Skip to content

Commit 53fcef6

Browse files
committed
issue #6382: computational time issue of Java generics
- Java doesn't have typedefs, so doxygen should not try to resolve them.
1 parent 2664015 commit 53fcef6

File tree

6 files changed

+43
-46
lines changed

6 files changed

+43
-46
lines changed

src/classdef.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3472,7 +3472,7 @@ void ClassDefImpl::mergeMembers()
34723472
found=matchArguments2(
34733473
srcMd->getOuterScope(),srcMd->getFileDef(),&srcAl,
34743474
dstMd->getOuterScope(),dstMd->getFileDef(),&dstAl,
3475-
TRUE
3475+
TRUE,getLanguage()
34763476
);
34773477
//printf(" Yes, matching (%s<->%s): %d\n",
34783478
// qPrint(argListToString(srcMd->argumentList())),

src/doxygen.cpp

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3649,7 +3649,7 @@ static void buildFunctionList(const Entry *root)
36493649
if (
36503650
matchArguments2(md->getOuterScope(),mfd,&mdAl,
36513651
rnd ? rnd : Doxygen::globalScope,rfd,&root->argList,
3652-
FALSE) &&
3652+
FALSE,root->lang) &&
36533653
sameNumTemplateArgs &&
36543654
matchingReturnTypes &&
36553655
sameRequiresClause &&
@@ -3816,7 +3816,7 @@ static void findFriends()
38163816
(mmd->isFriend() || (mmd->isRelated() && mmd->isFunction())) &&
38173817
matchArguments2(mmd->getOuterScope(), mmd->getFileDef(), &mmd->argumentList(),
38183818
fmd->getOuterScope(), fmd->getFileDef(), &fmd->argumentList(),
3819-
TRUE
3819+
TRUE,mmd->getLanguage()
38203820
)
38213821

