From 28fc7d1fce3cc8e7fa26e3760e8d8d79b9dd23a5 Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Sat, 18 Apr 2020 13:45:40 +0200 Subject: Refactoring: changed Doxygen::expandAsDefinedDict to Doxygen::expandAsDefinedSet --- src/doxygen.cpp | 9 ++------- src/doxygen.h | 4 +++- src/pre.l | 8 +++++--- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/doxygen.cpp b/src/doxygen.cpp index 56f395a..c59b075 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -136,7 +136,7 @@ FileNameLinkedMap *Doxygen::mscFileNameLinkedMap = 0; // msc files FileNameLinkedMap *Doxygen::diaFileNameLinkedMap = 0; // dia files StringDict Doxygen::namespaceAliasDict(257); // all namespace aliases StringDict Doxygen::tagDestinationDict(257); // all tag locations -QDict Doxygen::expandAsDefinedDict(257); // all macros that should be expanded +std::unordered_set Doxygen::expandAsDefinedSet; // all macros that should be expanded QIntDict Doxygen::memGrpInfoDict(1009); // dictionary of the member groups heading PageDef *Doxygen::mainPage = 0; bool Doxygen::insideMainPage = FALSE; // are we generating docs for the main page? @@ -275,8 +275,6 @@ void statistics() Doxygen::tagDestinationDict.statistics(); fprintf(stderr,"--- g_compoundKeywordDict stats ----\n"); g_compoundKeywordDict.statistics(); - fprintf(stderr,"--- expandAsDefinedDict stats ----\n"); - Doxygen::expandAsDefinedDict.statistics(); fprintf(stderr,"--- memGrpInfoDict stats ----\n"); Doxygen::memGrpInfoDict.statistics(); } @@ -10311,10 +10309,7 @@ void adjustConfiguration() s=expandAsDefinedList.first(); while (s) { - if (Doxygen::expandAsDefinedDict[s]==0) - { - Doxygen::expandAsDefinedDict.insert(s,(void *)666); - } + Doxygen::expandAsDefinedSet.insert(s); s=expandAsDefinedList.next(); } diff --git a/src/doxygen.h b/src/doxygen.h index a18ac3b..d04b0b3 100644 --- a/src/doxygen.h +++ b/src/doxygen.h @@ -22,6 +22,8 @@ #include #include +#include + #include "ftextstream.h" #include "sortdict.h" #include "membergroup.h" @@ -114,7 +116,7 @@ class Doxygen static StringDict tagDestinationDict; static StringDict aliasDict; static QIntDict memGrpInfoDict; - static QDict expandAsDefinedDict; + static std::unordered_set expandAsDefinedSet; static NamespaceDef *globalScope; static QCString htmlFileExtension; static bool parseSourcesNeeded; diff --git a/src/pre.l b/src/pre.l index 18394ad..351511b 100644 --- a/src/pre.l +++ b/src/pre.l @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -334,7 +335,7 @@ void DefineManager::DefinesPerFile::collectDefines( * * global state */ -static std::set g_allIncludes; +static std::unordered_set g_allIncludes; static DefineManager g_defineManager; @@ -396,7 +397,7 @@ struct preYY_state std::stack< std::unique_ptr > condStack; std::deque< std::unique_ptr > includeStack; std::map expandedDict; - std::set expanded; + std::unordered_set expanded; ConstExpressionParser constExpParser; }; @@ -2781,7 +2782,8 @@ static std::unique_ptr newDefine(yyscan_t yyscanner) //printf("newDefine: %s %s file: %s\n",def->name.data(),def->definition.data(), // def->fileDef ? def->fileDef->name().data() : def->fileName.data()); //printf("newDefine: '%s'->'%s'\n",def->name.data(),def->definition.data()); - if (!def->name.isEmpty() && Doxygen::expandAsDefinedDict[def->name]) + if (!def->name.isEmpty() && + Doxygen::expandAsDefinedSet.find(def->name.data())!=Doxygen::expandAsDefinedSet.end()) { def->isPredefined=TRUE; } -- cgit v0.12