Skip to content

Remove Squid unused code (experimental)#8

Draft
eduard-bagdasaryan wants to merge 7 commits intoSQUID-1137-report-unused-declaration-definition-source-code-linesfrom
SQUID-1137-report-unused-declaration-definition-source-code-lines-test
Draft

Remove Squid unused code (experimental)#8
eduard-bagdasaryan wants to merge 7 commits intoSQUID-1137-report-unused-declaration-definition-source-code-linesfrom
SQUID-1137-report-unused-declaration-definition-source-code-lines-test

Conversation

@eduard-bagdasaryan
Copy link

This catch-all PR comprises all changes required to mark
unused code in Squid. Subsequently we would need to isolate
each self-contained fix/improvement into a separate PR branch.

Works with test-suite/remove-unused.pl of 0cadedf5.

This catch-all branch comprises all changes required to mark
unused code in Squid. Subsequently we would need to isolate
each self-contained fix/improvement into a separate PR branch.

Works with test-suite/remove-unused.pl of 0cadedf5.
@eduard-bagdasaryan eduard-bagdasaryan marked this pull request as draft February 12, 2026 11:46
std::set<std::string> librarySourceFiles;
for (auto &File : DB.getAllFiles()) {
for (const auto &Cmd : DB.getCompileCommands(File)) {
if (!Cmd.Output.empty() && Cmd.Output.find("_la-") != std::string::npos) {
Copy link
Author

Choose a reason for hiding this comment

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

Particularly this excludes ecap from consideration.

if (Result.SourceManager->isInSystemHeader(Begin))
return;

if (!Result.SourceManager->isWrittenInMainFile(Begin))
Copy link
Author

Choose a reason for hiding this comment

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

This check excluded header-defined functions.

Mark as used all class constructors, operators=
and destructor if any of them is used. This behavior
is controlled by "--special-members" option.
* addClassReference(): add only 'special' methods
* externalBase() check only project defitions/declarations
  (i.e., skip system classes).
This check should find only virtual overriden methods of
a class inherited from a library class (these methods are
ignored). All other methods of such class are handled as
usual. Adjusted the test to cover these two types of
methods.
TODO: mark other 'special' members, such as comparison operators.
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.

1 participant