summaryrefslogtreecommitdiffstats
path: root/clang/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
commit92a47442f4a362fd634353316d632a1ef87ea106 (patch)
treefde0cc6b7131e237e3420d969dc463f39702e414 /clang/lib/CodeGen/CodeGenFunction.cpp
parent7dc3c0fb2b0464f56074a71db0064b69a08dc325 (diff)
downloadbcm5719-llvm-92a47442f4a362fd634353316d632a1ef87ea106.tar.gz
bcm5719-llvm-92a47442f4a362fd634353316d632a1ef87ea106.zip
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! llvm-svn: 205624
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
index 806540a26ce..ffaba958fb3 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/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");
OpenPOWER on IntegriCloud