diff options
author | Luca Di Sera <luca.disera@qt.io> | 2023-03-07 13:05:43 +0100 |
---|---|---|
committer | Luca Di Sera <luca.disera@qt.io> | 2023-03-07 13:46:29 +0000 |
commit | dc834493f634416021a2d70c044fffb88efd06da (patch) | |
tree | 3d3a49856f79f762ac8bd46ea06d501246629c0e /src/qdoc/clangcodeparser.cpp | |
parent | 571743a268bb404b88ed59232236b47c3a51d992 (diff) | |
download | qttools-dc834493f634416021a2d70c044fffb88efd06da.tar.gz |
QDoc: Remove `CodeParser::m_currentFile`
`CodeParser`, the base class for parsers of input source file in QDoc,
exposed an internal member that stored the path of the file that was
currently being parser by an instance of `CodeParser`.
The member was set when a new file was being parsed, and required to be
handled by all downstream parsers, both in setting and in clearing it at
the correct point.
Nonetheless, the member is generally unrequired and was indeed not used,
as the scope and usages of the path of a parsed file is well-defined and
limited during parsing.
The presence of the member is a source of bugs. Indeed, not all child
classes where correctly handling the lifetime of the member.
Further, it generally adds maintenance cost to the child classes and
hinders the creation of new derived classes as it increases the mental
load and implicit knowledge that is required to implement a
`CodeParser`.
Hence, the member and all references to it were removed in `CodeParser`
and its child classes; to simplify the codebase, remove unnecessary
state, avoid the additional classes of bugs that would exist if the
member was ever read and as the member represented dead code.
`CodeParser::currentFile`, a getter for `m_currentFile`, was removed as
a consequence of the member removal.
Change-Id: If5b5538d038a073d8288a644fe39d3dddc1d89c8
Reviewed-by: Topi Reiniƶ <topi.reinio@qt.io>
Diffstat (limited to 'src/qdoc/clangcodeparser.cpp')
-rw-r--r-- | src/qdoc/clangcodeparser.cpp | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/src/qdoc/clangcodeparser.cpp b/src/qdoc/clangcodeparser.cpp index ca8027909..163ce20f7 100644 --- a/src/qdoc/clangcodeparser.cpp +++ b/src/qdoc/clangcodeparser.cpp @@ -1538,7 +1538,6 @@ void ClangCodeParser::parseSourceFile(const Location & /*location*/, const QStri each source file. The word "source" here means cpp file. */ m_qdb->clearOpenNamespaces(); - m_currentFile = filePath; flags_ = static_cast<CXTranslationUnit_Flags>(CXTranslationUnit_Incomplete | CXTranslationUnit_SkipFunctionBodies | CXTranslationUnit_KeepGoing); |