[PATCH] D50905: [analyzer][UninitializedObjectChecker][WIP] Explicit namespace resolution for inherited data members
Umann Kristóf via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 17 08:58:04 PDT 2018
Szelethus created this revision.
Szelethus added reviewers: NoQ, george.karpenkov, xazax.hun, rnkovacs.
Herald added subscribers: cfe-commits, mikhail.ramalho, a.sidorin, szepet, whisperity.
For the following example:
struct Base {
int x;
};
// In a different translation unit
struct Derived : public Base {
Derived() {}
};
For a call to `Derived::Derived()`, we'll receive a note that `this->x` is uninitialized. Since `x` is not a direct field of `Derived`, it could be a little confusing. This patch aims to fix this, we well as the case when the derived object has a field that has the name as an inherited uninitialized data member:
struct Base {
int x; // note: uninitialized field 'this->Base::x'
};
struct Derived : public Base {
int x = 5;
Derived() {}
};
This patch is also meant as a conversation starter, as the way base classes were handled has been long debated.
Repository:
rC Clang
https://reviews.llvm.org/D50905
Files:
lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObject.h
lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObjectChecker.cpp
test/Analysis/cxx-uninitialized-object-inheritance.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50905.161271.patch
Type: text/x-patch
Size: 9473 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180817/34595261/attachment.bin>
More information about the cfe-commits
mailing list