Skip to content

Commit 9550606

Browse files
committed
Implement Cppyy::ResolveName
1 parent 075b328 commit 9550606

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

clingwrapper/src/clingwrapper.cxx

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -362,13 +362,15 @@ std::string Cppyy::ToString(TCppType_t klass, TCppObject_t obj)
362362
}
363363

364364
// // name to opaque C++ scope representation -----------------------------------
365-
std::string Cppyy::ResolveName(const std::string& cppitem_name)
366-
{
367-
#ifdef PRINT_DEBUG
368-
printf("Resolve name input = %s\n", cppitem_name.c_str());
369-
#endif
370-
return cppitem_name;
371-
365+
std::string Cppyy::ResolveName(const std::string& name) {
366+
if (!name.empty()) {
367+
if (Cppyy::TCppType_t type =
368+
Cppyy::GetType(name, /*enable_slow_lookup=*/true))
369+
return Cppyy::GetTypeAsString(Cppyy::ResolveType(type));
370+
return name;
371+
}
372+
return "";
373+
}
372374
// // Fully resolve the given name to the final type name.
373375
//
374376
// // try memoized type cache, in case seen before
@@ -443,7 +445,7 @@ std::string Cppyy::ResolveName(const std::string& cppitem_name)
443445
// if (tclean.compare(0, 6, "const ") != 0)
444446
// return TClassEdit::ShortType(tclean.c_str(), 2);
445447
// return "const " + TClassEdit::ShortType(tclean.c_str(), 2);
446-
}
448+
// }
447449

448450

449451
Cppyy::TCppType_t Cppyy::ResolveType(TCppType_t type) {
@@ -1276,8 +1278,8 @@ void Cppyy::GetClassMethods(TCppScope_t scope, std::vector<Cppyy::TCppMethod_t>
12761278

12771279
std::vector<Cppyy::TCppScope_t> Cppyy::GetMethodsFromName(
12781280
TCppScope_t scope, const std::string& name)
1279-
{
1280-
return Cpp::GetFunctionsUsingName(scope, name);
1281+
{
1282+
return Cpp::GetFunctionsUsingName(scope, name);;
12811283
}
12821284

12831285
// Cppyy::TCppMethod_t Cppyy::GetMethod(TCppScope_t scope, TCppIndex_t idx)

0 commit comments

Comments
 (0)