Skip to content

Commit

Permalink
fixed #12839 - generate ctu-info files for FileSettings before ex…
Browse files Browse the repository at this point in the history
…ecuting whole program analysis for addons (danmar#6525)

Co-authored-by: dzid26 <[email protected]>
  • Loading branch information
firewave and dzid26 authored Jun 26, 2024
1 parent dadabbb commit 65517e1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
9 changes: 7 additions & 2 deletions lib/cppcheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1463,7 +1463,7 @@ void CppCheck::executeAddons(const std::vector<std::string>& files, const std::s
}
}

void CppCheck::executeAddonsWholeProgram(const std::list<FileWithDetails> &files)
void CppCheck::executeAddonsWholeProgram(const std::list<FileWithDetails> &files, const std::list<FileSettings>& fileSettings)
{
if (mSettings.addons.empty())
return;
Expand All @@ -1474,6 +1474,11 @@ void CppCheck::executeAddonsWholeProgram(const std::list<FileWithDetails> &files
ctuInfoFiles.push_back(getCtuInfoFileName(dumpFileName));
}

for (const auto &f: fileSettings) {
const std::string &dumpFileName = getDumpFileName(mSettings, f.filename());
ctuInfoFiles.push_back(getCtuInfoFileName(dumpFileName));
}

try {
executeAddons(ctuInfoFiles, "");
} catch (const InternalError& e) {
Expand Down Expand Up @@ -1779,7 +1784,7 @@ bool CppCheck::analyseWholeProgram()

unsigned int CppCheck::analyseWholeProgram(const std::string &buildDir, const std::list<FileWithDetails> &files, const std::list<FileSettings>& fileSettings)
{
executeAddonsWholeProgram(files); // TODO: pass FileSettings
executeAddonsWholeProgram(files, fileSettings);
if (buildDir.empty()) {
removeCtuInfoFiles(files, fileSettings);
return mExitCode;
Expand Down
2 changes: 1 addition & 1 deletion lib/cppcheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ class CPPCHECKLIB CppCheck : ErrorLogger {
/**
* Execute addons
*/
void executeAddonsWholeProgram(const std::list<FileWithDetails> &files);
void executeAddonsWholeProgram(const std::list<FileWithDetails> &files, const std::list<FileSettings>& fileSettings);

#ifdef HAVE_RULES
/**
Expand Down
1 change: 0 additions & 1 deletion test/cli/whole-program_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ def __test_addon_suppress_inline_project(tmpdir, extra_args):
assert ret == 0, stdout


@pytest.mark.xfail(strict=True)
def test_addon_suppress_inline_project(tmpdir):
__test_addon_suppress_inline_project(tmpdir, ['-j1'])

Expand Down

0 comments on commit 65517e1

Please sign in to comment.