https://github.com/rniwa created 
https://github.com/llvm/llvm-project/pull/126203

Implicit value initialization is trivial for our purposes.

>From 717eca92439705bd9f152631a0602fdb7df9413a Mon Sep 17 00:00:00 2001
From: Ryosuke Niwa <rn...@webkit.org>
Date: Fri, 7 Feb 2025 00:29:41 -0800
Subject: [PATCH] [WebKit checkers] Treat an implicit value initialization as
 trivial

Implicit value initialization is trivial for our purposes.
---
 .../StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp    | 5 +++++
 clang/test/Analysis/Checkers/WebKit/uncounted-obj-arg.cpp   | 6 ++++++
 2 files changed, 11 insertions(+)

diff --git a/clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp 
b/clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp
index 5487fea1b956c83..d40b4b4dbb5607a 100644
--- a/clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp
@@ -636,6 +636,11 @@ class TrivialFunctionAnalysisVisitor
     return true;
   }
 
+  bool VisitImplicitValueInitExpr(const ImplicitValueInitExpr *IVIE) {
+    // An implicit value initialization is trvial.
+    return true;
+  }
+
 private:
   CacheTy &Cache;
   CacheTy RecursiveFn;
diff --git a/clang/test/Analysis/Checkers/WebKit/uncounted-obj-arg.cpp 
b/clang/test/Analysis/Checkers/WebKit/uncounted-obj-arg.cpp
index d654d963a4faeff..ffeecbf87c4516f 100644
--- a/clang/test/Analysis/Checkers/WebKit/uncounted-obj-arg.cpp
+++ b/clang/test/Analysis/Checkers/WebKit/uncounted-obj-arg.cpp
@@ -368,6 +368,11 @@ class RefCounted {
   }
   RefPtr<RefCounted> trivial66() { return children[0]; }
   Ref<RefCounted> trivial67() { return *children[0]; }
+  struct point {
+    double x;
+    double y;
+  };
+  void trivial68() { point pt = { 1.0 }; }
 
   static RefCounted& singleton() {
     static RefCounted s_RefCounted;
@@ -554,6 +559,7 @@ class UnrelatedClass {
     getFieldTrivial().trivial65(); // no-warning
     getFieldTrivial().trivial66()->trivial6(); // no-warning
     getFieldTrivial().trivial67()->trivial6(); // no-warning
+    getFieldTrivial().trivial68(); // no-warning
 
     RefCounted::singleton().trivial18(); // no-warning
     RefCounted::singleton().someFunction(); // no-warning

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

Reply via email to