diff options
author | Steve Naroff <snaroff@apple.com> | 2008-11-17 19:49:16 +0000 |
---|---|---|
committer | Steve Naroff <snaroff@apple.com> | 2008-11-17 19:49:16 +0000 |
commit | a8069f102f1e7b67927be2e500ee1518e25aafbb (patch) | |
tree | 34a49ec6fa4e99b6c888293ec0c161845c8ef8c2 /lib | |
parent | d0b05a5d07d5d38d05d240da57f5869291ed3e4a (diff) |
Fix <rdar://problem/6316324> [sema] spurious warning on comparison of qualified id.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59459 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 686a8f4008..a5066a8cd7 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -2182,7 +2182,15 @@ QualType Sema::CheckCompareOperands(Expr *&lex, Expr *&rex, SourceLocation loc, if ((lType->isObjCQualifiedIdType() || rType->isObjCQualifiedIdType())) { if (lType->isPointerType() || rType->isPointerType()) { - if (!Context.typesAreCompatible(lType, rType)) { + const PointerType *LPT = lType->getAsPointerType(); + const PointerType *RPT = rType->getAsPointerType(); + bool LPtrToVoid = LPT ? + Context.getCanonicalType(LPT->getPointeeType())->isVoidType() : false; + bool RPtrToVoid = RPT ? + Context.getCanonicalType(RPT->getPointeeType())->isVoidType() : false; + + if (!LPtrToVoid && !RPtrToVoid && + !Context.typesAreCompatible(lType, rType)) { Diag(loc, diag::ext_typecheck_comparison_of_distinct_pointers, lType.getAsString(), rType.getAsString(), lex->getSourceRange(), rex->getSourceRange()); |