]> granicus.if.org Git - clang/commit
[analyzer] Model trivial copy/move ctors with an aggregate bind.
authorJordan Rose <jordan_rose@apple.com>
Wed, 30 Jan 2013 18:16:06 +0000 (18:16 +0000)
committerJordan Rose <jordan_rose@apple.com>
Wed, 30 Jan 2013 18:16:06 +0000 (18:16 +0000)
commitbaa7ca1142990e1ad6d4e9d2c73adb749ff50789
tree453101a8e843fd9be1ec32b0ac255dcd7f3a834d
parent74149595de064572661d10f736c6cb2eda78db8d
[analyzer] Model trivial copy/move ctors with an aggregate bind.

This is faster for the analyzer to process than inlining the constructor
and performing a member-wise copy, and it also solves the problem of
warning when a partially-initialized POD struct is copied.

Before:
  CGPoint p;
  p.x = 0;
  CGPoint p2 = p; <-- assigned value is garbage or undefined

After:
  CGPoint p;
  p.x = 0;
  CGPoint p2 = p; // no-warning

This matches our behavior in C, where we don't see a field-by-field copy.

<rdar://problem/12305288>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173951 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
test/Analysis/ctor-inlining.mm
test/Analysis/temporaries.cpp