summaryrefslogtreecommitdiff
path: root/tools/llvm-mc/AsmParser.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-06-30 00:49:23 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-06-30 00:49:23 +0000
commit3fb7683bec8c8edb24e80c95f3b0668c6ecc0ae6 (patch)
tree814b198e69a8c9b1b21c8f1281d501e7a01adde0 /tools/llvm-mc/AsmParser.cpp
parent2bc29dc0bcb3c1441477a062e4a5cffff175c8ca (diff)
downloadllvm-3fb7683bec8c8edb24e80c95f3b0668c6ecc0ae6.tar.gz
llvm-3fb7683bec8c8edb24e80c95f3b0668c6ecc0ae6.tar.bz2
llvm-3fb7683bec8c8edb24e80c95f3b0668c6ecc0ae6.tar.xz
Normalize SourceMgr messages.
- Don't print "Parsing" in front of every message. - Take additional "type" argument which is prepended to the message (with ": ") if given. - Update clients to print errors (warnings) as: <filename>:<line number>: error(warning): ... git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74489 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-mc/AsmParser.cpp')
-rw-r--r--tools/llvm-mc/AsmParser.cpp18
1 files changed, 11 insertions, 7 deletions
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;
}
}