summaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGExpr.cpp
diff options
context:
space:
mode:
authorAnastasia Stulova <anastasia.stulova@arm.com>2018-11-16 16:22:56 +0000
committerAnastasia Stulova <anastasia.stulova@arm.com>2018-11-16 16:22:56 +0000
commitb6508aa4110621b4c5441dd67013cee4ec0d3036 (patch)
tree1652c7db8cd5af1be6079f8972b42f7b6a526615 /lib/CodeGen/CGExpr.cpp
parent59e40fbc67abf5f59b408d83bab2e33e1fe0eb17 (diff)
downloadclang-b6508aa4110621b4c5441dd67013cee4ec0d3036.tar.gz
[OpenCL] Enable address spaces for references in C++
Added references to the addr spaces deduction and enabled CL2.0 features (program scope variables and storage class qualifiers) to work in C++ mode too. Fixed several address space conversion issues in CodeGen for references. Differential Revision: https://reviews.llvm.org/D53764 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@347059 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExpr.cpp')
-rw-r--r--lib/CodeGen/CGExpr.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp
index c2e2031dd3..f4b0f8fb67 100644
--- a/lib/CodeGen/CGExpr.cpp
+++ b/lib/CodeGen/CGExpr.cpp
@@ -4163,7 +4163,6 @@ LValue CodeGenFunction::EmitCastLValue(const CastExpr *E) {
case CK_ARCReclaimReturnedObject:
case CK_ARCExtendBlockObject:
case CK_CopyAndAutoreleaseBlockObject:
- case CK_AddressSpaceConversion:
case CK_IntToOCLSampler:
case CK_FixedPointCast:
case CK_FixedPointToBoolean:
@@ -4260,6 +4259,14 @@ LValue CodeGenFunction::EmitCastLValue(const CastExpr *E) {
return MakeAddrLValue(V, E->getType(), LV.getBaseInfo(),
CGM.getTBAAInfoForSubobject(LV, E->getType()));
}
+ case CK_AddressSpaceConversion: {
+ LValue LV = EmitLValue(E->getSubExpr());
+ QualType DestTy = getContext().getPointerType(E->getType());
+ llvm::Value *V = getTargetHooks().performAddrSpaceCast(
+ *this, LV.getPointer(), E->getSubExpr()->getType().getAddressSpace(),
+ DestTy.getAddressSpace(), ConvertType(DestTy));
+ return MakeNaturalAlignPointeeAddrLValue(V, DestTy);
+ }
case CK_ObjCObjectLValueCast: {
LValue LV = EmitLValue(E->getSubExpr());
Address V = Builder.CreateElementBitCast(LV.getAddress(),