From f1e67d75fc922ff905de9faa6326bb1a96685ec1 Mon Sep 17 00:00:00 2001 From: Jordan Rose Date: Wed, 17 Oct 2012 19:35:37 +0000 Subject: [analyzer] Create a temporary region when accessing a struct rvalue. In C++, rvalues that need to have their address taken (for example, to be passed to a function by const reference) will be wrapped in a MaterializeTemporaryExpr, which lets CodeGen know to create a temporary region to store this value. However, MaterializeTemporaryExprs are /not/ created when a method is called on an rvalue struct, even though the 'this' pointer needs a valid value. CodeGen works around this by creating a temporary region anyway; now, so does the analyzer. The analyzer also does this when accessing a field of a struct rvalue. This is a little unfortunate, since the rest of the struct will soon be thrown away, but it does make things consistent with the rest of the analyzer. This allows us to bring back the assumption that all known 'this' values are Locs. This is a revised version of r164828-9, reverted in r164876-7. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166120 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Analysis/reference.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'test/Analysis/reference.cpp') diff --git a/test/Analysis/reference.cpp b/test/Analysis/reference.cpp index 374f3f7261..ce0ee8ed57 100644 --- a/test/Analysis/reference.cpp +++ b/test/Analysis/reference.cpp @@ -116,10 +116,8 @@ void testReferenceAddress(int &x) { struct S { int &x; }; - // FIXME: Should be TRUE. Fields of return-by-value structs are not yet - // symbolicated. Tracked by . extern S getS(); - clang_analyzer_eval(&getS().x != 0); // expected-warning{{UNKNOWN}} + clang_analyzer_eval(&getS().x != 0); // expected-warning{{TRUE}} extern S *getSP(); clang_analyzer_eval(&getSP()->x != 0); // expected-warning{{TRUE}} -- cgit v1.2.3-18-g5258