[cfe-commits] r161236 - in /cfe/trunk: lib/AST/RecordLayoutBuilder.cpp test/CodeGenCXX/cxx11-vtable-key-function.cpp

Matthieu Monrocq matthieu.monrocq at gmail.com
Sat Aug 4 03:41:31 PDT 2012


On Fri, Aug 3, 2012 at 10:39 AM, Benjamin Kramer
<benny.kra at googlemail.com>wrote:

> Author: d0k
> Date: Fri Aug  3 03:39:58 2012
> New Revision: 161236
>
> URL: http://llvm.org/viewvc/llvm-project?rev=161236&view=rev
> Log:
> Fix failed to generate vtables in certain cases.
>
> By C++ standard, the vtable should be generated if the first non-inline
> virtual function is defined in the TU.  Current version of clang doesn't
> generate vtable if the first virtual function is defaulted, because the
> key function is regarded as the defaulted function.
>
> Patch by Li Kan!
>
> Added:
>     cfe/trunk/test/CodeGenCXX/cxx11-vtable-key-function.cpp
> Modified:
>     cfe/trunk/lib/AST/RecordLayoutBuilder.cpp
>
> Modified: cfe/trunk/lib/AST/RecordLayoutBuilder.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/RecordLayoutBuilder.cpp?rev=161236&r1=161235&r2=161236&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/AST/RecordLayoutBuilder.cpp (original)
> +++ cfe/trunk/lib/AST/RecordLayoutBuilder.cpp Fri Aug  3 03:39:58 2012
> @@ -2351,6 +2351,9 @@
>      if (MD->hasInlineBody())
>        continue;
>
> +    if (!MD->isUserProvided())
> +      continue;
> +
>      // We found it.
>      return MD;
>    }
>
> Added: cfe/trunk/test/CodeGenCXX/cxx11-vtable-key-function.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/cxx11-vtable-key-function.cpp?rev=161236&view=auto
>
> ==============================================================================
> --- cfe/trunk/test/CodeGenCXX/cxx11-vtable-key-function.cpp (added)
> +++ cfe/trunk/test/CodeGenCXX/cxx11-vtable-key-function.cpp Fri Aug  3
> 03:39:58 2012
> @@ -0,0 +1,11 @@
> +// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o -
> -std=c++11 | FileCheck %s
> +// PR13424
> +
> +struct X {
> +  virtual ~X() = default;
> +  virtual void f();
> +};
> +
> +void X::f() {}
> +
> +// CHECK: @_ZTV1X = unnamed_addr constant
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>

I somehow doubt that the C++ Standard would require anything like that,
since it does not even mention virtual tables to begin with.

Is it not the Itanium ABI ?

-- Matthieu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120804/c792768c/attachment.html>


More information about the cfe-commits mailing list