[llvm-commits] [llvm] r73861 - in /llvm/trunk: include/llvm/Support/SourceMgr.h lib/Support/SourceMgr.cpp tools/llvm-mc/AsmLexer.cpp tools/llvm-mc/AsmLexer.h tools/llvm-mc/AsmParser.cpp tools/llvm-mc/AsmParser.h tools/llvm-mc/llvm-mc.cpp utils/TableGen/TGLexer.cpp utils/TableGen/TableGen.cpp
Chris Lattner
sabre at nondot.org
Sun Jun 21 14:22:13 PDT 2009
Author: lattner
Date: Sun Jun 21 16:22:11 2009
New Revision: 73861
URL: http://llvm.org/viewvc/llvm-project?rev=73861&view=rev
Log:
rename SourceMgr::PrintError to PrintMessage.
Modified:
llvm/trunk/include/llvm/Support/SourceMgr.h
llvm/trunk/lib/Support/SourceMgr.cpp
llvm/trunk/tools/llvm-mc/AsmLexer.cpp
llvm/trunk/tools/llvm-mc/AsmLexer.h
llvm/trunk/tools/llvm-mc/AsmParser.cpp
llvm/trunk/tools/llvm-mc/AsmParser.h
llvm/trunk/tools/llvm-mc/llvm-mc.cpp
llvm/trunk/utils/TableGen/TGLexer.cpp
llvm/trunk/utils/TableGen/TableGen.cpp
Modified: llvm/trunk/include/llvm/Support/SourceMgr.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/SourceMgr.h?rev=73861&r1=73860&r2=73861&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/SourceMgr.h (original)
+++ llvm/trunk/include/llvm/Support/SourceMgr.h Sun Jun 21 16:22:11 2009
@@ -107,10 +107,9 @@
/// specified file. This is not a fast method.
unsigned FindLineNumber(SMLoc Loc, int BufferID = -1) const;
-
- /// PrintError - Emit an error message about the specified location with the
+ /// PrintMessage - Emit a message about the specified location with the
/// specified string.
- void PrintError(SMLoc ErrorLoc, const std::string &Msg) const;
+ void PrintMessage(SMLoc Loc, const std::string &Msg) const;
private:
void PrintIncludeStack(SMLoc IncludeLoc) const;
Modified: llvm/trunk/lib/Support/SourceMgr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/SourceMgr.cpp?rev=73861&r1=73860&r2=73861&view=diff
==============================================================================
--- llvm/trunk/lib/Support/SourceMgr.cpp (original)
+++ llvm/trunk/lib/Support/SourceMgr.cpp Sun Jun 21 16:22:11 2009
@@ -90,12 +90,12 @@
}
-void SourceMgr::PrintError(SMLoc ErrorLoc, const std::string &Msg) const {
+void SourceMgr::PrintMessage(SMLoc Loc, const std::string &Msg) const {
raw_ostream &OS = errs();
// First thing to do: find the current buffer containing the specified
// location.
- int CurBuf = FindBufferContainingLoc(ErrorLoc);
+ int CurBuf = FindBufferContainingLoc(Loc);
assert(CurBuf != -1 && "Invalid or unspecified location!");
PrintIncludeStack(getBufferInfo(CurBuf).IncludeLoc);
@@ -104,24 +104,24 @@
OS << "Parsing " << CurMB->getBufferIdentifier() << ":"
- << FindLineNumber(ErrorLoc, CurBuf) << ": ";
+ << FindLineNumber(Loc, CurBuf) << ": ";
OS << Msg << "\n";
// Scan backward to find the start of the line.
- const char *LineStart = ErrorLoc.getPointer();
+ const char *LineStart = Loc.getPointer();
while (LineStart != CurMB->getBufferStart() &&
LineStart[-1] != '\n' && LineStart[-1] != '\r')
--LineStart;
// Get the end of the line.
- const char *LineEnd = ErrorLoc.getPointer();
+ const char *LineEnd = Loc.getPointer();
while (LineEnd != CurMB->getBufferEnd() &&
LineEnd[0] != '\n' && LineEnd[0] != '\r')
++LineEnd;
// Print out the line.
OS << std::string(LineStart, LineEnd) << "\n";
// Print out spaces before the caret.
- for (const char *Pos = LineStart; Pos != ErrorLoc.getPointer(); ++Pos)
+ for (const char *Pos = LineStart; Pos != Loc.getPointer(); ++Pos)
OS << (*Pos == '\t' ? '\t' : ' ');
OS << "^\n";
}
Modified: llvm/trunk/tools/llvm-mc/AsmLexer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmLexer.cpp?rev=73861&r1=73860&r2=73861&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mc/AsmLexer.cpp (original)
+++ llvm/trunk/tools/llvm-mc/AsmLexer.cpp Sun Jun 21 16:22:11 2009
@@ -29,18 +29,14 @@
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 @@
CurChar = getNextChar();
}
- if (CurChar == EOF) {
- PrintError(TokStart, "unterminated string constant");
- return asmtok::Eof;
- }
+ if (CurChar == EOF)
+ return ReturnError(TokStart, "unterminated string constant");
CurChar = getNextChar();
}
Modified: llvm/trunk/tools/llvm-mc/AsmLexer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmLexer.h?rev=73861&r1=73860&r2=73861&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mc/AsmLexer.h (original)
+++ llvm/trunk/tools/llvm-mc/AsmLexer.h Sun Jun 21 16:22:11 2009
@@ -89,8 +89,7 @@
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();
Modified: llvm/trunk/tools/llvm-mc/AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.cpp?rev=73861&r1=73860&r2=73861&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mc/AsmParser.cpp (original)
+++ llvm/trunk/tools/llvm-mc/AsmParser.cpp Sun Jun 21 16:22:11 2009
@@ -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::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;
Modified: llvm/trunk/tools/llvm-mc/AsmParser.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.h?rev=73861&r1=73860&r2=73861&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mc/AsmParser.h (original)
+++ llvm/trunk/tools/llvm-mc/AsmParser.h Sun Jun 21 16:22:11 2009
@@ -30,6 +30,8 @@
private:
bool ParseStatement();
+ bool Error(SMLoc L, const char *Msg);
+ bool TokError(const char *Msg);
};
} // end namespace llvm
Modified: llvm/trunk/tools/llvm-mc/llvm-mc.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/llvm-mc.cpp?rev=73861&r1=73860&r2=73861&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mc/llvm-mc.cpp (original)
+++ llvm/trunk/tools/llvm-mc/llvm-mc.cpp Sun Jun 21 16:22:11 2009
@@ -77,7 +77,7 @@
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:
Modified: llvm/trunk/utils/TableGen/TGLexer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/TGLexer.cpp?rev=73861&r1=73860&r2=73861&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/TGLexer.cpp (original)
+++ llvm/trunk/utils/TableGen/TGLexer.cpp Sun Jun 21 16:22:11 2009
@@ -44,11 +44,11 @@
void TGLexer::PrintError(const char *Loc, const std::string &Msg) const {
- SrcMgr.PrintError(SMLoc::getFromPointer(Loc), Msg);
+ SrcMgr.PrintMessage(SMLoc::getFromPointer(Loc), Msg);
}
void TGLexer::PrintError(SMLoc Loc, const std::string &Msg) const {
- SrcMgr.PrintError(Loc, Msg);
+ SrcMgr.PrintMessage(Loc, Msg);
}
Modified: llvm/trunk/utils/TableGen/TableGen.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/TableGen.cpp?rev=73861&r1=73860&r2=73861&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/TableGen.cpp (original)
+++ llvm/trunk/utils/TableGen/TableGen.cpp Sun Jun 21 16:22:11 2009
@@ -127,7 +127,7 @@
static SourceMgr SrcMgr;
void llvm::PrintError(SMLoc ErrorLoc, const std::string &Msg) {
- SrcMgr.PrintError(ErrorLoc, Msg);
+ SrcMgr.PrintMessage(ErrorLoc, Msg);
}
More information about the llvm-commits
mailing list