summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenFunction.cpp
diff options
context:
space:
mode:
authorFraser Cormack <fraser@codeplay.com>2014-07-30 13:41:12 +0000
committerFraser Cormack <fraser@codeplay.com>2014-07-30 13:41:12 +0000
commit152493b635c4cbc3f325dab8e88c55a6f81283aa (patch)
tree4c342e06fa4684ad408cefa52549c790d85193a7 /clang/lib/CodeGen/CodeGenFunction.cpp
parentc3478490ed4d9770a518e688e35aa20aa0099045 (diff)
downloadbcm5719-llvm-152493b635c4cbc3f325dab8e88c55a6f81283aa.tar.gz
bcm5719-llvm-152493b635c4cbc3f325dab8e88c55a6f81283aa.zip
Fix OpenCL/SPIR kernel_arg_type metadata node
This fixes a bug where kernel_arg_type was always changing 'unsigned ' to 'u' for any parameter type, including non-canonical types. Example: typedef unsigned int myunsignedint; would report: "myunt" llvm-svn: 214305
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
index 67eae450e8c..6fe90fd3d47 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
@@ -384,7 +384,7 @@ static void GenOpenCLArgMetadata(const FunctionDecl *FD, llvm::Function *Fn,
// Turn "unsigned type" to "utype"
std::string::size_type pos = typeName.find("unsigned");
- if (pos != std::string::npos)
+ if (pointeeTy.isCanonical() && pos != std::string::npos)
typeName.erase(pos+1, 8);
argTypeNames.push_back(llvm::MDString::get(Context, typeName));
@@ -410,7 +410,7 @@ static void GenOpenCLArgMetadata(const FunctionDecl *FD, llvm::Function *Fn,
// Turn "unsigned type" to "utype"
std::string::size_type pos = typeName.find("unsigned");
- if (pos != std::string::npos)
+ if (ty.isCanonical() && pos != std::string::npos)
typeName.erase(pos+1, 8);
argTypeNames.push_back(llvm::MDString::get(Context, typeName));
OpenPOWER on IntegriCloud