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

@ -50,6 +50,8 @@ if (APPLE)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux") elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
list(APPEND PLAT_LIBS dl) list(APPEND PLAT_LIBS dl)
endif() endif()
elseif(WIN32)
list(APPEND PLAT_LIBS Mincore)
endif() endif()
# Offer the user the choice of overriding the installation directories # 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) get_filename_component(LLVM_ROOT_DIR [HKEY_LOCAL_MACHINE\\Software\\LLVM\\LLVM] ABSOLUTE)
endif() 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.7 llvm-config37
llvm-config-3.6 llvm-config36 llvm-config-3.6 llvm-config36
llvm-config-3.5 llvm-config35 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") message(FATAL_ERROR "LLVM_ROOT_DIR (${LLVM_ROOT_DIR}) is not a valid LLVM install")
endif() endif()
# We incorporate the CMake features provided by LLVM: # 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) include(LLVMConfig)
# Set properties # Set properties
set(LLVM_HOST_TARGET ${TARGET_TRIPLE}) set(LLVM_HOST_TARGET ${TARGET_TRIPLE})

View File

@ -2323,22 +2323,22 @@ public:
class ATDNAConsumer : public clang::ASTConsumer class ATDNAConsumer : public clang::ASTConsumer
{ {
std::unique_ptr<StreamOut> fileOut;
ATDNAEmitVisitor emitVisitor; ATDNAEmitVisitor emitVisitor;
StreamOut& fileOut;
public: public:
explicit ATDNAConsumer(clang::ASTContext& context, StreamOut& fo) explicit ATDNAConsumer(clang::ASTContext& context, std::unique_ptr<StreamOut>&& fo)
: emitVisitor(context, fo), : fileOut(std::move(fo)),
fileOut(fo) {} emitVisitor(context, *fileOut) {}
void HandleTranslationUnit(clang::ASTContext& context) void HandleTranslationUnit(clang::ASTContext& context)
{ {
/* Write file head */ /* Write file head */
fileOut << "/* Auto generated atdna implementation */\n" *fileOut << "/* Auto generated atdna implementation */\n"
"#include <athena/Global.hpp>\n" "#include <athena/Global.hpp>\n"
"#include <athena/IStreamReader.hpp>\n" "#include <athena/IStreamReader.hpp>\n"
"#include <athena/IStreamWriter.hpp>\n\n"; "#include <athena/IStreamWriter.hpp>\n\n";
for (const std::string& inputf : InputFilenames) for (const std::string& inputf : InputFilenames)
fileOut << "#include \"" << inputf << "\"\n"; *fileOut << "#include \"" << inputf << "\"\n";
fileOut << "\n"; *fileOut << "\n";
/* Emit file */ /* Emit file */
emitVisitor.TraverseDecl(context.getTranslationUnitDecl()); emitVisitor.TraverseDecl(context.getTranslationUnitDecl());
@ -2352,13 +2352,20 @@ public:
std::unique_ptr<clang::ASTConsumer> CreateASTConsumer(clang::CompilerInstance& compiler, std::unique_ptr<clang::ASTConsumer> CreateASTConsumer(clang::CompilerInstance& compiler,
llvm::StringRef /*filename*/) 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()) if (OutputFilename.size())
fileout = compiler.createOutputFile(OutputFilename, false, true, "", "", true); fileout = compiler.createOutputFile(OutputFilename, false, true, "", "", true);
else else
fileout = compiler.createDefaultOutputFile(false, "a", "cpp"); 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"); 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", "-fsyntax-only",
"-std=c++14", "-std=c++14",
"-D__atdna__=1", "-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) "/lib/clang/" CLANG_VERSION_STRING "/include",
"-I" XSTR(INSTALL_PREFIX) "/include/Athena"}; "-I" XSTR(INSTALL_PREFIX) "/include/Athena"};
for (int a=1 ; a<argc ; ++a) for (int a=1 ; a<argc ; ++a)

View File

@ -18,7 +18,7 @@ BEGIN
VALUE "CompanyName", "Jackoalan / Antidote" VALUE "CompanyName", "Jackoalan / Antidote"
VALUE "FileDescription", "ATDNA" VALUE "FileDescription", "ATDNA"
VALUE "FileVersion", "@ATHENA_MAJOR_VERSION@.@ATHENA_MINOR_VERSION@.@ATHENA_PATCH_VERSION@" 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 "InternalName", "atdna"
VALUE "OriginalFilename", "atdna.exe" VALUE "OriginalFilename", "atdna.exe"
VALUE "ProductName", "ATDNA" VALUE "ProductName", "ATDNA"