summaryrefslogtreecommitdiff
path: root/lib/Parse/ParseDecl.cpp
diff options
context:
space:
mode:
authorLeonard Chan <leonardchan@google.com>2019-05-12 21:50:01 +0000
committerLeonard Chan <leonardchan@google.com>2019-05-12 21:50:01 +0000
commit9f75477c36f6807d1604d4d07ab27d388115d708 (patch)
treebe9a96399de8e5ddf2a0bb9b83a3d0bf4cda38ab /lib/Parse/ParseDecl.cpp
parent589b82d1efbd3c1a97b41692370e32ddd3a65efc (diff)
downloadclang-9f75477c36f6807d1604d4d07ab27d388115d708.tar.gz
Fix for P41852 where builtin attributes were being caught by FindLocsWithCommonFileID().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360544 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseDecl.cpp')
-rw-r--r--lib/Parse/ParseDecl.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index 86fb8897e6..fe597ed2df 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/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());