NoQ added inline comments.

================
Comment at: clang/lib/Analysis/UnsafeBufferUsage.cpp:1478
+
+  struct CallableFinderCallback : MatchFinder::MatchCallback {
+    UnsafeBufferUsageHandler &Handler;
----------------
I think this entire matcher business can easily live in 
`AnalysisBasedWarnings::IssueWarnings(TU)`. Just because we're running at the 
end of TU, doesn't mean each warning will need to figure out how to traverse 
it. In our case the warning still acts on function-by-function basis, it just 
benefits from other functions being already parsed. I suspect that this is 
going to be the case for almost every other analysis-based warning we ever put 
there. So I think let's run the matcher once in `IssueWarnings(TU)` , for all 
warnings at once, and then invoke `void checkUnsafeBufferUsage(const Decl *D, 
...)` directly from inside it, just like we did before the patch. If we ever 
run into a warning that really needs a `TranslationUnitDecl`, we can always 
invoke it from outside the matcher.


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

https://reviews.llvm.org/D146342

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to