On Aug 27, 2012, at 2:24 AM, Timur Iskhodzhanov wrote:
> On Mon, Aug 27, 2012 at 1:21 PM, Timur Iskhodzhanov <[email protected]> 
> wrote:
>> On Sat, Aug 25, 2012 at 5:16 AM, John McCall <[email protected]> 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.

It doesn't need to be canonical here;  it's guaranteed to have the given type
because we're switching on its type kind.

John.
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to