File tree Expand file tree Collapse file tree 3 files changed +47
-1
lines changed
lib/StaticAnalyzer/Checkers/WebKit
test/Analysis/Checkers/WebKit Expand file tree Collapse file tree 3 files changed +47
-1
lines changed Original file line number Diff line number Diff line change @@ -414,7 +414,8 @@ class TrivialFunctionAnalysisVisitor
414414 Name == " isMainThreadOrGCThread" || Name == " isMainRunLoop" ||
415415 Name == " isWebThread" || Name == " isUIThread" ||
416416 Name == " mayBeGCThread" || Name == " compilerFenceForCrash" ||
417- Name == " bitwise_cast" || Name.find (" __builtin" ) == 0 )
417+ Name == " bitwise_cast" || Name.find (" __builtin" ) == 0 ||
418+ Name == " __libcpp_verbose_abort" )
418419 return true ;
419420
420421 return IsFunctionTrivial (Callee);
Original file line number Diff line number Diff line change 1+ // RUN: %clang_analyze_cc1 -analyzer-checker=alpha.webkit.UncountedCallArgsChecker -verify %s
2+ // expected-no-diagnostics
3+
4+ #include " mock-types.h"
5+
6+ void __libcpp_verbose_abort (const char *__format, ...);
7+
8+ using size_t = __typeof(sizeof (int ));
9+ namespace std {
10+ template <class T , size_t N>
11+ class array {
12+ T elements[N];
13+
14+ public:
15+ T& operator [](unsigned i) {
16+ if (i >= N) {
17+ __libcpp_verbose_abort (" %s" , " aborting" );
18+ }
19+ return elements[i];
20+ }
21+ };
22+ }
23+
24+ class ArrayClass {
25+ public:
26+ void ref () const ;
27+ void deref () const ;
28+ typedef std::array<std::array<double , 4 >, 4 > Matrix;
29+ double e () { return matrix[3 ][0 ]; }
30+ Matrix matrix;
31+ };
32+
33+ class AnotherClass {
34+ RefPtr<ArrayClass> matrix;
35+ void test () {
36+ double val = { matrix->e ()};
37+ }
38+ };
39+
Original file line number Diff line number Diff line change @@ -238,6 +238,8 @@ class SomeType : public BaseType {
238238 using BaseType::BaseType;
239239};
240240
241+ void __libcpp_verbose_abort (const char *__format, ...);
242+
241243class RefCounted {
242244public:
243245 void ref () const ;
@@ -361,6 +363,9 @@ class RefCounted {
361363 void trivial62 () { WTFReportBacktrace (); }
362364 SomeType trivial63 () { return SomeType (0 ); }
363365 SomeType trivial64 () { return SomeType (); }
366+ void trivial65 () {
367+ __libcpp_verbose_abort (" %s" , " aborting" );
368+ }
364369
365370 static RefCounted& singleton () {
366371 static RefCounted s_RefCounted;
@@ -544,6 +549,7 @@ class UnrelatedClass {
544549 getFieldTrivial ().trivial62 (); // no-warning
545550 getFieldTrivial ().trivial63 (); // no-warning
546551 getFieldTrivial ().trivial64 (); // no-warning
552+ getFieldTrivial ().trivial65 (); // no-warning
547553
548554 RefCounted::singleton ().trivial18 (); // no-warning
549555 RefCounted::singleton ().someFunction (); // no-warning
You can’t perform that action at this time.
0 commit comments