summaryrefslogtreecommitdiff
path: root/tools/perf/util/c++/clang.cpp
diff options
context:
space:
mode:
authorJames Morris <james.morris@microsoft.com>2018-09-04 21:35:54 +0300
committerJames Morris <james.morris@microsoft.com>2018-09-04 21:35:54 +0300
commite42f6f9be4f83c537aa81b4c6239ea94ff5b29ce (patch)
treef956a5ea0e83fc6d0df3e64681e7bbc1f201f3ee /tools/perf/util/c++/clang.cpp
parent4408e300a67ab2ce2505087986a9fe922c800ffd (diff)
parent57361846b52bc686112da6ca5368d11210796804 (diff)
downloadlinux-e42f6f9be4f83c537aa81b4c6239ea94ff5b29ce.tar.xz
Merge tag 'v4.19-rc2' into next-general
Sync to Linux 4.19-rc2 for downstream developers.
Diffstat (limited to 'tools/perf/util/c++/clang.cpp')
-rw-r--r--tools/perf/util/c++/clang.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/tools/perf/util/c++/clang.cpp b/tools/perf/util/c++/clang.cpp
index bf31ceab33bd..89512504551b 100644
--- a/tools/perf/util/c++/clang.cpp
+++ b/tools/perf/util/c++/clang.cpp
@@ -146,8 +146,15 @@ getBPFObjectFromModule(llvm::Module *Module)
raw_svector_ostream ostream(*Buffer);
legacy::PassManager PM;
- if (TargetMachine->addPassesToEmitFile(PM, ostream,
- TargetMachine::CGFT_ObjectFile)) {
+ bool NotAdded;
+#if CLANG_VERSION_MAJOR < 7
+ NotAdded = TargetMachine->addPassesToEmitFile(PM, ostream,
+ TargetMachine::CGFT_ObjectFile);
+#else
+ NotAdded = TargetMachine->addPassesToEmitFile(PM, ostream, nullptr,
+ TargetMachine::CGFT_ObjectFile);
+#endif
+ if (NotAdded) {
llvm::errs() << "TargetMachine can't emit a file of this type\n";
return std::unique_ptr<llvm::SmallVectorImpl<char>>(nullptr);;
}