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

2
src/AST/Method.cs

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

3
src/CppParser/AST.cpp

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

2
src/CppParser/AST.h

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

1
src/CppParser/Parser.cpp

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

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

@ -281,5 +281,12 @@ namespace CppSharp.Generator.Tests.AST
{ {
Assert.AreEqual(98, AstContext.FindClass("HasAmbiguousFunctions").First().Specifiers.Last().LineNumberStart); 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
# endif # endif
#endif #endif
}; };
class ImplicitCtor
{
};

Loading…
Cancel
Save