[clang] 3109ce5 - clang-cl: Expose -f[no-]delete-null-pointer-checks as clang-cl flag

Nico Weber via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 11 06:19:12 PST 2020


Author: Nico Weber
Date: 2020-11-11T09:19:02-05:00
New Revision: 3109ce51d465b7c6e40f855bd88776654eaf08cc

URL: https://github.com/llvm/llvm-project/commit/3109ce51d465b7c6e40f855bd88776654eaf08cc
DIFF: https://github.com/llvm/llvm-project/commit/3109ce51d465b7c6e40f855bd88776654eaf08cc.diff

LOG: clang-cl: Expose -f[no-]delete-null-pointer-checks as clang-cl flag

Added: 
    

Modified: 
    clang/include/clang/Driver/Options.td
    clang/test/Driver/cl-options.c

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index 2e6efef04dbb..05a218ca09f0 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -1285,7 +1285,8 @@ defm rewrite_includes : OptInFFlag<"rewrite-includes", "">;
 
 defm delete_null_pointer_checks : OptOutFFlag<"delete-null-pointer-checks",
   "Treat usage of null pointers as undefined behavior (default)",
-  "Do not treat usage of null pointers as undefined behavior">;
+  "Do not treat usage of null pointers as undefined behavior",
+  "", [CoreOption]>;
 
 def frewrite_map_file : Separate<["-"], "frewrite-map-file">,
                         Group<f_Group>,

diff  --git a/clang/test/Driver/cl-options.c b/clang/test/Driver/cl-options.c
index 89dbdebbaf69..43713d955b9b 100644
--- a/clang/test/Driver/cl-options.c
+++ b/clang/test/Driver/cl-options.c
@@ -311,6 +311,14 @@
 // RUN: %clang_cl -c -fno-strict-aliasing -### -- %s 2>&1 | FileCheck -check-prefix=NOSTRICT %s
 // NOSTRICT: "-relaxed-aliasing"
 
+// We recognize -f[no-]delete-null-pointer-checks.
+// RUN: %clang_cl -c -### -- %s 2>&1 | FileCheck -check-prefix=DEFAULTNULL %s
+// DEFAULTNULL-NOT: "-fno-delete-null-pointer-checks"
+// RUN: %clang_cl -c -fdelete-null-pointer-checks -### -- %s 2>&1 | FileCheck -check-prefix=NULL %s
+// NULL-NOT: "-fno-delete-null-pointer-checks"
+// RUN: %clang_cl -c -fno-delete-null-pointer-checks -### -- %s 2>&1 | FileCheck -check-prefix=NONULL %s
+// NONULL: "-fno-delete-null-pointer-checks"
+
 // We recognize -f[no-]delayed-template-parsing.
 // /Zc:twoPhase[-] has the opposite meaning.
 // RUN: %clang_cl -c -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDDEFAULT %s


        


More information about the cfe-commits mailing list