Fix for P41852 where builtin attributes were being caught by FindLocsWithCommonFileID().
llvm-svn: 360544
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp
index 86fb889..fe597ed 100644
--- a/clang/lib/Parse/ParseDecl.cpp
+++ b/clang/lib/Parse/ParseDecl.cpp
@@ -224,8 +224,9 @@
// If this was declared in a macro, attach the macro IdentifierInfo to the
// parsed attribute.
- if (FindLocsWithCommonFileID(PP, AttrTokLoc, Loc)) {
- auto &SM = PP.getSourceManager();
+ auto &SM = PP.getSourceManager();
+ if (!SM.isWrittenInBuiltinFile(SM.getSpellingLoc(AttrTokLoc)) &&
+ FindLocsWithCommonFileID(PP, AttrTokLoc, Loc)) {
CharSourceRange ExpansionRange = SM.getExpansionRange(AttrTokLoc);
StringRef FoundName =
Lexer::getSourceText(ExpansionRange, SM, PP.getLangOpts());