Added llvm-mc support for parsing the .abort directive.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75545 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Kevin Enderby
2009-07-13 23:15:14 +00:00
parent 45f91b70c4
commit 5f1f0b8f7e
5 changed files with 52 additions and 0 deletions

View File

@@ -529,6 +529,8 @@ bool AsmParser::ParseStatement() {
if (!strcmp(IDVal, ".subsections_via_symbols"))
return ParseDirectiveDarwinSubsectionsViaSymbols();
if (!strcmp(IDVal, ".abort"))
return ParseDirectiveAbort();
Warning(IDLoc, "ignoring directive for now");
EatToEndOfStatement();
@@ -1068,3 +1070,26 @@ bool AsmParser::ParseDirectiveDarwinSubsectionsViaSymbols() {
return false;
}
/// ParseDirectiveAbort
/// ::= .abort [ "abort_string" ]
bool AsmParser::ParseDirectiveAbort() {
const char *Str = NULL;
if (Lexer.isNot(asmtok::EndOfStatement)) {
if (Lexer.isNot(asmtok::String))
return TokError("expected string in '.abort' directive");
Str = Lexer.getCurStrVal();
Lexer.Lex();
}
if (Lexer.isNot(asmtok::EndOfStatement))
return TokError("unexpected token in '.abort' directive");
Lexer.Lex();
Out.AbortAssembly(Str);
return false;
}

View File

@@ -115,6 +115,8 @@ private:
// Darwin specific ".subsections_via_symbols"
bool ParseDirectiveDarwinSubsectionsViaSymbols();
bool ParseDirectiveAbort(); // ".abort"
};
} // end namespace llvm