Browse Source

Simplified the getting of the target info in the parser.

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
pull/1005/head
Dimitar Dobrev 8 years ago
parent
commit
254cc0d279
  1. 2
      examples/Parser/Parser.cs
  2. 10
      src/CppParser/Parser.cpp

2
examples/Parser/Parser.cs

@ -68,7 +68,7 @@ namespace CppSharp @@ -68,7 +68,7 @@ namespace CppSharp
// First we will convert the output, bindings for the native Clang AST,
// to CppSharp's managed AST representation.
var astContext = ClangParser.ConvertASTContext(parserResult.ASTContext);
var astContext = ClangParser.ConvertASTContext(parserOptions.ASTContext);
// After its converted, we can dispose of the native AST bindings.
parserResult.Dispose();

10
src/CppParser/Parser.cpp

@ -113,7 +113,7 @@ void Parser::ReadClassLayout(Class* Class, const clang::RecordDecl* RD, @@ -113,7 +113,7 @@ void Parser::ReadClassLayout(Class* Class, const clang::RecordDecl* RD,
// Vtable pointer.
if (CXXRD->isDynamicClass() && !PrimaryBase &&
!c->getASTContext().getTargetInfo().getCXXABI().isMicrosoft()) {
!c->getTarget().getCXXABI().isMicrosoft()) {
auto VPtr = WalkVTablePointer(Parent, Offset, "vptr");
Class->layout->Fields.push_back(VPtr);
}
@ -2870,7 +2870,7 @@ bool Parser::CanCheckCodeGenInfo(clang::Sema& S, const clang::Type* Ty) @@ -2870,7 +2870,7 @@ bool Parser::CanCheckCodeGenInfo(clang::Sema& S, const clang::Type* Ty)
// Lock in the MS inheritance model if we have a member pointer to a class,
// else we get an assertion error inside Clang's codegen machinery.
if (c->getASTContext().getTargetInfo().getCXXABI().isMicrosoft())
if (c->getTarget().getCXXABI().isMicrosoft())
{
if (auto MPT = Ty->getAs<clang::MemberPointerType>())
if (!MPT->isDependentType())
@ -4049,8 +4049,8 @@ ParserResult* Parser::ParseHeader(const std::vector<std::string>& SourceFiles) @@ -4049,8 +4049,8 @@ ParserResult* Parser::ParseHeader(const std::vector<std::string>& SourceFiles)
llvm::LLVMContext Ctx;
std::unique_ptr<llvm::Module> M(new llvm::Module("", Ctx));
M->setTargetTriple(AST.getTargetInfo().getTriple().getTriple());
M->setDataLayout(AST.getTargetInfo().getDataLayout());
M->setTargetTriple(c->getTarget().getTriple().getTriple());
M->setDataLayout(c->getTarget().getDataLayout());
std::unique_ptr<clang::CodeGen::CodeGenModule> CGM(
new clang::CodeGen::CodeGenModule(c->getASTContext(), c->getHeaderSearchOpts(),
@ -4291,7 +4291,7 @@ ParserTargetInfo* Parser::GetTargetInfo() @@ -4291,7 +4291,7 @@ ParserTargetInfo* Parser::GetTargetInfo()
{
auto parserTargetInfo = new ParserTargetInfo();
auto& TI = c->getASTContext().getTargetInfo();
auto& TI = c->getTarget();
parserTargetInfo->ABI = TI.getABI();
parserTargetInfo->char16Type = ConvertIntType(TI.getChar16Type());

Loading…
Cancel
Save