summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCParser/AsmParser.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-07-12 19:22:53 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-07-12 19:22:53 +0000
commit63a379dd5c8b8d96100ccad1f06ad00bb6f524c1 (patch)
tree5a4fe36c2c6c34cb3b038877a8a1b679a4d097da /llvm/lib/MC/MCParser/AsmParser.cpp
parentfdec08bd8b1395c9b29b4912f63e99f03226185f (diff)
downloadbcm5719-llvm-63a379dd5c8b8d96100ccad1f06ad00bb6f524c1.tar.gz
bcm5719-llvm-63a379dd5c8b8d96100ccad1f06ad00bb6f524c1.zip
MC/AsmParser: Move .desc parsing to Darwin specific parser.
llvm-svn: 108179
Diffstat (limited to 'llvm/lib/MC/MCParser/AsmParser.cpp')
-rw-r--r--llvm/lib/MC/MCParser/AsmParser.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp
index e976c0a0b74..b9139fe5af6 100644
--- a/llvm/lib/MC/MCParser/AsmParser.cpp
+++ b/llvm/lib/MC/MCParser/AsmParser.cpp
@@ -66,6 +66,8 @@ public:
// Call the base implementation.
this->MCAsmParserExtension::Initialize(Parser);
+ Parser.AddDirectiveHandler(this, ".desc", MCAsmParser::DirectiveHandler(
+ &DarwinAsmParser::ParseDirectiveDesc));
Parser.AddDirectiveHandler(this, ".lsym", MCAsmParser::DirectiveHandler(
&DarwinAsmParser::ParseDirectiveLsym));
Parser.AddDirectiveHandler(this, ".subsections_via_symbols",
@@ -83,6 +85,7 @@ public:
&DarwinAsmParser::ParseDirectiveSecureLogReset));
}
+ bool ParseDirectiveDesc(StringRef, SMLoc);
bool ParseDirectiveDumpOrLoad(StringRef, SMLoc);
bool ParseDirectiveLsym(StringRef, SMLoc);
bool ParseDirectiveSecureLogReset(StringRef, SMLoc);
@@ -837,8 +840,6 @@ bool AsmParser::ParseStatement() {
return ParseDirectiveComm(/*IsLocal=*/true);
if (IDVal == ".zerofill")
return ParseDirectiveDarwinZerofill();
- if (IDVal == ".desc")
- return ParseDirectiveDarwinSymbolDesc();
if (IDVal == ".tbss")
return ParseDirectiveDarwinTBSS();
@@ -1431,22 +1432,22 @@ bool AsmParser::ParseDirectiveELFType() {
return false;
}
-/// ParseDirectiveDarwinSymbolDesc
+/// ParseDirectiveDesc
/// ::= .desc identifier , expression
-bool AsmParser::ParseDirectiveDarwinSymbolDesc() {
+bool DarwinAsmParser::ParseDirectiveDesc(StringRef, SMLoc) {
StringRef Name;
- if (ParseIdentifier(Name))
+ if (getParser().ParseIdentifier(Name))
return TokError("expected identifier in directive");
// Handle the identifier as the key symbol.
- MCSymbol *Sym = CreateSymbol(Name);
+ MCSymbol *Sym = getContext().GetOrCreateSymbol(Name);
if (getLexer().isNot(AsmToken::Comma))
return TokError("unexpected token in '.desc' directive");
Lex();
int64_t DescValue;
- if (ParseAbsoluteExpression(DescValue))
+ if (getParser().ParseAbsoluteExpression(DescValue))
return true;
if (getLexer().isNot(AsmToken::EndOfStatement))
OpenPOWER on IntegriCloud