Fix compiling with clang-10

This commit is contained in:
Phillip Stephens 2020-04-22 03:36:08 -07:00
parent 503cc155c6
commit 07b015782b
Signed by: Antidote
GPG Key ID: F8BEE4C83DACA60D
2 changed files with 32 additions and 12 deletions

View File

@ -30,6 +30,8 @@ else()
endif()
if(ATDNA_DYNAMIC_LLVM)
find_library(CLANGCPP_LIB clang-cpp HINTS "${LLVM_ROOT_DIR}/lib")
if (NOT CLANGCPP_LIB)
list(APPEND LLVM_LIBS
clangFrontend
clangTooling
@ -43,6 +45,11 @@ if(ATDNA_DYNAMIC_LLVM)
clangLex
clangBasic
LLVM)
else()
list(APPEND LLVM_LIBS
clang-cpp
LLVM)
endif()
else()
find_library(LLVMDEMANGLE_LIB LLVMDemangle HINTS "${LLVM_ROOT_DIR}/lib")
find_library(LLVMBINARYFORMAT_LIB LLVMBinaryFormat HINTS "${LLVM_ROOT_DIR}/lib")
@ -52,7 +59,9 @@ else()
if (NOT LLVMBINARYFORMAT_LIB)
set(LLVMBINARYFORMAT_LIB "")
endif()
list(APPEND LLVM_LIBS
find_library(CLANG_CPP_LIB clang-cpp HINTS "${LLVM_ROOT_DIR}/lib")
if (NOT CLANG_CPP_LIB)
list(APPEND CLANG_LIBS
clangFrontend
clangTooling
clangDriver
@ -63,7 +72,14 @@ else()
clangEdit
clangAST
clangLex
clangBasic
clangBasic)
else()
list(APPEND CLANG_LIBS
clang-cpp)
endif()
list(APPEND LLVM_LIBS
${CLANG_LIBS}
LLVMCore
LLVMOption
LLVMMCParser
@ -134,6 +150,7 @@ if(MSVC)
target_compile_options(atdna PRIVATE /GR-)
else()
target_compile_options(atdna PRIVATE -fno-rtti -Wno-error)
set_property(TARGET atdna PROPERTY CXX_STANDARD 17)
endif()
# Define installs

View File

@ -1261,10 +1261,13 @@ int main(int argc, const char** argv) {
}
llvm::IntrusiveRefCntPtr<clang::FileManager> fman(new clang::FileManager(clang::FileSystemOptions()));
#if LLVM_VERSION_MAJOR >= 10
clang::tooling::ToolInvocation TI(std::move(args), std::make_unique<ATDNAAction>(), fman.get());
#else
ATDNAAction* action = new ATDNAAction();
clang::tooling::ToolInvocation TI(std::move(args), action, fman.get());
#endif
if (!TI.run())
return 1;
return 0;
}