[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / Analysis / rvo.cpp
blob7215fbbded4610d9e8edc4c6415b16c8edbbefec
1 // RUN: %clang_analyze_cc1 -analyzer-checker core,cplusplus -std=c++14 \
2 // RUN: -analyzer-checker debug.ExprInspection -verify %s
4 void clang_analyzer_eval(bool);
6 struct A {
7 int x;
8 };
10 A getA();
12 struct B {
13 int *p;
14 A a;
16 B(int *p) : p(p), a(getA()) {}
19 void foo() {
20 B b1(nullptr);
21 clang_analyzer_eval(b1.p == nullptr); // expected-warning{{TRUE}}
22 B b2(new int); // No leak yet!
23 clang_analyzer_eval(b2.p == nullptr); // expected-warning{{FALSE}}
24 // expected-warning@-1{{Potential leak of memory pointed to by 'b2.p'}}