[PATCH] D15169: [SemaCXX] Fix handling of C-style casts from void pointers to pointers in different address space.
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 2 17:31:17 PST 2015
rsmith 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;
----------------
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`?
http://reviews.llvm.org/D15169
More information about the cfe-commits
mailing list