Skip to content

Commit 595195e

Browse files
authored
[WebKit checkers] Treat an implicit value initialization as trivial (llvm#126203)
Implicit value initialization is trivial for our purposes.
1 parent c9f1d2c commit 595195e

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -636,6 +636,11 @@ class TrivialFunctionAnalysisVisitor
636636
return true;
637637
}
638638

639+
bool VisitImplicitValueInitExpr(const ImplicitValueInitExpr *IVIE) {
640+
// An implicit value initialization is trvial.
641+
return true;
642+
}
643+
639644
private:
640645
CacheTy &Cache;
641646
CacheTy RecursiveFn;

clang/test/Analysis/Checkers/WebKit/uncounted-obj-arg.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,11 @@ class RefCounted {
368368
}
369369
RefPtr<RefCounted> trivial66() { return children[0]; }
370370
Ref<RefCounted> trivial67() { return *children[0]; }
371+
struct point {
372+
double x;
373+
double y;
374+
};
375+
void trivial68() { point pt = { 1.0 }; }
371376

372377
static RefCounted& singleton() {
373378
static RefCounted s_RefCounted;
@@ -554,6 +559,7 @@ class UnrelatedClass {
554559
getFieldTrivial().trivial65(); // no-warning
555560
getFieldTrivial().trivial66()->trivial6(); // no-warning
556561
getFieldTrivial().trivial67()->trivial6(); // no-warning
562+
getFieldTrivial().trivial68(); // no-warning
557563

558564
RefCounted::singleton().trivial18(); // no-warning
559565
RefCounted::singleton().someFunction(); // no-warning

0 commit comments

Comments
 (0)