blob: 3517933f6bcc6c6a191959ccb8fd35035b6ebbf1 [file] [log] [blame]
Artem Dergachev9b1e4a82020-04-06 20:27:40 +03001// RUN: %clang_analyze_cc1 -analyzer-checker=core,osx.coreFoundation.CFError \
2// RUN: -verify %s
3
4typedef unsigned long size_t;
5struct __CFError {};
6typedef struct __CFError *CFErrorRef;
7void *malloc(size_t);
8
9class Foo {
10public:
11 Foo(CFErrorRef *error) {} // no-warning
12
13 void operator delete(void *pointer, CFErrorRef *error) { // no-warning
14 return;
15 }
16
17 void operator delete[](void *pointer, CFErrorRef *error) { // no-warning
18 return;
19 }
20
21 // Check that we report warnings for operators when it can be useful
22 void operator()(CFErrorRef *error) {} // expected-warning {{Function accepting CFErrorRef* should have a non-void return value to indicate whether or not an error occurred}}
23};
24
25// Check that global delete operator is not bothered as well
26void operator delete(void *pointer, CFErrorRef *error) { // no-warning
27 return;
28}