ahmedasadi added inline comments.

================
Comment at: lib/Sema/SemaDecl.cpp:6753
     // the constructor initializes the field with the parameter.
-    if (isa<CXXConstructorDecl>(NewDC) && isa<ParmVarDecl>(D)) {
-      // Remember that this was shadowed so we can either warn about its
-      // modification or its existence depending on warning settings.
-      D = D->getCanonicalDecl();
-      ShadowingDecls.insert({D, FD});
-      return;
-    }
+    if (isa<CXXConstructorDecl>(NewDC))
+      if (ParmVarDecl* PVD = dyn_cast<ParmVarDecl>(D)) {
----------------
arphaman wrote:
> Why is the change to this `if` necessary? It doesn't seem that related to the 
> main change.
VarDecl overrides getCanonicalDecl() to return a VarDecl*. As the type of D was 
changed from VarDecl* to NamedDecl*,  getCanonicalDecl() now returns a 
NamedDecl*. 

I created a new ParmVarDecl variable so getCanonicalDecl() returns a VarDecl* 
which can be inserted into ShadowingDecls.

Perhaps it might be better to just cast D->getCanonicalDecl() to a VarDecl when 
inserting it into ShadowingDecls?


https://reviews.llvm.org/D31235



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

Reply via email to