Skip to content

Commit a6988ea

Browse files
committed
issue #10915 base class function in code block no longer linked if the code block contains a derived class definition calling the base class function in Doxygen 1.9.5 or later
1 parent 78c3d1c commit a6988ea

File tree

1 file changed

+25
-5
lines changed

1 file changed

+25
-5
lines changed

src/code.l

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ struct codeYY_state
162162

163163
bool lexInit = FALSE;
164164

165-
std::stack<int> classScopeLengthStack;
165+
std::vector<int> classScopeLengthStack;
166166

167167
int isPrefixedWithThis = FALSE;
168168
const Definition *searchCtx = nullptr;
@@ -2352,7 +2352,7 @@ static void addVariable(yyscan_t yyscanner,QCString type,QCString name)
23522352
static void pushScope(yyscan_t yyscanner,const QCString &s)
23532353
{
23542354
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
2355-
yyextra->classScopeLengthStack.push(int(yyextra->classScope.length()));
2355+
yyextra->classScopeLengthStack.push_back(int(yyextra->classScope.length()));
23562356
if (yyextra->classScope.isEmpty() || leftScopeMatch(s,yyextra->classScope))
23572357
{
23582358
yyextra->classScope = s;
@@ -2372,8 +2372,8 @@ static void popScope(yyscan_t yyscanner)
23722372
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
23732373
if (!yyextra->classScopeLengthStack.empty())
23742374
{
2375-
int length = yyextra->classScopeLengthStack.top();
2376-
yyextra->classScopeLengthStack.pop();
2375+
int length = yyextra->classScopeLengthStack.back();
2376+
yyextra->classScopeLengthStack.pop_back();
23772377
yyextra->classScope.resize(length);
23782378
}
23792379
else
@@ -2947,6 +2947,26 @@ static bool getLinkInScope(yyscan_t yyscanner,
29472947
input.currentFile = yyextra->sourceFileDef;
29482948
input.insideCode = true;
29492949
GetDefResult result = getDefs(input);
2950+
DBG_CTX((stderr,"classScopeLengthStack.size()=%zu\n",yyextra->classScopeLengthStack.size()));
2951+
if (!result.found && !yyextra->classScopeLengthStack.empty() && c==yyextra->classScope)
2952+
{
2953+
QCString localName = yyextra->classScope.mid(yyextra->classScopeLengthStack[0]+2); // try also without leading scope
2954+
auto it = yyextra->codeClassMap.find(localName.str());
2955+
if (it!=yyextra->codeClassMap.end())
2956+
{
2957+
ScopedTypeVariant ccd = it->second;
2958+
if (ccd.localDef() && !ccd.localDef()->baseClasses().empty())
2959+
{
2960+
for (const auto &bcName : ccd.localDef()->baseClasses())
2961+
{
2962+
DBG_CTX((stderr,"trying lookup via base class %s\n",qPrint(bcName)));
2963+
input.scopeName = bcName;
2964+
result = getDefs(input);
2965+
if (result.found) break;
2966+
}
2967+
}
2968+
}
2969+
}
29502970
if (result.found && (!varOnly || result.md->isVariable()))
29512971
{
29522972
if (result.md->isLinkable())
@@ -4115,7 +4135,7 @@ void CCodeParser::resetCodeParserState()
41154135
struct yyguts_t *yyg = (struct yyguts_t*)p->yyscanner;
41164136
DBG_CTX((stderr,"***CodeParser::reset()\n"));
41174137
yyextra->theVarContext.clear();
4118-
while (!yyextra->classScopeLengthStack.empty()) yyextra->classScopeLengthStack.pop();
4138+
while (!yyextra->classScopeLengthStack.empty()) yyextra->classScopeLengthStack.pop_back();
41194139
yyextra->codeClassMap.clear();
41204140
yyextra->curClassBases.clear();
41214141
yyextra->anchorCount = 0;

0 commit comments

Comments
 (0)