diff options
author | Reid Kleckner <reid@kleckner.net> | 2014-02-05 17:27:08 +0000 |
---|---|---|
committer | Reid Kleckner <reid@kleckner.net> | 2014-02-05 17:27:08 +0000 |
commit | 9d74e0d38b38a234c577341a55b351328841f52b (patch) | |
tree | 866dae08bc4ea3db8480981a52e39a465a53a1a2 /lib/CodeGen/CGVTables.h | |
parent | 3bb54680c4b6e7d918c82e96ecd56239e3149a5a (diff) |
MS ABI: Mangle member pointer template arguments
Member pointers are mangled as they would be represented at runtime.
They can be a single integer literal, single decl, or a tuple with some
more numbers tossed in. With Clang today, most of those numbers will be
zero because we reject pointers to members of virtual bases.
This change required moving VTableContextBase ownership from
CodeGenVTables to ASTContext, because mangling now depends on vtable
layout.
I also hoisted the inheritance model helpers up to be inline static
methods of MSInheritanceAttr. This makes the AST code that deals with
member pointers much more readable.
MSVC doesn't appear to have stable manglings of null member pointers:
- Null data memptrs in function templates have a mangling collision with
the first field of a non-polymorphic single inheritance class.
- The mangling of null data memptrs changes if you add casts.
- Large null function memptrs in class templates crash MSVC.
Clang uses the class template mangling for null data memptrs and the
function template mangling for null function memptrs to deal with this.
Reviewers: majnemer
Differential Revision: http://llvm-reviews.chandlerc.com/D2695
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@200857 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGVTables.h')
-rw-r--r-- | lib/CodeGen/CGVTables.h | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/CodeGen/CGVTables.h b/lib/CodeGen/CGVTables.h index a8768c22cc..e1554bec82 100644 --- a/lib/CodeGen/CGVTables.h +++ b/lib/CodeGen/CGVTables.h @@ -31,9 +31,8 @@ namespace CodeGen { class CodeGenVTables { CodeGenModule &CGM; - // FIXME: Consider moving VTContext into respective CXXABI classes? - OwningPtr<VTableContextBase> VTContext; - + VTableContextBase *VTContext; + /// VTableAddressPointsMapTy - Address points for a single vtable. typedef llvm::DenseMap<BaseSubobject, uint64_t> VTableAddressPointsMapTy; @@ -71,11 +70,11 @@ public: CodeGenVTables(CodeGenModule &CGM); ItaniumVTableContext &getItaniumVTableContext() { - return *cast<ItaniumVTableContext>(VTContext.get()); + return *cast<ItaniumVTableContext>(VTContext); } MicrosoftVTableContext &getMicrosoftVTableContext() { - return *cast<MicrosoftVTableContext>(VTContext.get()); + return *cast<MicrosoftVTableContext>(VTContext); } /// getSubVTTIndex - Return the index of the sub-VTT for the base class of the |