[PATCH] D27837: Add fix-it notes to the nullability consistency warning

Akira Hatanaka via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 16 11:39:51 PST 2016


ahatanak added inline comments.


================
Comment at: include/clang/Basic/DiagnosticSemaKinds.td:8772
+def note_nullability_fix_it : Note<
+  "insert '%select{_Nonnull|_Nullable|_Null_unspecified}0' if the "
+  "%select{pointer|block pointer|member pointer|array parameter}1 "
----------------
jordan_rose wrote:
> ahatanak wrote:
> > Is the third option (_Null_unspecified) going to be used somewhere? I see the first two options are used in emitNullabilityConsistencyWarning, but not the third one.
> I think it's better not to suggest it to people, but it seemed weirder to have a reusable diagnostic that's intended to take a NullabilityKind and then have it blow up if someone ever decided to use it with NullUnspecified. I can take it out if you like.
It seems that the code in lib/Basic/Diagnostic.cpp would assert at runtime if you tried to pass a value that isn't in the expected range (0 or 1 if _Null_unspecified were removed). But I guess you can leave _Null_unspecified there if you think it makes more sense to do so.


Repository:
  rL LLVM

https://reviews.llvm.org/D27837





More information about the cfe-commits mailing list