diff options
author | Steve Naroff <snaroff@apple.com> | 2008-12-10 20:07:25 +0000 |
---|---|---|
committer | Steve Naroff <snaroff@apple.com> | 2008-12-10 20:07:25 +0000 |
commit | 13ac125edf4c57bc08cf861efb8fce243ac3388d (patch) | |
tree | 85c80b97f19b4e7613686351aeae4e2e316e7538 /clang/lib/AST | |
parent | 517d05fd0037e5b3231bff325683a7b99e86255c (diff) | |
download | bcm5719-llvm-13ac125edf4c57bc08cf861efb8fce243ac3388d.tar.gz bcm5719-llvm-13ac125edf4c57bc08cf861efb8fce243ac3388d.zip |
Fix <rdar://problem/6424347> clang on xcode: Assertion failed: (0 && "unexpected type"), function mergeTypes,
llvm-svn: 60845
Diffstat (limited to 'clang/lib/AST')
-rw-r--r-- | clang/lib/AST/ASTContext.cpp | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index ba61332a44f..241dce6c95a 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -2126,35 +2126,35 @@ QualType ASTContext::mergeTypes(QualType LHS, QualType RHS) { if (LHSClass == Type::ObjCQualifiedInterface) LHSClass = Type::ObjCInterface; if (RHSClass == Type::ObjCQualifiedInterface) RHSClass = Type::ObjCInterface; - // 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; - } + // 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 (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) { // C99 6.7.2.2p4: Each enumerated type shall be compatible with char, // a signed integer type, or an unsigned integer type. |