diff options
| author | Steve Naroff <snaroff@apple.com> | 2009-04-14 15:11:46 +0000 |
|---|---|---|
| committer | Steve Naroff <snaroff@apple.com> | 2009-04-14 15:11:46 +0000 |
| commit | 06f440dd7b00ef8970242bcc9de79d223c35075e (patch) | |
| tree | 97f61293d2b40b95ec5f66e60d5abd8c811e2545 /clang/lib/AST | |
| parent | 389325715b3b63f0a6080489a48111960b172d2b (diff) | |
| download | bcm5719-llvm-06f440dd7b00ef8970242bcc9de79d223c35075e.tar.gz bcm5719-llvm-06f440dd7b00ef8970242bcc9de79d223c35075e.zip | |
ASTContext::mergeTypes(): Loosen up the type checking for 'Class' (treating it like 'id').
This fixes <rdar://problem/6782722> XCDataTipsManager.m registers, observes notifications in class methods.
The radar above is the result of clang typing 'self' in a class method as 'Class', which results in some spurious warnings (GCC types 'self' in a class method as 'id').
I considered changing the type of 'self' to 'id' (to conform to GCC), however this resulted in *many* test cases breaking. In addition, I really prefer a more strongly typed 'self'.
All in all, this is the least obtrusive fix I could find for removing the spurious warnings (though we do loose some valid warnings).
llvm-svn: 69041
Diffstat (limited to 'clang/lib/AST')
| -rw-r--r-- | clang/lib/AST/ASTContext.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 7b357318e5f..f0c2d2be484 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -2964,17 +2964,17 @@ QualType ASTContext::mergeTypes(QualType LHS, QualType RHS) { const ObjCInterfaceType* LHSIface = LHS->getAsObjCInterfaceType(); const ObjCInterfaceType* RHSIface = RHS->getAsObjCInterfaceType(); - // ID acts sort of like void* for ObjC interfaces - if (LHSIface && isObjCIdStructType(RHS)) + // 'id' and 'Class' act sort of like void* for ObjC interfaces + if (LHSIface && (isObjCIdStructType(RHS) || isObjCClassStructType(RHS))) return LHS; - if (RHSIface && isObjCIdStructType(LHS)) + if (RHSIface && (isObjCIdStructType(LHS) || isObjCClassStructType(LHS))) return RHS; // ID is compatible with all qualified id types. if (LHS->isObjCQualifiedIdType()) { if (const PointerType *PT = RHS->getAsPointerType()) { QualType pType = PT->getPointeeType(); - if (isObjCIdStructType(pType)) + if (isObjCIdStructType(pType) || isObjCClassStructType(pType)) return LHS; // FIXME: need to use ObjCQualifiedIdTypesAreCompatible(LHS, RHS, true). // Unfortunately, this API is part of Sema (which we don't have access @@ -2987,7 +2987,7 @@ QualType ASTContext::mergeTypes(QualType LHS, QualType RHS) { if (RHS->isObjCQualifiedIdType()) { if (const PointerType *PT = LHS->getAsPointerType()) { QualType pType = PT->getPointeeType(); - if (isObjCIdStructType(pType)) + if (isObjCIdStructType(pType) || isObjCClassStructType(pType)) return RHS; // FIXME: need to use ObjCQualifiedIdTypesAreCompatible(LHS, RHS, true). // Unfortunately, this API is part of Sema (which we don't have access |

