Fix a crasher by reporting a fatal error if we're unable to create the target
authorChad Rosier <mcrosier@apple.com>
Tue, 26 Mar 2013 18:01:48 +0000 (18:01 +0000)
committerChad Rosier <mcrosier@apple.com>
Tue, 26 Mar 2013 18:01:48 +0000 (18:01 +0000)
machine and one is required.
Part of rdar://13295753

llvm-svn: 178042

clang/include/clang/Basic/DiagnosticFrontendKinds.td
clang/lib/CodeGen/BackendUtil.cpp

index 111622e..2982268 100644 (file)
@@ -42,8 +42,6 @@ def err_fe_unable_to_load_pch : Error<
     "unable to load PCH file">;
 def err_fe_unable_to_load_plugin : Error<
     "unable to load plugin '%0': '%1'">;
-def err_fe_unable_to_create_target : Error<
-    "unable to create target: '%0'">;
 def err_fe_unable_to_interface_with_target : Error<
     "unable to interface with target machine">;
 def err_fe_unable_to_open_output : Error<
index 952d1fb..1d73959 100644 (file)
@@ -329,7 +329,7 @@ TargetMachine *EmitAssemblyHelper::CreateTargetMachine(bool MustCreateTM) {
   const llvm::Target *TheTarget = TargetRegistry::lookupTarget(Triple, Error);
   if (!TheTarget) {
     if (MustCreateTM)
-      Diags.Report(diag::err_fe_unable_to_create_target) << Error;
+      llvm::report_fatal_error ("Unable to create target: " + Error);
     return 0;
   }