Skip to content

Commit 9ca50bd

Browse files
authored
Auto merge of #38027 - rkruppe:llvm-printpasses-fwdcompat, r=alexcrichton
[LLVM 4.0] LLVMRustPrintPasses Adapt `LLVMRustPrintPasses` to LLVM 4.0 preferring `StringRef` over `char *` cc #37609
2 parents 2008732 + cb0e24e commit 9ca50bd

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/rustllvm/PassWrapper.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -529,10 +529,17 @@ LLVMRustPrintPasses() {
529529
LLVMInitializePasses();
530530
struct MyListener : PassRegistrationListener {
531531
void passEnumerate(const PassInfo *info) {
532+
#if LLVM_VERSION_GE(4, 0)
533+
if (!info->getPassArgument().empty()) {
534+
printf("%15s - %s\n", info->getPassArgument().data(),
535+
info->getPassName().data());
536+
}
537+
#else
532538
if (info->getPassArgument() && *info->getPassArgument()) {
533539
printf("%15s - %s\n", info->getPassArgument(),
534540
info->getPassName());
535541
}
542+
#endif
536543
}
537544
} listener;
538545

0 commit comments

Comments
 (0)