Skip to content

Commit cb0e24e

Browse files
author
Robin Kruppe
committed
Adapt LLVMRustPrintPasses to LLVM 4.0 preferring StringRef over char *
1 parent 29abe6f commit cb0e24e

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)