AST: Consider pseudo-struct builtin types as substitutable

We didn't consider types like ObjCSel as a substitution candidate.

This fixes PR21688.

llvm-svn: 222941
This commit is contained in:
David Majnemer 2014-11-28 22:22:46 +00:00
parent 9a9da99673
commit eea02eefe7
3 changed files with 21 additions and 1 deletions

View File

@ -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;

View File

@ -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) {}

View File

@ -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_