From 5923cbd27be7e70b875b1ff38fa04f24258e73e2 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Wed, 14 Mar 2012 18:01:43 +0000 Subject: [Analyser] Remove unnecessary recursive visits for ExprWithCleanups and MaterializeTemporaryExpr. llvm-svn: 152730 --- clang/test/Analysis/nullptr.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'clang/test/Analysis/nullptr.cpp') 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; +} -- cgit v1.2.3