Skip to content

Commit 7c3eed8

Browse files
Few changes and added test.
1 parent c4ed9f3 commit 7c3eed8

File tree

7 files changed

+27
-9
lines changed

7 files changed

+27
-9
lines changed

src/AST/Declaration.cs

-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ public abstract class Declaration : INamedDecl
5858
public int LineNumberStart { get; set; }
5959
public int LineNumberEnd { get; set; }
6060
public bool IsImplicit { get; set; }
61-
public bool IsExplicit { get; set; }
6261

6362
private DeclarationContext @namespace;
6463
public DeclarationContext OriginalNamespace;

src/AST/Method.cs

+1
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ public Method(Function function)
106106
public bool IsVirtual { get; set; }
107107
public bool IsStatic { get; set; }
108108
public bool IsConst { get; set; }
109+
public bool IsExplicit { get; set; }
109110
public bool IsOverride { get; set; }
110111
public bool IsProxy { get; set; }
111112

src/CppParser/AST.cpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ Declaration::Declaration(DeclarationKind kind)
159159
, LineNumberEnd(0)
160160
, Comment(0)
161161
, IsIncomplete(false)
162-
, IsDependent(false)
163-
, IsImplicit(false)
162+
, IsDependent(false)
163+
, IsImplicit(false)
164164
, CompleteDeclaration(0)
165165
, DefinitionOrder(0)
166166
, OriginalPtr(0)
@@ -178,8 +178,8 @@ Declaration::Declaration(const Declaration& rhs)
178178
, Comment(rhs.Comment)
179179
, DebugText(rhs.DebugText)
180180
, IsIncomplete(rhs.IsIncomplete)
181-
, IsDependent(rhs.IsDependent)
182-
, IsImplicit(rhs.IsImplicit)
181+
, IsDependent(rhs.IsDependent)
182+
, IsImplicit(rhs.IsImplicit)
183183
, CompleteDeclaration(rhs.CompleteDeclaration)
184184
, DefinitionOrder(rhs.DefinitionOrder)
185185
, PreprocessedEntities(rhs.PreprocessedEntities)
@@ -580,6 +580,7 @@ Method::Method()
580580
, IsVirtual(false)
581581
, IsStatic(false)
582582
, IsConst(false)
583+
, IsExplicit(false)
583584
, IsOverride(false)
584585
, IsDefaultConstructor(false)
585586
, IsCopyConstructor(false)

src/CppParser/AST.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -402,8 +402,8 @@ class CS_API Declaration
402402
RawComment* Comment;
403403
STRING(DebugText)
404404
bool IsIncomplete;
405-
bool IsDependent;
406-
bool IsImplicit;
405+
bool IsDependent;
406+
bool IsImplicit;
407407
Declaration* CompleteDeclaration;
408408
unsigned DefinitionOrder;
409409
VECTOR(PreprocessedEntity*, PreprocessedEntities)
@@ -643,8 +643,8 @@ class CS_API Method : public Function
643643
bool IsVirtual;
644644
bool IsStatic;
645645
bool IsConst;
646-
bool IsExplicit;
647646
bool IsOverride;
647+
bool IsExplicit;
648648

649649
CXXMethodKind MethodKind;
650650

src/CppParser/Parser.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -2760,7 +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;
2763+
Decl->IsImplicit = D->isImplicit();
27642764
Decl->Location = SourceLocation(D->getLocation().getRawEncoding());
27652765
Decl->LineNumberStart = C->getSourceManager().getExpansionLineNumber(D->getLocStart());
27662766
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.AreEqual(false, AstContext.FindFunction("testExplicitFunc").Single().IsImplicit);
289+
Assert.AreEqual(true, AstContext.FindFunction("testImplicitFunc").Single().IsImplicit);
290+
}
284291
}
285292
}

tests/Native/AST.h

+10
Original file line numberDiff line numberDiff line change
@@ -106,3 +106,13 @@ class Atomics
106106
# endif
107107
#endif
108108
};
109+
110+
void testImplicitFunc();
111+
112+
void testExplicitFunc()
113+
{
114+
testImplicitFunc();
115+
}
116+
117+
void testImplicitFunc()
118+
{}

0 commit comments

Comments
 (0)