after their syntactic form, not their semantic form.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92294
91177308-0d34-0410-b5e6-
96231b3b80d8
case ';':
SkipLineComment();
return LexToken();
case ';':
SkipLineComment();
return LexToken();
- case '!': return LexMetadata();
+ case '!': return LexExclaim();
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
case '-':
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
case '-':
/// !{...}
/// !42
/// !foo
/// !{...}
/// !42
/// !foo
-lltok::Kind LLLexer::LexMetadata() {
+lltok::Kind LLLexer::LexExclaim() {
if (isalpha(CurPtr[0])) {
++CurPtr;
while (isalnum(CurPtr[0]) || CurPtr[0] == '-' || CurPtr[0] == '$' ||
if (isalpha(CurPtr[0])) {
++CurPtr;
while (isalnum(CurPtr[0]) || CurPtr[0] == '-' || CurPtr[0] == '$' ||
StrVal.assign(TokStart+1, CurPtr); // Skip !
return lltok::NamedOrCustomMD;
}
StrVal.assign(TokStart+1, CurPtr); // Skip !
return lltok::NamedOrCustomMD;
}
- return lltok::Metadata;
}
/// LexIdentifier: Handle several related productions:
}
/// LexIdentifier: Handle several related productions:
lltok::Kind LexDigitOrNegative();
lltok::Kind LexPositive();
lltok::Kind LexAt();
lltok::Kind LexDigitOrNegative();
lltok::Kind LexPositive();
lltok::Kind LexAt();
- lltok::Kind LexMetadata();
+ lltok::Kind LexExclaim();
lltok::Kind LexPercent();
lltok::Kind LexQuote();
lltok::Kind Lex0x();
lltok::Kind LexPercent();
lltok::Kind LexQuote();
lltok::Kind Lex0x();
case lltok::LocalVar: if (ParseNamedType()) return true; break;
case lltok::GlobalID: if (ParseUnnamedGlobal()) return true; break;
case lltok::GlobalVar: if (ParseNamedGlobal()) return true; break;
case lltok::LocalVar: if (ParseNamedType()) return true; break;
case lltok::GlobalID: if (ParseUnnamedGlobal()) return true; break;
case lltok::GlobalVar: if (ParseNamedGlobal()) return true; break;
- case lltok::Metadata: if (ParseStandaloneMetadata()) return true; break;
+ case lltok::exclaim: if (ParseStandaloneMetadata()) return true; break;
case lltok::NamedOrCustomMD: if (ParseNamedMetadata()) return true; break;
// The Global variable production with no name can have many different
case lltok::NamedOrCustomMD: if (ParseNamedMetadata()) return true; break;
// The Global variable production with no name can have many different
std::string Name = Lex.getStrVal();
if (ParseToken(lltok::equal, "expected '=' here") ||
std::string Name = Lex.getStrVal();
if (ParseToken(lltok::equal, "expected '=' here") ||
- ParseToken(lltok::Metadata, "Expected '!' here") ||
+ ParseToken(lltok::exclaim, "Expected '!' here") ||
ParseToken(lltok::lbrace, "Expected '{' here"))
return true;
SmallVector<MetadataBase *, 8> Elts;
do {
ParseToken(lltok::lbrace, "Expected '{' here"))
return true;
SmallVector<MetadataBase *, 8> Elts;
do {
- if (ParseToken(lltok::Metadata, "Expected '!' here"))
+ if (ParseToken(lltok::exclaim, "Expected '!' here"))
return true;
// FIXME: This rejects MDStrings. Are they legal in an named MDNode or not?
return true;
// FIXME: This rejects MDStrings. Are they legal in an named MDNode or not?
/// ParseStandaloneMetadata:
/// !42 = !{...}
bool LLParser::ParseStandaloneMetadata() {
/// ParseStandaloneMetadata:
/// !42 = !{...}
bool LLParser::ParseStandaloneMetadata() {
- assert(Lex.getKind() == lltok::Metadata);
+ assert(Lex.getKind() == lltok::exclaim);
Lex.Lex();
unsigned MetadataID = 0;
Lex.Lex();
unsigned MetadataID = 0;
if (ParseUInt32(MetadataID) ||
ParseToken(lltok::equal, "expected '=' here") ||
ParseType(Ty, TyLoc) ||
if (ParseUInt32(MetadataID) ||
ParseToken(lltok::equal, "expected '=' here") ||
ParseType(Ty, TyLoc) ||
- ParseToken(lltok::Metadata, "Expected metadata here") ||
+ ParseToken(lltok::exclaim, "Expected '!' here") ||
ParseToken(lltok::lbrace, "Expected '{' here") ||
ParseMDNodeVector(Elts) ||
ParseToken(lltok::rbrace, "expected end of metadata node"))
ParseToken(lltok::lbrace, "Expected '{' here") ||
ParseMDNodeVector(Elts) ||
ParseToken(lltok::rbrace, "expected end of metadata node"))
std::string Name = Lex.getStrVal();
Lex.Lex();
std::string Name = Lex.getStrVal();
Lex.Lex();
- if (Lex.getKind() != lltok::Metadata)
- return TokError("expected '!' here");
- Lex.Lex();
-
- if (ParseMDNodeID(Node)) return true;
+ if (ParseToken(lltok::exclaim, "expected '!' here") ||
+ ParseMDNodeID(Node))
+ return true;
unsigned MDK = M->getMDKindID(Name.c_str());
MDsOnInst.push_back(std::make_pair(MDK, Node));
unsigned MDK = M->getMDKindID(Name.c_str());
MDsOnInst.push_back(std::make_pair(MDK, Node));
ID.StrVal = Lex.getStrVal();
ID.Kind = ValID::t_LocalName;
break;
ID.StrVal = Lex.getStrVal();
ID.Kind = ValID::t_LocalName;
break;
- case lltok::Metadata: // !{...} MDNode, !"foo" MDString
+ case lltok::exclaim: // !{...} MDNode, !"foo" MDString
Lex.Lex();
// FIXME: This doesn't belong here.
Lex.Lex();
// FIXME: This doesn't belong here.
less, greater, // < >
lparen, rparen, // ( )
backslash, // \ (not /)
less, greater, // < >
lparen, rparen, // ( )
backslash, // \ (not /)
StringConstant, // "foo"
NamedOrCustomMD, // !foo
StringConstant, // "foo"
NamedOrCustomMD, // !foo
- // Metadata valued tokens.
- Metadata, // !"foo" !{i8 42}
-
// Type valued tokens (TyVal).
Type,
// Type valued tokens (TyVal).
Type,