[PATCH] D52674: [AST] Add Obj-C discriminator to MS ABI RTTI
John McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 2 18:40:10 PDT 2018
rjmccall added a comment.
In https://reviews.llvm.org/D52674#1253401, @smeenai wrote:
> Actually, I take that back ... I just misread the stack trace.
>
> There are a bunch of hops between the `mangleCXXRTTI` call and the ultimate mangling function:
>
> MicrosoftMangleContextImpl::mangleCXXRTTI(QualType, raw_ostream &)
> MicrosoftCXXNameMangler::mangleType(QualType, SourceRange, QualifierMangleMode)
> MicrosoftCXXNameMangler::mangleType(const ObjCObjectPointerType *, Qualifiers, SourceRange)
> MicrosoftCXXNameMangler::mangleType(QualType, SourceRange, QualifierMangleMode)
> MicrosoftCXXNameMangler::mangleType(const ObjCObjectType *, Qualifiers, SourceRange)
>
>
> (the last one will be `ObjCInterfaceType` instead of `ObjCObjectType` if catching anything other than `id`)
>
> Threading a `ForRTTI` flag or similar all the way to the final call seems pretty tricky. I can add an optional paramater to `mangleType(QualType, SourceRange, QualifierMangleMode)`, but that function uses a generated switch case <https://reviews.llvm.org/diffusion/L/browse/cfe/trunk/lib/AST/MicrosoftMangle.cpp;343652$1833-1847> to call the specific `mangleType` functions, and I don't know how to special-case certain types in that switch case (to pass the extra parameter along) without doing something super ugly. Adding the extra parameter to every single `mangleType` overload seems highly non-ideal, which is why I was thinking of maintaining some internal state instead.
Well, that's why I was talking about how the pointee type of an `ObjCObjectPointerType` is always an `ObjCObjectType` (of which `ObjCInterfaceType` is a subclass) — the implication being that you don't actually have to do the `switch` to dispatch to one of those two cases.
Repository:
rC Clang
https://reviews.llvm.org/D52674
More information about the cfe-commits
mailing list