diff options
author | Kristof Umann <dkszelethus@gmail.com> | 2018-08-08 12:23:02 +0000 |
---|---|---|
committer | Kristof Umann <dkszelethus@gmail.com> | 2018-08-08 12:23:02 +0000 |
commit | 0735cfbd84b29a8348158fe7ae7d1e7375092c94 (patch) | |
tree | 9416884d6447cf617309ed735509837d072b578a /clang/test/Analysis/cxx-uninitialized-object.cpp | |
parent | 920a4534854f52657ec1c638f5378d8846a3d4c3 (diff) | |
download | bcm5719-llvm-0735cfbd84b29a8348158fe7ae7d1e7375092c94.tar.gz bcm5719-llvm-0735cfbd84b29a8348158fe7ae7d1e7375092c94.zip |
[analyzer][UninitializedObjectChecker] Fixed a false negative by no longer filtering out certain constructor calls
As of now, all constructor calls are ignored that are being called
by a constructor. The point of this was not to analyze the fields
of an object, so an uninitialized field wouldn't be reported
multiple times.
This however introduced false negatives when the two constructors
were in no relation to one another -- see the test file for a neat
example for this with singletons. This patch aims so fix this issue.
Differential Revision: https://reviews.llvm.org/D48436
llvm-svn: 339237
Diffstat (limited to 'clang/test/Analysis/cxx-uninitialized-object.cpp')
-rw-r--r-- | clang/test/Analysis/cxx-uninitialized-object.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/clang/test/Analysis/cxx-uninitialized-object.cpp b/clang/test/Analysis/cxx-uninitialized-object.cpp index 0c5c1c246c4..4fc455fea8a 100644 --- a/clang/test/Analysis/cxx-uninitialized-object.cpp +++ b/clang/test/Analysis/cxx-uninitialized-object.cpp @@ -1040,13 +1040,12 @@ void assert(int b) { // While a singleton would make more sense as a static variable, that would zero // initialize all of its fields, hence the not too practical implementation. struct Singleton { - // TODO: we'd expect the note: {{uninitialized field 'this->i'}} - int i; // no-note + int i; // expected-note{{uninitialized field 'this->i'}} + int dontGetFilteredByNonPedanticMode = 0; Singleton() { assert(!isInstantiated); - // TODO: we'd expect the warning: {{1 uninitialized field}} - isInstantiated = true; // no-warning + isInstantiated = true; // expected-warning{{1 uninitialized field}} } ~Singleton() { |