File tree 3 files changed +47
-1
lines changed
lib/StaticAnalyzer/Checkers/WebKit
test/Analysis/Checkers/WebKit
3 files changed +47
-1
lines changed Original file line number Diff line number Diff line change @@ -414,7 +414,8 @@ class TrivialFunctionAnalysisVisitor
414
414
Name == " isMainThreadOrGCThread" || Name == " isMainRunLoop" ||
415
415
Name == " isWebThread" || Name == " isUIThread" ||
416
416
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" )
418
419
return true ;
419
420
420
421
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 {
238
238
using BaseType::BaseType;
239
239
};
240
240
241
+ void __libcpp_verbose_abort (const char *__format, ...);
242
+
241
243
class RefCounted {
242
244
public:
243
245
void ref () const ;
@@ -361,6 +363,9 @@ class RefCounted {
361
363
void trivial62 () { WTFReportBacktrace (); }
362
364
SomeType trivial63 () { return SomeType (0 ); }
363
365
SomeType trivial64 () { return SomeType (); }
366
+ void trivial65 () {
367
+ __libcpp_verbose_abort (" %s" , " aborting" );
368
+ }
364
369
365
370
static RefCounted& singleton () {
366
371
static RefCounted s_RefCounted;
@@ -544,6 +549,7 @@ class UnrelatedClass {
544
549
getFieldTrivial ().trivial62 (); // no-warning
545
550
getFieldTrivial ().trivial63 (); // no-warning
546
551
getFieldTrivial ().trivial64 (); // no-warning
552
+ getFieldTrivial ().trivial65 (); // no-warning
547
553
548
554
RefCounted::singleton ().trivial18 (); // no-warning
549
555
RefCounted::singleton ().someFunction (); // no-warning
You can’t perform that action at this time.
0 commit comments