[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
diff --git a/test/Analysis/nullptr.cpp b/test/Analysis/nullptr.cpp
index 3f2bac1..c0fed87 100644
--- a/test/Analysis/nullptr.cpp
+++ b/test/Analysis/nullptr.cpp
@@ -59,3 +59,25 @@
:"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;
+}