[Driver] Conform warn_drv_object_size_disabled_O0 to DefaultWarnNoError
authorVedant Kumar <vsk@apple.com>
Thu, 12 Jul 2018 19:53:15 +0000 (19:53 +0000)
committerVedant Kumar <vsk@apple.com>
Thu, 12 Jul 2018 19:53:15 +0000 (19:53 +0000)
This diagnostic triggers when -fsanitize=object-size is explicitly
specified but will be a no-op (i.e, at -O0).

This diagnostic should not fail a -Werror build because it's just an
explanatory note to the user. It's not always actionable.

For example, a user may not be able to simply disable object-size,
because they want it enabled in optimized builds.

rdar://42128447

llvm-svn: 336937

clang/include/clang/Basic/DiagnosticDriverKinds.td
clang/test/Driver/fsanitize-object-size.c

index 5526ad4..a6be059 100644 (file)
@@ -273,7 +273,7 @@ def warn_drv_disabling_vptr_no_rtti_default : Warning<
   InGroup<AutoDisableVptrSanitizer>;
 def warn_drv_object_size_disabled_O0 : Warning<
   "the object size sanitizer has no effect at -O0, but is explicitly enabled: %0">,
-  InGroup<InvalidCommandLineArgument>;
+  InGroup<InvalidCommandLineArgument>, DefaultWarnNoWerror;
 
 def note_drv_command_failed_diag_msg : Note<
   "diagnostic msg: %0">;
index b96221e..50c6783 100644 (file)
@@ -2,8 +2,9 @@
 //
 // RUN: %clang -target x86_64-linux-gnu -fsanitize=object-size %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OSIZE
 // RUN: %clang -target x86_64-linux-gnu -fsanitize=object-size %s -O0 -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OSIZE
-// RUN: %clang -target x86_64-linux-gnu -fsanitize=null,object-size %s -### 2>&1 | FileCheck %s --check-prefixes=CHECK-NO-OSIZE
-// RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined %s -### 2>&1 | FileCheck %s --check-prefixes=CHECK-NO-OSIZE-NO-WARNING
+// RUN: %clang -target x86_64-linux-gnu -fsanitize=null,object-size %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OSIZE
+// RUN: %clang -target x86_64-linux-gnu -Werror -fsanitize=null,object-size %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OSIZE
+// RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OSIZE-NO-WARNING
 
 // Check that the object size check is enabled at other optimization levels.
 //