summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-07-27 23:20:52 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-07-27 23:20:52 +0000
commitf9507ffa5b1c8697009e86bbedaacb51e4c6735d (patch)
treeb207aaebc34228cb61beaa84809ba1f6131666d4 /tools
parent02efa786d40fabae6dbbb3de5ab057359701e337 (diff)
downloadllvm-f9507ffa5b1c8697009e86bbedaacb51e4c6735d.tar.gz
llvm-f9507ffa5b1c8697009e86bbedaacb51e4c6735d.tar.bz2
llvm-f9507ffa5b1c8697009e86bbedaacb51e4c6735d.tar.xz
llvm-mc: Implement .abort fully in the front end
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77272 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r--tools/llvm-mc/AsmParser.cpp17
-rw-r--r--tools/llvm-mc/AsmParser.h5
-rw-r--r--tools/llvm-mc/MC-X86Specific.cpp1
3 files changed, 16 insertions, 7 deletions
diff --git a/tools/llvm-mc/AsmParser.cpp b/tools/llvm-mc/AsmParser.cpp
index 371a58e6ca..65d48b23cb 100644
--- a/tools/llvm-mc/AsmParser.cpp
+++ b/tools/llvm-mc/AsmParser.cpp
@@ -14,6 +14,7 @@
#include "AsmParser.h"
#include "AsmExpr.h"
+#include "llvm/ADT/Twine.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCInst.h"
#include "llvm/MC/MCStreamer.h"
@@ -23,12 +24,12 @@
#include "llvm/Target/TargetAsmParser.h"
using namespace llvm;
-void AsmParser::Warning(SMLoc L, const char *Msg) {
- Lexer.PrintMessage(L, Msg, "warning");
+void AsmParser::Warning(SMLoc L, const Twine &Msg) {
+ Lexer.PrintMessage(L, Msg.str(), "warning");
}
-bool AsmParser::Error(SMLoc L, const char *Msg) {
- Lexer.PrintMessage(L, Msg, "error");
+bool AsmParser::Error(SMLoc L, const Twine &Msg) {
+ Lexer.PrintMessage(L, Msg.str(), "error");
return true;
}
@@ -1117,6 +1118,9 @@ bool AsmParser::ParseDirectiveDarwinSubsectionsViaSymbols() {
/// ParseDirectiveAbort
/// ::= .abort [ "abort_string" ]
bool AsmParser::ParseDirectiveAbort() {
+ // FIXME: Use loc from directive.
+ SMLoc Loc = Lexer.getLoc();
+
StringRef Str = "";
if (Lexer.isNot(asmtok::EndOfStatement)) {
if (Lexer.isNot(asmtok::String))
@@ -1133,7 +1137,10 @@ bool AsmParser::ParseDirectiveAbort() {
Lexer.Lex();
// FIXME: Handle here.
- Out.AbortAssembly(Str.str().c_str());
+ if (Str.empty())
+ Error(Loc, ".abort detected. Assembly stopping.");
+ else
+ Error(Loc, ".abort '" + Str + "' detected. Assembly stopping.");
return false;
}
diff --git a/tools/llvm-mc/AsmParser.h b/tools/llvm-mc/AsmParser.h
index 3d9842e642..dd6033847b 100644
--- a/tools/llvm-mc/AsmParser.h
+++ b/tools/llvm-mc/AsmParser.h
@@ -25,6 +25,7 @@ class MCInst;
class MCStreamer;
class MCValue;
class TargetAsmParser;
+class Twine;
class AsmParser : MCAsmParser {
public:
@@ -52,8 +53,8 @@ public:
private:
bool ParseStatement();
- void Warning(SMLoc L, const char *Msg);
- bool Error(SMLoc L, const char *Msg);
+ void Warning(SMLoc L, const Twine &Msg);
+ bool Error(SMLoc L, const Twine &Msg);
bool TokError(const char *Msg);
void EatToEndOfStatement();
diff --git a/tools/llvm-mc/MC-X86Specific.cpp b/tools/llvm-mc/MC-X86Specific.cpp
index d16bb15d38..6e28b028c3 100644
--- a/tools/llvm-mc/MC-X86Specific.cpp
+++ b/tools/llvm-mc/MC-X86Specific.cpp
@@ -13,6 +13,7 @@
//===----------------------------------------------------------------------===//
#include "AsmParser.h"
+#include "llvm/ADT/Twine.h"
#include "llvm/MC/MCInst.h"
#include "llvm/Support/SourceMgr.h"
using namespace llvm;