[clang/Lexer] Enhance `Lexer::getImmediateMacroNameForDiagnostics` to return a result...
authorArgyrios Kyrtzidis <kyrtzidis@apple.com>
Thu, 15 Dec 2022 21:33:17 +0000 (13:33 -0800)
committerArgyrios Kyrtzidis <kyrtzidis@apple.com>
Fri, 16 Dec 2022 06:46:41 +0000 (22:46 -0800)
commit59df56413bdc25bef53bf1629b26bd2176089088
treeb91fb8d9471bccb22eb4b907812dd2dbc211fffe
parent982a586ab481d5470a732c8eec898cb72d789b0e
[clang/Lexer] Enhance `Lexer::getImmediateMacroNameForDiagnostics` to return a result from non-file buffers

Use `SourceManager::isWrittenInScratchSpace()` to specifically check for token paste or stringization, instead of
excluding all non-file buffers. This allows diagnostics to mention macro names that were defined from the command-line.

Differential Revision: https://reviews.llvm.org/D140164
clang/lib/Lex/Lexer.cpp
clang/test/Modules/build-fail-notes.m
clang/test/Modules/epic-fail.m