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
This commit is contained in:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user