@@ -562,7 +562,7 @@ TEST(FunctionReflectionTest, GetFunctionRequiredArgs) {
562562}
563563
564564TEST(FunctionReflectionTest, GetFunctionArgType) {
565- std::vector<Decl*> Decls, SubDecls ;
565+ std::vector<Decl*> Decls;
566566 std::string code = R"(
567567 void f1(int i, double d, long l, char ch) {}
568568 void f2(const int i, double d[], long *l, char ch[4]) {}
@@ -582,7 +582,7 @@ TEST(FunctionReflectionTest, GetFunctionArgType) {
582582}
583583
584584TEST(FunctionReflectionTest, GetFunctionSignature) {
585- std::vector<Decl*> Decls, SubDecls ;
585+ std::vector<Decl*> Decls;
586586 std::string code = R"(
587587 class C {
588588 void f(int i, double d, long l = 0, char ch = 'a') {}
@@ -626,7 +626,8 @@ TEST(FunctionReflectionTest, GetFunctionSignature) {
626626}
627627
628628TEST(FunctionReflectionTest, IsTemplatedFunction) {
629- std::vector<Decl*> Decls, SubDeclsC1, SubDeclsC2;
629+ std::vector<Decl*> Decls;
630+ std::vector<Decl*> SubDeclsC1;
630631 std::string code = R"(
631632 void f1(int a) {}
632633
@@ -1448,7 +1449,7 @@ TEST(FunctionReflectionTest, GetFunctionAddress) {
14481449#ifdef _WIN32
14491450 GTEST_SKIP() << "Disabled on Windows. Needs fixing.";
14501451#endif
1451- std::vector<Decl*> Decls, SubDecls ;
1452+ std::vector<Decl*> Decls;
14521453 std::string code = "int f1(int i) { return i * i; }";
14531454 std::vector<const char*> interpreter_args = {"-include", "new"};
14541455
@@ -2111,6 +2112,61 @@ TEST(FunctionReflectionTest, GetFunctionCallWrapper) {
21112112
21122113 auto op_callable = Cpp::MakeFunctionCallable(op);
21132114 EXPECT_EQ(op_callable.getKind(), Cpp::JitCall::kGenericCall);
2115+
2116+ Cpp::Declare(R"(
2117+ enum class MyEnum { A, B, C };
2118+ template <MyEnum E>
2119+ class TemplatedEnum {};
2120+
2121+ namespace MyNameSpace {
2122+ enum class MyEnum { A, B, C };
2123+ template <MyEnum E>
2124+ class TemplatedEnum {};
2125+ }
2126+ )");
2127+
2128+ Cpp::TCppScope_t TemplatedEnum = Cpp::GetScope("TemplatedEnum");
2129+ EXPECT_TRUE(TemplatedEnum);
2130+
2131+ auto TAI_enum =
2132+ Cpp::TemplateArgInfo(Cpp::GetTypeFromScope(Cpp::GetNamed("MyEnum")), "1");
2133+ Cpp::TCppScope_t TemplatedEnum_instantiated =
2134+ Cpp::InstantiateTemplate(TemplatedEnum, &TAI_enum, 1);
2135+ EXPECT_TRUE(TemplatedEnum_instantiated);
2136+
2137+ Cpp::TCppObject_t obj = Cpp::Construct(TemplatedEnum_instantiated);
2138+ EXPECT_TRUE(obj);
2139+ Cpp::Destruct(obj, TemplatedEnum_instantiated);
2140+ obj = nullptr;
2141+
2142+ Cpp::TCppScope_t MyNameSpace_TemplatedEnum =
2143+ Cpp::GetScope("TemplatedEnum", Cpp::GetScope("MyNameSpace"));
2144+ EXPECT_TRUE(TemplatedEnum);
2145+
2146+ TAI_enum = Cpp::TemplateArgInfo(Cpp::GetTypeFromScope(Cpp::GetNamed(
2147+ "MyEnum", Cpp::GetScope("MyNameSpace"))),
2148+ "1");
2149+ Cpp::TCppScope_t MyNameSpace_TemplatedEnum_instantiated =
2150+ Cpp::InstantiateTemplate(MyNameSpace_TemplatedEnum, &TAI_enum, 1);
2151+ EXPECT_TRUE(TemplatedEnum_instantiated);
2152+
2153+ obj = Cpp::Construct(MyNameSpace_TemplatedEnum_instantiated);
2154+ EXPECT_TRUE(obj);
2155+ Cpp::Destruct(obj, MyNameSpace_TemplatedEnum_instantiated);
2156+ obj = nullptr;
2157+
2158+ Cpp::Declare(R"(
2159+ auto get_fn(int x) { return [x](int y){ return x + y; }; }
2160+ )");
2161+
2162+ Cpp::TCppScope_t get_fn = Cpp::GetNamed("get_fn");
2163+ EXPECT_TRUE(get_fn);
2164+
2165+ auto get_fn_callable = Cpp::MakeFunctionCallable(get_fn);
2166+ EXPECT_EQ(get_fn_callable.getKind(), Cpp::JitCall::kGenericCall);
2167+
2168+ EXPECT_TRUE(Cpp::IsLambdaClass(Cpp::GetFunctionReturnType(get_fn)));
2169+ EXPECT_FALSE(Cpp::IsLambdaClass(Cpp::GetFunctionReturnType(bar)));
21142170}
21152171
21162172TEST(FunctionReflectionTest, IsConstMethod) {
@@ -2132,7 +2188,7 @@ TEST(FunctionReflectionTest, IsConstMethod) {
21322188}
21332189
21342190TEST(FunctionReflectionTest, GetFunctionArgName) {
2135- std::vector<Decl*> Decls, SubDecls ;
2191+ std::vector<Decl*> Decls;
21362192 std::string code = R"(
21372193 void f1(int i, double d, long l, char ch) {}
21382194 void f2(const int i, double d[], long *l, char ch[4]) {}
@@ -2172,7 +2228,7 @@ TEST(FunctionReflectionTest, GetFunctionArgName) {
21722228}
21732229
21742230TEST(FunctionReflectionTest, GetFunctionArgDefault) {
2175- std::vector<Decl*> Decls, SubDecls ;
2231+ std::vector<Decl*> Decls;
21762232 std::string code = R"(
21772233 void f1(int i, double d = 4.0, const char *s = "default", char ch = 'c') {}
21782234 void f2(float i = 0.0, double d = 3.123, long m = 34126) {}
0 commit comments