Add warning for c++ member variable shadowing

James Sun via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 24 14:36:36 PST 2017


Dear members

Here is a patch (attached) to create warnings where a member variable shadows the one in one of its inheriting classes. For cases where we really don't want to shadow member variables, e.g.

class a {
  int foo;
}

class b : a {
  int foo; // Generate a warning
}

This patch
(1) adds a member variable shadowing checking, and
(2) incorporates it to the unit tests.


Comments are welcome.

Thanks

James
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170124/6b489fdf/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: inheritance-shadow-warning.patch
Type: application/octet-stream
Size: 10218 bytes
Desc: inheritance-shadow-warning.patch
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170124/6b489fdf/attachment.obj>


More information about the cfe-commits mailing list