Browse Source

Merge pull request #50 from ddobrev/master

Ignored private types
pull/51/merge
João Matos 12 years ago
parent
commit
26aee19689
  1. 2
      src/AST/Class.cs
  2. 2
      src/AST/Declaration.cs
  3. 1
      src/AST/Field.cs
  4. 1
      src/AST/Method.cs
  5. 2
      src/AST/Variable.cs
  6. 12
      src/Generator/Passes/CheckIgnoredDecls.cs
  7. 1
      src/Parser/Parser.cpp
  8. 9
      tests/Basic/Basic.h

2
src/AST/Class.cs

@ -15,8 +15,6 @@ namespace CppSharp.AST
// A C++ access specifier declaration. // A C++ access specifier declaration.
public class AccessSpecifierDecl : Declaration public class AccessSpecifierDecl : Declaration
{ {
public AccessSpecifier Access;
public override T Visit<T>(IDeclVisitor<T> visitor) public override T Visit<T>(IDeclVisitor<T> visitor)
{ {
throw new NotImplementedException(); throw new NotImplementedException();

2
src/AST/Declaration.cs

@ -169,6 +169,8 @@ namespace CppSharp.AST
} }
} }
public AccessSpecifier Access { get; set; }
// Contains debug text about the declaration. // Contains debug text about the declaration.
public string DebugText; public string DebugText;

1
src/AST/Field.cs

@ -8,7 +8,6 @@ namespace CppSharp.AST
public Type Type { get { return QualifiedType.Type; } } public Type Type { get { return QualifiedType.Type; } }
public QualifiedType QualifiedType { get; set; } public QualifiedType QualifiedType { get; set; }
public AccessSpecifier Access { get; set; }
public uint Offset { get; set; } public uint Offset { get; set; }
public Class Class { get; set; } public Class Class { get; set; }

1
src/AST/Method.cs

@ -74,7 +74,6 @@ namespace CppSharp.AST
Access = AccessSpecifier.Public; Access = AccessSpecifier.Public;
} }
public AccessSpecifier Access { get; set; }
public AccessSpecifierDecl AccessDecl { get; set; } public AccessSpecifierDecl AccessDecl { get; set; }
public bool IsVirtual { get; set; } public bool IsVirtual { get; set; }

2
src/AST/Variable.cs

@ -8,8 +8,6 @@ namespace CppSharp.AST
return visitor.VisitVariableDecl(this); return visitor.VisitVariableDecl(this);
} }
public AccessSpecifier Access { get; set; }
public Type Type { get { return QualifiedType.Type; } } public Type Type { get { return QualifiedType.Type; } }
public QualifiedType QualifiedType { get; set; } public QualifiedType QualifiedType { get; set; }

12
src/Generator/Passes/CheckIgnoredDecls.cs

@ -24,6 +24,16 @@ namespace CppSharp.Passes
return true; return true;
} }
public override bool VisitClassDecl(Class @class)
{
if (@class.Access == AccessSpecifier.Private)
{
@class.ExplicityIgnored = true;
return false;
}
return base.VisitClassDecl(@class);
}
public override bool VisitFieldDecl(Field field) public override bool VisitFieldDecl(Field field)
{ {
if (!VisitDeclaration(field)) if (!VisitDeclaration(field))
@ -86,7 +96,7 @@ namespace CppSharp.Passes
if (!VisitDeclaration(method)) if (!VisitDeclaration(method))
return false; return false;
if (method.Access != AccessSpecifier.Public) if (method.Access == AccessSpecifier.Private)
{ {
method.ExplicityIgnored = true; method.ExplicityIgnored = true;
return false; return false;

1
src/Parser/Parser.cpp

@ -2086,6 +2086,7 @@ CppSharp::AST::Declaration^ Parser::WalkDeclaration(clang::Decl* D,
if (const ValueDecl *VD = dyn_cast_or_null<ValueDecl>(D)) if (const ValueDecl *VD = dyn_cast_or_null<ValueDecl>(D))
Decl->IsDependent = VD->getType()->isDependentType(); Decl->IsDependent = VD->getType()->isDependentType();
Decl->Access = ConvertToAccess(D->getAccess());
} }
return Decl; return Decl;

9
tests/Basic/Basic.h

@ -49,12 +49,17 @@ enum Enum
class DLL_API Hello class DLL_API Hello
{ {
union { union NestedPrivate {
int i; int i;
float b; float f;
}; };
public: public:
union NestedPublic {
int j;
float g;
};
Hello (); Hello ();
void PrintHello(const char* s); void PrintHello(const char* s);

Loading…
Cancel
Save