Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp | ||
---|---|---|
61 | A comma-separated list of regexes to match against suffix of a header, and disable analysis if matched. | |
161–162 | we actually want to perform filtering inside analyze. it's not enough to filter only when printing, we should also filter before applying fixes :D. but we should also be applying filtering to absolute paths in all cases, for missing includes this is being applied to spelling instead. | |
162 | erroring out only after we performed all of our analysis and build a TU feels unfortunate. can we build these regexes and verify them at main and pass onto action instead? (in case the action is run on multiple files at once, we shouldn't compile/verify regexes over and over again) |
clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp | ||
---|---|---|
161–162 | oops, good catch. Added an actual --edit test. |
clang-tools-extra/include-cleaner/include/clang-include-cleaner/Analysis.h | ||
---|---|---|
67–68 | can you add some comments about how header filter works? A predicate that receives absolute path or spelling without quotes/brackets, when a phyiscal file doesn't exist. No analysis will be performed for headers that satisfy the predicate. | |
72 | rather than a default here, can we just do no filtering when HeaderFilter is null ? | |
clang-tools-extra/include-cleaner/include/clang-include-cleaner/Types.h | ||
137 | again some comments here could be useful | |
clang-tools-extra/include-cleaner/lib/Analysis.cpp | ||
65 | can you drop Path or put it in comments | |
clang-tools-extra/include-cleaner/test/tool.cpp | ||
17 | can you ignore one but keep other? it'd be useful to also test the regex behaviour | |
clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp | ||
112 | same as above, can you either drop or comment out Path | |
119 | same here for Path | |
172 | nit: braces | |
263 | nit: might be better to extract this into a function like: std::function<bool(StringRef)> headerFilter() { /* parses flags, returns a null function on failure */ } | |
265 | s/KeepEmpty/KeepEmpty=/ |
clang-tools-extra/include-cleaner/test/tool.cpp | ||
---|---|---|
17 | this tests aims to test filtering logic for both missing-includes and unused-includes cases. added a new test. |
clang-tools-extra/include-cleaner/include/clang-include-cleaner/Types.h | ||
---|---|---|
138 | i think name and the comment are somewhat confusing, what about: /// Absolute path for the header, when it's a physical file. Otherwise just the spelling without surrounding quotes/brackets. | |
clang-tools-extra/include-cleaner/lib/Analysis.cpp | ||
84 | nit: rather than checking this at every use, might be easier to have something like: if (!HeaderFilter) HeaderFilter = +[](llvm::StringRef) { return false; }; | |
clang-tools-extra/include-cleaner/test/tool.cpp | ||
17 | we're still lacking a test for regex behaviour, maybe change next one to foob.*\.h ? | |
clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp | ||
221 | nit: Drop Path | |
240 | FilterRegs=std::move(FilterRegs) and drop the shared_ptr? | |
241 | looks like debugging artifact |
clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp | ||
---|---|---|
240 | This was my first attempt, it didn't work, we're returning a lamdba function, which invokes a delete constructor of llvm::Regex. |
can you add some comments about how header filter works? A predicate that receives absolute path or spelling without quotes/brackets, when a phyiscal file doesn't exist. No analysis will be performed for headers that satisfy the predicate.