diff options
author | Bill Wendling <isanbard@gmail.com> | 2013-02-09 15:48:49 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2013-02-09 15:48:49 +0000 |
commit | a7c3877dc702f2d54e8c4dd184dc49937fbc95f5 (patch) | |
tree | a1a445b328ced84a733221958adfd06e2e4ccd82 | |
parent | 33ab8a2187b9e14355646f9dd2ff472e0965a7c6 (diff) | |
download | bcm5719-llvm-a7c3877dc702f2d54e8c4dd184dc49937fbc95f5.tar.gz bcm5719-llvm-a7c3877dc702f2d54e8c4dd184dc49937fbc95f5.zip |
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.
llvm-svn: 174813
-rw-r--r-- | llvm/lib/AsmParser/LLParser.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp index 6f076e27b72..76eb5965ddd 100644 --- a/llvm/lib/AsmParser/LLParser.cpp +++ b/llvm/lib/AsmParser/LLParser.cpp @@ -233,7 +233,6 @@ bool LLParser::ParseTopLevelEntities() { case lltok::GlobalVar: if (ParseNamedGlobal()) return true; break; case lltok::exclaim: if (ParseStandaloneMetadata()) return true; break; case lltok::MetadataVar:if (ParseNamedMetadata()) return true; break; - case lltok::AttrGrpID: if (ParseUnnamedAttrGrp()) return true; break; // The Global variable production with no name can have many different // optional leading prefixes, the production is: @@ -279,6 +278,8 @@ bool LLParser::ParseTopLevelEntities() { case lltok::kw_global: // GlobalType if (ParseGlobal("", SMLoc(), 0, false, 0)) return true; break; + + case lltok::kw_attributes: if (ParseUnnamedAttrGrp()) return true; break; } } } @@ -800,16 +801,18 @@ bool LLParser::ParseGlobal(const std::string &Name, LocTy NameLoc, } /// ParseUnnamedAttrGrp -/// ::= AttrGrpID '=' '{' AttrValPair+ '}' +/// ::= 'attributes' AttrGrpID '=' '{' AttrValPair+ '}' bool LLParser::ParseUnnamedAttrGrp() { - assert(Lex.getKind() == lltok::AttrGrpID); + assert(Lex.getKind() == lltok::kw_attributes); LocTy AttrGrpLoc = Lex.getLoc(); + Lex.Lex(); + + assert(Lex.getKind() == lltok::AttrGrpID); unsigned VarID = Lex.getUIntVal(); std::vector<unsigned> unused; Lex.Lex(); if (ParseToken(lltok::equal, "expected '=' here") || - ParseToken(lltok::kw_attributes, "expected 'attributes' keyword here") || ParseToken(lltok::lbrace, "expected '{' here") || ParseFnAttributeValuePairs(NumberedAttrBuilders[VarID], unused, true) || ParseToken(lltok::rbrace, "expected end of attribute group")) |