MS ABI: Mangle member pointer template arguments

Press ? to show keyboard shortcuts.
Committed
rnkFeb 5 2014, 9:27 AM
Differential Revision
D2695: MS ABI: Mangle member pointer template arguments
Parents
rL200856: Run the inlining pass even in AOT mode.
Branches
Unknown
Tags
Unknown
Subscribers
None
Description

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

rL200857

cfe/trunk/include/clang/AST/ASTContext.h

Loading...

cfe/trunk/include/clang/AST/DeclCXX.h

Loading...

cfe/trunk/include/clang/AST/Mangle.h

Loading...

cfe/trunk/include/clang/Basic/Attr.td

Loading...

cfe/trunk/lib/AST/ASTContext.cpp

Loading...

cfe/trunk/lib/AST/MicrosoftCXXABI.cpp

Loading...

cfe/trunk/lib/AST/MicrosoftMangle.cpp

Loading...

cfe/trunk/lib/CodeGen/CGVTables.cpp

Loading...

cfe/trunk/lib/CodeGen/CGVTables.h

Loading...

cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp

Loading...

cfe/trunk/test/CodeGenCXX/mangle-ms-templates-memptrs.cpp

Loading...

Add Comment