Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement Cppyy::GetAllCppNames #115

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,10 @@ jobs:
run: |
brew update
brew remove [email protected]
brew remove unxip
export ARCHITECHURE=$(uname -m)
if [[ "$ARCHITECHURE" != "x86_64" ]]; then
brew remove unxip
fi
# workaround for https://github.com/actions/setup-python/issues/577
for pkg in $(brew list | grep '^python@'); do
brew unlink "$pkg"
Expand Down
98 changes: 9 additions & 89 deletions clingwrapper/src/clingwrapper.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1068,95 +1068,15 @@ bool Cppyy::IsVariable(TCppScope_t scope)
// cppnames.insert(outer_with_template(name + ns_scope.size()));
// }
// }
//
// void Cppyy::GetAllCppNames(TCppScope_t scope, std::set<std::string>& cppnames)
// {
// // Collect all known names of C++ entities under scope. This is useful for IDEs
// // employing tab-completion, for example. Note that functions names need not be
// // unique as they can be overloaded.
// TClassRef& cr = type_from_handle(scope);
// if (scope != GLOBAL_HANDLE && !(cr.GetClass() && cr->Property()))
// return;
//
// std::string ns_scope = GetFinalName(scope);
// if (scope != GLOBAL_HANDLE) ns_scope += "::";
//
// // add existing values from read rootmap files if within this scope
// TCollection* coll = gInterpreter->GetMapfile()->GetTable();
// {
// TIter itr{coll};
// TEnvRec* ev = nullptr;
// while ((ev = (TEnvRec*)itr.Next())) {
// // TEnv contains rootmap entries and user-side rootmap files may be already
// // loaded on startup. Thus, filter on file name rather than load time.
// if (gRootSOs.find(ev->GetValue()) == gRootSOs.end())
// cond_add(scope, ns_scope, cppnames, ev->GetName(), true);
// }
// }
//
// // do we care about the class table or are the rootmap and list of types enough?
// [>
// gClassTable->Init();
// const int N = gClassTable->Classes();
// for (int i = 0; i < N; ++i)
// cond_add(scope, ns_scope, cppnames, gClassTable->Next());
// */
//
// // any other types (e.g. that may have come from parsing headers)
// coll = gROOT->GetListOfTypes();
// {
// TIter itr{coll};
// TDataType* dt = nullptr;
// while ((dt = (TDataType*)itr.Next())) {
// if (!(dt->Property() & kIsFundamental)) {
// cond_add(scope, ns_scope, cppnames, dt->GetName());
// }
// }
// }
//
// // add functions
// coll = (scope == GLOBAL_HANDLE) ?
// gROOT->GetListOfGlobalFunctions() : cr->GetListOfMethods();
// {
// TIter itr{coll};
// TFunction* obj = nullptr;
// while ((obj = (TFunction*)itr.Next())) {
// const char* nm = obj->GetName();
// // skip templated functions, adding only the un-instantiated ones
// if (nm && nm[0] != '_' && strstr(nm, "<") == 0 && strncmp(nm, "operator", 8) != 0) {
// if (gInitialNames.find(nm) == gInitialNames.end())
// cppnames.insert(nm);
// }
// }
// }
//
// // add uninstantiated templates
// coll = (scope == GLOBAL_HANDLE) ?
// gROOT->GetListOfFunctionTemplates() : cr->GetListOfFunctionTemplates();
// FILL_COLL(TFunctionTemplate, kIsPrivate | kIsProtected)
//
// // add (global) data members
// if (scope == GLOBAL_HANDLE) {
// coll = gROOT->GetListOfGlobals();
// FILL_COLL(TGlobal, kIsPrivate | kIsProtected)
// } else {
// coll = cr->GetListOfDataMembers();
// FILL_COLL(TDataMember, kIsPrivate | kIsProtected)
// }
//
// // add enums values only for user classes/namespaces
// if (scope != GLOBAL_HANDLE && scope != STD_HANDLE) {
// coll = cr->GetListOfEnums();
// FILL_COLL(TEnum, kIsPrivate | kIsProtected)
// }
//
// #ifdef __APPLE__
// // special case for Apple, add version namespace '__1' entries to std
// if (scope == STD_HANDLE)
// GetAllCppNames(GetScope("std::__1"), cppnames);
// #endif
// }
//

void Cppyy::GetAllCppNames(TCppScope_t scope, std::set<std::string>& cppnames)
{
// Collect all known names of C++ entities under scope. This is useful for IDEs
// employing tab-completion, for example. Note that functions names need not be
// unique as they can be overloaded.
Cpp::GetAllCppNames(scope, cppnames);
}

//
// // class reflection information ----------------------------------------------
std::vector<Cppyy::TCppScope_t> Cppyy::GetUsingNamespaces(TCppScope_t scope)
Expand Down
2 changes: 1 addition & 1 deletion clingwrapper/src/cpp_cppyy.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ namespace Cppyy {
bool IsVariable(TCppScope_t scope);

RPY_EXPORTED
void GetAllCppNames(TCppScope_t scope, std::set<std::string>& cppnames) { return; }
void GetAllCppNames(TCppScope_t scope, std::set<std::string>& cppnames);

// // namespace reflection information ------------------------------------------
RPY_EXPORTED
Expand Down