brunodf added inline comments.

================
Comment at: lib/CodeGen/CGClass.cpp:2025
+    ThisPtr =
+        Builder.CreatePointerBitCastOrAddrSpaceCast(This.getPointer(), 
NewType);
   }
----------------
rjmccall wrote:
> Anastasia wrote:
> > I am a bit unsure if `performAddrSpaceCast` should be used, but considering 
> > that we know that we are not casting a constant it should be fine?
> > 
> > If not any suggestions how to propagate `LangAS` of 'this' here. Some 
> > thoughts I have are:
> > - Try to list the conversion up in the call stack
> > - Pass `LangAS` all the way to here
> I feel like `This` should just be in the right address space for the 
> constructor at the point `EmitCXXConstructorCall` is called.  We don't expect 
> this function to do any other semantic conversions.  Or is this necessary to 
> handle special-case use of things like trivial default / copy constructors?
Where could the conversion of `this` be listed in the clang AST? `this` seems 
implicit there.

Passing along `LangAS` seems to have some precedent. `EmitCXXConstructExpr` 
(which calls `EmitCXXConstructorCall`) works on `AggValueSlot` which carries 
the original qualifiers. Currently not yet used for address space (but this 
seems similar to me):

```
  /// \param quals - The qualifiers that dictate how the slot should
  /// be initialied. Only 'volatile' and the Objective-C lifetime
  /// qualifiers matter.
```



CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59988/new/

https://reviews.llvm.org/D59988



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

Reply via email to