AST: adjust ObjC MS mangling to work with typedefs
Rather than hardcode the pointerness of the `id` and `class` types, handle them generically. This allows for the template type specialization of `remove_pointer<id>` which would look through the `id` type and deal with the `objc_object` structure without the pointer. llvm-svn: 323241
This commit is contained in:
parent
275ffa4679
commit
6794236ad4
@ -1833,11 +1833,9 @@ void MicrosoftCXXNameMangler::mangleType(const BuiltinType *T, Qualifiers,
|
||||
llvm_unreachable("placeholder types shouldn't get to name mangling");
|
||||
|
||||
case BuiltinType::ObjCId:
|
||||
Out << "PA";
|
||||
mangleArtificalTagType(TTK_Struct, "objc_object");
|
||||
break;
|
||||
case BuiltinType::ObjCClass:
|
||||
Out << "PA";
|
||||
mangleArtificalTagType(TTK_Struct, "objc_class");
|
||||
break;
|
||||
case BuiltinType::ObjCSel:
|
||||
@ -2337,9 +2335,6 @@ void MicrosoftCXXNameMangler::mangleType(const PointerType *T, Qualifiers Quals,
|
||||
|
||||
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);
|
||||
|
||||
@ -33,7 +33,7 @@ void g(id &) {}
|
||||
// CHECK-LABEL: "\01?g@@YAXAAPAUobjc_object@@@Z"
|
||||
|
||||
void g(const id &) {}
|
||||
// CHECK-LABEL: "\01?g@@YAXABPAUobjc_object@@@Z"
|
||||
// CHECK-LABEL: "\01?g@@YAXABQAUobjc_object@@@Z"
|
||||
|
||||
void g(id &&) {}
|
||||
// CHECK-LABEL: "\01?g@@YAX$$QAPAUobjc_object@@@Z"
|
||||
@ -45,7 +45,7 @@ void h(Class &) {}
|
||||
// CHECK-LABEL: "\01?h@@YAXAAPAUobjc_class@@@Z"
|
||||
|
||||
void h(const Class &) {}
|
||||
// CHECK-LABEL: "\01?h@@YAXABPAUobjc_class@@@Z"
|
||||
// CHECK-LABEL: "\01?h@@YAXABQAUobjc_class@@@Z"
|
||||
|
||||
void h(Class &&) {}
|
||||
// CHECK-LABEL: "\01?h@@YAX$$QAPAUobjc_class@@@Z"
|
||||
@ -62,6 +62,12 @@ I &k() { return *kI; }
|
||||
const I &l() { return *kI; }
|
||||
// CHECK-LABEL: "\01?l@@YAABUI@@XZ"
|
||||
|
||||
void m(const id) {}
|
||||
// CHECK-LABEL: "\01?m@@YAXQAUobjc_object@@@Z"
|
||||
|
||||
void m(const I *) {}
|
||||
// CHECK-LABEL: "\01?m@@YAXPBUI@@@Z"
|
||||
|
||||
struct __declspec(dllexport) s {
|
||||
struct s &operator=(const struct s &) = delete;
|
||||
|
||||
@ -93,16 +99,16 @@ struct __declspec(dllexport) s {
|
||||
// CHECK-LABEL: "\01?m@s@@QAAX$$QAPAUobjc_object@@@Z"
|
||||
|
||||
void m(const id &) {}
|
||||
// CHECK-LABEL: "\01?m@s@@QAAXABPAUobjc_object@@@Z"
|
||||
// CHECK-LABEL: "\01?m@s@@QAAXABQAUobjc_object@@@Z"
|
||||
|
||||
void m(const id &&) {}
|
||||
// CHECK-LABEL: "\01?m@s@@QAAX$$QBPAUobjc_object@@@Z"
|
||||
// CHECK-LABEL: "\01?m@s@@QAAX$$QBQAUobjc_object@@@Z"
|
||||
|
||||
void m(Class *) {}
|
||||
// CHECK-LABEL: "\01?m@s@@QAAXPAPAUobjc_class@@@Z"
|
||||
|
||||
void m(const Class *) {}
|
||||
// CHECK-LABEL: "\01?m@s@@QAAXPBPAUobjc_class@@@Z"
|
||||
// CHECK-LABEL: "\01?m@s@@QAAXPBQAUobjc_class@@@Z"
|
||||
|
||||
void m(Class) {}
|
||||
// CHECK-LABEL: "\01?m@s@@QAAXPAUobjc_class@@@Z"
|
||||
@ -111,12 +117,31 @@ struct __declspec(dllexport) s {
|
||||
// CHECK-LABEL: "\01?m@s@@QAAXAAPAUobjc_class@@@Z"
|
||||
|
||||
void m(const Class &) {}
|
||||
// CHECK-LABEL: "\01?m@s@@QAAXABPAUobjc_class@@@Z"
|
||||
// CHECK-LABEL: "\01?m@s@@QAAXABQAUobjc_class@@@Z"
|
||||
|
||||
void m(Class &&) {}
|
||||
// CHECK-LABEL: "\01?m@s@@QAAX$$QAPAUobjc_class@@@Z"
|
||||
|
||||
void m(const Class &&) {}
|
||||
// CHECK-LABEL: "\01?m@s@@QAAX$$QBPAUobjc_class@@@Z"
|
||||
// CHECK-LABEL: "\01?m@s@@QAAX$$QBQAUobjc_class@@@Z"
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct remove_pointer { typedef T type; };
|
||||
|
||||
template <typename T>
|
||||
struct remove_pointer<T *> {
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct t {
|
||||
t() {}
|
||||
};
|
||||
|
||||
template struct t<id>;
|
||||
// CHECK-LABEL: "\01??0?$t@PAUobjc_object@@@@QAA@XZ"
|
||||
|
||||
template struct t<remove_pointer<id>::type>;
|
||||
// CHECK-LABEL: "\01??0?$t@Uobjc_object@@@@QAA@XZ"
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user