Skip to content

Commit

Permalink
CppCheckk: small refactoring in checkNormalTokens()
Browse files Browse the repository at this point in the history
  • Loading branch information
firewave committed Dec 14, 2023
1 parent 61bbcbe commit d427b7a
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions lib/cppcheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1097,25 +1097,23 @@ void CppCheck::checkNormalTokens(const Tokenizer &tokenizer)
if (mSettings.useSingleJob() || !mSettings.buildDir.empty()) {
// Analyse the tokens..

CTU::FileInfo *fi1 = CTU::getFileInfo(&tokenizer);
if (fi1) {
if (mSettings.useSingleJob())
mFileInfo.push_back(fi1);
if (CTU::FileInfo * const fi1 = CTU::getFileInfo(&tokenizer)) {
if (!mSettings.buildDir.empty())
mAnalyzerInformation.setFileInfo("ctu", fi1->toString());
if (mSettings.useSingleJob())
mFileInfo.push_back(fi1);
}

// cppcheck-suppress shadowFunction - TODO: fix this
for (const Check *check : Check::instances()) {
if (doUnusedFunctionOnly && dynamic_cast<const CheckUnusedFunctions*>(check) == nullptr)
continue;

Check::FileInfo *fi = check->getFileInfo(&tokenizer, &mSettings);
if (fi != nullptr) {
if (mSettings.useSingleJob())
mFileInfo.push_back(fi);
if (Check::FileInfo * const fi = check->getFileInfo(&tokenizer, &mSettings)) {
if (!mSettings.buildDir.empty())
mAnalyzerInformation.setFileInfo(check->name(), fi->toString());
if (mSettings.useSingleJob())
mFileInfo.push_back(fi);
}
}
}
Expand Down

0 comments on commit d427b7a

Please sign in to comment.