[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
Mon Jul 16 14:40:13 PDT 2018


jyknight added a comment.

In https://reviews.llvm.org/D47894#1158811, @manojgupta wrote:

> @efriedma @jyknight Does the change match your expectations where warnings are still generated but codeGen does not emit nonnull attribute?


Yes, this seems sensible IMO.



================
Comment at: include/clang/Driver/Options.td:1080
+def fdelete_null_pointer_checks : Flag<["-"],
+  "fdelete-null-pointer-checks">, Group<f_Group>;
+def fno_delete_null_pointer_checks : Flag<["-"],
----------------
Do we need help text for this one too?


================
Comment at: test/CodeGen/nonnull.c:1-2
-// RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm < %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm < %s | FileCheck -check-prefix=PREFIX-NONNULL %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm -fno-delete-null-pointer-checks < %s | FileCheck -check-prefix=PREFIX-NO-NULL %s
 
----------------
These prefixes are very confusingly named. NONNULL and NO-NULL sound like the same thing.
I'd suggest using, across all the files here,
CHECK:
NULL-INVALID:
NULL-VALID:

That'd also avoid the need to rename all the "CHECK" lines to something else, which is most of the diff in these files.


================
Comment at: test/Sema/nonnull.c:2
 // RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -fno-delete-null-pointer-checks -verify %s
 // rdar://9584012
----------------
manojgupta wrote:
> All warnings are still issued if nullptr is passed to function nonnull attribute.
SGTM, but this should be a comment in the file, not the code review.


Repository:
  rC Clang

https://reviews.llvm.org/D47894





More information about the cfe-commits mailing list