r195126 - Revert r194540, it breaks various C++ programs.

Joerg Sonnenberger joerg at bec.de
Tue Nov 19 05:38:38 PST 2013


Author: joerg
Date: Tue Nov 19 07:38:38 2013
New Revision: 195126

URL: http://llvm.org/viewvc/llvm-project?rev=195126&view=rev
Log:
Revert r194540, it breaks various C++ programs.

Removed:
    cfe/trunk/test/Sema/warn-null.c
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=195126&r1=195125&r2=195126&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Tue Nov 19 07:38:38 2013
@@ -10619,17 +10619,8 @@ bool Sema::DiagnoseAssignmentResult(Assi
 
   switch (ConvTy) {
   case Compatible:
-    // See if a proper null pointer constant is to be assigned.
-    if (DstType->isAnyPointerType() && !SrcType->isAnyPointerType() &&
-        SrcExpr->isNullPointerConstant(Context,
-                                       Expr::NPC_NeverValueDependent) ==
-            Expr::NPCK_ZeroExpression &&
-        !isUnevaluatedContext())
-      Diag(SrcExpr->getExprLoc(), diag::warn_non_literal_null_pointer)
-        << DstType << SrcExpr->getSourceRange();
-
-    DiagnoseAssignmentEnum(DstType, SrcType, SrcExpr);
-    return false;
+      DiagnoseAssignmentEnum(DstType, SrcType, SrcExpr);
+      return false;
 
   case PointerToInt:
     DiagKind = diag::ext_typecheck_convert_pointer_int;

Removed: cfe/trunk/test/Sema/warn-null.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/warn-null.c?rev=195125&view=auto
==============================================================================
--- cfe/trunk/test/Sema/warn-null.c (original)
+++ cfe/trunk/test/Sema/warn-null.c (removed)
@@ -1,6 +0,0 @@
-// RUN: %clang_cc1 %s -verify -fsyntax-only
-
-// PR10837: warn if a non-pointer-typed expression is folded to a null pointer
-int *p = 0;
-int *q = '\0';  // expected-warning{{expression which evaluates to zero treated as a null pointer constant}}
-int *r = (1 - 1);  // expected-warning{{expression which evaluates to zero treated as a null pointer constant}}





More information about the cfe-commits mailing list