<br><br><div class="gmail_quote">On Fri, Aug 3, 2012 at 10:39 AM, Benjamin Kramer <span dir="ltr"><<a href="mailto:benny.kra@googlemail.com" target="_blank">benny.kra@googlemail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Author: d0k<br>
Date: Fri Aug  3 03:39:58 2012<br>
New Revision: 161236<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=161236&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=161236&view=rev</a><br>
Log:<br>
Fix failed to generate vtables in certain cases.<br>
<br>
By C++ standard, the vtable should be generated if the first non-inline<br>
virtual function is defined in the TU.  Current version of clang doesn't<br>
generate vtable if the first virtual function is defaulted, because the<br>
key function is regarded as the defaulted function.<br>
<br>
Patch by Li Kan!<br>
<br>
Added:<br>
    cfe/trunk/test/CodeGenCXX/cxx11-vtable-key-function.cpp<br>
Modified:<br>
    cfe/trunk/lib/AST/RecordLayoutBuilder.cpp<br>
<br>
Modified: cfe/trunk/lib/AST/RecordLayoutBuilder.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/RecordLayoutBuilder.cpp?rev=161236&r1=161235&r2=161236&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/RecordLayoutBuilder.cpp?rev=161236&r1=161235&r2=161236&view=diff</a><br>

==============================================================================<br>
--- cfe/trunk/lib/AST/RecordLayoutBuilder.cpp (original)<br>
+++ cfe/trunk/lib/AST/RecordLayoutBuilder.cpp Fri Aug  3 03:39:58 2012<br>
@@ -2351,6 +2351,9 @@<br>
     if (MD->hasInlineBody())<br>
       continue;<br>
<br>
+    if (!MD->isUserProvided())<br>
+      continue;<br>
+<br>
     // We found it.<br>
     return MD;<br>
   }<br>
<br>
Added: cfe/trunk/test/CodeGenCXX/cxx11-vtable-key-function.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/cxx11-vtable-key-function.cpp?rev=161236&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/cxx11-vtable-key-function.cpp?rev=161236&view=auto</a><br>

==============================================================================<br>
--- cfe/trunk/test/CodeGenCXX/cxx11-vtable-key-function.cpp (added)<br>
+++ cfe/trunk/test/CodeGenCXX/cxx11-vtable-key-function.cpp Fri Aug  3 03:39:58 2012<br>
@@ -0,0 +1,11 @@<br>
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - -std=c++11 | FileCheck %s<br>
+// PR13424<br>
+<br>
+struct X {<br>
+  virtual ~X() = default;<br>
+  virtual void f();<br>
+};<br>
+<br>
+void X::f() {}<br>
+<br>
+// CHECK: @_ZTV1X = unnamed_addr constant<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>I somehow doubt that the C++ Standard would require anything like that, since it does not even mention virtual tables to begin with.<br><br>Is it not the Itanium ABI ?<br><br>-- Matthieu<br>