Permalink
Browse files

Added support for VS 2017 by updating Clang.

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
  • Loading branch information...
ddobrev committed Jul 4, 2017
1 parent 346bc97 commit d7daed827373e52ab5e365640be4b2770f9acb6f
Showing with 33 additions and 2 deletions.
  1. +1 −1 build/Clang-commit
  2. +1 −1 build/LLVM-commit
  3. +5 −0 build/LLVM.lua
  4. +1 −0 build/scripts/LLVM.lua
  5. +10 −0 src/CppParser/ELFDumper.h
  6. +15 −0 src/CppParser/Parser.cpp
@@ -1 +1 @@
6a795889c33eb039866a867b41c30fdf000e345d
e20a5f4e97e6bde6c10d591e8466b030b717d258
@@ -1 +1 @@
cccdd2eff6e04737dfc4a2caf33ea1a6ee5fb80e
cad1431a1e4e8f9ceb11d463682fd868897d7af6
@@ -161,6 +161,11 @@ function SetupLLVMLibs()
"LLVMCore",
"LLVMSupport",
}
if os.is("windows") then
configuration "*"
links { "LLVMBinaryFormat" }
end
configuration(c)
end
@@ -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
@@ -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;
@@ -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()
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
{
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;

3 comments on commit d7daed8

@realvictorprm

This comment has been minimized.

Contributor

realvictorprm replied Jul 5, 2017

Looks like I can have a small party here 😃

@realvictorprm

This comment has been minimized.

Contributor

realvictorprm replied Jul 5, 2017

@ddobrev
Okay, cheered too soon. While using developer command prompt for vs 2017 the result of download deps was this:

E:\Development\CppSharp\CppSharpOrigin\build>"premake5" --file=scripts/LLVM.lua download_llvm
Downloading: https://github.com/mono/CppSharp/releases/download/CppSharp/llvm-cad143-windows-vs2017-x86-RelWithDebInfo.7z
Error: ...ment/CppSharp/CppSharpOrigin/build/scripts/Utils.lua:96: HTTP response code said error
The requested URL returned error: 404 Not Found
@realvictorprm

This comment has been minimized.

Contributor

realvictorprm replied Jul 5, 2017

Okay fixed, thanks @ddobrev

Please sign in to comment.