mjacob added inline comments.

================
Comment at: lib/Sema/SemaCast.cpp:1081-1083
@@ -1080,3 +1080,5 @@
           }
-          Kind = CK_BitCast;
+          unsigned SrcAS = SrcPointee.getAddressSpace();
+          unsigned DestAS = DestPointee.getAddressSpace();
+          Kind = SrcAS != DestAS ? CK_AddressSpaceConversion : CK_BitCast;
           return TC_Success;
----------------
rsmith wrote:
> I would expect to get both a `CK_BitCast` *and* a `CK_AddressSpaceCast` 
> created for this case. Note that by not returning `CK_BitCast`, you lose the 
> `checkCastAlign` call in the caller.
> 
> Instead, can you push this check down into wherever we're building the 
> conversion, so that if we try to create a `CK_BitCast` that crosses address 
> spaces, we additionally create a `CK_AddressSpaceCast`?
I'm not sure what you mean by "**additionally** create a 
`CK_AddressSpaceCast`". Please clarify.
Would it also be possible to extend all places which call `checkCastAlign()` to 
also call it for `CK_AddressSpaceCast`?


http://reviews.llvm.org/D15169



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

Reply via email to