diff options
author | Dimitri van Heesch <doxygen@gmail.com> | 2019-05-05 11:47:17 (GMT) |
---|---|---|
committer | Dimitri van Heesch <doxygen@gmail.com> | 2019-05-05 11:47:17 (GMT) |
commit | 1854ad69bf183f34c937145eba437f653ef67f0b (patch) | |
tree | 96f2882cda1fb6e0a73175bae857ff1716267b86 /src | |
parent | 52e32ead5d8152d75a18f3cc7f4b7e5c7bb38b29 (diff) | |
download | Doxygen-1854ad69bf183f34c937145eba437f653ef67f0b.zip Doxygen-1854ad69bf183f34c937145eba437f653ef67f0b.tar.gz Doxygen-1854ad69bf183f34c937145eba437f653ef67f0b.tar.bz2 |
Further const correctness changes
Diffstat (limited to 'src')
-rw-r--r-- | src/code.l | 6 | ||||
-rw-r--r-- | src/docparser.cpp | 2 | ||||
-rw-r--r-- | src/doxygen.cpp | 255 | ||||
-rw-r--r-- | src/memberdef.cpp | 14 | ||||
-rw-r--r-- | src/pycode.l | 4 | ||||
-rw-r--r-- | src/util.cpp | 10 | ||||
-rw-r--r-- | src/util.h | 2 |
7 files changed, 150 insertions, 143 deletions
@@ -860,7 +860,7 @@ static bool getLinkInScope(const QCString &c, // scope bool varOnly=FALSE ) { - MemberDef *md = 0; + const MemberDef *md = 0; const ClassDef *cd = 0; const FileDef *fd = 0; const NamespaceDef *nd = 0; @@ -878,7 +878,7 @@ static bool getLinkInScope(const QCString &c, // scope anchor.sprintf("a%d",g_anchorCount); //printf("addExampleFile(%s,%s,%s)\n",anchor.data(),g_exampleName.data(), // g_exampleFile.data()); - if (md->addExample(anchor,g_exampleName,g_exampleFile)) + if (const_cast<MemberDef*>(md)->addExample(anchor,g_exampleName,g_exampleFile)) { ol.writeCodeAnchor(anchor); g_anchorCount++; @@ -897,7 +897,7 @@ static bool getLinkInScope(const QCString &c, // scope if (g_currentDefinition && g_currentMemberDef && md!=g_currentMemberDef && g_insideBody && g_collectXRefs) { - addDocCrossReference(g_currentMemberDef,md); + addDocCrossReference(g_currentMemberDef,const_cast<MemberDef*>(md)); } //printf("d->getReference()=`%s' d->getOutputBase()=`%s' name=`%s' member name=`%s'\n",d->getReference().data(),d->getOutputFileBase().data(),d->name().data(),md->name().data()); diff --git a/src/docparser.cpp b/src/docparser.cpp index 3d7ae33..b265093 100644 --- a/src/docparser.cpp +++ b/src/docparser.cpp @@ -689,7 +689,7 @@ static bool findDocsForMemberOrCompound(const char *commandName, QCString args=cmdArg.right(l-funcStart); // try if the link is to a member - MemberDef *md=0; + const MemberDef *md=0; const ClassDef *cd=0; const FileDef *fd=0; const NamespaceDef *nd=0; diff --git a/src/doxygen.cpp b/src/doxygen.cpp index 2900f49..347cd2a 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -3586,146 +3586,149 @@ static void buildFunctionList(Entry *root) MemberNameIterator mni(*mn); for (mni.toFirst();(!found && (md=mni.current()));++mni) { - const NamespaceDef *mnd = md->getNamespaceDef(); - NamespaceDef *rnd = 0; - //printf("root namespace=%s\n",rootNav->parent()->name().data()); - QCString fullScope = scope; - QCString parentScope = root->parent()->name; - if (!parentScope.isEmpty() && !leftScopeMatch(parentScope,scope)) + if (!md->isAlias()) { - if (!scope.isEmpty()) fullScope.prepend("::"); - fullScope.prepend(parentScope); - } - //printf("fullScope=%s\n",fullScope.data()); - rnd = getResolvedNamespace(fullScope); - const FileDef *mfd = md->getFileDef(); - QCString nsName,rnsName; - if (mnd) nsName = mnd->name().copy(); - if (rnd) rnsName = rnd->name().copy(); - //printf("matching arguments for %s%s %s%s\n", - // md->name().data(),md->argsString(),rname.data(),argListToString(root->argList).data()); - ArgumentList *mdAl = md->argumentList(); - ArgumentList *mdTempl = md->templateArguments(); - - // in case of template functions, we need to check if the - // functions have the same number of template parameters - bool sameNumTemplateArgs = TRUE; - bool matchingReturnTypes = TRUE; - if (mdTempl!=0 && root->tArgLists) - { - if (mdTempl->count()!=root->tArgLists->getLast()->count()) + const NamespaceDef *mnd = md->getNamespaceDef(); + NamespaceDef *rnd = 0; + //printf("root namespace=%s\n",rootNav->parent()->name().data()); + QCString fullScope = scope; + QCString parentScope = root->parent()->name; + if (!parentScope.isEmpty() && !leftScopeMatch(parentScope,scope)) { - sameNumTemplateArgs = FALSE; + if (!scope.isEmpty()) fullScope.prepend("::"); + fullScope.prepend(parentScope); } - if (md->typeString()!=removeRedundantWhiteSpace(root->type)) + //printf("fullScope=%s\n",fullScope.data()); + rnd = getResolvedNamespace(fullScope); + const FileDef *mfd = md->getFileDef(); + QCString nsName,rnsName; + if (mnd) nsName = mnd->name().copy(); + if (rnd) rnsName = rnd->name().copy(); + //printf("matching arguments for %s%s %s%s\n", + // md->name().data(),md->argsString(),rname.data(),argListToString(root->argList).data()); + ArgumentList *mdAl = md->argumentList(); + ArgumentList *mdTempl = md->templateArguments(); + + // in case of template functions, we need to check if the + // functions have the same number of template parameters + bool sameNumTemplateArgs = TRUE; + bool matchingReturnTypes = TRUE; + if (mdTempl!=0 && root->tArgLists) { - matchingReturnTypes = FALSE; + if (mdTempl->count()!=root->tArgLists->getLast()->count()) + { + sameNumTemplateArgs = FALSE; + } + if (md->typeString()!=removeRedundantWhiteSpace(root->type)) + { + matchingReturnTypes = FALSE; + } } - } - bool staticsInDifferentFiles = - root->stat && md->isStatic() && root->fileName!=md->getDefFileName(); + bool staticsInDifferentFiles = + root->stat && md->isStatic() && root->fileName!=md->getDefFileName(); - if ( - matchArguments2(md->getOuterScope(),mfd,mdAl, - rnd ? rnd : Doxygen::globalScope,rfd,root->argList, - FALSE) && - sameNumTemplateArgs && - matchingReturnTypes && - !staticsInDifferentFiles - ) - { - GroupDef *gd=0; - if (root->groups->getFirst()!=0) - { - gd = Doxygen::groupSDict->find(root->groups->getFirst()->groupname.data()); - } - //printf("match!\n"); - //printf("mnd=%p rnd=%p nsName=%s rnsName=%s\n",mnd,rnd,nsName.data(),rnsName.data()); - // see if we need to create a new member - found=(mnd && rnd && nsName==rnsName) || // members are in the same namespace - ((mnd==0 && rnd==0 && mfd!=0 && // no external reference and - mfd->absFilePath()==root->fileName // prototype in the same file - ) - ); - // otherwise, allow a duplicate global member with the same argument list - if (!found && gd && gd==md->getGroupDef() && nsName==rnsName) + if ( + matchArguments2(md->getOuterScope(),mfd,mdAl, + rnd ? rnd : Doxygen::globalScope,rfd,root->argList, + FALSE) && + sameNumTemplateArgs && + matchingReturnTypes && + !staticsInDifferentFiles + ) { - // member is already in the group, so we don't want to add it again. - found=TRUE; - } + GroupDef *gd=0; + if (root->groups->getFirst()!=0) + { + gd = Doxygen::groupSDict->find(root->groups->getFirst()->groupname.data()); + } + //printf("match!\n"); + //printf("mnd=%p rnd=%p nsName=%s rnsName=%s\n",mnd,rnd,nsName.data(),rnsName.data()); + // see if we need to create a new member + found=(mnd && rnd && nsName==rnsName) || // members are in the same namespace + ((mnd==0 && rnd==0 && mfd!=0 && // no external reference and + mfd->absFilePath()==root->fileName // prototype in the same file + ) + ); + // otherwise, allow a duplicate global member with the same argument list + if (!found && gd && gd==md->getGroupDef() && nsName==rnsName) + { + // member is already in the group, so we don't want to add it again. + found=TRUE; + } - //printf("combining function with prototype found=%d in namespace %s\n", - // found,nsName.data()); + //printf("combining function with prototype found=%d in namespace %s\n", + // found,nsName.data()); - if (found) - { - // merge argument lists - mergeArguments(mdAl,root->argList,!root->doc.isEmpty()); - // merge documentation - if (md->documentation().isEmpty() && !root->doc.isEmpty()) + if (found) { - ArgumentList *argList = new ArgumentList; - stringToArgumentList(root->args,argList); - if (root->proto) + // merge argument lists + mergeArguments(mdAl,root->argList,!root->doc.isEmpty()); + // merge documentation + if (md->documentation().isEmpty() && !root->doc.isEmpty()) { - //printf("setDeclArgumentList to %p\n",argList); - md->setDeclArgumentList(argList); + ArgumentList *argList = new ArgumentList; + stringToArgumentList(root->args,argList); + if (root->proto) + { + //printf("setDeclArgumentList to %p\n",argList); + md->setDeclArgumentList(argList); + } + else + { + md->setArgumentList(argList); + } } - else + + md->setDocumentation(root->doc,root->docFile,root->docLine); + md->setInbodyDocumentation(root->inbodyDocs,root->inbodyFile,root->inbodyLine); + md->setDocsForDefinition(!root->proto); + if (md->getStartBodyLine()==-1 && root->bodyLine!=-1) { - md->setArgumentList(argList); + md->setBodySegment(root->bodyLine,root->endBodyLine); + md->setBodyDef(rfd); } - } - - md->setDocumentation(root->doc,root->docFile,root->docLine); - md->setInbodyDocumentation(root->inbodyDocs,root->inbodyFile,root->inbodyLine); - md->setDocsForDefinition(!root->proto); - if (md->getStartBodyLine()==-1 && root->bodyLine!=-1) - { - md->setBodySegment(root->bodyLine,root->endBodyLine); - md->setBodyDef(rfd); - } - if (md->briefDescription().isEmpty() && !root->brief.isEmpty()) - { - md->setArgsString(root->args); - } - md->setBriefDescription(root->brief,root->briefFile,root->briefLine); + if (md->briefDescription().isEmpty() && !root->brief.isEmpty()) + { + md->setArgsString(root->args); + } + md->setBriefDescription(root->brief,root->briefFile,root->briefLine); - md->addSectionsToDefinition(root->anchors); + md->addSectionsToDefinition(root->anchors); - md->enableCallGraph(md->hasCallGraph() || root->callGraph); - md->enableCallerGraph(md->hasCallerGraph() || root->callerGraph); - md->enableReferencedByRelation(md->hasReferencedByRelation() || root->referencedByRelation); - md->enableReferencesRelation(md->hasReferencesRelation() || root->referencesRelation); + md->enableCallGraph(md->hasCallGraph() || root->callGraph); + md->enableCallerGraph(md->hasCallerGraph() || root->callerGraph); + md->enableReferencedByRelation(md->hasReferencedByRelation() || root->referencedByRelation); + md->enableReferencesRelation(md->hasReferencesRelation() || root->referencesRelation); - // merge ingroup specifiers - if (md->getGroupDef()==0 && root->groups->getFirst()!=0) - { - addMemberToGroups(root,md); - } - else if (md->getGroupDef()!=0 && root->groups->count()==0) - { - //printf("existing member is grouped, new member not\n"); - root->groups->append(new Grouping(md->getGroupDef()->name(), md->getGroupPri())); - } - else if (md->getGroupDef()!=0 && root->groups->getFirst()!=0) - { - //printf("both members are grouped\n"); - } + // merge ingroup specifiers + if (md->getGroupDef()==0 && root->groups->getFirst()!=0) + { + addMemberToGroups(root,md); + } + else if (md->getGroupDef()!=0 && root->groups->count()==0) + { + //printf("existing member is grouped, new member not\n"); + root->groups->append(new Grouping(md->getGroupDef()->name(), md->getGroupPri())); + } + else if (md->getGroupDef()!=0 && root->groups->getFirst()!=0) + { + //printf("both members are grouped\n"); + } - // if md is a declaration and root is the corresponding - // definition, then turn md into a definition. - if (md->isPrototype() && !root->proto) - { - md->setDeclFile(md->getDefFileName(),md->getDefLine(),md->getDefColumn()); - md->setPrototype(FALSE,root->fileName,root->startLine,root->startColumn); - } - // if md is already the definition, then add the declaration info - else if (!md->isPrototype() && root->proto) - { - md->setDeclFile(root->fileName,root->startLine,root->startColumn); + // if md is a declaration and root is the corresponding + // definition, then turn md into a definition. + if (md->isPrototype() && !root->proto) + { + md->setDeclFile(md->getDefFileName(),md->getDefLine(),md->getDefColumn()); + md->setPrototype(FALSE,root->fileName,root->startLine,root->startColumn); + } + // if md is already the definition, then add the declaration info + else if (!md->isPrototype() && root->proto) + { + md->setDeclFile(root->fileName,root->startLine,root->startColumn); + } } } } @@ -3915,18 +3918,20 @@ static void findFriends() MemberDef *fmd; for (;(fmd=fni.current());++fni) // for each function with that name { + const MemberDef *cfmd = const_cast<const MemberDef*>(fmd); MemberNameIterator mni(*mn); MemberDef *mmd; for (;(mmd=mni.current());++mni) // for each member with that name { + const MemberDef *cmmd = const_cast<const MemberDef*>(mmd); //printf("Checking for matching arguments // mmd->isRelated()=%d mmd->isFriend()=%d mmd->isFunction()=%d\n", // mmd->isRelated(),mmd->isFriend(),mmd->isFunction()); - ArgumentList *mmdAl = mmd->argumentList(); - ArgumentList *fmdAl = fmd->argumentList(); - if ((mmd->isFriend() || (mmd->isRelated() && mmd->isFunction())) && - matchArguments2(mmd->getOuterScope(), mmd->getFileDef(), mmdAl, - fmd->getOuterScope(), fmd->getFileDef(), fmdAl, + ArgumentList *mmdAl = cmmd->argumentList(); + ArgumentList *fmdAl = cfmd->argumentList(); + if ((cmmd->isFriend() || (cmmd->isRelated() && cmmd->isFunction())) && + matchArguments2(cmmd->getOuterScope(), cmmd->getFileDef(), mmdAl, + cfmd->getOuterScope(), cfmd->getFileDef(), fmdAl, TRUE ) diff --git a/src/memberdef.cpp b/src/memberdef.cpp index 24257da..273c96a 100644 --- a/src/memberdef.cpp +++ b/src/memberdef.cpp @@ -6030,12 +6030,14 @@ void combineDeclarationAndDefinition(MemberDef *mdec,MemberDef *mdef) // mdef, mdef ? mdef->name().data() : "", // mdec, mdec ? mdec->name().data() : ""); - ArgumentList *mdefAl = mdef->argumentList(); - ArgumentList *mdecAl = mdec->argumentList(); - if (matchArguments2(mdef->getOuterScope(),mdef->getFileDef(),mdefAl, - mdec->getOuterScope(),mdec->getFileDef(),mdecAl, - TRUE - ) + const MemberDef *cmdec = const_cast<const MemberDef*>(mdec); + const MemberDef *cmdef = const_cast<const MemberDef*>(mdef); + ArgumentList *mdefAl = cmdef->argumentList(); + ArgumentList *mdecAl = cmdec->argumentList(); + if (matchArguments2(cmdef->getOuterScope(),cmdef->getFileDef(),mdefAl, + cmdec->getOuterScope(),cmdec->getFileDef(),mdecAl, + TRUE + ) ) /* match found */ { //printf("Found member %s: definition in %s (doc=`%s') and declaration in %s (doc=`%s')\n", diff --git a/src/pycode.l b/src/pycode.l index b0ec68e..1a87bca 100644 --- a/src/pycode.l +++ b/src/pycode.l @@ -544,7 +544,7 @@ static bool getLinkInScope(const QCString &c, // scope const char *text ) { - MemberDef *md = 0; + const MemberDef *md = 0; const ClassDef *cd = 0; const FileDef *fd = 0; const NamespaceDef *nd = 0; @@ -569,7 +569,7 @@ static bool getLinkInScope(const QCString &c, // scope if (g_currentDefinition && g_currentMemberDef && md!=g_currentMemberDef && g_collectXRefs) { - addDocCrossReference(g_currentMemberDef,md); + addDocCrossReference(g_currentMemberDef,const_cast<MemberDef*>(md)); } //printf("d->getReference()=`%s' d->getOutputBase()=`%s' name=`%s' member name=`%s'\n",d->getReference().data(),d->getOutputFileBase().data(),d->name().data(),md->name().data()); diff --git a/src/util.cpp b/src/util.cpp index 2719c73..5c66dd1 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -2080,7 +2080,7 @@ void linkifyText(const TextGeneratorIntf &out, const Definition *scope, bool found=FALSE; if (!insideString) { - MemberDef *md=0; + const MemberDef *md=0; const ClassDef *cd=0; const FileDef *fd=0; const NamespaceDef *nd=0; @@ -4058,7 +4058,7 @@ static void findMembersWithSpecificName(MemberName *mn, bool getDefs(const QCString &scName, const QCString &mbName, const char *args, - MemberDef *&md, + const MemberDef *&md, const ClassDef *&cd, const FileDef *&fd, const NamespaceDef *&nd, @@ -4336,7 +4336,7 @@ bool getDefs(const QCString &scName, // namespaceName.data(),mn->count()); bool found=FALSE; MemberNameIterator mmli(*mn); - MemberDef *mmd; + const MemberDef *mmd; for (mmli.toFirst();((mmd=mmli.current()) && !found);++mmli) { //printf("mmd->getNamespaceDef()=%p fnd=%p\n", @@ -4400,7 +4400,7 @@ bool getDefs(const QCString &scName, } } } - if (found) + if (found) { if (!md->isLinkable()) { @@ -4706,7 +4706,7 @@ bool resolveRef(/* in */ const char *scName, QCString scopeStr=scName; - MemberDef *md = 0; + const MemberDef *md = 0; const ClassDef *cd = 0; const FileDef *fd = 0; const NamespaceDef *nd = 0; @@ -142,7 +142,7 @@ QCString dateToString(bool); bool getDefs(const QCString &scopeName, const QCString &memberName, const char *, - MemberDef *&md, + const MemberDef *&md, const ClassDef *&cd, const FileDef *&fd, const NamespaceDef *&nd, |