Make deprecation message for -fsanitize-coverage= with numeric argument friendlier.

http://reviews.llvm.org/D17397


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@261247 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Nico Weber 2016-02-18 19:32:54 +00:00
Родитель 29e6c0aba5
Коммит 9bf05a90cd
2 изменённых файлов: 12 добавлений и 4 удалений

Просмотреть файл

@ -444,23 +444,31 @@ SanitizerArgs::SanitizerArgs(const ToolChain &TC,
!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;
}

Просмотреть файл

@ -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='