[analyzer] Checker for uninitialized C++ objects
authorKristof Umann <dkszelethus@gmail.com>
Mon, 18 Jun 2018 11:50:17 +0000 (11:50 +0000)
committerKristof Umann <dkszelethus@gmail.com>
Mon, 18 Jun 2018 11:50:17 +0000 (11:50 +0000)
commit30f086565c78f986cd462966c9f656331f2a5655
tree92095dd8ad24e43d331e3b8e4c987a56b949d959
parent99a58320167d06771659f8da3cd3f2b70b78395f
[analyzer] Checker for uninitialized C++ objects

This checker analyzes C++ constructor calls, and reports uninitialized fields.

Due to the nature of this problem (uninitialized fields after an object
construction), this checker doesn't search for bugs, but rather is a tool to
enforce a specific programming model where every field needs to be initialized.

This checker lands in alpha for now, and a number of followup patches will be
made to reduce false negatives and to make it easier for the user to understand
what rules the checker relies on, eg. whether a derived class' constructor is
responsible for initializing inherited data members or whether it should be
handled in the base class' constructor.

Differential Revision: https://reviews.llvm.org/D45532

llvm-svn: 334935
clang/include/clang/StaticAnalyzer/Checkers/Checkers.td
clang/lib/StaticAnalyzer/Checkers/CMakeLists.txt
clang/lib/StaticAnalyzer/Checkers/UninitializedObjectChecker.cpp [new file with mode: 0644]
clang/test/Analysis/Inputs/system-header-simulator-for-cxx-uninitialized-object.h [new file with mode: 0644]
clang/test/Analysis/cxx-uninitialized-object-inheritance.cpp [new file with mode: 0644]
clang/test/Analysis/cxx-uninitialized-object-ptr-ref.cpp [new file with mode: 0644]
clang/test/Analysis/cxx-uninitialized-object.cpp [new file with mode: 0644]