Browse Source

Fixed the Unix build after upgrading the Unix Clang packages.

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
pull/838/merge
Dimitar Dobrev 9 years ago
parent
commit
f946eea70e
  1. 5
      build/LLVM.lua
  2. 6
      src/CppParser/ELFDumper.h
  3. 12
      src/CppParser/Parser.cpp

5
build/LLVM.lua

@ -137,6 +137,7 @@ function SetupLLVMLibs()
"LLVMLinker", "LLVMLinker",
"LLVMipo", "LLVMipo",
"LLVMVectorize", "LLVMVectorize",
"LLVMBinaryFormat",
"LLVMBitWriter", "LLVMBitWriter",
"LLVMIRReader", "LLVMIRReader",
"LLVMAsmParser", "LLVMAsmParser",
@ -162,10 +163,6 @@ function SetupLLVMLibs()
"LLVMCore", "LLVMCore",
"LLVMSupport", "LLVMSupport",
} }
if os.istarget("windows") then
links { "LLVMBinaryFormat" }
end
filter(c) filter(c)
end end

6
src/CppParser/ELFDumper.h

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

12
src/CppParser/Parser.cpp

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

Loading…
Cancel
Save