Adapt LLVMRustPrintPasses to LLVM 4.0 preferring StringRef over char *

This commit is contained in:
Robin Kruppe 2016-11-27 14:48:47 +01:00
parent 29abe6f9e8
commit cb0e24eafa

View File

@ -529,10 +529,17 @@ LLVMRustPrintPasses() {
LLVMInitializePasses();
struct MyListener : PassRegistrationListener {
void passEnumerate(const PassInfo *info) {
#if LLVM_VERSION_GE(4, 0)
if (!info->getPassArgument().empty()) {
printf("%15s - %s\n", info->getPassArgument().data(),
info->getPassName().data());
}
#else
if (info->getPassArgument() && *info->getPassArgument()) {
printf("%15s - %s\n", info->getPassArgument(),
info->getPassName());
}
#endif
}
} listener;