1 // RUN: %clang_analyze_cc1 -analyzer-checker=core,unix.MismatchedDeallocator -analyzer-output=text -verify %s 2 // RUN: %clang_analyze_cc1 -analyzer-checker=core,unix.MismatchedDeallocator -analyzer-output=plist %s -o %t.plist 3 // RUN: tail -n +11 %t.plist | %normalize_plist | diff -ub %S/copypaste/Inputs/expected-plists/MismatchedDeallocator-path-notes.cpp.plist - 4 5 void changePointee(int *p); 6 int *allocIntArray(unsigned c) { 7 return new int[c]; // expected-note {{Memory is allocated}} 8 } 9 void test() { 10 int *p = allocIntArray(1); // expected-note {{Calling 'allocIntArray'}} 11 // expected-note@-1 {{Returned allocated memory}} 12 changePointee(p); 13 delete p; // expected-warning {{Memory allocated by 'new[]' should be deallocated by 'delete[]', not 'delete'}} 14 // expected-note@-1 {{Memory allocated by 'new[]' should be deallocated by 'delete[]', not 'delete'}} 15 } 16