[cfe-commits] Fix PR13434 - mangling of templates with function pointers as arguments

Timur Iskhodzhanov timurrrr at google.com
Mon Aug 27 02:24:19 PDT 2012


On Mon, Aug 27, 2012 at 1:21 PM, Timur Iskhodzhanov <timurrrr at google.com> wrote:
> On Sat, Aug 25, 2012 at 5:16 AM, John McCall <rjmccall at apple.com> wrote:
>> On Jul 31, 2012, at 4:32 AM, Timur Iskhodzhanov wrote:
>>> FTR, the idea of using static_cast came to me after looking at
>>> MicrosoftMangle:972.
>>> Probably, static_cast should be replaced with getAs/castAs there too ?
>>
>> If it's working on a canonical type, static_cast is fine, although we generally
>> prefer cast<> in such cases.  If it's not a canonical type, it should be castAs.
> Not sure here
It does like this:
=============
  switch (T->getTypeClass()) {
#define ABSTRACT_TYPE(CLASS, PARENT)
#define NON_CANONICAL_TYPE(CLASS, PARENT) \
  case Type::CLASS: \
    llvm_unreachable("can't mangle non-canonical type " #CLASS "Type"); \
    return;
#define TYPE(CLASS, PARENT) \
  case Type::CLASS: \
    mangleType(static_cast<const CLASS##Type*>(T.getTypePtr()), Range); \
    break;
#include "clang/AST/TypeNodes.def"
=============
so I think it is canonical.



More information about the cfe-commits mailing list