[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / Analysis / NewDelete-path-notes.cpp
blob2837fd1951e23aa37809a9244c861a0d0de5b85b
1 // RUN: %clang_analyze_cc1 \
2 // RUN: -analyzer-checker=cplusplus.NewDelete,unix.Malloc \
3 // RUN: -analyzer-config add-pop-up-notes=false \
4 // RUN: -analyzer-output=text -verify %s
5 // RUN: %clang_analyze_cc1 \
6 // RUN: -analyzer-checker=cplusplus.NewDelete,unix.Malloc \
7 // RUN: -analyzer-config add-pop-up-notes=false \
8 // RUN: -analyzer-output=plist %s -o %t.plist
9 // RUN: %normalize_plist <%t.plist | diff -ub \
10 // RUN: %S/Inputs/expected-plists/NewDelete-path-notes.cpp.plist -
12 void test() {
13 int *p = new int;
14 // expected-note@-1 {{Memory is allocated}}
15 if (p) // expected-note {{Taking true branch}}
16 delete p;
17 // expected-note@-1 {{Memory is released}}
19 delete p; // expected-warning {{Attempt to free released memory}}
20 // expected-note@-1 {{Attempt to free released memory}}
23 struct Odd {
24 void kill() {
25 delete this; // expected-note {{Memory is released}}
29 void test(Odd *odd) {
30 odd->kill(); // expected-note{{Calling 'Odd::kill'}}
31 // expected-note@-1 {{Returning; memory was released}}
32 delete odd; // expected-warning {{Attempt to free released memory}}
33 // expected-note@-1 {{Attempt to free released memory}}