<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">The rationale is no different for DWARF than for CodeView, there's no other way to get the fully qualified name of an inlined function.  Unless you want to
 connect this up to the existing DWARF hook for putting linkage names on inlined subprograms?  The downside there is that linkage names are probably going to be longer than the qualified names, so maybe that's not such a good idea.  Not knowing how these names
 get used by a consumer of â€“gmlt data, hard for me to judge.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">IIRC when I put linkage-names in for inlined functions, it added ~1% to the normal ("limited") debug-info size.  You'd be adding smaller names to much smaller
 debug-info so the percentage is bound to be bigger.  You'll want to collect some hard data but I'd guess it would not be horrifying.<o:p></o:p></span></p>
<p class="MsoNormal"><a name="_MailEndCompose"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">--paulr<o:p></o:p></span></a></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> cfe-commits [mailto:cfe-commits-bounces@lists.llvm.org]
<b>On Behalf Of </b>Reid Kleckner via cfe-commits<br>
<b>Sent:</b> Thursday, June 30, 2016 11:06 AM<br>
<b>To:</b> cfe-commits; David Blaikie; Robinson, Paul<br>
<b>Subject:</b> Re: r274246 - [codeview] Emit qualified display names if -gline-tables-only is on<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">David and Paul,<o:p></o:p></p>
<div>
<p class="MsoNormal"><br>
Do you think I should enable this behavior for DWARF as well? We only emit a DW_TAG_subprogram when a function is inlined or contains inlined functions, which might not be that many. IIRC Paul did something similar with DW_AT_linkage_name, and the object file
 size cost wasn't that bad.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Reid<o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">On Thu, Jun 30, 2016 at 10:41 AM, Reid Kleckner via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>> wrote:<o:p></o:p></p>
<p class="MsoNormal">Author: rnk<br>
Date: Thu Jun 30 12:41:31 2016<br>
New Revision: 274246<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=274246&view=rev" target="_blank">
http://llvm.org/viewvc/llvm-project?rev=274246&view=rev</a><br>
Log:<br>
[codeview] Emit qualified display names if -gline-tables-only is on<br>
<br>
When -gmlt is on, we don't emit namespace or class scope information,<br>
and the CodeView emission code in LLVM can't compute the fully qualified<br>
name. If we know LLVM won't be able to get the name right, go ahead and<br>
emit the qualified name in the frontend.<br>
<br>
We could change our -gmlt emission strategy to include those scopes when<br>
emitting codeview, but that would increase memory usage and slow down<br>
LTO and add more complexity to debug info emission.<br>
<br>
The same problem exists when you debug a -gmlt binary with GDB, so we<br>
should consider removing '&& EmitCodeView' from the condition here at<br>
some point in the future after evaluating the impact on object file<br>
size.<br>
<br>
Modified:<br>
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp<br>
    cfe/trunk/test/CodeGenCXX/debug-info-codeview-display-name.cpp<br>
