Skip to content

Commit 254cc0d

Browse files
committed
Simplified the getting of the target info in the parser.
Signed-off-by: Dimitar Dobrev <[email protected]>
1 parent 33bc64a commit 254cc0d

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

examples/Parser/Parser.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public static bool ParseSourceFile(string file)
6868

6969
// First we will convert the output, bindings for the native Clang AST,
7070
// to CppSharp's managed AST representation.
71-
var astContext = ClangParser.ConvertASTContext(parserResult.ASTContext);
71+
var astContext = ClangParser.ConvertASTContext(parserOptions.ASTContext);
7272

7373
// After its converted, we can dispose of the native AST bindings.
7474
parserResult.Dispose();

src/CppParser/Parser.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ void Parser::ReadClassLayout(Class* Class, const clang::RecordDecl* RD,
113113

114114
// Vtable pointer.
115115
if (CXXRD->isDynamicClass() && !PrimaryBase &&
116-
!c->getASTContext().getTargetInfo().getCXXABI().isMicrosoft()) {
116+
!c->getTarget().getCXXABI().isMicrosoft()) {
117117
auto VPtr = WalkVTablePointer(Parent, Offset, "vptr");
118118
Class->layout->Fields.push_back(VPtr);
119119
}
@@ -2870,7 +2870,7 @@ bool Parser::CanCheckCodeGenInfo(clang::Sema& S, const clang::Type* Ty)
28702870

28712871
// Lock in the MS inheritance model if we have a member pointer to a class,
28722872
// else we get an assertion error inside Clang's codegen machinery.
2873-
if (c->getASTContext().getTargetInfo().getCXXABI().isMicrosoft())
2873+
if (c->getTarget().getCXXABI().isMicrosoft())
28742874
{
28752875
if (auto MPT = Ty->getAs<clang::MemberPointerType>())
28762876
if (!MPT->isDependentType())
@@ -4049,8 +4049,8 @@ ParserResult* Parser::ParseHeader(const std::vector<std::string>& SourceFiles)
40494049
llvm::LLVMContext Ctx;
40504050
std::unique_ptr<llvm::Module> M(new llvm::Module("", Ctx));
40514051

4052-
M->setTargetTriple(AST.getTargetInfo().getTriple().getTriple());
4053-
M->setDataLayout(AST.getTargetInfo().getDataLayout());
4052+
M->setTargetTriple(c->getTarget().getTriple().getTriple());
4053+
M->setDataLayout(c->getTarget().getDataLayout());
40544054

40554055
std::unique_ptr<clang::CodeGen::CodeGenModule> CGM(
40564056
new clang::CodeGen::CodeGenModule(c->getASTContext(), c->getHeaderSearchOpts(),
@@ -4291,7 +4291,7 @@ ParserTargetInfo* Parser::GetTargetInfo()
42914291
{
42924292
auto parserTargetInfo = new ParserTargetInfo();
42934293

4294-
auto& TI = c->getASTContext().getTargetInfo();
4294+
auto& TI = c->getTarget();
42954295
parserTargetInfo->ABI = TI.getABI();
42964296

42974297
parserTargetInfo->char16Type = ConvertIntType(TI.getChar16Type());

0 commit comments

Comments
 (0)