r178042 - Fix a crasher by reporting a fatal error if we're unable to create the target

Chad Rosier mcrosier at apple.com
Tue Mar 26 11:01:49 PDT 2013


Author: mcrosier
Date: Tue Mar 26 13:01:48 2013
New Revision: 178042

URL: http://llvm.org/viewvc/llvm-project?rev=178042&view=rev
Log:
Fix a crasher by reporting a fatal error if we're unable to create the target
machine and one is required.
Part of rdar://13295753

Modified:
    cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td
    cfe/trunk/lib/CodeGen/BackendUtil.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td?rev=178042&r1=178041&r2=178042&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td Tue Mar 26 13:01:48 2013
@@ -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<

Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=178042&r1=178041&r2=178042&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original)
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Tue Mar 26 13:01:48 2013
@@ -329,7 +329,7 @@ TargetMachine *EmitAssemblyHelper::Creat
   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;
   }
 





More information about the cfe-commits mailing list