forked from OSchip/llvm-project
[PR41567][Sema] Fixed cast kind in addr space conversions
This change sets missing cast kind correctly in the address space conversion case. Differential Revision: https://reviews.llvm.org/D62299 llvm-svn: 362409
This commit is contained in:
parent
bedcaea99a
commit
5099aef869
|
@ -2450,6 +2450,10 @@ void CastOperation::CheckCXXCStyleCast(bool FunctionalStyle,
|
|||
tcr = TryAddressSpaceCast(Self, SrcExpr, DestType, /*CStyle*/ true, msg);
|
||||
if (SrcExpr.isInvalid())
|
||||
return;
|
||||
|
||||
if (isValidCast(tcr))
|
||||
Kind = CK_AddressSpaceConversion;
|
||||
|
||||
if (tcr == TC_NotApplicable) {
|
||||
// ... or if that is not possible, a static_cast, ignoring const, ...
|
||||
tcr = TryStaticCast(Self, SrcExpr, DestType, CCK, OpRange, msg, Kind,
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=c++ -emit-llvm -O0 -o - | FileCheck %s
|
||||
|
||||
void bar(__generic volatile unsigned int* ptr)
|
||||
{
|
||||
//CHECK: addrspacecast i32 addrspace(4)* %{{.+}} to i32 addrspace(1)*
|
||||
auto gptr = (__global volatile unsigned int*)ptr;
|
||||
}
|
Loading…
Reference in New Issue