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<
132
132
"no suitable precompiled header file found in directory '%0'">;
133
133
def err_fe_action_not_available : Error<
134
134
"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">;
135
137
def err_fe_invalid_multiple_actions : Error<
136
138
"'%0' action ignored; '%1' action specified previously">;
137
139
def err_fe_invalid_alignment : Error<
Original file line number Diff line number Diff line change @@ -81,7 +81,8 @@ CreateFrontendBaseAction(CompilerInstance &CI) {
81
81
#if CLANG_ENABLE_CIR
82
82
return std::make_unique<cir::EmitCIRAction>();
83
83
#else
84
- llvm_unreachable (" CIR suppport not built into clang" );
84
+ CI.getDiagnostics ().Report (diag::err_fe_cir_not_built);
85
+ return nullptr ;
85
86
#endif
86
87
case EmitHTML: return std::make_unique<HTMLPrintAction>();
87
88
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():
224
224
)
225
225
)
226
226
227
+ # ClangIR support
228
+ if config .clang_enable_cir :
229
+ config .available_features .add ("cir-support" )
230
+
227
231
llvm_config .add_tool_substitutions (tools , tool_dirs )
228
232
229
233
config .substitutions .append (
You can’t perform that action at this time.
0 commit comments