diff --git a/cling/src/core/metacling/src/TCling.h b/cling/src/core/metacling/src/TCling.h index 7783e360..f1d49418 100644 --- a/cling/src/core/metacling/src/TCling.h +++ b/cling/src/core/metacling/src/TCling.h @@ -595,12 +595,13 @@ class TCling final : public TInterpreter { virtual bool IsFloatingType(const void * QualTypePtr) const; virtual bool IsPointerType(const void * QualTypePtr) const; virtual bool IsVoidPointerType(const void * QualTypePtr) const; + +// FunctionDecl interface + bool FunctionDeclId_IsMethod(DeclId_t fdeclid) const; + virtual TypeInfo_t* GetNonReferenceType(const void * QualTypePtr) const; virtual TypeInfo_t* GetUnqualifiedType(const void * QualTypePtr) const; virtual TypeInfo_t* GetPointerType(const void * QualTypePtr) const; - -// FunctionDecl interface - bool FunctionDeclId_IsMethod(DeclId_t fdeclid) const; }; } // namespace CppyyLegacy diff --git a/clingwrapper/src/clingwrapper.cxx b/clingwrapper/src/clingwrapper.cxx index c8e9986e..c1465870 100644 --- a/clingwrapper/src/clingwrapper.cxx +++ b/clingwrapper/src/clingwrapper.cxx @@ -586,6 +586,28 @@ std::string Cppyy::ResolveEnum(const std::string& enum_type) return restype; // should default to some int variant } +static Cppyy::TCppIndex_t ArgSimilarityScore(void *argqtp, void *reqqtp) +{ + // This scoring is not based on any particular rules + if (gInterpreter->IsSameType(argqtp, reqqtp)) + return 0; // Best match + else if ((gInterpreter->IsSignedIntegerType(argqtp) && gInterpreter->IsSignedIntegerType(reqqtp)) || + (gInterpreter->IsUnsignedIntegerType(argqtp) && gInterpreter->IsUnsignedIntegerType(reqqtp)) || + (gInterpreter->IsFloatingType(argqtp) && gInterpreter->IsFloatingType(reqqtp))) + return 1; + else if ((gInterpreter->IsSignedIntegerType(argqtp) && gInterpreter->IsUnsignedIntegerType(reqqtp)) || + (gInterpreter->IsFloatingType(argqtp) && gInterpreter->IsUnsignedIntegerType(reqqtp))) + return 2; + else if ((gInterpreter->IsIntegerType(argqtp) && gInterpreter->IsIntegerType(reqqtp))) + return 3; + else if ((gInterpreter->IsIntegralType(argqtp) && gInterpreter->IsIntegralType(reqqtp))) + return 4; + else if ((gInterpreter->IsVoidPointerType(argqtp) && gInterpreter->IsPointerType(reqqtp))) + return 5; + else + return 10; // Penalize heavily for no possible match +} + Cppyy::TCppScope_t Cppyy::GetScope(const std::string& sname) { // First, try cache @@ -1742,28 +1764,6 @@ Cppyy::TCppIndex_t Cppyy::CompareMethodArgType(TCppMethod_t method, TCppIndex_t return INT_MAX; // Method is not valid } -Cppyy::TCppIndex_t Cppyy::ArgSimilarityScore(void *argqtp, void *reqqtp) -{ - // This scoring is not based on any particular rules - if (gInterpreter->IsSameType(argqtp, reqqtp)) - return 0; // Best match - else if ((gInterpreter->IsSignedIntegerType(argqtp) && gInterpreter->IsSignedIntegerType(reqqtp)) || - (gInterpreter->IsUnsignedIntegerType(argqtp) && gInterpreter->IsUnsignedIntegerType(reqqtp)) || - (gInterpreter->IsFloatingType(argqtp) && gInterpreter->IsFloatingType(reqqtp))) - return 1; - else if ((gInterpreter->IsSignedIntegerType(argqtp) && gInterpreter->IsUnsignedIntegerType(reqqtp)) || - (gInterpreter->IsFloatingType(argqtp) && gInterpreter->IsUnsignedIntegerType(reqqtp))) - return 2; - else if ((gInterpreter->IsIntegerType(argqtp) && gInterpreter->IsIntegerType(reqqtp))) - return 3; - else if ((gInterpreter->IsIntegralType(argqtp) && gInterpreter->IsIntegralType(reqqtp))) - return 4; - else if ((gInterpreter->IsVoidPointerType(argqtp) && gInterpreter->IsPointerType(reqqtp))) - return 5; - else - return 10; // Penalize heavily for no possible match -} - std::string Cppyy::GetMethodArgDefault(TCppMethod_t method, TCppIndex_t iarg) { if (method) { diff --git a/clingwrapper/src/cpp_cppyy.h b/clingwrapper/src/cpp_cppyy.h index b59efd22..9a15711d 100644 --- a/clingwrapper/src/cpp_cppyy.h +++ b/clingwrapper/src/cpp_cppyy.h @@ -203,8 +203,6 @@ namespace Cppyy { RPY_EXPORTED TCppIndex_t CompareMethodArgType(TCppMethod_t, TCppIndex_t iarg, const std::string &req_type); RPY_EXPORTED - TCppIndex_t ArgSimilarityScore(void *argqtp, void *reqqtp); - RPY_EXPORTED std::string GetMethodArgDefault(TCppMethod_t, TCppIndex_t iarg); RPY_EXPORTED std::string GetMethodSignature(TCppMethod_t, bool show_formalargs, TCppIndex_t maxargs = (TCppIndex_t)-1);