Skip to content

Commit ce64ac4

Browse files
committed
Be merge friendly with rust-lang#96215
1 parent 84a0675 commit ce64ac4

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,15 @@ extern "C" LLVMPassRef LLVMRustCreateHWAddressSanitizerPass(bool Recover) {
149149
}
150150

151151
extern "C" LLVMPassRef LLVMRustCreateEntryExitInstrumenterPass(bool PostInlining) {
152+
#if LLVM_VERSION_LT(15, 0)
152153
if (PostInlining) {
153154
return wrap(createPostInlineEntryExitInstrumenterPass());
154155
} else {
155156
return wrap(createEntryExitInstrumenterPass());
156157
}
158+
#else
159+
report_fatal_error("Legacy PM not supported with LLVM 15");
160+
#endif
157161
}
158162

159163
extern "C" LLVMRustPassKind LLVMRustPassKind(LLVMPassRef RustPass) {
@@ -180,6 +184,7 @@ void LLVMRustPassManagerBuilderPopulateThinLTOPassManager(
180184
extern "C"
181185
void LLVMRustAddEarlyExtensionPasses(
182186
LLVMPassManagerBuilderRef PMBR, LLVMPassRef *Passes, size_t NumPasses) {
187+
#if LLVM_VERSION_LT(15, 0)
183188
auto AddExtensionPasses = [Passes, NumPasses](
184189
const PassManagerBuilder &Builder, PassManagerBase &PM) {
185190
for (size_t I = 0; I < NumPasses; I++) {
@@ -190,6 +195,9 @@ void LLVMRustAddEarlyExtensionPasses(
190195
AddExtensionPasses);
191196
unwrap(PMBR)->addExtension(PassManagerBuilder::EP_EnabledOnOptLevel0,
192197
AddExtensionPasses);
198+
#else
199+
report_fatal_error("Legacy PM not supported with LLVM 15");
200+
#endif
193201
}
194202

195203
extern "C"

0 commit comments

Comments
 (0)