]> granicus.if.org Git - clang/commit
[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)
commit6402a97d5b74108b300f5833af0b85b3d4c5d6b6
treed8cbd3c62fb05b37fada65472a1f9b6d48507eb4
parent07caa7f2a1dae8d2569ec59a2f6785ad5d4ea3d9
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@334935 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/StaticAnalyzer/Checkers/Checkers.td
lib/StaticAnalyzer/Checkers/CMakeLists.txt
lib/StaticAnalyzer/Checkers/UninitializedObjectChecker.cpp [new file with mode: 0644]
test/Analysis/Inputs/system-header-simulator-for-cxx-uninitialized-object.h [new file with mode: 0644]
test/Analysis/cxx-uninitialized-object-inheritance.cpp [new file with mode: 0644]
test/Analysis/cxx-uninitialized-object-ptr-ref.cpp [new file with mode: 0644]
test/Analysis/cxx-uninitialized-object.cpp [new file with mode: 0644]