diff options
Diffstat (limited to 'clang')
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.cpp | 8 | ||||
-rw-r--r-- | clang/test/CodeGenOpenCL/pipe_types.cl | 20 |
2 files changed, 25 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index a0158d8b4b2..755881fb148 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -516,7 +516,8 @@ static void GenOpenCLArgMetadata(const FunctionDecl *FD, llvm::Function *Fn, // Get argument type name. std::string typeName; if (isPipe) - typeName = cast<PipeType>(ty)->getElementType().getAsString(Policy); + typeName = ty.getCanonicalType()->getAs<PipeType>()->getElementType() + .getAsString(Policy); else typeName = ty.getUnqualifiedType().getAsString(Policy); @@ -529,8 +530,9 @@ static void GenOpenCLArgMetadata(const FunctionDecl *FD, llvm::Function *Fn, std::string baseTypeName; if (isPipe) - baseTypeName = - cast<PipeType>(ty)->getElementType().getCanonicalType().getAsString(Policy); + baseTypeName = ty.getCanonicalType()->getAs<PipeType>() + ->getElementType().getCanonicalType() + .getAsString(Policy); else baseTypeName = ty.getUnqualifiedType().getCanonicalType().getAsString(Policy); diff --git a/clang/test/CodeGenOpenCL/pipe_types.cl b/clang/test/CodeGenOpenCL/pipe_types.cl index 9d8d5274a3b..b9c411b5fcb 100644 --- a/clang/test/CodeGenOpenCL/pipe_types.cl +++ b/clang/test/CodeGenOpenCL/pipe_types.cl @@ -25,3 +25,23 @@ void test4(read_only pipe uchar3 p) { void test5(read_only pipe int4 p) { // CHECK: define void @test5(%opencl.pipe_t* %p) } + +typedef read_only pipe int MyPipe; +kernel void test6(MyPipe p) { +// CHECK: define void @test6(%opencl.pipe_t* %p) +} + +struct Person { + const char *Name; + bool isFemale; + int ID; +}; + +void test_reserved_read_pipe(global struct Person *SDst, + read_only pipe struct Person SPipe) { +// CHECK: define void @test_reserved_read_pipe + read_pipe (SPipe, SDst); + // CHECK: call i32 @__read_pipe_2(%opencl.pipe_t* %{{.*}}, i8* %{{.*}}) + read_pipe (SPipe, SDst); + // CHECK: call i32 @__read_pipe_2(%opencl.pipe_t* %{{.*}}, i8* %{{.*}}) +} |