Extend test cases for tokens, and remove assertion that is unneeded and
hitting in Tokens.cpp.
Fixes Bugzilla https://bugs.llvm.org/show_bug.cgi?id=45428
Differential D77507
[clangd] Fix HitMapping assertion in Tokens.cpp vabridgers on Apr 5 2020, 11:49 AM. Authored by
Details
Extend test cases for tokens, and remove assertion that is unneeded and Fixes Bugzilla https://bugs.llvm.org/show_bug.cgi?id=45428
Diff Detail
Event TimelineComment Actions Thanks for tracking this down. Unfortunately I don't think removing the assertion is enough, the code doesn't handle this case correctly.
Comment Actions Oh dear, this seems like a design bug. TokenBuffer only attempts to record "top-level" expansions, i.e. FOO(BAR(BAZ)) will record the expansion of FOO, and say the tokens FOO ( BAR ( BAZ ) ) were expanded into some other thing in an essentially-opaque way.
The second seems more fundamental, so we should try patching the code to avoid the former. But I worry there are subtle assumptions of this scattered through... Comment Actions Thank you for the comments. I'll keep looking at this to find a proper fix, but any hints you may have would be greatly appreciated (debugging tips, strategies, areas of code to focus on). This code is new to me, so I may not be as efficient at tracking this down as yourself or Ilya. Best! Comment Actions Hope you don't mind, I ended up writing up a fix myself. (Well, I got frustrated with TokenBuffer's internals being complicated, and rewrote some of it in a way that makes this bug easy to fix.) D77615 is the proposed fix for this bug, and D77614 is the required refactoring. FWIW I don't have much great advice about debugging this stuff beyond minimizing the example as far as possible and instrumenting with lots of printfs... |
clang-format-diff not found in user's PATH; not linting file.