From 152493b635c4cbc3f325dab8e88c55a6f81283aa Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Wed, 30 Jul 2014 13:41:12 +0000 Subject: 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 --- clang/lib/CodeGen/CodeGenFunction.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp') 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)); -- cgit v1.2.3