Skip to content

Commit a1dc53c

Browse files
committed
Add template functions to their context
This also fixes a minor memory leak. Signed-off-by: Dimitar Dobrev <[email protected]>
1 parent a25162b commit a1dc53c

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

src/CppParser/Parser.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1571,7 +1571,7 @@ FunctionTemplate* Parser::WalkFunctionTemplate(const clang::FunctionTemplateDecl
15711571
if (auto MD = dyn_cast<CXXMethodDecl>(TemplatedDecl))
15721572
Function = WalkMethodCXX(MD);
15731573
else
1574-
Function = WalkFunction(TemplatedDecl, /*AddToNamespace=*/false);
1574+
Function = WalkFunction(TemplatedDecl);
15751575

15761576
FT = new FunctionTemplate();
15771577
HandleDeclaration(TD, FT);
@@ -3304,7 +3304,7 @@ void Parser::WalkFunction(const clang::FunctionDecl* FD, Function* F)
33043304
F->qualifiedType = GetQualifiedType(FD->getType(), &FTL);
33053305
}
33063306

3307-
Function* Parser::WalkFunction(const clang::FunctionDecl* FD, bool AddToNamespace)
3307+
Function* Parser::WalkFunction(const clang::FunctionDecl* FD)
33083308
{
33093309
using namespace clang;
33103310

@@ -3320,10 +3320,7 @@ Function* Parser::WalkFunction(const clang::FunctionDecl* FD, bool AddToNamespac
33203320

33213321
F = new Function();
33223322
HandleDeclaration(FD, F);
3323-
3324-
if (AddToNamespace)
3325-
NS->Functions.push_back(F);
3326-
3323+
NS->Functions.push_back(F);
33273324
WalkFunction(FD, F);
33283325

33293326
return F;

src/CppParser/Parser.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class Parser
7373
Declaration* WalkDeclarationDef(clang::Decl* D);
7474
Enumeration* WalkEnum(const clang::EnumDecl* ED);
7575
Enumeration::Item* WalkEnumItem(clang::EnumConstantDecl* ECD);
76-
Function* WalkFunction(const clang::FunctionDecl* FD, bool AddToNamespace = true);
76+
Function* WalkFunction(const clang::FunctionDecl* FD);
7777
void EnsureCompleteRecord(const clang::RecordDecl* Record, DeclarationContext* NS, Class* RC);
7878
Class* GetRecord(const clang::RecordDecl* Record, bool& IsComplete);
7979
Class* WalkRecord(const clang::RecordDecl* Record);

0 commit comments

Comments
 (0)