File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed
lib/StaticAnalyzer/Checkers/WebKit
test/Analysis/Checkers/WebKit Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -503,6 +503,11 @@ class TrivialFunctionAnalysisVisitor
503
503
return true ;
504
504
}
505
505
506
+ bool VisitOffsetOfExpr (const OffsetOfExpr *OE) {
507
+ // offsetof(T, D) is considered trivial.
508
+ return true ;
509
+ }
510
+
506
511
bool VisitCXXMemberCallExpr (const CXXMemberCallExpr *MCE) {
507
512
if (!checkArguments (MCE))
508
513
return false ;
Original file line number Diff line number Diff line change @@ -77,6 +77,8 @@ T&& forward(T& arg);
77
77
template <typename T>
78
78
T&& move( T&& t );
79
79
80
+ #define offsetof (t, d ) __builtin_offsetof(t, d)
81
+
80
82
} // namespace std
81
83
82
84
bool isMainThread ();
@@ -373,6 +375,7 @@ class RefCounted {
373
375
double y;
374
376
};
375
377
void trivial68 () { point pt = { 1.0 }; }
378
+ unsigned trivial69 () { return offsetof (RefCounted, children); }
376
379
377
380
static RefCounted& singleton () {
378
381
static RefCounted s_RefCounted;
@@ -560,6 +563,7 @@ class UnrelatedClass {
560
563
getFieldTrivial ().trivial66 ()->trivial6 (); // no-warning
561
564
getFieldTrivial ().trivial67 ()->trivial6 (); // no-warning
562
565
getFieldTrivial ().trivial68 (); // no-warning
566
+ getFieldTrivial ().trivial69 (); // no-warning
563
567
564
568
RefCounted::singleton ().trivial18 (); // no-warning
565
569
RefCounted::singleton ().someFunction (); // no-warning
You can’t perform that action at this time.
0 commit comments