-
Notifications
You must be signed in to change notification settings - Fork 13.3k
[WebKit checkers] Treat an implicit value initialization as trivial #126203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Implicit value initialization is trivial for our purposes.
@llvm/pr-subscribers-clang-static-analyzer-1 @llvm/pr-subscribers-clang Author: Ryosuke Niwa (rniwa) ChangesImplicit value initialization is trivial for our purposes. Full diff: https://github.com/llvm/llvm-project/pull/126203.diff 2 Files Affected:
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
|
double x; | ||
double y; | ||
}; | ||
void trivial68() { point pt = { 1.0 }; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure how much this matters for the test, but doesn't this leave y
uninitialized?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It implicitly initializes y. That's what this bug is about. I wasn't recognizing that type of implicit initialization.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Thank you for the review! |
…lvm#126203) Implicit value initialization is trivial for our purposes.
…lvm#126203) Implicit value initialization is trivial for our purposes.
…lvm#126203) Implicit value initialization is trivial for our purposes.
…lvm#126203) Implicit value initialization is trivial for our purposes.
Implicit value initialization is trivial for our purposes.