[PATCH] D46441: [clang][CodeGenCXX] Noalias attr for 'this' parameter

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Oct 7 21:06:54 PDT 2018


rjmccall added inline comments.


================
Comment at: lib/CodeGen/CGCall.cpp:1893
+
+    IsCtor = isa<CXXConstructorDecl>(TargetDecl);
   }
----------------
AntonBikineev wrote:
> rjmccall wrote:
> > I feel like you should just use `TargetDecl && isa<CXXConstructorDecl>(TargetDecl)` below; it's more obvious.
> > 
> > Is there not an analogous rule for destructors?
> There appears to be no similar rule for destructors, maybe because at the point of calling a destructor the value of the object/subobjects is well-determined.
That's a good point, although there's certainly a point during the destructor's execution that that's no longer true.


================
Comment at: lib/CodeGen/CGCall.cpp:2049
+        // from the constructor’s this pointer, the value of the object or
+        // subobject thus obtained is unspecified.
+        unsigned ThisIRArg, NumIRArgs;
----------------
You probably ought to add here that we're treating this as undefined behavior and have recommended the standard be changed.


https://reviews.llvm.org/D46441





More information about the cfe-commits mailing list