Skip to content

Commit 0b77866

Browse files
committed
TEMPORARY SYNTAX CHANGE!
The original syntax for the attribute groups was ambiguous. For example: declare void @foo() #1 #0 = attributes { noinline } The '#0' would be parsed as an attribute reference for '@foo' and not as a top-level entity. In order to continue forward while waiting for a decision on what the correct syntax is, I'm changing it to this instead: declare void @foo() #1 attributes #0 = { noinline } Repeat: This is TEMPORARY until we decide what the correct syntax should be. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174813 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 1627425 commit 0b77866

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

lib/AsmParser/LLParser.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,6 @@ bool LLParser::ParseTopLevelEntities() {
233233
case lltok::GlobalVar: if (ParseNamedGlobal()) return true; break;
234234
case lltok::exclaim: if (ParseStandaloneMetadata()) return true; break;
235235
case lltok::MetadataVar:if (ParseNamedMetadata()) return true; break;
236-
case lltok::AttrGrpID: if (ParseUnnamedAttrGrp()) return true; break;
237236

238237
// The Global variable production with no name can have many different
239238
// optional leading prefixes, the production is:
@@ -279,6 +278,8 @@ bool LLParser::ParseTopLevelEntities() {
279278
case lltok::kw_global: // GlobalType
280279
if (ParseGlobal("", SMLoc(), 0, false, 0)) return true;
281280
break;
281+
282+
case lltok::kw_attributes: if (ParseUnnamedAttrGrp()) return true; break;
282283
}
283284
}
284285
}
@@ -800,16 +801,18 @@ bool LLParser::ParseGlobal(const std::string &Name, LocTy NameLoc,
800801
}
801802

802803
/// ParseUnnamedAttrGrp
803-
/// ::= AttrGrpID '=' '{' AttrValPair+ '}'
804+
/// ::= 'attributes' AttrGrpID '=' '{' AttrValPair+ '}'
804805
bool LLParser::ParseUnnamedAttrGrp() {
805-
assert(Lex.getKind() == lltok::AttrGrpID);
806+
assert(Lex.getKind() == lltok::kw_attributes);
806807
LocTy AttrGrpLoc = Lex.getLoc();
808+
Lex.Lex();
809+
810+
assert(Lex.getKind() == lltok::AttrGrpID);
807811
unsigned VarID = Lex.getUIntVal();
808812
std::vector<unsigned> unused;
809813
Lex.Lex();
810814

811815
if (ParseToken(lltok::equal, "expected '=' here") ||
812-
ParseToken(lltok::kw_attributes, "expected 'attributes' keyword here") ||
813816
ParseToken(lltok::lbrace, "expected '{' here") ||
814817
ParseFnAttributeValuePairs(NumberedAttrBuilders[VarID], unused, true) ||
815818
ParseToken(lltok::rbrace, "expected end of attribute group"))

0 commit comments

Comments
 (0)