llvm-project/clang/lib/Tooling/Syntax
Sam McCall 67268ee11c [Syntax] Fix macro-arg handling in TokenBuffer::spelledForExpanded
A few cases were not handled correctly. Notably:
  #define ID(X) X
  #define HIDE a ID(b)
  HIDE
spelledForExpanded() would claim HIDE is an equivalent range of the 'b' it
contains, despite the fact that HIDE also covers 'a'.

While trying to fix this bug, I found findCommonRangeForMacroArgs hard
to understand (both the implementation and how it's used in spelledForExpanded).
It relies on details of the SourceLocation graph that are IMO fairly obscure.
So I've added/revised quite a lot of comments and made some naming tweaks.

Fixes https://github.com/clangd/clangd/issues/1289

Differential Revision: https://reviews.llvm.org/D134618
2022-10-05 18:04:39 +02:00
..
BuildTree.cpp [syntax] Introduce a TokenManager interface. 2022-07-15 10:30:37 +02:00
CMakeLists.txt [syntax] Introduce a TokenManager interface. 2022-07-15 10:30:37 +02:00
ComputeReplacements.cpp [syntax] Introduce a TokenManager interface. 2022-07-15 10:30:37 +02:00
Mutations.cpp [syntax] Introduce a TokenManager interface. 2022-07-15 10:30:37 +02:00
Nodes.cpp [syntax] Some #includes cleanup, NFC. 2022-07-15 21:05:59 +02:00
Synthesis.cpp [syntax] Introduce a TokenManager interface. 2022-07-15 10:30:37 +02:00
TokenBufferTokenManager.cpp [syntax] Introduce a TokenManager interface. 2022-07-15 10:30:37 +02:00
Tokens.cpp [Syntax] Fix macro-arg handling in TokenBuffer::spelledForExpanded 2022-10-05 18:04:39 +02:00
Tree.cpp [syntax] Some #includes cleanup, NFC. 2022-07-15 21:05:59 +02:00