LGTM with minor changes.

================
Comment at: lib/Sema/SemaExpr.cpp:10617-10624
@@ -10616,3 +10616,10 @@
   case Compatible:
-      DiagnoseAssignmentEnum(DstType, SrcType, SrcExpr);
-      return false;
+    // 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();
+
----------------
Indentation within the `if (...)` is a bit unusual. Please clang-format this 
prior to checkin.

================
Comment at: test/Sema/PR10837.c:1
@@ +1,2 @@
+// RUN: %clang_cc1 %s -verify -fsyntax-only
+
----------------
Please give this test file a better name. Maybe warn-null.c?


http://llvm-reviews.chandlerc.com/D2124
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to