@@ -187,14 +187,13 @@ class Remangler {
187
187
std::string remangle () {
188
188
clang::QualType RetTy;
189
189
SmallVector<clang::QualType> TemplateArgTys;
190
- SmallVector<clang::QualType> ArgTys ;
190
+ SmallVector<clang::QualType> InputArgTys ;
191
191
bool IsVariadic = false ;
192
- nodeToQualTypes (RetTy, TemplateArgTys, ArgTys , IsVariadic);
193
- auto *FD = createKernelDecl (RetTy, TemplateArgTys, ArgTys , IsVariadic);
192
+ nodeToQualTypes (RetTy, TemplateArgTys, InputArgTys , IsVariadic);
193
+ auto *FD = createKernelDecl (RetTy, TemplateArgTys, InputArgTys , IsVariadic);
194
194
assert (MangleContext->shouldMangleDeclName (FD) &&
195
195
" It should always be possible to mangle libclc func." );
196
196
197
-
198
197
SmallString<256 > Buffer;
199
198
raw_svector_ostream Out (Buffer);
200
199
MangleContext->mangleName (FD, Out);
@@ -229,10 +228,11 @@ class Remangler {
229
228
230
229
private:
231
230
// Construct FunctionDecl from return, argument and template types.
232
- FunctionDecl *createKernelDecl (clang::QualType &RetTy,
233
- SmallVector<clang::QualType> &TemplateArgTys,
234
- SmallVector<clang::QualType> &ArgTys,
235
- bool IsVariadic) {
231
+ FunctionDecl *createKernelDecl (
232
+ clang::QualType RetTy, const SmallVector<clang::QualType> &TemplateArgTys,
233
+ const SmallVector<clang::QualType> &InputArgTys, bool IsVariadic) {
234
+ // Copy in InputArgTys as this function can mutate them.
235
+ auto ArgTys{InputArgTys};
236
236
// Create this with a void ret no args prototype, will be fixed up after
237
237
// we've seen all the params.
238
238
FunctionProtoType::ExtProtoInfo Info (CC_OpenCLKernel);
0 commit comments