Skip to content

Commit 4ad9658

Browse files
committed
Implement Cppyy::ResolveName
1 parent 5052f82 commit 4ad9658

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

clingwrapper/src/clingwrapper.cxx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -364,13 +364,15 @@ std::string Cppyy::ToString(TCppType_t klass, TCppObject_t obj)
364364
}
365365

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

450452

451453
Cppyy::TCppType_t Cppyy::ResolveType(TCppType_t type) {

0 commit comments

Comments
 (0)