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
diff --git a/tools/llvm-mc/AsmParser.cpp b/tools/llvm-mc/AsmParser.cpp
index fe9d4f3..c105801 100644
--- a/tools/llvm-mc/AsmParser.cpp
+++ b/tools/llvm-mc/AsmParser.cpp
@@ -529,6 +529,8 @@
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 @@
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;
+}