1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 12:41:49 +01:00

rename lltok::Metadata -> lltok::exclaim. We name tokens

after their syntactic form, not their semantic form.

llvm-svn: 92294
This commit is contained in:
Chris Lattner 2009-12-30 04:56:59 +00:00
parent 6664b8bd4d
commit 2e5b6d96ac
4 changed files with 15 additions and 19 deletions

View File

@ -254,7 +254,7 @@ lltok::Kind LLLexer::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 '-':
@ -422,11 +422,11 @@ static bool JustWhitespaceNewLine(const char *&Ptr) {
return false;
}
/// LexMetadata:
/// LexExclaim:
/// !{...}
/// !42
/// !foo
lltok::Kind LLLexer::LexMetadata() {
lltok::Kind LLLexer::LexExclaim() {
if (isalpha(CurPtr[0])) {
++CurPtr;
while (isalnum(CurPtr[0]) || CurPtr[0] == '-' || CurPtr[0] == '$' ||
@ -436,7 +436,7 @@ lltok::Kind LLLexer::LexMetadata() {
StrVal.assign(TokStart+1, CurPtr); // Skip !
return lltok::NamedOrCustomMD;
}
return lltok::Metadata;
return lltok::exclaim;
}
/// LexIdentifier: Handle several related productions:

View File

@ -75,7 +75,7 @@ namespace llvm {
lltok::Kind LexDigitOrNegative();
lltok::Kind LexPositive();
lltok::Kind LexAt();
lltok::Kind LexMetadata();
lltok::Kind LexExclaim();
lltok::Kind LexPercent();
lltok::Kind LexQuote();
lltok::Kind Lex0x();

View File

@ -168,7 +168,7 @@ bool LLParser::ParseTopLevelEntities() {
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
@ -506,13 +506,13 @@ bool LLParser::ParseNamedMetadata() {
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 {
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?
@ -531,7 +531,7 @@ bool LLParser::ParseNamedMetadata() {
/// ParseStandaloneMetadata:
/// !42 = !{...}
bool LLParser::ParseStandaloneMetadata() {
assert(Lex.getKind() == lltok::Metadata);
assert(Lex.getKind() == lltok::exclaim);
Lex.Lex();
unsigned MetadataID = 0;
@ -542,7 +542,7 @@ bool LLParser::ParseStandaloneMetadata() {
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"))
@ -1074,12 +1074,10 @@ bool LLParser::ParseOptionalCustomMetadata() {
std::string Name = Lex.getStrVal();
Lex.Lex();
if (Lex.getKind() != lltok::Metadata)
return TokError("expected '!' here");
Lex.Lex();
MDNode *Node;
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));
@ -1890,7 +1888,7 @@ bool LLParser::ParseValID(ValID &ID) {
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.

View File

@ -29,6 +29,7 @@ namespace lltok {
less, greater, // < >
lparen, rparen, // ( )
backslash, // \ (not /)
exclaim, // !
kw_x,
kw_begin, kw_end,
@ -131,9 +132,6 @@ namespace lltok {
StringConstant, // "foo"
NamedOrCustomMD, // !foo
// Metadata valued tokens.
Metadata, // !"foo" !{i8 42}
// Type valued tokens (TyVal).
Type,