[PATCH] D98799: [UniqueLinkageName] Use consistent checks when mangling symbo linkage name and debug linkage name.

Hongtao Yu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 18 12:44:30 PDT 2021


hoy added inline comments.


================
Comment at: clang/lib/CodeGen/CGDebugInfo.cpp:3525-3526
                                            llvm::DINode::DIFlags &Flags) {
-  const auto *FD = cast<FunctionDecl>(GD.getDecl());
+  GlobalDecl CanonicalGD = GD.getCanonicalDecl();
+  const auto *FD = cast<FunctionDecl>(CanonicalGD.getDecl());
   Name = getFunctionName(FD);
----------------
dblaikie wrote:
> I'd probably roll this into the expression rather than adding another named variable - it doesn't seem to add much readability to me at least. Up to you.
Good point, fixed.


================
Comment at: clang/test/CodeGen/unique-internal-linkage-names-dwarf.c:18
+// since it doesn't come with valid prototype.
+static int bar(a) int a;
+{
----------------
tmsriram wrote:
> Nice test, I didnt know you could do this!
I didn't know either. It's an old C usage. We hit this when compiling mysql.


================
Comment at: clang/test/CodeGen/unique-internal-linkage-names-dwarf.c:34-39
+static int go(a) int a;
+{
+  return glob + a;
+}
+
+
----------------
dblaikie wrote:
> Does this need to be down here? Or would the code be a well exercised if it was up next to the go declaration above?
Yes, it needs to be here. Otherwise it will just like the function `bar` above that doesn't get a uniquefied name. I think moving the definition up to right after the declaration hides the declaration.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D98799/new/

https://reviews.llvm.org/D98799



More information about the cfe-commits mailing list