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



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to