[clang] WebKit Checkers should set DeclWithIssue. (PR #109389)

Artem Dergachev via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 25 14:02:34 PDT 2024


================
@@ -134,18 +135,25 @@ class UncountedLocalVarsChecker
       bool shouldVisitTemplateInstantiations() const { return true; }
       bool shouldVisitImplicitCode() const { return false; }
 
+      bool TraverseDecl(Decl *D) {
+        llvm::SaveAndRestore SavedDecl(DeclWithIssue);
+        if (D && isa<FunctionDecl>(D))
----------------
haoNoQ wrote:

You can avoid this if-statement by overriding the `TraverseFunctionDecl` method instead.

Though, on the other hand, you might want to include `ObjCMethodDecl` too, in case you run into any ObjC code. (It doesn't inherit from `FunctionDecl`.) Which is slightly less convenient to do if you split it into `Traverse...` methods.

So ultimately up to you^^

https://github.com/llvm/llvm-project/pull/109389


More information about the cfe-commits mailing list