
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
19 lines
502 B
C++
19 lines
502 B
C++
// Like the compiler, the static analyzer treats some functions differently if
|
|
// they come from a system header -- for example, it is assumed that system
|
|
// functions do not arbitrarily free() their parameters, and that some bugs
|
|
// found in system headers cannot be fixed by the user and should be
|
|
// suppressed.
|
|
|
|
#pragma clang system_header
|
|
|
|
struct RecordInSystemHeader {
|
|
int a;
|
|
int b;
|
|
};
|
|
|
|
template <class T>
|
|
struct ContainerInSystemHeader {
|
|
T &t;
|
|
ContainerInSystemHeader(T& t) : t(t) {}
|
|
};
|