diff options
author | Leonard Chan <leonardchan@google.com> | 2019-05-12 21:50:01 +0000 |
---|---|---|
committer | Leonard Chan <leonardchan@google.com> | 2019-05-12 21:50:01 +0000 |
commit | 69aec05bb15528d388b65f4b3012e2fe7e732078 (patch) | |
tree | e856e20c005be50e1872305fc4d3f11206c31200 /clang/lib/Parse/ParseDecl.cpp | |
parent | a7fc7630829b93247e8dc11df93ce155158a49fd (diff) | |
download | llvm-69aec05bb15528d388b65f4b3012e2fe7e732078.zip llvm-69aec05bb15528d388b65f4b3012e2fe7e732078.tar.gz llvm-69aec05bb15528d388b65f4b3012e2fe7e732078.tar.bz2 |
Fix for P41852 where builtin attributes were being caught by FindLocsWithCommonFileID().
llvm-svn: 360544
Diffstat (limited to 'clang/lib/Parse/ParseDecl.cpp')
-rw-r--r-- | clang/lib/Parse/ParseDecl.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
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 @@ void Parser::ParseGNUAttributes(ParsedAttributes &attrs, // 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()); |