Browse Source

Added support for VS 2017 by updating Clang.

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
pull/838/merge
Dimitar Dobrev 8 years ago
parent
commit
d7daed8273
  1. 2
      build/Clang-commit
  2. 2
      build/LLVM-commit
  3. 5
      build/LLVM.lua
  4. 1
      build/scripts/LLVM.lua
  5. 10
      src/CppParser/ELFDumper.h
  6. 15
      src/CppParser/Parser.cpp

2
build/Clang-commit

@ -1 +1 @@ @@ -1 +1 @@
6a795889c33eb039866a867b41c30fdf000e345d
e20a5f4e97e6bde6c10d591e8466b030b717d258

2
build/LLVM-commit

@ -1 +1 @@ @@ -1 +1 @@
cccdd2eff6e04737dfc4a2caf33ea1a6ee5fb80e
cad1431a1e4e8f9ceb11d463682fd868897d7af6

5
build/LLVM.lua

@ -161,6 +161,11 @@ function SetupLLVMLibs() @@ -161,6 +161,11 @@ function SetupLLVMLibs()
"LLVMCore",
"LLVMSupport",
}
if os.is("windows") then
configuration "*"
links { "LLVMBinaryFormat" }
end
configuration(c)
end

1
build/scripts/LLVM.lua

@ -317,6 +317,7 @@ function package_llvm(conf, llvm, llvm_build) @@ -317,6 +317,7 @@ function package_llvm(conf, llvm, llvm_build)
os.copydir(llvm .. "/tools/clang/lib/CodeGen", out .. "/tools/clang/lib/CodeGen", "*.h")
os.copydir(llvm .. "/tools/clang/lib/Driver", out .. "/tools/clang/lib/Driver", "*.h")
os.copydir(llvm .. "/tools/clang/lib/Driver/ToolChains", out .. "/tools/clang/lib/Driver/ToolChains", "*.h")
local out_lib_dir = out .. "/build" .. lib_dir
if os.is("windows") then

10
src/CppParser/ELFDumper.h

@ -53,7 +53,17 @@ template <typename ELFT> @@ -53,7 +53,17 @@ template <typename ELFT>
ELFDumper<ELFT>::ELFDumper(const llvm::object::ELFFile<ELFT> *Obj) {
llvm::SmallVector<const Elf_Phdr *, 4> LoadSegments;
#ifdef WIN32
auto& ProgramHeaders = Obj->program_headers();
if (ProgramHeaders.takeError())
{
llvm::report_fatal_error("Error reading program headers");
return;
}
for (const Elf_Phdr &Phdr : ProgramHeaders.get()) {
#else
for (const Elf_Phdr &Phdr : Obj->program_headers()) {
#endif // WIN32
if (Phdr.p_type == llvm::ELF::PT_DYNAMIC) {
DynamicRegion.Addr = Obj->base() + Phdr.p_offset;
uint64_t Size = Phdr.p_filesz;

15
src/CppParser/Parser.cpp

@ -48,7 +48,12 @@ @@ -48,7 +48,12 @@
#include <CodeGen/TargetInfo.h>
#include <CodeGen/CGCall.h>
#include <CodeGen/CGCXXABI.h>
#ifdef WIN32
#include <Driver/ToolChains/Linux.h>
#else
#include <Driver/ToolChains.h>
#endif // WIN32
#if defined(__APPLE__) || defined(__linux__)
#ifndef _GNU_SOURCE
@ -296,7 +301,12 @@ void Parser::SetupHeader() @@ -296,7 +301,12 @@ void Parser::SetupHeader()
CompilerInvocation* Inv = new CompilerInvocation();
CompilerInvocation::CreateFromArgs(*Inv, args.data(), args.data() + args.size(),
c->getDiagnostics());
#ifdef WIN32
c->setInvocation(std::shared_ptr<CompilerInvocation>(Inv));
#else
c->setInvocation(Inv);
#endif // WIN32
auto& TO = Inv->TargetOpts;
targetABI = ConvertToClangTargetCXXABI(opts->abi);
@ -3947,7 +3957,12 @@ ParserResult* Parser::ParseHeader(const std::vector<std::string>& SourceFiles, P @@ -3947,7 +3957,12 @@ ParserResult* Parser::ParseHeader(const std::vector<std::string>& SourceFiles, P
{
auto FileEntry = c->getPreprocessor().getHeaderSearchInfo().LookupFile(SourceFile,
clang::SourceLocation(), /*isAngled*/true,
#ifdef WIN32
nullptr, Dir, Includers, nullptr, nullptr, nullptr, nullptr, nullptr);
#else
nullptr, Dir, Includers, nullptr, nullptr, nullptr, nullptr);
#endif // WIN32
if (!FileEntry)
{
res->kind = ParserResultKind::FileNotFound;

Loading…
Cancel
Save