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
503503 return true ;
504504 }
505505
506+ bool VisitOffsetOfExpr (const OffsetOfExpr *OE) {
507+ // offsetof(T, D) is considered trivial.
508+ return true ;
509+ }
510+
506511 bool VisitCXXMemberCallExpr (const CXXMemberCallExpr *MCE) {
507512 if (!checkArguments (MCE))
508513 return false ;
Original file line number Diff line number Diff line change @@ -77,6 +77,8 @@ T&& forward(T& arg);
7777template <typename T>
7878T&& move( T&& t );
7979
80+ #define offsetof (t, d ) __builtin_offsetof(t, d)
81+
8082} // namespace std
8183
8284bool isMainThread ();
@@ -373,6 +375,7 @@ class RefCounted {
373375 double y;
374376 };
375377 void trivial68 () { point pt = { 1.0 }; }
378+ unsigned trivial69 () { return offsetof (RefCounted, children); }
376379
377380 static RefCounted& singleton () {
378381 static RefCounted s_RefCounted;
@@ -560,6 +563,7 @@ class UnrelatedClass {
560563 getFieldTrivial ().trivial66 ()->trivial6 (); // no-warning
561564 getFieldTrivial ().trivial67 ()->trivial6 (); // no-warning
562565 getFieldTrivial ().trivial68 (); // no-warning
566+ getFieldTrivial ().trivial69 (); // no-warning
563567
564568 RefCounted::singleton ().trivial18 (); // no-warning
565569 RefCounted::singleton ().someFunction (); // no-warning
You can’t perform that action at this time.
0 commit comments