rsmith added inline comments.

================
Comment at: lib/Sema/SemaDecl.cpp:6437-6445
@@ +6436,11 @@
+      // Warn immediately if -Wshadow-field-in-constructor is set.
+      Diag(R.getNameLoc(), diag::warn_ctor_parm_shadows_field)
+          << D << FD << FD->getParent();
+      Diag(FD->getLocation(), diag::note_previous_declaration);
+      // Remember that this was shadowed so we can warn later if it is
+      // modified.
+      ShadowingDecls.insert({D, FD});
+      return;
+    }
+  }
+
----------------
Here's what I was thinking:

 * The new warning goes in its own group, say 
`-Wshadow-field-in-constructor-modified`
 * The new warning group is part of both `-Wshadow` and 
`-Wshadow-field-in-constructor`
 * We produce the `-Wshadow-field-in-constructor` warning from `ActOnPopScope` 
whenever we remove something from the map.

This means that our behavior is as if `-W` flags filter our warning output, and 
we only get one warning for each instance of shadowing, and 
`-Wshadow-field-in-constructor` can be used to control all 
constructor-parameter-shadows-field warnings (and even obscure cases like 
`-Wshadow -Wno-shadow-field-in-constructor` do what they look like they should 
do).


http://reviews.llvm.org/D18271



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to