mirror of https://github.com/microsoft/clang.git
AST: Consider pseudo-struct builtin types as substitutable
We didn't consider types like ObjCSel as a substitution candidate. This fixes PR21688. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@222941 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
f661c5aaf0
commit
76742aedda
|
@ -1840,6 +1840,19 @@ void CXXNameMangler::mangleObjCMethodName(const ObjCMethodDecl *MD) {
|
|||
Context.mangleObjCMethodName(MD, Out);
|
||||
}
|
||||
|
||||
static bool isTypeSubstitutable(Qualifiers Quals, const Type *Ty) {
|
||||
if (Quals)
|
||||
return true;
|
||||
if (Ty->isSpecificBuiltinType(BuiltinType::ObjCSel))
|
||||
return true;
|
||||
if (Ty->isOpenCLSpecificType())
|
||||
return true;
|
||||
if (Ty->isBuiltinType())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CXXNameMangler::mangleType(QualType T) {
|
||||
// If our type is instantiation-dependent but not dependent, we mangle
|
||||
// it as it was written in the source, removing any top-level sugar.
|
||||
|
@ -1881,7 +1894,7 @@ void CXXNameMangler::mangleType(QualType T) {
|
|||
Qualifiers quals = split.Quals;
|
||||
const Type *ty = split.Ty;
|
||||
|
||||
bool isSubstitutable = quals || !isa<BuiltinType>(T);
|
||||
bool isSubstitutable = isTypeSubstitutable(quals, ty);
|
||||
if (isSubstitutable && mangleSubstitution(T))
|
||||
return;
|
||||
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
|
||||
|
||||
// CHECK: @_Z4bad1P8NSObjectP13objc_selectorP11objc_objectS4_
|
||||
void bad1(struct NSObject *, SEL, id, id) {}
|
|
@ -35,3 +35,6 @@ kernel void foo(image1d_t img) {
|
|||
fnc4smp(glb_smp);
|
||||
// CHECK: call void @fnc4smp(i32
|
||||
}
|
||||
|
||||
void __attribute__((overloadable)) bad1(image1d_t *b, image2d_t *c, image2d_t *d) {}
|
||||
// CHECK-LABEL: @_Z4bad1P11ocl_image1dP11ocl_image2dS2_
|
||||
|
|
Loading…
Reference in New Issue