This is an archive of the discontinued LLVM Phabricator instance.

MS ABI: Mangle member pointer template arguments
ClosedPublic

Authored by rnk on Feb 4 2014, 2:48 PM.

Details

Summary

In essence, 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.

Diff Detail

Event Timeline

majnemer added inline comments.Feb 4 2014, 3:09 PM
lib/CodeGen/CGCXXABI.h
46 ↗(On Diff #6865)

Why did this constructor change? I can't find a place where MangleCtx isn't CGM.getContext().createMangleContext().

lib/Sema/SemaTemplate.cpp
4542 ↗(On Diff #6865)

How hard would it be to make this an error when the mangling is truly erroneous?

rnk added a comment.Feb 5 2014, 8:38 AM

I switched over to the class template mangling of memptrs as discussed, because it's unambiguous. We just won't be ABI compatible for function templates instantiated with null data member pointers. Oh well. :)

lib/CodeGen/CGCXXABI.h
46 ↗(On Diff #6865)

Ah, that should be reverted.

lib/Sema/SemaTemplate.cpp
4542 ↗(On Diff #6865)

This is gone now, because we eliminated the ambiguous mangling.

rnk updated this revision to Unknown Object (????).Feb 5 2014, 8:39 AM
  • Avoid ambiguity by using class template mangling for null data memptrs
majnemer accepted this revision.Feb 5 2014, 9:09 AM

LGTM

rnk closed this revision.Feb 5 2014, 9:33 AM

Closed by commit rL200857 (authored by @rnk).