<div dir="rtl"><div dir="ltr">Hi David,</div><div dir="ltr"><br></div><div dir="ltr">This does not compile on VC 2013:</div><div dir="ltr"><br></div><div dir="ltr"><div dir="ltr">1>  CGDebugInfo.cpp</div><div dir="ltr">1>..\..\..\..\..\tools\clang\lib\CodeGen\CGDebugInfo.cpp(1181): error C2446: ':' : no conversion from 'llvm::WeakVH' to 'llvm::DISubprogram'</div><div dir="ltr">1>          No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called</div><div dir="ltr"><br></div><div>refers to:</div><div><br></div><div><div>    EltTys.push_back(MI == SPCache.end()</div><div>                         ? CreateCXXMemberFunction(Method, Unit, RecordTy)</div><div>                         : MI->second);</div></div><div><br></div><div dir="ltr">Yaron<br></div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div dir="ltr">2014-10-06 8:18 GMT+03:00 David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span>:</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: dblaikie<br>
Date: Mon Oct  6 00:18:55 2014<br>
New Revision: 219101<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=219101&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=219101&view=rev</a><br>
Log:<br>
DebugInfo: Don't include implicit special members in the list of class members<br>
<br>
By leaving these members out of the member list, we avoid them being<br>
emitted into type unit definitions - while still allowing the<br>
definition/declaration to be injected into the compile unit as expected.<br>
<br>
Modified:<br>
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp<br>
    cfe/trunk/test/CodeGenCXX/debug-info-template-member.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=219101&r1=219100&r2=219101&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=219101&r1=219100&r2=219101&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)<br>
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Mon Oct  6 00:18:55 2014<br>
@@ -1157,24 +1157,23 @@ CollectCXXMemberFunctions(const CXXRecor<br>
   // have templated functions iterate over every declaration to gather<br>
   // the functions.<br>
   for(const auto *I : RD->decls()) {<br>
-    if (const auto *Method = dyn_cast<CXXMethodDecl>(I)) {<br>
-      // Reuse the existing member function declaration if it exists.<br>
-      // It may be associated with the declaration of the type & should be<br>
-      // reused as we're building the definition.<br>
-      //<br>
-      // This situation can arise in the vtable-based debug info reduction where<br>
-      // implicit members are emitted in a non-vtable TU.<br>
-      llvm::DenseMap<const FunctionDecl *, llvm::WeakVH>::iterator MI =<br>
-          SPCache.find(Method->getCanonicalDecl());<br>
-      if (MI == SPCache.end()) {<br>
-        // If the member is implicit, lazily create it when we see the<br>
-        // definition, not before. (an ODR-used implicit default ctor that's<br>
-        // never actually code generated should not produce debug info)<br>
-        if (!Method->isImplicit())<br>
-          EltTys.push_back(CreateCXXMemberFunction(Method, Unit, RecordTy));<br>
-      } else<br>
-        EltTys.push_back(MI->second);<br>
-    }<br>
+    const auto *Method = dyn_cast<CXXMethodDecl>(I);<br>
+    // If the member is implicit, don't add it to the member list. This avoids<br>
+    // the member being added to type units by LLVM, while still allowing it<br>
+    // to be emitted into the type declaration/reference inside the compile<br>
+    // unit.<br>
+    if (!Method || Method->isImplicit())<br>
+      continue;<br>
+    // Reuse the existing member function declaration if it exists.<br>
+    // It may be associated with the declaration of the type & should be<br>
+    // reused as we're building the definition.<br>
+    //<br>
+    // This situation can arise in the vtable-based debug info reduction where<br>
+    // implicit members are emitted in a non-vtable TU.<br>
+    auto MI = SPCache.find(Method->getCanonicalDecl());<br>
+    EltTys.push_back(MI == SPCache.end()<br>
+                         ? CreateCXXMemberFunction(Method, Unit, RecordTy)<br>
+                         : MI->second);<br>
   }<br>
 }<br>
<br>
<br>
Modified: cfe/trunk/test/CodeGenCXX/debug-info-template-member.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-template-member.cpp?rev=219101&r1=219100&r2=219101&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-template-member.cpp?rev=219101&r1=219100&r2=219101&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/test/CodeGenCXX/debug-info-template-member.cpp (original)<br>
+++ cfe/trunk/test/CodeGenCXX/debug-info-template-member.cpp Mon Oct  6 00:18:55 2014<br>
@@ -28,21 +28,22 @@ inline int add3(int x) {<br>
 // CHECK: [[VIRT_T]] = metadata !{metadata !"0x2f\00T\000\000"{{, [^,]+}}, metadata !"_ZTS4elem", {{.*}} ; [ DW_TAG_template_type_parameter ]<br>
<br>
 // CHECK: [[C:![0-9]*]] = {{.*}}, metadata [[C_MEM:![0-9]*]], metadata !"_ZTS7MyClass", null, metadata !"_ZTS7MyClass"} ; [ DW_TAG_structure_type ] [MyClass]<br>
-// CHECK: [[C_MEM]] = metadata !{metadata [[C_VPTR:![0-9]*]], metadata [[C_FUNC:![0-9]*]], metadata [[C_CTOR:![0-9]*]]}<br>
+// CHECK: [[C_MEM]] = metadata !{metadata [[C_VPTR:![0-9]*]], metadata [[C_FUNC:![0-9]*]]}<br>
 // CHECK: [[C_VPTR]] = {{.*}} ; [ DW_TAG_member ] [_vptr$MyClass]<br>
<br>
 // CHECK: [[C_FUNC]] = {{.*}} ; [ DW_TAG_subprogram ] [line 7] [func]<br>
-// CHECK: [[C_CTOR]] = {{.*}} ; [ DW_TAG_subprogram ] [line 0] [MyClass]<br>
<br>
 // CHECK: [[ELEM:![0-9]*]] = {{.*}}, metadata [[ELEM_MEM:![0-9]*]], null, null, metadata !"_ZTS4elem"} ; [ DW_TAG_structure_type ] [elem] {{.*}} [def]<br>
 // CHECK: [[ELEM_MEM]] = metadata !{metadata [[ELEM_X:![0-9]*]]}<br>
 // CHECK: [[ELEM_X]] = {{.*}} ; [ DW_TAG_member ] [x] {{.*}} [static] [from _ZTS4virtI4elemE]<br>
<br>
-// Check that the member function template specialization refers to its class by<br>
-// scope, even though it didn't appear in the class's member list (C_MEM). This<br>
-// prevents the function from being added to type units, while still appearing<br>
-// in the type declaration/reference in the compile unit.<br>
+// Check that the member function template specialization and implicit special<br>
+// members (the default ctor) refer to their class by scope, even though they<br>
+// didn't appear in the class's member list (C_MEM). This prevents the functions<br>
+// from being added to type units, while still appearing in the type<br>
+// declaration/reference in the compile unit.<br>
 // CHECK: metadata !"_ZTS7MyClass", {{.*}} ; [ DW_TAG_subprogram ] [line 4] [add<2>]<br>
+// CHECK: metadata !"_ZTS7MyClass", {{.*}} ; [ DW_TAG_subprogram ] [line 0] [MyClass]<br>
<br>
 template<typename T><br>
 struct outer {<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div>