aboutsummaryrefslogtreecommitdiff
path: root/test/Analysis/nullptr.cpp
diff options
context:
space:
mode:
authorErik Verbruggen <erikjv@me.com>2012-03-14 18:01:43 +0000
committerErik Verbruggen <erikjv@me.com>2012-03-14 18:01:43 +0000
commite711d7e7875920fee4180a26bfc67d67f0f71a2c (patch)
tree59980a6ec044aa85c32a42b94898bb882d12686d /test/Analysis/nullptr.cpp
parent72ff6bb6f61e39b62e000d90244ae7181b5bc33e (diff)
[Analyser] Remove unnecessary recursive visits for ExprWithCleanups and
MaterializeTemporaryExpr. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152730 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Analysis/nullptr.cpp')
-rw-r--r--test/Analysis/nullptr.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/Analysis/nullptr.cpp b/test/Analysis/nullptr.cpp
index 3f2bac11c2..c0fed87242 100644
--- a/test/Analysis/nullptr.cpp
+++ b/test/Analysis/nullptr.cpp
@@ -59,3 +59,25 @@ void zoo2() {
:"0"(*b) // expected-warning{{Dereference of null pointer}}
);
}
+
+int exprWithCleanups() {
+ struct S {
+ S(int a):a(a){}
+ ~S() {}
+
+ int a;
+ };
+
+ int *x = 0;
+ return S(*x).a; // expected-warning{{Dereference of null pointer}}
+}
+
+int materializeTempExpr() {
+ int *n = 0;
+ struct S {
+ int a;
+ S(int i): a(i) {}
+ };
+ const S &s = S(*n); // expected-warning{{Dereference of null pointer}}
+ return s.a;
+}