Skip to content

Commit

Permalink
Simplified the getting of the target info in the parser.
Browse files Browse the repository at this point in the history
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
  • Loading branch information
ddobrev committed Nov 15, 2017
1 parent 33bc64a commit 254cc0d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion examples/Parser/Parser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public static bool ParseSourceFile(string file)

// 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();
Expand Down
10 changes: 5 additions & 5 deletions src/CppParser/Parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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());
Expand Down

0 comments on commit 254cc0d

Please sign in to comment.