[compiler-rt] 3195610 - [NFC][sanitizer] Reorder functions in cpp file
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 2 14:36:25 PST 2021
Author: Vitaly Buka
Date: 2021-12-02T14:35:59-08:00
New Revision: 3195610b2d8e4c5a039b663abac349ed07c4f5a6
URL: https://github.com/llvm/llvm-project/commit/3195610b2d8e4c5a039b663abac349ed07c4f5a6
DIFF: https://github.com/llvm/llvm-project/commit/3195610b2d8e4c5a039b663abac349ed07c4f5a6.diff
LOG: [NFC][sanitizer] Reorder functions in cpp file
Added:
Modified:
compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cpp
index 0a065fefb8146..2c4687debef4f 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cpp
@@ -86,26 +86,6 @@ void *BackgroundThread(void *arg) {
}
#endif
-void WriteToSyslog(const char *msg) {
- InternalScopedString msg_copy;
- msg_copy.append("%s", msg);
- const char *p = msg_copy.data();
-
- // Print one line at a time.
- // syslog, at least on Android, has an implicit message length limit.
- while (char* q = internal_strchr(p, '\n')) {
- *q = '\0';
- WriteOneLineToSyslog(p);
- p = q + 1;
- }
- // Print remaining characters, if there are any.
- // Note that this will add an extra newline at the end.
- // FIXME: buffer extra output. This would need a thread-local buffer, which
- // on Android requires plugging into the tools (ex. ASan's) Thread class.
- if (*p)
- WriteOneLineToSyslog(p);
-}
-
void MaybeStartBackgroudThread() {
#if (SANITIZER_LINUX || SANITIZER_NETBSD) && \
!SANITIZER_GO // Need to implement/test on other platforms.
@@ -126,6 +106,26 @@ void MaybeStartBackgroudThread() {
#endif
}
+void WriteToSyslog(const char *msg) {
+ InternalScopedString msg_copy;
+ msg_copy.append("%s", msg);
+ const char *p = msg_copy.data();
+
+ // Print one line at a time.
+ // syslog, at least on Android, has an implicit message length limit.
+ while (char* q = internal_strchr(p, '\n')) {
+ *q = '\0';
+ WriteOneLineToSyslog(p);
+ p = q + 1;
+ }
+ // Print remaining characters, if there are any.
+ // Note that this will add an extra newline at the end.
+ // FIXME: buffer extra output. This would need a thread-local buffer, which
+ // on Android requires plugging into the tools (ex. ASan's) Thread class.
+ if (*p)
+ WriteOneLineToSyslog(p);
+}
+
static void (*sandboxing_callback)();
void SetSandboxingCallback(void (*f)()) {
sandboxing_callback = f;
More information about the llvm-commits
mailing list