On Tue, Jul 31, 2012 at 4:56 AM, John McCall <[email protected]> wrote: > On Jul 27, 2012, at 7:30 AM, Timur Iskhodzhanov wrote: >> Attached is an updated patch which has slightly uglier code (due to >> code duplication) but better mangling. >> The "eta" mangling remains the same, "_E$$A6" has been replaced with >> "_E" everywhere. > > + QualType pointee = T->getPointeeType(); > + assert(isa<FunctionProtoType>(pointee)); > + mangleType(static_cast<const FunctionProtoType*>(pointee.getTypePtr()), > NULL, false, false); > > The easier way to do an assert-and-cast is like this: > cast<FunctionProtoType>(pointee) > > However, you can't actually do a cast here, because there could be a typedef > in the way. Test case: > typedef void fn(); > void foo(fn^ block) { block(); } > > So instead you need to do this: > pointee->castAs<FunctionProtoType>() > This is like getAs<>, but asserting. Thanks for the tip! See the updated patch.
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 ? > John. >
bug_13434_4.patch
Description: Binary data
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
