1184c6242SDominic Chen // RUN: %clang_analyze_cc1 -analyzer-checker=core,unix.MismatchedDeallocator -analyzer-output=text -verify %s 239165091SGeorge Karpenkov // RUN: %clang_analyze_cc1 -analyzer-checker=core,unix.MismatchedDeallocator -analyzer-output=plist %s -o %t.plist 3*61c848d2SHubert Tong // RUN: tail -n +11 %t.plist | %normalize_plist | diff -ub %S/copypaste/Inputs/expected-plists/MismatchedDeallocator-path-notes.cpp.plist - 4f0593d67SAnton Yartsev 593a21a8cSAnna Zaks void changePointee(int *p); allocIntArray(unsigned c)6e5768d17SIsmail Pazarbasiint *allocIntArray(unsigned c) { 7e5768d17SIsmail Pazarbasi return new int[c]; // expected-note {{Memory is allocated}} 8e5768d17SIsmail Pazarbasi } test()9f0593d67SAnton Yartsevvoid test() { 10e5768d17SIsmail Pazarbasi int *p = allocIntArray(1); // expected-note {{Calling 'allocIntArray'}} 11e5768d17SIsmail Pazarbasi // expected-note@-1 {{Returned allocated memory}} 1293a21a8cSAnna Zaks changePointee(p); 13f0593d67SAnton Yartsev delete p; // expected-warning {{Memory allocated by 'new[]' should be deallocated by 'delete[]', not 'delete'}} 14f0593d67SAnton Yartsev // expected-note@-1 {{Memory allocated by 'new[]' should be deallocated by 'delete[]', not 'delete'}} 15f0593d67SAnton Yartsev } 16