<div dir="ltr">Thanks - I'll take a look at the bug report.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jul 8, 2021 at 5:27 PM <<a href="mailto:douglas.yung@sony.com">douglas.yung@sony.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi David,<br>
<br>
Your change has caused some failures in the GDB test suite that we run internally. I have put details up in PR51034. Can you please take a look?<br>
<br>
Douglas Yung<br>
<br>
-----Original Message-----<br>
From: cfe-commits <<a href="mailto:cfe-commits-bounces@lists.llvm.org" target="_blank">cfe-commits-bounces@lists.llvm.org</a>> On Behalf Of David Blaikie via cfe-commits<br>
Sent: Tuesday, July 6, 2021 16:28<br>
To: <a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
Subject: [clang] 6c9559b - DebugInfo: Mangle K&R declarations for debug info linkage names<br>
<br>
<br>
Author: David Blaikie<br>
Date: 2021-07-06T16:28:02-07:00<br>
New Revision: 6c9559b67b91966bfeff9e17808a3e84a92e64a0<br>
<br>
URL: <a href="https://urldefense.com/v3/__https://github.com/llvm/llvm-project/commit/6c9559b67b91966bfeff9e17808a3e84a92e64a0__;!!JmoZiZGBv3RvKRSx!vFf7ecy0edfxiybhfYjYVxwii_QJ0ux7EALh-TLSkJxMX6qz3NFd0w9lAa2n-lcD9A$" rel="noreferrer" target="_blank">https://urldefense.com/v3/__https://github.com/llvm/llvm-project/commit/6c9559b67b91966bfeff9e17808a3e84a92e64a0__;!!JmoZiZGBv3RvKRSx!vFf7ecy0edfxiybhfYjYVxwii_QJ0ux7EALh-TLSkJxMX6qz3NFd0w9lAa2n-lcD9A$</a><br>
DIFF: <a href="https://urldefense.com/v3/__https://github.com/llvm/llvm-project/commit/6c9559b67b91966bfeff9e17808a3e84a92e64a0.diff__;!!JmoZiZGBv3RvKRSx!vFf7ecy0edfxiybhfYjYVxwii_QJ0ux7EALh-TLSkJxMX6qz3NFd0w9lAa3n7ANbTQ$" rel="noreferrer" target="_blank">https://urldefense.com/v3/__https://github.com/llvm/llvm-project/commit/6c9559b67b91966bfeff9e17808a3e84a92e64a0.diff__;!!JmoZiZGBv3RvKRSx!vFf7ecy0edfxiybhfYjYVxwii_QJ0ux7EALh-TLSkJxMX6qz3NFd0w9lAa3n7ANbTQ$</a> <br>
<br>
LOG: DebugInfo: Mangle K&R declarations for debug info linkage names<br>
<br>
This fixes a gap in the `overloadable` attribute support (K&R declared functions would get mangled symbol names, but that name wouldn't be represented in the debug info linkage name field for the function) and in -funique-internal-linkage-names (this came up in review discussion on<br>
D98799) where K&R static declarations would not get the uniqued linkage names.<br>
<br>
Added: <br>
    clang/test/CodeGen/overloadable-debug.c<br>
<br>
Modified: <br>
    clang/lib/AST/ItaniumMangle.cpp<br>
    clang/lib/CodeGen/CGDebugInfo.cpp<br>
    clang/test/CodeGen/unique-internal-linkage-names-dwarf.c<br>
