Skip to content

Commit

Permalink
Fixed anothing compilation issue when use_libclang was not enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
doxygen committed Jun 29, 2020
1 parent 6b1543b commit 3e9d938
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 30 deletions.
18 changes: 8 additions & 10 deletions src/doxygen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ QCString Doxygen::spaces;
bool Doxygen::generatingXmlOutput = FALSE;
GenericsSDict *Doxygen::genericsDict;
DefinesPerFileList Doxygen::macroDefinitions;
bool Doxygen::clangAssistedParsing = FALSE;

// locally accessible globals
static std::unordered_map< std::string, const Entry* > g_classEntries;
Expand Down Expand Up @@ -7477,8 +7478,7 @@ static void generateFileSources()
if (!Doxygen::inputNameLinkedMap->empty())
{
#if USE_LIBCLANG
static bool clangAssistedParsing = Config_getBool(CLANG_ASSISTED_PARSING);
if (clangAssistedParsing)
if (Doxygen::clangAssistedParsing)
{
QDict<void> g_processedFiles(10007);

Expand Down Expand Up @@ -9063,11 +9063,6 @@ static std::shared_ptr<Entry> parseFile(OutlineParserInterface &parser,
FileDef *fd,const char *fn,
bool sameTu,QStrList &filesInSameTu)
{
#if USE_LIBCLANG
static bool clangAssistedParsing = Config_getBool(CLANG_ASSISTED_PARSING);
#else
static bool clangAssistedParsing = FALSE;
#endif
QCString fileName=fn;
QCString extension;
int ei = fileName.findRev('.');
Expand Down Expand Up @@ -9114,7 +9109,7 @@ static std::shared_ptr<Entry> parseFile(OutlineParserInterface &parser,

convBuf.addChar('\0');

if (clangAssistedParsing && !sameTu)
if (Doxygen::clangAssistedParsing && !sameTu)
{
fd->getAllIncludeFilesRecursively(filesInSameTu);
}
Expand All @@ -9130,8 +9125,7 @@ static std::shared_ptr<Entry> parseFile(OutlineParserInterface &parser,
static void parseFiles(const std::shared_ptr<Entry> &root)
{
#if USE_LIBCLANG
static bool clangAssistedParsing = Config_getBool(CLANG_ASSISTED_PARSING);
if (clangAssistedParsing)
if (Doxygen::clangAssistedParsing)
{
QDict<void> g_processedFiles(10007);

Expand Down Expand Up @@ -10707,6 +10701,10 @@ void parseInput()
{
atexit(exitDoxygen);

#if USE_LIBCLANG
Doxygen::clangAssistedParsing = Config_getBool(CLANG_ASSISTED_PARSING);
#endif

// we would like to show the versionString earlier, but we first have to handle the configuration file
// to know the value of the QUIET setting.
QCString versionString = getFullVersion();
Expand Down
1 change: 1 addition & 0 deletions src/doxygen.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ class Doxygen
static bool generatingXmlOutput;
static GenericsSDict *genericsDict;
static DefinesPerFileList macroDefinitions;
static bool clangAssistedParsing;
};

void initDoxygen();
Expand Down
6 changes: 2 additions & 4 deletions src/filedef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1212,8 +1212,7 @@ void FileDefImpl::writeSource(OutputList &ol,bool sameTu,QStrList &filesInSameTu
(void)sameTu;
(void)filesInSameTu;
#if USE_LIBCLANG
static bool clangAssistedParsing = Config_getBool(CLANG_ASSISTED_PARSING);
if (clangAssistedParsing &&
if (Doxygen::clangAssistedParsing &&
(getLanguage()==SrcLangExt_Cpp || getLanguage()==SrcLangExt_ObjC))
{
ol.startCodeFragment();
Expand Down Expand Up @@ -1276,8 +1275,7 @@ void FileDefImpl::parseSource(bool sameTu,QStrList &filesInSameTu)
(void)sameTu;
(void)filesInSameTu;
#if USE_LIBCLANG
static bool clangAssistedParsing = Config_getBool(CLANG_ASSISTED_PARSING);
if (clangAssistedParsing &&
if (Doxygen::clangAssistedParsing &&
(getLanguage()==SrcLangExt_Cpp || getLanguage()==SrcLangExt_ObjC))
{
if (!sameTu)
Expand Down
28 changes: 12 additions & 16 deletions src/scanner.l
Original file line number Diff line number Diff line change
Expand Up @@ -2045,7 +2045,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
BEGIN(FindMembers);
}
<FindMembers,FindMemberName>{SCOPENAME} {
if (Config_getBool(CLANG_ASSISTED_PARSING) && (yyextra->insideCpp || yyextra->insideObjC))
if (Doxygen::clangAssistedParsing && (yyextra->insideCpp || yyextra->insideObjC))
{
yyextra->current->id = ClangParser::instance()->lookup(yyextra->yyLineNr,yytext);
}
Expand Down Expand Up @@ -2348,7 +2348,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
*/
<Define>{ID} {
//printf("Define '%s' without args\n",yytext);
if (Config_getBool(CLANG_ASSISTED_PARSING) && (yyextra->insideCpp || yyextra->insideObjC))
if (Doxygen::clangAssistedParsing && (yyextra->insideCpp || yyextra->insideObjC))
{
yyextra->current->id = ClangParser::instance()->lookup(yyextra->yyLineNr,yytext);
}
Expand Down Expand Up @@ -3463,7 +3463,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
}
<Sharp>. { yyextra->current->type += *yytext ; }
<FindFields>{ID} {
if (Config_getBool(CLANG_ASSISTED_PARSING) && (yyextra->insideCpp || yyextra->insideObjC))
if (Doxygen::clangAssistedParsing && (yyextra->insideCpp || yyextra->insideObjC))
{
yyextra->current->id = ClangParser::instance()->lookup(yyextra->yyLineNr,yytext);
}
Expand Down Expand Up @@ -5334,7 +5334,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
}
<CompoundName>{SCOPENAME} {
yyextra->current->name = yytext ;
if (Config_getBool(CLANG_ASSISTED_PARSING) && (yyextra->insideCpp || yyextra->insideObjC))
if (Doxygen::clangAssistedParsing && (yyextra->insideCpp || yyextra->insideObjC))
{
yyextra->current->id = ClangParser::instance()->lookup(yyextra->yyLineNr,yytext);
}
Expand Down Expand Up @@ -5399,7 +5399,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
}
}
<ClassVar>{ID} {
if (Config_getBool(CLANG_ASSISTED_PARSING) && (yyextra->insideCpp || yyextra->insideObjC))
if (Doxygen::clangAssistedParsing && (yyextra->insideCpp || yyextra->insideObjC))
{
yyextra->current->id = ClangParser::instance()->lookup(yyextra->yyLineNr,yytext);
}
Expand Down Expand Up @@ -7255,19 +7255,15 @@ static void parseMain(yyscan_t yyscanner,
yyextra->yyBegColNr = 0;
yyextra->yyFileName = fileName;
setContext(yyscanner);
if (Config_getBool(CLANG_ASSISTED_PARSING))
if (Doxygen::clangAssistedParsing && (yyextra->insideCpp || yyextra->insideObjC))
{
bool processWithClang = yyextra->insideCpp || yyextra->insideObjC;
if (processWithClang)
if (!sameTranslationUnit) // new file
{
if (!sameTranslationUnit) // new file
{
ClangParser::instance()->start(fileName,filesInSameTranslationUnit);
}
else
{
ClangParser::instance()->switchToFile(fileName);
}
ClangParser::instance()->start(fileName,filesInSameTranslationUnit);
}
else
{
ClangParser::instance()->switchToFile(fileName);
}
}
rt->lang = yyextra->language;
Expand Down

0 comments on commit 3e9d938

Please sign in to comment.