[PATCH] D22034: [MSVC][DLL] use local vftable mangling only exported classes with virtual destructor

David Majnemer via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 6 11:20:50 PDT 2016


majnemer added a comment.

Thinking about this some more, it is possible for clang to emit code that will make everybody happy:

If a class is being constructed in a constexpr context and all the vftable entries it references are marked import, emit local vftables and reference them in the object.  If a vftable entry it references is not marked import, report an error.

If a class is constructed via operator new and all the vftable entries it references are marked import, emit local vftables and store it in the object after the constructors run.  If a vftable entry it references is not marked import, report an error.

If a class is constructed via a local or global variable and all the vftable entries it references are marked import, create a `dllimport available_externally` vftable.  Otherwise create a normal `dllimport external` vftable.

I believe this behavior captures the best behavior across the spectrum of functionality we all care about: it supports devirtualization, constexpr and importing classes which don't have all their vftable methods exported.


http://reviews.llvm.org/D22034





More information about the cfe-commits mailing list