| 1 | // RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -analyzer-config suppress-c++-stdlib=false -verify %s |
| 2 | // RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -analyzer-config suppress-c++-stdlib=true -DSUPPRESSED=1 -verify %s |
| 3 | // RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -DSUPPRESSED=1 -verify %s |
| 4 | |
| 5 | #ifdef SUPPRESSED |
| 6 | // expected-no-diagnostics |
| 7 | #endif |
| 8 | |
| 9 | #include "../Inputs/system-header-simulator-cxx.h" |
| 10 | |
| 11 | void clang_analyzer_eval(bool); |
| 12 | |
| 13 | class C { |
| 14 | // The virtual function is to make C not trivially copy assignable so that we call the |
| 15 | // variant of std::copy() that does not defer to memmove(). |
| 16 | virtual int f(); |
| 17 | }; |
| 18 | |
| 19 | void testCopyNull(C *I, C *E) { |
| 20 | std::copy(I, E, (C *)0); |
| 21 | #ifndef SUPPRESSED |
| 22 | // expected-warning@../Inputs/system-header-simulator-cxx.h:677 {{Called C++ object pointer is null}} |
| 23 | #endif |
| 24 | } |
| 25 | |