[cfe-commits] r49138 - /cfe/trunk/lib/Sema/SemaExpr.cpp
Chris Lattner
sabre at nondot.org
Wed Apr 2 22:07:25 PDT 2008
Author: lattner
Date: Thu Apr 3 00:07:25 2008
New Revision: 49138
URL: http://llvm.org/viewvc/llvm-project?rev=49138&view=rev
Log:
Fix a bug where we didn't check the RHS for null, we checked
the LHS for null twice.
Modified:
cfe/trunk/lib/Sema/SemaExpr.cpp
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=49138&r1=49137&r2=49138&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Thu Apr 3 00:07:25 2008
@@ -1494,13 +1494,15 @@
// when handling null pointer constants. One day, we can consider making them
// errors (when -pedantic-errors is enabled).
if (lType->isPointerType() && rType->isPointerType()) { // C99 6.5.8p2
- QualType lpointee = lType->getAsPointerType()->getPointeeType();
- QualType rpointee = rType->getAsPointerType()->getPointeeType();
+ QualType LCanPointeeTy =
+ lType->getAsPointerType()->getPointeeType().getCanonicalType();
+ QualType RCanPointeeTy =
+ rType->getAsPointerType()->getPointeeType().getCanonicalType();
if (!LHSIsNull && !RHSIsNull && // C99 6.5.9p2
- !lpointee->isVoidType() && !lpointee->isVoidType() &&
- !Context.typesAreCompatible(lpointee.getUnqualifiedType(),
- rpointee.getUnqualifiedType())) {
+ !LCanPointeeTy->isVoidType() && !RCanPointeeTy->isVoidType() &&
+ !Context.typesAreCompatible(LCanPointeeTy.getUnqualifiedType(),
+ RCanPointeeTy.getUnqualifiedType())) {
Diag(loc, diag::ext_typecheck_comparison_of_distinct_pointers,
lType.getAsString(), rType.getAsString(),
lex->getSourceRange(), rex->getSourceRange());
More information about the cfe-commits
mailing list