Typz added a comment.

In https://reviews.llvm.org/D33589#875039, @djasper wrote:

> I think doing the computation twice is fine. Or at least, I'd need a test 
> case where it actually shows substantial overhead before doing what you are 
> doing here. Understand that creating more States and making the State object 
> itself larger also has cost and that cost occurs in the combinatorial 
> exploration of the solution space. Doing an additional computation at the end 
> should be comparatively cheap. Look at it this way: During the exploration of 
> the solution space, we might enter breakProtrudingToken many times for the 
> same comment. One more time during reconstruction of the solution is not that 
> harmful.


I 've just tried to implement this (e.g. make the 2 calls also in DryRun), and 
I am running into an assertion in WhitespaceManager :

  [ RUN      ] FormatTest.ConfigurableUseOfTab
  FormatTests: 
/workspace/llvm/tools/clang/lib/Format/WhitespaceManager.cpp:112: void 
clang::format::WhitespaceManager::calculateLineBreakInformation(): Assertion 
`PreviousOriginalWhitespaceEndOffset <= OriginalWhitespaceStartOffset' failed.

This remind there was another "reason" for limiting this to DryRun (not sure it 
is a good or bad reason): it happens only in the optimizer, all other cases 
where the indenter is used are not affected.

I am still trying to get to the bottom of this assertion, any hint where to 
look for?


https://reviews.llvm.org/D33589



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to