16#include <unordered_map>
30#if !ENABLE_SYMBOLRESOLVER_TRACING
34#define AUTO_TRACE(...) (void)0
35#define AUTO_TRACE_ADD(...) (void)0
36#define AUTO_TRACE_EXIT(...) (void)0
57 std::lock_guard lock(stats.
mutex);
82 if (cacheSize<0) cacheSize=0;
83 if (cacheSize>9) cacheSize=9;
84 return 65536u << cacheSize;
90 return wrapper.cache();
96 return wrapper.cache();
130 m_elements.emplace_back(scope,fileScope,item);
134 m_elements.emplace_back(scope,fileScope,item,expScope);
143 [&](
const AccessElem &e) { return e.scope==scope && e.fileScope==fileScope && e.item==item; });
149 [&](
const AccessElem &e) { return e.scope==scope && e.fileScope==fileScope && e.item==item && e.expScope==expScope; });
223 const DString &explicitScopePart);
230 const DString &explicitScopePart,
245 const DString &explicitScopePart,
246 const DString &strippedTemplateParams,
275 const DString &explicitScopePart=
"",
280 const DString &explicitScopePart=
""
302 if (n.
empty())
return nullptr;
304 DString strippedTemplateParams;
307 std::unique_ptr<ArgumentList> actTemplParams;
308 if (!strippedTemplateParams.
empty())
315 if (qualifierIndex!=-1)
318 explicitScopePart=name.
left(qualifierIndex);
321 name=name.
mid(qualifierIndex+2);
337 bool hasUsingStatements =
347 size_t scopeNameLen = scope->
name().
length()+1;
348 size_t nameLen = name.
length()+1;
349 size_t explicitPartLen = explicitScopePart.
length();
367 if (hasUsingStatements)
379 if (std::find(visitedKeys.begin(),visitedKeys.end(),key.
str())!=std::end(visitedKeys))
387 visitedKeys.push_back(key.
str());
393 if (pTemplSpec) *pTemplSpec=pval->
templSpec;
394 if (pTypeDef) *pTypeDef=pval->
typeDef;
396 AUTO_TRACE_EXIT(
"found cached name={} templSpec={} typeDef={} resolvedTypedef={}",
408 int minDistance=10000;
414 getResolvedType(cache,visitedKeys,scope,d,explicitScopePart,actTemplParams.get(),
415 minDistance,bestMatch,bestTypedef,bestTemplSpec,bestResolvedType);
417 if (minDistance==0)
break;
422 *pTypeDef = bestTypedef;
426 *pTemplSpec = bestTemplSpec;
430 *pResolvedType = bestResolvedType;
434 visitedKeys.erase(std::remove(visitedKeys.begin(), visitedKeys.end(), key.
str()), visitedKeys.end());
436 AUTO_TRACE_EXIT(
"found name={} templSpec={} typeDef={} resolvedTypedef={}",
458 AUTO_TRACE(
"scope={} name={} args={} checkCV={} insideCode={}",
459 scope->
name(),n,args,checkCV,insideCode);
460 if (n.
empty())
return nullptr;
462 DString strippedTemplateParams;
465 std::unique_ptr<ArgumentList> actTemplParams;
466 if (!strippedTemplateParams.
empty())
473 if (qualifierIndex!=-1)
476 explicitScopePart=name.
left(qualifierIndex);
479 name=name.
mid(qualifierIndex+2);
481 AUTO_TRACE_ADD(
"qualifierIndex={} name={} explicitScopePart={} strippedTemplateParams={}",
482 qualifierIndex,name,explicitScopePart,strippedTemplateParams);
496 AUTO_TRACE_ADD(
"no symbols with name '{}' (including unspecialized)",name);
501 bool hasUsingStatements =
512 size_t nameLen = name.
length()+1;
513 size_t explicitPartLen = explicitScopePart.
length();
514 size_t strippedTemplateParamsLen = strippedTemplateParams.
length();
515 size_t fileScopeLen = hasUsingStatements ? 1+
m_fileScope->absFilePath().length() : 0;
516 size_t argsLen = args.
length()+1;
521 key.reserve(scopeNameLen+nameLen+explicitPartLen+strippedTemplateParamsLen+fileScopeLen+argsLen);
529 key+=explicitScopePart.
str();
530 key+=strippedTemplateParams.
str();
536 if (hasUsingStatements)
551 if (std::find(visitedKeys.begin(),visitedKeys.end(),key)!=std::end(visitedKeys))
558 visitedKeys.push_back(key);
563 if (pTemplSpec) *pTemplSpec=pval->
templSpec;
564 if (pTypeDef) *pTypeDef=pval->
typeDef;
566 AUTO_TRACE_EXIT(
"found cached name={} templSpec={} typeDef={} resolvedTypedef={}",
577 int minDistance=10000;
580 auto skipDefinition = [
this,&explicitScopePart](
const Definition *d) ->
bool {
588 explicitScopePart.
empty())
610 d->isLinkableInProject() ||
617 if (skipDefinition(d))
continue;
618 getResolvedSymbol(visitedKeys,scope,d,args,checkCV,insideCode,explicitScopePart,strippedTemplateParams,
false,
619 minDistance,bestMatch,bestTypedef,bestTemplSpec,bestResolvedType);
621 if (minDistance==0)
break;
626 if (bestMatch==
nullptr && args==
"()")
632 if (skipDefinition(d))
continue;
634 minDistance,bestMatch,bestTypedef,bestTemplSpec,bestResolvedType);
636 if (minDistance==0)
break;
642 *pTypeDef = bestTypedef;
646 *pTemplSpec = bestTemplSpec;
650 *pResolvedType = bestResolvedType;
653 cache.
insert(key,
LookupInfo(bestMatch,bestTypedef,bestTemplSpec,bestResolvedType));
654 visitedKeys.erase(std::remove(visitedKeys.begin(),visitedKeys.end(),key),visitedKeys.end());
656 AUTO_TRACE_EXIT(
"found name={} templSpec={} typeDef={} resolvedTypedef={}",
670 const DString &explicitScopePart,
692 accessStack,scope,d,explicitScopePart);
707 if (distance<minDistance)
709 AUTO_TRACE_ADD(
"found symbol={} at distance={} minDistance={}",cd->
name(),distance,minDistance);
710 minDistance=distance;
712 bestTypedef =
nullptr;
713 bestTemplSpec.
clear();
716 else if (distance==minDistance &&
731 AUTO_TRACE_ADD(
"found symbol={} at distance={} minDistance={}",cd->
name(),distance,minDistance);
732 minDistance=distance;
734 bestTypedef =
nullptr;
735 bestTemplSpec.
clear();
757 if (distance<minDistance)
761 minDistance=distance;
766 AUTO_TRACE_ADD(
"found symbol={} at distance={} minDistance={}",cd->
name(),distance,minDistance);
769 bestTemplSpec = spec;
770 bestResolvedType = type;
776 bestTypedef = enumType;
785 bestTemplSpec = spec;
786 bestResolvedType = type;
793 bestTemplSpec.
clear();
794 bestResolvedType.
clear();
809 if (distance<minDistance)
811 AUTO_TRACE_ADD(
"found enum={} at distance={} minDistance={}",md->
name(),distance,minDistance);
812 minDistance=distance;
827 bestMatch?bestMatch->
name():
DString(
"<none>"),bestResolvedType);
838 const DString &explicitScopePart,
839 const DString &strippedTemplateParams,
853 int distance =
isAccessibleFromWithExpScope(visitedKeys,visitedNamespaces,accessStack,scope,d,explicitScopePart+strippedTemplateParams);
854 if (distance==-1 && !strippedTemplateParams.
empty())
870 if (distance<minDistance)
872 AUTO_TRACE_ADD(
"found symbol={} at distance={} minDistance={}",d->
name(),distance,minDistance);
873 minDistance=distance;
875 bestTypedef =
nullptr;
876 bestTemplSpec.
clear();
879 else if (distance==minDistance &&
894 AUTO_TRACE_ADD(
"found symbol={} at distance={} minDistance={}",d->
name(),distance,minDistance);
895 minDistance=distance;
897 bestTypedef =
nullptr;
898 bestTemplSpec.
clear();
934 if (match && distance<minDistance)
936 AUTO_TRACE_ADD(
"found symbol={} at distance={} minDistance={}",md->
name(),distance,minDistance);
937 minDistance=distance;
948 if (distance<minDistance)
950 AUTO_TRACE_ADD(
"found symbol={} at distance={} minDistance={}",d->
name(),distance,minDistance);
951 minDistance=distance;
953 bestTypedef =
nullptr;
954 bestTemplSpec.
clear();
955 bestResolvedType.
clear();
964 bestMatch?bestMatch->
name():
DString(
"<none>"),bestResolvedType);
1005 actTemplParams && !actTemplParams->
empty())
1011 int tl=
static_cast<int>(type.
length());
1013 while (ip>=0 && (type.
at(ip)==
'*' || type.
at(ip)==
'&' || type.
at(ip)==
' '))
1017 type=type.
left(ip+1);
1023 tl=
static_cast<int>(type.
length());
1024 while (sp<tl && type.
at(sp)==
' ') sp++;
1027 &memTypeDef,
nullptr,pResolvedType);
1029 if (memTypeDef && memTypeDef->
isTypedef())
1035 else if (memTypeDef && memTypeDef->
isEnumerate() && pMemType)
1037 *pMemType = memTypeDef;
1040 if (result==
nullptr)
1043 size_t si = type.
rfind(
"::");
1044 size_t i = type.
find(
'<');
1047 if (pTemplSpec) *pTemplSpec = type.
mid(i);
1052 i=type.
find(
'<',si);
1059 if (pTemplSpec) *pTemplSpec = type.
mid(i);
1072 if (sp>0) pResolvedType->
prepend(typedefValue.
left(sp));
1073 if (ip<tl-1) pResolvedType->
append(typedefValue.
right(tl-ip-1));
1077 *pResolvedType = typedefValue;
1091 pTemplSpec ? *pTemplSpec :
DString(),
1092 pResolvedType ? *pResolvedType :
DString()
1101 pTemplSpec ? *pTemplSpec :
"<nullptr>",
1102 pResolvedType ? *pResolvedType :
"<nullptr>"
1113 const DString &explicitScopePart)
1116 AUTO_TRACE(
"scope={} item={} explictScopePart={}",
1118 if (explicitScopePart.
empty())
1140 bool nestedClassInsideBaseClass =
1146 bool enumValueWithinEnum =
1151 if (itemScope==newScope)
1155 else if (nestedClassInsideBaseClass)
1168 else if (enumValueWithinEnum)
1178 visitedNamespaces.emplace(newScope->
name().
str(),newScope);
1194 if (visitedNamespaces.find(nd->name().str())==visitedNamespaces.end())
1220 result = (i==-1) ? -1 : i+2;
1253 result= (i==-1) ? -1 : i+2;
1276 AUTO_TRACE_ADD(
"qualScopePart={} memTypeDef={}",qualScopePart,memTypeDef?memTypeDef->
name():
"");
1312 if (namespaceMember && namespaceMember->
isEnumerate())
1314 next = namespaceMember;
1351 (
toFileDef(current))->getUsedDefinitions(),qualScopePart);
1354 if (current==
nullptr)
break;
1370 for (
const auto &d : dl)
1372 if (d->localName()==localName)
1385 const DString &explicitScopePart,
1388 AUTO_TRACE(
"item={} explicitScopePart={} level={}",item?item->
name():
DString(), explicitScopePart, level);
1389 for (
const auto &und : nl)
1400 DString key=und->qualifiedName();
1401 if (!und->getUsedNamespaces().empty() && std::find(visitedNamespaces.begin(),visitedNamespaces.end(),key.
str())==std::end(visitedNamespaces))
1403 visitedNamespaces.push_back(key.
str());
1421 const DString &explicitScopePart)
1424 for (
const auto &ud : dl)
1443 AUTO_TRACE(
"scope={} item={} item.definitionType={}",
1464 if ((itemIsMember || itemIsClass) &&
1466 (itemScope && itemScope->
name().
startsWith(
"anonymous_namespace{"))
1474 else if (itemIsClass)
1481 bool memberAccessibleFromScope =
1487 bool nestedClassInsideBaseClass =
1493 bool enumValueOfStrongEnum =
1501 if (itemScope==scope || memberAccessibleFromScope || nestedClassInsideBaseClass || enumValueOfStrongEnum)
1503 AUTO_TRACE_ADD(
"memberAccessibleFromScope={} nestedClassInsideBaseClass={} enumValueOfStrongEnum={}",
1504 memberAccessibleFromScope, nestedClassInsideBaseClass, enumValueOfStrongEnum);
1505 int distanceToBase=0;
1506 if (nestedClassInsideBaseClass)
1512 else if (memberAccessibleFromScope &&
1519 result+=distanceToBase;
1598 result= (i==-1) ? -1 : i+2;
1613 if (name.
empty())
return result;
1620 int minDistance=10000;
1623 const int maxAddrSize = 20;
1624 char ptr_str[maxAddrSize];
1625 int num = snprintf(ptr_str,maxAddrSize,
"%p:",(
void *)scope);
1627 key.reserve(num+name.
length()+1);
1634 if (pTypeDef) *pTypeDef = it->second.second;
1635 return it->second.first;
1652 if (distance!=-1 && distance<minDistance)
1655 minDistance=distance;
1665 if (pTypeDef) *pTypeDef=bestMatch;
1671 g_substMap.emplace(key,std::make_pair(result,bestMatch));
1693 bool mayBeUnlinkable,
1696 AUTO_TRACE(
"scope={} name={} mayBeUnlinkable={} mayBeHidden={}",
1697 scope?scope->
name():
DString(), name, mayBeUnlinkable, mayBeHidden);
1701 p->fileScope() ?
p->fileScope()->getLanguage() :
1704 if (scope==
nullptr ||
1709 ((lang==SrcLangExt::Java || lang==SrcLangExt::CSharp) &&
DString(name).find(
"::")!=
DString::npos)
1724 result =
p->getResolvedTypeRec(
getTypeLookupCache(),visitedKeys,scope,lookupName,&
p->typeDef,&
p->templateSpec,&
p->resolvedType);
1725 if (result==
nullptr)
1732 if (!mayBeUnlinkable && result && !result->
isLinkable())
1734 if (!mayBeHidden || !result->
isHidden())
1751 AUTO_TRACE(
"scope={} name={} args={} checkCV={} insideCode={}",
1752 scope?scope->
name():
DString(), name, args, checkCV, insideCode);
1756 const Definition *result =
p->getResolvedSymbolRec(
getSymbolLookupCache(),visitedKeys,scope,name,args,checkCV,insideCode,onlyLinkable,&
p->typeDef,&
p->templateSpec,&
p->resolvedType);
1769 int result =
p->isAccessibleFrom(visitedKeys,accessStack,scope,item);
1775 const DString &explicitScopePart)
1777 AUTO_TRACE(
"scope={} item={} explicitScopePart={}",
1783 int result =
p->isAccessibleFromWithExpScope(visitedKeys,visitedNamespaces,accessStack,scope,item,explicitScopePart);
1790 p->setFileScope(fileScope);
1800 return p->templateSpec;
1805 return p->resolvedType;
1819 for (
const auto &ci : cache)
1824 elementsToRemove.push_back(ci.first);
1827 for (
const auto &k : elementsToRemove)
1836 for (
const auto &ci : cache)
1841 elementsToRemove.push_back(ci.first);
1844 for (
const auto &k : elementsToRemove)
1866 return std::max(0,std::min(r-16,9));
1875 msg(
"type lookup cache used {}/{} hits={} misses={}\n",
1880 msg(
"symbol lookup cache used {}/{} hits={} misses={}\n",
1887 int cacheParam = std::max(typeCacheParam,symbolCacheParam);
1890 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 bool isTemplateArgument() const =0
virtual FileDef * getFileDef() const =0
Returns the namespace this compound is in, or 0 if it has a global scope.
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
size_t size() const
Returns the length of the string, not counting the 0-terminator.
DString & prepend(const char *s)
size_t find(char c, size_t pos=0) const
DString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
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 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 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 <.
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)
DString stripTemplateSpecifiersFromScope(const DString &fullName, bool parentOnly, DString *pLastScopeStripped, DString scopeName, bool allowArtificial)
DString argListToString(const ArgumentList &al, bool useCanonicalType, bool showDefVals)
DString mangleCSharpGenericName(const DString &name)
int getScopeFragment(const DString &s, int p, int *l)
A bunch of utility functions.