From cab3fc53d2e173243a462e9c8e914af58ddbeaba Mon Sep 17 00:00:00 2001 From: Alexandre Ganea Date: Thu, 18 Jun 2020 10:07:18 -0400 Subject: [PATCH] Fix linker error in clang-fuzzer following 89ea0b05207d45c145fb525df554b3b986ae379b. This fixes: tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o:handle_cxx.cpp:function clang_fuzzer::HandleCXX(std::__cxx11::basic_string, std::allocator > const&, char const*, std::vector > const&): error: undefined reference to 'clang::tooling::newInvocation(clang::DiagnosticsEngine*, llvm::SmallVector const&)' --- clang/include/clang/Tooling/Tooling.h | 3 ++- clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/clang/include/clang/Tooling/Tooling.h b/clang/include/clang/Tooling/Tooling.h index ced2405f6e83..4fb0c18be95e 100644 --- a/clang/include/clang/Tooling/Tooling.h +++ b/clang/include/clang/Tooling/Tooling.h @@ -505,7 +505,8 @@ void addTargetAndModeForProgramName(std::vector &CommandLine, /// Creates a \c CompilerInvocation. CompilerInvocation *newInvocation(DiagnosticsEngine *Diagnostics, - const llvm::opt::ArgStringList &CC1Args); + const llvm::opt::ArgStringList &CC1Args, + const char *const BinaryName); } // namespace tooling diff --git a/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp b/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp index 32d351f4c3e9..14204021d262 100644 --- a/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp +++ b/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp @@ -37,7 +37,7 @@ void clang_fuzzer::HandleCXX(const std::string &S, IntrusiveRefCntPtr(new DiagnosticIDs()), &*DiagOpts, &Diags, false); std::unique_ptr Invocation( - tooling::newInvocation(&Diagnostics, CC1Args)); + tooling::newInvocation(&Diagnostics, CC1Args, /*BinaryName=*/nullptr)); std::unique_ptr Input = llvm::MemoryBuffer::getMemBuffer(S); Invocation->getPreprocessorOpts().addRemappedFile(FileName,