Skip to content

Commit fdb49de

Browse files
committed
fix: ci
1 parent 49447c0 commit fdb49de

File tree

3 files changed

+24
-5
lines changed

3 files changed

+24
-5
lines changed

clang/test/Driver/fsanitize-ignorelist.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050

5151
// Driver properly reports malformed ignorelist files.
5252
// RUN: not %clang --target=x86_64-linux-gnu -fsanitize=address -fsanitize-ignorelist=%t.second -fsanitize-ignorelist=%t.bad -fsanitize-ignorelist=%t.good %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-BAD-IGNORELIST
53-
// CHECK-BAD-IGNORELIST: error: failed to parse malformed sanitizer ignorelist: '{{.*}}.bad': malformed line 1: 'badline'
53+
// CHECK-BAD-IGNORELIST: error: failed to parse malformed sanitizer ignorelist: ''{{.*}}.bad': malformed line 1: 'badline'
5454

5555
// -fno-sanitize-ignorelist disables all ignorelists specified earlier.
5656
// RUN: %clang --target=x86_64-linux-gnu -fsanitize=address -fsanitize-ignorelist=%t.good -fno-sanitize-ignorelist -fsanitize-ignorelist=%t.second %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ONLY-FIRST-DISABLED --implicit-check-not=-fsanitize-ignorelist=
@@ -74,7 +74,7 @@
7474

7575
// Check that a missing file passed to -fsanitize-system-ignorelist triggers a clean error without crashing.
7676
// RUN: not %clang --target=x86_64-linux-gnu -Xclang -fsanitize-system-ignorelist=%t.nonexistent %s -c -o /dev/null 2>&1 | FileCheck %s --check-prefix=CHECK-SYSTEM-IGNORELIST-NOFILE
77-
// CHECK-SYSTEM-IGNORELIST-NOFILE: error: failed to load sanitizer ignorelist file: '{{.*[\\/]fsanitize-ignorelist\.c\.tmp\.nonexistent}}': {{[Nn]o such file or directory}}
77+
// CHECK-SYSTEM-IGNORELIST-NOFILE: error: failed to load sanitizer ignorelist file: ''{{.*[\\/]fsanitize-ignorelist\.c\.tmp\.nonexistent}}': {{[Nn]o such file or directory}}
7878
// CHECK-SYSTEM-IGNORELIST-NOFILE-NOT: Stack dump:
7979
// CHECK-SYSTEM-IGNORELIST-NOFILE-NOT: PLEASE submit a bug report
8080
// CHECK-SYSTEM-IGNORELIST-NOFILE-NOT: diagnostic msg:

llvm/include/llvm/Support/SpecialCaseList.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,15 @@ class SpecialCaseList {
7272
public:
7373
static constexpr std::pair<unsigned, unsigned> NotFound = {0, 0};
7474
/// Parses the special case list entries from files. On failure, returns
75-
/// 0 and writes an error message to string.
75+
/// std::pair Error, Error.first is error enum, Error.second is error message.
7676
LLVM_ABI static std::unique_ptr<SpecialCaseList>
7777
create(const std::vector<std::string> &Paths, llvm::vfs::FileSystem &FS,
7878
std::pair<unsigned, std::string> &Error);
79+
/// Parses the special case list entries from files. On failure, returns
80+
/// 0 and writes an error message to string.
81+
LLVM_ABI static std::unique_ptr<SpecialCaseList>
82+
create(const std::vector<std::string> &Paths, llvm::vfs::FileSystem &FS,
83+
std::string &Error);
7984
/// Parses the special case list from a memory buffer. On failure, returns
8085
/// 0 and writes an error message to string.
8186
LLVM_ABI static std::unique_ptr<SpecialCaseList>

llvm/lib/Support/SpecialCaseList.cpp

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,20 @@ SpecialCaseList::create(const std::vector<std::string> &Paths,
8787
return nullptr;
8888
}
8989

90+
std::unique_ptr<SpecialCaseList>
91+
SpecialCaseList::create(const std::vector<std::string> &Paths,
92+
llvm::vfs::FileSystem &FS, std::string &Error) {
93+
std::pair<unsigned, std::string> Err;
94+
std::unique_ptr<SpecialCaseList> SCL = create(Paths, FS, Err);
95+
if (!SCL) {
96+
assert(Err.first == 0 || Err.first == 1 && "Unexpected error kind");
97+
const char *Prefix =
98+
Err.first == 0 ? "can't open file " : "error parsing file ";
99+
Error = (Twine(Prefix) + Err.second).str();
100+
}
101+
return SCL;
102+
}
103+
90104
std::unique_ptr<SpecialCaseList> SpecialCaseList::create(const MemoryBuffer *MB,
91105
std::string &Error) {
92106
std::unique_ptr<SpecialCaseList> SCL(new SpecialCaseList());
@@ -113,13 +127,13 @@ bool SpecialCaseList::createInternal(const std::vector<std::string> &Paths,
113127
VFS.getBufferForFile(Path);
114128
if (std::error_code EC = FileOrErr.getError()) {
115129
Error.first = 0 /* open failure */;
116-
Error.second = (Twine(Path) + "': " + EC.message()).str();
130+
Error.second = (Twine("'") + Path + "': " + EC.message()).str();
117131
return false;
118132
}
119133
std::string ParseError;
120134
if (!parse(i, FileOrErr.get().get(), ParseError)) {
121135
Error.first = 1 /* parse failure */;
122-
Error.second = (Twine(Path) + "': " + ParseError).str();
136+
Error.second = (Twine("'") + Path + "': " + ParseError).str();
123137
return false;
124138
}
125139
}

0 commit comments

Comments
 (0)