[PATCH] D17397: Make deprecation message for -fsanitize-coverage= with numeric argument friendlier.
Nico Weber via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 18 10:15:08 PST 2016
thakis created this revision.
thakis added a reviewer: kcc.
thakis added a subscriber: cfe-commits.
http://reviews.llvm.org/D17397
Files:
lib/Driver/SanitizerArgs.cpp
test/Driver/fsanitize-coverage.c
Index: test/Driver/fsanitize-coverage.c
===================================================================
--- test/Driver/fsanitize-coverage.c
+++ test/Driver/fsanitize-coverage.c
@@ -22,7 +22,7 @@
// CHECK-SANITIZE-COVERAGE-FUNC_INDIR: fsanitize-coverage-indirect-calls
// 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=[func,bb,edge]' instead
+// CHECK-SANITIZE-COVERAGE-3: warning: argument '-fsanitize-coverage=3' is deprecated, use '-fsanitize-coverage=edge' instead
//
// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=5 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-5
// CHECK-SANITIZE-COVERAGE-5: error: unsupported argument '5' to option 'fsanitize-coverage='
Index: lib/Driver/SanitizerArgs.cpp
===================================================================
--- lib/Driver/SanitizerArgs.cpp
+++ lib/Driver/SanitizerArgs.cpp
@@ -444,23 +444,31 @@
!StringRef(Arg->getValue(0))
.getAsInteger(0, LegacySanitizeCoverage) &&
LegacySanitizeCoverage >= 0 && LegacySanitizeCoverage <= 4) {
- D.Diag(diag::warn_drv_deprecated_arg)
- << Arg->getAsString(Args) << "-fsanitize-coverage=[func,bb,edge]";
- // TODO: Add deprecation notice for this form.
switch (LegacySanitizeCoverage) {
case 0:
+ D.Diag(diag::warn_drv_deprecated_arg) << Arg->getAsString(Args)
+ << "-fsanitize-coverage=";
CoverageFeatures = 0;
break;
case 1:
+ D.Diag(diag::warn_drv_deprecated_arg) << Arg->getAsString(Args)
+ << "-fsanitize-coverage=func";
CoverageFeatures = CoverageFunc;
break;
case 2:
+ D.Diag(diag::warn_drv_deprecated_arg) << Arg->getAsString(Args)
+ << "-fsanitize-coverage=bb";
CoverageFeatures = CoverageBB;
break;
case 3:
+ D.Diag(diag::warn_drv_deprecated_arg) << Arg->getAsString(Args)
+ << "-fsanitize-coverage=edge";
CoverageFeatures = CoverageEdge;
break;
case 4:
+ D.Diag(diag::warn_drv_deprecated_arg)
+ << Arg->getAsString(Args)
+ << "-fsanitize-coverage=edge,indirect-calls";
CoverageFeatures = CoverageEdge | CoverageIndirCall;
break;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17397.48352.patch
Type: text/x-patch
Size: 2710 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160218/6efa6422/attachment-0001.bin>
More information about the cfe-commits
mailing list