diff options
author | Alexey Sotkin <alexey.sotkin@intel.com> | 2017-07-26 18:49:54 +0000 |
---|---|---|
committer | Alexey Sotkin <alexey.sotkin@intel.com> | 2017-07-26 18:49:54 +0000 |
commit | 7d7f0dc08b5124d1af9818e2841eeb000eaf9624 (patch) | |
tree | 47446f40ce004f239028bc4e0d21947b0fc47169 /clang/lib/CodeGen/CodeGenFunction.cpp | |
parent | 833ad37c9035baf52fb44e9300e142a756aaedfb (diff) | |
download | bcm5719-llvm-7d7f0dc08b5124d1af9818e2841eeb000eaf9624.tar.gz bcm5719-llvm-7d7f0dc08b5124d1af9818e2841eeb000eaf9624.zip |
[OpenCL] Fix access qualifiers metadata for kernel arguments with typedef
Subscribers: cfe-commits, yaxunl, Anastasia
Differential Revision: https://reviews.llvm.org/D35420
llvm-svn: 309155
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index 93a4a386619..fc7a10d08b2 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -620,7 +620,10 @@ static void GenOpenCLArgMetadata(const FunctionDecl *FD, llvm::Function *Fn, // Get image and pipe access qualifier: if (ty->isImageType()|| ty->isPipeType()) { - const OpenCLAccessAttr *A = parm->getAttr<OpenCLAccessAttr>(); + const Decl *PDecl = parm; + if (auto *TD = dyn_cast<TypedefType>(ty)) + PDecl = TD->getDecl(); + const OpenCLAccessAttr *A = PDecl->getAttr<OpenCLAccessAttr>(); if (A && A->isWriteOnly()) accessQuals.push_back(llvm::MDString::get(Context, "write_only")); else if (A && A->isReadWrite()) |