[llvm-commits] [llvm] r108179 - in /llvm/trunk: include/llvm/MC/MCParser/AsmParser.h lib/MC/MCParser/AsmParser.cpp test/MC/AsmParser/directive_desc.s
Daniel Dunbar
daniel at zuster.org
Mon Jul 12 12:22:53 PDT 2010
Author: ddunbar
Date: Mon Jul 12 14:22:53 2010
New Revision: 108179
URL: http://llvm.org/viewvc/llvm-project?rev=108179&view=rev
Log:
MC/AsmParser: Move .desc parsing to Darwin specific parser.
Modified:
llvm/trunk/include/llvm/MC/MCParser/AsmParser.h
llvm/trunk/lib/MC/MCParser/AsmParser.cpp
llvm/trunk/test/MC/AsmParser/directive_desc.s
Modified: llvm/trunk/include/llvm/MC/MCParser/AsmParser.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCParser/AsmParser.h?rev=108179&r1=108178&r2=108179&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCParser/AsmParser.h (original)
+++ llvm/trunk/include/llvm/MC/MCParser/AsmParser.h Mon Jul 12 14:22:53 2010
@@ -137,7 +137,6 @@
/// accepts a single symbol (which should be a label or an external).
bool ParseDirectiveSymbolAttribute(MCSymbolAttr Attr);
bool ParseDirectiveELFType(); // ELF specific ".type"
- bool ParseDirectiveDarwinSymbolDesc(); // Darwin specific ".desc"
bool ParseDirectiveComm(bool IsLocal); // ".comm" and ".lcomm"
bool ParseDirectiveDarwinZerofill(); // Darwin specific ".zerofill"
Modified: llvm/trunk/lib/MC/MCParser/AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/AsmParser.cpp?rev=108179&r1=108178&r2=108179&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCParser/AsmParser.cpp (original)
+++ llvm/trunk/lib/MC/MCParser/AsmParser.cpp Mon Jul 12 14:22:53 2010
@@ -66,6 +66,8 @@
// 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 @@
&DarwinAsmParser::ParseDirectiveSecureLogReset));
}
+ bool ParseDirectiveDesc(StringRef, SMLoc);
bool ParseDirectiveDumpOrLoad(StringRef, SMLoc);
bool ParseDirectiveLsym(StringRef, SMLoc);
bool ParseDirectiveSecureLogReset(StringRef, SMLoc);
@@ -837,8 +840,6 @@
return ParseDirectiveComm(/*IsLocal=*/true);
if (IDVal == ".zerofill")
return ParseDirectiveDarwinZerofill();
- if (IDVal == ".desc")
- return ParseDirectiveDarwinSymbolDesc();
if (IDVal == ".tbss")
return ParseDirectiveDarwinTBSS();
@@ -1431,22 +1432,22 @@
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))
Modified: llvm/trunk/test/MC/AsmParser/directive_desc.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/directive_desc.s?rev=108179&r1=108178&r2=108179&view=diff
==============================================================================
--- llvm/trunk/test/MC/AsmParser/directive_desc.s (original)
+++ llvm/trunk/test/MC/AsmParser/directive_desc.s Mon Jul 12 14:22:53 2010
@@ -1,4 +1,4 @@
-# RUN: llvm-mc -triple i386-unknown-unknown %s | FileCheck %s
+# RUN: llvm-mc -triple i386-apple-darwin9 %s | FileCheck %s
# CHECK: TEST0:
# CHECK: .desc foo,16
More information about the llvm-commits
mailing list