Index: include/clang/Basic/AddressSpaces.h =================================================================== --- include/clang/Basic/AddressSpaces.h +++ include/clang/Basic/AddressSpaces.h @@ -35,6 +35,7 @@ opencl_global, opencl_local, opencl_constant, + opencl_private, opencl_generic, // CUDA specific address spaces. Index: lib/AST/ASTContext.cpp =================================================================== --- lib/AST/ASTContext.cpp +++ lib/AST/ASTContext.cpp @@ -707,6 +707,7 @@ 1, // opencl_global 3, // opencl_local 2, // opencl_constant + 0, // opencl_private 4, // opencl_generic 5, // cuda_device 6, // cuda_constant Index: lib/AST/Expr.cpp =================================================================== --- lib/AST/Expr.cpp +++ lib/AST/Expr.cpp @@ -3230,20 +3230,20 @@ // Check that it is a cast to void*. if (const PointerType *PT = CE->getType()->getAs()) { QualType Pointee = PT->getPointeeType(); - Qualifiers Q = Pointee.getQualifiers(); - // In OpenCL v2.0 generic address space acts as a placeholder - // and should be ignored. - bool IsASValid = true; - if (Ctx.getLangOpts().OpenCLVersion >= 200) { - if (Pointee.getAddressSpace() == LangAS::opencl_generic) - Q.removeAddressSpace(); - else - IsASValid = false; - } + // Only (void*)0 or equivalent are treated as nullptr. If pointee type + // has non-default address space it is not treated as nullptr. + bool PointeeHasDefaultAS = false; + if (Ctx.getLangOpts().OpenCL) + PointeeHasDefaultAS = + (Ctx.getLangOpts().OpenCLVersion >= 200 && + Pointee.getAddressSpace() == LangAS::opencl_generic) || + (Ctx.getLangOpts().OpenCLVersion < 200 && + Pointee.getAddressSpace() == LangAS::opencl_private); + else + PointeeHasDefaultAS = Pointee.getAddressSpace() == LangAS::Default; - if (IsASValid && !Q.hasQualifiers() && - Pointee->isVoidType() && // to void* - CE->getSubExpr()->getType()->isIntegerType()) // from int. + if (PointeeHasDefaultAS && Pointee->isVoidType() && // to void* + CE->getSubExpr()->getType()->isIntegerType()) // from int. return CE->getSubExpr()->isNullPointerConstant(Ctx, NPC); } } Index: lib/AST/ItaniumMangle.cpp =================================================================== --- lib/AST/ItaniumMangle.cpp +++ lib/AST/ItaniumMangle.cpp @@ -2155,15 +2155,17 @@ if (Context.getASTContext().addressSpaceMapManglingFor(AS)) { // ::= "AS" unsigned TargetAS = Context.getASTContext().getTargetAddressSpace(AS); - ASString = "AS" + llvm::utostr(TargetAS); + if (TargetAS != 0) + ASString = "AS" + llvm::utostr(TargetAS); } else { switch (AS) { default: llvm_unreachable("Not a language specific address space"); - // ::= "CL" [ "global" | "local" | "constant | - // "generic" ] + // ::= "CL" [ "global" | "local" | "constant" | + // "private"| "generic" ] case LangAS::opencl_global: ASString = "CLglobal"; break; case LangAS::opencl_local: ASString = "CLlocal"; break; case LangAS::opencl_constant: ASString = "CLconstant"; break; + case LangAS::opencl_private: ASString = "CLprivate"; break; case LangAS::opencl_generic: ASString = "CLgeneric"; break; // ::= "CU" [ "device" | "constant" | "shared" ] case LangAS::cuda_device: ASString = "CUdevice"; break; @@ -2171,7 +2173,8 @@ case LangAS::cuda_shared: ASString = "CUshared"; break; } } - mangleVendorQualifier(ASString); + if (!ASString.empty()) + mangleVendorQualifier(ASString); } // The ARC ownership qualifiers start with underscores. Index: lib/AST/TypePrinter.cpp =================================================================== --- lib/AST/TypePrinter.cpp +++ lib/AST/TypePrinter.cpp @@ -1658,6 +1658,9 @@ case LangAS::cuda_constant: OS << "__constant"; break; + case LangAS::opencl_private: + OS << "__private"; + break; case LangAS::opencl_generic: OS << "__generic"; break; Index: lib/Basic/Targets.cpp =================================================================== --- lib/Basic/Targets.cpp +++ lib/Basic/Targets.cpp @@ -1799,6 +1799,7 @@ 1, // opencl_global 3, // opencl_local 4, // opencl_constant + 0, // opencl_private // FIXME: generic has to be added to the target 0, // opencl_generic 1, // cuda_device @@ -2054,6 +2055,7 @@ 1, // opencl_global 3, // opencl_local 2, // opencl_constant + 0, // opencl_private 4, // opencl_generic 1, // cuda_device 2, // cuda_constant @@ -2064,6 +2066,7 @@ 1, // opencl_global 3, // opencl_local 2, // opencl_constant + 5, // opencl_private 0, // opencl_generic 1, // cuda_device 2, // cuda_constant @@ -2074,6 +2077,7 @@ 1, // opencl_global 3, // opencl_local 2, // opencl_constant + 0, // opencl_private 4, // opencl_generic 1, // cuda_device 2, // cuda_constant @@ -2084,6 +2088,7 @@ 1, // opencl_global 3, // opencl_local 2, // opencl_constant + 5, // opencl_private 0, // opencl_generic 1, // cuda_device 2, // cuda_constant @@ -7696,6 +7701,7 @@ 3, // opencl_global 4, // opencl_local 5, // opencl_constant + 0, // opencl_private // FIXME: generic has to be added to the target 0, // opencl_generic 0, // cuda_device @@ -8820,6 +8826,7 @@ 1, // opencl_global 3, // opencl_local 2, // opencl_constant + 0, // opencl_private 4, // opencl_generic 0, // cuda_device 0, // cuda_constant Index: lib/CodeGen/CGDecl.cpp =================================================================== --- lib/CodeGen/CGDecl.cpp +++ lib/CodeGen/CGDecl.cpp @@ -952,7 +952,9 @@ CodeGenFunction::AutoVarEmission CodeGenFunction::EmitAutoVarAlloca(const VarDecl &D) { QualType Ty = D.getType(); - assert(Ty.getAddressSpace() == LangAS::Default); + assert( + Ty.getAddressSpace() == LangAS::Default || + (Ty.getAddressSpace() == LangAS::opencl_private && getLangOpts().OpenCL)); AutoVarEmission emission(D); Index: lib/Sema/SemaChecking.cpp =================================================================== --- lib/Sema/SemaChecking.cpp +++ lib/Sema/SemaChecking.cpp @@ -721,6 +721,9 @@ case Builtin::BIto_local: Qual.setAddressSpace(LangAS::opencl_local); break; + case Builtin::BIto_private: + Qual.setAddressSpace(LangAS::opencl_private); + break; default: Qual.removeAddressSpace(); } Index: lib/Sema/SemaDecl.cpp =================================================================== --- lib/Sema/SemaDecl.cpp +++ lib/Sema/SemaDecl.cpp @@ -6237,7 +6237,7 @@ // The event type cannot be used with the __local, __constant and __global // address space qualifiers. if (R->isEventT()) { - if (R.getAddressSpace()) { + if (R.getAddressSpace() != LangAS::opencl_private) { Diag(D.getLocStart(), diag::err_event_t_addr_space_qual); D.setInvalidType(); } @@ -7325,7 +7325,7 @@ return; } } - } else if (T.getAddressSpace() != LangAS::Default) { + } else if (T.getAddressSpace() != LangAS::opencl_private) { // Do not allow other address spaces on automatic variable. Diag(NewVD->getLocation(), diag::err_as_qualified_auto_decl) << 1; NewVD->setInvalidDecl(); @@ -7960,7 +7960,8 @@ if (PointeeType->isPointerType()) return PtrPtrKernelParam; if (PointeeType.getAddressSpace() == LangAS::opencl_generic || - PointeeType.getAddressSpace() == 0) + PointeeType.getAddressSpace() == LangAS::opencl_private || + PointeeType.getAddressSpace() == LangAS::Default) return InvalidAddrSpacePtrKernelParam; return PtrKernelParam; } @@ -8730,9 +8731,7 @@ // OpenCL v1.1 s6.5: Using an address space qualifier in a function return // type declaration will generate a compilation error. unsigned AddressSpace = NewFD->getReturnType().getAddressSpace(); - if (AddressSpace == LangAS::opencl_local || - AddressSpace == LangAS::opencl_global || - AddressSpace == LangAS::opencl_constant) { + if (AddressSpace != LangAS::Default) { Diag(NewFD->getLocation(), diag::err_opencl_return_value_with_address_space); NewFD->setInvalidDecl(); @@ -11842,13 +11841,13 @@ // duration shall not be qualified by an address-space qualifier." // Since all parameters have automatic store duration, they can not have // an address space. - if (T.getAddressSpace() != 0) { - // OpenCL allows function arguments declared to be an array of a type - // to be qualified with an address space. - if (!(getLangOpts().OpenCL && T->isArrayType())) { - Diag(NameLoc, diag::err_arg_with_address_space); - New->setInvalidDecl(); - } + if (T.getAddressSpace() != LangAS::Default && + // OpenCL allows function arguments declared to be an array of a type + // to be qualified with an address space. + !(getLangOpts().OpenCL && + (T->isArrayType() || T.getAddressSpace() == LangAS::opencl_private))) { + Diag(NameLoc, diag::err_arg_with_address_space); + New->setInvalidDecl(); } return New; Index: lib/Sema/SemaType.cpp =================================================================== --- lib/Sema/SemaType.cpp +++ lib/Sema/SemaType.cpp @@ -5566,7 +5566,7 @@ ASIdx = LangAS::opencl_generic; break; default: assert(Attr.getKind() == AttributeList::AT_OpenCLPrivateAddressSpace); - ASIdx = 0; break; + ASIdx = LangAS::opencl_private; break; } } @@ -6966,6 +6966,38 @@ } } + if (state.getSema().getLangOpts().OpenCL && + !hasOpenCLAddressSpace && type.getAddressSpace() == 0 && + (TAL == TAL_DeclSpec || TAL == TAL_DeclChunk)) { + Declarator &D = state.getDeclarator(); + // Put OpenCL automatic variable in private address space. + if (state.getCurrentChunkIndex() == 0 && !D.isFunctionDeclarator() && + !D.isFunctionDefinition() && + D.getDeclSpec().getStorageClassSpec() != DeclSpec::SCS_typedef && + !type->isVoidType()) { + if (D.getContext() == Declarator::BlockContext || + D.getContext() == Declarator::ForContext || + D.getContext() == Declarator::InitStmtContext || + D.getContext() == Declarator::ConditionContext || + D.getContext() == Declarator::PrototypeContext) { + if (D.getDeclSpec().getStorageClassSpec() != DeclSpec::SCS_static) { + type = state.getSema().Context.getAddrSpaceQualType( + type, LangAS::opencl_private); + } + } + // OpenCL v1.2 s6.5: + // The generic address space name for arguments to a function in a + // program, or local variables of a function is __private. All function + // arguments shall be in the __private address space. + } else if (state.getCurrentChunkIndex() > 0 && + state.getSema().getLangOpts().OpenCLVersion <= 120 && + (D.getTypeObject(state.getCurrentChunkIndex() - 1).Kind == + DeclaratorChunk::Pointer)) { + type = state.getSema().Context.getAddrSpaceQualType( + type, LangAS::opencl_private); + } + } + // If address space is not set, OpenCL 2.0 defines non private default // address spaces for some cases: // OpenCL 2.0, section 6.5: @@ -6987,15 +7019,24 @@ type = state.getSema().Context.getAddrSpaceQualType( type, LangAS::opencl_generic); } else if (state.getCurrentChunkIndex() == 0 && - D.getContext() == Declarator::FileContext && !D.isFunctionDeclarator() && !D.isFunctionDefinition() && D.getDeclSpec().getStorageClassSpec() != DeclSpec::SCS_typedef && - !type->isSamplerT()) - type = state.getSema().Context.getAddrSpaceQualType( + !type->isSamplerT()) { + if (D.getContext() == Declarator::FileContext) { + type = state.getSema().Context.getAddrSpaceQualType( type, LangAS::opencl_global); - else if (state.getCurrentChunkIndex() == 0 && - D.getContext() == Declarator::BlockContext && - D.getDeclSpec().getStorageClassSpec() == DeclSpec::SCS_static) + } else if (D.getContext() == Declarator::BlockContext) { + if (D.getDeclSpec().getStorageClassSpec() != DeclSpec::SCS_static) { + type = state.getSema().Context.getAddrSpaceQualType( + type, LangAS::opencl_private); + } else { + type = state.getSema().Context.getAddrSpaceQualType( + type, LangAS::opencl_global); + } + } + } else if (state.getCurrentChunkIndex() == 0 && + D.getContext() == Declarator::BlockContext && + D.getDeclSpec().getStorageClassSpec() == DeclSpec::SCS_static) type = state.getSema().Context.getAddrSpaceQualType( type, LangAS::opencl_global); } Index: test/CodeGenOpenCL/address-spaces-mangling.cl =================================================================== --- test/CodeGenOpenCL/address-spaces-mangling.cl +++ test/CodeGenOpenCL/address-spaces-mangling.cl @@ -1,5 +1,7 @@ -// RUN: %clang_cc1 %s -ffake-address-space-map -faddress-space-map-mangling=yes -triple %itanium_abi_triple -emit-llvm -o - | FileCheck -check-prefix=ASMANG %s -// RUN: %clang_cc1 %s -ffake-address-space-map -faddress-space-map-mangling=no -triple %itanium_abi_triple -emit-llvm -o - | FileCheck -check-prefix=NOASMANG %s +// RUN: %clang_cc1 %s -ffake-address-space-map -faddress-space-map-mangling=yes -triple %itanium_abi_triple -emit-llvm -o - | FileCheck -check-prefixes=ASMANG,ASMAN10 %s +// RUN: %clang_cc1 %s -cl-std=CL2.0 -ffake-address-space-map -faddress-space-map-mangling=yes -triple %itanium_abi_triple -emit-llvm -o - | FileCheck -check-prefixes=ASMANG,ASMAN20 %s +// RUN: %clang_cc1 %s -ffake-address-space-map -faddress-space-map-mangling=no -triple %itanium_abi_triple -emit-llvm -o - | FileCheck -check-prefixes=NOASMANG,NOASMAN10 %s +// RUN: %clang_cc1 %s -cl-std=CL2.0 -ffake-address-space-map -faddress-space-map-mangling=no -triple %itanium_abi_triple -emit-llvm -o - | FileCheck -check-prefixes=NOASMANG,NOASMAN20 %s // We check that the address spaces are mangled the same in both version of OpenCL // RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=CL2.0 -emit-llvm -o - | FileCheck -check-prefix=OCL-20 %s @@ -10,15 +12,17 @@ // warnings, but we do want it for comparison purposes. __attribute__((overloadable)) void ff(int *arg) { } -// ASMANG: @_Z2ffPi -// NOASMANG: @_Z2ffPi +// ASMANG10: @_Z2ffPi +// ASMANG20: @_Z2ffPU3AS4i +// NOASMANG10: @_Z2ffPi +// NOASMANG20: @_Z2ffPU9CLgenerici // OCL-20-DAG: @_Z2ffPU3AS4i // OCL-12-DAG: @_Z2ffPi __attribute__((overloadable)) void f(private int *arg) { } // ASMANG: @_Z1fPi -// NOASMANG: @_Z1fPi +// NOASMANG: @_Z1fPU9CLprivatei // OCL-20-DAG: @_Z1fPi // OCL-12-DAG: @_Z1fPi @@ -42,3 +46,11 @@ // NOASMANG: @_Z1fPU10CLconstanti // OCL-20-DAG: @_Z1fPU3AS2i // OCL-12-DAG: @_Z1fPU3AS2i + +#if __OPENCL_C_VERSION__ >= 200 +__attribute__((overloadable)) +void f(generic int *arg) { } +// ASMANG20: @_Z1fPU3AS4i +// NOASMANG20: @_Z1fPU9CLgenerici +// OCL-20-DAG: @_Z1fPU3AS4i +#endif Index: test/Index/opencl-types.cl =================================================================== --- test/Index/opencl-types.cl +++ test/Index/opencl-types.cl @@ -16,12 +16,12 @@ double4 vectorDouble; } -// CHECK: VarDecl=scalarHalf:11:8 (Definition) [type=half] [typekind=Half] [isPOD=1] -// CHECK: VarDecl=vectorHalf:12:9 (Definition) [type=half4] [typekind=Typedef] [canonicaltype=half __attribute__((ext_vector_type(4)))] [canonicaltypekind=Unexposed] [isPOD=1] -// CHECK: VarDecl=scalarFloat:13:9 (Definition) [type=float] [typekind=Float] [isPOD=1] -// CHECK: VarDecl=vectorFloat:14:10 (Definition) [type=float4] [typekind=Typedef] [canonicaltype=float __attribute__((ext_vector_type(4)))] [canonicaltypekind=Unexposed] [isPOD=1] -// CHECK: VarDecl=scalarDouble:15:10 (Definition) [type=double] [typekind=Double] [isPOD=1] -// CHECK: VarDecl=vectorDouble:16:11 (Definition) [type=double4] [typekind=Typedef] [canonicaltype=double __attribute__((ext_vector_type(4)))] [canonicaltypekind=Unexposed] [isPOD=1] +// CHECK: VarDecl=scalarHalf:11:8 (Definition) [type=__private half] [typekind=Half] [isPOD=1] +// CHECK: VarDecl=vectorHalf:12:9 (Definition) [type=__private half4] [typekind=Typedef] [canonicaltype=half __private __attribute__((ext_vector_type(4)))] [canonicaltypekind=Unexposed] [isPOD=1] +// CHECK: VarDecl=scalarFloat:13:9 (Definition) [type=__private float] [typekind=Float] [isPOD=1] +// CHECK: VarDecl=vectorFloat:14:10 (Definition) [type=__private float4] [typekind=Typedef] [canonicaltype=float __private __attribute__((ext_vector_type(4)))] [canonicaltypekind=Unexposed] [isPOD=1] +// CHECK: VarDecl=scalarDouble:15:10 (Definition) [type=__private double] [typekind=Double] [isPOD=1] +// CHECK: VarDecl=vectorDouble:16:11 (Definition) [type=__private double4] [typekind=Typedef] [canonicaltype=double __private __attribute__((ext_vector_type(4)))] [canonicaltypekind=Unexposed] [isPOD=1] #pragma OPENCL EXTENSION cl_khr_gl_msaa_sharing : enable @@ -38,18 +38,18 @@ void kernel OCLImage2dArrayMSAADepthROTest(read_only image2d_array_msaa_depth_t scalarOCLImage2dArrayMSAADepthRO); void kernel OCLImage3dROTest(read_only image3d_t scalarOCLImage3dRO); -// CHECK: ParmDecl=scalarOCLImage1dRO:28:50 (Definition) [type=__read_only image1d_t] [typekind=OCLImage1dRO] [isPOD=1] -// CHECK: ParmDecl=scalarOCLImage1dArrayRO:29:61 (Definition) [type=__read_only image1d_array_t] [typekind=OCLImage1dArrayRO] [isPOD=1] -// CHECK: ParmDecl=scalarOCLImage1dBufferRO:30:63 (Definition) [type=__read_only image1d_buffer_t] [typekind=OCLImage1dBufferRO] [isPOD=1] -// CHECK: ParmDecl=scalarOCLImage2dRO:31:50 (Definition) [type=__read_only image2d_t] [typekind=OCLImage2dRO] [isPOD=1] -// CHECK: ParmDecl=scalarOCLImage2dArrayRO:32:61 (Definition) [type=__read_only image2d_array_t] [typekind=OCLImage2dArrayRO] [isPOD=1] -// CHECK: ParmDecl=scalarOCLImage2dDepthRO:33:61 (Definition) [type=__read_only image2d_depth_t] [typekind=OCLImage2dDepthRO] [isPOD=1] -// CHECK: ParmDecl=scalarOCLImage2dArrayDepthRO:34:72 (Definition) [type=__read_only image2d_array_depth_t] [typekind=OCLImage2dArrayDepthRO] [isPOD=1] -// CHECK: ParmDecl=scalarOCLImage2dMSAARO:35:59 (Definition) [type=__read_only image2d_msaa_t] [typekind=OCLImage2dMSAARO] [isPOD=1] -// CHECK: ParmDecl=scalarOCLImage2dArrayMSAARO:36:70 (Definition) [type=__read_only image2d_array_msaa_t] [typekind=OCLImage2dArrayMSAARO] [isPOD=1] -// CHECK: ParmDecl=scalarOCLImage2dMSAADepthRO:37:70 (Definition) [type=__read_only image2d_msaa_depth_t] [typekind=OCLImage2dMSAADepthRO] [isPOD=1] -// CHECK: ParmDecl=scalarOCLImage2dArrayMSAADepthRO:38:81 (Definition) [type=__read_only image2d_array_msaa_depth_t] [typekind=OCLImage2dArrayMSAADepthRO] [isPOD=1] -// CHECK: ParmDecl=scalarOCLImage3dRO:39:50 (Definition) [type=__read_only image3d_t] [typekind=OCLImage3dRO] [isPOD=1] +// CHECK: ParmDecl=scalarOCLImage1dRO:28:50 (Definition) [type=__private __read_only image1d_t] [typekind=OCLImage1dRO] [isPOD=1] +// CHECK: ParmDecl=scalarOCLImage1dArrayRO:29:61 (Definition) [type=__private __read_only image1d_array_t] [typekind=OCLImage1dArrayRO] [isPOD=1] +// CHECK: ParmDecl=scalarOCLImage1dBufferRO:30:63 (Definition) [type=__private __read_only image1d_buffer_t] [typekind=OCLImage1dBufferRO] [isPOD=1] +// CHECK: ParmDecl=scalarOCLImage2dRO:31:50 (Definition) [type=__private __read_only image2d_t] [typekind=OCLImage2dRO] [isPOD=1] +// CHECK: ParmDecl=scalarOCLImage2dArrayRO:32:61 (Definition) [type=__private __read_only image2d_array_t] [typekind=OCLImage2dArrayRO] [isPOD=1] +// CHECK: ParmDecl=scalarOCLImage2dDepthRO:33:61 (Definition) [type=__private __read_only image2d_depth_t] [typekind=OCLImage2dDepthRO] [isPOD=1] +// CHECK: ParmDecl=scalarOCLImage2dArrayDepthRO:34:72 (Definition) [type=__private __read_only image2d_array_depth_t] [typekind=OCLImage2dArrayDepthRO] [isPOD=1] +// CHECK: ParmDecl=scalarOCLImage2dMSAARO:35:59 (Definition) [type=__private __read_only image2d_msaa_t] [typekind=OCLImage2dMSAARO] [isPOD=1] +// CHECK: ParmDecl=scalarOCLImage2dArrayMSAARO:36:70 (Definition) [type=__private __read_only image2d_array_msaa_t] [typekind=OCLImage2dArrayMSAARO] [isPOD=1] +// CHECK: ParmDecl=scalarOCLImage2dMSAADepthRO:37:70 (Definition) [type=__private __read_only image2d_msaa_depth_t] [typekind=OCLImage2dMSAADepthRO] [isPOD=1] +// CHECK: ParmDecl=scalarOCLImage2dArrayMSAADepthRO:38:81 (Definition) [type=__private __read_only image2d_array_msaa_depth_t] [typekind=OCLImage2dArrayMSAADepthRO] [isPOD=1] +// CHECK: ParmDecl=scalarOCLImage3dRO:39:50 (Definition) [type=__private __read_only image3d_t] [typekind=OCLImage3dRO] [isPOD=1] void kernel OCLImage1dWOTest(write_only image1d_t scalarOCLImage1dWO); void kernel OCLImage1dArrayWOTest(write_only image1d_array_t scalarOCLImage1dArrayWO); @@ -64,18 +64,18 @@ void kernel OCLImage2dArrayMSAADepthWOTest(write_only image2d_array_msaa_depth_t scalarOCLImage2dArrayMSAADepthWO); void kernel OCLImage3dWOTest(write_only image3d_t scalarOCLImage3dWO); -// CHECK: ParmDecl=scalarOCLImage1dWO:54:51 (Definition) [type=__write_only image1d_t] [typekind=OCLImage1dWO] [isPOD=1] -// CHECK: ParmDecl=scalarOCLImage1dArrayWO:55:62 (Definition) [type=__write_only image1d_array_t] [typekind=OCLImage1dArrayWO] [isPOD=1] -// CHECK: ParmDecl=scalarOCLImage1dBufferWO:56:64 (Definition) [type=__write_only image1d_buffer_t] [typekind=OCLImage1dBufferWO] [isPOD=1] -// CHECK: ParmDecl=scalarOCLImage2dWO:57:51 (Definition) [type=__write_only image2d_t] [typekind=OCLImage2dWO] [isPOD=1] -// CHECK: ParmDecl=scalarOCLImage2dArrayWO:58:62 (Definition) [type=__write_only image2d_array_t] [typekind=OCLImage2dArrayWO] [isPOD=1] -// CHECK: ParmDecl=scalarOCLImage2dDepthWO:59:62 (Definition) [type=__write_only image2d_depth_t] [typekind=OCLImage2dDepthWO] [isPOD=1] -// CHECK: ParmDecl=scalarOCLImage2dArrayDepthWO:60:73 (Definition) [type=__write_only image2d_array_depth_t] [typekind=OCLImage2dArrayDepthWO] [isPOD=1] -// CHECK: ParmDecl=scalarOCLImage2dMSAAWO:61:60 (Definition) [type=__write_only image2d_msaa_t] [typekind=OCLImage2dMSAAWO] [isPOD=1] -// CHECK: ParmDecl=scalarOCLImage2dArrayMSAAWO:62:71 (Definition) [type=__write_only image2d_array_msaa_t] [typekind=OCLImage2dArrayMSAAWO] [isPOD=1] -// CHECK: ParmDecl=scalarOCLImage2dMSAADepthWO:63:71 (Definition) [type=__write_only image2d_msaa_depth_t] [typekind=OCLImage2dMSAADepthWO] [isPOD=1] -// CHECK: ParmDecl=scalarOCLImage2dArrayMSAADepthWO:64:82 (Definition) [type=__write_only image2d_array_msaa_depth_t] [typekind=OCLImage2dArrayMSAADepthWO] [isPOD=1] -// CHECK: ParmDecl=scalarOCLImage3dWO:65:51 (Definition) [type=__write_only image3d_t] [typekind=OCLImage3dWO] [isPOD=1] +// CHECK: ParmDecl=scalarOCLImage1dWO:54:51 (Definition) [type=__private __write_only image1d_t] [typekind=OCLImage1dWO] [isPOD=1] +// CHECK: ParmDecl=scalarOCLImage1dArrayWO:55:62 (Definition) [type=__private __write_only image1d_array_t] [typekind=OCLImage1dArrayWO] [isPOD=1] +// CHECK: ParmDecl=scalarOCLImage1dBufferWO:56:64 (Definition) [type=__private __write_only image1d_buffer_t] [typekind=OCLImage1dBufferWO] [isPOD=1] +// CHECK: ParmDecl=scalarOCLImage2dWO:57:51 (Definition) [type=__private __write_only image2d_t] [typekind=OCLImage2dWO] [isPOD=1] +// CHECK: ParmDecl=scalarOCLImage2dArrayWO:58:62 (Definition) [type=__private __write_only image2d_array_t] [typekind=OCLImage2dArrayWO] [isPOD=1] +// CHECK: ParmDecl=scalarOCLImage2dDepthWO:59:62 (Definition) [type=__private __write_only image2d_depth_t] [typekind=OCLImage2dDepthWO] [isPOD=1] +// CHECK: ParmDecl=scalarOCLImage2dArrayDepthWO:60:73 (Definition) [type=__private __write_only image2d_array_depth_t] [typekind=OCLImage2dArrayDepthWO] [isPOD=1] +// CHECK: ParmDecl=scalarOCLImage2dMSAAWO:61:60 (Definition) [type=__private __write_only image2d_msaa_t] [typekind=OCLImage2dMSAAWO] [isPOD=1] +// CHECK: ParmDecl=scalarOCLImage2dArrayMSAAWO:62:71 (Definition) [type=__private __write_only image2d_array_msaa_t] [typekind=OCLImage2dArrayMSAAWO] [isPOD=1] +// CHECK: ParmDecl=scalarOCLImage2dMSAADepthWO:63:71 (Definition) [type=__private __write_only image2d_msaa_depth_t] [typekind=OCLImage2dMSAADepthWO] [isPOD=1] +// CHECK: ParmDecl=scalarOCLImage2dArrayMSAADepthWO:64:82 (Definition) [type=__private __write_only image2d_array_msaa_depth_t] [typekind=OCLImage2dArrayMSAADepthWO] [isPOD=1] +// CHECK: ParmDecl=scalarOCLImage3dWO:65:51 (Definition) [type=__private __write_only image3d_t] [typekind=OCLImage3dWO] [isPOD=1] void kernel OCLImage1dRWTest(read_write image1d_t scalarOCLImage1dRW); void kernel OCLImage1dArrayRWTest(read_write image1d_array_t scalarOCLImage1dArrayRW); @@ -90,24 +90,24 @@ void kernel OCLImage2dArrayMSAADepthRWTest(read_write image2d_array_msaa_depth_t scalarOCLImage2dArrayMSAADepthRW); void kernel OCLImage3dRWTest(read_write image3d_t scalarOCLImage3dRW); -// CHECK: ParmDecl=scalarOCLImage1dRW:80:51 (Definition) [type=__read_write image1d_t] [typekind=OCLImage1dRW] [isPOD=1] -// CHECK: ParmDecl=scalarOCLImage1dArrayRW:81:62 (Definition) [type=__read_write image1d_array_t] [typekind=OCLImage1dArrayRW] [isPOD=1] -// CHECK: ParmDecl=scalarOCLImage1dBufferRW:82:64 (Definition) [type=__read_write image1d_buffer_t] [typekind=OCLImage1dBufferRW] [isPOD=1] -// CHECK: ParmDecl=scalarOCLImage2dRW:83:51 (Definition) [type=__read_write image2d_t] [typekind=OCLImage2dRW] [isPOD=1] -// CHECK: ParmDecl=scalarOCLImage2dArrayRW:84:62 (Definition) [type=__read_write image2d_array_t] [typekind=OCLImage2dArrayRW] [isPOD=1] -// CHECK: ParmDecl=scalarOCLImage2dDepthRW:85:62 (Definition) [type=__read_write image2d_depth_t] [typekind=OCLImage2dDepthRW] [isPOD=1] -// CHECK: ParmDecl=scalarOCLImage2dArrayDepthRW:86:73 (Definition) [type=__read_write image2d_array_depth_t] [typekind=OCLImage2dArrayDepthRW] [isPOD=1] -// CHECK: ParmDecl=scalarOCLImage2dMSAARW:87:60 (Definition) [type=__read_write image2d_msaa_t] [typekind=OCLImage2dMSAARW] [isPOD=1] -// CHECK: ParmDecl=scalarOCLImage2dArrayMSAARW:88:71 (Definition) [type=__read_write image2d_array_msaa_t] [typekind=OCLImage2dArrayMSAARW] [isPOD=1] -// CHECK: ParmDecl=scalarOCLImage2dMSAADepthRW:89:71 (Definition) [type=__read_write image2d_msaa_depth_t] [typekind=OCLImage2dMSAADepthRW] [isPOD=1] -// CHECK: ParmDecl=scalarOCLImage2dArrayMSAADepthRW:90:82 (Definition) [type=__read_write image2d_array_msaa_depth_t] [typekind=OCLImage2dArrayMSAADepthRW] [isPOD=1] -// CHECK: ParmDecl=scalarOCLImage3dRW:91:51 (Definition) [type=__read_write image3d_t] [typekind=OCLImage3dRW] [isPOD=1] +// CHECK: ParmDecl=scalarOCLImage1dRW:80:51 (Definition) [type=__private __read_write image1d_t] [typekind=OCLImage1dRW] [isPOD=1] +// CHECK: ParmDecl=scalarOCLImage1dArrayRW:81:62 (Definition) [type=__private __read_write image1d_array_t] [typekind=OCLImage1dArrayRW] [isPOD=1] +// CHECK: ParmDecl=scalarOCLImage1dBufferRW:82:64 (Definition) [type=__private __read_write image1d_buffer_t] [typekind=OCLImage1dBufferRW] [isPOD=1] +// CHECK: ParmDecl=scalarOCLImage2dRW:83:51 (Definition) [type=__private __read_write image2d_t] [typekind=OCLImage2dRW] [isPOD=1] +// CHECK: ParmDecl=scalarOCLImage2dArrayRW:84:62 (Definition) [type=__private __read_write image2d_array_t] [typekind=OCLImage2dArrayRW] [isPOD=1] +// CHECK: ParmDecl=scalarOCLImage2dDepthRW:85:62 (Definition) [type=__private __read_write image2d_depth_t] [typekind=OCLImage2dDepthRW] [isPOD=1] +// CHECK: ParmDecl=scalarOCLImage2dArrayDepthRW:86:73 (Definition) [type=__private __read_write image2d_array_depth_t] [typekind=OCLImage2dArrayDepthRW] [isPOD=1] +// CHECK: ParmDecl=scalarOCLImage2dMSAARW:87:60 (Definition) [type=__private __read_write image2d_msaa_t] [typekind=OCLImage2dMSAARW] [isPOD=1] +// CHECK: ParmDecl=scalarOCLImage2dArrayMSAARW:88:71 (Definition) [type=__private __read_write image2d_array_msaa_t] [typekind=OCLImage2dArrayMSAARW] [isPOD=1] +// CHECK: ParmDecl=scalarOCLImage2dMSAADepthRW:89:71 (Definition) [type=__private __read_write image2d_msaa_depth_t] [typekind=OCLImage2dMSAADepthRW] [isPOD=1] +// CHECK: ParmDecl=scalarOCLImage2dArrayMSAADepthRW:90:82 (Definition) [type=__private __read_write image2d_array_msaa_depth_t] [typekind=OCLImage2dArrayMSAADepthRW] [isPOD=1] +// CHECK: ParmDecl=scalarOCLImage3dRW:91:51 (Definition) [type=__private __read_write image3d_t] [typekind=OCLImage3dRW] [isPOD=1] void kernel intPipeTestRO(read_only pipe int scalarPipe); void kernel intPipeTestWO(write_only pipe int scalarPipe); -// CHECK: ParmDecl=scalarPipe:106:46 (Definition) [type=read_only pipe int] [typekind=Pipe] [isPOD=0] -// CHECK: ParmDecl=scalarPipe:107:47 (Definition) [type=write_only pipe int] [typekind=Pipe] [isPOD=0] +// CHECK: ParmDecl=scalarPipe:106:46 (Definition) [type=__private read_only pipe int] [typekind=Pipe] [isPOD=0] +// CHECK: ParmDecl=scalarPipe:107:47 (Definition) [type=__private write_only pipe int] [typekind=Pipe] [isPOD=0] #define CLK_ADDRESS_CLAMP_TO_EDGE 2 #define CLK_NORMALIZED_COORDS_TRUE 1 @@ -120,7 +120,7 @@ reserve_id_t scalarOCLReserveID; } -// CHECK: VarDecl=scalarOCLSampler:117:19 (Definition) [type=const sampler_t] [typekind=Typedef] const [canonicaltype=const sampler_t] [canonicaltypekind=OCLSampler] [isPOD=1] -// CHECK: VarDecl=scalarOCLEvent:118:15 (Definition) [type=clk_event_t] [typekind=Typedef] [canonicaltype=clk_event_t] [canonicaltypekind=Unexposed] [isPOD=1] -// CHECK: VarDecl=scalarOCLQueue:119:11 (Definition) [type=queue_t] [typekind=Typedef] [canonicaltype=queue_t] [canonicaltypekind=OCLQueue] [isPOD=1] -// CHECK: VarDecl=scalarOCLReserveID:120:16 (Definition) [type=reserve_id_t] [typekind=Typedef] [canonicaltype=reserve_id_t] [canonicaltypekind=OCLReserveID] [isPOD=1] +// CHECK: VarDecl=scalarOCLSampler:117:19 (Definition) [type=const __private sampler_t] [typekind=Typedef] const [canonicaltype=const __private sampler_t] [canonicaltypekind=OCLSampler] [isPOD=1] +// CHECK: VarDecl=scalarOCLEvent:118:15 (Definition) [type=__private clk_event_t] [typekind=Typedef] [canonicaltype=__private clk_event_t] [canonicaltypekind=Unexposed] [isPOD=1] +// CHECK: VarDecl=scalarOCLQueue:119:11 (Definition) [type=__private queue_t] [typekind=Typedef] [canonicaltype=__private queue_t] [canonicaltypekind=OCLQueue] [isPOD=1] +// CHECK: VarDecl=scalarOCLReserveID:120:16 (Definition) [type=__private reserve_id_t] [typekind=Typedef] [canonicaltype=__private reserve_id_t] [canonicaltypekind=OCLReserveID] [isPOD=1] Index: test/Parser/opencl-astype.cl =================================================================== --- test/Parser/opencl-astype.cl +++ test/Parser/opencl-astype.cl @@ -11,7 +11,7 @@ typedef __attribute__(( ext_vector_type(4) )) double double4; float4 f4; - double4 d4 = __builtin_astype(f4, double4); // expected-error{{invalid reinterpretation: sizes of 'double4' (vector of 4 'double' values) and 'float4' (vector of 4 'float' values) must match}} + double4 d4 = __builtin_astype(f4, double4); // expected-error{{invalid reinterpretation: sizes of 'double4' (vector of 4 'double' values) and '__private float4' (vector of 4 'float' values) must match}} // Verify int4->float3, float3->int4 works. int4 i4; Index: test/Parser/opencl-atomics-cl20.cl =================================================================== --- test/Parser/opencl-atomics-cl20.cl +++ test/Parser/opencl-atomics-cl20.cl @@ -66,9 +66,9 @@ atomic_int i; foo(&i); // OpenCL v2.0 s6.13.11.8, arithemtic operations are not permitted on atomic types. - i++; // expected-error {{invalid argument type 'atomic_int' (aka '_Atomic(int)') to unary expression}} + i++; // expected-error {{invalid argument type '__private atomic_int' (aka '__private _Atomic(int)') to unary expression}} i = 1; // expected-error {{atomic variable can be assigned to a variable only in global address space}} - i += 1; // expected-error {{invalid operands to binary expression ('atomic_int' (aka '_Atomic(int)') and 'int')}} - i = i + i; // expected-error {{invalid operands to binary expression ('atomic_int' (aka '_Atomic(int)') and 'atomic_int')}} + i += 1; // expected-error {{invalid operands to binary expression ('__private atomic_int' (aka '__private _Atomic(int)') and 'int')}} + i = i + i; // expected-error {{invalid operands to binary expression ('__private atomic_int' (aka '__private _Atomic(int)') and '__private atomic_int')}} } #endif Index: test/SemaOpenCL/access-qualifier.cl =================================================================== --- test/SemaOpenCL/access-qualifier.cl +++ test/SemaOpenCL/access-qualifier.cl @@ -20,16 +20,16 @@ #if __OPENCL_C_VERSION__ >= 200 void myReadWrite(read_write image1d_t); #else -void myReadWrite(read_write image1d_t); // expected-error {{access qualifier 'read_write' can not be used for '__read_write image1d_t' prior to OpenCL version 2.0}} +void myReadWrite(read_write image1d_t); // expected-error {{access qualifier 'read_write' can not be used for '__private __read_write image1d_t' prior to OpenCL version 2.0}} #endif kernel void k1(img1d_wo img) { - myRead(img); // expected-error {{passing 'img1d_wo' (aka '__write_only image1d_t') to parameter of incompatible type '__read_only image1d_t'}} + myRead(img); // expected-error {{passing '__private img1d_wo' (aka '__private __write_only image1d_t') to parameter of incompatible type '__read_only image1d_t'}} } kernel void k2(img1d_ro img) { - myWrite(img); // expected-error {{passing 'img1d_ro' (aka '__read_only image1d_t') to parameter of incompatible type '__write_only image1d_t'}} + myWrite(img); // expected-error {{passing '__private img1d_ro' (aka '__private __read_only image1d_t') to parameter of incompatible type '__write_only image1d_t'}} } kernel void k3(img1d_wo img) { @@ -43,7 +43,7 @@ #endif kernel void k5(img1d_ro_default img) { - myWrite(img); // expected-error {{passing 'img1d_ro_default' (aka '__read_only image1d_t') to parameter of incompatible type '__write_only image1d_t'}} + myWrite(img); // expected-error {{passing '__private img1d_ro_default' (aka '__private __read_only image1d_t') to parameter of incompatible type '__write_only image1d_t'}} } kernel void k6(img1d_ro img) { @@ -63,15 +63,15 @@ kernel void k12(read_only read_only image1d_t i){} // expected-error{{multiple access qualifiers}} #if __OPENCL_C_VERSION__ >= 200 -kernel void k13(read_write pipe int i){} // expected-error{{access qualifier 'read_write' can not be used for 'read_only pipe int'}} +kernel void k13(read_write pipe int i){} // expected-error{{access qualifier 'read_write' can not be used for '__private read_only pipe int'}} #else -kernel void k13(__read_write image1d_t i){} // expected-error{{access qualifier '__read_write' can not be used for '__read_write image1d_t' prior to OpenCL version 2.0}} +kernel void k13(__read_write image1d_t i){} // expected-error{{access qualifier '__read_write' can not be used for '__private __read_write image1d_t' prior to OpenCL version 2.0}} #endif #if __OPENCL_C_VERSION__ >= 200 void myPipeWrite(write_only pipe int); // expected-note {{passing argument to parameter here}} kernel void k14(read_only pipe int p) { - myPipeWrite(p); // expected-error {{passing 'read_only pipe int' to parameter of incompatible type 'write_only pipe int'}} + myPipeWrite(p); // expected-error {{passing '__private read_only pipe int' to parameter of incompatible type 'write_only pipe int'}} } #endif Index: test/SemaOpenCL/address-spaces-conversions-cl2.0.cl =================================================================== --- test/SemaOpenCL/address-spaces-conversions-cl2.0.cl +++ test/SemaOpenCL/address-spaces-conversions-cl2.0.cl @@ -61,27 +61,27 @@ AS int *var_init1 = arg_glob; #ifdef CONSTANT -// expected-error@-2{{initializing '__constant int *' with an expression of type '__global int *' changes address space of pointer}} +// expected-error@-2{{initializing '__constant int *__private' with an expression of type '__global int *__private' changes address space of pointer}} #endif AS int *var_init2 = arg_loc; #ifndef GENERIC -// expected-error-re@-2{{initializing '__{{global|constant}} int *' with an expression of type '__local int *' changes address space of pointer}} +// expected-error-re@-2{{initializing '__{{global|constant}} int *__private' with an expression of type '__local int *__private' changes address space of pointer}} #endif AS int *var_init3 = arg_const; #ifndef CONSTANT -// expected-error-re@-2{{initializing '__{{global|generic}} int *' with an expression of type '__constant int *' changes address space of pointer}} +// expected-error-re@-2{{initializing '__{{global|generic}} int *__private' with an expression of type '__constant int *__private' changes address space of pointer}} #endif AS int *var_init4 = arg_priv; #ifndef GENERIC -// expected-error-re@-2{{initializing '__{{global|constant}} int *' with an expression of type 'int *' changes address space of pointer}} +// expected-error-re@-2{{initializing '__{{global|constant}} int *__private' with an expression of type '__private int *__private' changes address space of pointer}} #endif AS int *var_init5 = arg_gen; #ifndef GENERIC -// expected-error-re@-2{{initializing '__{{global|constant}} int *' with an expression of type '__generic int *' changes address space of pointer}} +// expected-error-re@-2{{initializing '__{{global|constant}} int *__private' with an expression of type '__generic int *__private' changes address space of pointer}} #endif AS int *var_cast1 = (AS int *)arg_glob; @@ -101,7 +101,7 @@ AS int *var_cast4 = (AS int *)arg_priv; #ifndef GENERIC -// expected-error-re@-2{{casting 'int *' to type '__{{global|constant}} int *' changes address space of pointer}} +// expected-error-re@-2{{casting '__private int *' to type '__{{global|constant}} int *' changes address space of pointer}} #endif AS int *var_cast5 = (AS int *)arg_gen; @@ -112,27 +112,27 @@ AS int *var_impl; var_impl = arg_glob; #ifdef CONSTANT -// expected-error@-2{{assigning '__global int *' to '__constant int *' changes address space of pointer}} +// expected-error@-2{{assigning '__global int *__private' to '__constant int *__private' changes address space of pointer}} #endif var_impl = arg_loc; #ifndef GENERIC -// expected-error-re@-2{{assigning '__local int *' to '__{{global|constant}} int *' changes address space of pointer}} +// expected-error-re@-2{{assigning '__local int *__private' to '__{{global|constant}} int *__private' changes address space of pointer}} #endif var_impl = arg_const; #ifndef CONSTANT -// expected-error-re@-2{{assigning '__constant int *' to '__{{global|generic}} int *' changes address space of pointer}} +// expected-error-re@-2{{assigning '__constant int *__private' to '__{{global|generic}} int *__private' changes address space of pointer}} #endif var_impl = arg_priv; #ifndef GENERIC -// expected-error-re@-2{{assigning 'int *' to '__{{global|constant}} int *' changes address space of pointer}} +// expected-error-re@-2{{assigning '__private int *__private' to '__{{global|constant}} int *__private' changes address space of pointer}} #endif var_impl = arg_gen; #ifndef GENERIC -// expected-error-re@-2{{assigning '__generic int *' to '__{{global|constant}} int *' changes address space of pointer}} +// expected-error-re@-2{{assigning '__generic int *__private' to '__{{global|constant}} int *__private' changes address space of pointer}} #endif var_cast1 = (AS int *)arg_glob; @@ -152,7 +152,7 @@ var_cast4 = (AS int *)arg_priv; #ifndef GENERIC -// expected-error-re@-2{{casting 'int *' to type '__{{global|constant}} int *' changes address space of pointer}} +// expected-error-re@-2{{casting '__private int *' to type '__{{global|constant}} int *' changes address space of pointer}} #endif var_cast5 = (AS int *)arg_gen; @@ -178,7 +178,7 @@ b = var_cmp <= arg_priv; #ifndef GENERIC -// expected-error-re@-2{{comparison between ('__{{global|constant}} int *' and 'int *') which are pointers to non-overlapping address spaces}} +// expected-error-re@-2{{comparison between ('__{{global|constant}} int *' and '__private int *') which are pointers to non-overlapping address spaces}} #endif b = var_cmp >= arg_gen; @@ -204,7 +204,7 @@ b = var_sub - arg_priv; #ifndef GENERIC -// expected-error-re@-2{{arithmetic operation with operands of type ('__{{global|constant}} int *' and 'int *') which are pointers to non-overlapping address spaces}} +// expected-error-re@-2{{arithmetic operation with operands of type ('__{{global|constant}} int *' and '__private int *') which are pointers to non-overlapping address spaces}} #endif b = var_sub - arg_gen; @@ -214,21 +214,21 @@ f_glob(var_sub); #ifndef GLOBAL -// expected-error-re@-2{{passing '__{{constant|generic}} int *' to parameter of type '__global int *' changes address space of pointer}} +// expected-error-re@-2{{passing '__{{constant|generic}} int *__private' to parameter of type '__global int *' changes address space of pointer}} #endif - f_loc(var_sub); // expected-error-re{{passing '__{{global|constant|generic}} int *' to parameter of type '__local int *' changes address space of pointer}} + f_loc(var_sub); // expected-error-re{{passing '__{{global|constant|generic}} int *__private' to parameter of type '__local int *' changes address space of pointer}} f_const(var_sub); #ifndef CONSTANT -// expected-error-re@-2{{passing '__{{global|generic}} int *' to parameter of type '__constant int *' changes address space of pointer}} +// expected-error-re@-2{{passing '__{{global|generic}} int *__private' to parameter of type '__constant int *' changes address space of pointer}} #endif - f_priv(var_sub); // expected-error-re{{passing '__{{global|constant|generic}} int *' to parameter of type 'int *' changes address space of pointer}} + f_priv(var_sub); // expected-error-re{{passing '__{{global|constant|generic}} int *__private' to parameter of type '__private int *' changes address space of pointer}} f_gen(var_sub); #ifdef CONSTANT -// expected-error@-2{{passing '__constant int *' to parameter of type '__generic int *' changes address space of pointer}} +// expected-error@-2{{passing '__constant int *__private' to parameter of type '__generic int *' changes address space of pointer}} #endif } @@ -256,7 +256,7 @@ private int *var_priv; var_gen = 0 ? var_cond : var_priv; #ifndef GENERIC -// expected-error-re@-2{{conditional operator with the second and third operands of type ('__{{global|constant}} int *' and 'int *') which are pointers to non-overlapping address spaces}} +// expected-error-re@-2{{conditional operator with the second and third operands of type ('__{{global|constant}} int *' and '__private int *') which are pointers to non-overlapping address spaces}} #endif var_gen = 0 ? var_cond : var_gen; @@ -293,9 +293,9 @@ private char *var_priv_ch; var_void_gen = 0 ? var_cond : var_priv_ch; #ifndef GENERIC -// expected-error-re@-2{{conditional operator with the second and third operands of type ('__{{global|constant}} int *' and 'char *') which are pointers to non-overlapping address spaces}} +// expected-error-re@-2{{conditional operator with the second and third operands of type ('__{{global|constant}} int *' and '__private char *') which are pointers to non-overlapping address spaces}} #else -// expected-warning@-4{{pointer type mismatch ('__generic int *' and 'char *')}} +// expected-warning@-4{{pointer type mismatch ('__generic int *' and '__private char *')}} #endif generic char *var_gen_ch; Index: test/SemaOpenCL/address-spaces.cl =================================================================== --- test/SemaOpenCL/address-spaces.cl +++ test/SemaOpenCL/address-spaces.cl @@ -1,4 +1,5 @@ // RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only +// RUN: %clang_cc1 %s -cl-std=CL2.0 -verify -pedantic -fsyntax-only __constant int ci = 1; @@ -7,9 +8,15 @@ __local int lj = 2; // expected-error {{'__local' variable cannot have an initializer}} int *ip; - ip = gip; // expected-error {{assigning '__global int *' to 'int *' changes address space of pointer}} - ip = &li; // expected-error {{assigning '__local int *' to 'int *' changes address space of pointer}} - ip = &ci; // expected-error {{assigning '__constant int *' to 'int *' changes address space of pointer}} +#if __OPENCL_C_VERSION__ < 200 + ip = gip; // expected-error {{assigning '__global int *__private' to '__private int *__private' changes address space of pointer}} + ip = &li; // expected-error {{assigning '__local int *' to '__private int *__private' changes address space of pointer}} + ip = &ci; // expected-error {{assigning '__constant int *' to '__private int *__private' changes address space of pointer}} +#else + ip = gip; + ip = &li; + ip = &ci; // expected-error {{assigning '__constant int *' to '__generic int *__private' changes address space of pointer}} +#endif } void explicit_cast(global int* g, local int* l, constant int* c, private int* p, const constant int *cc) @@ -17,21 +24,21 @@ g = (global int*) l; // expected-error {{casting '__local int *' to type '__global int *' changes address space of pointer}} g = (global int*) c; // expected-error {{casting '__constant int *' to type '__global int *' changes address space of pointer}} g = (global int*) cc; // expected-error {{casting 'const __constant int *' to type '__global int *' changes address space of pointer}} - g = (global int*) p; // expected-error {{casting 'int *' to type '__global int *' changes address space of pointer}} + g = (global int*) p; // expected-error {{casting '__private int *' to type '__global int *' changes address space of pointer}} l = (local int*) g; // expected-error {{casting '__global int *' to type '__local int *' changes address space of pointer}} l = (local int*) c; // expected-error {{casting '__constant int *' to type '__local int *' changes address space of pointer}} l = (local int*) cc; // expected-error {{casting 'const __constant int *' to type '__local int *' changes address space of pointer}} - l = (local int*) p; // expected-error {{casting 'int *' to type '__local int *' changes address space of pointer}} + l = (local int*) p; // expected-error {{casting '__private int *' to type '__local int *' changes address space of pointer}} c = (constant int*) g; // expected-error {{casting '__global int *' to type '__constant int *' changes address space of pointer}} c = (constant int*) l; // expected-error {{casting '__local int *' to type '__constant int *' changes address space of pointer}} - c = (constant int*) p; // expected-error {{casting 'int *' to type '__constant int *' changes address space of pointer}} + c = (constant int*) p; // expected-error {{casting '__private int *' to type '__constant int *' changes address space of pointer}} - p = (private int*) g; // expected-error {{casting '__global int *' to type 'int *' changes address space of pointer}} - p = (private int*) l; // expected-error {{casting '__local int *' to type 'int *' changes address space of pointer}} - p = (private int*) c; // expected-error {{casting '__constant int *' to type 'int *' changes address space of pointer}} - p = (private int*) cc; // expected-error {{casting 'const __constant int *' to type 'int *' changes address space of pointer}} + p = (private int*) g; // expected-error {{casting '__global int *' to type '__private int *' changes address space of pointer}} + p = (private int*) l; // expected-error {{casting '__local int *' to type '__private int *' changes address space of pointer}} + p = (private int*) c; // expected-error {{casting '__constant int *' to type '__private int *' changes address space of pointer}} + p = (private int*) cc; // expected-error {{casting 'const __constant int *' to type '__private int *' changes address space of pointer}} } void ok_explicit_casts(global int *g, global int* g2, local int* l, local int* l2, private int* p, private int* p2) @@ -40,3 +47,19 @@ l = (local int*) l2; p = (private int*) p2; } + +__private int func_return_priv(void); //expected-error {{return value cannot be qualified with address space}} +__global int func_return_global(void); //expected-error {{return value cannot be qualified with address space}} +__local int func_return_local(void); //expected-error {{return value cannot be qualified with address space}} +__constant int func_return_constant(void); //expected-error {{return value cannot be qualified with address space}} +#if __OPENCL_C_VERSION__ >= 200 +__generic int func_return_generic(void); //expected-error {{return value cannot be qualified with address space}} +#endif + +void func_multiple_addr(void) { + typedef __private int private_int_t; + __local __private int var1; // expected-error {{multiple address spaces specified for type}} + __local __private int *var2; // expected-error {{multiple address spaces specified for type}} + __local private_int_t var3; // expected-error {{multiple address spaces specified for type}} + __local private_int_t *var4; // expected-error {{multiple address spaces specified for type}} +} Index: test/SemaOpenCL/arithmetic-conversions.cl =================================================================== --- test/SemaOpenCL/arithmetic-conversions.cl +++ test/SemaOpenCL/arithmetic-conversions.cl @@ -14,10 +14,10 @@ kernel void foo5(float2 in, global float2 *out) { float* f; - *out = f + in; // expected-error{{cannot convert between vector and non-scalar values ('float *' and 'float2' (vector of 2 'float' values))}} + *out = f + in; // expected-error{{cannot convert between vector and non-scalar values ('__private float *' and 'float2' (vector of 2 'float' values))}} } kernel void foo6(int2 in, global int2 *out) { int* f; - *out = f + in; // expected-error{{cannot convert between vector and non-scalar values ('int *' and 'int2' (vector of 2 'int' values))}} + *out = f + in; // expected-error{{cannot convert between vector and non-scalar values ('__private int *' and 'int2' (vector of 2 'int' values))}} } Index: test/SemaOpenCL/as_type.cl =================================================================== --- test/SemaOpenCL/as_type.cl +++ test/SemaOpenCL/as_type.cl @@ -1,14 +1,14 @@ // RUN: %clang_cc1 %s -emit-llvm -triple spir-unknown-unknown -finclude-default-header -o - -verify -fsyntax-only char3 f1(char16 x) { - return __builtin_astype(x, char3); // expected-error{{invalid reinterpretation: sizes of 'char3' (vector of 3 'char' values) and 'char16' (vector of 16 'char' values) must match}} + return __builtin_astype(x, char3); // expected-error{{invalid reinterpretation: sizes of 'char3' (vector of 3 'char' values) and '__private char16' (vector of 16 'char' values) must match}} } char16 f3(int x) { - return __builtin_astype(x, char16); // expected-error{{invalid reinterpretation: sizes of 'char16' (vector of 16 'char' values) and 'int' must match}} + return __builtin_astype(x, char16); // expected-error{{invalid reinterpretation: sizes of 'char16' (vector of 16 'char' values) and '__private int' must match}} } void foo() { char src = 1; - int dst = as_int(src); // expected-error{{invalid reinterpretation: sizes of 'int' and 'char' must match}} + int dst = as_int(src); // expected-error{{invalid reinterpretation: sizes of 'int' and '__private char' must match}} } Index: test/SemaOpenCL/cl20-device-side-enqueue.cl =================================================================== --- test/SemaOpenCL/cl20-device-side-enqueue.cl +++ test/SemaOpenCL/cl20-device-side-enqueue.cl @@ -91,7 +91,7 @@ }, c, 1024L); #ifdef WCONV -// expected-warning-re@-2{{implicit conversion changes signedness: 'char' to 'unsigned {{int|long}}'}} +// expected-warning-re@-2{{implicit conversion changes signedness: '__private char' to 'unsigned {{int|long}}'}} #endif #define UINT_MAX 4294967295 Index: test/SemaOpenCL/event_t.cl =================================================================== --- test/SemaOpenCL/event_t.cl +++ test/SemaOpenCL/event_t.cl @@ -8,7 +8,7 @@ void foo(event_t evt); // expected-note {{passing argument to parameter 'evt' here}} -void kernel ker(event_t argevt) { // expected-error {{'event_t' cannot be used as the type of a kernel parameter}} +void kernel ker(event_t argevt) { // expected-error {{'__private event_t' cannot be used as the type of a kernel parameter}} event_t e; constant event_t const_evt; // expected-error {{the event_t type can only be used with __private address space qualifier}} foo(e); Index: test/SemaOpenCL/extension-begin.cl =================================================================== --- test/SemaOpenCL/extension-begin.cl +++ test/SemaOpenCL/extension-begin.cl @@ -45,7 +45,7 @@ struct A test_A2; // expected-error {{use of type 'struct A' requires my_ext extension to be enabled}} const struct A test_A_local; // expected-error {{use of type 'struct A' requires my_ext extension to be enabled}} TypedefOfA test_typedef_A; // expected-error {{use of type 'TypedefOfA' (aka 'struct A') requires my_ext extension to be enabled}} - PointerOfA test_A_pointer; // expected-error {{use of type 'PointerOfA' (aka 'const struct A *') requires my_ext extension to be enabled}} + PointerOfA test_A_pointer; // expected-error {{use of type 'PointerOfA' (aka 'const __private struct A *') requires my_ext extension to be enabled}} f(); // expected-error {{use of declaration 'f' requires my_ext extension to be enabled}} g(0); // expected-error {{no matching function for call to 'g'}} // expected-note@-26 {{candidate disabled due to OpenCL extension}} Index: test/SemaOpenCL/half.cl =================================================================== --- test/SemaOpenCL/half.cl +++ test/SemaOpenCL/half.cl @@ -4,13 +4,13 @@ constant float f = 1.0h; // expected-error{{half precision constant requires cl_khr_fp16}} half half_disabled(half *p, // expected-error{{declaring function return value of type 'half' is not allowed}} - half h) // expected-error{{declaring function parameter of type 'half' is not allowed}} + half h) // expected-error{{declaring function parameter of type '__private half' is not allowed}} { - half a[2]; // expected-error{{declaring variable of type 'half [2]' is not allowed}} - half b; // expected-error{{declaring variable of type 'half' is not allowed}} - *p; // expected-error{{loading directly from pointer to type 'half' requires cl_khr_fp16. Use vector data load builtin functions instead}} + half a[2]; // expected-error{{declaring variable of type 'half __private[2]' is not allowed}} + half b; // expected-error{{declaring variable of type '__private half' is not allowed}} + *p; // expected-error{{loading directly from pointer to type '__private half' requires cl_khr_fp16. Use vector data load builtin functions instead}} *p = 0; // expected-error{{assigning directly to pointer to type 'half' requires cl_khr_fp16. Use vector data store builtin functions instead}} - p[1]; // expected-error{{loading directly from pointer to type 'half' requires cl_khr_fp16. Use vector data load builtin functions instead}} + p[1]; // expected-error{{loading directly from pointer to type '__private half' requires cl_khr_fp16. Use vector data load builtin functions instead}} p[1] = 0; // expected-error{{assigning directly to pointer to type 'half' requires cl_khr_fp16. Use vector data store builtin functions instead}} float c = 1.0f; @@ -26,7 +26,7 @@ } kernel void half_disabled_kernel(global half *p, - half h); // expected-error{{declaring function parameter of type 'half' is not allowed; did you forget * ?}} + half h); // expected-error{{declaring function parameter of type '__private half' is not allowed; did you forget * ?}} // Exactly the same as above but with the cl_khr_fp16 extension enabled. #pragma OPENCL EXTENSION cl_khr_fp16 : enable Index: test/SemaOpenCL/images.cl =================================================================== --- test/SemaOpenCL/images.cl +++ test/SemaOpenCL/images.cl @@ -7,26 +7,26 @@ void imgage_access_test(image2d_t img2dro, image3d_t img3dro) { img2d_ro(img2dro); // read_only = read_only - img2d_ro(img3dro); // expected-error{{passing '__read_only image3d_t' to parameter of incompatible type '__read_only image2d_t'}} + img2d_ro(img3dro); // expected-error{{passing '__private __read_only image3d_t' to parameter of incompatible type '__read_only image2d_t'}} } kernel void read_only_access_test(read_only image2d_t img) { img2d_ro(img); // read_only = read_only - img2d_wo(img); // expected-error {{passing '__read_only image2d_t' to parameter of incompatible type '__write_only image2d_t'}} - img2d_rw(img); // expected-error {{passing '__read_only image2d_t' to parameter of incompatible type '__read_write image2d_t'}} + img2d_wo(img); // expected-error {{passing '__private __read_only image2d_t' to parameter of incompatible type '__write_only image2d_t'}} + img2d_rw(img); // expected-error {{passing '__private __read_only image2d_t' to parameter of incompatible type '__read_write image2d_t'}} img2d_default(img); // read_only = read_only } kernel void write_only_access_test(write_only image2d_t img) { - img2d_ro(img); // expected-error {{passing '__write_only image2d_t' to parameter of incompatible type '__read_only image2d_t'}} + img2d_ro(img); // expected-error {{passing '__private __write_only image2d_t' to parameter of incompatible type '__read_only image2d_t'}} img2d_wo(img); // write_only = write_only - img2d_rw(img); // expected-error {{passing '__write_only image2d_t' to parameter of incompatible type '__read_write image2d_t'}} - img2d_default(img); // expected-error {{passing '__write_only image2d_t' to parameter of incompatible type '__read_only image2d_t'}} + img2d_rw(img); // expected-error {{passing '__private __write_only image2d_t' to parameter of incompatible type '__read_write image2d_t'}} + img2d_default(img); // expected-error {{passing '__private __write_only image2d_t' to parameter of incompatible type '__read_only image2d_t'}} } kernel void read_write_access_test(read_write image2d_t img) { - img2d_ro(img); // expected-error {{passing '__read_write image2d_t' to parameter of incompatible type '__read_only image2d_t'}} - img2d_wo(img); // expected-error {{passing '__read_write image2d_t' to parameter of incompatible type '__write_only image2d_t'}} + img2d_ro(img); // expected-error {{passing '__private __read_write image2d_t' to parameter of incompatible type '__read_only image2d_t'}} + img2d_wo(img); // expected-error {{passing '__private __read_write image2d_t' to parameter of incompatible type '__write_only image2d_t'}} img2d_rw(img); //read_write = read_write - img2d_default(img); // expected-error {{passing '__read_write image2d_t' to parameter of incompatible type '__read_only image2d_t'}} + img2d_default(img); // expected-error {{passing '__private __read_write image2d_t' to parameter of incompatible type '__read_only image2d_t'}} } Index: test/SemaOpenCL/invalid-block.cl =================================================================== --- test/SemaOpenCL/invalid-block.cl +++ test/SemaOpenCL/invalid-block.cl @@ -12,7 +12,7 @@ }; f0(bl1); f0(bl2); - bl1 = bl2; // expected-error{{invalid operands to binary expression ('int (__generic ^const)(void)' and 'int (__generic ^const)(void)')}} + bl1 = bl2; // expected-error{{invalid operands to binary expression ('int (__generic ^const __private)(void)' and 'int (__generic ^const __private)(void)')}} int (^const bl3)(); // expected-error{{invalid block variable declaration - must be initialized}} } @@ -53,18 +53,18 @@ bl2_t bl2 = ^(int i) { return 2; }; - bl2_t arr[] = {bl1, bl2}; // expected-error {{array of 'bl2_t' (aka 'int (__generic ^const)(int)') type is invalid in OpenCL}} + bl2_t arr[] = {bl1, bl2}; // expected-error {{array of 'bl2_t' (aka 'int (__generic ^const)(__private int)') type is invalid in OpenCL}} int tmp = i ? bl1(i) // expected-error {{block type cannot be used as expression in ternary expression in OpenCL}} : bl2(i); // expected-error {{block type cannot be used as expression in ternary expression in OpenCL}} } // A block pointer type and all pointer operations are disallowed -void f6(bl2_t *bl_ptr) { // expected-error{{pointer to type '__generic bl2_t' (aka 'int (__generic ^const __generic)(int)') is invalid in OpenCL}} +void f6(bl2_t *bl_ptr) { // expected-error{{pointer to type '__generic bl2_t' (aka 'int (__generic ^const __generic)(__private int)') is invalid in OpenCL}} bl2_t bl = ^(int i) { return 1; }; - bl2_t *p; // expected-error {{pointer to type '__generic bl2_t' (aka 'int (__generic ^const __generic)(int)') is invalid in OpenCL}} - *bl; // expected-error {{invalid argument type 'bl2_t' (aka 'int (__generic ^const)(int)') to unary expression}} - &bl; // expected-error {{invalid argument type 'bl2_t' (aka 'int (__generic ^const)(int)') to unary expression}} + bl2_t *p; // expected-error {{pointer to type '__generic bl2_t' (aka 'int (__generic ^const __generic)(__private int)') is invalid in OpenCL}} + *bl; // expected-error {{invalid argument type '__private bl2_t' (aka 'int (__generic ^const __private)(__private int)') to unary expression}} + &bl; // expected-error {{invalid argument type '__private bl2_t' (aka 'int (__generic ^const __private)(__private int)') to unary expression}} } // A block can't reference another block kernel void f7() { Index: test/SemaOpenCL/invalid-image.cl =================================================================== --- test/SemaOpenCL/invalid-image.cl +++ test/SemaOpenCL/invalid-image.cl @@ -1,15 +1,15 @@ // RUN: %clang_cc1 -verify %s // RUN: %clang_cc1 -verify -D=ATTR_TEST -fms-compatibility %s -void test1(image1d_t *i) {} // expected-error{{pointer to type '__read_only image1d_t' is invalid in OpenCL}} +void test1(image1d_t *i) {} // expected-error{{pointer to type '__private __read_only image1d_t' is invalid in OpenCL}} void test2(image1d_t i) { - image1d_t ti; // expected-error{{type '__read_only image1d_t' can only be used as a function parameter}} + image1d_t ti; // expected-error{{type '__private __read_only image1d_t' can only be used as a function parameter}} image1d_t ai[] = {i, i}; // expected-error{{array of '__read_only image1d_t' type is invalid in OpenCL}} - i=i; // expected-error{{invalid operands to binary expression ('__read_only image1d_t' and '__read_only image1d_t')}} - i+1; // expected-error{{invalid operands to binary expression ('__read_only image1d_t' and 'int')}} - &i; // expected-error{{invalid argument type '__read_only image1d_t' to unary expression}} - *i; // expected-error{{invalid argument type '__read_only image1d_t' to unary expression}} + i=i; // expected-error{{invalid operands to binary expression ('__private __read_only image1d_t' and '__private __read_only image1d_t')}} + i+1; // expected-error{{invalid operands to binary expression ('__private __read_only image1d_t' and 'int')}} + &i; // expected-error{{invalid argument type '__private __read_only image1d_t' to unary expression}} + *i; // expected-error{{invalid argument type '__private __read_only image1d_t' to unary expression}} } image1d_t test3() {} // expected-error{{declaring function return value of type '__read_only image1d_t' is not allowed}} Index: test/SemaOpenCL/invalid-kernel-parameters.cl =================================================================== --- test/SemaOpenCL/invalid-kernel-parameters.cl +++ test/SemaOpenCL/invalid-kernel-parameters.cl @@ -1,6 +1,6 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s -triple spir-unknown-unknown -kernel void half_arg(half x) { } // expected-error{{declaring function parameter of type 'half' is not allowed; did you forget * ?}} +kernel void half_arg(half x) { } // expected-error{{declaring function parameter of type '__private half' is not allowed; did you forget * ?}} #pragma OPENCL EXTENSION cl_khr_fp16 : enable @@ -11,7 +11,7 @@ // TODO: Ban int types, size_t, ptrdiff_t ... -kernel void bool_arg(bool x) { } // expected-error{{'bool' cannot be used as the type of a kernel parameter}} +kernel void bool_arg(bool x) { } // expected-error{{'__private bool' cannot be used as the type of a kernel parameter}} // half kernel argument is allowed when cl_khr_fp16 is enabled. kernel void half_arg(half x) { } @@ -21,7 +21,7 @@ bool x; // expected-note{{field of illegal type 'bool' declared here}} } ContainsBool; -kernel void bool_in_struct_arg(ContainsBool x) { } // expected-error{{'ContainsBool' (aka 'struct ContainsBool') cannot be used as the type of a kernel parameter}} +kernel void bool_in_struct_arg(ContainsBool x) { } // expected-error{{'__private ContainsBool' (aka '__private struct ContainsBool') cannot be used as the type of a kernel parameter}} @@ -37,14 +37,14 @@ typedef struct Foo // expected-note{{within field of type 'Foo' declared here}} { - int* ptrField; // expected-note{{field of illegal pointer type 'int *' declared here}} + int* ptrField; // expected-note{{field of illegal pointer type '__private int *' declared here}} } Foo; kernel void pointer_in_struct_arg(Foo arg) { } // expected-error{{struct kernel parameters may not contain pointers}} typedef union FooUnion // expected-note{{within field of type 'FooUnion' declared here}} { - int* ptrField; // expected-note{{field of illegal pointer type 'int *' declared here}} + int* ptrField; // expected-note{{field of illegal pointer type '__private int *' declared here}} } FooUnion; kernel void pointer_in_union_arg(FooUnion arg) { }// expected-error{{union kernel parameters may not contain pointers}} @@ -54,7 +54,7 @@ int x; struct InnerNestedPointer { - int* ptrField; // expected-note 3 {{field of illegal pointer type 'int *' declared here}} + int* ptrField; // expected-note 3 {{field of illegal pointer type '__private int *' declared here}} } inner; // expected-note 3 {{within field of type 'struct InnerNestedPointer' declared here}} } NestedPointer; @@ -68,7 +68,7 @@ struct InnerNestedPointerComplex { int innerFoo; - int* innerPtrField; // expected-note{{field of illegal pointer type 'int *' declared here}} + int* innerPtrField; // expected-note{{field of illegal pointer type '__private int *' declared here}} } inner; // expected-note{{within field of type 'struct InnerNestedPointerComplex' declared here}} float y; @@ -86,10 +86,10 @@ } inner; // expected-note 2 {{within field of type 'struct InnerNestedBool' declared here}} } NestedBool; -kernel void bool_in_nested_struct_arg(NestedBool arg) { } // expected-error{{'NestedBool' (aka 'struct NestedBool') cannot be used as the type of a kernel parameter}} +kernel void bool_in_nested_struct_arg(NestedBool arg) { } // expected-error{{'__private NestedBool' (aka '__private struct NestedBool') cannot be used as the type of a kernel parameter}} // Warning emitted again for argument used in other kernel -kernel void bool_in_nested_struct_arg_again(NestedBool arg) { } // expected-error{{'NestedBool' (aka 'struct NestedBool') cannot be used as the type of a kernel parameter}} +kernel void bool_in_nested_struct_arg_again(NestedBool arg) { } // expected-error{{'__private NestedBool' (aka '__private struct NestedBool') cannot be used as the type of a kernel parameter}} // Check for note with a struct not defined inside the struct @@ -104,7 +104,7 @@ NestedBool2Inner inner; // expected-note{{within field of type 'NestedBool2Inner' (aka 'struct NestedBool2Inner') declared here}} } NestedBool2; -kernel void bool_in_nested_struct_2_arg(NestedBool2 arg) { } // expected-error{{'NestedBool2' (aka 'struct NestedBool2') cannot be used as the type of a kernel parameter}} +kernel void bool_in_nested_struct_2_arg(NestedBool2 arg) { } // expected-error{{'__private NestedBool2' (aka '__private struct NestedBool2') cannot be used as the type of a kernel parameter}} struct InnerInner Index: test/SemaOpenCL/invalid-pipe-builtin-cl2.0.cl =================================================================== --- test/SemaOpenCL/invalid-pipe-builtin-cl2.0.cl +++ test/SemaOpenCL/invalid-pipe-builtin-cl2.0.cl @@ -10,22 +10,22 @@ read_pipe(tmp, p); // expected-error {{first argument to 'read_pipe' must be a pipe type}} read_pipe(p); // expected-error {{invalid number of arguments to function: 'read_pipe'}} read_pipe(p, rid, tmp, ptr); - read_pipe(p, tmp, tmp, ptr); // expected-error {{invalid argument type to function 'read_pipe' (expecting 'reserve_id_t' having 'int')}} - read_pipe(p, rid, rid, ptr); // expected-error {{invalid argument type to function 'read_pipe' (expecting 'unsigned int' having 'reserve_id_t')}} - read_pipe(p, tmp); // expected-error {{invalid argument type to function 'read_pipe' (expecting 'int *' having 'int')}} + read_pipe(p, tmp, tmp, ptr); // expected-error {{invalid argument type to function 'read_pipe' (expecting 'reserve_id_t' having '__private int')}} + read_pipe(p, rid, rid, ptr); // expected-error {{invalid argument type to function 'read_pipe' (expecting 'unsigned int' having '__private reserve_id_t')}} + read_pipe(p, tmp); // expected-error {{invalid argument type to function 'read_pipe' (expecting 'int *' having '__private int')}} write_pipe(p, ptr); // expected-error {{invalid pipe access modifier (expecting write_only)}} write_pipe(p, rid, tmp, ptr); // expected-error {{invalid pipe access modifier (expecting write_only)}} // reserve_read/write_pipe reserve_read_pipe(p, tmp); - reserve_read_pipe(p, ptr); // expected-error{{invalid argument type to function 'reserve_read_pipe' (expecting 'unsigned int' having '__global int *')}} + reserve_read_pipe(p, ptr); // expected-error{{invalid argument type to function 'reserve_read_pipe' (expecting 'unsigned int' having '__global int *__private')}} work_group_reserve_read_pipe(tmp, tmp); // expected-error{{first argument to 'work_group_reserve_read_pipe' must be a pipe type}} sub_group_reserve_write_pipe(p, tmp); // expected-error{{invalid pipe access modifier (expecting write_only)}} // commit_read/write_pipe commit_read_pipe(p, rid); commit_read_pipe(tmp, rid); // expected-error{{first argument to 'commit_read_pipe' must be a pipe type}} - work_group_commit_read_pipe(p, tmp); // expected-error{{invalid argument type to function 'work_group_commit_read_pipe' (expecting 'reserve_id_t' having 'int')}} + work_group_commit_read_pipe(p, tmp); // expected-error{{invalid argument type to function 'work_group_commit_read_pipe' (expecting 'reserve_id_t' having '__private int')}} sub_group_commit_write_pipe(p, tmp); // expected-error{{invalid pipe access modifier (expecting write_only)}} } @@ -39,22 +39,22 @@ write_pipe(tmp, p); // expected-error {{first argument to 'write_pipe' must be a pipe type}} write_pipe(p); // expected-error {{invalid number of arguments to function: 'write_pipe'}} write_pipe(p, rid, tmp, ptr); - write_pipe(p, tmp, tmp, ptr); // expected-error {{invalid argument type to function 'write_pipe' (expecting 'reserve_id_t' having 'int')}} - write_pipe(p, rid, rid, ptr); // expected-error {{invalid argument type to function 'write_pipe' (expecting 'unsigned int' having 'reserve_id_t')}} - write_pipe(p, tmp); // expected-error {{invalid argument type to function 'write_pipe' (expecting 'int *' having 'int')}} + write_pipe(p, tmp, tmp, ptr); // expected-error {{invalid argument type to function 'write_pipe' (expecting 'reserve_id_t' having '__private int')}} + write_pipe(p, rid, rid, ptr); // expected-error {{invalid argument type to function 'write_pipe' (expecting 'unsigned int' having '__private reserve_id_t')}} + write_pipe(p, tmp); // expected-error {{invalid argument type to function 'write_pipe' (expecting 'int *' having '__private int')}} read_pipe(p, ptr); // expected-error {{invalid pipe access modifier (expecting read_only)}} read_pipe(p, rid, tmp, ptr); // expected-error {{invalid pipe access modifier (expecting read_only)}} // reserve_read/write_pipe reserve_write_pipe(p, tmp); - reserve_write_pipe(p, ptr); // expected-error{{invalid argument type to function 'reserve_write_pipe' (expecting 'unsigned int' having '__global int *')}} + reserve_write_pipe(p, ptr); // expected-error{{invalid argument type to function 'reserve_write_pipe' (expecting 'unsigned int' having '__global int *__private')}} work_group_reserve_write_pipe(tmp, tmp); // expected-error{{first argument to 'work_group_reserve_write_pipe' must be a pipe type}} sub_group_reserve_read_pipe(p, tmp); // expected-error{{invalid pipe access modifier (expecting read_only)}} // commit_read/write_pipe commit_write_pipe(p, rid); commit_write_pipe(tmp, rid); // expected-error{{first argument to 'commit_write_pipe' must be a pipe type}} - work_group_commit_write_pipe(p, tmp); // expected-error{{invalid argument type to function 'work_group_commit_write_pipe' (expecting 'reserve_id_t' having 'int')}} + work_group_commit_write_pipe(p, tmp); // expected-error{{invalid argument type to function 'work_group_commit_write_pipe' (expecting 'reserve_id_t' having '__private int')}} sub_group_commit_read_pipe(p, tmp); // expected-error{{invalid pipe access modifier (expecting read_only)}} } Index: test/SemaOpenCL/invalid-pipes-cl2.0.cl =================================================================== --- test/SemaOpenCL/invalid-pipes-cl2.0.cl +++ test/SemaOpenCL/invalid-pipes-cl2.0.cl @@ -5,7 +5,7 @@ extern pipe write_only int get_pipe(); // expected-error {{type '__global write_only pipe int ()' can only be used as a function parameter in OpenCL}} -kernel void test_invalid_reserved_id(reserve_id_t ID) { // expected-error {{'reserve_id_t' cannot be used as the type of a kernel parameter}} +kernel void test_invalid_reserved_id(reserve_id_t ID) { // expected-error {{'__private reserve_id_t' cannot be used as the type of a kernel parameter}} } void test1(pipe int *p) {// expected-error {{pipes packet types cannot be of reference type}} @@ -15,15 +15,15 @@ void test3(int pipe p) {// expected-error {{cannot combine with previous 'int' declaration specifier}} } void test4() { - pipe int p; // expected-error {{type 'read_only pipe int' can only be used as a function parameter}} + pipe int p; // expected-error {{type '__private read_only pipe int' can only be used as a function parameter}} //TODO: fix parsing of this pipe int (*p); } void test5(pipe int p) { - p+p; // expected-error{{invalid operands to binary expression ('read_only pipe int' and 'read_only pipe int')}} - p=p; // expected-error{{invalid operands to binary expression ('read_only pipe int' and 'read_only pipe int')}} - &p; // expected-error{{invalid argument type 'read_only pipe int' to unary expression}} - *p; // expected-error{{invalid argument type 'read_only pipe int' to unary expression}} + p+p; // expected-error{{invalid operands to binary expression ('__private read_only pipe int' and '__private read_only pipe int')}} + p=p; // expected-error{{invalid operands to binary expression ('__private read_only pipe int' and '__private read_only pipe int')}} + &p; // expected-error{{invalid argument type '__private read_only pipe int' to unary expression}} + *p; // expected-error{{invalid argument type '__private read_only pipe int' to unary expression}} } typedef pipe int pipe_int_t; Index: test/SemaOpenCL/null_literal.cl =================================================================== --- test/SemaOpenCL/null_literal.cl +++ test/SemaOpenCL/null_literal.cl @@ -1,5 +1,5 @@ // RUN: %clang_cc1 -verify %s -// RUN: %clang_cc1 -cl-std=CL2.0 -DCL20 -verify %s +// RUN: %clang_cc1 -cl-std=CL2.0 -verify %s #define NULL ((void*)0) @@ -11,14 +11,22 @@ constant int* ptr3 = NULL; -constant int* ptr4 = (global void*)0; // expected-error{{initializing '__constant int *' with an expression of type '__global void *' changes address space of pointer}} +constant int* ptr4 = (global void*)0; // expected-error{{initializing '__constant int *__private' with an expression of type '__global void *' changes address space of pointer}} + +#if __OPENCL_C_VERSION__ >= 200 -#ifdef CL20 // Accept explicitly pointer to generic address space in OpenCL v2.0. global int* ptr5 = (generic void*)0; + +global int *ptr = (private void *)0; // expected-error{{initializing '__global int *__private' with an expression of type '__private void *' changes address space of pointer}} + +#else + +global int *ptr = (private void *)0; + #endif -global int* ptr6 = (local void*)0; // expected-error{{initializing '__global int *' with an expression of type '__local void *' changes address space of pointer}} +global int* ptr6 = (local void*)0; // expected-error{{initializing '__global int *__private' with an expression of type '__local void *' changes address space of pointer}} bool cmp = ptr1 == NULL; Index: test/SemaOpenCL/null_queue.cl =================================================================== --- test/SemaOpenCL/null_queue.cl +++ test/SemaOpenCL/null_queue.cl @@ -7,6 +7,6 @@ } void init() { - queue_t q1 = 1; // expected-error{{initializing 'queue_t' with an expression of incompatible type 'int'}} + queue_t q1 = 1; // expected-error{{initializing '__private queue_t' with an expression of incompatible type 'int'}} queue_t q = 0; } Index: test/SemaOpenCL/queue_t_overload.cl =================================================================== --- test/SemaOpenCL/queue_t_overload.cl +++ test/SemaOpenCL/queue_t_overload.cl @@ -1,7 +1,7 @@ // RUN: %clang_cc1 %s -cl-std=CL2.0 -verify -pedantic -fsyntax-only -void __attribute__((overloadable)) foo(queue_t, __local char *); // expected-note {{candidate function not viable: no known conversion from 'int' to 'queue_t' for 1st argument}} // expected-note {{candidate function}} -void __attribute__((overloadable)) foo(queue_t, __local float *); // expected-note {{candidate function not viable: no known conversion from 'int' to 'queue_t' for 1st argument}} // expected-note {{candidate function}} +void __attribute__((overloadable)) foo(queue_t, __local char *); // expected-note {{candidate function not viable: no known conversion from 'int' to '__private queue_t' for 1st argument}} // expected-note {{candidate function}} +void __attribute__((overloadable)) foo(queue_t, __local float *); // expected-note {{candidate function not viable: no known conversion from 'int' to '__private queue_t' for 1st argument}} // expected-note {{candidate function}} void kernel ker(__local char *src1, __local float *src2, __global int *src3) { queue_t q; Index: test/SemaOpenCL/sampler_t.cl =================================================================== --- test/SemaOpenCL/sampler_t.cl +++ test/SemaOpenCL/sampler_t.cl @@ -50,7 +50,7 @@ const sampler_t const_smp2; const sampler_t const_smp3 = const_smp; const sampler_t const_smp4 = f(); - const sampler_t const_smp5 = 1.0f; // expected-error{{initializing 'const sampler_t' with an expression of incompatible type 'float'}} + const sampler_t const_smp5 = 1.0f; // expected-error{{initializing 'const __private sampler_t' with an expression of incompatible type 'float'}} const sampler_t const_smp6 = 0x100000000LL; // expected-error{{sampler_t initialization requires 32-bit integer, not 'long long'}} foo(glb_smp); @@ -78,15 +78,15 @@ foo(bad()); } -void bad(sampler_t*); // expected-error{{pointer to type 'sampler_t' is invalid in OpenCL}} +void bad(sampler_t*); // expected-error{{pointer to type '__private sampler_t' is invalid in OpenCL}} void bar() { sampler_t smp1 = CLK_ADDRESS_CLAMP_TO_EDGE | CLK_NORMALIZED_COORDS_TRUE | CLK_FILTER_LINEAR; sampler_t smp2 = CLK_ADDRESS_CLAMP_TO_EDGE | CLK_NORMALIZED_COORDS_TRUE | CLK_FILTER_NEAREST; - smp1=smp2; //expected-error{{invalid operands to binary expression ('sampler_t' and 'sampler_t')}} - smp1+1; //expected-error{{invalid operands to binary expression ('sampler_t' and 'int')}} - &smp1; //expected-error{{invalid argument type 'sampler_t' to unary expression}} - *smp2; //expected-error{{invalid argument type 'sampler_t' to unary expression}} - foo(smp1+1); //expected-error{{invalid operands to binary expression ('sampler_t' and 'int')}} + smp1=smp2; //expected-error{{invalid operands to binary expression ('__private sampler_t' and '__private sampler_t')}} + smp1+1; //expected-error{{invalid operands to binary expression ('__private sampler_t' and 'int')}} + &smp1; //expected-error{{invalid argument type '__private sampler_t' to unary expression}} + *smp2; //expected-error{{invalid argument type '__private sampler_t' to unary expression}} + foo(smp1+1); //expected-error{{invalid operands to binary expression ('__private sampler_t' and 'int')}} } Index: test/SemaOpenCL/shifts.cl =================================================================== --- test/SemaOpenCL/shifts.cl +++ test/SemaOpenCL/shifts.cl @@ -45,7 +45,7 @@ // ** Negative tests ** char2 ntest01(char c, char2 s) { - return c << s; // expected-error {{requested shift is a vector of type 'char2' (vector of 2 'char' values) but the first operand is not a vector ('char')}} + return c << s; // expected-error {{requested shift is a vector of type '__private char2' (vector of 2 'char' values) but the first operand is not a vector ('__private char')}} } char3 ntest02(char3 c, char2 s) { Index: test/SemaOpenCL/to_addr_builtin.cl =================================================================== --- test/SemaOpenCL/to_addr_builtin.cl +++ test/SemaOpenCL/to_addr_builtin.cl @@ -11,7 +11,7 @@ glob = to_global(glob, loc); #if __OPENCL_C_VERSION__ < CL_VERSION_2_0 // expected-error@-2{{implicit declaration of function 'to_global' is invalid in OpenCL}} - // expected-warning@-3{{incompatible integer to pointer conversion assigning to '__global int *' from 'int'}} + // expected-warning@-3{{incompatible integer to pointer conversion assigning to '__global int *__private' from 'int'}} #else // expected-error@-5{{invalid number of arguments to function: 'to_global'}} #endif @@ -19,37 +19,37 @@ int x; glob = to_global(x); #if __OPENCL_C_VERSION__ < CL_VERSION_2_0 - // expected-warning@-2{{incompatible integer to pointer conversion assigning to '__global int *' from 'int'}} + // expected-warning@-2{{incompatible integer to pointer conversion assigning to '__global int *__private' from 'int'}} #else // expected-error@-4{{invalid argument x to function: 'to_global', expecting a generic pointer argument}} #endif glob = to_global(con); #if __OPENCL_C_VERSION__ < CL_VERSION_2_0 - // expected-warning@-2{{incompatible integer to pointer conversion assigning to '__global int *' from 'int'}} + // expected-warning@-2{{incompatible integer to pointer conversion assigning to '__global int *__private' from 'int'}} #else // expected-error@-4{{invalid argument con to function: 'to_global', expecting a generic pointer argument}} #endif glob = to_global(con_typedef); #if __OPENCL_C_VERSION__ < CL_VERSION_2_0 - // expected-warning@-2{{incompatible integer to pointer conversion assigning to '__global int *' from 'int'}} + // expected-warning@-2{{incompatible integer to pointer conversion assigning to '__global int *__private' from 'int'}} #else // expected-error@-4{{invalid argument con_typedef to function: 'to_global', expecting a generic pointer argument}} #endif loc = to_global(glob); #if __OPENCL_C_VERSION__ < CL_VERSION_2_0 - // expected-warning@-2{{incompatible integer to pointer conversion assigning to '__local int *' from 'int'}} + // expected-warning@-2{{incompatible integer to pointer conversion assigning to '__local int *__private' from 'int'}} #else - // expected-error@-4{{assigning '__global int *' to '__local int *' changes address space of pointer}} + // expected-error@-4{{assigning '__global int *' to '__local int *__private' changes address space of pointer}} #endif global char *glob_c = to_global(loc); #if __OPENCL_C_VERSION__ < CL_VERSION_2_0 - // expected-warning@-2{{incompatible integer to pointer conversion initializing '__global char *' with an expression of type 'int'}} + // expected-warning@-2{{incompatible integer to pointer conversion initializing '__global char *__private' with an expression of type 'int'}} #else - // expected-warning@-4{{incompatible pointer types initializing '__global char *' with an expression of type '__global int *'}} + // expected-warning@-4{{incompatible pointer types initializing '__global char *__private' with an expression of type '__global int *'}} #endif } Index: test/SemaOpenCL/vec_step.cl =================================================================== --- test/SemaOpenCL/vec_step.cl +++ test/SemaOpenCL/vec_step.cl @@ -26,7 +26,7 @@ int res11[vec_step(int16) == 16 ? 1 : -1]; int res12[vec_step(void) == 1 ? 1 : -1]; - int res13 = vec_step(*incomplete1); // expected-error {{'vec_step' requires built-in scalar or vector type, 'struct S' invalid}} - int res14 = vec_step(int16*); // expected-error {{'vec_step' requires built-in scalar or vector type, 'int16 *' invalid}} + int res13 = vec_step(*incomplete1); // expected-error {{'vec_step' requires built-in scalar or vector type, '__private struct S' invalid}} + int res14 = vec_step(int16 *); // expected-error {{'vec_step' requires built-in scalar or vector type, '__private int16 *' invalid}} int res15 = vec_step(void(void)); // expected-error {{'vec_step' requires built-in scalar or vector type, 'void (void)' invalid}} } Index: test/SemaOpenCL/vector_conv_invalid.cl =================================================================== --- test/SemaOpenCL/vector_conv_invalid.cl +++ test/SemaOpenCL/vector_conv_invalid.cl @@ -7,7 +7,7 @@ void vector_conv_invalid() { uint4 u = (uint4)(1); - int4 i = u; // expected-error{{initializing 'int4' (vector of 4 'int' values) with an expression of incompatible type 'uint4' (vector of 4 'unsigned int' values)}} + int4 i = u; // expected-error{{initializing '__private int4' (vector of 4 'int' values) with an expression of incompatible type '__private uint4' (vector of 4 'unsigned int' values)}} int4 e = (int4)u; // expected-error{{invalid conversion between ext-vector type 'int4' (vector of 4 'int' values) and 'uint4' (vector of 4 'unsigned int' values)}} uint3 u4 = (uint3)u; // expected-error{{invalid conversion between ext-vector type 'uint3' (vector of 3 'unsigned int' values) and 'uint4' (vector of 4 'unsigned int' values)}}