From 578787ad3055d0a874bb76b148a9d5dc7bd18db5 Mon Sep 17 00:00:00 2001 From: Kostya Serebryany Date: Wed, 2 Mar 2016 19:16:54 +0000 Subject: [PATCH] [libFuzzer] allow -fsanitize-coverage=0 (disables all coverage) llvm-svn: 262503 --- clang/lib/Driver/SanitizerArgs.cpp | 3 +-- clang/test/Driver/fsanitize-coverage.c | 5 +++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/clang/lib/Driver/SanitizerArgs.cpp b/clang/lib/Driver/SanitizerArgs.cpp index 9b60407..e4e6c02 100644 --- a/clang/lib/Driver/SanitizerArgs.cpp +++ b/clang/lib/Driver/SanitizerArgs.cpp @@ -446,9 +446,8 @@ SanitizerArgs::SanitizerArgs(const ToolChain &TC, LegacySanitizeCoverage >= 0 && LegacySanitizeCoverage <= 4) { switch (LegacySanitizeCoverage) { case 0: - D.Diag(diag::warn_drv_deprecated_arg) << Arg->getAsString(Args) - << "-fsanitize-coverage="; CoverageFeatures = 0; + Arg->claim(); break; case 1: D.Diag(diag::warn_drv_deprecated_arg) << Arg->getAsString(Args) diff --git a/clang/test/Driver/fsanitize-coverage.c b/clang/test/Driver/fsanitize-coverage.c index 3bb5deb..19b4af4 100644 --- a/clang/test/Driver/fsanitize-coverage.c +++ b/clang/test/Driver/fsanitize-coverage.c @@ -2,6 +2,7 @@ // RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=edge -fsanitize-coverage=0 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-0 // RUN: %clang -target x86_64-linux-gnu -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-0 // CHECK-SANITIZE-COVERAGE-0-NOT: fsanitize-coverage-type +// CHECK-SANITIZE-COVERAGE-0: -fsanitize=address // RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=func %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC // RUN: %clang -target x86_64-linux-gnu -fsanitize=memory -fsanitize-coverage=func %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC @@ -21,6 +22,10 @@ // CHECK-SANITIZE-COVERAGE-FUNC_INDIR: fsanitize-coverage-type=3 // CHECK-SANITIZE-COVERAGE-FUNC_INDIR: fsanitize-coverage-indirect-calls +// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=1 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-1 +// CHECK-SANITIZE-COVERAGE-1: warning: argument '-fsanitize-coverage=1' is deprecated, use '-fsanitize-coverage=func' instead +// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=2 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-2 +// CHECK-SANITIZE-COVERAGE-2: warning: argument '-fsanitize-coverage=2' is deprecated, use '-fsanitize-coverage=bb' instead // RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=3 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-3 // CHECK-SANITIZE-COVERAGE-3: warning: argument '-fsanitize-coverage=3' is deprecated, use '-fsanitize-coverage=edge' instead // -- 2.7.4