explicit-suppression.cpp 875 B

123456789101112131415161718192021222324
  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. #ifdef SUPPRESSED
  5. // expected-no-diagnostics
  6. #endif
  7. #include "../Inputs/system-header-simulator-cxx.h"
  8. void clang_analyzer_eval(bool);
  9. class C {
  10. // The virtual function is to make C not trivially copy assignable so that we call the
  11. // variant of std::copy() that does not defer to memmove().
  12. virtual int f();
  13. };
  14. void testCopyNull(C *I, C *E) {
  15. std::copy(I, E, (C *)0);
  16. #ifndef SUPPRESSED
  17. // expected-warning@../Inputs/system-header-simulator-cxx.h:686 {{Called C++ object pointer is null}}
  18. #endif
  19. }