summaryrefslogtreecommitdiffstats
path: root/clang/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
commit5923cbd27be7e70b875b1ff38fa04f24258e73e2 (patch)
tree8842601fcdd36220c5096a8fa119287e51fd4d44 /clang/test/Analysis/nullptr.cpp
parentd23e333bf6efb3e5952190f268d464f3795d939e (diff)
downloadbcm5719-llvm-5923cbd27be7e70b875b1ff38fa04f24258e73e2.tar.gz
bcm5719-llvm-5923cbd27be7e70b875b1ff38fa04f24258e73e2.zip
[Analyser] Remove unnecessary recursive visits for ExprWithCleanups and
MaterializeTemporaryExpr. llvm-svn: 152730
Diffstat (limited to 'clang/test/Analysis/nullptr.cpp')
-rw-r--r--clang/test/Analysis/nullptr.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/clang/test/Analysis/nullptr.cpp b/clang/test/Analysis/nullptr.cpp
index 3f2bac11c2b..c0fed872428 100644
--- a/clang/test/Analysis/nullptr.cpp
+++ b/clang/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;
+}
OpenPOWER on IntegriCloud