Depens on D135953
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
sorry for the delay, just realize it is sitting in the review list, left some comments.
clang-tools-extra/include-cleaner/lib/Analysis.cpp | ||
---|---|---|
28 | nit: this name is similar to findHeaders (not sure this is intended), I'd rather use a different name (something like headersForSymbol) | |
44 | I agree the place here might be on a performance-critical path, but I think the idea of using cache probably needs some bits of design, the current implementation seems half baked (there is also a FIXME in the findAllHeaders saying we should implement another cache for it, so it is unclear to me what's the whole picture). Can we just leave out all cache in this patch with a FIXME? And having a follow-up patch for that? | |
46 | any reason not using llvm::DenseMap? | |
50 | nit: consider using structure binding to get rid of the Insert.first, Insert.second magic names. | |
clang-tools-extra/include-cleaner/unittests/AnalysisTest.cpp | ||
115–116 | it feels weird that all other tests are using WalkUsedTest, but not this one. The logic are mostly the same except that this test doesn't need to build the AST nodes, if we change offsetToProviders method to offset(llvm::ArrayRef<Decl*> TopLevelDecl, llvm::ArrayRef<SymbolReference> MacroRef, SourceManager &SM), I think we can use it in this test. |
- Address comments
clang-tools-extra/include-cleaner/lib/Analysis.cpp | ||
---|---|---|
44 | i agree that the cache for findHeaders is a bit more nuanced, as it'll need to have assumptions about a given SymbolLocation, no matter how/where it was acquired will return the same results. |
clang-tools-extra/include-cleaner/lib/Analysis.cpp | ||
---|---|---|
44 | I also think this needs a bit more examination. It seems cheap, but there are several overlapping concerns and addressing the first is always cheap but makes the others more expensive. e.g. here, it's not obvious which of these is most desirable and therefore should probably be done first:
I don't personally have a strong intuition of which of these steps should be cached for performance, if any of them will really matter, and whether we're better off caching end-to-end (cache a longer computation, lower hit-rate) vs individual steps (small computation, higher hit-rate). To me this seems premature without *at least* measuring that it improves performance, but ideally showing that it's better than caching at a different level. | |
clang-tools-extra/include-cleaner/test/html.cpp | ||
7 ↗ | (On Diff #480340) | I'd like to keep a very simple smoke test of the HTML report. If you're aiming to test something specific here about the HTML report, I'd suggest creating a new test describing what it is. (Though generally speaking, the HTML test has poor test coverage of its details, which I think is unfortunately the right tradeoff) If you're aiming to provide an integration test (these locations are taken into account in making overall decisions), I think this should be a test using -print=changes rather than -html. |
clang-tools-extra/include-cleaner/unittests/AnalysisTest.cpp | ||
61 | shouldn't we have a location filter for the decls, to simulate RecordAST? |
clang-tools-extra/include-cleaner/test/html.cpp | ||
---|---|---|
7 ↗ | (On Diff #480340) | thanks makes sense. print-changes didn't exist back in the day when i was putting together this patch and i forgot to update this piece. i wasn't trying to test HTMLReport behaviour specifically, and it's probably not worth adding that anyways. |
- Drop the cache
- Use -print=changes in lit test
- Update unittest helper to limit decls to main file
LG, thanks!
clang-tools-extra/include-cleaner/lib/Analysis.cpp | ||
---|---|---|
33 | nit: I think this would be better as a vaguer comment at a higher level (in walkUsed) like "it might be useful to cache some parts of this computation to save repeated work" | |
clang-tools-extra/include-cleaner/test/multiple-providers.cpp | ||
2 | nit: splitting RUN lines over lines makes copy/pasting/debugging lit tests harder and ends up being net-negative IMO. I've added a .clang-format file so that >80 col lines won't get split |
clang-tools-extra/include-cleaner/test/multiple-providers.cpp | ||
---|---|---|
2 | i also have some extra enforcement by my editor for line breaks :P. i didn't know copy pasting run lines were a workflow (because they usually have place holders one needs to change afterwards), i've always used the command line printed with the failing test. makes sense to keep it in a single line for people with such a workflow though. |
nit: this name is similar to findHeaders (not sure this is intended), I'd rather use a different name (something like headersForSymbol)