brintos

brintos / llvm-project-archived public Read only

0
0
Text · 871 B · 814ad3a Raw
16 lines · cpp
1// RUN: %clang_analyze_cc1 -analyzer-checker=core,unix.MismatchedDeallocator -analyzer-output=text -verify %s2// RUN: %clang_analyze_cc1 -analyzer-checker=core,unix.MismatchedDeallocator -analyzer-output=plist %s -o %t.plist3// RUN: tail -n +11 %t.plist | %normalize_plist | diff -ub %S/copypaste/Inputs/expected-plists/MismatchedDeallocator-path-notes.cpp.plist -4 5void changePointee(int *p);6int *allocIntArray(unsigned c) {7  return new int[c]; // expected-note {{Memory is allocated}}8}9void 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