Skip to content

Fix #13333 (better handling when source file is repeated in compile_commands.json) #7508

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
May 9, 2025

Conversation

danmar
Copy link
Owner

@danmar danmar commented May 4, 2025

No description provided.

@danmar
Copy link
Owner Author

danmar commented May 4, 2025

More tests are needed.. however when I run it manually I see improvement.

@danmar danmar changed the title add file index Fix #13333 (better handling when source file is repeated in compile_commands.json) May 5, 2025
@danmar danmar marked this pull request as ready for review May 5, 2025 09:13
@danmar danmar requested review from firewave and Copilot May 5, 2025 09:53
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR improves the handling of duplicate file entries in compile_commands.json (Fix #13333). Key changes include passing a new fileIndex parameter through various API functions and updating test cases to validate correct ordering and naming of duplicate files.

  • Updated file handling in Summaries, Tokenizer, AnalyzerInformation, and cppcheck to include a fileIndex.
  • New tests added in testimportproject.cpp, testanalyzerinformation.cpp, and dumpfile_test.py to verify duplicate file scenarios.

Reviewed Changes

Copilot reviewed 15 out of 16 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/testsummaries.cpp Adjusted Summaries::create call to pass a file index.
test/testimportproject.cpp Added support and tests for handling duplicate file entries.
test/testanalyzerinformation.cpp Updated analyzer information tests to check the new file index in file names.
test/cli/dumpfile_test.py Added new test to verify dump file naming for duplicate source files.
lib/tokenize.h/.cpp Updated simplifyTokens1 to accept a file index parameter.
lib/summaries.h/.cpp Propagated fileIndex parameter to create analyzer info filenames.
lib/importproject.cpp Integrated fileIndex mapping while importing compile commands.
lib/filesettings.h Introduced fileIndex member.
lib/cppcheck.h/.cpp Updated checkFile and checkClang functions to accept fileIndex.
lib/analyzerinfo.h/.cpp Modified analyzer info file creation and parsing to include fileIndex.
gui/checkthread.cpp Updated AnalyzerInformation call with the proper file index.
Files not reviewed (1)
  • Makefile: Language not supported

@danmar danmar merged commit b3c7f00 into danmar:main May 9, 2025
53 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants