[PATCH] D77615: [Syntax] Merge overlapping top-level macros in TokenBuffer

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 7 02:40:27 PDT 2020


kadircet accepted this revision.
kadircet added a comment.
This revision is now accepted and ready to land.

LGTM, thanks!



================
Comment at: clang/lib/Tooling/Syntax/Tokens.cpp:452
+
+    // The *last* token of the macro reference is in the main file for A and B.
+    if (Range.getEnd().isMacroID())
----------------
instead of saying `A and B` maybe say something like, a `the last token for a top-level macro expansion must be inside a file` and invert the following condition:

`if(!Range.getEnd().isFileID()) return;`


================
Comment at: clang/lib/Tooling/Syntax/Tokens.cpp:461
+
+    // If the macro invocation B starts in a macro A but ends in a file, we'll
+    // create a merged mapping for A & B by overwriting the endpoint for A's
----------------
maybe put As and Bs in parentheses, i.e:
```
// If the macro invocation (B) starts in a macro (A) but ends in a file, we'll
    // create a merged mapping (for A & B) by overwriting the endpoint for parent's (A's)
    // startpoint.
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77615/new/

https://reviews.llvm.org/D77615





More information about the cfe-commits mailing list