The convenience function captures running the analysis and then collecting
diagnostics based on a Diagnoser object. This pattern is valuable to
clang-tidy checks which analyze a function at a time, though it could be more
generally useful for analysis clients.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h | ||
---|---|---|
245 | Can you document what the function signature for this should be? Also, I'm wondering if DiagnoserT even needs to be a template argument. Shouldn't the Diagnostic type be the only "variable" in the type of DiagnoserT? Or is it that you don't want to force the caller to pass a std::function for Diagnoser? In that case, you could consider `function_ref'. | |
246–247 | ||
260 | Does this need to be passed by non-const reference? std::function::operator() is const, so a const reference should be fine for that. Non-const reference looks like we might be assigning to the reference (which we aren't). | |
262–266 | ||
268–269 | Nit: Of the two variables Solver and SolverView, Solver sounds like the more canonical name and the one to "go for". Granted, this is a short function with little potential for confusion, but maybe call the unique pointer OwnedSolver (or similar) and the raw pointer Solver? This would also eliminate the "view", which to me sounds like there's more going on than just a simple pointer. | |
274–289 | ||
clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp | ||
95–98 | ||
101–103 | I think this gives us a stronger and more explicit check for little extra effort. |
This broke one of the builds.
https://lab.llvm.org/buildbot/#/builders/121/builds/32939/steps/4/logs/stdio.
Working on a fix now.
Can you document what the function signature for this should be?
Also, I'm wondering if DiagnoserT even needs to be a template argument. Shouldn't the Diagnostic type be the only "variable" in the type of DiagnoserT?
Or is it that you don't want to force the caller to pass a std::function for Diagnoser? In that case, you could consider `function_ref'.