diff --git a/include/clang/Interpreter/CppInterOp.h b/include/clang/Interpreter/CppInterOp.h index bad7eabac..420b69ff4 100644 --- a/include/clang/Interpreter/CppInterOp.h +++ b/include/clang/Interpreter/CppInterOp.h @@ -292,8 +292,11 @@ namespace Cpp { CPPINTEROP_API void GetClassMethods(TCppScope_t klass, std::vector& methods); - ///\returns Template function pointer list to add proxies for - /// un-instantiated/non-overloaded templated methods + /// Template function pointer list to add proxies for un-instantiated/ + /// non-overloaded templated methods + ///\param[in] klass - Pointer to the scope/class under which the methods have + /// to be retrieved + ///\param[out] methods - Vector of methods in the class CPPINTEROP_API void GetFunctionTemplatedDecls(TCppScope_t klass, std::vector& methods); diff --git a/lib/Interpreter/CppInterOp.cpp b/lib/Interpreter/CppInterOp.cpp index ea08f55a4..eab23c818 100644 --- a/lib/Interpreter/CppInterOp.cpp +++ b/lib/Interpreter/CppInterOp.cpp @@ -993,10 +993,10 @@ namespace Cpp { if (func->getNumParams() != arg_types.size()) continue; - // TODO : first score based on the type similarity before forcing + // FIXME : first score based on the type similarity before forcing // instantiation try instantiating - TCppFunction_t instantiated = InstantiateTemplate( - candidate, arg_types.data(), arg_types.size()); + TCppFunction_t instantiated = + InstantiateTemplate(candidate, arg_types.data(), arg_types.size()); if (instantiated) return instantiated; diff --git a/unittests/CppInterOp/FunctionReflectionTest.cpp b/unittests/CppInterOp/FunctionReflectionTest.cpp index 299e4ac2b..0eb0984af 100644 --- a/unittests/CppInterOp/FunctionReflectionTest.cpp +++ b/unittests/CppInterOp/FunctionReflectionTest.cpp @@ -487,14 +487,14 @@ TEST(FunctionReflectionTest, ExistsFunctionTemplate) { EXPECT_FALSE(Cpp::ExistsFunctionTemplate("f", Decls[2])); } -// TEST(ScopeReflectionTest, InstantiateTemplateFunctionFromString) { -// Cpp::CreateInterpreter(); -// std::string code = R"(#include )"; -// Interp->process(code); -// const char* str = "std::make_unique"; -// auto* Instance1 = (Decl*)Cpp::InstantiateTemplateFunctionFromString(str); -// EXPECT_TRUE(Instance1); -// } +TEST(FunctionReflectionTest, InstantiateTemplateFunctionFromString) { + Cpp::CreateInterpreter(); + std::string code = R"(#include )"; + Interp->process(code); + const char* str = "std::make_unique"; + auto* Instance1 = (Decl*)Cpp::InstantiateTemplateFunctionFromString(str); + EXPECT_TRUE(Instance1); +} TEST(FunctionReflectionTest, InstantiateFunctionTemplate) { std::vector Decls;