diff --git a/src/Parser/Parser.cpp b/src/Parser/Parser.cpp index ef9297d6..062a5b9d 100644 --- a/src/Parser/Parser.cpp +++ b/src/Parser/Parser.cpp @@ -431,7 +431,8 @@ Cxxi::FunctionTemplate^ Parser::WalkFunctionTemplate(clang::FunctionTemplateDecl auto NS = GetNamespace(TD); - auto Function = WalkFunction(TD->getTemplatedDecl(), /*IsDependent=*/true); + auto Function = WalkFunction(TD->getTemplatedDecl(), /*IsDependent=*/true, + /*AddToNamespace=*/false); Cxxi::FunctionTemplate^ FT = gcnew Cxxi::FunctionTemplate(Function); return FT; @@ -1055,7 +1056,8 @@ void Parser::WalkFunction(clang::FunctionDecl* FD, Cxxi::Function^ F, } } -Cxxi::Function^ Parser::WalkFunction(clang::FunctionDecl* FD, bool IsDependent) +Cxxi::Function^ Parser::WalkFunction(clang::FunctionDecl* FD, bool IsDependent, + bool AddToNamespace) { using namespace clang; using namespace clix; @@ -1071,7 +1073,9 @@ Cxxi::Function^ Parser::WalkFunction(clang::FunctionDecl* FD, bool IsDependent) F = gcnew Cxxi::Function(); WalkFunction(FD, F, IsDependent); - NS->Functions->Add(F); + + if (AddToNamespace) + NS->Functions->Add(F); return F; } diff --git a/src/Parser/Parser.h b/src/Parser/Parser.h index 54000b45..2ccf27c4 100644 --- a/src/Parser/Parser.h +++ b/src/Parser/Parser.h @@ -96,7 +96,8 @@ protected: bool IgnoreSystemDecls = true, bool CanBeDefinition = false); Cxxi::Declaration^ WalkDeclarationDef(clang::Decl* D); Cxxi::Enumeration^ WalkEnum(clang::EnumDecl*); - Cxxi::Function^ WalkFunction(clang::FunctionDecl*, bool IsDependent = false); + Cxxi::Function^ WalkFunction(clang::FunctionDecl*, bool IsDependent = false, + bool AddToNamespace = true); Cxxi::Class^ WalkRecordCXX(clang::CXXRecordDecl*, bool IsDependent = false); Cxxi::Method^ WalkMethodCXX(clang::CXXMethodDecl*); Cxxi::Field^ WalkFieldCXX(clang::FieldDecl*, Cxxi::Class^);