// pseudo-builtins
QualType ObjCIdRedefinitionType;
QualType ObjCClassRedefinitionType;
- QualType ObjCSELRedefinitionType;
+ QualType ObjCSelRedefinitionType;
/// \brief Source ranges for all of the comments in the source file,
/// sorted in order of appearance in the translation unit.
BuiltinInfo(builtins), ExternalSource(0), PrintingPolicy(LOpts) {
ObjCIdRedefinitionType = QualType();
ObjCClassRedefinitionType = QualType();
- ObjCSELRedefinitionType = QualType();
+ ObjCSelRedefinitionType = QualType();
if (size_reserve > 0) Types.reserve(size_reserve);
TUDecl = TranslationUnitDecl::Create(*this);
InitBuiltinTypes();
// FIXME. Accommodate for this in several PCH/Index tests
if (unsigned ObjCSelRedef
= SpecialTypes[pch::SPECIAL_TYPE_OBJC_SEL_REDEFINITION])
- Context->ObjCSELRedefinitionType = GetType(ObjCSelRedef);
+ Context->ObjCSelRedefinitionType = GetType(ObjCSelRedef);
#endif
if (unsigned String = SpecialTypes[pch::SPECIAL_TYPE_BLOCK_DESCRIPTOR])
Context->setBlockDescriptorType(GetType(String));
AddTypeRef(Context.ObjCClassRedefinitionType, Record);
#if 0
// FIXME. Accommodate for this in several PCH/Indexer tests
- AddTypeRef(Context.ObjCSELRedefinitionType, Record);
+ AddTypeRef(Context.ObjCSelRedefinitionType, Record);
#endif
AddTypeRef(Context.getRawBlockdescriptorType(), Record);
AddTypeRef(Context.getRawBlockdescriptorExtendedType(), Record);
&Context.Idents.get("SEL"), SelInfo);
PushOnScopeChains(SelTypedef, TUScope);
Context.setObjCSelType(Context.getTypeDeclType(SelTypedef));
- Context.ObjCSELRedefinitionType = Context.getObjCSelType();
+ Context.ObjCSelRedefinitionType = Context.getObjCSelType();
}
// Synthesize "@class Protocol;
case 3:
if (!TypeID->isStr("SEL"))
break;
- Context.ObjCSELRedefinitionType = New->getUnderlyingType();
+ Context.ObjCSelRedefinitionType = New->getUnderlyingType();
// Install the built-in type for 'SEL', ignoring the current definition.
New->setTypeForDecl(Context.getObjCSelType().getTypePtr());
return;
ImpCastExprToType(BaseExpr, BaseType, CastExpr::CK_BitCast);
}
}
+ // If this is an Objective-C pseudo-builtin and a definition is provided then
+ // use that.
+ if (Context.isObjCSelType(BaseType)) {
+ // We have an 'SEL' type. Rather than fall through, we check if this
+ // is a reference to 'sel_id'.
+ if (BaseType != Context.ObjCSelRedefinitionType) {
+ BaseType = Context.ObjCSelRedefinitionType;
+ ImpCastExprToType(BaseExpr, BaseType, CastExpr::CK_BitCast);
+ }
+ }
assert(!BaseType.isNull() && "no type for member expression");
// Handle properties on ObjC 'Class' types.
ImpCastExprToType(LHS, RHSTy, CastExpr::CK_BitCast);
return RHSTy;
}
+ // And the same for struct objc_selector* / SEL
+ if (Context.isObjCSelType(LHSTy) &&
+ (RHSTy.getDesugaredType() == Context.ObjCSelRedefinitionType)) {
+ ImpCastExprToType(RHS, LHSTy, CastExpr::CK_BitCast);
+ return LHSTy;
+ }
+ if (Context.isObjCSelType(RHSTy) &&
+ (LHSTy.getDesugaredType() == Context.ObjCSelRedefinitionType)) {
+ ImpCastExprToType(LHS, RHSTy, CastExpr::CK_BitCast);
+ return RHSTy;
+ }
// Handle block pointer types.
if (LHSTy->isBlockPointerType() || RHSTy->isBlockPointerType()) {
if (!LHSTy->isBlockPointerType() || !RHSTy->isBlockPointerType()) {
}
@end
+int func(SEL s1, SEL s2)
+{
+ return s1->sel_id == s2->sel_id;
+}