[cfe-commits] r166069 - in /cfe/trunk: lib/CodeGen/CGCXXABI.h lib/CodeGen/CGVTables.cpp lib/CodeGen/ItaniumCXXABI.cpp lib/CodeGen/MicrosoftCXXABI.cpp test/CodeGenCXX/vtt-layout.cpp

John McCall rjmccall at apple.com
Tue Oct 16 16:34:20 PDT 2012


On Oct 16, 2012, at 4:24 PM, David Blaikie wrote:
> On Tue, Oct 16, 2012 at 4:19 PM, John McCall <rjmccall at apple.com> wrote:
>> On Oct 16, 2012, at 4:12 PM, David Blaikie wrote:
>>> On Tue, Oct 16, 2012 at 4:09 PM, Eli Friedman <eli.friedman at gmail.com> wrote:
>>>> On Tue, Oct 16, 2012 at 3:56 PM, David Blaikie <dblaikie at gmail.com> wrote:
>>>>> Author: dblaikie
>>>>> Date: Tue Oct 16 17:56:05 2012
>>>>> New Revision: 166069
>>>>> 
>>>>> URL: http://llvm.org/viewvc/llvm-project?rev=166069&view=rev
>>>>> Log:
>>>>> PR13684: Emit vtable entries for deleted functions as __cxa_deleted_function.
>>>>> 
>>>>> This is consistent/interoperable with GCC 4.7 (& __cxa_deleted_function isn't
>>>>> present in 4.4 - not sure when it got added, but you'll need something with
>>>>> that function available for this to work).
>>>> 
>>>> The use of __cxa_deleted_function needs to be guarded by some sort of
>>>> check; it isn't present on any released version of OS X, so generating
>>>> it there will lead to a guaranteed link error.
>>> 
>>> [+John McCall]
>>> 
>>> How else would we like to implement vtables for deleted virtual members?
>> 
>> linkonce_odr hidden function with an evocative name that calls @llvm.trap?
>> The point of this function is just that, if some later version of the class "un-deletes"
>> the function, we should reliably blow up if this version gets called.
> 
> Sure enough - is there any way we should be doing detection of
> __cxa_deleted_function? or should we just implement this in terms of
> this, as you say evocatively named, function always?

Long term, we probably ought to have something like a target C++ runtime
in the same way that we have a target ObjC runtime;  that would be useful
if we ever decide to use, say, a custom personality function.

The less intrusive way to handle this is to condition it on the OS in
the target triple.  Basically, condition it on !isDarwin(), and let us figure out
when/if we can ever enable the behavior.

> (any examples of similar hidden functions I should be looking at for
> reference when implementing this?)

In the blocks code, maybe?

John.



More information about the cfe-commits mailing list