Skip to content

Commit eb5d5ce

Browse files
authored
Merge pull request doxygen#11561 from nwellnhof/only-linkable
Fix links not being generated
2 parents 4bb67ed + d1666a6 commit eb5d5ce

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

src/symbolresolver.cpp

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ struct SymbolResolver::Private
144144
const QCString &args, // in
145145
bool checkCV, // in
146146
bool insideCode, // in
147+
bool onlyLinkable, // in
147148
const MemberDef **pTypeDef, // out
148149
QCString *pTemplSpec, // out
149150
QCString *pResolvedType); // out
@@ -393,6 +394,7 @@ const Definition *SymbolResolver::Private::getResolvedSymbolRec(
393394
const QCString &args,
394395
bool checkCV,
395396
bool insideCode,
397+
bool onlyLinkable,
396398
const MemberDef **pTypeDef,
397399
QCString *pTemplSpec,
398400
QCString *pResolvedType)
@@ -523,7 +525,15 @@ const Definition *SymbolResolver::Private::getResolvedSymbolRec(
523525

524526
for (Definition *d : range)
525527
{
526-
if (isCodeSymbol(d->definitionType()))
528+
if (isCodeSymbol(d->definitionType()) &&
529+
(!onlyLinkable ||
530+
d->isLinkable() ||
531+
d->isLinkableInProject() ||
532+
(d->definitionType()==Definition::TypeFile &&
533+
(toFileDef(d))->generateSourceFile()
534+
) // undocumented file that has source code we can link to
535+
)
536+
)
527537
{
528538
getResolvedSymbol(visitedKeys,scope,d,args,checkCV,insideCode,explicitScopePart,strippedTemplateParams,false,
529539
minDistance,bestMatch,bestTypedef,bestTemplSpec,bestResolvedType);
@@ -1658,14 +1668,15 @@ const Definition *SymbolResolver::resolveSymbol(const Definition *scope,
16581668
const QCString &name,
16591669
const QCString &args,
16601670
bool checkCV,
1661-
bool insideCode)
1671+
bool insideCode,
1672+
bool onlyLinkable)
16621673
{
16631674
AUTO_TRACE("scope={} name={} args={} checkCV={} insideCode={}",
16641675
scope?scope->name():QCString(), name, args, checkCV, insideCode);
16651676
p->reset();
16661677
if (scope==nullptr) scope=Doxygen::globalScope;
16671678
VisitedKeys visitedKeys;
1668-
const Definition *result = p->getResolvedSymbolRec(visitedKeys,scope,name,args,checkCV,insideCode,&p->typeDef,&p->templateSpec,&p->resolvedType);
1679+
const Definition *result = p->getResolvedSymbolRec(visitedKeys,scope,name,args,checkCV,insideCode,onlyLinkable,&p->typeDef,&p->templateSpec,&p->resolvedType);
16691680
AUTO_TRACE_EXIT("result={}{}", qPrint(result?result->qualifiedName():QCString()),
16701681
qPrint(result && result->definitionType()==Definition::TypeMember ? toMemberDef(result)->argsString() : QCString()));
16711682
return result;

src/symbolresolver.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,14 @@ class SymbolResolver
6868
* @param args Argument list associated with the symbol (for functions)
6969
* @param checkCV Check const/volatile qualifiers (for methods)
7070
* @param insideCode Is the symbol found in a code fragment
71+
* @param onlyLinkable Only search linkable definitions
7172
*/
7273
const Definition *resolveSymbol(const Definition *scope,
7374
const QCString &name,
7475
const QCString &args=QCString(),
7576
bool checkCV=false,
76-
bool insideCode=false
77+
bool insideCode=false,
78+
bool onlyLinkable=false
7779
);
7880

7981
/** Checks if symbol \a item is accessible from within \a scope.

src/util.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2289,7 +2289,7 @@ GetDefResult getDefsNew(const GetDefInput &input)
22892289
}
22902290
//printf("@@ -> found scope scope=%s member=%s out=%s\n",qPrint(input.scopeName),qPrint(input.memberName),qPrint(scope?scope->name():""));
22912291
//
2292-
const Definition *symbol = resolver.resolveSymbol(scope,input.memberName,input.args,input.checkCV,input.insideCode);
2292+
const Definition *symbol = resolver.resolveSymbol(scope,input.memberName,input.args,input.checkCV,input.insideCode,true);
22932293
//printf("@@ -> found symbol in=%s out=%s\n",qPrint(input.memberName),qPrint(symbol?symbol->qualifiedName():QCString()));
22942294
if (symbol && symbol->definitionType()==Definition::TypeMember)
22952295
{

0 commit comments

Comments
 (0)