Typz added a comment. > My question is: if CanBreak is false, we currently don't call > breakProtrudingToken. So either we do something very wrong in that case > (which might be true, but I'd like to understand why) or we should be able > to just calculate the penalty by not breaking anything and go on.
CanBreak is currently very short, it only verifies some very broad conditions. I initiallly tried patching at this level, but it really does not work. Most conditions are actually tested at the beginning of breakProtrudingToken. That part of the code actually takes different branches for different kind of tokens (strings, block commands, line comments...), and handles many different cases for each. This goal is to create the actual BreakableToken object, but it has a few other side effects: it returns immediately in various corner cases (javascript, preprocessor, formatting macros....), and it tweaks some variables, e.g. ColumnLimit. In addition, replacement is non trivial even in case we choose not to reflow: it is required in order to properly manage whitespaces. For this reason we really must pass through the loop in most cases. https://reviews.llvm.org/D33589 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits