[PATCH] D22391: [Sema] Add warning for implicitly casting a null constant to a non null pointer type

Akira Hatanaka via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 24 17:03:42 PST 2017


ahatanak added inline comments.


================
Comment at: include/clang/Basic/DiagnosticGroups.td:290
 def NullableToNonNullConversion : DiagGroup<"nullable-to-nonnull-conversion">;
+def NullConstToNonnull : DiagGroup<"null-const-to-nonnull">;
 def NullabilityCompletenessOnArrays : DiagGroup<"nullability-completeness-on-arrays">;
----------------
jordan_rose wrote:
> Nitpick: Using "const" here makes me think of the qualifier. Is there a reason not to just spell out "constant"?
I probably just wanted it to be shorter, but I'll change it to constant as you suggested.


================
Comment at: include/clang/Basic/DiagnosticSemaKinds.td:8807
+  "implicitly casting a null constant to non-nullable pointer type %0">,
+  InGroup<NullConstToNonnull>, DefaultIgnore;
+
----------------
jordan_rose wrote:
> Why "DefaultIgnore"? This seems like a good warning to be on all the time.
I think I added DefaultIgnore just because the one above (warn_nullability_lost) had it too. I agree that it probably should be on all the time.


https://reviews.llvm.org/D22391





More information about the cfe-commits mailing list