summaryrefslogtreecommitdiffstats
path: root/src/util.cpp
diff options
context:
space:
mode:
authordimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7>2004-05-17 20:19:03 (GMT)
committerdimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7>2004-05-17 20:19:03 (GMT)
commit6e92a0d3db80c3d93a35efbe52d45c73b8303e45 (patch)
tree5c4df5008d6c8033ded1f60fbb87461e666c8f1c /src/util.cpp
parent53da67394cd52ea7301f306ad766107b38ffd2ae (diff)
downloadDoxygen-6e92a0d3db80c3d93a35efbe52d45c73b8303e45.zip
Doxygen-6e92a0d3db80c3d93a35efbe52d45c73b8303e45.tar.gz
Doxygen-6e92a0d3db80c3d93a35efbe52d45c73b8303e45.tar.bz2
Release-1.3.7-20040517
Diffstat (limited to 'src/util.cpp')
-rw-r--r--src/util.cpp31
1 files changed, 24 insertions, 7 deletions
diff --git a/src/util.cpp b/src/util.cpp
index ca30377..e223da2 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -60,7 +60,16 @@ extern char **environ;
//------------------------------------------------------------------------
-static QCache<ClassDef*> g_lookupCache(20000,20000);
+struct LookupInfo
+{
+ LookupInfo(ClassDef *cd=0,MemberDef *td=0,QCString ts="")
+ : classDef(cd), typeDef(td), templSpec(ts) {}
+ ClassDef *classDef;
+ MemberDef *typeDef;
+ QCString templSpec;
+};
+
+static QCache<LookupInfo> g_lookupCache(20000,20000);
// object that automatically initializes the cache at startup
class CacheInitializer
@@ -448,7 +457,6 @@ int guessSection(const char *name)
return 0;
}
-// TODO: remove this!
QCString resolveTypeDef(Definition *context,const QCString &qualifiedName,
Definition **typedefContext)
{
@@ -639,6 +647,7 @@ ClassDef *newResolveTypedef(FileDef *fileScope,MemberDef *md,QCString *pTemplSpe
}
type=type.stripWhiteSpace(); // strip leading and trailing whitespace
ClassDef *result = getResolvedClassRec(md->getOuterScope(),fileScope,type,0,0);
+ //printf("type=%s result=%p\n",type.data(),result);
if (result==0)
{
// try unspecialized version if type is template
@@ -1025,16 +1034,21 @@ ClassDef *getResolvedClassRec(Definition *scope,
// scope, the name to search for and the explicit scope prefix. The speedup
// achieved by this simple cache can be enormous.
QCString key=scope->name()+"+"+name+"+"+explicitScopePart;
- ClassDef **pval=g_lookupCache.find(key);
+ LookupInfo *pval=g_lookupCache.find(key);
//printf("Searching for %s result=%p\n",key.data(),pval);
if (pval)
{
- return *pval;
+ if (pTemplSpec) *pTemplSpec=pval->templSpec;
+ if (pTypeDef) *pTypeDef=pval->typeDef;
+ //printf("] cachedMatch=%s\n",
+ // pval->classDef?pval->classDef->name().data():"<none>");
+ //if (pTemplSpec) printf("templSpec=%s\n",pTemplSpec->data());
+ return pval->classDef;
}
else // not found yet; we already add a 0 to avoid the possibility of
// endless recursion.
{
- g_lookupCache.insert(key,new ClassDef*(0));
+ g_lookupCache.insert(key,new LookupInfo);
}
ClassDef *bestMatch=0;
@@ -1114,14 +1128,17 @@ ClassDef *getResolvedClassRec(Definition *scope,
pval=g_lookupCache.find(key);
if (pval)
{
- *pval=bestMatch;
+ pval->classDef = bestMatch;
+ pval->typeDef = bestTypedef;
+ pval->templSpec = bestTemplSpec;
}
else
{
- g_lookupCache.insert(key,new ClassDef*(bestMatch));
+ g_lookupCache.insert(key,new LookupInfo(bestMatch,bestTypedef,bestTemplSpec));
}
//printf("] bestMatch=%s distance=%d\n",
// bestMatch?bestMatch->name().data():"<none>",minDistance);
+ //if (pTemplSpec) printf("templSpec=%s\n",pTemplSpec->data());
return bestMatch;
}