Skip to content

Commit 33706e3

Browse files
committed
[ubsan] Make suppressions.cpp test pass for me on Windows
The test seems to be failing because the module suppression file contains a colon. I found that it was sufficient to just use the basename of the suppression file. While I was here, I noticed that we don't implement IsAbsolutePath for Windows, so I added it. llvm-svn: 352921
1 parent afc24ed commit 33706e3

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

compiler-rt/lib/sanitizer_common/sanitizer_win.cc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,8 +486,14 @@ bool IsPathSeparator(const char c) {
486486
return c == '\\' || c == '/';
487487
}
488488

489+
static bool IsAlpha(char c) {
490+
c = ToLower(c);
491+
return c >= 'a' && c <= 'z';
492+
}
493+
489494
bool IsAbsolutePath(const char *path) {
490-
UNIMPLEMENTED();
495+
return path != nullptr && IsAlpha(path[0]) && path[1] == ':' &&
496+
IsPathSeparator(path[2]);
491497
}
492498

493499
void SleepForSeconds(int seconds) {

compiler-rt/test/ubsan/TestCases/Integer/suppressions.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515

1616
// RUN: echo "unsigned-integer-overflow:do_overflow" > %t.func-supp
1717
// RUN: %env_ubsan_opts=halt_on_error=1:suppressions='"%t.func-supp"' %run %t
18-
// RUN: echo "unsigned-integer-overflow:%t" > %t.module-supp
18+
// FIXME: The '%t' substitution can't be used for the module name because it
19+
// contains a colon, so we have to use the basename, which is
20+
// suppressions.cpp.tmp.
21+
// RUN: echo "unsigned-integer-overflow:suppressions.cpp.tmp" > %t.module-supp
1922
// RUN: %env_ubsan_opts=halt_on_error=1:suppressions='"%t.module-supp"' %run %t
2023

2124
// Note: file-level suppressions should work even without debug info.

0 commit comments

Comments
 (0)