Browse Source

Added support for keeping track of extern "C" contexts in classes/structs.

pull/155/merge
Joao Matos 12 years ago
parent
commit
19376cc2c3
  1. 3
      src/AST/Namespace.cs
  2. 1
      src/Core/Parser/ASTConverter.cs
  3. 1
      src/CppParser/AST.h
  4. 2
      src/CppParser/Parser.cpp
  5. 2
      src/Parser/Parser.cpp

3
src/AST/Namespace.cs

@ -24,6 +24,9 @@ namespace CppSharp.AST @@ -24,6 +24,9 @@ namespace CppSharp.AST
// Used to keep track of anonymous declarations.
public Dictionary<ulong, Declaration> Anonymous;
// True if the context is inside an extern "C" context.
public bool IsExternCContext;
protected DeclarationContext()
{
Namespaces = new List<Namespace>();

1
src/Core/Parser/ASTConverter.cs

@ -1039,6 +1039,7 @@ namespace CppSharp @@ -1039,6 +1039,7 @@ namespace CppSharp
_class.HasNonTrivialDefaultConstructor = @class.HasNonTrivialDefaultConstructor;
_class.HasNonTrivialCopyConstructor = @class.HasNonTrivialCopyConstructor;
_class.HasNonTrivialDestructor = @class.HasNonTrivialDestructor;
_class.IsExternCContext = @class.IsExternCContext;
_class.Layout = VisitClassLayout(@class.Layout);
}

1
src/CppParser/AST.h

@ -618,6 +618,7 @@ struct CS_API Class : public DeclarationContext @@ -618,6 +618,7 @@ struct CS_API Class : public DeclarationContext
bool HasNonTrivialDefaultConstructor;
bool HasNonTrivialCopyConstructor;
bool HasNonTrivialDestructor;
bool IsExternCContext;
ClassLayout Layout;
};

2
src/CppParser/Parser.cpp

@ -598,6 +598,8 @@ void Parser::WalkRecordCXX(clang::CXXRecordDecl* Record, Class* RC) @@ -598,6 +598,8 @@ void Parser::WalkRecordCXX(clang::CXXRecordDecl* Record, Class* RC)
RC->HasNonTrivialCopyConstructor = Record->hasNonTrivialCopyConstructor();
RC->HasNonTrivialDestructor = Record->hasNonTrivialDestructor();
RC->IsExternCContext = Record->isExternCContext();
bool hasLayout = !Record->isDependentType() && !Record->isInvalidDecl();
// Get the record layout information.

2
src/Parser/Parser.cpp

@ -557,6 +557,8 @@ void Parser::WalkRecordCXX(clang::CXXRecordDecl* Record, @@ -557,6 +557,8 @@ void Parser::WalkRecordCXX(clang::CXXRecordDecl* Record,
RC->HasNonTrivialCopyConstructor = Record->hasNonTrivialCopyConstructor();
RC->HasNonTrivialDestructor = Record->hasNonTrivialDestructor();
RC->IsExternCContext = Record->isExternCContext();
bool hasLayout = !Record->isDependentType() && !Record->isInvalidDecl();
// Get the record layout information.

Loading…
Cancel
Save