brintos

brintos / llvm-project-archived public Read only

0
0
Text · 853 B · 3517933 Raw
29 lines · cpp
1// RUN: %clang_analyze_cc1 -analyzer-checker=core,osx.coreFoundation.CFError \2// RUN:   -verify %s3 4typedef unsigned long size_t;5struct __CFError {};6typedef struct __CFError *CFErrorRef;7void *malloc(size_t);8 9class Foo {10public:11  Foo(CFErrorRef *error) {} // no-warning12 13  void operator delete(void *pointer, CFErrorRef *error) { // no-warning14    return;15  }16 17  void operator delete[](void *pointer, CFErrorRef *error) { // no-warning18    return;19  }20 21  // Check that we report warnings for operators when it can be useful22  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 well26void operator delete(void *pointer, CFErrorRef *error) { // no-warning27  return;28}29