[PATCH] D36029: [sanitizer_common] Disable filesystem-related code for Fuchsia

Vitaly Buka via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 1 14:29:32 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL309749: [sanitizer_common] Disable filesystem-related code for Fuchsia (authored by vitalybuka).

Changed prior to commit:
  https://reviews.llvm.org/D36029?vs=109168&id=109226#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D36029

Files:
  compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_libcdep.cc
  compiler-rt/trunk/lib/sanitizer_common/sanitizer_file.cc
  compiler-rt/trunk/lib/sanitizer_common/sanitizer_suppressions.cc


Index: compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_libcdep.cc
===================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_libcdep.cc
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_libcdep.cc
@@ -26,21 +26,34 @@
 
 namespace __sanitizer {
 
+#if !SANITIZER_FUCHSIA
+
 bool ReportFile::SupportsColors() {
   SpinMutexLock l(mu);
   ReopenIfNecessary();
   return SupportsColoredOutput(fd);
 }
 
+static INLINE bool ReportSupportsColors() {
+  return report_file.SupportsColors();
+}
+
+#else  // SANITIZER_FUCHSIA
+
+// Fuchsia's logs always go through post-processing that handles colorization.
+static INLINE bool ReportSupportsColors() { return true; }
+
+#endif  // !SANITIZER_FUCHSIA
+
 bool ColorizeReports() {
   // FIXME: Add proper Windows support to AnsiColorDecorator and re-enable color
   // printing on Windows.
   if (SANITIZER_WINDOWS)
     return false;
 
   const char *flag = common_flags()->color;
   return internal_strcmp(flag, "always") == 0 ||
-         (internal_strcmp(flag, "auto") == 0 && report_file.SupportsColors());
+         (internal_strcmp(flag, "auto") == 0 && ReportSupportsColors());
 }
 
 static void (*sandboxing_callback)();
Index: compiler-rt/trunk/lib/sanitizer_common/sanitizer_file.cc
===================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_file.cc
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_file.cc
@@ -14,6 +14,10 @@
 //
 //===---------------------------------------------------------------------===//
 
+#include "sanitizer_platform.h"
+
+#if !SANITIZER_FUCHSIA
+
 #include "sanitizer_common.h"
 #include "sanitizer_file.h"
 
@@ -169,3 +173,5 @@
   report_file.fd_pid = internal_getpid();
 }
 } // extern "C"
+
+#endif  // !SANITIZER_FUCHSIA
Index: compiler-rt/trunk/lib/sanitizer_common/sanitizer_suppressions.cc
===================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_suppressions.cc
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_suppressions.cc
@@ -51,14 +51,16 @@
   if (filename[0] == '\0')
     return;
 
+#if !SANITIZER_FUCHSIA
   // If we cannot find the file, check if its location is relative to
   // the location of the executable.
   InternalScopedString new_file_path(kMaxPathLength);
   if (!FileExists(filename) && !IsAbsolutePath(filename) &&
       GetPathAssumingFileIsRelativeToExec(filename, new_file_path.data(),
                                           new_file_path.size())) {
     filename = new_file_path.data();
   }
+#endif  // !SANITIZER_FUCHSIA
 
   // Read the file.
   VPrintf(1, "%s: reading suppressions file at %s\n",


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36029.109226.patch
Type: text/x-patch
Size: 2741 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170801/61b0aebd/attachment.bin>


More information about the llvm-commits mailing list