<br>
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=274246&r1=274245&r2=274246&view=diff" target="_blank">
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=274246&r1=274245&r2=274246&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)<br>
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Thu Jun 30 12:41:31 2016<br>
@@ -185,17 +185,27 @@ StringRef CGDebugInfo::getFunctionName(c<br>
   FunctionTemplateSpecializationInfo *Info =<br>
       FD->getTemplateSpecializationInfo();<br>
<br>
-  if (!Info && FII)<br>
+  // Emit the unqualified name in normal operation. LLVM and the debugger can<br>
+  // compute the fully qualified name from the scope chain. If we're only<br>
+  // emitting line table info, there won't be any scope chains, so emit the<br>
+  // fully qualified name here so that stack traces are more accurate.<br>
+  // FIXME: Do this when emitting DWARF as well as when emitting CodeView after<br>
+  // evaluating the size impact.<br>
+  bool UseQualifiedName = DebugKind == codegenoptions::DebugLineTablesOnly &&<br>
+                          CGM.getCodeGenOpts().EmitCodeView;<br>
+<br>
+  if (!Info && FII && !UseQualifiedName)<br>
     return FII->getName();<br>
<br>
-  // Otherwise construct human readable name for debug info.<br>
   SmallString<128> NS;<br>
   llvm::raw_svector_ostream OS(NS);<br>
   PrintingPolicy Policy(CGM.getLangOpts());<br>
   Policy.MSVCFormatting = CGM.getCodeGenOpts().EmitCodeView;<br>
+  if (!UseQualifiedName)<br>
+    FD->printName(OS);<br>
+  else<br>
+    FD->printQualifiedName(OS, Policy);<br>
<br>
-  // Print the unqualified name with some template arguments.<br>
-  FD->printName(OS);<br>
   // Add any template specialization args.<br>
   if (Info) {<br>
     const TemplateArgumentList *TArgs = Info->TemplateArguments;<br>
<br>
Modified: cfe/trunk/test/CodeGenCXX/debug-info-codeview-display-name.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-codeview-display-name.cpp?rev=274246&r1=274245&r2=274246&view=diff" target="_blank">
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-codeview-display-name.cpp?rev=274246&r1=274245&r2=274246&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/test/CodeGenCXX/debug-info-codeview-display-name.cpp (original)<br>
+++ cfe/trunk/test/CodeGenCXX/debug-info-codeview-display-name.cpp Thu Jun 30 12:41:31 2016<br>
@@ -1,14 +1,22 @@<br>
-// RUN: %clang_cc1 -fblocks -debug-info-kind=limited -gcodeview -emit-llvm %s -o - -triple=x86_64-pc-win32 -std=c++98 | \<br>
-// RUN:  grep 'DISubprogram' | sed -e 's/.*name: "\([^"]*\)".*/"\1"/' | FileCheck %s<br>
+// RUN: %clang_cc1 -fblocks -debug-info-kind=limited -gcodeview -emit-llvm %s \<br>
+// RUN:       -o - -triple=x86_64-pc-win32 -std=c++98 | \<br>
+// RUN:    grep 'DISubprogram' | sed -e 's/.*name: "\([^"]*\)".*/"\1"/' | \<br>
+// RUN:    FileCheck %s --check-prefix=CHECK --check-prefix=UNQUAL<br>
+// RUN: %clang_cc1 -fblocks -debug-info-kind=line-tables-only -gcodeview -emit-llvm %s \<br>
+// RUN:       -o - -triple=x86_64-pc-win32 -std=c++98 | \<br>
+// RUN:    grep 'DISubprogram' | sed -e 's/.*name: "\([^"]*\)".*/"\1"/' | \<br>
+// RUN:    FileCheck %s --check-prefix=CHECK --check-prefix=QUAL<br>
<br>
 void freefunc() { }<br>
 // CHECK-DAG: "freefunc"<br>
<br>
 namespace N {<br>
   int b() { return 0; }<br>
-// CHECK-DAG: "b"<br>
+// UNQUAL-DAG: "b"<br>
+// QUAL-DAG: "N::b"<br>
   namespace { void func() { } }<br>
-// CHECK-DAG: "func"<br>
+// UNQUAL-DAG: "func"<br>
+// QUAL-DAG: "N::`anonymous namespace'::func"<br>
 }<br>
<br>
 void _c(void) {<br>
@@ -19,19 +27,24 @@ void _c(void) {<br>
 struct foo {<br>
   int operator+(int);<br>
   foo(){}<br>
-// CHECK-DAG: "foo"<br>
+// UNQUAL-DAG: "foo"<br>
+// QUAL-DAG: "foo::foo"<br>
<br>
   ~foo(){}<br>
-// CHECK-DAG: "~foo"<br>
+// UNQUAL-DAG: "~foo"<br>
+// QUAL-DAG: "foo::~foo"<br>
<br>
   foo(int i){}<br>
-// CHECK-DAG: "foo"<br>
+// UNQUAL-DAG: "foo"<br>
+// QUAL-DAG: "foo::foo"<br>
<br>
   foo(char *q){}<br>
-// CHECK-DAG: "foo"<br>
+// UNQUAL-DAG: "foo"<br>
+// QUAL-DAG: "foo::foo"<br>
<br>
   static foo* static_method() { return 0; }<br>
-// CHECK-DAG: "static_method"<br>
+// UNQUAL-DAG: "static_method"<br>
+// QUAL-DAG: "foo::static_method"<br>
<br>
 };<br>
<br>
@@ -40,7 +53,8 @@ void use_foo() {<br>
   foo::static_method();<br>
 }<br>
<br>
-// CHECK-DAG: "operator+"<br>
+// UNQUAL-DAG: "operator+"<br>
+// QUAL-DAG: "foo::operator+"<br>
 int foo::operator+(int a) { return a; }<br>
<br>
 // PR17371<br>
@@ -60,11 +74,17 @@ void OverloadedNewDelete::operator delet<br>
 void OverloadedNewDelete::operator delete[](void *) { }<br>
 int OverloadedNewDelete::operator+(int x) { return x; };<br>
<br>
-// CHECK-DAG: "operator new"<br>
-// CHECK-DAG: "operator new[]"<br>
-// CHECK-DAG: "operator delete"<br>
-// CHECK-DAG: "operator delete[]"<br>
-// CHECK-DAG: "operator+"<br>
+// UNQUAL-DAG: "operator new"<br>
+// UNQUAL-DAG: "operator new[]"<br>
+// UNQUAL-DAG: "operator delete"<br>
+// UNQUAL-DAG: "operator delete[]"<br>
+// UNQUAL-DAG: "operator+"<br>
+// QUAL-DAG: "OverloadedNewDelete::operator new"<br>
+// QUAL-DAG: "OverloadedNewDelete::operator new[]"<br>
+// QUAL-DAG: "OverloadedNewDelete::operator delete"<br>
+// QUAL-DAG: "OverloadedNewDelete::operator delete[]"<br>
+// QUAL-DAG: "OverloadedNewDelete::operator+"<br>
+<br>
<br>
 template <typename T, void (*)(void)><br>
 void fn_tmpl() {}<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</div>
</body>
</html>