r222941 - AST: Consider pseudo-struct builtin types as substitutable
David Majnemer
david.majnemer at gmail.com
Fri Nov 28 14:22:46 PST 2014
Author: majnemer
Date: Fri Nov 28 16:22:46 2014
New Revision: 222941
URL: http://llvm.org/viewvc/llvm-project?rev=222941&view=rev
Log:
AST: Consider pseudo-struct builtin types as substitutable
We didn't consider types like ObjCSel as a substitution candidate.
This fixes PR21688.
Added:
cfe/trunk/test/CodeGenObjCXX/subst-sel.mm
Modified:
cfe/trunk/lib/AST/ItaniumMangle.cpp
cfe/trunk/test/CodeGenOpenCL/opencl_types.cl
Modified: cfe/trunk/lib/AST/ItaniumMangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ItaniumMangle.cpp?rev=222941&r1=222940&r2=222941&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ItaniumMangle.cpp (original)
+++ cfe/trunk/lib/AST/ItaniumMangle.cpp Fri Nov 28 16:22:46 2014
@@ -1840,6 +1840,19 @@ void CXXNameMangler::mangleObjCMethodNam
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
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;
Added: cfe/trunk/test/CodeGenObjCXX/subst-sel.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjCXX/subst-sel.mm?rev=222941&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenObjCXX/subst-sel.mm (added)
+++ cfe/trunk/test/CodeGenObjCXX/subst-sel.mm Fri Nov 28 16:22:46 2014
@@ -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) {}
Modified: cfe/trunk/test/CodeGenOpenCL/opencl_types.cl
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenOpenCL/opencl_types.cl?rev=222941&r1=222940&r2=222941&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenOpenCL/opencl_types.cl (original)
+++ cfe/trunk/test/CodeGenOpenCL/opencl_types.cl Fri Nov 28 16:22:46 2014
@@ -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_
More information about the cfe-commits
mailing list