[PATCH] D68578: [HIP] Fix device stub name
Artem Belevich via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 13 11:55:14 PST 2019
tra added inline comments.
================
Comment at: clang/lib/CodeGen/CodeGenModule.cpp:1099-1108
+ auto *FD = const_cast<NamedDecl *>((ND));
+ if (auto *TD = cast<FunctionDecl>(FD)->getPrimaryTemplate())
+ FD = TD->getTemplatedDecl();
+ auto OldDeclName = FD->getDeclName();
+ auto NewNameStr = std::string("__device_stub__") + OldDeclName.getAsString();
+ auto *NewId = &Context.Idents.get(NewNameStr);
+ auto NewDeclName = DeclarationName(NewId);
----------------
On one hand I like this patch variant much better than the one that changed the mangling itself.
On the other hand this code appears to reply on implementation details. I.e. we're setting new name on `FD` which may or may not be the same as `ND`, but we're always passing `ND` to `getMangledNameImpl()`.
Perhaps we could implement name-tweaking as another `MultiVersionKind` which we already plumb into getMangledNameImpl() and which allows changing the name for target attributes & features.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D68578/new/
https://reviews.llvm.org/D68578
More information about the cfe-commits
mailing list