diff options
author | Steve Naroff <snaroff@apple.com> | 2008-12-10 22:14:21 +0000 |
---|---|---|
committer | Steve Naroff <snaroff@apple.com> | 2008-12-10 22:14:21 +0000 |
commit | c68cfcfd03e0280b9412e4609b5b6434fb77ba5b (patch) | |
tree | c3744412b61c63d88ccb05be4600c1b36e187550 /clang/lib | |
parent | d5021730c847fc5446f909669f391ec6798591b0 (diff) | |
download | bcm5719-llvm-c68cfcfd03e0280b9412e4609b5b6434fb77ba5b.tar.gz bcm5719-llvm-c68cfcfd03e0280b9412e4609b5b6434fb77ba5b.zip |
The "real" fix for <rdar://problem/6424347> clang on xcode: Assertion failed: (0 && "unexpected type"), function mergeTypes,
Commit r60845 was premature.
llvm-svn: 60852
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/AST/ASTContext.cpp | 58 |
1 files changed, 30 insertions, 28 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 233a661a4c9..044106300cb 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -2122,36 +2122,35 @@ QualType ASTContext::mergeTypes(QualType LHS, QualType RHS) { if (LHSClass == Type::ObjCQualifiedInterface) LHSClass = Type::ObjCInterface; if (RHSClass == Type::ObjCQualifiedInterface) RHSClass = Type::ObjCInterface; - // ID is compatible with all qualified id types. - if (LHS->isObjCQualifiedIdType()) { - if (const PointerType *PT = RHS->getAsPointerType()) { - QualType pType = PT->getPointeeType(); - if (isObjCIdType(pType)) - return LHS; - // FIXME: need to use ObjCQualifiedIdTypesAreCompatible(LHS, RHS, true). - // Unfortunately, this API is part of Sema (which we don't have access - // to. Need to refactor. The following check is insufficient, since we - // need to make sure the class implements the protocol. - if (pType->isObjCInterfaceType()) - return LHS; - } - } - if (RHS->isObjCQualifiedIdType()) { - if (const PointerType *PT = LHS->getAsPointerType()) { - QualType pType = PT->getPointeeType(); - if (isObjCIdType(pType)) - return RHS; - // FIXME: need to use ObjCQualifiedIdTypesAreCompatible(LHS, RHS, true). - // Unfortunately, this API is part of Sema (which we don't have access - // to. Need to refactor. The following check is insufficient, since we - // need to make sure the class implements the protocol. - if (pType->isObjCInterfaceType()) - return RHS; - } - } // If the canonical type classes don't match. if (LHSClass != RHSClass) { - + // ID is compatible with all qualified id types. + if (LHS->isObjCQualifiedIdType()) { + if (const PointerType *PT = RHS->getAsPointerType()) { + QualType pType = PT->getPointeeType(); + if (isObjCIdType(pType)) + return LHS; + // FIXME: need to use ObjCQualifiedIdTypesAreCompatible(LHS, RHS, true). + // Unfortunately, this API is part of Sema (which we don't have access + // to. Need to refactor. The following check is insufficient, since we + // need to make sure the class implements the protocol. + if (pType->isObjCInterfaceType()) + return LHS; + } + } + if (RHS->isObjCQualifiedIdType()) { + if (const PointerType *PT = LHS->getAsPointerType()) { + QualType pType = PT->getPointeeType(); + if (isObjCIdType(pType)) + return RHS; + // FIXME: need to use ObjCQualifiedIdTypesAreCompatible(LHS, RHS, true). + // Unfortunately, this API is part of Sema (which we don't have access + // to. Need to refactor. The following check is insufficient, since we + // need to make sure the class implements the protocol. + if (pType->isObjCInterfaceType()) + return RHS; + } + } // C99 6.7.2.2p4: Each enumerated type shall be compatible with char, // a signed integer type, or an unsigned integer type. if (const EnumType* ETy = LHS->getAsEnumType()) { @@ -2253,6 +2252,9 @@ QualType ASTContext::mergeTypes(QualType LHS, QualType RHS) { // Distinct ObjC interfaces are not compatible; see canAssignObjCInterfaces // for checking assignment/comparison safety return QualType(); + case Type::ObjCQualifiedId: + // Distinct qualified id's are not compatible. + return QualType(); default: assert(0 && "unexpected type"); return QualType(); |