23#include <unordered_map>
36#if !ENABLE_SYMBOLRESOLVER_TRACING
40#define AUTO_TRACE(...) (void)0
41#define AUTO_TRACE_ADD(...) (void)0
42#define AUTO_TRACE_EXIT(...) (void)0
63 std::lock_guard lock(stats.
mutex);
88 if (cacheSize<0) cacheSize=0;
89 if (cacheSize>9) cacheSize=9;
90 return 65536u << cacheSize;
96 return wrapper.cache();
102 return wrapper.cache();
122 if (
size_t i=name.find(
'<'); i!=
DString::npos) name = name.left(i);
155 m_elements.emplace_back(scope,fileScope,item);
159 m_elements.emplace_back(scope,fileScope,item,expScope);
168 [&](
const AccessElem &e) { return e.scope==scope && e.fileScope==fileScope && e.item==item; });
174 [&](
const AccessElem &e) { return e.scope==scope && e.fileScope==fileScope && e.item==item && e.expScope==expScope; });
248 const DString &explicitScopePart);
255 const DString &explicitScopePart,
270 const DString &explicitScopePart,
271 const DString &strippedTemplateParams,
300 const DString &explicitScopePart=
"",
305 const DString &explicitScopePart=
""
327 if (n.
empty())
return nullptr;
329 DString strippedTemplateParams;
332 std::unique_ptr<ArgumentList> actTemplParams;
333 if (!strippedTemplateParams.
empty())
340 if (qualifierIndex!=-1)
343 explicitScopePart=name.left(qualifierIndex);
346 name=name.mid(qualifierIndex+2);
362 bool hasUsingStatements =
372 size_t scopeNameLen = scope->
name().
length()+1;
373 size_t nameLen = name.length()+1;
374 size_t explicitPartLen = explicitScopePart.
length();
383 dstrcpy(pk,name.data()); *(pk+nameLen-1)=
'+';
392 if (hasUsingStatements)
404 if (std::find(visitedKeys.begin(),visitedKeys.end(),key.
str())!=std::end(visitedKeys))
412 visitedKeys.push_back(key.
str());
418 if (pTemplSpec) *pTemplSpec=pval->
templSpec;
419 if (pTypeDef) *pTypeDef=pval->
typeDef;
421 AUTO_TRACE_EXIT(
"found cached name={} templSpec={} typeDef={} resolvedTypedef={}",
433 int minDistance=10000;
439 getResolvedType(cache,visitedKeys,scope,d,explicitScopePart,actTemplParams.get(),
440 minDistance,bestMatch,bestTypedef,bestTemplSpec,bestResolvedType);
442 if (minDistance==0)
break;
447 *pTypeDef = bestTypedef;
451 *pTemplSpec = bestTemplSpec;
455 *pResolvedType = bestResolvedType;
459 visitedKeys.erase(std::remove(visitedKeys.begin(), visitedKeys.end(), key.
str()), visitedKeys.end());
461 AUTO_TRACE_EXIT(
"found name={} templSpec={} typeDef={} resolvedTypedef={}",
483 AUTO_TRACE(
"scope={} name={} args={} checkCV={} insideCode={}",
484 scope->
name(),n,args,checkCV,insideCode);
485 if (n.
empty())
return nullptr;
487 DString strippedTemplateParams;
490 std::unique_ptr<ArgumentList> actTemplParams;
491 if (!strippedTemplateParams.
empty())
498 if (qualifierIndex!=-1)
501 explicitScopePart=name.left(qualifierIndex);
504 name=name.mid(qualifierIndex+2);
506 AUTO_TRACE_ADD(
"qualifierIndex={} name={} explicitScopePart={} strippedTemplateParams={}",
507 qualifierIndex,name,explicitScopePart,strippedTemplateParams);
517 const auto &range = (range1.empty() && (i=name.find(
'<'))!=
DString::npos) ?
521 AUTO_TRACE_ADD(
"no symbols with name '{}' (including unspecialized)",name);
526 bool hasUsingStatements =
537 size_t nameLen = name.length()+1;
538 size_t explicitPartLen = explicitScopePart.
length();
539 size_t strippedTemplateParamsLen = strippedTemplateParams.
length();
540 bool resultDependsOnFileScope = hasUsingStatements ||
542 size_t fileScopeLen = resultDependsOnFileScope ? 1+
m_fileScope->absFilePath().length() : 0;
543 size_t argsLen = args.
length()+1;
548 key.reserve(scopeNameLen+nameLen+explicitPartLen+strippedTemplateParamsLen+fileScopeLen+argsLen);
556 key+=explicitScopePart.
str();
557 key+=strippedTemplateParams.
str();
564 if (resultDependsOnFileScope)
579 if (std::find(visitedKeys.begin(),visitedKeys.end(),key)!=std::end(visitedKeys))
586 visitedKeys.push_back(key);
591 if (pTemplSpec) *pTemplSpec=pval->
templSpec;
592 if (pTypeDef) *pTypeDef=pval->
typeDef;
594 AUTO_TRACE_EXIT(
"found cached name={} templSpec={} typeDef={} resolvedTypedef={}",
605 int minDistance=10000;
608 auto skipDefinition = [
this,&explicitScopePart](
const Definition *d) ->
bool {
616 explicitScopePart.
empty())
637 d->isLinkableInProject() ||
644 if (skipDefinition(d))
continue;
645 getResolvedSymbol(visitedKeys,scope,d,args,checkCV,insideCode,explicitScopePart,strippedTemplateParams,
false,
646 minDistance,bestMatch,bestTypedef,bestTemplSpec,bestResolvedType);
648 if (minDistance==0)
break;
653 if (bestMatch==
nullptr && args==
"()")
659 if (skipDefinition(d))
continue;
661 minDistance,bestMatch,bestTypedef,bestTemplSpec,bestResolvedType);
663 if (minDistance==0)
break;
669 *pTypeDef = bestTypedef;
673 *pTemplSpec = bestTemplSpec;
677 *pResolvedType = bestResolvedType;
680 cache.
insert(key,
LookupInfo(bestMatch,bestTypedef,bestTemplSpec,bestResolvedType));
681 visitedKeys.erase(std::remove(visitedKeys.begin(),visitedKeys.end(),key),visitedKeys.end());
683 AUTO_TRACE_EXIT(
"found name={} templSpec={} typeDef={} resolvedTypedef={}",
697 const DString &explicitScopePart,
719 accessStack,scope,d,explicitScopePart);
734 if (distance<minDistance)
736 AUTO_TRACE_ADD(
"found symbol={} at distance={} minDistance={}",cd->
name(),distance,minDistance);
737 minDistance=distance;
739 bestTypedef =
nullptr;
740 bestTemplSpec.
clear();
743 else if (distance==minDistance &&
758 AUTO_TRACE_ADD(
"found symbol={} at distance={} minDistance={}",cd->
name(),distance,minDistance);
759 minDistance=distance;
761 bestTypedef =
nullptr;
762 bestTemplSpec.
clear();
784 if (distance<minDistance)
788 minDistance=distance;
793 AUTO_TRACE_ADD(
"found symbol={} at distance={} minDistance={}",cd->
name(),distance,minDistance);
796 bestTemplSpec = spec;
797 bestResolvedType = type;
803 bestTypedef = enumType;
812 bestTemplSpec = spec;
813 bestResolvedType = type;
820 bestTemplSpec.
clear();
821 bestResolvedType.
clear();
836 if (distance<minDistance)
838 AUTO_TRACE_ADD(
"found enum={} at distance={} minDistance={}",md->
name(),distance,minDistance);
839 minDistance=distance;
854 bestMatch?bestMatch->
name():
DString(
"<none>"),bestResolvedType);
865 const DString &explicitScopePart,
866 const DString &strippedTemplateParams,
880 int distance =
isAccessibleFromWithExpScope(visitedKeys,visitedNamespaces,accessStack,scope,d,explicitScopePart+strippedTemplateParams);
881 if (distance==-1 && !strippedTemplateParams.
empty())
897 if (distance<minDistance)
899 AUTO_TRACE_ADD(
"found symbol={} at distance={} minDistance={}",d->
name(),distance,minDistance);
900 minDistance=distance;
902 bestTypedef =
nullptr;
903 bestTemplSpec.
clear();
906 else if (distance==minDistance &&
921 AUTO_TRACE_ADD(
"found symbol={} at distance={} minDistance={}",d->
name(),distance,minDistance);
922 minDistance=distance;
924 bestTypedef =
nullptr;
925 bestTemplSpec.
clear();
961 if (match && distance<minDistance)
963 AUTO_TRACE_ADD(
"found symbol={} at distance={} minDistance={}",md->
name(),distance,minDistance);
964 minDistance=distance;
975 if (distance<minDistance)
977 AUTO_TRACE_ADD(
"found symbol={} at distance={} minDistance={}",d->
name(),distance,minDistance);
978 minDistance=distance;
980 bestTypedef =
nullptr;
981 bestTemplSpec.
clear();
982 bestResolvedType.
clear();
991 bestMatch?bestMatch->
name():
DString(
"<none>"),bestResolvedType);
1032 actTemplParams && !actTemplParams->
empty())
1038 int tl=
static_cast<int>(type.
length());
1040 while (ip>=0 && (type.
at(ip)==
'*' || type.
at(ip)==
'&' || type.
at(ip)==
' '))
1044 type=type.
left(ip+1);
1051 tl=
static_cast<int>(type.
length());
1052 while (sp<tl && type.
at(sp)==
' ') sp++;
1055 &memTypeDef,
nullptr,pResolvedType);
1057 if (memTypeDef && memTypeDef->
isTypedef())
1063 else if (memTypeDef && memTypeDef->
isEnumerate() && pMemType)
1065 *pMemType = memTypeDef;
1068 if (result==
nullptr)
1071 size_t si = type.
rfind(
"::");
1072 size_t i = type.
find(
'<');
1075 if (pTemplSpec) *pTemplSpec = type.
mid(i);
1080 i=type.
find(
'<',si);
1087 if (pTemplSpec) *pTemplSpec = type.
mid(i);
1100 if (sp>0) pResolvedType->
prepend(typedefValue.
left(sp));
1101 if (ip<tl-1) pResolvedType->
append(typedefValue.
right(tl-ip-1));
1105 *pResolvedType = typedefValue;
1119 pTemplSpec ? *pTemplSpec :
DString(),
1120 pResolvedType ? *pResolvedType :
DString()
1129 pTemplSpec ? *pTemplSpec :
"<nullptr>",
1130 pResolvedType ? *pResolvedType :
"<nullptr>"
1141 const DString &explicitScopePart)
1144 AUTO_TRACE(
"scope={} item={} explictScopePart={}",
1146 if (explicitScopePart.
empty())
1168 bool nestedClassInsideBaseClass =
1174 bool enumValueWithinEnum =
1179 if (itemScope==newScope)
1183 else if (nestedClassInsideBaseClass)
1196 else if (enumValueWithinEnum)
1206 visitedNamespaces.emplace(newScope->
name().
str(),newScope);
1222 if (visitedNamespaces.find(nd->name().str())==visitedNamespaces.end())
1248 result = (i==-1) ? -1 : i+2;
1281 result= (i==-1) ? -1 : i+2;
1304 AUTO_TRACE_ADD(
"qualScopePart={} memTypeDef={}",qualScopePart,memTypeDef?memTypeDef->
name():
"");
1340 if (namespaceMember && namespaceMember->
isEnumerate())
1342 next = namespaceMember;
1379 (
toFileDef(current))->getUsedDefinitions(),qualScopePart);
1382 if (current==
nullptr)
break;
1398 for (
const auto &d : dl)
1400 if (d->localName()==localName)
1413 const DString &explicitScopePart,
1416 AUTO_TRACE(
"item={} explicitScopePart={} level={}",item?item->
name():
DString(), explicitScopePart, level);
1417 for (
const auto &und : nl)
1428 DString key=und->qualifiedName();
1429 if (!und->getUsedNamespaces().empty() && std::find(visitedNamespaces.begin(),visitedNamespaces.end(),key.
str())==std::end(visitedNamespaces))
1431 visitedNamespaces.push_back(key.
str());
1449 const DString &explicitScopePart)
1452 for (
const auto &ud : dl)
1471 AUTO_TRACE(
"scope={} item={} item.definitionType={}",
1492 if ((itemIsMember || itemIsClass) &&
1494 (itemScope && itemScope->
name().
startsWith(
"anonymous_namespace{"))
1502 else if (itemIsClass)
1511 bool memberAccessibleFromScope =
1516 bool nestedClassInsideBaseClass =
1521 int distanceToBaseClass=0;
1522 bool baseClassOfScope =
1523 (itemIsClass && item!=scope &&
1529 bool enumValueOfStrongEnum =
1537 if (itemScope==scope || memberAccessibleFromScope || nestedClassInsideBaseClass || baseClassOfScope || enumValueOfStrongEnum)
1539 AUTO_TRACE_ADD(
"memberAccessibleFromScope={} nestedClassInsideBaseClass={} baseClassOfScope={} enumValueOfStrongEnum={}",
1540 memberAccessibleFromScope, nestedClassInsideBaseClass, baseClassOfScope, enumValueOfStrongEnum);
1541 int distanceToBase=0;
1542 if (nestedClassInsideBaseClass)
1548 else if (memberAccessibleFromScope &&
1555 result+=distanceToBase;
1557 else if (baseClassOfScope)
1559 result+=distanceToBaseClass;
1638 result= (i==-1) ? -1 : i+2;
1653 if (name.empty())
return result;
1660 int minDistance=10000;
1663 const int maxAddrSize = 20;
1664 char ptr_str[maxAddrSize];
1665 int num = snprintf(ptr_str,maxAddrSize,
"%p:",(
void *)scope);
1667 key.reserve(num+name.length()+1);
1674 if (pTypeDef) *pTypeDef = it->second.second;
1675 return it->second.first;
1692 if (distance!=-1 && distance<minDistance)
1695 minDistance=distance;
1705 if (pTypeDef) *pTypeDef=bestMatch;
1711 g_substMap.emplace(key,std::make_pair(result,bestMatch));
1733 bool mayBeUnlinkable,
1736 AUTO_TRACE(
"scope={} name={} mayBeUnlinkable={} mayBeHidden={}",
1737 scope?scope->
name():
DString(), name, mayBeUnlinkable, mayBeHidden);
1741 p->fileScope() ?
p->fileScope()->getLanguage() :
1744 if (scope==
nullptr ||
1748 (name.stripWhiteSpace().startsWith(
"::")) ||
1749 ((lang==SrcLangExt::Java || lang==SrcLangExt::CSharp) &&
DString(name).find(
"::")!=
DString::npos)
1764 result =
p->getResolvedTypeRec(
getTypeLookupCache(),visitedKeys,scope,lookupName,&
p->typeDef,&
p->templateSpec,&
p->resolvedType);
1765 if (result==
nullptr)
1772 if (!mayBeUnlinkable && result && !result->
isLinkable())
1774 if (!mayBeHidden || !result->
isHidden())
1791 AUTO_TRACE(
"scope={} name={} args={} checkCV={} insideCode={}",
1792 scope?scope->
name():
DString(), name, args, checkCV, insideCode);
1796 const Definition *result =
p->getResolvedSymbolRec(
getSymbolLookupCache(),visitedKeys,scope,name,args,checkCV,insideCode,onlyLinkable,&
p->typeDef,&
p->templateSpec,&
p->resolvedType);
1809 int result =
p->isAccessibleFrom(visitedKeys,accessStack,scope,item);
1815 const DString &explicitScopePart)
1817 AUTO_TRACE(
"scope={} item={} explicitScopePart={}",
1823 int result =
p->isAccessibleFromWithExpScope(visitedKeys,visitedNamespaces,accessStack,scope,item,explicitScopePart);
1830 p->setFileScope(fileScope);
1840 return p->templateSpec;
1845 return p->resolvedType;
1859 for (
const auto &ci : cache)
1864 elementsToRemove.push_back(ci.first);
1867 for (
const auto &k : elementsToRemove)
1876 for (
const auto &ci : cache)
1881 elementsToRemove.push_back(ci.first);
1884 for (
const auto &k : elementsToRemove)
1906 return std::max(0,std::min(r-16,9));
1918 msg(
"type lookup cache used {}/{} hits={} misses={}\n",
1923 msg(
"symbol lookup cache used {}/{} hits={} misses={}\n",
1930 int cacheParam = std::max(typeCacheParam,symbolCacheParam);
1933 msg(
"Note: based on cache misses the ideal setting for LOOKUP_CACHE_SIZE is {} at the cost of higher memory usage.\n",cacheParam);
Helper class representing the stack of items considered while resolving the scope.
void push(const Definition *scope, const FileDef *fileScope, const Definition *item, const DString &expScope)
bool find(const Definition *scope, const FileDef *fileScope, const Definition *item, const DString &expScope)
std::vector< AccessElem > m_elements
bool find(const Definition *scope, const FileDef *fileScope, const Definition *item)
void push(const Definition *scope, const FileDef *fileScope, const Definition *item)
This class represents an function or template argument list.
V * insert(const K &key, V &&value)
Inserts value under key in the cache.
size_t capacity() const
Returns the maximum number of values that can be stored in the cache.
size_t size() const
Returns the number of values stored in the cache.
uint64_t misses() const
Returns how many of the find() calls did not found a value in the cache.
uint64_t hits() const
Returns how many of the find() calls did find a value in the cache.
A abstract class representing of a compound symbol.
virtual const MemberDef * getMemberByName(const DString &) const =0
Returns the member with the given name.
virtual const ArgumentList & templateArguments() const =0
Returns the template arguments of this class.
virtual bool isTemplate() const =0
Returns true if this class is a template.
virtual int isBaseClass(const ClassDef *bcd, bool followInstances, const DString &templSpec=DString()) const =0
Returns true iff bcd is a direct or indirect base class of this class.
virtual bool isTemplateArgument() const =0
virtual bool isAccessibleMember(const MemberDef *md) const =0
returns true iff md is a member of this class or of the the public/protected members of a base class
virtual FileDef * getFileDef() const =0
Returns the file in which this compound's definition can be found.
A String class for use with Doxygen wrapping std::string and adding some additional functionality off...
size_t rfind(char c, size_t pos=npos) const
DString mid(size_t index, size_t len=npos) const
bool empty() const
Returns true iff the string is empty (std::string compatible alias for isEmpty()).
char * rawData()
Returns a writable pointer to the data.
static constexpr size_t npos
value used to indicate 'not found' or 'to the end of the string', matching std::string::npos
char & at(size_t i)
Returns a reference to the character at index i.
DString right(size_t len) const
DString & prepend(const char *s)
size_t find(char c, size_t pos=0) const
DString left(size_t len) const
const std::string & str() const
bool stripPrefix(const DString &prefix)
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
bool startsWith(const char *s) const
size_t length() const
Returns the length of the string, not counting the 0-terminator.
The common base class of all entity definitions found in the sources.
virtual SrcLangExt getLanguage() const =0
Returns the programming language this definition was written in.
virtual DString getDefFileName() const =0
virtual bool isLinkable() const =0
virtual DefType definitionType() const =0
virtual const DString & name() const =0
virtual const DString & localName() const =0
virtual DString qualifiedName() const =0
virtual bool isHidden() const =0
virtual bool isArtificial() const =0
virtual Definition * getOuterScope() const =0
virtual bool isReference() const =0
virtual const Definition * findInnerCompound(const DString &name) const =0
static NamespaceDefMutable * globalScope
static SymbolMap< Definition > * symbolMap
A model of a file symbol.
virtual DString absFilePath() const =0
virtual const LinkedRefMap< NamespaceDef > & getUsedNamespaces() const =0
virtual const LinkedRefMap< const Definition > & getUsedDefinitions() const =0
Container class representing a vector of objects with keys.
A model of a class/file/namespace member symbol.
virtual DString argsString() const =0
virtual const ClassDef * getCachedTypedefVal() const =0
virtual const ClassDef * getClassDef() const =0
virtual DString getCachedResolvedTypedef() const =0
virtual bool isTypedef() const =0
virtual const FileDef * getFileDef() const =0
virtual const ArgumentList & argumentList() const =0
virtual bool isStrongEnumValue() const =0
virtual bool isStatic() const =0
virtual bool isTypedefValCached() const =0
virtual std::optional< ArgumentList > formalTemplateArguments() const =0
virtual DString getCachedTypedefTemplSpec() const =0
virtual bool isEnumerate() const =0
virtual bool isStrong() const =0
virtual DString typeString() const =0
virtual bool isCallable() const =0
virtual const MemberDef * getEnumScope() const =0
virtual bool isEnumValue() const =0
virtual void cacheTypedefVal(const ClassDef *val, const DString &templSpec, const DString &resolvedType)=0
An abstract interface of a namespace symbol.
virtual const MemberDef * getMemberByName(const DString &) const =0
virtual const LinkedRefMap< NamespaceDef > & getUsedNamespaces() const =0
virtual const LinkedRefMap< const Definition > & getUsedDefinitions() const =0
const VectorPtr & find(const DString &name)
static void showCacheUsage()
Show usage of the type lookup cache.
ClearScope
Clear the type lookup cache for the current thread.
int isAccessibleFrom(const Definition *scope, const Definition *item)
Checks if symbol item is accessible from within scope.
static void clearTypeLookupCache(ClearScope scope)
const ClassDef * resolveClass(const Definition *scope, const DString &name, bool maybeUnlinkable=false, bool mayBeHidden=false)
Find the class definition matching name within the scope set.
const Definition * resolveSymbol(const Definition *scope, const DString &name, const DString &args=DString(), bool checkCV=false, bool insideCode=false, bool onlyLinkable=false)
Find the symbool definition matching name within the scope set.
DString getResolvedType() const
In case a call to resolveClass() points to a typedef or using declaration.
std::unique_ptr< Private > p
int isAccessibleFromWithExpScope(const Definition *scope, const Definition *item, const DString &explicitScopePart)
Check if symbol item is accessible from within scope, where it has to match the explicitScopePart.
SymbolResolver(const FileDef *fileScope=nullptr)
DString getTemplateSpec() const
In case a call to resolveClass() points to a template specialization, the template part is return via...
void setFileScope(const FileDef *fd)
Sets or updates the file scope using when resolving symbols.
const MemberDef * getTypedef() const
In case a call to resolveClass() resolves to a type member (e.g. an enum) this method will return it.
ClassDef * getClass(const DString &n)
ClassDef * toClassDef(Definition *d)
#define Config_getInt(name)
#define Config_getBool(name)
std::vector< std::string > StringVector
std::unique_ptr< ArgumentList > stringToArgumentList(SrcLangExt lang, const DString &argsString, DString *extraTypeChars=nullptr)
#define AUTO_TRACE_ADD(...)
#define AUTO_TRACE_EXIT(...)
char * dstrcpy(char *dst, const char *src)
const char * qPrint(const char *s)
FileDef * toFileDef(Definition *d)
MemberDefMutable * toMemberDefMutable(Definition *d)
MemberDef * toMemberDef(Definition *d)
void replaceNamespaceAliases(DString &name)
NamespaceDef * toNamespaceDef(Definition *d)
const FileDef * fileScope
AccessElem(const Definition *d, const FileDef *f, const Definition *i)
AccessElem(const Definition *d, const FileDef *f, const Definition *i, const DString &e)
CacheStatistics & m_statistics
Cache< std::string, LookupInfo > m_cache
CacheStatsWrapper(CacheStatistics &stats, size_t capacity)
const Definition * definition
const MemberDef * typeDef
const MemberDef * typeDef
const FileDef * m_fileScope
const ClassDef * newResolveTypedef(LookupCache &cache, VisitedKeys &visitedKeys, const Definition *scope, const MemberDef *md, const MemberDef **pMemType, DString *pTemplSpec, DString *pResolvedType, const ArgumentList *actTemplParams=nullptr)
int isAccessibleFrom(VisitedKeys &visitedKeys, AccessStack &accessStack, const Definition *scope, const Definition *item)
Private(const FileDef *f)
const ClassDef * getResolvedTypeRec(LookupCache &cache, VisitedKeys &visitedKeys, const Definition *scope, const DString &n, const MemberDef **pTypeDef, DString *pTemplSpec, DString *pResolvedType)
bool accessibleViaUsingNamespace(VisitedKeys &visitedKeys, VisitedNamespaceKeys &visitedNamespaces, const LinkedRefMap< NamespaceDef > &nl, const Definition *item, const DString &explicitScopePart="", int level=0)
bool accessibleViaUsingDefinition(VisitedKeys &visitedKeys, const LinkedRefMap< const Definition > &dl, const Definition *item, const DString &explicitScopePart="")
const FileDef * fileScope() const
void setFileScope(const FileDef *fileScope)
const Definition * endOfPathIsUsedClass(const LinkedRefMap< const Definition > &dl, const DString &localName)
void getResolvedType(LookupCache &cache, VisitedKeys &visitedKeys, const Definition *scope, const Definition *d, const DString &explicitScopePart, const ArgumentList *actTemplParams, int &minDistance, const ClassDef *&bestMatch, const MemberDef *&bestTypedef, DString &bestTemplSpec, DString &bestResolvedType)
const Definition * followPath(VisitedKeys &visitedKeys, const Definition *start, const DString &path)
void getResolvedSymbol(VisitedKeys &visitedKeys, const Definition *scope, const Definition *d, const DString &args, bool checkCV, bool insideCode, const DString &explicitScopePart, const DString &strippedTemplateParams, bool forceCallable, int &minDistance, const Definition *&bestMatch, const MemberDef *&bestTypedef, DString &bestTemplSpec, DString &bestResolvedType)
int isAccessibleFromWithExpScope(VisitedKeys &visitedKeys, VisitedNamespaces &visitedNamespaces, AccessStack &accessStack, const Definition *scope, const Definition *item, const DString &explicitScopePart)
DString substTypedef(VisitedKeys &visitedKeys, const Definition *scope, const DString &name, const MemberDef **pTypeDef=nullptr)
std::unordered_map< std::string, const MemberDef * > m_resolvedTypedefs
const Definition * getResolvedSymbolRec(LookupCache &cache, VisitedKeys &visitedKeys, const Definition *scope, const DString &n, const DString &args, bool checkCV, bool insideCode, bool onlyLinkable, const MemberDef **pTypeDef, DString *pTemplSpec, DString *pResolvedType)
StringVector VisitedNamespaceKeys
static bool isCodeSymbol(Definition::DefType defType)
static bool isFileLocalStatic(const Definition *d)
Returns true for a static function or variable that is not a class member, so it is only visible with...
static DString bareName(const Definition *d)
Returns the name of a class as it is used inside the class itself, so Widget for Widget<int>.
static std::recursive_mutex g_cacheTypedefMutex
static void mergeStatistics(CacheStatistics &stats, LookupCache &cache)
std::unordered_map< std::string, const Definition * > VisitedNamespaces
static LookupCache & getTypeLookupCache()
static int computeIdealCacheParam(size_t v)
static LookupCache & getSymbolLookupCache()
static size_t getCacheSize()
THREAD_LOCAL std::unordered_map< std::string, std::pair< DString, const MemberDef * > > g_substMap
static CacheStatistics g_symbolCacheStatistics
static CacheStatistics g_typeCacheStatistics
Cache< std::string, LookupInfo > LookupCache
DString substituteTemplateArgumentsInString(const DString &nm, const ArgumentList &formalArgs, const ArgumentList *actualArgs)
int computeQualifiedIndex(const DString &name)
Return the index of the last :: in the string name that is still before the first <.
DString stripTemplateSpecifiersFromScope(const DString &fullName, bool parentOnly, DString *pLastScopeStripped, DString scopeName, bool allowArtificial)
DString argListToString(const ArgumentList &al, bool useCanonicalType, bool showDefVals)
bool matchArguments2(const Definition *srcScope, const FileDef *srcFileScope, const DString &srcReturnType, const ArgumentList *srcAl, const Definition *dstScope, const FileDef *dstFileScope, const DString &dstReturnType, const ArgumentList *dstAl, bool checkCV, SrcLangExt lang, bool allowUnresolved)
DString mangleCSharpGenericName(const DString &name)
int getScopeFragment(const DString &s, int p, int *l)
A bunch of utility functions.