[PATCH] D122677: [prototype] include-cleaner library

Piotr Zegar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 9 08:18:04 PST 2023


PiotrZSL added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp:62
         "misc-unused-alias-decls");
+    CheckFactories.registerCheck<UnusedIncludesCheck>("misc-unused-includes");
     CheckFactories.registerCheck<UnusedParametersCheck>(
----------------
Missing tests & documentation for this check.


================
Comment at: clang-tools-extra/clang-tidy/misc/UnusedIncludesCheck.cpp:38
+  Finder->addMatcher(
+      translationUnitDecl(forEach(decl(isExpansionInMainFile()).bind("top"))),
+      this);
----------------
why not just:
```
Finder->addMatcher(decl(isExpansionInMainFile()).bind("top"))
```


================
Comment at: clang-tools-extra/clang-tidy/misc/UnusedIncludesCheck.h:35
+  std::unique_ptr<include_cleaner::RecordedPP> RecordedPP;
+  std::vector<Decl *> Top;
+};
----------------
There are going to be manny reallocations of this std::vector, we got manny declarations, consider using std::deque.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122677/new/

https://reviews.llvm.org/D122677



More information about the cfe-commits mailing list