diff --git a/compiler-rt/lib/hwasan/hwasan_dynamic_shadow.cpp b/compiler-rt/lib/hwasan/hwasan_dynamic_shadow.cpp --- a/compiler-rt/lib/hwasan/hwasan_dynamic_shadow.cpp +++ b/compiler-rt/lib/hwasan/hwasan_dynamic_shadow.cpp @@ -17,6 +17,7 @@ #include "hwasan_mapping.h" #include "sanitizer_common/sanitizer_common.h" #include "sanitizer_common/sanitizer_posix.h" +#include "sanitizer_common/sanitizer_printf.h" #include #include diff --git a/compiler-rt/lib/msan/msan_linux.cc b/compiler-rt/lib/msan/msan_linux.cc --- a/compiler-rt/lib/msan/msan_linux.cc +++ b/compiler-rt/lib/msan/msan_linux.cc @@ -32,6 +32,7 @@ #include "sanitizer_common/sanitizer_common.h" #include "sanitizer_common/sanitizer_procmaps.h" +#include "sanitizer_common/sanitizer_printf.h" namespace __msan { diff --git a/compiler-rt/lib/sanitizer_common/CMakeLists.txt b/compiler-rt/lib/sanitizer_common/CMakeLists.txt --- a/compiler-rt/lib/sanitizer_common/CMakeLists.txt +++ b/compiler-rt/lib/sanitizer_common/CMakeLists.txt @@ -157,6 +157,7 @@ sanitizer_platform_limits_posix.h sanitizer_platform_limits_solaris.h sanitizer_posix.h + sanitizer_printf.h sanitizer_procmaps.h sanitizer_quarantine.h sanitizer_report_decorator.h @@ -182,6 +183,7 @@ sanitizer_syscalls_netbsd.inc sanitizer_thread_registry.h sanitizer_tls_get_addr.h + sanitizer_variadic_printf.h sanitizer_vector.h sanitizer_win.h sanitizer_win_defs.h diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_allocator.h b/compiler-rt/lib/sanitizer_common/sanitizer_allocator.h --- a/compiler-rt/lib/sanitizer_common/sanitizer_allocator.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_allocator.h @@ -20,6 +20,7 @@ #include "sanitizer_list.h" #include "sanitizer_local_address_space_view.h" #include "sanitizer_mutex.h" +#include "sanitizer_printf.h" #include "sanitizer_procmaps.h" #include "sanitizer_type_traits.h" diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_allocator.cc b/compiler-rt/lib/sanitizer_common/sanitizer_allocator.cc --- a/compiler-rt/lib/sanitizer_common/sanitizer_allocator.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_allocator.cc @@ -17,6 +17,7 @@ #include "sanitizer_allocator_internal.h" #include "sanitizer_atomic.h" #include "sanitizer_common.h" +#include "sanitizer_printf.h" namespace __sanitizer { diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_allocator_report.cc b/compiler-rt/lib/sanitizer_common/sanitizer_allocator_report.cc --- a/compiler-rt/lib/sanitizer_common/sanitizer_allocator_report.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_allocator_report.cc @@ -15,6 +15,7 @@ #include "sanitizer_allocator_report.h" #include "sanitizer_common.h" #include "sanitizer_report_decorator.h" +#include "sanitizer_printf.h" namespace __sanitizer { diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_bitvector.h b/compiler-rt/lib/sanitizer_common/sanitizer_bitvector.h --- a/compiler-rt/lib/sanitizer_common/sanitizer_bitvector.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_bitvector.h @@ -150,8 +150,6 @@ l2_[i0][i1].clear(); } bool res = l2_[i0][i1].setBit(i2); - // Printf("%s: %zd => %zd %zd %zd; %d\n", __func__, - // idx, i0, i1, i2, res); return res; } @@ -174,7 +172,6 @@ uptr i0 = idx0(idx); uptr i1 = idx1(idx); uptr i2 = idx2(idx); - // Printf("%s: %zd => %zd %zd %zd\n", __func__, idx, i0, i1, i2); return l1_[i0].getBit(i1) && l2_[i0][i1].getBit(i2); } @@ -186,7 +183,6 @@ if (!l2_[i0][i1].empty()) l1_[i0].setBit(i1); uptr res = i0 * BV::kSize * BV::kSize + i1 * BV::kSize + i2; - // Printf("getAndClearFirstOne: %zd %zd %zd => %zd\n", i0, i1, i2, res); return res; } CHECK(0); @@ -286,14 +282,10 @@ } uptr next() { - // Printf("++++: %zd %zd; %d %d; size %zd\n", i0_, i1_, it1_.hasNext(), - // it2_.hasNext(), kSize); if (!it1_.hasNext() && !it2_.hasNext()) { for (; i0_ < kLevel1Size; i0_++) { if (bv_.l1_[i0_].empty()) continue; it1_ = typename BV::Iterator(bv_.l1_[i0_]); - // Printf("+i0: %zd %zd; %d %d; size %zd\n", i0_, i1_, it1_.hasNext(), - // it2_.hasNext(), kSize); break; } } @@ -301,14 +293,10 @@ CHECK(it1_.hasNext()); i1_ = it1_.next(); it2_ = typename BV::Iterator(bv_.l2_[i0_][i1_]); - // Printf("++i1: %zd %zd; %d %d; size %zd\n", i0_, i1_, it1_.hasNext(), - // it2_.hasNext(), kSize); } CHECK(it2_.hasNext()); uptr i2 = it2_.next(); uptr res = i0_ * BV::kSize * BV::kSize + i1_ * BV::kSize + i2; - // Printf("+ret: %zd %zd; %d %d; size %zd; res: %zd\n", i0_, i1_, - // it1_.hasNext(), it2_.hasNext(), kSize, res); if (!it1_.hasNext() && !it2_.hasNext()) i0_++; return res; diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common.h b/compiler-rt/lib/sanitizer_common/sanitizer_common.h --- a/compiler-rt/lib/sanitizer_common/sanitizer_common.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_common.h @@ -185,17 +185,6 @@ void RawWrite(const char *buffer); bool ColorizeReports(); void RemoveANSIEscapeSequencesFromString(char *buffer); -void Printf(const char *format, ...); -void Report(const char *format, ...); -void SetPrintfAndReportCallback(void (*callback)(const char *)); -#define VReport(level, ...) \ - do { \ - if ((uptr)Verbosity() >= (level)) Report(__VA_ARGS__); \ - } while (0) -#define VPrintf(level, ...) \ - do { \ - if ((uptr)Verbosity() >= (level)) Printf(__VA_ARGS__); \ - } while (0) // Lock sanitizer error reporting and protects against nested errors. class ScopedErrorReportLock { diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common.cc b/compiler-rt/lib/sanitizer_common/sanitizer_common.cc --- a/compiler-rt/lib/sanitizer_common/sanitizer_common.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_common.cc @@ -17,6 +17,7 @@ #include "sanitizer_flags.h" #include "sanitizer_libc.h" #include "sanitizer_placement_new.h" +#include "sanitizer_printf.h" namespace __sanitizer { diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc --- a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc @@ -43,6 +43,7 @@ #include "sanitizer_errno.h" #include "sanitizer_placement_new.h" #include "sanitizer_platform_interceptors.h" +#include "sanitizer_printf.h" #include "sanitizer_symbolizer.h" #include "sanitizer_tls_get_addr.h" diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cc b/compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cc --- a/compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cc @@ -13,9 +13,9 @@ #include "sanitizer_allocator_interface.h" #include "sanitizer_common.h" #include "sanitizer_flags.h" +#include "sanitizer_printf.h" #include "sanitizer_procmaps.h" - namespace __sanitizer { static void (*SoftRssLimitExceededCallback)(bool exceeded); diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common_nolibc.cc b/compiler-rt/lib/sanitizer_common/sanitizer_common_nolibc.cc --- a/compiler-rt/lib/sanitizer_common/sanitizer_common_nolibc.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_nolibc.cc @@ -13,6 +13,7 @@ #include "sanitizer_platform.h" #include "sanitizer_common.h" #include "sanitizer_libc.h" +#include "sanitizer_printf.h" namespace __sanitizer { diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_coverage_fuchsia.cc b/compiler-rt/lib/sanitizer_common/sanitizer_coverage_fuchsia.cc --- a/compiler-rt/lib/sanitizer_common/sanitizer_coverage_fuchsia.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_coverage_fuchsia.cc @@ -30,6 +30,7 @@ #include "sanitizer_atomic.h" #include "sanitizer_common.h" #include "sanitizer_internal_defs.h" +#include "sanitizer_printf.h" #include "sanitizer_symbolizer_fuchsia.h" #include diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_coverage_libcdep_new.cc b/compiler-rt/lib/sanitizer_common/sanitizer_coverage_libcdep_new.cc --- a/compiler-rt/lib/sanitizer_common/sanitizer_coverage_libcdep_new.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_coverage_libcdep_new.cc @@ -15,6 +15,7 @@ #include "sanitizer_atomic.h" #include "sanitizer_common.h" #include "sanitizer_file.h" +#include "sanitizer_printf.h" using namespace __sanitizer; diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_deadlock_detector.h b/compiler-rt/lib/sanitizer_common/sanitizer_deadlock_detector.h --- a/compiler-rt/lib/sanitizer_common/sanitizer_deadlock_detector.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_deadlock_detector.h @@ -27,6 +27,7 @@ #include "sanitizer_bvgraph.h" #include "sanitizer_common.h" +#include "sanitizer_printf.h" namespace __sanitizer { diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_deadlock_detector1.cc b/compiler-rt/lib/sanitizer_common/sanitizer_deadlock_detector1.cc --- a/compiler-rt/lib/sanitizer_common/sanitizer_deadlock_detector1.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_deadlock_detector1.cc @@ -10,11 +10,12 @@ // //===----------------------------------------------------------------------===// -#include "sanitizer_deadlock_detector_interface.h" -#include "sanitizer_deadlock_detector.h" #include "sanitizer_allocator_internal.h" -#include "sanitizer_placement_new.h" +#include "sanitizer_deadlock_detector.h" +#include "sanitizer_deadlock_detector_interface.h" #include "sanitizer_mutex.h" +#include "sanitizer_placement_new.h" +#include "sanitizer_printf.h" #if SANITIZER_DEADLOCK_DETECTOR_VERSION == 1 diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_deadlock_detector2.cc b/compiler-rt/lib/sanitizer_common/sanitizer_deadlock_detector2.cc --- a/compiler-rt/lib/sanitizer_common/sanitizer_deadlock_detector2.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_deadlock_detector2.cc @@ -10,11 +10,12 @@ // //===----------------------------------------------------------------------===// -#include "sanitizer_deadlock_detector_interface.h" -#include "sanitizer_common.h" #include "sanitizer_allocator_internal.h" -#include "sanitizer_placement_new.h" +#include "sanitizer_common.h" +#include "sanitizer_deadlock_detector_interface.h" #include "sanitizer_mutex.h" +#include "sanitizer_placement_new.h" +#include "sanitizer_printf.h" #if SANITIZER_DEADLOCK_DETECTOR_VERSION == 2 diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_file.cc b/compiler-rt/lib/sanitizer_common/sanitizer_file.cc --- a/compiler-rt/lib/sanitizer_common/sanitizer_file.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_file.cc @@ -19,6 +19,7 @@ #include "sanitizer_common.h" #include "sanitizer_file.h" +#include "sanitizer_printf.h" namespace __sanitizer { diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_flag_parser.h b/compiler-rt/lib/sanitizer_common/sanitizer_flag_parser.h --- a/compiler-rt/lib/sanitizer_common/sanitizer_flag_parser.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_flag_parser.h @@ -13,9 +13,10 @@ #ifndef SANITIZER_FLAG_REGISTRY_H #define SANITIZER_FLAG_REGISTRY_H +#include "sanitizer_common.h" #include "sanitizer_internal_defs.h" #include "sanitizer_libc.h" -#include "sanitizer_common.h" +#include "sanitizer_printf.h" namespace __sanitizer { diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_flag_parser.cc b/compiler-rt/lib/sanitizer_common/sanitizer_flag_parser.cc --- a/compiler-rt/lib/sanitizer_common/sanitizer_flag_parser.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_flag_parser.cc @@ -16,6 +16,7 @@ #include "sanitizer_libc.h" #include "sanitizer_flags.h" #include "sanitizer_flag_parser.h" +#include "sanitizer_printf.h" namespace __sanitizer { diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_fuchsia.cc b/compiler-rt/lib/sanitizer_common/sanitizer_fuchsia.cc --- a/compiler-rt/lib/sanitizer_common/sanitizer_fuchsia.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_fuchsia.cc @@ -17,6 +17,7 @@ #include "sanitizer_common.h" #include "sanitizer_libc.h" #include "sanitizer_mutex.h" +#include "sanitizer_printf.h" #include #include diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_libignore.cc b/compiler-rt/lib/sanitizer_common/sanitizer_libignore.cc --- a/compiler-rt/lib/sanitizer_common/sanitizer_libignore.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_libignore.cc @@ -11,9 +11,10 @@ #if SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_MAC || \ SANITIZER_NETBSD || SANITIZER_OPENBSD -#include "sanitizer_libignore.h" #include "sanitizer_flags.h" +#include "sanitizer_libignore.h" #include "sanitizer_posix.h" +#include "sanitizer_printf.h" #include "sanitizer_procmaps.h" namespace __sanitizer { diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc --- a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc @@ -24,6 +24,7 @@ #include "sanitizer_linux.h" #include "sanitizer_mutex.h" #include "sanitizer_placement_new.h" +#include "sanitizer_printf.h" #include "sanitizer_procmaps.h" #if SANITIZER_LINUX diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cc b/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cc --- a/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cc @@ -25,6 +25,7 @@ #include "sanitizer_getauxval.h" #include "sanitizer_linux.h" #include "sanitizer_placement_new.h" +#include "sanitizer_printf.h" #include "sanitizer_procmaps.h" #include // for dlsym() diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_linux_s390.cc b/compiler-rt/lib/sanitizer_common/sanitizer_linux_s390.cc --- a/compiler-rt/lib/sanitizer_common/sanitizer_linux_s390.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux_s390.cc @@ -17,6 +17,7 @@ #include "sanitizer_libc.h" #include "sanitizer_linux.h" +#include "sanitizer_printf.h" #include #include diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_mac.cc b/compiler-rt/lib/sanitizer_common/sanitizer_mac.cc --- a/compiler-rt/lib/sanitizer_common/sanitizer_mac.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_mac.cc @@ -28,6 +28,7 @@ #include "sanitizer_libc.h" #include "sanitizer_placement_new.h" #include "sanitizer_platform_limits_posix.h" +#include "sanitizer_printf.h" #include "sanitizer_procmaps.h" #if !SANITIZER_IOS diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_netbsd.cc b/compiler-rt/lib/sanitizer_common/sanitizer_netbsd.cc --- a/compiler-rt/lib/sanitizer_common/sanitizer_netbsd.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_netbsd.cc @@ -22,6 +22,7 @@ #include "sanitizer_linux.h" #include "sanitizer_mutex.h" #include "sanitizer_placement_new.h" +#include "sanitizer_printf.h" #include "sanitizer_procmaps.h" #include diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_openbsd.cc b/compiler-rt/lib/sanitizer_common/sanitizer_openbsd.cc --- a/compiler-rt/lib/sanitizer_common/sanitizer_openbsd.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_openbsd.cc @@ -21,6 +21,7 @@ #include "sanitizer_libc.h" #include "sanitizer_placement_new.h" #include "sanitizer_platform_limits_posix.h" +#include "sanitizer_printf.h" #include "sanitizer_procmaps.h" #include diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_posix.cc b/compiler-rt/lib/sanitizer_common/sanitizer_posix.cc --- a/compiler-rt/lib/sanitizer_common/sanitizer_posix.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_posix.cc @@ -20,6 +20,7 @@ #include "sanitizer_flags.h" #include "sanitizer_libc.h" #include "sanitizer_posix.h" +#include "sanitizer_printf.h" #include "sanitizer_procmaps.h" #include diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cc b/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cc --- a/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cc @@ -22,6 +22,7 @@ #include "sanitizer_platform_limits_posix.h" #include "sanitizer_platform_limits_solaris.h" #include "sanitizer_posix.h" +#include "sanitizer_printf.h" #include "sanitizer_procmaps.h" #include diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_printf.h b/compiler-rt/lib/sanitizer_common/sanitizer_printf.h new file mode 100644 --- /dev/null +++ b/compiler-rt/lib/sanitizer_common/sanitizer_printf.h @@ -0,0 +1,28 @@ +//===-- sanitizer_printf.h --------------------------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef SANITIZER_PRINTF_H +#define SANITIZER_PRINTF_H + +namespace __sanitizer { + +void Printf(const char *format, ...); +void Report(const char *format, ...); +void SetPrintfAndReportCallback(void (*callback)(const char *)); +#define VReport(level, ...) \ + do { \ + if ((uptr)Verbosity() >= (level)) Report(__VA_ARGS__); \ + } while (0) +#define VPrintf(level, ...) \ + do { \ + if ((uptr)Verbosity() >= (level)) Printf(__VA_ARGS__); \ + } while (0) + +} // namespace __sanitizer + +#endif // SANITIZER_PRINTF_H diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_printf.cc b/compiler-rt/lib/sanitizer_common/sanitizer_printf.cc --- a/compiler-rt/lib/sanitizer_common/sanitizer_printf.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_printf.cc @@ -16,6 +16,7 @@ #include "sanitizer_common.h" #include "sanitizer_flags.h" #include "sanitizer_libc.h" +#include "sanitizer_printf.h" #include #include @@ -322,6 +323,10 @@ va_end(args); } +void VariadicPrintf(const char *format, va_list ap) { + SharedPrintfCode(false, format, ap); +} + // Like Printf, but prints the current PID before the output string. FORMAT(1, 2) void Report(const char *format, ...) { diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_quarantine.h b/compiler-rt/lib/sanitizer_common/sanitizer_quarantine.h --- a/compiler-rt/lib/sanitizer_common/sanitizer_quarantine.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_quarantine.h @@ -17,8 +17,9 @@ #define SANITIZER_QUARANTINE_H #include "sanitizer_internal_defs.h" -#include "sanitizer_mutex.h" #include "sanitizer_list.h" +#include "sanitizer_mutex.h" +#include "sanitizer_printf.h" namespace __sanitizer { diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_libcdep.cc b/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_libcdep.cc --- a/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_libcdep.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_libcdep.cc @@ -12,6 +12,7 @@ #include "sanitizer_common.h" #include "sanitizer_placement_new.h" +#include "sanitizer_printf.h" #include "sanitizer_stacktrace.h" #include "sanitizer_stacktrace_printer.h" #include "sanitizer_symbolizer.h" diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_printer.cc b/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_printer.cc --- a/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_printer.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_printer.cc @@ -13,6 +13,7 @@ #include "sanitizer_stacktrace_printer.h" #include "sanitizer_file.h" #include "sanitizer_fuchsia.h" +#include "sanitizer_printf.h" namespace __sanitizer { diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc b/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc --- a/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc @@ -55,6 +55,7 @@ #include "sanitizer_linux.h" #include "sanitizer_mutex.h" #include "sanitizer_placement_new.h" +#include "sanitizer_printf.h" // Sufficiently old kernel headers don't provide this value, but we can still // call prctl with it. If the runtime kernel is new enough, the prctl call will diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_mac.cc b/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_mac.cc --- a/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_mac.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_mac.cc @@ -19,6 +19,7 @@ #include #include +#include "sanitizer_printf.h" #include "sanitizer_stoptheworld.h" namespace __sanitizer { diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_suppressions.cc b/compiler-rt/lib/sanitizer_common/sanitizer_suppressions.cc --- a/compiler-rt/lib/sanitizer_common/sanitizer_suppressions.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_suppressions.cc @@ -14,10 +14,11 @@ #include "sanitizer_allocator_internal.h" #include "sanitizer_common.h" -#include "sanitizer_flags.h" #include "sanitizer_file.h" +#include "sanitizer_flags.h" #include "sanitizer_libc.h" #include "sanitizer_placement_new.h" +#include "sanitizer_printf.h" namespace __sanitizer { diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_libcdep.cc b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_libcdep.cc --- a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_libcdep.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_libcdep.cc @@ -12,6 +12,7 @@ #include "sanitizer_allocator_internal.h" #include "sanitizer_internal_defs.h" +#include "sanitizer_printf.h" #include "sanitizer_symbolizer_internal.h" namespace __sanitizer { diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc --- a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc @@ -21,6 +21,7 @@ #include "sanitizer_linux.h" #include "sanitizer_placement_new.h" #include "sanitizer_posix.h" +#include "sanitizer_printf.h" #include "sanitizer_procmaps.h" #include "sanitizer_symbolizer_internal.h" #include "sanitizer_symbolizer_libbacktrace.h" diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_report.cc b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_report.cc --- a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_report.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_report.cc @@ -14,6 +14,7 @@ #include "sanitizer_common.h" #include "sanitizer_file.h" #include "sanitizer_flags.h" +#include "sanitizer_printf.h" #include "sanitizer_procmaps.h" #include "sanitizer_report_decorator.h" #include "sanitizer_stacktrace.h" diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_win.cc b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_win.cc --- a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_win.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_win.cc @@ -15,6 +15,7 @@ #if SANITIZER_WINDOWS #include "sanitizer_dbghelp.h" +#include "sanitizer_printf.h" #include "sanitizer_symbolizer_internal.h" namespace __sanitizer { diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_termination.cc b/compiler-rt/lib/sanitizer_common/sanitizer_termination.cc --- a/compiler-rt/lib/sanitizer_common/sanitizer_termination.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_termination.cc @@ -13,6 +13,7 @@ #include "sanitizer_common.h" #include "sanitizer_libc.h" +#include "sanitizer_printf.h" namespace __sanitizer { diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_thread_registry.cc b/compiler-rt/lib/sanitizer_common/sanitizer_thread_registry.cc --- a/compiler-rt/lib/sanitizer_common/sanitizer_thread_registry.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_thread_registry.cc @@ -13,6 +13,8 @@ #include "sanitizer_thread_registry.h" +#include "sanitizer_printf.h" + namespace __sanitizer { ThreadContextBase::ThreadContextBase(u32 tid) diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_tls_get_addr.cc b/compiler-rt/lib/sanitizer_common/sanitizer_tls_get_addr.cc --- a/compiler-rt/lib/sanitizer_common/sanitizer_tls_get_addr.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_tls_get_addr.cc @@ -14,6 +14,7 @@ #include "sanitizer_flags.h" #include "sanitizer_platform_interceptors.h" +#include "sanitizer_printf.h" namespace __sanitizer { #if SANITIZER_INTERCEPT_TLS_GET_ADDR diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cc b/compiler-rt/lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cc --- a/compiler-rt/lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cc @@ -14,6 +14,7 @@ #if SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_NETBSD || \ SANITIZER_SOLARIS #include "sanitizer_common.h" +#include "sanitizer_printf.h" #include "sanitizer_stacktrace.h" #if SANITIZER_ANDROID diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_variadic_printf.h b/compiler-rt/lib/sanitizer_common/sanitizer_variadic_printf.h new file mode 100644 --- /dev/null +++ b/compiler-rt/lib/sanitizer_common/sanitizer_variadic_printf.h @@ -0,0 +1,22 @@ +//===-- sanitizer_variadic_printf.h -----------------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef SANITIZER_VARIADIC_PRINTF_H +#define SANITIZER_VARIADIC_PRINTF_H + +// Note: This file contains the variadic version of printf, so that general +// dependencies on santiier_printf.h do not have to transiently depend on +// . + +#include + +namespace __sanitizer { +void VariadicPrintf(const char *format, va_list ap); +} // namespace __sanitizer + +#endif // SANITIZER_VARIADIC_PRINTF_H diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_win.cc b/compiler-rt/lib/sanitizer_common/sanitizer_win.cc --- a/compiler-rt/lib/sanitizer_common/sanitizer_win.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_win.cc @@ -26,6 +26,7 @@ #include "sanitizer_libc.h" #include "sanitizer_mutex.h" #include "sanitizer_placement_new.h" +#include "sanitizer_printf.h" #include "sanitizer_win_defs.h" #if defined(PSAPI_VERSION) && PSAPI_VERSION == 1 diff --git a/compiler-rt/lib/sanitizer_common/tests/sanitizer_allocator_testlib.cc b/compiler-rt/lib/sanitizer_common/tests/sanitizer_allocator_testlib.cc --- a/compiler-rt/lib/sanitizer_common/tests/sanitizer_allocator_testlib.cc +++ b/compiler-rt/lib/sanitizer_common/tests/sanitizer_allocator_testlib.cc @@ -19,6 +19,7 @@ */ #include "sanitizer_common/sanitizer_allocator.h" #include "sanitizer_common/sanitizer_common.h" +#include "sanitizer_common/sanitizer_printf.h" #include #include #include diff --git a/compiler-rt/lib/sanitizer_common/tests/sanitizer_format_interceptor_test.cc b/compiler-rt/lib/sanitizer_common/tests/sanitizer_format_interceptor_test.cc --- a/compiler-rt/lib/sanitizer_common/tests/sanitizer_format_interceptor_test.cc +++ b/compiler-rt/lib/sanitizer_common/tests/sanitizer_format_interceptor_test.cc @@ -16,6 +16,7 @@ #include "sanitizer_test_utils.h" #include "sanitizer_common/sanitizer_libc.h" #include "sanitizer_common/sanitizer_common.h" +#include "sanitizer_common/sanitizer_printf.h" #include "gtest/gtest.h" using namespace __sanitizer; diff --git a/compiler-rt/lib/sanitizer_common/tests/sanitizer_ioctl_test.cc b/compiler-rt/lib/sanitizer_common/tests/sanitizer_ioctl_test.cc --- a/compiler-rt/lib/sanitizer_common/tests/sanitizer_ioctl_test.cc +++ b/compiler-rt/lib/sanitizer_common/tests/sanitizer_ioctl_test.cc @@ -20,6 +20,7 @@ #include "sanitizer_test_utils.h" #include "sanitizer_common/sanitizer_platform_limits_posix.h" #include "sanitizer_common/sanitizer_common.h" +#include "sanitizer_common/sanitizer_printf.h" #include "gtest/gtest.h" diff --git a/compiler-rt/lib/stats/stats.cc b/compiler-rt/lib/stats/stats.cc --- a/compiler-rt/lib/stats/stats.cc +++ b/compiler-rt/lib/stats/stats.cc @@ -14,6 +14,7 @@ #include "sanitizer_common/sanitizer_common.h" #include "sanitizer_common/sanitizer_file.h" #include "sanitizer_common/sanitizer_internal_defs.h" +#include "sanitizer_common/sanitizer_printf.h" #if SANITIZER_POSIX #include "sanitizer_common/sanitizer_posix.h" #endif diff --git a/compiler-rt/lib/tsan/rtl/tsan_dense_alloc.h b/compiler-rt/lib/tsan/rtl/tsan_dense_alloc.h --- a/compiler-rt/lib/tsan/rtl/tsan_dense_alloc.h +++ b/compiler-rt/lib/tsan/rtl/tsan_dense_alloc.h @@ -19,6 +19,7 @@ #define TSAN_DENSE_ALLOC_H #include "sanitizer_common/sanitizer_common.h" +#include "sanitizer_common/sanitizer_printf.h" #include "tsan_defs.h" #include "tsan_mutex.h" diff --git a/compiler-rt/lib/ubsan/ubsan_diag.cc b/compiler-rt/lib/ubsan/ubsan_diag.cc --- a/compiler-rt/lib/ubsan/ubsan_diag.cc +++ b/compiler-rt/lib/ubsan/ubsan_diag.cc @@ -17,6 +17,7 @@ #include "ubsan_flags.h" #include "ubsan_monitor.h" #include "sanitizer_common/sanitizer_placement_new.h" +#include "sanitizer_common/sanitizer_printf.h" #include "sanitizer_common/sanitizer_report_decorator.h" #include "sanitizer_common/sanitizer_stacktrace.h" #include "sanitizer_common/sanitizer_stacktrace_printer.h" diff --git a/compiler-rt/lib/xray/xray_allocator.h b/compiler-rt/lib/xray/xray_allocator.h --- a/compiler-rt/lib/xray/xray_allocator.h +++ b/compiler-rt/lib/xray/xray_allocator.h @@ -18,6 +18,7 @@ #include "sanitizer_common/sanitizer_common.h" #include "sanitizer_common/sanitizer_internal_defs.h" #include "sanitizer_common/sanitizer_mutex.h" +#include "sanitizer_common/sanitizer_printf.h" #if SANITIZER_FUCHSIA #include #include diff --git a/compiler-rt/lib/xray/xray_x86_64.cc b/compiler-rt/lib/xray/xray_x86_64.cc --- a/compiler-rt/lib/xray/xray_x86_64.cc +++ b/compiler-rt/lib/xray/xray_x86_64.cc @@ -1,5 +1,6 @@ #include "cpuid.h" #include "sanitizer_common/sanitizer_common.h" +#include "sanitizer_common/sanitizer_printf.h" #if !SANITIZER_FUCHSIA #include "sanitizer_common/sanitizer_posix.h" #endif