diff options
author | Anastasia Stulova <anastasia.stulova@arm.com> | 2018-11-16 16:22:56 +0000 |
---|---|---|
committer | Anastasia Stulova <anastasia.stulova@arm.com> | 2018-11-16 16:22:56 +0000 |
commit | b6508aa4110621b4c5441dd67013cee4ec0d3036 (patch) | |
tree | 1652c7db8cd5af1be6079f8972b42f7b6a526615 /lib/AST/Expr.cpp | |
parent | 59e40fbc67abf5f59b408d83bab2e33e1fe0eb17 (diff) | |
download | clang-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/AST/Expr.cpp')
-rw-r--r-- | lib/AST/Expr.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp index b811b22239..2e26500862 100644 --- a/lib/AST/Expr.cpp +++ b/lib/AST/Expr.cpp @@ -1634,13 +1634,18 @@ bool CastExpr::CastConsistency() const { assert(getSubExpr()->getType()->isFunctionType()); goto CheckNoBasePath; - case CK_AddressSpaceConversion: - assert(getType()->isPointerType() || getType()->isBlockPointerType()); - assert(getSubExpr()->getType()->isPointerType() || - getSubExpr()->getType()->isBlockPointerType()); - assert(getType()->getPointeeType().getAddressSpace() != - getSubExpr()->getType()->getPointeeType().getAddressSpace()); - LLVM_FALLTHROUGH; + case CK_AddressSpaceConversion: { + auto Ty = getType(); + auto SETy = getSubExpr()->getType(); + assert(getValueKindForType(Ty) == Expr::getValueKindForType(SETy)); + if (!isGLValue()) + Ty = Ty->getPointeeType(); + if (!isGLValue()) + SETy = SETy->getPointeeType(); + assert(!Ty.isNull() && !SETy.isNull() && + Ty.getAddressSpace() != SETy.getAddressSpace()); + goto CheckNoBasePath; + } // These should not have an inheritance path. case CK_Dynamic: case CK_ToUnion: |