38223822
) // if the member is related and the arguments match then the
@@ -3946,7 +3946,7 @@ static void transferFunctionReferences()
39463946
if (
39473947
matchArguments2(mdef->getOuterScope(),mdef->getFileDef(),const_cast<ArgumentList*>(&mdefAl),
39483948
mdec->getOuterScope(),mdec->getFileDef(),const_cast<ArgumentList*>(&mdecAl),
3949-
TRUE
3949+
TRUE,mdef->getLanguage()
39503950
)
39513951
) /* match found */
39523952
{
@@ -3988,7 +3988,7 @@ static void transferRelatedFunctionDocumentation()
39883988
(rmd->isRelated() || rmd->isForeign()) && // related function
39893989
matchArguments2( md->getOuterScope(), md->getFileDef(), &md->argumentList(),
39903990
rmd->getOuterScope(),rmd->getFileDef(),&rmd->argumentList(),
3991-
TRUE
3991+
TRUE,md->getLanguage()
39923992
)
39933993
)
39943994
{
@@ -4096,7 +4096,7 @@ static void findUsedClassesForClass(const Entry *root,
40964096
{
40974097
//printf(" Found variable %s in class %s\n",qPrint(md->name()),qPrint(masterCd->name()));
40984098
QCString type = normalizeNonTemplateArgumentsInString(md->typeString(),masterCd,formalArgs);
4099-
QCString typedefValue = resolveTypeDef(masterCd,type);
4099+
QCString typedefValue = md->getLanguage()==SrcLangExt_Java ? type : resolveTypeDef(masterCd,type);
41004100
if (!typedefValue.isEmpty())
41014101
{
41024102
type = typedefValue;
@@ -4640,9 +4640,6 @@ static bool findClassRelation(
46404640
}
46414641
}
46424642
bool isATemplateArgument = templateNames.find(biName.str())!=templateNames.end();
4643-
// make templSpec canonical
4644-
// warning: the following line doesn't work for Mixin classes (see bug 560623)
4645-
// templSpec = getCanonicalTemplateSpec(cd, cd->getFileDef(), templSpec);
46464643

46474644
//printf("4. found=%d\n",found);
46484645
if (found)
@@ -5180,7 +5177,7 @@ static void addMemberDocs(const Entry *root,
51805177
if (
51815178
matchArguments2( md->getOuterScope(), md->getFileDef(),const_cast<ArgumentList*>(&mdAl),
51825179
rscope,rfd,&root->argList,
5183-
TRUE
5180+
TRUE, root->lang
51845181
)
51855182
)
51865183
{
@@ -5411,7 +5408,7 @@ static bool findGlobalMember(const Entry *root,
54115408
md->isVariable() || md->isTypedef() || /* in case of function pointers */
54125409
matchArguments2(md->getOuterScope(),const_cast<const MemberDef *>(md.get())->getFileDef(),&mdAl,
54135410
rnd ? rnd : Doxygen::globalScope,fd,&root->argList,
5414-
FALSE);
5411+
FALSE,root->lang);
54155412

54165413
// for template members we need to check if the number of
54175414
// template arguments is the same, otherwise we are dealing with
@@ -5841,7 +5838,7 @@ static void addMemberFunction(const Entry *root,
58415838
matchArguments2(
58425839
md->getClassDef(),md->getFileDef(),&argList,
58435840
cd,fd,&root->argList,
5844-
TRUE);
5841+
TRUE,root->lang);
58455842

58465843
if (md->getLanguage()==SrcLangExt_ObjC && md->isVariable() && (root->section&Entry::FUNCTION_SEC))
58475844
{
@@ -6622,7 +6619,7 @@ static void findMember(const Entry *root,
66226619
className!=rmd->getOuterScope()->name() ||
66236620
!matchArguments2(rmd->getOuterScope(),rmd->getFileDef(),&rmdAl,
66246621
cd,fd,&root->argList,
6625-
TRUE);
6622+
TRUE,root->lang);
66266623
if (!newMember)
66276624
{
66286625
rmd_found = rmd;
@@ -6721,7 +6718,7 @@ static void findMember(const Entry *root,
67216718
if (
67226719
matchArguments2(rmd->getOuterScope(),rmd->getFileDef(),&rmdAl,
67236720
cd,fd,&root->argList,
6724-
TRUE)
6721+
TRUE,root->lang)
67256722
)
67266723
{
67276724
found=TRUE;
@@ -7874,7 +7871,7 @@ static void computeMemberRelations()
78747871
bmd->getLanguage()==SrcLangExt_Python ||
78757872
matchArguments2(bmd->getOuterScope(),bmd->getFileDef(),&bmdAl,
78767873
md->getOuterScope(), md->getFileDef(), &mdAl,
7877-
TRUE
7874+
TRUE,bmd->getLanguage()
78787875
)
78797876
)
78807877
{

src/groupdef.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ bool GroupDefImpl::insertMember(const MemberDef *md,bool docOnly)
344344
(tSrcMdAl.size()==tMdAl.size()) && // same number of template arguments
345345
matchArguments2(srcMd->getOuterScope(),srcMd->getFileDef(),&srcMdAl,
346346
md->getOuterScope(),md->getFileDef(),&mdAl,
347-
TRUE
347+
TRUE,srcMd->getLanguage()
348348
) && // matching parameters
349349
sameScope // both are found in the same scope
350350
)

src/memberdef.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5843,7 +5843,7 @@ void combineDeclarationAndDefinition(MemberDefMutable *mdec,MemberDefMutable *md
58435843
if (sameNumTemplateArgs &&
58445844
matchArguments2(mdef->getOuterScope(),mdef->getFileDef(),&mdefAl,
58455845
mdec->getOuterScope(),mdec->getFileDef(),&mdecAl,
5846-
TRUE
5846+
TRUE,mdef->getLanguage()
58475847
)
58485848
) /* match found */
58495849
{

src/util.cpp

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1589,19 +1589,19 @@ static QCString stripDeclKeywords(const QCString &s)
15891589
}
15901590

15911591
// forward decl for circular dependencies
1592-
static QCString extractCanonicalType(const Definition *d,const FileDef *fs,QCString type);
1592+
static QCString extractCanonicalType(const Definition *d,const FileDef *fs,QCString type,SrcLangExt lang);
15931593

1594-
QCString getCanonicalTemplateSpec(const Definition *d,const FileDef *fs,const QCString& spec)
1594+
static QCString getCanonicalTemplateSpec(const Definition *d,const FileDef *fs,const QCString& spec,SrcLangExt lang)
15951595
{
15961596

15971597
QCString templSpec = spec.stripWhiteSpace();
15981598
// this part had been commented out before... but it is needed to match for instance
15991599
// std::list<std::string> against list<string> so it is now back again!
16001600
if (!templSpec.isEmpty() && templSpec.at(0) == '<')
16011601
{
1602-
templSpec = "< " + extractCanonicalType(d,fs,templSpec.right(templSpec.length()-1).stripWhiteSpace());
1602+
templSpec = "< " + extractCanonicalType(d,fs,templSpec.right(templSpec.length()-1).stripWhiteSpace(),lang);
16031603
}
1604-
QCString resolvedType = resolveTypeDef(d,templSpec);
1604+
QCString resolvedType = lang==SrcLangExt_Java ? templSpec : resolveTypeDef(d,templSpec);
16051605
if (!resolvedType.isEmpty()) // not known as a typedef either
16061606
{
16071607
templSpec = resolvedType;
@@ -1612,14 +1612,14 @@ QCString getCanonicalTemplateSpec(const Definition *d,const FileDef *fs,const QC
16121612

16131613

16141614
static QCString getCanonicalTypeForIdentifier(
1615-
const Definition *d,const FileDef *fs,const QCString &word,
1615+
const Definition *d,const FileDef *fs,const QCString &word,SrcLangExt lang,
16161616
QCString *tSpec,int count=0)
16171617
{
16181618
if (count>10) return word; // oops recursion
16191619

16201620
QCString symName,result,templSpec,tmpName;
16211621
if (tSpec && !tSpec->isEmpty())
1622-
templSpec = stripDeclKeywords(getCanonicalTemplateSpec(d,fs,*tSpec));
1622+
templSpec = stripDeclKeywords(getCanonicalTemplateSpec(d,fs,*tSpec,lang));
16231623

16241624
if (word.findRev("::")!=-1 && !(tmpName=stripScope(word)).isEmpty())
16251625
{
@@ -1691,7 +1691,7 @@ static QCString getCanonicalTypeForIdentifier(
16911691
else if (!ts.isEmpty() && templSpec.isEmpty())
16921692
{
16931693
// use formal template args for spec
1694-
templSpec = stripDeclKeywords(getCanonicalTemplateSpec(d,fs,ts));
1694+
templSpec = stripDeclKeywords(getCanonicalTemplateSpec(d,fs,ts,lang));
16951695
}
16961696

16971697
result = removeRedundantWhiteSpace(cd->qualifiedName() + templSpec);
@@ -1734,7 +1734,7 @@ static QCString getCanonicalTypeForIdentifier(
17341734
type.stripPrefix("typename ");
17351735
type = stripTemplateSpecifiersFromScope(type,FALSE);
17361736
}
1737-
result = getCanonicalTypeForIdentifier(d,fs,type,tSpec,count+1);
1737+
result = getCanonicalTypeForIdentifier(d,fs,type,mType->getLanguage(),tSpec,count+1);
17381738
}
17391739
else
17401740
{
@@ -1743,7 +1743,7 @@ static QCString getCanonicalTypeForIdentifier(
17431743
}
17441744
else // fallback
17451745
{
1746-
resolvedType = resolveTypeDef(d,word);
1746+
resolvedType = lang==SrcLangExt_Java ? word : resolveTypeDef(d,word);
17471747
//printf("typedef [%s]->[%s]\n",qPrint(word),qPrint(resolvedType));
17481748
if (resolvedType.isEmpty()) // not known as a typedef either
17491749
{
@@ -1758,7 +1758,7 @@ static QCString getCanonicalTypeForIdentifier(
17581758
return result;
17591759
}
17601760

1761-
static QCString extractCanonicalType(const Definition *d,const FileDef *fs,QCString type)
1761+
static QCString extractCanonicalType(const Definition *d,const FileDef *fs,QCString type,SrcLangExt lang)
17621762
{
17631763
type = type.stripWhiteSpace();
17641764

@@ -1785,7 +1785,7 @@ static QCString extractCanonicalType(const Definition *d,const FileDef *fs,QCStr
17851785
//printf(" i=%d p=%d\n",i,p);
17861786
if (i>pp) canType += type.mid(pp,i-pp);
17871787

1788-
QCString ct = getCanonicalTypeForIdentifier(d,fs,word,&templSpec);
1788+
QCString ct = getCanonicalTypeForIdentifier(d,fs,word,lang,&templSpec);
17891789

17901790
// in case the ct is empty it means that "word" represents scope "d"
17911791
// and this does not need to be added to the canonical
@@ -1819,7 +1819,7 @@ static QCString extractCanonicalType(const Definition *d,const FileDef *fs,QCStr
18191819
size_t tl = match.length();
18201820
std::string matchStr = match.str();
18211821
canType += ts.substr(tp,ti-tp);
1822-
canType += getCanonicalTypeForIdentifier(d,fs,matchStr.c_str(),0);
1822+
canType += getCanonicalTypeForIdentifier(d,fs,matchStr.c_str(),lang,0);
18231823
tp=ti+tl;
18241824
}
18251825
canType+=ts.substr(tp);
@@ -1833,7 +1833,7 @@ static QCString extractCanonicalType(const Definition *d,const FileDef *fs,QCStr
18331833
return removeRedundantWhiteSpace(canType);
18341834
}
18351835

1836-
static QCString extractCanonicalArgType(const Definition *d,const FileDef *fs,const Argument &arg)
1836+
static QCString extractCanonicalArgType(const Definition *d,const FileDef *fs,const Argument &arg,SrcLangExt lang)
18371837
{
18381838
QCString type = arg.type.stripWhiteSpace();
18391839
QCString name = arg.name;
@@ -1853,12 +1853,13 @@ static QCString extractCanonicalArgType(const Definition *d,const FileDef *fs,co
18531853
type+=arg.array;
18541854
}
18551855

1856-
return extractCanonicalType(d,fs,type);
1856+
return extractCanonicalType(d,fs,type,lang);
18571857
}
18581858

18591859
static bool matchArgument2(
18601860
const Definition *srcScope,const FileDef *srcFileScope,Argument &srcA,
1861-
const Definition *dstScope,const FileDef *dstFileScope,Argument &dstA
1861+
const Definition *dstScope,const FileDef *dstFileScope,Argument &dstA,
1862+
SrcLangExt lang
18621863
)
18631864
{
18641865
//printf(">> match argument: %s::'%s|%s' (%s) <-> %s::'%s|%s' (%s)\n",
@@ -1896,8 +1897,8 @@ static bool matchArgument2(
18961897
if (srcA.canType.isEmpty() || dstA.canType.isEmpty())
18971898
{
18981899
// need to re-evaluate both see issue #8370
1899-
srcA.canType = extractCanonicalArgType(srcScope,srcFileScope,srcA);
1900-
dstA.canType = extractCanonicalArgType(dstScope,dstFileScope,dstA);
1900+
srcA.canType = extractCanonicalArgType(srcScope,srcFileScope,srcA,lang);
1901+
dstA.canType = extractCanonicalArgType(dstScope,dstFileScope,dstA,lang);
19011902
}
19021903

19031904
if (srcA.canType==dstA.canType)
@@ -1917,8 +1918,8 @@ static bool matchArgument2(
19171918

19181919
// new algorithm for argument matching
19191920
bool matchArguments2(const Definition *srcScope,const FileDef *srcFileScope,const ArgumentList *srcAl,
1920-
const Definition *dstScope,const FileDef *dstFileScope,const ArgumentList *dstAl,
1921-
bool checkCV)
1921+
const Definition *dstScope,const FileDef *dstFileScope,const ArgumentList *dstAl,
1922+
bool checkCV,SrcLangExt lang)
19221923
{
19231924
ASSERT(srcScope!=0 && dstScope!=0);
19241925

@@ -1990,7 +1991,8 @@ bool matchArguments2(const Definition *srcScope,const FileDef *srcFileScope,cons
19901991
Argument &srcA = const_cast<Argument&>(*srcIt);
19911992
Argument &dstA = const_cast<Argument&>(*dstIt);
19921993
if (!matchArgument2(srcScope,srcFileScope,srcA,
1993-
dstScope,dstFileScope,dstA)
1994+
dstScope,dstFileScope,dstA,
1995+
lang)
19941996
)
19951997
{
19961998
NOMATCH
@@ -2002,7 +2004,6 @@ bool matchArguments2(const Definition *srcScope,const FileDef *srcFileScope,cons
20022004
}
20032005

20042006

2005-
20062007
// merges the initializer of two argument lists
20072008
// pre: the types of the arguments in the list should match.
20082009
void mergeArguments(ArgumentList &srcAl,ArgumentList &dstAl,bool forceNameOverwrite)
@@ -2172,7 +2173,7 @@ static void findMembersWithSpecificName(const MemberName *mn,
21722173
match=matchArguments2(
21732174
md->getOuterScope(),fd,&mdAl,
21742175
Doxygen::globalScope,fd,argList_p.get(),
2175-
checkCV);
2176+
checkCV,md->getLanguage());
21762177
}
21772178
if (match)
21782179
{
@@ -2310,7 +2311,7 @@ bool getDefs(const QCString &scName,
23102311
bool match = args.isEmpty() ||
23112312
matchArguments2(mmd->getOuterScope(),mmd->getFileDef(),&mmdAl,
23122313
fcd, fcd->getFileDef(),argList.get(),
2313-
checkCV);
2314+
checkCV,mmd->getLanguage());
23142315
//printf("match=%d\n",match);
23152316
if (match)
23162317
{
@@ -2433,9 +2434,8 @@ bool getDefs(const QCString &scName,
24332434

24342435
const ArgumentList &mmdAl = mmd->argumentList();
24352436
if (matchArguments2(mmd->getOuterScope(),mmd->getFileDef(),&mmdAl,
2436-
Doxygen::globalScope,mmd->getFileDef(),argList.get(),
2437-
checkCV
2438-
)
2437+
Doxygen::globalScope,mmd->getFileDef(),argList.get(),
2438+
checkCV,mmd->getLanguage())
24392439
)
24402440
{
24412441
fuzzy_mmd = mmd;
@@ -2520,7 +2520,7 @@ bool getDefs(const QCString &scName,
25202520
match=matchArguments2(
25212521
mmd->getOuterScope(),mmd->getFileDef(),&mmdAl,
25222522
fnd,mmd->getFileDef(),argList_p.get(),
2523-
checkCV);
2523+
checkCV,mmd->getLanguage());
25242524
}
25252525
if (match)
25262526
{

src/util.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,11 @@ void generateFileRef(OutputDocInterface &od,const QCString &,
145145

146146
void writePageRef(OutputDocInterface &od,const QCString &cn,const QCString &mn);
147147

148-
QCString getCanonicalTemplateSpec(const Definition *d,const FileDef *fs,const QCString& spec);
148+
//QCString getCanonicalTemplateSpec(const Definition *d,const FileDef *fs,const QCString& spec);
149149

150150
bool matchArguments2(const Definition *srcScope,const FileDef *srcFileScope,const ArgumentList *srcAl,
151151
const Definition *dstScope,const FileDef *dstFileScope,const ArgumentList *dstAl,
152-
bool checkCV
152+
bool checkCV,SrcLangExt lang
153153
);
154154

155155
void mergeArguments(ArgumentList &,ArgumentList &,bool forceNameOverwrite=FALSE);

0 commit comments

Comments
 (0)