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

Manoj Gupta via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 7 11:16:25 PDT 2018


manojgupta created this revision.
manojgupta added reviewers: t.p.northover, efriedma, jyknight, chandlerc, rnk, srhines, void.

Support for this option is needed for building Linux kernel.
This is a very frequently requested feature by kernel developers.

More details : https://lkml.org/lkml/2018/4/4/601

GCC option description for -fdelete-null-pointer-checks:
This Assume that programs cannot safely dereference null pointers,
and that no code or data element resides at address zero.

-fno-delete-null-pointer-checks is the inverse of this implying that
null pointer dereferencing is not undefined.

This feature is implemented in as the function attribute
"null-pointer-is-valid"="true".
This CL only adds the attribute on the function. Another corresponding LLVM
change updates the optimizations to not treat null pointer dereferencing
as undefined if the attribute is present.


Repository:
  rC Clang

https://reviews.llvm.org/D47894

Files:
  include/clang/Driver/Options.td
  include/clang/Frontend/CodeGenOptions.def
  lib/CodeGen/CGCall.cpp
  lib/Driver/ToolChains/Clang.cpp
  lib/Frontend/CompilerInvocation.cpp
  test/CodeGen/delete-null-pointer-checks.c
  test/Driver/clang_f_opts.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47894.150366.patch
Type: text/x-patch
Size: 6857 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180607/227a23d1/attachment-0001.bin>


More information about the cfe-commits mailing list