[PATCH] D140164: [clang/Lexer] Enhance `Lexer::getImmediateMacroNameForDiagnostics` to return a result from non-file buffers

Steven Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 15 15:12:06 PST 2022


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

LGTM



================
Comment at: clang/lib/Lex/Lexer.cpp:1050
 
-  // If the macro's spelling has no FileID, then it's actually a token paste
-  // or stringization (or similar) and not a macro at all.
-  if (!SM.getFileEntryForID(SM.getFileID(SM.getSpellingLoc(Loc))))
+  // If the macro's spelling isn't FileID or came from the scratch space, then
+  // it's actually a token paste or stringization (or similar) and not a macro
----------------
nit: isn't FileID or from scratch space


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140164



More information about the cfe-commits mailing list