llvm-project/clang/unittests/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
..
BuildTreeTest.cpp [clang] Fix missing template arguments in AST of access to member variable template 2022-09-21 00:46:18 +02:00
CMakeLists.txt [Testing] Drop clangTesting from clang's public library interface 2022-04-20 13:28:44 +02:00
MutationsTest.cpp [syntax] Introduce a TokenManager interface. 2022-07-15 10:30:37 +02:00
SynthesisTest.cpp [syntax] Introduce a TokenManager interface. 2022-07-15 10:30:37 +02:00
TokensTest.cpp [Syntax] Fix macro-arg handling in TokenBuffer::spelledForExpanded 2022-10-05 18:04:39 +02:00
TreeTest.cpp [syntax] Introduce a TokenManager interface. 2022-07-15 10:30:37 +02:00
TreeTestBase.cpp [syntax] Introduce a TokenManager interface. 2022-07-15 10:30:37 +02:00
TreeTestBase.h [syntax] Introduce a TokenManager interface. 2022-07-15 10:30:37 +02:00