Conformance with LLVM 3.9

This commit is contained in:
Jack Andersen 2016-09-10 13:38:44 -10:00
parent ca09f732ba
commit d9a03aa69c
4 changed files with 35 additions and 26 deletions

View File

@ -44,12 +44,14 @@ set(CLANG_INCLUDE_DIR ${LLVM_LIBRARY_DIRS}/clang/${LLVM_VERSION_BASE}/include
CACHE PATH "Clang include dir" FORCE)
if(UNIX)
list(APPEND PLAT_LIBS z pthread curses)
if (APPLE)
list(APPEND PLAT_LIBS z pthread curses)
if (APPLE)
list(APPEND PLAT_LIBS dl)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
list(APPEND PLAT_LIBS dl)
endif()
endif()
elseif(WIN32)
list(APPEND PLAT_LIBS Mincore)
endif()
# Offer the user the choice of overriding the installation directories

View File

@ -33,7 +33,8 @@ if(WIN32)
get_filename_component(LLVM_ROOT_DIR [HKEY_LOCAL_MACHINE\\Software\\LLVM\\LLVM] ABSOLUTE)
endif()
set(llvm_config_names llvm-config-3.8 llvm-config38
set(llvm_config_names llvm-config-3.9 llvm-config39
llvm-config-3.8 llvm-config38
llvm-config-3.7 llvm-config37
llvm-config-3.6 llvm-config36
llvm-config-3.5 llvm-config35
@ -54,7 +55,9 @@ if ((WIN32 AND NOT(MINGW OR CYGWIN)) OR NOT LLVM_CONFIG)
message(FATAL_ERROR "LLVM_ROOT_DIR (${LLVM_ROOT_DIR}) is not a valid LLVM install")
endif()
# We incorporate the CMake features provided by LLVM:
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${LLVM_ROOT_DIR}/share/llvm/cmake")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
"${LLVM_ROOT_DIR}/share/llvm/cmake"
"${LLVM_ROOT_DIR}/lib/cmake/llvm")
include(LLVMConfig)
# Set properties
set(LLVM_HOST_TARGET ${TARGET_TRIPLE})

View File

@ -2323,22 +2323,22 @@ public:
class ATDNAConsumer : public clang::ASTConsumer
{
std::unique_ptr<StreamOut> fileOut;
ATDNAEmitVisitor emitVisitor;
StreamOut& fileOut;
public:
explicit ATDNAConsumer(clang::ASTContext& context, StreamOut& fo)
: emitVisitor(context, fo),
fileOut(fo) {}
explicit ATDNAConsumer(clang::ASTContext& context, std::unique_ptr<StreamOut>&& fo)
: fileOut(std::move(fo)),
emitVisitor(context, *fileOut) {}
void HandleTranslationUnit(clang::ASTContext& context)
{
/* Write file head */
fileOut << "/* Auto generated atdna implementation */\n"
"#include <athena/Global.hpp>\n"
"#include <athena/IStreamReader.hpp>\n"
"#include <athena/IStreamWriter.hpp>\n\n";
*fileOut << "/* Auto generated atdna implementation */\n"
"#include <athena/Global.hpp>\n"
"#include <athena/IStreamReader.hpp>\n"
"#include <athena/IStreamWriter.hpp>\n\n";
for (const std::string& inputf : InputFilenames)
fileOut << "#include \"" << inputf << "\"\n";
fileOut << "\n";
*fileOut << "#include \"" << inputf << "\"\n";
*fileOut << "\n";
/* Emit file */
emitVisitor.TraverseDecl(context.getTranslationUnitDecl());
@ -2352,13 +2352,20 @@ public:
std::unique_ptr<clang::ASTConsumer> CreateASTConsumer(clang::CompilerInstance& compiler,
llvm::StringRef /*filename*/)
{
StreamOut* fileout;
std::unique_ptr<StreamOut> fileout;
#if LLVM_VERSION_MAJOR > 3 || (LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 9)
if (OutputFilename.size())
fileout = compiler.createOutputFile(OutputFilename, false, true, "", "", true);
else
fileout = compiler.createDefaultOutputFile(false, "a", "cpp");
#else
if (OutputFilename.size())
fileout.reset(compiler.createOutputFile(OutputFilename, false, true, "", "", true));
else
fileout.reset(compiler.createDefaultOutputFile(false, "a", "cpp"));
#endif
AthenaError = compiler.getASTContext().getDiagnostics().getCustomDiagID(clang::DiagnosticsEngine::Error, "Athena error: %0");
return std::unique_ptr<clang::ASTConsumer>(new ATDNAConsumer(compiler.getASTContext(), *fileout));
return std::unique_ptr<clang::ASTConsumer>(new ATDNAConsumer(compiler.getASTContext(), std::move(fileout)));
}
};
@ -2372,9 +2379,6 @@ int main(int argc, const char** argv)
"-fsyntax-only",
"-std=c++14",
"-D__atdna__=1",
#if _WIN32
"-D__is_assignable(a,b)=false", /* HACK HACKITY HACK HACK: Microsoft, play nice with the other kids*/
#endif
"-I" XSTR(INSTALL_PREFIX) "/lib/clang/" CLANG_VERSION_STRING "/include",
"-I" XSTR(INSTALL_PREFIX) "/include/Athena"};
for (int a=1 ; a<argc ; ++a)

View File

@ -18,7 +18,7 @@ BEGIN
VALUE "CompanyName", "Jackoalan / Antidote"
VALUE "FileDescription", "ATDNA"
VALUE "FileVersion", "@ATHENA_MAJOR_VERSION@.@ATHENA_MINOR_VERSION@.@ATHENA_PATCH_VERSION@"
VALUE "LegalCopyright", "Copyright (C) 2015 Jackoalan / Antidote"
VALUE "LegalCopyright", "Copyright (C) 2016 Jackoalan / Antidote"
VALUE "InternalName", "atdna"
VALUE "OriginalFilename", "atdna.exe"
VALUE "ProductName", "ATDNA"