From cb0e24eafa233ddf5eee1937f161f3bda1745f2c Mon Sep 17 00:00:00 2001 From: Robin Kruppe Date: Sun, 27 Nov 2016 14:48:47 +0100 Subject: [PATCH] Adapt LLVMRustPrintPasses to LLVM 4.0 preferring `StringRef` over `char *` --- src/rustllvm/PassWrapper.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/rustllvm/PassWrapper.cpp b/src/rustllvm/PassWrapper.cpp index 70f7ee3004d..9230c639833 100644 --- a/src/rustllvm/PassWrapper.cpp +++ b/src/rustllvm/PassWrapper.cpp @@ -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;