[PATCH] D139676: [libTooling] Add flag to getRangeForEdit to ignore macro expansions

Yitzhak Mandelbaum via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 8 19:19:39 PST 2022


ymandel accepted this revision.
ymandel added inline comments.
This revision is now accepted and ready to land.


================
Comment at: clang/lib/Tooling/Transformer/SourceCode.cpp:90-92
+      Loc = Expansion.getExpansionLocStart();
+      if (Loc.isFileID())
+        return true;
----------------
can you comment on the logic here? Why isn't this just "return true", since it's in a macro but not a part of a macro arg, I'd think it must be part of a macro definition.


================
Comment at: clang/lib/Tooling/Transformer/SourceCode.cpp:111-113
+    if (EditRange.isTokenRange()) {
+      E = Lexer::getLocForEndOfToken(E, 0, SM, LangOpts);
+    }
----------------
LLVM style doesn't use braces for single-line ifs.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139676



More information about the cfe-commits mailing list