16#include <unordered_map>
29#if !ENABLE_SYMBOLRESOLVER_TRACING
33#define AUTO_TRACE(...) (void)0
34#define AUTO_TRACE_ADD(...) (void)0
35#define AUTO_TRACE_EXIT(...) (void)0
42static std::unordered_map<std::string, std::pair<QCString,const MemberDef *> >
g_substMap;
62 void push(
const Definition *scope,
const FileDef *fileScope,
const Definition *item)
66 void push(
const Definition *scope,
const FileDef *fileScope,
const Definition *item,
const QCString &expScope)
68 m_elements.emplace_back(scope,fileScope,item,expScope);
74 bool find(
const Definition *scope,
const FileDef *fileScope,
const Definition *item)
77 [&](
const AccessElem &e) { return e.scope==scope && e.fileScope==fileScope && e.item==item; });
80 bool find(
const Definition *scope,
const FileDef *fileScope,
const Definition *item,
const QCString &expScope)
83 [&](
const AccessElem &e) { return e.scope==scope && e.fileScope==fileScope && e.item==item && e.expScope==expScope; });
125 const Definition *scope,
127 const MemberDef **pTypeDef,
128 QCString *pTemplSpec,
129 QCString *pResolvedType);
133 const Definition *scope,
135 const QCString &args,
138 const MemberDef **pTypeDef,
139 QCString *pTemplSpec,
140 QCString *pResolvedType);
143 AccessStack &accessStack,
144 const Definition *scope,
145 const Definition *item);
150 AccessStack &accessStack,
151 const Definition *scope,
152 const Definition *item,
153 const QCString &explicitScopePart);
157 const Definition *scope,
159 const QCString &explicitScopePart,
160 const ArgumentList *actTemplParams,
162 const ClassDef *&bestMatch,
163 const MemberDef *&bestTypedef,
164 QCString &bestTemplSpec,
165 QCString &bestResolvedType
169 const Definition *scope,
171 const QCString &args,
174 const QCString &explicitScopePart,
177 const Definition *&bestMatch,
178 const MemberDef *&bestTypedef,
179 QCString &bestTemplSpec,
180 QCString &bestResolvedType
185 const Definition *scope,
187 const MemberDef **pMemType,
188 QCString *pTemplSpec,
189 QCString *pResolvedType,
190 const ArgumentList *actTemplParams =
nullptr
194 const Definition *start,
const QCString &path);
196 const Definition *
endOfPathIsUsedClass(
const LinkedRefMap<const Definition> &dl,
const QCString &localName);
200 const LinkedRefMap<NamespaceDef> &nl,
201 const Definition *item,
202 const QCString &explicitScopePart=
"",
205 const LinkedRefMap<const Definition> &dl,
206 const Definition *item,
207 const QCString &explicitScopePart=
""
210 const Definition *scope,
const QCString &name,
211 const MemberDef **pTypeDef=
nullptr);
228 if (n.
isEmpty())
return nullptr;
229 QCString explicitScopePart;
230 QCString strippedTemplateParams;
233 std::unique_ptr<ArgumentList> actTemplParams;
234 if (!strippedTemplateParams.
isEmpty())
241 if (qualifierIndex!=-1)
244 explicitScopePart=name.
left(qualifierIndex);
247 name=name.
mid(qualifierIndex+2);
263 bool hasUsingStatements =
273 size_t scopeNameLen = scope->
name().
length()+1;
274 size_t nameLen = name.
length()+1;
275 size_t explicitPartLen = explicitScopePart.
length();
276 size_t fileScopeLen = hasUsingStatements ? 1+
m_fileScope->absFilePath().length() : 0;
293 if (hasUsingStatements)
303 const ClassDef *bestMatch=
nullptr;
305 if (std::find(visitedKeys.begin(),visitedKeys.end(),key.
str())!=std::end(visitedKeys))
313 visitedKeys.push_back(key.
str());
315 LookupInfo *pval =
nullptr;
323 if (pTemplSpec) *pTemplSpec=pval->
templSpec;
324 if (pTypeDef) *pTypeDef=pval->
typeDef;
326 AUTO_TRACE_EXIT(
"found cached name={} templSpec={} typeDef={} resolvedTypedef={}",
335 const MemberDef *bestTypedef=
nullptr;
336 QCString bestTemplSpec;
337 QCString bestResolvedType;
338 int minDistance=10000;
340 for (Definition *d : range)
342 getResolvedType(visitedKeys,scope,d,explicitScopePart,actTemplParams.get(),
343 minDistance,bestMatch,bestTypedef,bestTemplSpec,bestResolvedType);
344 if (minDistance==0)
break;
349 *pTypeDef = bestTypedef;
353 *pTemplSpec = bestTemplSpec;
357 *pResolvedType = bestResolvedType;
363 LookupInfo(bestMatch,bestTypedef,bestTemplSpec,bestResolvedType));
365 visitedKeys.erase(std::remove(visitedKeys.begin(), visitedKeys.end(), key.
str()), visitedKeys.end());
367 AUTO_TRACE_EXIT(
"found name={} templSpec={} typeDef={} resolvedTypedef={}",
368 bestMatch?bestMatch->
name():QCString(),
370 bestTypedef?bestTypedef->
name():QCString(),
378 const Definition *scope,
380 const QCString &args,
383 const MemberDef **pTypeDef,
384 QCString *pTemplSpec,
385 QCString *pResolvedType)
387 AUTO_TRACE(
"scope={} name={} args={} checkCV={} insideCode={}",
388 scope->
name(),n,args,checkCV,insideCode);
389 if (n.
isEmpty())
return nullptr;
390 QCString explicitScopePart;
391 QCString strippedTemplateParams;
394 std::unique_ptr<ArgumentList> actTemplParams;
395 if (!strippedTemplateParams.
isEmpty())
402 if (qualifierIndex!=-1)
405 explicitScopePart=name.
left(qualifierIndex);
408 name=name.
mid(qualifierIndex+2);
410 AUTO_TRACE_ADD(
"qualifierIndex={} name={} explicitScopePart={}",qualifierIndex,name,explicitScopePart);
423 AUTO_TRACE_ADD(
"no symbols with name '{}' (including unspecialized)",name);
428 bool hasUsingStatements =
429 (m_fileScope && (!m_fileScope->getUsedNamespaces().empty() ||
430 !m_fileScope->getUsedDefinitions().empty())
439 size_t nameLen = name.
length()+1;
440 size_t explicitPartLen = explicitScopePart.
length();
441 size_t fileScopeLen = hasUsingStatements ? 1+m_fileScope->absFilePath().length() : 0;
442 size_t argsLen = args.
length()+1;
447 key.reserve(scopeNameLen+nameLen+explicitPartLen+fileScopeLen+argsLen);
455 key+=explicitScopePart.
str();
461 if (hasUsingStatements)
466 key+=m_fileScope->absFilePath().str();
474 const Definition *bestMatch=
nullptr;
476 if (std::find(visitedKeys.begin(),visitedKeys.end(),key)!=std::end(visitedKeys))
483 visitedKeys.push_back(key);
484 LookupInfo *pval =
nullptr;
492 if (pTemplSpec) *pTemplSpec=pval->
templSpec;
493 if (pTypeDef) *pTypeDef=pval->
typeDef;
495 AUTO_TRACE_EXIT(
"found cached name={} templSpec={} typeDef={} resolvedTypedef={}",
503 const MemberDef *bestTypedef=
nullptr;
504 QCString bestTemplSpec;
505 QCString bestResolvedType;
506 int minDistance=10000;
508 for (Definition *d : range)
510 getResolvedSymbol(visitedKeys,scope,d,args,checkCV,insideCode,explicitScopePart,
false,
511 minDistance,bestMatch,bestTypedef,bestTemplSpec,bestResolvedType);
512 if (minDistance==0)
break;
517 if (bestMatch==
nullptr && args==
"()")
519 for (Definition *d : range)
521 getResolvedSymbol(visitedKeys,scope,d,QCString(),
false,insideCode,explicitScopePart,
true,
522 minDistance,bestMatch,bestTypedef,bestTemplSpec,bestResolvedType);
523 if (minDistance==0)
break;
529 *pTypeDef = bestTypedef;
533 *pTemplSpec = bestTemplSpec;
537 *pResolvedType = bestResolvedType;
541 LookupInfo lookupInfo(bestMatch,bestTypedef,bestTemplSpec,bestResolvedType);
546 visitedKeys.erase(std::remove(visitedKeys.begin(),visitedKeys.end(),key),visitedKeys.end());
548 AUTO_TRACE_EXIT(
"found name={} templSpec={} typeDef={} resolvedTypedef={}",
549 bestMatch?bestMatch->
name():QCString(),
551 bestTypedef?bestTypedef->
name():QCString(),
559 const Definition *scope,
561 const QCString &explicitScopePart,
562 const ArgumentList *actTemplParams,
564 const ClassDef *&bestMatch,
565 const MemberDef *&bestTypedef,
566 QCString &bestTemplSpec,
567 QCString &bestResolvedType
580 AccessStack accessStack;
583 accessStack,scope,d,explicitScopePart);
598 if (distance<minDistance)
600 AUTO_TRACE_ADD(
"found symbol={} at distance={} minDistance={}",cd->
name(),distance,minDistance);
601 minDistance=distance;
603 bestTypedef =
nullptr;
604 bestTemplSpec.
clear();
607 else if (distance==minDistance &&
608 m_fileScope && bestMatch &&
609 !m_fileScope->getUsedNamespaces().empty() &&
622 AUTO_TRACE_ADD(
"found symbol={} at distance={} minDistance={}",cd->
name(),distance,minDistance);
623 minDistance=distance;
625 bestTypedef =
nullptr;
626 bestTemplSpec.
clear();
648 if (distance<minDistance)
652 minDistance=distance;
653 const MemberDef *enumType =
nullptr;
654 const ClassDef *cd = newResolveTypedef(visitedKeys,scope,md,&enumType,&spec,&type,actTemplParams);
657 AUTO_TRACE_ADD(
"found symbol={} at distance={} minDistance={}",cd->
name(),distance,minDistance);
660 bestTemplSpec = spec;
661 bestResolvedType = type;
667 bestTypedef = enumType;
676 bestTemplSpec = spec;
677 bestResolvedType = type;
684 bestTemplSpec.
clear();
685 bestResolvedType.
clear();
700 if (distance<minDistance)
702 AUTO_TRACE_ADD(
"found enum={} at distance={} minDistance={}",md->
name(),distance,minDistance);
703 minDistance=distance;
718 bestMatch?bestMatch->
name():QCString(
"<none>"),bestResolvedType);
724 const Definition *scope,
726 const QCString &args,
729 const QCString &explicitScopePart,
732 const Definition *&bestMatch,
733 const MemberDef *&bestTypedef,
734 QCString &bestTemplSpec,
735 QCString &bestResolvedType
741 AccessStack accessStack;
756 if (distance<minDistance)
758 AUTO_TRACE_ADD(
"found symbol={} at distance={} minDistance={}",d->
name(),distance,minDistance);
759 minDistance=distance;
761 bestTypedef =
nullptr;
762 bestTemplSpec.
clear();
765 else if (distance==minDistance &&
766 m_fileScope && bestMatch &&
767 !m_fileScope->getUsedNamespaces().empty() &&
780 AUTO_TRACE_ADD(
"found symbol={} at distance={} minDistance={}",d->
name(),distance,minDistance);
781 minDistance=distance;
783 bestTypedef =
nullptr;
784 bestTemplSpec.
clear();
820 if (match && distance<minDistance)
822 AUTO_TRACE_ADD(
"found symbol={} at distance={} minDistance={}",md->
name(),distance,minDistance);
823 minDistance=distance;
833 if (distance<minDistance)
835 AUTO_TRACE_ADD(
"found symbol={} at distance={} minDistance={}",d->
name(),distance,minDistance);
836 minDistance=distance;
838 bestTypedef =
nullptr;
839 bestTemplSpec.
clear();
840 bestResolvedType.
clear();
849 bestMatch?bestMatch->
name():QCString(
"<none>"),bestResolvedType);
857 const MemberDef **pMemType,
858 QCString *pTemplSpec,
859 QCString *pResolvedType,
860 const ArgumentList *actTemplParams)
878 if (m_resolvedTypedefs.find(qname.
str())!=m_resolvedTypedefs.end())
884 auto typedef_it = m_resolvedTypedefs.emplace(qname.
str(),md).first;
889 actTemplParams && !actTemplParams->
empty())
894 QCString typedefValue = type;
895 int tl=
static_cast<int>(type.
length());
897 while (ip>=0 && (type.
at(ip)==
'*' || type.
at(ip)==
'&' || type.
at(ip)==
' '))
901 type=type.
left(ip+1);
907 tl=
static_cast<int>(type.
length());
908 while (sp<tl && type.
at(sp)==
' ') sp++;
909 const MemberDef *memTypeDef =
nullptr;
910 const ClassDef *result = getResolvedTypeRec(visitedKeys,md->
getOuterScope(),type,
911 &memTypeDef,
nullptr,pResolvedType);
913 if (memTypeDef && memTypeDef->
isTypedef())
916 result=newResolveTypedef(visitedKeys,m_fileScope,memTypeDef,pMemType,pTemplSpec,
nullptr);
919 else if (memTypeDef && memTypeDef->
isEnumerate() && pMemType)
921 *pMemType = memTypeDef;
928 int i=type.
find(
'<');
931 if (pTemplSpec) *pTemplSpec = type.
mid(i);
932 result = getResolvedTypeRec(visitedKeys,md->
getOuterScope(),type.
left(i),
nullptr,
nullptr,pResolvedType);
939 i=
static_cast<int>(type.
length());
943 if (pTemplSpec) *pTemplSpec = type.
mid(i);
956 if (sp>0) pResolvedType->
prepend(typedefValue.
left(sp));
957 if (ip<tl-1) pResolvedType->
append(typedefValue.
right(tl-ip-1));
961 *pResolvedType = typedefValue;
975 pTemplSpec ? *pTemplSpec : QCString(),
976 pResolvedType ? *pResolvedType : QCString()
981 m_resolvedTypedefs.erase(typedef_it);
984 result ? result->
name() : QCString(),
985 pTemplSpec ? *pTemplSpec :
"<nullptr>",
986 pResolvedType ? *pResolvedType :
"<nullptr>"
992static bool isParentScope(
const Definition *
parent,
const Definition *item)
996 return isParentScope(
parent->getOuterScope(),item);
1003 AccessStack &accessStack,
1004 const Definition *scope,
1005 const Definition *item,
1006 const QCString &explicitScopePart)
1009 AUTO_TRACE(
"scope={} item={} explictScopePart={}",
1010 scope?scope->
name():QCString(), item?item->
name():QCString(), explicitScopePart);
1011 if (explicitScopePart.
isEmpty())
1019 if (accessStack.
find(scope,m_fileScope,item,explicitScopePart))
1024 accessStack.
push(scope,m_fileScope,item,explicitScopePart);
1026 const Definition *newScope = followPath(visitedKeys,scope,explicitScopePart);
1033 bool nestedClassInsideBaseClass =
1039 bool enumValueWithinEnum =
1044 if (itemScope==newScope)
1048 else if (nestedClassInsideBaseClass)
1061 else if (enumValueWithinEnum)
1071 visitedNamespaces.emplace(newScope->
name().
str(),newScope);
1087 if (visitedNamespaces.find(nd->name().str())==visitedNamespaces.end())
1113 result = (i==-1) ? -1 : i+2;
1123 if (accessibleViaUsingNamespace(visitedKeys,locVisitedNamespaceKeys,nscope->
getUsedNamespaces(),item,explicitScopePart))
1134 if (accessibleViaUsingNamespace(visitedKeys,locVisitedNamespaceKeys,m_fileScope->getUsedNamespaces(),item,explicitScopePart))
1146 result= (i==-1) ? -1 : i+2;
1157 const Definition *start,
const QCString &path)
1159 AUTO_TRACE(
"start={},path={}",start?start->
name():QCString(), path);
1162 const Definition *current=start;
1167 const MemberDef *memTypeDef=
nullptr;
1168 QCString qualScopePart = substTypedef(visitedKeys,current,path.
mid(is,l),&memTypeDef);
1172 const ClassDef *type = newResolveTypedef(visitedKeys,m_fileScope,memTypeDef,
nullptr,
nullptr,
nullptr);
1181 qualScopePart, current->
name(), next?next->
name():QCString());
1197 if (namespaceMember && namespaceMember->
isEnumerate())
1199 next = namespaceMember;
1205 for (Definition *def : range)
1207 const Definition *outerScope = def->getOuterScope();
1230 next = endOfPathIsUsedClass(
1235 next = endOfPathIsUsedClass(
1236 (
toFileDef(current))->getUsedDefinitions(),qualScopePart);
1239 if (current==
nullptr)
break;
1255 for (
const auto &d : dl)
1257 if (d->localName()==localName)
1268 const LinkedRefMap<NamespaceDef> &nl,
1269 const Definition *item,
1270 const QCString &explicitScopePart,
1273 AUTO_TRACE(
"item={} explicitScopePart={} level={}",item?item->
name():QCString(), explicitScopePart, level);
1274 for (
const auto &und : nl)
1277 const Definition *sc = explicitScopePart.
isEmpty() ? und : followPath(visitedKeys,und,explicitScopePart);
1285 QCString key=und->qualifiedName();
1286 if (!und->getUsedNamespaces().empty() && std::find(visitedNamespaces.begin(),visitedNamespaces.end(),key.
str())==std::end(visitedNamespaces))
1288 visitedNamespaces.push_back(key.
str());
1289 if (accessibleViaUsingNamespace(visitedKeys,visitedNamespaces,und->getUsedNamespaces(),item,explicitScopePart,level+1))
1304 const LinkedRefMap<const Definition> &dl,
1305 const Definition *item,
1306 const QCString &explicitScopePart)
1308 AUTO_TRACE(
"item={} explicitScopePart={}",item?item->
name():QCString(), explicitScopePart);
1309 for (
const auto &ud : dl)
1312 const Definition *sc = explicitScopePart.
isEmpty() ? ud : followPath(visitedKeys,ud,explicitScopePart);
1324 AccessStack &accessStack,
1325 const Definition *scope,
1326 const Definition *item)
1329 scope?scope->
name():QCString(), item?item->
name():QCString());
1331 if (accessStack.
find(scope,m_fileScope,item))
1336 accessStack.
push(scope,m_fileScope,item);
1348 if ((itemIsMember || itemIsClass) &&
1350 (itemScope && itemScope->
name().
startsWith(
"anonymous_namespace{"))
1358 else if (itemIsClass)
1365 bool memberAccessibleFromScope =
1371 bool nestedClassInsideBaseClass =
1377 bool enumValueOfStrongEnum =
1385 if (itemScope==scope || memberAccessibleFromScope || nestedClassInsideBaseClass || enumValueOfStrongEnum)
1387 AUTO_TRACE_ADD(
"memberAccessibleFromScope={} nestedClassInsideBaseClass={} enumValueOfStrongEnum={}",
1388 memberAccessibleFromScope, nestedClassInsideBaseClass, enumValueOfStrongEnum);
1389 int distanceToBase=0;
1390 if (nestedClassInsideBaseClass)
1396 else if (memberAccessibleFromScope &&
1403 result+=distanceToBase;
1420 if (accessibleViaUsingDefinition(visitedKeys,m_fileScope->getUsedDefinitions(),item))
1426 if (accessibleViaUsingNamespace(visitedKeys,visitedNamespaceKeys,m_fileScope->getUsedNamespaces(),item))
1447 if (accessibleViaUsingNamespace(visitedKeys,visitedNamespaceKeys,nscope->
getUsedNamespaces(),item,QCString()))
1455 const FileDef *nfile =
toFileDef(scope);
1462 if (accessibleViaUsingNamespace(visitedKeys,visitedNamespaceKeys,nfile->
getUsedNamespaces(),item,QCString()))
1482 result= (i==-1) ? -1 : i+2;
1492 const Definition *scope,
const QCString &name,
1493 const MemberDef **pTypeDef)
1495 AUTO_TRACE(
"scope={} name={}",scope?scope->
name():QCString(), name);
1496 QCString result=name;
1497 if (name.
isEmpty())
return result;
1503 MemberDef *bestMatch=
nullptr;
1504 int minDistance=10000;
1507 const int maxAddrSize = 20;
1508 char ptr_str[maxAddrSize];
1509 int num =
qsnprintf(ptr_str,maxAddrSize,
"%p:",(
void *)scope);
1511 key.reserve(num+name.
length()+1);
1519 if (pTypeDef) *pTypeDef = it->second.second;
1520 return it->second.first;
1524 for (Definition *d : range)
1534 AccessStack accessStack;
1537 if (distance!=-1 && distance<minDistance)
1540 minDistance=distance;
1550 if (pTypeDef) *pTypeDef=bestMatch;
1557 g_substMap.emplace(key,std::make_pair(result,bestMatch));
1568 :
p(std::make_unique<
Private>(fileScope))
1579 bool mayBeUnlinkable,
1582 AUTO_TRACE(
"scope={} name={} mayBeUnlinkable={} mayBeHidden={}",
1583 scope?scope->
name():QCString(), name, mayBeUnlinkable, mayBeHidden);
1586 if (scope==
nullptr ||
1596 const ClassDef *result=
nullptr;
1604 result =
p->getResolvedTypeRec(visitedKeys,scope,name,&
p->typeDef,&
p->templateSpec,&
p->resolvedType);
1605 if (result==
nullptr)
1612 if (!mayBeUnlinkable && result && !result->
isLinkable())
1614 if (!mayBeHidden || !result->
isHidden())
1630 AUTO_TRACE(
"scope={} name={} args={} checkCV={} insideCode={}",
1631 scope?scope->
name():QCString(), name, args, checkCV, insideCode);
1635 const Definition *result =
p->getResolvedSymbolRec(visitedKeys,scope,name,args,checkCV,insideCode,&
p->typeDef,&
p->templateSpec,&
p->resolvedType);
1644 scope?scope->
name():QCString(), item?item->
name():QCString());
1647 AccessStack accessStack;
1648 int result =
p->isAccessibleFrom(visitedKeys,accessStack,scope,item);
1656 AUTO_TRACE(
"scope={} item={} explicitScopePart={}",
1657 scope?scope->
name():QCString(), item?item->
name():QCString(), explicitScopePart);
1661 AccessStack accessStack;
1662 int result =
p->isAccessibleFromWithExpScope(visitedKeys,visitedNamespaces,accessStack,scope,item,explicitScopePart);
1669 p->setFileScope(fileScope);
1679 return p->templateSpec;
1684 return p->resolvedType;
Helper class representing the stack of items considered while resolving the scope.
bool find(const Definition *scope, const FileDef *fileScope, const Definition *item, const QCString &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)
void push(const Definition *scope, const FileDef *fileScope, const Definition *item, const QCString &expScope)
V * insert(const K &key, V &&value)
Inserts value under key in the cache.
V * find(const K &key)
Finds a value in the cache given the corresponding key.
A abstract class representing of a compound symbol.
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 const MemberDef * getMemberByName(const QCString &) const =0
Returns the member with the given name.
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.
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 QCString getDefFileName() const =0
virtual bool isLinkable() const =0
virtual DefType definitionType() const =0
virtual bool isHidden() const =0
virtual const Definition * findInnerCompound(const QCString &name) const =0
virtual QCString qualifiedName() const =0
virtual bool isArtificial() const =0
virtual Definition * getOuterScope() const =0
virtual bool isReference() const =0
virtual const QCString & name() const =0
static Cache< std::string, LookupInfo > * typeLookupCache
static NamespaceDefMutable * globalScope
static Cache< std::string, LookupInfo > * symbolLookupCache
static SymbolMap< Definition > * symbolMap
A model of a file symbol.
virtual const LinkedRefMap< NamespaceDef > & getUsedNamespaces() const =0
virtual const LinkedRefMap< const Definition > & getUsedDefinitions() const =0
A model of a class/file/namespace member symbol.
virtual QCString typeString() const =0
virtual QCString getCachedResolvedTypedef() const =0
virtual const ClassDef * getCachedTypedefVal() const =0
virtual const ClassDef * getClassDef() 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 QCString getCachedTypedefTemplSpec() const =0
virtual bool isTypedefValCached() const =0
virtual std::optional< ArgumentList > formalTemplateArguments() const =0
virtual bool isEnumerate() const =0
virtual QCString argsString() 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 QCString &templSpec, const QCString &resolvedType)=0
virtual const LinkedRefMap< NamespaceDef > & getUsedNamespaces() const =0
virtual const MemberDef * getMemberByName(const QCString &) const =0
virtual const LinkedRefMap< const Definition > & getUsedDefinitions() const =0
This is an alternative implementation of QCString.
int find(char c, int index=0, bool cs=TRUE) const
QCString & prepend(const char *s)
size_t length() const
Returns the length of the string, not counting the 0-terminator.
bool startsWith(const char *s) const
QCString mid(size_t index, size_t len=static_cast< size_t >(-1)) const
char & at(size_t i)
Returns a reference to the character at index i.
char * rawData()
Returns a writable pointer to the data.
bool isEmpty() const
Returns TRUE iff the string is empty.
QCString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
const std::string & str() const
QCString & append(char c)
QCString right(size_t len) const
size_t size() const
Returns the length of the string, not counting the 0-terminator.
int findRev(char c, int index=-1, bool cs=TRUE) const
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
QCString left(size_t len) const
bool stripPrefix(const QCString &prefix)
const VectorPtr & find(const QCString &name)
Find the list of symbols stored under key name Returns a pair of iterators pointing to the start and ...
const Definition * resolveSymbol(const Definition *scope, const QCString &name, const QCString &args=QCString(), bool checkCV=false, bool insideCode=false)
Find the symbool definition matching name within the scope set.
int isAccessibleFrom(const Definition *scope, const Definition *item)
Checks if symbol item is accessible from within scope.
int isAccessibleFromWithExpScope(const Definition *scope, const Definition *item, const QCString &explicitScopePart)
Check if symbol item is accessible from within scope, where it has to match the explicitScopePart.
QCString getResolvedType() const
In case a call to resolveClass() points to a typedef or using declaration.
std::unique_ptr< Private > p
const ClassDef * resolveClass(const Definition *scope, const QCString &name, bool maybeUnlinkable=false, bool mayBeHidden=false)
Find the class definition matching name within the scope set.
SymbolResolver(const FileDef *fileScope=nullptr)
QCString 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.
ClassDef * getClass(const QCString &n)
ClassDef * toClassDef(Definition *d)
#define Config_getBool(name)
std::vector< std::string > StringVector
std::unique_ptr< ArgumentList > stringToArgumentList(SrcLangExt lang, const QCString &argsString, QCString *extraTypeChars=nullptr)
#define AUTO_TRACE_ADD(...)
#define AUTO_TRACE_EXIT(...)
constexpr DocNodeVariant * parent(DocNodeVariant *n)
returns the parent node of a given node n or nullptr if the node has no parent.
FileDef * toFileDef(Definition *d)
MemberDefMutable * toMemberDefMutable(Definition *d)
MemberDef * toMemberDef(Definition *d)
void replaceNamespaceAliases(QCString &name)
NamespaceDef * toNamespaceDef(Definition *d)
const char * qPrint(const char *s)
char * qstrcpy(char *dst, const char *src)
const FileDef * fileScope
AccessElem(const Definition *d, const FileDef *f, const Definition *i)
AccessElem(const Definition *d, const FileDef *f, const Definition *i, const QCString &e)
const Definition * definition
const MemberDef * typeDef
int isAccessibleFromWithExpScope(VisitedKeys &visitedKeys, VisitedNamespaces &visitedNamespaces, AccessStack &accessStack, const Definition *scope, const Definition *item, const QCString &explicitScopePart)
const MemberDef * typeDef
const FileDef * m_fileScope
const ClassDef * getResolvedTypeRec(VisitedKeys &visitedKeys, const Definition *scope, const QCString &n, const MemberDef **pTypeDef, QCString *pTemplSpec, QCString *pResolvedType)
bool accessibleViaUsingDefinition(VisitedKeys &visitedKeys, const LinkedRefMap< const Definition > &dl, const Definition *item, const QCString &explicitScopePart="")
bool accessibleViaUsingNamespace(VisitedKeys &visitedKeys, VisitedNamespaceKeys &visitedNamespaces, const LinkedRefMap< NamespaceDef > &nl, const Definition *item, const QCString &explicitScopePart="", int level=0)
const ClassDef * newResolveTypedef(VisitedKeys &visitedKeys, const Definition *scope, const MemberDef *md, const MemberDef **pMemType, QCString *pTemplSpec, QCString *pResolvedType, const ArgumentList *actTemplParams=nullptr)
int isAccessibleFrom(VisitedKeys &visitedKeys, AccessStack &accessStack, const Definition *scope, const Definition *item)
Private(const FileDef *f)
const Definition * endOfPathIsUsedClass(const LinkedRefMap< const Definition > &dl, const QCString &localName)
QCString substTypedef(VisitedKeys &visitedKeys, const Definition *scope, const QCString &name, const MemberDef **pTypeDef=nullptr)
void setFileScope(const FileDef *fileScope)
void getResolvedSymbol(VisitedKeys &visitedKeys, const Definition *scope, const Definition *d, const QCString &args, bool checkCV, bool insideCode, const QCString &explicitScopePart, bool forceCallable, int &minDistance, const Definition *&bestMatch, const MemberDef *&bestTypedef, QCString &bestTemplSpec, QCString &bestResolvedType)
const Definition * followPath(VisitedKeys &visitedKeys, const Definition *start, const QCString &path)
const Definition * getResolvedSymbolRec(VisitedKeys &visitedKeys, const Definition *scope, const QCString &n, const QCString &args, bool checkCV, bool insideCode, const MemberDef **pTypeDef, QCString *pTemplSpec, QCString *pResolvedType)
std::unordered_map< std::string, const MemberDef * > m_resolvedTypedefs
void getResolvedType(VisitedKeys &visitedKeys, const Definition *scope, const Definition *d, const QCString &explicitScopePart, const ArgumentList *actTemplParams, int &minDistance, const ClassDef *&bestMatch, const MemberDef *&bestTypedef, QCString &bestTemplSpec, QCString &bestResolvedType)
StringVector VisitedNamespaceKeys
static std::recursive_mutex g_cacheTypedefMutex
std::unordered_map< std::string, const Definition * > VisitedNamespaces
static std::mutex g_substMapMutex
static std::unordered_map< std::string, std::pair< QCString, const MemberDef * > > g_substMap
static std::mutex g_cacheMutex
QCString substituteTemplateArgumentsInString(const QCString &nm, const ArgumentList &formalArgs, const ArgumentList *actualArgs)
bool matchArguments2(const Definition *srcScope, const FileDef *srcFileScope, const ArgumentList *srcAl, const Definition *dstScope, const FileDef *dstFileScope, const ArgumentList *dstAl, bool checkCV, SrcLangExt lang)
int computeQualifiedIndex(const QCString &name)
Return the index of the last :: in the string name that is still before the first <.
QCString argListToString(const ArgumentList &al, bool useCanonicalType, bool showDefVals)
QCString stripTemplateSpecifiersFromScope(const QCString &fullName, bool parentOnly, QCString *pLastScopeStripped, QCString scopeName, bool allowArtificial)
int getScopeFragment(const QCString &s, int p, int *l)
A bunch of utility functions.