Add warning for c++ member variable shadowing

James Sun via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 24 16:06:49 PST 2017


Coding style change

From: James Sun <jamessun at fb.com>
Date: Tuesday, January 24, 2017 at 2:36 PM
To: "cfe-commits at lists.llvm.org" <cfe-commits at lists.llvm.org>
Subject: Add warning for c++ member variable shadowing

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/20170125/155e597b/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: inheritance-shadow-warning-v0.2.patch
Type: application/octet-stream
Size: 10046 bytes
Desc: inheritance-shadow-warning-v0.2.patch
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170125/155e597b/attachment-0001.obj>


More information about the cfe-commits mailing list