[PATCH] D47894: [clang]: Add support for "-fno-delete-null-pointer-checks"

James Y Knight via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 17 08:50:27 PDT 2018


jyknight accepted this revision.
jyknight added a comment.
This revision is now accepted and ready to land.

Please refer to the commit for the LLVM half of the change in the commit message for this.

LGTM, other than some minor suggestions for the help texts.



================
Comment at: docs/ClangCommandLineReference.rst:1548
+
+Assume that null pointers cannot be dereferenced safely and any code/data cannot reside at address zero.
+
----------------
Suggested text:
When enabled, treat null pointer dereference, creation of a reference to null, or passing a null pointer to a function parameter annotated with the "nonnull" attribute as undefined behavior.  (And, thus the optimizer may assume that any pointer used in such a way must not have been null and optimize away branches accordingly.) On by default.



================
Comment at: include/clang/Driver/Options.td:1081
+  "fdelete-null-pointer-checks">, Group<f_Group>,
+  HelpText<"Assume that null pointers can not be dereferenced safely, and remove useless null checks">;
+def fno_delete_null_pointer_checks : Flag<["-"],
----------------
Suggested text:
Treat usage of null pointers as undefined behavior.


================
Comment at: include/clang/Driver/Options.td:1084
+  "fno-delete-null-pointer-checks">, Group<f_Group>, Flags<[CC1Option]>,
+  HelpText<"Assume that it may be possible to safely dereference null pointers">;
+
----------------
Suggested text:
Do not treat usage of null pointers as undefined behavior.


Repository:
  rC Clang

https://reviews.llvm.org/D47894





More information about the cfe-commits mailing list