diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index cb19b80b7e994..ba235afffe20f 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -291,8 +291,6 @@ Modified Compiler Flags - The `-mno-outline` and `-moutline` compiler flags are now allowed on RISC-V and X86, which both support the machine outliner. - The `-mno-outline` flag will now add the `nooutline` IR attribute, so that `-mno-outline` and `-moutline` objects can be mixed correctly during LTO. -- The `-fms-kernel` flag will now implicitly add -fno-delete-null-pointer-checks. - Still -fdelete-null-pointer-checks can be used to override this behavior. Removed Compiler Flags ---------------------- diff --git a/clang/include/clang/Options/Options.td b/clang/include/clang/Options/Options.td index 863e6b3d0871f..e21ea8a6529a1 100644 --- a/clang/include/clang/Options/Options.td +++ b/clang/include/clang/Options/Options.td @@ -3037,10 +3037,10 @@ defm rewrite_includes : BoolFOption<"rewrite-includes", defm directives_only : OptInCC1FFlag<"directives-only", "">; defm delete_null_pointer_checks : BoolFOption<"delete-null-pointer-checks", - CodeGenOpts<"NullPointerIsValid">, Default<"LangOpts->Kernel">, + CodeGenOpts<"NullPointerIsValid">, DefaultFalse, NegFlag, - PosFlag, + PosFlag, BothFlags<[], [ClangOption, CLOption]>>, DocBrief<[{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" diff --git a/clang/test/CodeGen/MSKernel/null-deref.c b/clang/test/CodeGen/MSKernel/null-deref.c deleted file mode 100644 index f23409115f50d..0000000000000 --- a/clang/test/CodeGen/MSKernel/null-deref.c +++ /dev/null @@ -1,16 +0,0 @@ -// Check that null pointer checks are not omited in kernel mode compilations -// RUN: %clang_cc1 -fms-kernel -fms-extensions -triple x86_64-pc-windows-msvc %s -emit-llvm -o - | FileCheck %s -// RUN: %clang_cc1 -fms-kernel -fms-extensions -triple x86_64-pc-windows-msvc -fdelete-null-pointer-checks %s -emit-llvm -o - | FileCheck %s --check-prefix=NOCHECK - -// CHECK: define dso_local i32 @process(ptr noundef %p) #0 -// CHECK: attributes #0 = {{.*}} null_pointer_is_valid -// NOCHECK-NOT: null_pointer_is_valid - -struct Obj { int value; int extra; }; - -int process(struct Obj* p) { - int v = p->value; - if (!p) - return -1; - return v + p->extra; -}