Consolidate some TableGen diagnostic helper functions.

TableGen had diagnostic printers sprinkled about in a few places. Pull them
together into a single location in Error.cpp.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133568 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jim Grosbach
2011-06-21 22:55:50 +00:00
parent 109c22c062
commit 0b6a44afb9
17 changed files with 99 additions and 40 deletions
+4 -11
View File
@@ -26,6 +26,7 @@
#include "DAGISelEmitter.h"
#include "DisassemblerEmitter.h"
#include "EDEmitter.h"
#include "Error.h"
#include "FastISelEmitter.h"
#include "InstrEnumEmitter.h"
#include "InstrInfoEmitter.h"
@@ -194,12 +195,6 @@ namespace {
}
static SourceMgr SrcMgr;
void llvm::PrintError(SMLoc ErrorLoc, const Twine &Msg) {
SrcMgr.PrintMessage(ErrorLoc, Msg, "error");
}
int main(int argc, char **argv) {
RecordKeeper Records;
@@ -403,13 +398,11 @@ int main(int argc, char **argv) {
return 0;
} catch (const TGError &Error) {
errs() << argv[0] << ": error:\n";
PrintError(Error.getLoc(), Error.getMessage());
PrintError(Error);
} catch (const std::string &Error) {
errs() << argv[0] << ": " << Error << "\n";
PrintError(Error);
} catch (const char *Error) {
errs() << argv[0] << ": " << Error << "\n";
PrintError(Error);
} catch (...) {
errs() << argv[0] << ": Unknown unexpected exception occurred.\n";
}