diff options
author | Chris Lattner <sabre@nondot.org> | 2009-06-21 21:22:11 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-06-21 21:22:11 +0000 |
commit | 14ee48a5bae352780b767a14bd97e8e91800a95b (patch) | |
tree | 5ff109bb82dfebe414bbd54f6a7cbe1a0e0e0f4c /tools | |
parent | b0789ed5a45a90ee7ff398fcdc1383b49ee88918 (diff) | |
download | external_llvm-14ee48a5bae352780b767a14bd97e8e91800a95b.tar.gz external_llvm-14ee48a5bae352780b767a14bd97e8e91800a95b.tar.bz2 external_llvm-14ee48a5bae352780b767a14bd97e8e91800a95b.zip |
rename SourceMgr::PrintError to PrintMessage.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73861 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r-- | tools/llvm-mc/AsmLexer.cpp | 16 | ||||
-rw-r--r-- | tools/llvm-mc/AsmLexer.h | 3 | ||||
-rw-r--r-- | tools/llvm-mc/AsmParser.cpp | 14 | ||||
-rw-r--r-- | tools/llvm-mc/AsmParser.h | 2 | ||||
-rw-r--r-- | tools/llvm-mc/llvm-mc.cpp | 2 |
5 files changed, 21 insertions, 16 deletions
diff --git a/tools/llvm-mc/AsmLexer.cpp b/tools/llvm-mc/AsmLexer.cpp index cf6a4a8c12..740215b683 100644 --- a/tools/llvm-mc/AsmLexer.cpp +++ b/tools/llvm-mc/AsmLexer.cpp @@ -29,18 +29,14 @@ SMLoc AsmLexer::getLoc() const { return SMLoc::getFromPointer(TokStart); } -void AsmLexer::PrintError(const char *Loc, const std::string &Msg) const { - SrcMgr.PrintError(SMLoc::getFromPointer(Loc), Msg); -} - -void AsmLexer::PrintError(SMLoc Loc, const std::string &Msg) const { - SrcMgr.PrintError(Loc, Msg); +void AsmLexer::PrintMessage(SMLoc Loc, const std::string &Msg) const { + SrcMgr.PrintMessage(Loc, Msg); } /// 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) { - PrintError(Loc, Msg); + SrcMgr.PrintMessage(SMLoc::getFromPointer(Loc), Msg); return asmtok::Error; } @@ -203,10 +199,8 @@ asmtok::TokKind AsmLexer::LexQuote() { CurChar = getNextChar(); } - if (CurChar == EOF) { - PrintError(TokStart, "unterminated string constant"); - return asmtok::Eof; - } + if (CurChar == EOF) + return ReturnError(TokStart, "unterminated string constant"); CurChar = getNextChar(); } diff --git a/tools/llvm-mc/AsmLexer.h b/tools/llvm-mc/AsmLexer.h index c668e8639c..bad2cb931b 100644 --- a/tools/llvm-mc/AsmLexer.h +++ b/tools/llvm-mc/AsmLexer.h @@ -89,8 +89,7 @@ public: SMLoc getLoc() const; - void PrintError(const char *Loc, const std::string &Msg) const; - void PrintError(SMLoc Loc, const std::string &Msg) const; + void PrintMessage(SMLoc Loc, const std::string &Msg) const; private: int getNextChar(); diff --git a/tools/llvm-mc/AsmParser.cpp b/tools/llvm-mc/AsmParser.cpp index 9c0b4abb07..1940d76189 100644 --- a/tools/llvm-mc/AsmParser.cpp +++ b/tools/llvm-mc/AsmParser.cpp @@ -16,6 +16,17 @@ #include "llvm/Support/raw_ostream.h" using namespace llvm; +bool AsmParser::Error(SMLoc L, const char *Msg) { + Lexer.PrintMessage(L, Msg); + return true; +} + +bool AsmParser::TokError(const char *Msg) { + Lexer.PrintMessage(Lexer.getLoc(), Msg); + return true; +} + + bool AsmParser::Run() { // Prime the lexer. Lexer.Lex(); @@ -34,8 +45,7 @@ bool AsmParser::Run() { bool AsmParser::ParseStatement() { switch (Lexer.getKind()) { default: - Lexer.PrintError(Lexer.getLoc(), "unexpected token at start of statement"); - return true; + return TokError("unexpected token at start of statement"); case asmtok::EndOfStatement: Lexer.Lex(); return false; diff --git a/tools/llvm-mc/AsmParser.h b/tools/llvm-mc/AsmParser.h index 5e1f6c6562..66e1a9b42f 100644 --- a/tools/llvm-mc/AsmParser.h +++ b/tools/llvm-mc/AsmParser.h @@ -30,6 +30,8 @@ public: private: bool ParseStatement(); + bool Error(SMLoc L, const char *Msg); + bool TokError(const char *Msg); }; } // end namespace llvm diff --git a/tools/llvm-mc/llvm-mc.cpp b/tools/llvm-mc/llvm-mc.cpp index 0acd78ea41..7d0c571c72 100644 --- a/tools/llvm-mc/llvm-mc.cpp +++ b/tools/llvm-mc/llvm-mc.cpp @@ -77,7 +77,7 @@ static int AsLexInput(const char *ProgName) { while (Tok != asmtok::Eof) { switch (Tok) { default: - Lexer.PrintError(Lexer.getLoc(), "driver: unknown token"); + Lexer.PrintMessage(Lexer.getLoc(), "driver: unknown token"); Error = true; break; case asmtok::Error: |