aboutsummaryrefslogtreecommitdiff
path: root/tools/llvm-mc
diff options
context:
space:
mode:
Diffstat (limited to 'tools/llvm-mc')
-rw-r--r--tools/llvm-mc/AsmLexer.cpp7
-rw-r--r--tools/llvm-mc/AsmLexer.h2
-rw-r--r--tools/llvm-mc/AsmParser.cpp18
-rw-r--r--tools/llvm-mc/AsmParser.h3
-rw-r--r--tools/llvm-mc/llvm-mc.cpp2
5 files changed, 19 insertions, 13 deletions
diff --git a/tools/llvm-mc/AsmLexer.cpp b/tools/llvm-mc/AsmLexer.cpp
index 931f3b2ee0..7b744fbde6 100644
--- a/tools/llvm-mc/AsmLexer.cpp
+++ b/tools/llvm-mc/AsmLexer.cpp
@@ -42,14 +42,15 @@ SMLoc AsmLexer::getLoc() const {
return SMLoc::getFromPointer(TokStart);
}
-void AsmLexer::PrintMessage(SMLoc Loc, const std::string &Msg) const {
- SrcMgr.PrintMessage(Loc, Msg);
+void AsmLexer::PrintMessage(SMLoc Loc, const std::string &Msg,
+ const char *Type) const {
+ SrcMgr.PrintMessage(Loc, Msg, Type);
}
/// ReturnError - Set the error to the specified string at the specified
/// location. This is defined to always return asmtok::Error.
asmtok::TokKind AsmLexer::ReturnError(const char *Loc, const std::string &Msg) {
- SrcMgr.PrintMessage(SMLoc::getFromPointer(Loc), Msg);
+ SrcMgr.PrintMessage(SMLoc::getFromPointer(Loc), Msg, "error");
return asmtok::Error;
}
diff --git a/tools/llvm-mc/AsmLexer.h b/tools/llvm-mc/AsmLexer.h
index 5d0002d4d8..6360b1280c 100644
--- a/tools/llvm-mc/AsmLexer.h
+++ b/tools/llvm-mc/AsmLexer.h
@@ -97,7 +97,7 @@ public:
SMLoc getLoc() const;
- void PrintMessage(SMLoc Loc, const std::string &Msg) const;
+ void PrintMessage(SMLoc Loc, const std::string &Msg, const char *Type) const;
private:
int getNextChar();
diff --git a/tools/llvm-mc/AsmParser.cpp b/tools/llvm-mc/AsmParser.cpp
index 9a71139873..9414f9918c 100644
--- a/tools/llvm-mc/AsmParser.cpp
+++ b/tools/llvm-mc/AsmParser.cpp
@@ -22,13 +22,17 @@
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
+void AsmParser::Warning(SMLoc L, const char *Msg) {
+ Lexer.PrintMessage(L, Msg, "warning");
+}
+
bool AsmParser::Error(SMLoc L, const char *Msg) {
- Lexer.PrintMessage(L, Msg);
+ Lexer.PrintMessage(L, Msg, "error");
return true;
}
bool AsmParser::TokError(const char *Msg) {
- Lexer.PrintMessage(Lexer.getLoc(), Msg);
+ Lexer.PrintMessage(Lexer.getLoc(), Msg, "error");
return true;
}
@@ -482,7 +486,7 @@ bool AsmParser::ParseStatement() {
if (!strcmp(IDVal, ".weak_reference"))
return ParseDirectiveSymbolAttribute(MCStreamer::WeakReference);
- Lexer.PrintMessage(IDLoc, "warning: ignoring directive for now");
+ Warning(IDLoc, "ignoring directive for now");
EatToEndOfStatement();
return false;
}
@@ -810,14 +814,14 @@ bool AsmParser::ParseDirectiveAlign(bool IsPow2, unsigned ValueSize) {
// Diagnose non-sensical max bytes to fill.
if (MaxBytesLoc.isValid()) {
if (MaxBytesToFill < 1) {
- Lexer.PrintMessage(MaxBytesLoc, "warning: alignment directive can never "
- "be satisfied in this many bytes, ignoring");
+ Warning(MaxBytesLoc, "alignment directive can never be satisfied in this "
+ "many bytes, ignoring");
return false;
}
if (MaxBytesToFill >= Alignment) {
- Lexer.PrintMessage(MaxBytesLoc, "warning: maximum bytes expression "
- "exceeds alignment and has no effect");
+ Warning(MaxBytesLoc, "maximum bytes expression exceeds alignment and "
+ "has no effect");
MaxBytesToFill = 0;
}
}
diff --git a/tools/llvm-mc/AsmParser.h b/tools/llvm-mc/AsmParser.h
index f5e372ccd2..8cd40eb4d4 100644
--- a/tools/llvm-mc/AsmParser.h
+++ b/tools/llvm-mc/AsmParser.h
@@ -39,7 +39,8 @@ public:
private:
bool ParseStatement();
-
+
+ void Warning(SMLoc L, const char *Msg);
bool Error(SMLoc L, const char *Msg);
bool TokError(const char *Msg);
diff --git a/tools/llvm-mc/llvm-mc.cpp b/tools/llvm-mc/llvm-mc.cpp
index 4100cb14de..e26d79d6c9 100644
--- a/tools/llvm-mc/llvm-mc.cpp
+++ b/tools/llvm-mc/llvm-mc.cpp
@@ -80,7 +80,7 @@ static int AsLexInput(const char *ProgName) {
while (Tok != asmtok::Eof) {
switch (Tok) {
default:
- Lexer.PrintMessage(Lexer.getLoc(), "driver: unknown token");
+ Lexer.PrintMessage(Lexer.getLoc(), "unknown token", "warning");
Error = true;
break;
case asmtok::Error: