Revert "[Attribute/Diagnostics] Print macro if definition is an attribute declaration"
This reverts commit fc40cbd9d8c63e65eed3590ba925321afe782e1d.
llvm-svn: 359859
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp
index 4e5ca2e..130cd9f2 100644
--- a/clang/lib/Parse/ParseDecl.cpp
+++ b/clang/lib/Parse/ParseDecl.cpp
@@ -85,23 +85,6 @@
#undef CLANG_ATTR_LATE_PARSED_LIST
}
-/// Check if the a start and end source location expand to the same macro.
-bool FindLocsWithCommonFileID(Preprocessor &PP, SourceLocation StartLoc,
- SourceLocation EndLoc) {
- if (!StartLoc.isMacroID() || !EndLoc.isMacroID())
- return false;
-
- SourceManager &SM = PP.getSourceManager();
- if (SM.getFileID(StartLoc) != SM.getFileID(EndLoc))
- return false;
-
- bool AttrStartIsInMacro =
- Lexer::isAtStartOfMacroExpansion(StartLoc, SM, PP.getLangOpts());
- bool AttrEndIsInMacro =
- Lexer::isAtEndOfMacroExpansion(EndLoc, SM, PP.getLangOpts());
- return AttrStartIsInMacro && AttrEndIsInMacro;
-}
-
/// ParseGNUAttributes - Parse a non-empty attributes list.
///
/// [GNU] attributes:
@@ -150,10 +133,7 @@
assert(Tok.is(tok::kw___attribute) && "Not a GNU attribute list!");
while (Tok.is(tok::kw___attribute)) {
- SourceLocation AttrTokLoc = ConsumeToken();
- unsigned OldNumAttrs = attrs.size();
- unsigned OldNumLateAttrs = LateAttrs ? LateAttrs->size() : 0;
-
+ ConsumeToken();
if (ExpectAndConsume(tok::l_paren, diag::err_expected_lparen_after,
"attribute")) {
SkipUntil(tok::r_paren, StopAtSemi); // skip until ) or ;
@@ -221,24 +201,6 @@
SkipUntil(tok::r_paren, StopAtSemi);
if (endLoc)
*endLoc = Loc;
-
- // If this was declared in a macro, attach the macro IdentifierInfo to the
- // parsed attribute.
- if (FindLocsWithCommonFileID(PP, AttrTokLoc, Loc)) {
- auto &SM = PP.getSourceManager();
- CharSourceRange ExpansionRange = SM.getExpansionRange(AttrTokLoc);
- StringRef FoundName =
- Lexer::getSourceText(ExpansionRange, SM, PP.getLangOpts());
- IdentifierInfo *MacroII = PP.getIdentifierInfo(FoundName);
-
- for (unsigned i = OldNumAttrs; i < attrs.size(); ++i)
- attrs[i].setMacroIdentifier(MacroII, ExpansionRange.getBegin());
-
- if (LateAttrs) {
- for (unsigned i = OldNumLateAttrs; i < LateAttrs->size(); ++i)
- (*LateAttrs)[i]->MacroII = MacroII;
- }
- }
}
}