Browse Source

Merge pull request #604 from genuinelucifer/isImplicitAST

First try at moving isimplicit to declaration from method.
pull/605/head
Dimitar Dobrev 10 years ago
parent
commit
3c44798399
  1. 2
      src/AST/Declaration.cs
  2. 2
      src/AST/Method.cs
  3. 3
      src/CppParser/AST.cpp
  4. 2
      src/CppParser/AST.h
  5. 1
      src/CppParser/Parser.cpp
  6. 7
      src/Generator.Tests/AST/TestAST.cs
  7. 4
      tests/Native/AST.h

2
src/AST/Declaration.cs

@ -57,6 +57,7 @@ namespace CppSharp.AST @@ -57,6 +57,7 @@ namespace CppSharp.AST
public int LineNumberStart { get; set; }
public int LineNumberEnd { get; set; }
public bool IsImplicit { get; set; }
private DeclarationContext @namespace;
public DeclarationContext OriginalNamespace;
@ -346,6 +347,7 @@ namespace CppSharp.AST @@ -346,6 +347,7 @@ namespace CppSharp.AST
OriginalPtr = declaration.OriginalPtr;
LineNumberStart = declaration.LineNumberStart;
LineNumberEnd = declaration.LineNumberEnd;
IsImplicit = declaration.IsImplicit;
}
public override string ToString()

2
src/AST/Method.cs

@ -85,7 +85,6 @@ namespace CppSharp.AST @@ -85,7 +85,6 @@ namespace CppSharp.AST
Access = method.Access;
IsVirtual = method.IsVirtual;
IsConst = method.IsConst;
IsImplicit = method.IsImplicit;
IsOverride = method.IsOverride;
IsProxy = method.IsProxy;
IsStatic = method.IsStatic;
@ -107,7 +106,6 @@ namespace CppSharp.AST @@ -107,7 +106,6 @@ namespace CppSharp.AST
public bool IsVirtual { get; set; }
public bool IsStatic { get; set; }
public bool IsConst { get; set; }
public bool IsImplicit { get; set; }
public bool IsExplicit { get; set; }
public bool IsOverride { get; set; }
public bool IsProxy { get; set; }

3
src/CppParser/AST.cpp

@ -160,6 +160,7 @@ Declaration::Declaration(DeclarationKind kind) @@ -160,6 +160,7 @@ Declaration::Declaration(DeclarationKind kind)
, Comment(0)
, IsIncomplete(false)
, IsDependent(false)
, IsImplicit(false)
, CompleteDeclaration(0)
, DefinitionOrder(0)
, OriginalPtr(0)
@ -178,6 +179,7 @@ Declaration::Declaration(const Declaration& rhs) @@ -178,6 +179,7 @@ Declaration::Declaration(const Declaration& rhs)
, DebugText(rhs.DebugText)
, IsIncomplete(rhs.IsIncomplete)
, IsDependent(rhs.IsDependent)
, IsImplicit(rhs.IsImplicit)
, CompleteDeclaration(rhs.CompleteDeclaration)
, DefinitionOrder(rhs.DefinitionOrder)
, PreprocessedEntities(rhs.PreprocessedEntities)
@ -555,7 +557,6 @@ Method::Method() @@ -555,7 +557,6 @@ Method::Method()
, IsVirtual(false)
, IsStatic(false)
, IsConst(false)
, IsImplicit(false)
, IsExplicit(false)
, IsOverride(false)
, IsDefaultConstructor(false)

2
src/CppParser/AST.h

@ -403,6 +403,7 @@ public: @@ -403,6 +403,7 @@ public:
STRING(DebugText)
bool IsIncomplete;
bool IsDependent;
bool IsImplicit;
Declaration* CompleteDeclaration;
unsigned DefinitionOrder;
VECTOR(PreprocessedEntity*, PreprocessedEntities)
@ -642,7 +643,6 @@ public: @@ -642,7 +643,6 @@ public:
bool IsVirtual;
bool IsStatic;
bool IsConst;
bool IsImplicit;
bool IsExplicit;
bool IsOverride;

1
src/CppParser/Parser.cpp

@ -2760,6 +2760,7 @@ void Parser::HandleDeclaration(clang::Decl* D, Declaration* Decl) @@ -2760,6 +2760,7 @@ void Parser::HandleDeclaration(clang::Decl* D, Declaration* Decl)
Decl->OriginalPtr = (void*) D;
Decl->USR = GetDeclUSR(D);
Decl->IsImplicit = D->isImplicit();
Decl->Location = SourceLocation(D->getLocation().getRawEncoding());
Decl->LineNumberStart = C->getSourceManager().getExpansionLineNumber(D->getLocStart());
Decl->LineNumberEnd = C->getSourceManager().getExpansionLineNumber(D->getLocEnd());

7
src/Generator.Tests/AST/TestAST.cs

@ -281,5 +281,12 @@ namespace CppSharp.Generator.Tests.AST @@ -281,5 +281,12 @@ namespace CppSharp.Generator.Tests.AST
{
Assert.AreEqual(98, AstContext.FindClass("HasAmbiguousFunctions").First().Specifiers.Last().LineNumberStart);
}
[Test]
public void TestImplicitDeclaration()
{
Assert.IsTrue(AstContext.FindClass("ImplicitCtor").First().Constructors.First(
c => c.Parameters.Count == 0).IsImplicit);
}
}
}

4
tests/Native/AST.h

@ -106,3 +106,7 @@ class Atomics @@ -106,3 +106,7 @@ class Atomics
# endif
#endif
};
class ImplicitCtor
{
};

Loading…
Cancel
Save