summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-mc/AsmParser.cpp
diff options
context:
space:
mode:
authorSean Callanan <scallanan@apple.com>2010-01-20 23:19:55 +0000
committerSean Callanan <scallanan@apple.com>2010-01-20 23:19:55 +0000
commit177934e02151d58f5837ee31478e349de6ae2c6b (patch)
treefdff1d5de84783b154cac76999d6de357388d997 /llvm/tools/llvm-mc/AsmParser.cpp
parentd7cf27a1d135896c1038e73cc2a37c1b25444dfa (diff)
downloadbcm5719-llvm-177934e02151d58f5837ee31478e349de6ae2c6b.tar.gz
bcm5719-llvm-177934e02151d58f5837ee31478e349de6ae2c6b.zip
Changed the AsmParser to handle error messages itself
rather than passing them off to the AsmLexer to handle. This means the AsmLexer no longer requires a SourceMgr to do error handling. llvm-svn: 94047
Diffstat (limited to 'llvm/tools/llvm-mc/AsmParser.cpp')
-rw-r--r--llvm/tools/llvm-mc/AsmParser.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/llvm/tools/llvm-mc/AsmParser.cpp b/llvm/tools/llvm-mc/AsmParser.cpp
index 2cbf74916c5..0e0c1a4de7a 100644
--- a/llvm/tools/llvm-mc/AsmParser.cpp
+++ b/llvm/tools/llvm-mc/AsmParser.cpp
@@ -87,24 +87,29 @@ const MCSection *AsmParser::getMachOSection(const StringRef &Segment,
}
void AsmParser::Warning(SMLoc L, const Twine &Msg) {
- Lexer.PrintMessage(L, Msg.str(), "warning");
+ PrintMessage(L, Msg.str(), "warning");
}
bool AsmParser::Error(SMLoc L, const Twine &Msg) {
- Lexer.PrintMessage(L, Msg.str(), "error");
+ PrintMessage(L, Msg.str(), "error");
return true;
}
bool AsmParser::TokError(const char *Msg) {
- Lexer.PrintMessage(Lexer.getLoc(), Msg, "error");
+ PrintMessage(Lexer.getLoc(), Msg, "error");
return true;
}
+void AsmParser::PrintMessage(SMLoc Loc, const std::string &Msg,
+ const char *Type) const {
+ SrcMgr.PrintMessage(Loc, Msg, Type);
+}
+
const AsmToken &AsmParser::Lex() {
const AsmToken &tok = Lexer.Lex();
if (tok.is(AsmToken::Error))
- Lexer.PrintMessage(Lexer.getErrLoc(), Lexer.getErr(), "error");
+ PrintMessage(Lexer.getErrLoc(), Lexer.getErr(), "error");
return tok;
}
@@ -1518,9 +1523,9 @@ bool AsmParser::ParseDirectiveInclude() {
// Attempt to switch the lexer to the included file before consuming the end
// of statement to avoid losing it when we switch.
if (Lexer.EnterIncludeFile(Filename)) {
- Lexer.PrintMessage(IncludeLoc,
- "Could not find include file '" + Filename + "'",
- "error");
+ PrintMessage(IncludeLoc,
+ "Could not find include file '" + Filename + "'",
+ "error");
return true;
}
OpenPOWER on IntegriCloud