Remove Squid unused code (experimental)#8
Draft
Conversation
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.
| 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) { |
Author
There was a problem hiding this comment.
Particularly this excludes ecap from consideration.
| if (Result.SourceManager->isInSystemHeader(Begin)) | ||
| return; | ||
|
|
||
| if (!Result.SourceManager->isWrittenInMainFile(Begin)) |
Author
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.