| 1 |
// RUN: %clang_analyze_cc1 -analyzer-checker=core,osx.coreFoundation.CFError \ |
| 2 |
// RUN: -verify %s |
| 3 |
|
| 4 |
typedef unsigned long size_t; |
| 5 |
struct __CFError {}; |
| 6 |
typedef struct __CFError *CFErrorRef; |
| 7 |
void *malloc(size_t); |
| 8 |
|
| 9 |
class Foo { |
| 10 |
public: |
| 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 |
| 26 |
void operator delete(void *pointer, CFErrorRef *error) { // no-warning |
| 27 |
return; |
| 28 |
} |