<br>
Removed: <br>
<br>
<br>
<br>
################################################################################<br>
diff  --git a/clang/lib/AST/ItaniumMangle.cpp b/clang/lib/AST/ItaniumMangle.cpp index b5b9cd7535196..c40916308611b 100644<br>
--- a/clang/lib/AST/ItaniumMangle.cpp<br>
+++ b/clang/lib/AST/ItaniumMangle.cpp<br>
@@ -649,7 +649,7 @@ bool ItaniumMangleContextImpl::isUniqueInternalLinkageDecl(<br>
<br>
   // For C functions without prototypes, return false as their<br>
   // names should not be mangled.<br>
-  if (!FD->hasPrototype())<br>
+  if (!FD->getType()->getAs<FunctionProtoType>())<br>
     return false;<br>
<br>
   if (isInternalLinkageDecl(ND))<br>
<br>
diff  --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp<br>
index 8a5b246275b15..0363fd7023f32 100644<br>
--- a/clang/lib/CodeGen/CGDebugInfo.cpp<br>
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp<br>
@@ -3546,7 +3546,7 @@ void CGDebugInfo::collectFunctionDeclProps(GlobalDecl GD, llvm::DIFile *Unit,<br>
   const auto *FD = cast<FunctionDecl>(GD.getCanonicalDecl().getDecl());<br>
   Name = getFunctionName(FD);<br>
   // Use mangled name as linkage name for C/C++ functions.<br>
-  if (FD->hasPrototype()) {<br>
+  if (FD->getType()->getAs<FunctionProtoType>()) {<br>
     LinkageName = CGM.getMangledName(GD);<br>
     Flags |= llvm::DINode::FlagPrototyped;<br>
   }<br>
<br>
diff  --git a/clang/test/CodeGen/overloadable-debug.c b/clang/test/CodeGen/overloadable-debug.c<br>
new file mode 100644<br>
index 0000000000000..6eda318844960<br>
--- /dev/null<br>
+++ b/clang/test/CodeGen/overloadable-debug.c<br>
@@ -0,0 +1,6 @@<br>
+// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm <br>
+-debug-info-kind=limited %s -o - | FileCheck %s<br>
+<br>
+__attribute__((overloadable)) void f1(a) int a; { }<br>
+<br>
+// CHECK: !DISubprogram(name: "f1", linkageName: "_Z2f1i"<br>
<br>
diff  --git a/clang/test/CodeGen/unique-internal-linkage-names-dwarf.c b/clang/test/CodeGen/unique-internal-linkage-names-dwarf.c<br>
index e5d507e154aeb..cae839830c6e2 100644<br>
--- a/clang/test/CodeGen/unique-internal-linkage-names-dwarf.c<br>
+++ b/clang/test/CodeGen/unique-internal-linkage-names-dwarf.c<br>
@@ -13,27 +13,15 @@ static int foo(void) {<br>
   return glob;<br>
 }<br>
<br>
-// bar should not be given a uniquefied name under -funique-internal-linkage-names, -// since it doesn't come with valid prototype.<br>
+// K&R prototypes should be given uniquefied names under -funique-internal-linkage-names.<br>
 static int bar(a) int a;<br>
 {<br>
   return glob + a;<br>
 }<br>
<br>
-// go should be given a uniquefied name under -funique-internal-linkage-names, even -// if its definition doesn't come with a valid prototype, but the declaration here -// has a prototype.<br>
-static int go(int);<br>
-<br>
 void baz() {<br>
   foo();<br>
   bar(1);<br>
-  go(2);<br>
-}<br>
-<br>
-static int go(a) int a;<br>
-{<br>
-  return glob + a;<br>
 }<br>
<br>
<br>
@@ -43,13 +31,11 @@ static int go(a) int a;  // PLAIN: distinct !DIGlobalVariable(name: "glob"{{.*}})  // PLAIN: distinct !DISubprogram(name: "foo"{{.*}})  // PLAIN: distinct !DISubprogram(name: "bar"{{.*}}) -// PLAIN: distinct !DISubprogram(name: "go"{{.*}})  // PLAIN-NOT: linkageName:<br>
 //<br>
 // UNIQUE: @glob = internal global i32<br>
 // UNIQUE: define internal i32 @_ZL3foov.[[MODHASH:__uniq.[0-9]+]]()<br>
-// UNIQUE: define internal i32 @bar(i32 %a) -// UNIQUE: define internal i32 @_ZL2goi.[[MODHASH]](i32 %a)<br>
+// UNIQUE: define internal i32 @_ZL3bari.[[MODHASH]](i32 %a)<br>
 // UNIQUE: distinct !DIGlobalVariable(name: "glob"{{.*}})  // UNIQUE: distinct !DISubprogram(name: "foo", linkageName: "_ZL3foov.[[MODHASH]]"{{.*}}) -// UNIQUE: distinct !DISubprogram(name: "go", linkageName: "_ZL2goi.[[MODHASH]]"{{.*}})<br>
+// UNIQUE: distinct !DISubprogram(name: "bar", linkageName: <br>
+"_ZL3bari.[[MODHASH]]"{{.*}})<br>
<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
<a href="https://urldefense.com/v3/__https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits__;!!JmoZiZGBv3RvKRSx!vFf7ecy0edfxiybhfYjYVxwii_QJ0ux7EALh-TLSkJxMX6qz3NFd0w9lAa1uki4Jqw$" rel="noreferrer" target="_blank">https://urldefense.com/v3/__https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits__;!!JmoZiZGBv3RvKRSx!vFf7ecy0edfxiybhfYjYVxwii_QJ0ux7EALh-TLSkJxMX6qz3NFd0w9lAa1uki4Jqw$</a> <br>
</blockquote></div>