summaryrefslogtreecommitdiff
path: root/lib/CodeGen/CodeGenFunction.cpp
diff options
context:
space:
mode:
authorJoey Gouly <joey.gouly@gmail.com>2014-04-04 13:43:57 +0000
committerJoey Gouly <joey.gouly@gmail.com>2014-04-04 13:43:57 +0000
commitc426836180304420f356caaba15b6128d88b7fb9 (patch)
tree84b70082a245d85772ffcea4d85b505657dc59f8 /lib/CodeGen/CodeGenFunction.cpp
parentef95faf680799e3eb69eeddf7630a0cb4a0237f9 (diff)
downloadclang-c426836180304420f356caaba15b6128d88b7fb9.tar.gz
clang-c426836180304420f356caaba15b6128d88b7fb9.tar.bz2
clang-c426836180304420f356caaba15b6128d88b7fb9.tar.xz
When printing types for the OpenCL kernel metadata, use the PrintingPolicy.
This allows 'half' to be printed as 'half' and not as '__fp16'. Patch by Fraser Cormack! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205624 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r--lib/CodeGen/CodeGenFunction.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp
index 806540a26c..ffaba958fb 100644
--- a/lib/CodeGen/CodeGenFunction.cpp
+++ b/lib/CodeGen/CodeGenFunction.cpp
@@ -339,6 +339,8 @@ static void GenOpenCLArgMetadata(const FunctionDecl *FD, llvm::Function *Fn,
// Each MDNode is a list in the form of "key", N number of values which is
// the same number of values as their are kernel arguments.
+ const PrintingPolicy &Policy = ASTCtx.getPrintingPolicy();
+
// MDNode for the kernel argument address space qualifiers.
SmallVector<llvm::Value*, 8> addressQuals;
addressQuals.push_back(llvm::MDString::get(Context, "kernel_arg_addr_space"));
@@ -372,7 +374,8 @@ static void GenOpenCLArgMetadata(const FunctionDecl *FD, llvm::Function *Fn,
pointeeTy.getAddressSpace())));
// Get argument type name.
- std::string typeName = pointeeTy.getUnqualifiedType().getAsString() + "*";
+ std::string typeName =
+ pointeeTy.getUnqualifiedType().getAsString(Policy) + "*";
// Turn "unsigned type" to "utype"
std::string::size_type pos = typeName.find("unsigned");
@@ -398,7 +401,7 @@ static void GenOpenCLArgMetadata(const FunctionDecl *FD, llvm::Function *Fn,
addressQuals.push_back(Builder.getInt32(AddrSpc));
// Get argument type name.
- std::string typeName = ty.getUnqualifiedType().getAsString();
+ std::string typeName = ty.getUnqualifiedType().getAsString(Policy);
// Turn "unsigned type" to "utype"
std::string::size_type pos = typeName.find("unsigned");