[compiler-rt] r352921 - [ubsan] Make suppressions.cpp test pass for me on Windows

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 1 13:35:17 PST 2019


Author: rnk
Date: Fri Feb  1 13:35:17 2019
New Revision: 352921

URL: http://llvm.org/viewvc/llvm-project?rev=352921&view=rev
Log:
[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.

Modified:
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_win.cc
    compiler-rt/trunk/test/ubsan/TestCases/Integer/suppressions.cpp

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_win.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_win.cc?rev=352921&r1=352920&r2=352921&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_win.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_win.cc Fri Feb  1 13:35:17 2019
@@ -486,8 +486,14 @@ bool IsPathSeparator(const char c) {
   return c == '\\' || c == '/';
 }
 
+static bool IsAlpha(char c) {
+  c = ToLower(c);
+  return c >= 'a' && c <= 'z';
+}
+
 bool IsAbsolutePath(const char *path) {
-  UNIMPLEMENTED();
+  return path != nullptr && IsAlpha(path[0]) && path[1] == ':' &&
+         IsPathSeparator(path[2]);
 }
 
 void SleepForSeconds(int seconds) {

Modified: compiler-rt/trunk/test/ubsan/TestCases/Integer/suppressions.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/ubsan/TestCases/Integer/suppressions.cpp?rev=352921&r1=352920&r2=352921&view=diff
==============================================================================
--- compiler-rt/trunk/test/ubsan/TestCases/Integer/suppressions.cpp (original)
+++ compiler-rt/trunk/test/ubsan/TestCases/Integer/suppressions.cpp Fri Feb  1 13:35:17 2019
@@ -15,7 +15,10 @@
 
 // RUN: echo "unsigned-integer-overflow:do_overflow" > %t.func-supp
 // RUN: %env_ubsan_opts=halt_on_error=1:suppressions='"%t.func-supp"' %run %t
-// RUN: echo "unsigned-integer-overflow:%t" > %t.module-supp
+// FIXME: The '%t' substitution can't be used for the module name because it
+// contains a colon, so we have to use the basename, which is
+// suppressions.cpp.tmp.
+// RUN: echo "unsigned-integer-overflow:suppressions.cpp.tmp" > %t.module-supp
 // RUN: %env_ubsan_opts=halt_on_error=1:suppressions='"%t.module-supp"' %run %t
 
 // Note: file-level suppressions should work even without debug info.




More information about the llvm-commits mailing list