Browse Source

Deleted useless fields from the parser.

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
pull/1005/head
Dimitar Dobrev 8 years ago
parent
commit
28f42bb1c7
  1. 10
      src/CppParser/Bindings/CLI/CppParser.cpp
  2. 6
      src/CppParser/Bindings/CLI/CppParser.h
  3. 23
      src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/CppSharp.CppParser.cs
  4. 23
      src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/CppSharp.CppParser.cs
  5. 23
      src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/CppSharp.CppParser.cs
  6. 23
      src/CppParser/Bindings/CSharp/x86_64-linux-gnu-cxx11abi/CppSharp.CppParser.cs
  7. 23
      src/CppParser/Bindings/CSharp/x86_64-linux-gnu/CppSharp.CppParser.cs
  8. 23
      src/CppParser/Bindings/CSharp/x86_64-pc-win32-msvc/CppSharp.CppParser.cs
  9. 6
      src/CppParser/Comments.cpp
  10. 4
      src/CppParser/CppParser.cpp
  11. 1
      src/CppParser/CppParser.h
  12. 44
      src/CppParser/Parser.cpp
  13. 2
      src/CppParser/Parser.h

10
src/CppParser/Bindings/CLI/CppParser.cpp

@ -723,16 +723,6 @@ void CppSharp::Parser::ParserResult::Diagnostics::set(System::Collections::Gener @@ -723,16 +723,6 @@ void CppSharp::Parser::ParserResult::Diagnostics::set(System::Collections::Gener
((::CppSharp::CppParser::ParserResult*)NativePtr)->Diagnostics = _tmpvalue;
}
CppSharp::Parser::AST::ASTContext^ CppSharp::Parser::ParserResult::ASTContext::get()
{
return (((::CppSharp::CppParser::ParserResult*)NativePtr)->ASTContext == nullptr) ? nullptr : gcnew CppSharp::Parser::AST::ASTContext((::CppSharp::CppParser::AST::ASTContext*)((::CppSharp::CppParser::ParserResult*)NativePtr)->ASTContext);
}
void CppSharp::Parser::ParserResult::ASTContext::set(CppSharp::Parser::AST::ASTContext^ value)
{
((::CppSharp::CppParser::ParserResult*)NativePtr)->ASTContext = (::CppSharp::CppParser::AST::ASTContext*)value->NativePtr;
}
CppSharp::Parser::AST::NativeLibrary^ CppSharp::Parser::ParserResult::Library::get()
{
return (((::CppSharp::CppParser::ParserResult*)NativePtr)->library == nullptr) ? nullptr : gcnew CppSharp::Parser::AST::NativeLibrary((::CppSharp::CppParser::AST::NativeLibrary*)((::CppSharp::CppParser::ParserResult*)NativePtr)->library);

6
src/CppParser/Bindings/CLI/CppParser.h

@ -368,12 +368,6 @@ namespace CppSharp @@ -368,12 +368,6 @@ namespace CppSharp
void set(System::Collections::Generic::List<CppSharp::Parser::ParserDiagnostic^>^);
}
property CppSharp::Parser::AST::ASTContext^ ASTContext
{
CppSharp::Parser::AST::ASTContext^ get();
void set(CppSharp::Parser::AST::ASTContext^);
}
property CppSharp::Parser::AST::NativeLibrary^ Library
{
CppSharp::Parser::AST::NativeLibrary^ get();

23
src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/CppSharp.CppParser.cs

@ -18772,7 +18772,7 @@ namespace CppSharp @@ -18772,7 +18772,7 @@ namespace CppSharp
public unsafe partial class ParserResult : IDisposable
{
[StructLayout(LayoutKind.Explicit, Size = 24)]
[StructLayout(LayoutKind.Explicit, Size = 20)]
public partial struct __Internal
{
[FieldOffset(0)]
@ -18782,9 +18782,6 @@ namespace CppSharp @@ -18782,9 +18782,6 @@ namespace CppSharp
internal global::Std.Vector.__Internalc__N_std_N___1_S_vector____N_CppSharp_N_CppParser_S_ParserDiagnostic___N_std_N___1_S_allocator__S0_ Diagnostics;
[FieldOffset(16)]
internal global::System.IntPtr ASTContext;
[FieldOffset(20)]
internal global::System.IntPtr library;
[SuppressUnmanagedCodeSecurity]
@ -18932,24 +18929,6 @@ namespace CppSharp @@ -18932,24 +18929,6 @@ namespace CppSharp
}
}
public global::CppSharp.Parser.AST.ASTContext ASTContext
{
get
{
global::CppSharp.Parser.AST.ASTContext __result0;
if (((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->ASTContext == IntPtr.Zero) __result0 = null;
else if (global::CppSharp.Parser.AST.ASTContext.NativeToManagedMap.ContainsKey(((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->ASTContext))
__result0 = (global::CppSharp.Parser.AST.ASTContext) global::CppSharp.Parser.AST.ASTContext.NativeToManagedMap[((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->ASTContext];
else __result0 = global::CppSharp.Parser.AST.ASTContext.__CreateInstance(((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->ASTContext);
return __result0;
}
set
{
((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->ASTContext = ReferenceEquals(value, null) ? global::System.IntPtr.Zero : value.__Instance;
}
}
public global::CppSharp.Parser.AST.NativeLibrary Library
{
get

23
src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/CppSharp.CppParser.cs

@ -18772,7 +18772,7 @@ namespace CppSharp @@ -18772,7 +18772,7 @@ namespace CppSharp
public unsafe partial class ParserResult : IDisposable
{
[StructLayout(LayoutKind.Explicit, Size = 24)]
[StructLayout(LayoutKind.Explicit, Size = 20)]
public partial struct __Internal
{
[FieldOffset(0)]
@ -18782,9 +18782,6 @@ namespace CppSharp @@ -18782,9 +18782,6 @@ namespace CppSharp
internal global::Std.Vector.__Internalc__N_std_S_vector____N_CppSharp_N_CppParser_S_ParserDiagnostic___N_std_S_allocator__S0_ Diagnostics;
[FieldOffset(16)]
internal global::System.IntPtr ASTContext;
[FieldOffset(20)]
internal global::System.IntPtr library;
[SuppressUnmanagedCodeSecurity]
@ -18932,24 +18929,6 @@ namespace CppSharp @@ -18932,24 +18929,6 @@ namespace CppSharp
}
}
public global::CppSharp.Parser.AST.ASTContext ASTContext
{
get
{
global::CppSharp.Parser.AST.ASTContext __result0;
if (((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->ASTContext == IntPtr.Zero) __result0 = null;
else if (global::CppSharp.Parser.AST.ASTContext.NativeToManagedMap.ContainsKey(((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->ASTContext))
__result0 = (global::CppSharp.Parser.AST.ASTContext) global::CppSharp.Parser.AST.ASTContext.NativeToManagedMap[((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->ASTContext];
else __result0 = global::CppSharp.Parser.AST.ASTContext.__CreateInstance(((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->ASTContext);
return __result0;
}
set
{
((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->ASTContext = ReferenceEquals(value, null) ? global::System.IntPtr.Zero : value.__Instance;
}
}
public global::CppSharp.Parser.AST.NativeLibrary Library
{
get

23
src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/CppSharp.CppParser.cs

@ -18771,7 +18771,7 @@ namespace CppSharp @@ -18771,7 +18771,7 @@ namespace CppSharp
public unsafe partial class ParserResult : IDisposable
{
[StructLayout(LayoutKind.Explicit, Size = 48)]
[StructLayout(LayoutKind.Explicit, Size = 40)]
public partial struct __Internal
{
[FieldOffset(0)]
@ -18781,9 +18781,6 @@ namespace CppSharp @@ -18781,9 +18781,6 @@ namespace CppSharp
internal global::Std.Vector.__Internalc__N_std_N___1_S_vector____N_CppSharp_N_CppParser_S_ParserDiagnostic___N_std_N___1_S_allocator__S0_ Diagnostics;
[FieldOffset(32)]
internal global::System.IntPtr ASTContext;
[FieldOffset(40)]
internal global::System.IntPtr library;
[SuppressUnmanagedCodeSecurity]
@ -18931,24 +18928,6 @@ namespace CppSharp @@ -18931,24 +18928,6 @@ namespace CppSharp
}
}
public global::CppSharp.Parser.AST.ASTContext ASTContext
{
get
{
global::CppSharp.Parser.AST.ASTContext __result0;
if (((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->ASTContext == IntPtr.Zero) __result0 = null;
else if (global::CppSharp.Parser.AST.ASTContext.NativeToManagedMap.ContainsKey(((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->ASTContext))
__result0 = (global::CppSharp.Parser.AST.ASTContext) global::CppSharp.Parser.AST.ASTContext.NativeToManagedMap[((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->ASTContext];
else __result0 = global::CppSharp.Parser.AST.ASTContext.__CreateInstance(((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->ASTContext);
return __result0;
}
set
{
((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->ASTContext = ReferenceEquals(value, null) ? global::System.IntPtr.Zero : value.__Instance;
}
}
public global::CppSharp.Parser.AST.NativeLibrary Library
{
get

23
src/CppParser/Bindings/CSharp/x86_64-linux-gnu-cxx11abi/CppSharp.CppParser.cs

@ -18771,7 +18771,7 @@ namespace CppSharp @@ -18771,7 +18771,7 @@ namespace CppSharp
public unsafe partial class ParserResult : IDisposable
{
[StructLayout(LayoutKind.Explicit, Size = 48)]
[StructLayout(LayoutKind.Explicit, Size = 40)]
public partial struct __Internal
{
[FieldOffset(0)]
@ -18781,9 +18781,6 @@ namespace CppSharp @@ -18781,9 +18781,6 @@ namespace CppSharp
internal global::Std.Vector.__Internalc__N_std_S_vector____N_CppSharp_N_CppParser_S_ParserDiagnostic___N_std_S_allocator__S0_ Diagnostics;
[FieldOffset(32)]
internal global::System.IntPtr ASTContext;
[FieldOffset(40)]
internal global::System.IntPtr library;
[SuppressUnmanagedCodeSecurity]
@ -18931,24 +18928,6 @@ namespace CppSharp @@ -18931,24 +18928,6 @@ namespace CppSharp
}
}
public global::CppSharp.Parser.AST.ASTContext ASTContext
{
get
{
global::CppSharp.Parser.AST.ASTContext __result0;
if (((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->ASTContext == IntPtr.Zero) __result0 = null;
else if (global::CppSharp.Parser.AST.ASTContext.NativeToManagedMap.ContainsKey(((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->ASTContext))
__result0 = (global::CppSharp.Parser.AST.ASTContext) global::CppSharp.Parser.AST.ASTContext.NativeToManagedMap[((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->ASTContext];
else __result0 = global::CppSharp.Parser.AST.ASTContext.__CreateInstance(((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->ASTContext);
return __result0;
}
set
{
((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->ASTContext = ReferenceEquals(value, null) ? global::System.IntPtr.Zero : value.__Instance;
}
}
public global::CppSharp.Parser.AST.NativeLibrary Library
{
get

23
src/CppParser/Bindings/CSharp/x86_64-linux-gnu/CppSharp.CppParser.cs

@ -18771,7 +18771,7 @@ namespace CppSharp @@ -18771,7 +18771,7 @@ namespace CppSharp
public unsafe partial class ParserResult : IDisposable
{
[StructLayout(LayoutKind.Explicit, Size = 48)]
[StructLayout(LayoutKind.Explicit, Size = 40)]
public partial struct __Internal
{
[FieldOffset(0)]
@ -18781,9 +18781,6 @@ namespace CppSharp @@ -18781,9 +18781,6 @@ namespace CppSharp
internal global::Std.Vector.__Internalc__N_std_S_vector____N_CppSharp_N_CppParser_S_ParserDiagnostic___N_std_S_allocator__S0_ Diagnostics;
[FieldOffset(32)]
internal global::System.IntPtr ASTContext;
[FieldOffset(40)]
internal global::System.IntPtr library;
[SuppressUnmanagedCodeSecurity]
@ -18931,24 +18928,6 @@ namespace CppSharp @@ -18931,24 +18928,6 @@ namespace CppSharp
}
}
public global::CppSharp.Parser.AST.ASTContext ASTContext
{
get
{
global::CppSharp.Parser.AST.ASTContext __result0;
if (((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->ASTContext == IntPtr.Zero) __result0 = null;
else if (global::CppSharp.Parser.AST.ASTContext.NativeToManagedMap.ContainsKey(((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->ASTContext))
__result0 = (global::CppSharp.Parser.AST.ASTContext) global::CppSharp.Parser.AST.ASTContext.NativeToManagedMap[((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->ASTContext];
else __result0 = global::CppSharp.Parser.AST.ASTContext.__CreateInstance(((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->ASTContext);
return __result0;
}
set
{
((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->ASTContext = ReferenceEquals(value, null) ? global::System.IntPtr.Zero : value.__Instance;
}
}
public global::CppSharp.Parser.AST.NativeLibrary Library
{
get

23
src/CppParser/Bindings/CSharp/x86_64-pc-win32-msvc/CppSharp.CppParser.cs

@ -18772,7 +18772,7 @@ namespace CppSharp @@ -18772,7 +18772,7 @@ namespace CppSharp
public unsafe partial class ParserResult : IDisposable
{
[StructLayout(LayoutKind.Explicit, Size = 48)]
[StructLayout(LayoutKind.Explicit, Size = 40)]
public partial struct __Internal
{
[FieldOffset(0)]
@ -18782,9 +18782,6 @@ namespace CppSharp @@ -18782,9 +18782,6 @@ namespace CppSharp
internal global::Std.Vector.__Internalc__N_std_S_vector____N_CppSharp_N_CppParser_S_ParserDiagnostic___N_std_S_allocator__S0_ Diagnostics;
[FieldOffset(32)]
internal global::System.IntPtr ASTContext;
[FieldOffset(40)]
internal global::System.IntPtr library;
[SuppressUnmanagedCodeSecurity]
@ -18932,24 +18929,6 @@ namespace CppSharp @@ -18932,24 +18929,6 @@ namespace CppSharp
}
}
public global::CppSharp.Parser.AST.ASTContext ASTContext
{
get
{
global::CppSharp.Parser.AST.ASTContext __result0;
if (((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->ASTContext == IntPtr.Zero) __result0 = null;
else if (global::CppSharp.Parser.AST.ASTContext.NativeToManagedMap.ContainsKey(((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->ASTContext))
__result0 = (global::CppSharp.Parser.AST.ASTContext) global::CppSharp.Parser.AST.ASTContext.NativeToManagedMap[((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->ASTContext];
else __result0 = global::CppSharp.Parser.AST.ASTContext.__CreateInstance(((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->ASTContext);
return __result0;
}
set
{
((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->ASTContext = ReferenceEquals(value, null) ? global::System.IntPtr.Zero : value.__Instance;
}
}
public global::CppSharp.Parser.AST.NativeLibrary Library
{
get

6
src/CppParser/Comments.cpp

@ -42,7 +42,7 @@ RawComment* Parser::WalkRawComment(const clang::RawComment* RC) @@ -42,7 +42,7 @@ RawComment* Parser::WalkRawComment(const clang::RawComment* RC)
auto Comment = new RawComment();
Comment->kind = ConvertRawCommentKind(RC->getKind());
Comment->text = RC->getRawText(SM);
Comment->briefText = RC->getBriefText(*AST);
Comment->briefText = RC->getBriefText(c->getASTContext());
return Comment;
}
@ -261,13 +261,13 @@ void Parser::HandleComments(const clang::Decl* D, Declaration* Decl) @@ -261,13 +261,13 @@ void Parser::HandleComments(const clang::Decl* D, Declaration* Decl)
using namespace clang;
const clang::RawComment* RC = 0;
if (!(RC = AST->getRawCommentForAnyRedecl(D)))
if (!(RC = c->getASTContext().getRawCommentForAnyRedecl(D)))
return;
auto RawComment = WalkRawComment(RC);
Decl->comment = RawComment;
if (clang::comments::FullComment* FC = RC->parse(*AST, &c->getPreprocessor(), D))
if (clang::comments::FullComment* FC = RC->parse(c->getASTContext(), &c->getPreprocessor(), D))
{
auto CB = static_cast<FullComment*>(ConvertCommentBlock(FC));
RawComment->fullCommentBlock = CB;

4
src/CppParser/CppParser.cpp

@ -34,15 +34,13 @@ DEF_VECTOR_STRING(CppParserOptions, LibraryDirs) @@ -34,15 +34,13 @@ DEF_VECTOR_STRING(CppParserOptions, LibraryDirs)
DEF_VECTOR_STRING(CppParserOptions, SupportedStdTypes)
ParserResult::ParserResult()
: ASTContext(0)
, library(0)
: library(0)
{
}
ParserResult::ParserResult(const ParserResult& rhs)
: kind(rhs.kind)
, Diagnostics(rhs.Diagnostics)
, ASTContext(rhs.ASTContext)
, library(rhs.library)
{}

1
src/CppParser/CppParser.h

@ -84,7 +84,6 @@ struct CS_API ParserResult @@ -84,7 +84,6 @@ struct CS_API ParserResult
ParserResultKind kind;
VECTOR(ParserDiagnostic, Diagnostics)
CppSharp::CppParser::AST::ASTContext* ASTContext;
NativeLibrary* library;
};

44
src/CppParser/Parser.cpp

@ -68,7 +68,7 @@ void* IgnorePtr = reinterpret_cast<void*>(0x1); @@ -68,7 +68,7 @@ void* IgnorePtr = reinterpret_cast<void*>(0x1);
//-----------------------------------//
Parser::Parser(CppParserOptions* Opts) : lib(Opts->ASTContext), opts(Opts), index(0)
Parser::Parser(CppParserOptions* Opts) : opts(Opts), index(0)
{
for (const auto& SupportedStdType : Opts->SupportedStdTypes)
supportedStdTypes.insert(SupportedStdType);
@ -396,13 +396,14 @@ std::string Parser::GetDeclMangledName(const clang::Decl* D) @@ -396,13 +396,14 @@ std::string Parser::GetDeclMangledName(const clang::Decl* D)
auto ND = cast<NamedDecl>(D);
std::unique_ptr<MangleContext> MC;
auto& AST = c->getASTContext();
switch(targetABI)
{
default:
MC.reset(ItaniumMangleContext::create(*AST, AST->getDiagnostics()));
MC.reset(ItaniumMangleContext::create(AST, AST.getDiagnostics()));
break;
case TargetCXXABI::Microsoft:
MC.reset(MicrosoftMangleContext::create(*AST, AST->getDiagnostics()));
MC.reset(MicrosoftMangleContext::create(AST, AST.getDiagnostics()));
break;
}
@ -686,12 +687,13 @@ void Parser::WalkVTable(const clang::CXXRecordDecl* RD, Class* C) @@ -686,12 +687,13 @@ void Parser::WalkVTable(const clang::CXXRecordDecl* RD, Class* C)
if (!C->layout)
C->layout = new ClassLayout();
auto& AST = c->getASTContext();
switch(targetABI)
{
case TargetCXXABI::Microsoft:
{
C->layout->ABI = CppAbi::Microsoft;
MicrosoftVTableContext VTContext(*AST);
MicrosoftVTableContext VTContext(AST);
const auto& VFPtrs = VTContext.getVFPtrOffsets(RD);
for (const auto& VFPtrInfo : VFPtrs)
@ -710,7 +712,7 @@ void Parser::WalkVTable(const clang::CXXRecordDecl* RD, Class* C) @@ -710,7 +712,7 @@ void Parser::WalkVTable(const clang::CXXRecordDecl* RD, Class* C)
case TargetCXXABI::GenericItanium:
{
C->layout->ABI = CppAbi::Itanium;
ItaniumVTableContext VTContext(*AST);
ItaniumVTableContext VTContext(AST);
auto& VTLayout = VTContext.getVTableLayout(RD);
C->layout->layout = WalkVTableLayout(VTLayout);
@ -1868,7 +1870,7 @@ TranslationUnit* Parser::GetTranslationUnit(clang::SourceLocation Loc, @@ -1868,7 +1870,7 @@ TranslationUnit* Parser::GetTranslationUnit(clang::SourceLocation Loc,
if (Kind)
*Kind = LocKind;
auto Unit = lib->FindOrCreateModule(File);
auto Unit = opts->ASTContext->FindOrCreateModule(File);
Unit->originalPtr = (void*) Unit;
assert(Unit->originalPtr != nullptr);
@ -2161,9 +2163,10 @@ Type* Parser::WalkType(clang::QualType QualType, const clang::TypeLoc* TL, @@ -2161,9 +2163,10 @@ Type* Parser::WalkType(clang::QualType QualType, const clang::TypeLoc* TL,
const clang::Type* Type = QualType.getTypePtr();
auto& AST = c->getASTContext();
if (DesugarType)
{
clang::QualType Desugared = QualType.getDesugaredType(*AST);
clang::QualType Desugared = QualType.getDesugaredType(AST);
assert(!Desugared.isNull() && "Expected a valid desugared type");
Type = Desugared.getTypePtr();
}
@ -2303,7 +2306,7 @@ Type* Parser::WalkType(clang::QualType QualType, const clang::TypeLoc* TL, @@ -2303,7 +2306,7 @@ Type* Parser::WalkType(clang::QualType QualType, const clang::TypeLoc* TL,
}
case clang::Type::ConstantArray:
{
auto AT = AST->getAsConstantArrayType(QualType);
auto AT = AST.getAsConstantArrayType(QualType);
TypeLoc Next;
if (LocValid) Next = TL->getNextTypeLoc();
@ -2312,16 +2315,16 @@ Type* Parser::WalkType(clang::QualType QualType, const clang::TypeLoc* TL, @@ -2312,16 +2315,16 @@ Type* Parser::WalkType(clang::QualType QualType, const clang::TypeLoc* TL,
auto ElemTy = AT->getElementType();
A->qualifiedType = GetQualifiedType(ElemTy, &Next);
A->sizeType = ArrayType::ArraySize::Constant;
A->size = AST->getConstantArrayElementCount(AT);
A->size = AST.getConstantArrayElementCount(AT);
if (!ElemTy->isDependentType())
A->elementSize = (long)AST->getTypeSize(ElemTy);
A->elementSize = (long)AST.getTypeSize(ElemTy);
Ty = A;
break;
}
case clang::Type::IncompleteArray:
{
auto AT = AST->getAsIncompleteArrayType(QualType);
auto AT = AST.getAsIncompleteArrayType(QualType);
TypeLoc Next;
if (LocValid) Next = TL->getNextTypeLoc();
@ -2335,7 +2338,7 @@ Type* Parser::WalkType(clang::QualType QualType, const clang::TypeLoc* TL, @@ -2335,7 +2338,7 @@ Type* Parser::WalkType(clang::QualType QualType, const clang::TypeLoc* TL,
}
case clang::Type::DependentSizedArray:
{
auto AT = AST->getAsDependentSizedArrayType(QualType);
auto AT = AST.getAsDependentSizedArrayType(QualType);
TypeLoc Next;
if (LocValid) Next = TL->getNextTypeLoc();
@ -3191,7 +3194,7 @@ bool Parser::IsValidDeclaration(const clang::SourceLocation& Loc) @@ -3191,7 +3194,7 @@ bool Parser::IsValidDeclaration(const clang::SourceLocation& Loc)
void Parser::WalkAST()
{
auto TU = AST->getTranslationUnitDecl();
auto TU = c->getASTContext().getTranslationUnitDecl();
for (auto D : TU->decls())
{
if (D->getLocStart().isValid() &&
@ -3963,7 +3966,6 @@ ParserResult* Parser::ParseHeader(const std::vector<std::string>& SourceFiles) @@ -3963,7 +3966,6 @@ ParserResult* Parser::ParseHeader(const std::vector<std::string>& SourceFiles)
assert(opts->ASTContext && "Expected a valid ASTContext");
auto res = new ParserResult();
res->ASTContext = lib;
if (SourceFiles.empty())
{
@ -4031,13 +4033,13 @@ ParserResult* Parser::ParseHeader(const std::vector<std::string>& SourceFiles) @@ -4031,13 +4033,13 @@ ParserResult* Parser::ParseHeader(const std::vector<std::string>& SourceFiles)
return res;
}
AST = &c->getASTContext();
auto& AST = c->getASTContext();
auto FileEntry = FileEntries[0];
auto FileName = FileEntry->getName();
auto Unit = lib->FindOrCreateModule(FileName);
auto Unit = opts->ASTContext->FindOrCreateModule(FileName);
auto TU = AST->getTranslationUnitDecl();
auto TU = AST.getTranslationUnitDecl();
HandleDeclaration(TU, Unit);
if (Unit->originalPtr == nullptr)
@ -4047,8 +4049,8 @@ ParserResult* Parser::ParseHeader(const std::vector<std::string>& SourceFiles) @@ -4047,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(AST.getTargetInfo().getTriple().getTriple());
M->setDataLayout(AST.getTargetInfo().getDataLayout());
std::unique_ptr<clang::CodeGen::CodeGenModule> CGM(
new clang::CodeGen::CodeGenModule(c->getASTContext(), c->getHeaderSearchOpts(),
@ -4306,11 +4308,9 @@ ParserTargetInfo* Parser::GetTargetInfo() @@ -4306,11 +4308,9 @@ ParserTargetInfo* Parser::GetTargetInfo()
auto DiagClient = new DiagnosticConsumer();
c->getDiagnostics().setClient(DiagClient);
AST = &c->getASTContext();
auto parserTargetInfo = new ParserTargetInfo();
auto& TI = AST->getTargetInfo();
auto& TI = c->getASTContext().getTargetInfo();
parserTargetInfo->ABI = TI.getABI();
parserTargetInfo->char16Type = ConvertIntType(TI.getChar16Type());

2
src/CppParser/Parser.h

@ -153,10 +153,8 @@ private: @@ -153,10 +153,8 @@ private:
Declaration* GetDeclarationFromFriend(clang::NamedDecl* FriendDecl);
int index;
CppSharp::CppParser::AST::ASTContext* lib;
CppParserOptions* opts;
std::unique_ptr<clang::CompilerInstance> c;
clang::ASTContext* AST;
clang::TargetCXXABI::Kind targetABI;
clang::CodeGen::CodeGenTypes* codeGenTypes;
std::unordered_map<const clang::TemplateTypeParmDecl*, TypeTemplateParameter*> walkedTypeTemplateParameters;

Loading…
Cancel
Save