mirror of
https://github.com/Gericom/teak-llvm.git
synced 2025-06-21 12:35:47 -04:00

Following r363007, which reverted r362998, r362996, and r362994, reapply with adjustments for the CRLF differences encountered with Windows. Namely, the `-b` option of `diff` is employed, and the `grep` patterns have `$` replaced with `[[:space:]]*$`. llvm-svn: 363069
16 lines
871 B
C++
16 lines
871 B
C++
// RUN: %clang_analyze_cc1 -analyzer-checker=core,unix.MismatchedDeallocator -analyzer-output=text -verify %s
|
|
// RUN: %clang_analyze_cc1 -analyzer-checker=core,unix.MismatchedDeallocator -analyzer-output=plist %s -o %t.plist
|
|
// RUN: tail -n +11 %t.plist | %normalize_plist | diff -ub %S/copypaste/Inputs/expected-plists/MismatchedDeallocator-path-notes.cpp.plist -
|
|
|
|
void changePointee(int *p);
|
|
int *allocIntArray(unsigned c) {
|
|
return new int[c]; // expected-note {{Memory is allocated}}
|
|
}
|
|
void test() {
|
|
int *p = allocIntArray(1); // expected-note {{Calling 'allocIntArray'}}
|
|
// expected-note@-1 {{Returned allocated memory}}
|
|
changePointee(p);
|
|
delete p; // expected-warning {{Memory allocated by 'new[]' should be deallocated by 'delete[]', not 'delete'}}
|
|
// expected-note@-1 {{Memory allocated by 'new[]' should be deallocated by 'delete[]', not 'delete'}}
|
|
}
|