]> granicus.if.org Git - clang/commit
[analyzer] Fix FP warnings when binding a temporary to a local static variable
authorPavel Labath <labath@google.com>
Fri, 26 Jul 2013 11:50:42 +0000 (11:50 +0000)
committerPavel Labath <labath@google.com>
Fri, 26 Jul 2013 11:50:42 +0000 (11:50 +0000)
commit76b5dd48c9dbf2ed3e5830060ea55b81b7d1cca0
tree451ad493a8305c1aa1a96201b651c8439a2768ff
parentc0267f62a41df681d8ae5623f4053e52a5a5e516
[analyzer] Fix FP warnings when binding a temporary to a local static variable

Summary:
When binding a temporary object to a static local variable, the analyzer would
complain about a dangling reference even though the temporary's lifetime should
be extended past the end of the function. This commit tries to detect these
cases and construct them in a global memory region instead of a local one.

Reviewers: jordan_rose

CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D1133

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187196 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h
lib/StaticAnalyzer/Core/ExprEngine.cpp
lib/StaticAnalyzer/Core/MemRegion.cpp
test/Analysis/stack-addr-ps.cpp
test/Analysis/temporaries.cpp