summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExpr.cpp
diff options
context:
space:
mode:
authorSteve Naroff <snaroff@apple.com>2008-11-17 19:49:16 +0000
committerSteve Naroff <snaroff@apple.com>2008-11-17 19:49:16 +0000
commit753567f2c1e7d11447dc06135f128fd50dee1cd1 (patch)
tree79df4eaa315dea5ff948ddd73a282ef3028e925d /clang/lib/Sema/SemaExpr.cpp
parenta687fd833954e2f6a43593ed49a819c280a02c52 (diff)
downloadbcm5719-llvm-753567f2c1e7d11447dc06135f128fd50dee1cd1.tar.gz
bcm5719-llvm-753567f2c1e7d11447dc06135f128fd50dee1cd1.zip
Fix <rdar://problem/6316324> [sema] spurious warning on comparison of qualified id.
llvm-svn: 59459
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
-rw-r--r--clang/lib/Sema/SemaExpr.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 686a8f40083..a5066a8cd7f 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/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());
OpenPOWER on IntegriCloud