[clang] b1b86b6 - [Clang][Driver] More explicit message when failing to find sanitizer resource file
via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 1 01:54:41 PDT 2022
Author: serge-sans-paille
Date: 2022-06-01T10:54:20+02:00
New Revision: b1b86b63943305f71e5fb522da168c9dbac1d39d
URL: https://github.com/llvm/llvm-project/commit/b1b86b63943305f71e5fb522da168c9dbac1d39d
DIFF: https://github.com/llvm/llvm-project/commit/b1b86b63943305f71e5fb522da168c9dbac1d39d.diff
LOG: [Clang][Driver] More explicit message when failing to find sanitizer resource file
Compiler-rt doesn't provide support file for cfi on s390x ad ppc64le (at least).
When trying to use the flag, we get a file error.
This is an attempt at making the error more explicit.
Differential Revision: https://reviews.llvm.org/D120484
Added:
Modified:
clang/include/clang/Basic/DiagnosticDriverKinds.td
clang/lib/Driver/SanitizerArgs.cpp
clang/test/Driver/fsanitize-ignorelist.c
Removed:
################################################################################
diff --git a/clang/include/clang/Basic/DiagnosticDriverKinds.td b/clang/include/clang/Basic/DiagnosticDriverKinds.td
index 618e748da444..1012551651c5 100644
--- a/clang/include/clang/Basic/DiagnosticDriverKinds.td
+++ b/clang/include/clang/Basic/DiagnosticDriverKinds.td
@@ -212,6 +212,8 @@ def err_drv_invalid_libcxx_deployment : Error<
"invalid deployment target for -stdlib=libc++ (requires %0 or later)">;
def err_drv_invalid_argument_to_option : Error<
"invalid argument '%0' to -%1">;
+def err_drv_missing_sanitizer_ignorelist : Error<
+ "missing sanitizer ignorelist: '%0'">;
def err_drv_malformed_sanitizer_ignorelist : Error<
"malformed sanitizer ignorelist: '%0'">;
def err_drv_malformed_sanitizer_coverage_allowlist : Error<
diff --git a/clang/lib/Driver/SanitizerArgs.cpp b/clang/lib/Driver/SanitizerArgs.cpp
index b63c6e463706..fbabd1a3e38a 100644
--- a/clang/lib/Driver/SanitizerArgs.cpp
+++ b/clang/lib/Driver/SanitizerArgs.cpp
@@ -168,7 +168,7 @@ static void addDefaultIgnorelists(const Driver &D, SanitizerMask Kinds,
else if (BL.Mask == SanitizerKind::CFI && DiagnoseErrors)
// If cfi_ignorelist.txt cannot be found in the resource dir, driver
// should fail.
- D.Diag(clang::diag::err_drv_no_such_file) << Path;
+ D.Diag(clang::diag::err_drv_missing_sanitizer_ignorelist) << Path;
}
validateSpecialCaseListFormat(
D, IgnorelistFiles, clang::diag::err_drv_malformed_sanitizer_ignorelist,
diff --git a/clang/test/Driver/fsanitize-ignorelist.c b/clang/test/Driver/fsanitize-ignorelist.c
index 17c4f5abcedc..22e8e724be75 100644
--- a/clang/test/Driver/fsanitize-ignorelist.c
+++ b/clang/test/Driver/fsanitize-ignorelist.c
@@ -64,7 +64,7 @@
// If cfi_ignorelist.txt cannot be found in the resource dir, driver should fail.
// RUN: %clang -target x86_64-linux-gnu -fsanitize=cfi -flto -fvisibility=default -resource-dir=/dev/null %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-MISSING-CFI-IGNORELIST
-// CHECK-MISSING-CFI-IGNORELIST: error: no such file or directory: '{{.*}}cfi_ignorelist.txt'
+// CHECK-MISSING-CFI-IGNORELIST: error: missing sanitizer ignorelist: '{{.*}}cfi_ignorelist.txt'
// -fno-sanitize-ignorelist disables checking for cfi_ignorelist.txt in the resource dir.
// RUN: %clang -target x86_64-linux-gnu -fsanitize=cfi -flto -fvisibility=default -fno-sanitize-ignorelist -resource-dir=/dev/null %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-MISSING-CFI-NO-IGNORELIST
More information about the cfe-commits
mailing list