[PATCH] D50892: [analyzer][UninitializedObjectChecker] Correct dynamic type is acquired for record pointees

Umann Kristóf via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 10 11:08:58 PDT 2018


Szelethus marked an inline comment as done.
Szelethus added inline comments.


================
Comment at: test/Analysis/cxx-uninitialized-object-inheritance.cpp:802
+struct DynTBase2 {
+  int x; // expected-note{{uninitialized field 'static_cast<struct DynTDerived2 *>(this->bptr)->DynTBase2::x'}}
+};
----------------
Szelethus wrote:
> NoQ wrote:
> > Szelethus wrote:
> > > NoQ wrote:
> > > > Mmm, what's the value of casting to derived type and then specifying that we access the field of the base type anyway? Isn't `this->bptr->x` exactly what the user needs to know(?)
> > > True, but it's a one tough job to write `this->bptr->x` here and also a correct note message for...
> > I guess don't try too hard, eg. say if it requires something of non-linear complexity it's probably not worth it (not because it'd be slow but because it'd be an indication that it might be not worth the effort).
> I actually invested some effort into this and I'm fairly certain I could pull it off with O(n) complexity, but I'll probably just place a TODO in the code for now, as I have other things I really want to get fixed first.
I think I'll leave this as is, it could be done, but it wouldn't be nice, and it wouldn't make anyone's life significantly easier. At least this report tells you the dynamic type of `this->bptr`, so I guess that's something.


https://reviews.llvm.org/D50892





More information about the cfe-commits mailing list