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 | 563803fe16cbd881020e700f2583354afe19facc (patch) | |
tree | 23f253aba1d5199dc97a42ca96fecf88b0222820 /lib/CodeGen/CodeGenFunction.cpp | |
parent | eea8887a7d2888bccc5f4a9012eda8d902eed124 (diff) |
[OpenCL] Fix access qualifiers metadata for kernel arguments with typedef
Subscribers: cfe-commits, yaxunl, Anastasia
Differential Revision: https://reviews.llvm.org/D35420
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@309155 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r-- | lib/CodeGen/CodeGenFunction.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp index 93a4a38661..fc7a10d08b 100644 --- a/lib/CodeGen/CodeGenFunction.cpp +++ b/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()) |