r217654 - MS ABI: The latest VC "14" CTP implements deleted virtual functions

Timur Iskhodzhanov timurrrr at google.com
Wed Oct 1 06:07:22 PDT 2014


There's also no test that verifies we put "_purecall" into the vftable, right?

2014-09-26 21:52 GMT+04:00 David Majnemer <david.majnemer at gmail.com>:
> We could replace it with an out of line constructor.
>
> On Fri, Sep 26, 2014 at 2:36 AM, Timur Iskhodzhanov <timurrrr at google.com>
> wrote:
>>
>> __declspec(dllexport) isn't needed, is it?
>>
>> 2014-09-12 8:38 GMT+04:00 David Majnemer <david.majnemer at gmail.com>:
>> > Author: majnemer
>> > Date: Thu Sep 11 23:38:08 2014
>> > New Revision: 217654
>> >
>> > URL: http://llvm.org/viewvc/llvm-project?rev=217654&view=rev
>> > Log:
>> > MS ABI: The latest VC "14" CTP implements deleted virtual functions
>> >
>> > Deleted virtual functions get _purecall inserted into the vftable.
>> > Earlier CTPs would simply stick nullptr in there.
>> >
>> > N.B.  MSVC can't handle deleted virtual functions which require return
>> > adjusting thunks, they give an error that a deleted function couldn't be
>> > called inside of a compiler generated function.  We get this correct by
>> > making the thunk have a __purecall entry as well.
>> >
>> > Modified:
>> >     cfe/trunk/lib/AST/VTableBuilder.cpp
>> >     cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp
>> >
>> > cfe/trunk/test/CodeGenCXX/microsoft-abi-vtables-virtual-inheritance.cpp
>> >
>> > Modified: cfe/trunk/lib/AST/VTableBuilder.cpp
>> > URL:
>> > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/VTableBuilder.cpp?rev=217654&r1=217653&r2=217654&view=diff
>> >
>> > ==============================================================================
>> > --- cfe/trunk/lib/AST/VTableBuilder.cpp (original)
>> > +++ cfe/trunk/lib/AST/VTableBuilder.cpp Thu Sep 11 23:38:08 2014
>> > @@ -2566,13 +2566,6 @@ private:
>> >      }
>> >    }
>> >
>> > -  void ErrorUnsupported(StringRef Feature, SourceLocation Location) {
>> > -    clang::DiagnosticsEngine &Diags = Context.getDiagnostics();
>> > -    unsigned DiagID = Diags.getCustomDiagID(
>> > -        DiagnosticsEngine::Error, "v-table layout for %0 is not
>> > supported yet");
>> > -    Diags.Report(Context.getFullLoc(Location), DiagID) << Feature;
>> > -  }
>> > -
>> >  public:
>> >    VFTableBuilder(MicrosoftVTableContext &VTables,
>> >                   const CXXRecordDecl *MostDerivedClass, const VPtrInfo
>> > *Which)
>> > @@ -3037,10 +3030,8 @@ void VFTableBuilder::dumpLayout(raw_ostr
>> >        if (MD->isPure())
>> >          Out << " [pure]";
>> >
>> > -      if (MD->isDeleted()) {
>> > -        ErrorUnsupported("deleted methods", MD->getLocation());
>> > +      if (MD->isDeleted())
>> >          Out << " [deleted]";
>> > -      }
>> >
>> >        ThunkInfo Thunk = VTableThunks.lookup(I);
>> >        if (!Thunk.isEmpty())
>> >
>> > Modified: cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp
>> > URL:
>> > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp?rev=217654&r1=217653&r2=217654&view=diff
>> >
>> > ==============================================================================
>> > --- cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp (original)
>> > +++ cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp Thu Sep 11 23:38:08 2014
>> > @@ -63,8 +63,6 @@ public:
>> >    }
>> >
>> >    StringRef GetPureVirtualCallName() override { return "_purecall"; }
>> > -  // No known support for deleted functions in MSVC yet, so this choice
>> > is
>> > -  // arbitrary.
>> >    StringRef GetDeletedVirtualCallName() override { return "_purecall";
>> > }
>> >
>> >    llvm::Value *adjustToCompleteObject(CodeGenFunction &CGF,
>> >
>> > Modified:
>> > cfe/trunk/test/CodeGenCXX/microsoft-abi-vtables-virtual-inheritance.cpp
>> > URL:
>> > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/microsoft-abi-vtables-virtual-inheritance.cpp?rev=217654&r1=217653&r2=217654&view=diff
>> >
>> > ==============================================================================
>> > ---
>> > cfe/trunk/test/CodeGenCXX/microsoft-abi-vtables-virtual-inheritance.cpp
>> > (original)
>> > +++
>> > cfe/trunk/test/CodeGenCXX/microsoft-abi-vtables-virtual-inheritance.cpp Thu
>> > Sep 11 23:38:08 2014
>> > @@ -1,4 +1,4 @@
>> > -// RUN: %clang_cc1 -fno-rtti -emit-llvm -o %t.ll -fdump-vtable-layouts
>> > %s -triple=i386-pc-win32 >%t
>> > +// RUN: %clang_cc1 -std=c++11 -fms-extensions -fno-rtti -emit-llvm -o
>> > %t.ll -fdump-vtable-layouts %s -triple=i386-pc-win32 >%t
>> >  // RUN: FileCheck %s < %t
>> >  // RUN: FileCheck --check-prefix=MANGLING %s < %t.ll
>> >
>> > @@ -764,3 +764,11 @@ struct W : B, Y {
>> >
>> >  W::W() {}
>> >  }
>> > +
>> > +namespace Test13 {
>> > +struct __declspec(dllexport) A {
>> > +  // CHECK-LABEL: VFTable for 'Test13::A' (1 entry).
>> > +  // CHECK-NEXT:   0 | void Test13::A::f() [deleted]
>> > +  virtual void f() = delete;
>> > +};
>> > +}
>> >
>> >
>> > _______________________________________________
>> > cfe-commits mailing list
>> > cfe-commits at cs.uiuc.edu
>> > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>



More information about the cfe-commits mailing list