[llvm-commits] [llvm-gcc-4.2] r79286 - /llvm-gcc-4.2/trunk/gcc/llvm-main.cpp
Bill Wendling
isanbard at gmail.com
Mon Aug 17 14:20:55 PDT 2009
Author: void
Date: Mon Aug 17 16:20:55 2009
New Revision: 79286
URL: http://llvm.org/viewvc/llvm-project?rev=79286&view=rev
Log:
Hook up llvm-gcc to the llvm backend error reporting mechanism. This is similar
to clang's implementation. I couldn't use the "fatal()" function because of
dependency issues between the .o files.
Modified:
llvm-gcc-4.2/trunk/gcc/llvm-main.cpp
Modified: llvm-gcc-4.2/trunk/gcc/llvm-main.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-main.cpp?rev=79286&r1=79285&r2=79286&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-main.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-main.cpp Mon Aug 17 16:20:55 2009
@@ -19,21 +19,30 @@
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
+#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/PrettyStackTrace.h"
extern "C" {
#include "config.h"
#include "system.h"
#include "coretypes.h"
+#include "errors.h"
#include "tm.h"
#include "toplev.h"
+
+extern const char *progname;
+}
+
+static void LLVMErrorHandler(void *UserData, const std::string &Message) {
+ fprintf(stderr, "%s: error in backend: %s\n", progname, Message.c_str());
+ exit(FATAL_EXIT_CODE);
}
// We define main() to call toplev_main(), which is defined in toplev.c.
// We do this so that C++ code has its static constructors called as required.
-//
int main (int argc, char **argv) {
llvm::PrettyStackTraceProgram X(argc, argv);
+ llvm::llvm_install_error_handler(LLVMErrorHandler);
return toplev_main (argc, (const char **) argv);
}
More information about the llvm-commits
mailing list