summaryrefslogtreecommitdiffstats
path: root/src/clangparser.cpp
diff options
context:
space:
mode:
authorDimitri van Heesch <doxygen@gmail.com>2021-01-01 10:47:41 (GMT)
committerDimitri van Heesch <doxygen@gmail.com>2021-01-01 10:47:41 (GMT)
commit3867926d7162704c8232af95316dbc14e313f9c3 (patch)
tree20fbd3878404a7b15474e9c5e752ae4b6b36160a /src/clangparser.cpp
parenteec3c9ab5eb881d596b489f1f6024e4ac29f23ce (diff)
downloadDoxygen-3867926d7162704c8232af95316dbc14e313f9c3.zip
Doxygen-3867926d7162704c8232af95316dbc14e313f9c3.tar.gz
Doxygen-3867926d7162704c8232af95316dbc14e313f9c3.tar.bz2
Refactoring: modernise Doxygen::clangUsrMap
Diffstat (limited to 'src/clangparser.cpp')
-rw-r--r--src/clangparser.cpp25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/clangparser.cpp b/src/clangparser.cpp
index 2593d27..fc31639 100644
--- a/src/clangparser.cpp
+++ b/src/clangparser.cpp
@@ -350,7 +350,7 @@ ClangTUParser::~ClangTUParser()
p->tu = 0;
}
-void ClangTUParser::switchToFile(FileDef *fd)
+void ClangTUParser::switchToFile(const FileDef *fd)
{
//printf("ClangTUParser::switchToFile(%s) this=%p\n",qPrint(fd->absFilePath()),this);
if (p->tu)
@@ -490,7 +490,7 @@ QCString ClangTUParser::lookup(uint line,const char *symbol)
}
-void ClangTUParser::writeLineNumber(CodeOutputInterface &ol,FileDef *fd,uint line)
+void ClangTUParser::writeLineNumber(CodeOutputInterface &ol,const FileDef *fd,uint line)
{
Definition *d = fd ? fd->getSourceDefinition(line) : 0;
if (d && d->isLinkable())
@@ -536,7 +536,7 @@ void ClangTUParser::writeLineNumber(CodeOutputInterface &ol,FileDef *fd,uint lin
//printf("writeLineNumber(%d) g_searchForBody=%d\n",line,g_searchForBody);
}
-void ClangTUParser::codifyLines(CodeOutputInterface &ol,FileDef *fd,const char *text,
+void ClangTUParser::codifyLines(CodeOutputInterface &ol,const FileDef *fd,const char *text,
uint &line,uint &column,const char *fontClass)
{
if (fontClass) ol.startFontClass(fontClass);
@@ -573,8 +573,8 @@ void ClangTUParser::codifyLines(CodeOutputInterface &ol,FileDef *fd,const char *
}
void ClangTUParser::writeMultiLineCodeLink(CodeOutputInterface &ol,
- FileDef *fd,uint &line,uint &column,
- Definition *d,
+ const FileDef *fd,uint &line,uint &column,
+ const Definition *d,
const char *text)
{
static bool sourceTooltips = Config_getBool(SOURCE_TOOLTIPS);
@@ -613,7 +613,7 @@ void ClangTUParser::writeMultiLineCodeLink(CodeOutputInterface &ol,
}
}
-void ClangTUParser::linkInclude(CodeOutputInterface &ol,FileDef *fd,
+void ClangTUParser::linkInclude(CodeOutputInterface &ol,const FileDef *fd,
uint &line,uint &column,const char *text)
{
QCString incName = text;
@@ -647,7 +647,7 @@ void ClangTUParser::linkInclude(CodeOutputInterface &ol,FileDef *fd,
}
}
-void ClangTUParser::linkMacro(CodeOutputInterface &ol,FileDef *fd,
+void ClangTUParser::linkMacro(CodeOutputInterface &ol,const FileDef *fd,
uint &line,uint &column,const char *text)
{
MemberName *mn=Doxygen::functionNameLinkedMap->find(text);
@@ -666,7 +666,7 @@ void ClangTUParser::linkMacro(CodeOutputInterface &ol,FileDef *fd,
}
-void ClangTUParser::linkIdentifier(CodeOutputInterface &ol,FileDef *fd,
+void ClangTUParser::linkIdentifier(CodeOutputInterface &ol,const FileDef *fd,
uint &line,uint &column,const char *text,int tokenIndex)
{
CXCursor c = p->cursors[tokenIndex];
@@ -683,7 +683,12 @@ void ClangTUParser::linkIdentifier(CodeOutputInterface &ol,FileDef *fd,
CXString usr = clang_getCursorUSR(c);
const char *usrStr = clang_getCString(usr);
- Definition *d = usrStr ? Doxygen::clangUsrMap->find(usrStr) : 0;
+ const Definition *d = 0;
+ auto kv = Doxygen::clangUsrMap->find(usrStr);
+ if (kv!=Doxygen::clangUsrMap->end())
+ {
+ d = kv->second;
+ }
//CXCursorKind kind = clang_getCursorKind(c);
//if (d==0)
//{
@@ -743,7 +748,7 @@ void ClangTUParser::detectFunctionBody(const char *s)
}
}
-void ClangTUParser::writeSources(CodeOutputInterface &ol,FileDef *fd)
+void ClangTUParser::writeSources(CodeOutputInterface &ol,const FileDef *fd)
{
// (re)set global parser state
p->currentMemberDef=0;