The idea came from both @george.karpenkov (D45532#1145592) and from bugzilla (https://bugs.llvm.org/show_bug.cgi?id=37965).
Assigning an object with uninitialized value to a pointer/reference could be intentional, especially if one writes a class that just initializes values.
struct Initializer {
int *a;
void initialize(/* ... */) {
a = /* ... */;
}
Initializer(int *a) : a(a) {}
};
void f() {
int b;
Initializer init(&b);
// ...
init.initialize(/* ... */);
}I actually have seen some examples for this in LLVM. While I absolutely agree that a flag like this would be neat, I also think that it should be disabled by default, as for example some objects are only created with malloc/new, and because I didn't find this functionality to be too noisy.
The comment is outdated and "true" should be switched to "false", right?