]> granicus.if.org Git - clang/commit
During cross field uninitialized checking, when processing an assignment,
authorRichard Trieu <rtrieu@google.com>
Thu, 28 Aug 2014 03:23:47 +0000 (03:23 +0000)
committerRichard Trieu <rtrieu@google.com>
Thu, 28 Aug 2014 03:23:47 +0000 (03:23 +0000)
commit9dfdd2d2a9e511caf339340d5596f2a6ce6c97ad
tree13c3529fd78e3ae963f648501f36e300db4e9f05
parent6af28e5566ee645400c581673544554bda5d1d48
During cross field uninitialized checking, when processing an assignment,
don't mark the field as initialized until the next initializer instead of
instantly.  Since this checker is AST based, statements are processed in tree
order instead of following code flow.  This can result in different warnings
from just reordering the code.  Also changed to use one checker per constructor
instead of creating a new checker per field.

class T {
  int x, y;

  // Already warns
  T(bool b) : x(!b ? (1 + y) : (y = 5)) {}

  // New warning added here, previously (1 + y) comes after (y = 5) in the AST
  // preventing the warning.
  T(bool b) : x(b ? (y = 5) : (1 + y)) {}

};

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216641 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Sema/SemaDeclCXX.cpp
test/SemaCXX/uninitialized.cpp