Skip to content

Commit d753c8d

Browse files
Moved property IsImplicit to Declaration from Method.
1 parent dd1576b commit d753c8d

File tree

7 files changed

+17
-4
lines changed

7 files changed

+17
-4
lines changed

src/AST/Declaration.cs

+2
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ public abstract class Declaration : INamedDecl
5757

5858
public int LineNumberStart { get; set; }
5959
public int LineNumberEnd { get; set; }
60+
public bool IsImplicit { get; set; }
6061

6162
private DeclarationContext @namespace;
6263
public DeclarationContext OriginalNamespace;
@@ -346,6 +347,7 @@ protected Declaration(Declaration declaration)
346347
OriginalPtr = declaration.OriginalPtr;
347348
LineNumberStart = declaration.LineNumberStart;
348349
LineNumberEnd = declaration.LineNumberEnd;
350+
IsImplicit = declaration.IsImplicit;
349351
}
350352

351353
public override string ToString()

src/AST/Method.cs

-2
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ public Method(Method method)
8585
Access = method.Access;
8686
IsVirtual = method.IsVirtual;
8787
IsConst = method.IsConst;
88-
IsImplicit = method.IsImplicit;
8988
IsOverride = method.IsOverride;
9089
IsProxy = method.IsProxy;
9190
IsStatic = method.IsStatic;
@@ -107,7 +106,6 @@ public Method(Function function)
107106
public bool IsVirtual { get; set; }
108107
public bool IsStatic { get; set; }
109108
public bool IsConst { get; set; }
110-
public bool IsImplicit { get; set; }
111109
public bool IsExplicit { get; set; }
112110
public bool IsOverride { get; set; }
113111
public bool IsProxy { get; set; }

src/CppParser/AST.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ Declaration::Declaration(DeclarationKind kind)
160160
, Comment(0)
161161
, IsIncomplete(false)
162162
, IsDependent(false)
163+
, IsImplicit(false)
163164
, CompleteDeclaration(0)
164165
, DefinitionOrder(0)
165166
, OriginalPtr(0)
@@ -178,6 +179,7 @@ Declaration::Declaration(const Declaration& rhs)
178179
, DebugText(rhs.DebugText)
179180
, IsIncomplete(rhs.IsIncomplete)
180181
, IsDependent(rhs.IsDependent)
182+
, IsImplicit(rhs.IsImplicit)
181183
, CompleteDeclaration(rhs.CompleteDeclaration)
182184
, DefinitionOrder(rhs.DefinitionOrder)
183185
, PreprocessedEntities(rhs.PreprocessedEntities)
@@ -578,7 +580,6 @@ Method::Method()
578580
, IsVirtual(false)
579581
, IsStatic(false)
580582
, IsConst(false)
581-
, IsImplicit(false)
582583
, IsExplicit(false)
583584
, IsOverride(false)
584585
, IsDefaultConstructor(false)

src/CppParser/AST.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,7 @@ class CS_API Declaration
403403
STRING(DebugText)
404404
bool IsIncomplete;
405405
bool IsDependent;
406+
bool IsImplicit;
406407
Declaration* CompleteDeclaration;
407408
unsigned DefinitionOrder;
408409
VECTOR(PreprocessedEntity*, PreprocessedEntities)
@@ -642,7 +643,6 @@ class CS_API Method : public Function
642643
bool IsVirtual;
643644
bool IsStatic;
644645
bool IsConst;
645-
bool IsImplicit;
646646
bool IsExplicit;
647647
bool IsOverride;
648648

src/CppParser/Parser.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -2760,6 +2760,7 @@ void Parser::HandleDeclaration(clang::Decl* D, Declaration* Decl)
27602760

27612761
Decl->OriginalPtr = (void*) D;
27622762
Decl->USR = GetDeclUSR(D);
2763+
Decl->IsImplicit = D->isImplicit();
27632764
Decl->Location = SourceLocation(D->getLocation().getRawEncoding());
27642765
Decl->LineNumberStart = C->getSourceManager().getExpansionLineNumber(D->getLocStart());
27652766
Decl->LineNumberEnd = C->getSourceManager().getExpansionLineNumber(D->getLocEnd());

src/Generator.Tests/AST/TestAST.cs

+7
Original file line numberDiff line numberDiff line change
@@ -281,5 +281,12 @@ public void TestMacroLineNumber()
281281
{
282282
Assert.AreEqual(98, AstContext.FindClass("HasAmbiguousFunctions").First().Specifiers.Last().LineNumberStart);
283283
}
284+
285+
[Test]
286+
public void TestImplicitDeclaration()
287+
{
288+
Assert.IsTrue(AstContext.FindClass("ImplicitCtor").First().Constructors.First(
289+
c => c.Parameters.Count == 0).IsImplicit);
290+
}
284291
}
285292
}

tests/Native/AST.h

+4
Original file line numberDiff line numberDiff line change
@@ -106,3 +106,7 @@ class Atomics
106106
# endif
107107
#endif
108108
};
109+
110+
class ImplicitCtor
111+
{
112+
};

0 commit comments

Comments
 (0)