diff options
author | Saleem Abdulrasool <compnerd@compnerd.org> | 2017-08-23 22:38:58 +0000 |
---|---|---|
committer | Saleem Abdulrasool <compnerd@compnerd.org> | 2017-08-23 22:38:58 +0000 |
commit | 5a3e50a3e6c65850e2462838d846f54a1b2fda30 (patch) | |
tree | 4c6983386bb89483ec92d273328b64ef62e75d13 /clang/lib/AST/MicrosoftMangle.cpp | |
parent | 39eca9b95ab73f3ad442e4980ea0b12df3c134b8 (diff) | |
download | bcm5719-llvm-5a3e50a3e6c65850e2462838d846f54a1b2fda30.tar.gz bcm5719-llvm-5a3e50a3e6c65850e2462838d846f54a1b2fda30.zip |
ObjC++: decorate ObjC interfaces in MSABI properly
`id` needs to be handled specially since it is a `TypedefType` which is
sugar for an `ObjCObjectPointerType` whose pointee is an
`ObjCObjectType` with base `BuiltinType::ObjCIdType` and no protocols
and the first level of pointer gets it own type implementation. `Class`
is similar with the `ObjCClassType` as the base instead.
The qualifiers on the base type of the `ObjCObjectType` need to be
dropped because the innermost `mangleType` will handle the qualifiers
itself.
`id` is desugared to `struct objc_object *` which should be encoded as
`PAUobjc_object@@`. `Class` is desugared to `struct objc_class *` which
should be encoded as `PAUobjc_class@@`.
We were previously applying an extra modifier `A` which will be handled
during the recursive call.
This now properly decorates interface types as well as `Class` and `id`.
This corrects the interactions between C++ and ObjC++ for the type
specifier decoration.
llvm-svn: 311617
Diffstat (limited to 'clang/lib/AST/MicrosoftMangle.cpp')
-rw-r--r-- | clang/lib/AST/MicrosoftMangle.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/clang/lib/AST/MicrosoftMangle.cpp b/clang/lib/AST/MicrosoftMangle.cpp index 24b16f892e7..5afaeef1eec 100644 --- a/clang/lib/AST/MicrosoftMangle.cpp +++ b/clang/lib/AST/MicrosoftMangle.cpp @@ -2324,13 +2324,15 @@ void MicrosoftCXXNameMangler::mangleType(const PointerType *T, Qualifiers Quals, manglePointerExtQualifiers(Quals, PointeeType); mangleType(PointeeType, Range); } + void MicrosoftCXXNameMangler::mangleType(const ObjCObjectPointerType *T, Qualifiers Quals, SourceRange Range) { + if (T->isObjCIdType() || T->isObjCClassType()) + return mangleType(T->getPointeeType(), Range, QMM_Drop); + QualType PointeeType = T->getPointeeType(); manglePointerCVQualifiers(Quals); manglePointerExtQualifiers(Quals, PointeeType); - // Object pointers never have qualifiers. - Out << 'A'; mangleType(PointeeType, Range); } @@ -2438,7 +2440,7 @@ void MicrosoftCXXNameMangler::mangleType(const ObjCObjectType *T, Qualifiers, SourceRange Range) { // We don't allow overloading by different protocol qualification, // so mangling them isn't necessary. - mangleType(T->getBaseType(), Range); + mangleType(T->getBaseType(), Range, QMM_Drop); } void MicrosoftCXXNameMangler::mangleType(const BlockPointerType *T, |