return methods[i];
}
}
+ // Didn't find one yet - look through protocols.
+ ObjcProtocolDecl **protocols = ClassDecl->getReferencedProtocols();
+ int numProtocols = ClassDecl->getNumIntfRefProtocols();
+ for (int pIdx = 0; pIdx < numProtocols; pIdx++) {
+ ObjcMethodDecl **methods = protocols[pIdx]->getInstanceMethods();
+ int methodCount = protocols[pIdx]->getNumInstanceMethods();
+ for (int i = 0; i < methodCount; ++i) {
+ if (methods[i]->getSelector() == Sel) {
+ return methods[i];
+ }
+ }
+ }
// Didn't find one yet - now look through categories.
- ObjcCategoryDecl *CatDecl = this->getCategoryList();
+ ObjcCategoryDecl *CatDecl = ClassDecl->getCategoryList();
while (CatDecl) {
ObjcMethodDecl **methods = CatDecl->getInstanceMethods();
int methodCount = CatDecl->getNumInstanceMethods();
return methods[i];
}
}
+ // Didn't find one yet - look through protocols.
+ ObjcProtocolDecl **protocols = ClassDecl->getReferencedProtocols();
+ int numProtocols = ClassDecl->getNumIntfRefProtocols();
+ for (int pIdx = 0; pIdx < numProtocols; pIdx++) {
+ ObjcMethodDecl **methods = protocols[pIdx]->getClassMethods();
+ int methodCount = protocols[pIdx]->getNumClassMethods();
+ for (int i = 0; i < methodCount; ++i) {
+ if (methods[i]->getSelector() == Sel) {
+ return methods[i];
+ }
+ }
+ }
// Didn't find one yet - now look through categories.
- ObjcCategoryDecl *CatDecl = this->getCategoryList();
+ ObjcCategoryDecl *CatDecl = ClassDecl->getCategoryList();
while (CatDecl) {
ObjcMethodDecl **methods = CatDecl->getClassMethods();
int methodCount = CatDecl->getNumClassMethods();
return lBuiltin->getKind() == rBuiltin->getKind();
}
+bool Type::interfaceTypesAreCompatible(QualType lhs, QualType rhs) {
+ return true; // FIXME: IMPLEMENT.
+}
+
// C99 6.2.7p1: If both are complete types, then the following additional
// requirements apply...FIXME (handle compatibility across source files).
bool Type::tagTypesAreCompatible(QualType lhs, QualType rhs) {
return tagTypesAreCompatible(lcanon, rcanon);
case Type::Builtin:
return builtinTypesAreCompatible(lcanon, rcanon);
+ case Type::ObjcInterface:
+ return interfaceTypesAreCompatible(lcanon, rcanon);
default:
assert(0 && "unexpected type");
}
QualType returnType;
if (receiverType == GetObjcIdType()) {
- returnType = Context.IntTy; // FIXME:just a placeholder
+ ObjcMethodDecl *Method = InstanceMethodPool[Sel].Method;
+ // FIXME: emit a diagnostic. For now, I want a hard error...
+ assert(Method && "missing method declaration");
+ returnType = Method->getMethodType();
} else {
// FIXME (snaroff): checking in this code from Patrick. Needs to be
// revisited. how do we get the ClassDecl from the receiver expression?
ObjcInterfaceDecl* ClassDecl = static_cast<ObjcInterfaceType*>(
receiverType.getTypePtr())->getDecl();
ObjcMethodDecl *Method = ClassDecl->lookupInstanceMethod(Sel);
+ // FIXME: emit a diagnostic. For now, I want a hard error...
assert(Method && "missing method declaration");
returnType = Method->getMethodType();
}
static bool functionTypesAreCompatible(QualType, QualType); // C99 6.7.5.3p15
static bool arrayTypesAreCompatible(QualType, QualType); // C99 6.7.5.2p6
static bool builtinTypesAreCompatible(QualType, QualType);
+ static bool interfaceTypesAreCompatible(QualType, QualType);
private:
QualType getCanonicalTypeInternal() const { return CanonicalType; }
friend class QualType;