File tree Expand file tree Collapse file tree 4 files changed +20
-1
lines changed Expand file tree Collapse file tree 4 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -132,6 +132,8 @@ def err_fe_no_pch_in_dir : Error<
132132 "no suitable precompiled header file found in directory '%0'">;
133133def err_fe_action_not_available : Error<
134134 "action %0 not compiled in">;
135+ def err_fe_cir_not_built : Error<"clang IR support not available, rebuild "
136+ "clang with -DCLANG_ENABLE_CIR=ON">;
135137def err_fe_invalid_multiple_actions : Error<
136138 "'%0' action ignored; '%1' action specified previously">;
137139def err_fe_invalid_alignment : Error<
Original file line number Diff line number Diff line change @@ -81,7 +81,8 @@ CreateFrontendBaseAction(CompilerInstance &CI) {
8181#if CLANG_ENABLE_CIR
8282 return std::make_unique<cir::EmitCIRAction>();
8383#else
84- llvm_unreachable (" CIR suppport not built into clang" );
84+ CI.getDiagnostics ().Report (diag::err_fe_cir_not_built);
85+ return nullptr ;
8586#endif
8687 case EmitHTML: return std::make_unique<HTMLPrintAction>();
8788 case EmitLLVM: {
Original file line number Diff line number Diff line change 1+ // Test that using -emit-cir when clang is not built with CIR support gives a proper error message
2+ // instead of crashing.
3+
4+ // This test should only run when CIR support is NOT enabled
5+ // UNSUPPORTED: cir-support
6+
7+ // RUN: not %clang_cc1 -emit-cir %s 2>&1 | FileCheck %s
8+ // CHECK: error: clang IR support not available, rebuild clang with -DCLANG_ENABLE_CIR=ON
9+
10+ int main (void ) {
11+ return 0 ;
12+ }
Original file line number Diff line number Diff line change @@ -224,6 +224,10 @@ def have_host_clang_repl_cuda():
224224 )
225225 )
226226
227+ # ClangIR support
228+ if config .clang_enable_cir :
229+ config .available_features .add ("cir-support" )
230+
227231llvm_config .add_tool_substitutions (tools , tool_dirs )
228232
229233config .substitutions .append (
You can’t perform that action at this time.
0 commit comments