Index: include/clang/Basic/DiagnosticDriverKinds.td =================================================================== --- include/clang/Basic/DiagnosticDriverKinds.td +++ include/clang/Basic/DiagnosticDriverKinds.td @@ -232,7 +232,7 @@ "implicitly disabling vptr sanitizer because rtti wasn't enabled">, InGroup; def warn_drv_disabling_vptr_no_null_check : Warning< - "implicitly disabling vptr sanitizer because null checking wasn't enabled">, + "implicitly disabling vptr sanitizer because null checking wasn't enabled (try %select{specifying -fsanitize=null or -fsanitize=undefined|removing -fno-sanitize=null}0)">, InGroup; def warn_drv_object_size_disabled_O0 : Warning< "the object size sanitizer has no effect at -O0, but is explicitly enabled: %0">, Index: lib/Driver/SanitizerArgs.cpp =================================================================== --- lib/Driver/SanitizerArgs.cpp +++ lib/Driver/SanitizerArgs.cpp @@ -311,7 +311,7 @@ // instrumentation is broken without run-time null checks). if ((Kinds & Vptr) && !(Kinds & Null)) { Kinds &= ~Vptr; - D.Diag(diag::warn_drv_disabling_vptr_no_null_check); + D.Diag(diag::warn_drv_disabling_vptr_no_null_check) << !!(AllRemove & Null); } // Check that LTO is enabled if we need it. Index: test/Driver/fsanitize.c =================================================================== --- test/Driver/fsanitize.c +++ test/Driver/fsanitize.c @@ -58,9 +58,10 @@ // RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined -fno-rtti %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-NO-RTTI // CHECK-UNDEFINED-NO-RTTI-NOT: vptr -// RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined -fno-sanitize=null %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-VPTR-NO-NULL -// RUN: %clang -target x86_64-linux-gnu -fsanitize=vptr %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-VPTR-NO-NULL -// CHECK-VPTR-NO-NULL: warning: implicitly disabling vptr sanitizer because null checking wasn't enabled +// RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined -fno-sanitize=null %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-VPTR-EXPLICIT-NO-NULL +// CHECK-VPTR-EXPLICIT-NO-NULL: warning: implicitly disabling vptr sanitizer because null checking wasn't enabled (try removing -fno-sanitize=null) +// RUN: %clang -target x86_64-linux-gnu -fsanitize=vptr %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-VPTR-IMPLICIT-NO-NULL +// CHECK-VPTR-IMPLICIT-NO-NULL: warning: implicitly disabling vptr sanitizer because null checking wasn't enabled (try specifying -fsanitize=null or -fsanitize=undefined) // RUN: %clang -target x86_64-linux-gnu -fsanitize=address,thread -fno-rtti %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANA-SANT // CHECK-SANA-SANT: '-fsanitize=address' not allowed with '-fsanitize=thread'