Skip to content

Commit 8246b2e

Browse files
author
Mariusz Borsa
committed
[Sanitizers][Darwin] Replace SANITIZER_MAC with SANITIZER_APPLE in source files
This is a follow up to [Sanitizers][Darwin] Rename Apple macro SANITIZER_MAC -> SANITIZER_APPLE (D125816) Performed a global search/replace as in title against LLVM sources Differential Revision: https://reviews.llvm.org/D126263
1 parent c428620 commit 8246b2e

File tree

80 files changed

+264
-264
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+264
-264
lines changed

compiler-rt/lib/asan/asan_flags.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ void InitializeFlags() {
8787
RegisterCommonFlags(&ubsan_parser);
8888
#endif
8989

90-
if (SANITIZER_MAC) {
90+
if (SANITIZER_APPLE) {
9191
// Support macOS MallocScribble and MallocPreScribble:
9292
// <https://developer.apple.com/library/content/documentation/Performance/
9393
// Conceptual/ManagingMemory/Articles/MallocDebug.html>

compiler-rt/lib/asan/asan_flags.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ ASAN_FLAG(bool, poison_array_cookie, true,
122122
// https://github.com/google/sanitizers/issues/309
123123
// TODO(glider,timurrrr): Fix known issues and enable this back.
124124
ASAN_FLAG(bool, alloc_dealloc_mismatch,
125-
!SANITIZER_MAC && !SANITIZER_WINDOWS && !SANITIZER_ANDROID,
125+
!SANITIZER_APPLE && !SANITIZER_WINDOWS && !SANITIZER_ANDROID,
126126
"Report errors on malloc/delete, new/free, new/delete[], etc.")
127127

128128
ASAN_FLAG(bool, new_delete_type_mismatch, true,

compiler-rt/lib/asan/asan_interceptors.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ DECLARE_REAL_AND_INTERCEPTOR(void, free, void *)
103103
do { \
104104
if (asan_init_is_running) \
105105
return REAL(func)(__VA_ARGS__); \
106-
if (SANITIZER_MAC && UNLIKELY(!asan_inited)) \
106+
if (SANITIZER_APPLE && UNLIKELY(!asan_inited)) \
107107
return REAL(func)(__VA_ARGS__); \
108108
ENSURE_ASAN_INITED(); \
109109
} while (false)
@@ -355,7 +355,7 @@ INTERCEPTOR(_Unwind_Reason_Code, _Unwind_SjLj_RaiseException,
355355
INTERCEPTOR(char*, index, const char *string, int c)
356356
ALIAS(WRAPPER_NAME(strchr));
357357
# else
358-
# if SANITIZER_MAC
358+
# if SANITIZER_APPLE
359359
DECLARE_REAL(char*, index, const char *string, int c)
360360
OVERRIDE_FUNCTION(index, strchr);
361361
# else
@@ -409,7 +409,7 @@ INTERCEPTOR(char*, strncat, char *to, const char *from, uptr size) {
409409
INTERCEPTOR(char *, strcpy, char *to, const char *from) {
410410
void *ctx;
411411
ASAN_INTERCEPTOR_ENTER(ctx, strcpy);
412-
#if SANITIZER_MAC
412+
#if SANITIZER_APPLE
413413
if (UNLIKELY(!asan_inited))
414414
return REAL(strcpy)(to, from);
415415
#endif
@@ -489,7 +489,7 @@ INTERCEPTOR(long, strtol, const char *nptr, char **endptr, int base) {
489489
INTERCEPTOR(int, atoi, const char *nptr) {
490490
void *ctx;
491491
ASAN_INTERCEPTOR_ENTER(ctx, atoi);
492-
#if SANITIZER_MAC
492+
#if SANITIZER_APPLE
493493
if (UNLIKELY(!asan_inited)) return REAL(atoi)(nptr);
494494
#endif
495495
ENSURE_ASAN_INITED();
@@ -510,7 +510,7 @@ INTERCEPTOR(int, atoi, const char *nptr) {
510510
INTERCEPTOR(long, atol, const char *nptr) {
511511
void *ctx;
512512
ASAN_INTERCEPTOR_ENTER(ctx, atol);
513-
#if SANITIZER_MAC
513+
#if SANITIZER_APPLE
514514
if (UNLIKELY(!asan_inited)) return REAL(atol)(nptr);
515515
#endif
516516
ENSURE_ASAN_INITED();
@@ -563,7 +563,7 @@ static void AtCxaAtexit(void *unused) {
563563
#if ASAN_INTERCEPT___CXA_ATEXIT
564564
INTERCEPTOR(int, __cxa_atexit, void (*func)(void *), void *arg,
565565
void *dso_handle) {
566-
#if SANITIZER_MAC
566+
#if SANITIZER_APPLE
567567
if (UNLIKELY(!asan_inited)) return REAL(__cxa_atexit)(func, arg, dso_handle);
568568
#endif
569569
ENSURE_ASAN_INITED();

compiler-rt/lib/asan/asan_interceptors.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ DECLARE_REAL(char*, strncpy, char *to, const char *from, uptr size)
133133
DECLARE_REAL(uptr, strnlen, const char *s, uptr maxlen)
134134
DECLARE_REAL(char*, strstr, const char *s1, const char *s2)
135135

136-
# if !SANITIZER_MAC
136+
# if !SANITIZER_APPLE
137137
# define ASAN_INTERCEPT_FUNC(name) \
138138
do { \
139139
if (!INTERCEPT_FUNCTION(name)) \
@@ -156,7 +156,7 @@ DECLARE_REAL(char*, strstr, const char *s1, const char *s2)
156156
# else
157157
// OS X interceptors don't need to be initialized with INTERCEPT_FUNCTION.
158158
# define ASAN_INTERCEPT_FUNC(name)
159-
# endif // SANITIZER_MAC
159+
# endif // SANITIZER_APPLE
160160

161161
#endif // !SANITIZER_FUCHSIA
162162

compiler-rt/lib/asan/asan_mac.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
//===----------------------------------------------------------------------===//
1313

1414
#include "sanitizer_common/sanitizer_platform.h"
15-
#if SANITIZER_MAC
15+
#if SANITIZER_APPLE
1616

1717
#include "asan_interceptors.h"
1818
#include "asan_internal.h"
@@ -296,4 +296,4 @@ INTERCEPTOR(void, dispatch_source_set_event_handler,
296296
}
297297
#endif
298298

299-
#endif // SANITIZER_MAC
299+
#endif // SANITIZER_APPLE

compiler-rt/lib/asan/asan_malloc_mac.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
//===----------------------------------------------------------------------===//
1313

1414
#include "sanitizer_common/sanitizer_platform.h"
15-
#if SANITIZER_MAC
15+
#if SANITIZER_APPLE
1616

1717
#include "asan_interceptors.h"
1818
#include "asan_report.h"

compiler-rt/lib/asan/asan_mapping.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@
174174
#else
175175
# if SANITIZER_IOS
176176
# define ASAN_SHADOW_OFFSET_DYNAMIC
177-
# elif SANITIZER_MAC && defined(__aarch64__)
177+
# elif SANITIZER_APPLE && defined(__aarch64__)
178178
# define ASAN_SHADOW_OFFSET_DYNAMIC
179179
# elif SANITIZER_RISCV64
180180
# define ASAN_SHADOW_OFFSET_CONST 0x0000000d55550000
@@ -188,7 +188,7 @@
188188
# define ASAN_SHADOW_OFFSET_CONST 0x0000400000000000
189189
# elif SANITIZER_NETBSD
190190
# define ASAN_SHADOW_OFFSET_CONST 0x0000400000000000
191-
# elif SANITIZER_MAC
191+
# elif SANITIZER_APPLE
192192
# define ASAN_SHADOW_OFFSET_CONST 0x0000100000000000
193193
# elif defined(__mips64)
194194
# define ASAN_SHADOW_OFFSET_CONST 0x0000002000000000

compiler-rt/lib/asan/asan_new_delete.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ enum class align_val_t: size_t {};
8989
// delete.
9090
// To make sure that C++ allocation/deallocation operators are overridden on
9191
// OS X we need to intercept them using their mangled names.
92-
#if !SANITIZER_MAC
92+
#if !SANITIZER_APPLE
9393
CXX_OPERATOR_ATTRIBUTE
9494
void *operator new(size_t size)
9595
{ OPERATOR_NEW_BODY(FROM_NEW, false /*nothrow*/); }
@@ -115,7 +115,7 @@ CXX_OPERATOR_ATTRIBUTE
115115
void *operator new[](size_t size, std::align_val_t align, std::nothrow_t const&)
116116
{ OPERATOR_NEW_BODY_ALIGN(FROM_NEW_BR, true /*nothrow*/); }
117117

118-
#else // SANITIZER_MAC
118+
#else // SANITIZER_APPLE
119119
INTERCEPTOR(void *, _Znwm, size_t size) {
120120
OPERATOR_NEW_BODY(FROM_NEW, false /*nothrow*/);
121121
}
@@ -128,7 +128,7 @@ INTERCEPTOR(void *, _ZnwmRKSt9nothrow_t, size_t size, std::nothrow_t const&) {
128128
INTERCEPTOR(void *, _ZnamRKSt9nothrow_t, size_t size, std::nothrow_t const&) {
129129
OPERATOR_NEW_BODY(FROM_NEW_BR, true /*nothrow*/);
130130
}
131-
#endif // !SANITIZER_MAC
131+
#endif // !SANITIZER_APPLE
132132

133133
#define OPERATOR_DELETE_BODY(type) \
134134
GET_STACK_TRACE_FREE; \
@@ -146,7 +146,7 @@ INTERCEPTOR(void *, _ZnamRKSt9nothrow_t, size_t size, std::nothrow_t const&) {
146146
GET_STACK_TRACE_FREE; \
147147
asan_delete(ptr, size, static_cast<uptr>(align), &stack, type);
148148

149-
#if !SANITIZER_MAC
149+
#if !SANITIZER_APPLE
150150
CXX_OPERATOR_ATTRIBUTE
151151
void operator delete(void *ptr) NOEXCEPT
152152
{ OPERATOR_DELETE_BODY(FROM_NEW); }
@@ -184,7 +184,7 @@ CXX_OPERATOR_ATTRIBUTE
184184
void operator delete[](void *ptr, size_t size, std::align_val_t align) NOEXCEPT
185185
{ OPERATOR_DELETE_BODY_SIZE_ALIGN(FROM_NEW_BR); }
186186

187-
#else // SANITIZER_MAC
187+
#else // SANITIZER_APPLE
188188
INTERCEPTOR(void, _ZdlPv, void *ptr)
189189
{ OPERATOR_DELETE_BODY(FROM_NEW); }
190190
INTERCEPTOR(void, _ZdaPv, void *ptr)
@@ -193,4 +193,4 @@ INTERCEPTOR(void, _ZdlPvRKSt9nothrow_t, void *ptr, std::nothrow_t const&)
193193
{ OPERATOR_DELETE_BODY(FROM_NEW); }
194194
INTERCEPTOR(void, _ZdaPvRKSt9nothrow_t, void *ptr, std::nothrow_t const&)
195195
{ OPERATOR_DELETE_BODY(FROM_NEW_BR); }
196-
#endif // !SANITIZER_MAC
196+
#endif // !SANITIZER_APPLE

compiler-rt/lib/asan/tests/asan_noinst_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ TEST(AddressSanitizer, LoadStoreCallbacks) {
282282
}
283283

284284
#if defined(__x86_64__) && \
285-
!(defined(SANITIZER_MAC) || defined(SANITIZER_WINDOWS))
285+
!(defined(SANITIZER_APPLE) || defined(SANITIZER_WINDOWS))
286286
// clang-format off
287287

288288
#define CALL_ASAN_MEMORY_ACCESS_CALLBACK_ADD(s, reg, op) \

compiler-rt/lib/asan/tests/asan_test_main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
// Default ASAN_OPTIONS for the unit tests.
1616
extern "C" const char* __asan_default_options() {
17-
#if SANITIZER_MAC
17+
#if SANITIZER_APPLE
1818
// On Darwin, we default to `abort_on_error=1`, which would make tests run
1919
// much slower. Let's override this and run lit tests with 'abort_on_error=0'
2020
// and make sure we do not overwhelm the syslog while testing. Also, let's
@@ -35,7 +35,7 @@ extern "C" const char* __asan_default_options() {
3535

3636
namespace __sanitizer {
3737
bool ReexecDisabled() {
38-
#if __has_feature(address_sanitizer) && SANITIZER_MAC
38+
#if __has_feature(address_sanitizer) && SANITIZER_APPLE
3939
// Allow re-exec in instrumented unit tests on Darwin. Technically, we only
4040
// need this for 10.10 and below, where re-exec is required for the
4141
// interceptors to work, but to avoid duplicating the version detection logic,

compiler-rt/lib/interception/interception.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
#include "sanitizer_common/sanitizer_internal_defs.h"
1818

19-
#if !SANITIZER_LINUX && !SANITIZER_FREEBSD && !SANITIZER_MAC && \
19+
#if !SANITIZER_LINUX && !SANITIZER_FREEBSD && !SANITIZER_APPLE && \
2020
!SANITIZER_NETBSD && !SANITIZER_WINDOWS && !SANITIZER_FUCHSIA && \
2121
!SANITIZER_SOLARIS
2222
# error "Interception doesn't work on this operating system."
@@ -88,7 +88,7 @@ typedef __sanitizer::OFF64_T OFF64_T;
8888
// As it's decided at compile time which functions are to be intercepted on Mac,
8989
// INTERCEPT_FUNCTION() is effectively a no-op on this system.
9090

91-
#if SANITIZER_MAC
91+
#if SANITIZER_APPLE
9292
#include <sys/cdefs.h> // For __DARWIN_ALIAS_C().
9393

9494
// Just a pair of pointers.
@@ -157,7 +157,7 @@ const interpose_substitution substitution_##func_name[] \
157157
# define INTERCEPTOR_ATTRIBUTE __attribute__((visibility("default")))
158158
# define REAL(x) __unsanitized_##x
159159
# define DECLARE_REAL(ret_type, func, ...)
160-
#elif !SANITIZER_MAC
160+
#elif !SANITIZER_APPLE
161161
# define PTR_TO_REAL(x) real_##x
162162
# define REAL(x) __interception::PTR_TO_REAL(x)
163163
# define FUNC_TYPE(x) x##_type
@@ -168,12 +168,12 @@ const interpose_substitution substitution_##func_name[] \
168168
extern FUNC_TYPE(func) PTR_TO_REAL(func); \
169169
}
170170
# define ASSIGN_REAL(dst, src) REAL(dst) = REAL(src)
171-
#else // SANITIZER_MAC
171+
#else // SANITIZER_APPLE
172172
# define REAL(x) x
173173
# define DECLARE_REAL(ret_type, func, ...) \
174174
extern "C" ret_type func(__VA_ARGS__);
175175
# define ASSIGN_REAL(x, y)
176-
#endif // SANITIZER_MAC
176+
#endif // SANITIZER_APPLE
177177

178178
#if !SANITIZER_FUCHSIA
179179
# define DECLARE_REAL_AND_INTERCEPTOR(ret_type, func, ...) \
@@ -193,7 +193,7 @@ const interpose_substitution substitution_##func_name[] \
193193
// macros does its job. In exceptional cases you may need to call REAL(foo)
194194
// without defining INTERCEPTOR(..., foo, ...). For example, if you override
195195
// foo with an interceptor for other function.
196-
#if !SANITIZER_MAC && !SANITIZER_FUCHSIA
196+
#if !SANITIZER_APPLE && !SANITIZER_FUCHSIA
197197
# define DEFINE_REAL(ret_type, func, ...) \
198198
typedef ret_type (*FUNC_TYPE(func))(__VA_ARGS__); \
199199
namespace __interception { \
@@ -213,7 +213,7 @@ const interpose_substitution substitution_##func_name[] \
213213
__interceptor_##func(__VA_ARGS__); \
214214
extern "C" INTERCEPTOR_ATTRIBUTE ret_type func(__VA_ARGS__)
215215

216-
#elif !SANITIZER_MAC
216+
#elif !SANITIZER_APPLE
217217

218218
#define INTERCEPTOR(ret_type, func, ...) \
219219
DEFINE_REAL(ret_type, func, __VA_ARGS__) \
@@ -226,7 +226,7 @@ const interpose_substitution substitution_##func_name[] \
226226
#define INTERCEPTOR_WITH_SUFFIX(ret_type, func, ...) \
227227
INTERCEPTOR(ret_type, func, __VA_ARGS__)
228228

229-
#else // SANITIZER_MAC
229+
#else // SANITIZER_APPLE
230230

231231
#define INTERCEPTOR_ZZZ(suffix, ret_type, func, ...) \
232232
extern "C" ret_type func(__VA_ARGS__) suffix; \
@@ -278,7 +278,7 @@ typedef unsigned long uptr;
278278
# define INTERCEPT_FUNCTION(func) INTERCEPT_FUNCTION_LINUX_OR_FREEBSD(func)
279279
# define INTERCEPT_FUNCTION_VER(func, symver) \
280280
INTERCEPT_FUNCTION_VER_LINUX_OR_FREEBSD(func, symver)
281-
#elif SANITIZER_MAC
281+
#elif SANITIZER_APPLE
282282
# include "interception_mac.h"
283283
# define INTERCEPT_FUNCTION(func) INTERCEPT_FUNCTION_MAC(func)
284284
# define INTERCEPT_FUNCTION_VER(func, symver) \

compiler-rt/lib/interception/interception_mac.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313

1414
#include "interception.h"
1515

16-
#if SANITIZER_MAC
16+
#if SANITIZER_APPLE
1717

18-
#endif // SANITIZER_MAC
18+
#endif // SANITIZER_APPLE

compiler-rt/lib/interception/interception_mac.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// Mac-specific interception methods.
1212
//===----------------------------------------------------------------------===//
1313

14-
#if SANITIZER_MAC
14+
#if SANITIZER_APPLE
1515

1616
#if !defined(INCLUDED_FROM_INTERCEPTION_LIB)
1717
# error "interception_mac.h should be included from interception.h only"
@@ -24,4 +24,4 @@
2424
#define INTERCEPT_FUNCTION_VER_MAC(func, symver)
2525

2626
#endif // INTERCEPTION_MAC_H
27-
#endif // SANITIZER_MAC
27+
#endif // SANITIZER_APPLE

compiler-rt/lib/interception/interception_type_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
#include "interception.h"
1515

16-
#if SANITIZER_LINUX || SANITIZER_MAC
16+
#if SANITIZER_LINUX || SANITIZER_APPLE
1717

1818
#include <sys/types.h>
1919
#include <stddef.h>
@@ -24,7 +24,7 @@ COMPILER_CHECK(sizeof(::SSIZE_T) == sizeof(ssize_t));
2424
COMPILER_CHECK(sizeof(::PTRDIFF_T) == sizeof(ptrdiff_t));
2525
COMPILER_CHECK(sizeof(::INTMAX_T) == sizeof(intmax_t));
2626

27-
#if !SANITIZER_MAC
27+
#if !SANITIZER_APPLE
2828
COMPILER_CHECK(sizeof(::OFF64_T) == sizeof(off64_t));
2929
#endif
3030

compiler-rt/lib/interception/interception_win.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1068,4 +1068,4 @@ bool OverrideImportedFunction(const char *module_to_patch,
10681068

10691069
} // namespace __interception
10701070

1071-
#endif // SANITIZER_MAC
1071+
#endif // SANITIZER_APPLE

compiler-rt/lib/lsan/lsan_common.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ static const char kStdSuppressions[] =
105105
// definition.
106106
"leak:*pthread_exit*\n"
107107
# endif // SANITIZER_SUPPRESS_LEAK_ON_PTHREAD_EXIT
108-
# if SANITIZER_MAC
108+
# if SANITIZER_APPLE
109109
// For Darwin and os_log/os_trace: https://reviews.llvm.org/D35173
110110
"leak:*_os_trace*\n"
111111
# endif

compiler-rt/lib/lsan/lsan_common.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@
3434
// is missing. This caused a link error.
3535
#if SANITIZER_ANDROID && (__ANDROID_API__ < 28 || defined(__arm__))
3636
# define CAN_SANITIZE_LEAKS 0
37-
#elif (SANITIZER_LINUX || SANITIZER_MAC) && (SANITIZER_WORDSIZE == 64) && \
37+
#elif (SANITIZER_LINUX || SANITIZER_APPLE) && (SANITIZER_WORDSIZE == 64) && \
3838
(defined(__x86_64__) || defined(__mips64) || defined(__aarch64__) || \
3939
defined(__powerpc64__) || defined(__s390x__))
4040
# define CAN_SANITIZE_LEAKS 1
41-
#elif defined(__i386__) && (SANITIZER_LINUX || SANITIZER_MAC)
41+
#elif defined(__i386__) && (SANITIZER_LINUX || SANITIZER_APPLE)
4242
# define CAN_SANITIZE_LEAKS 1
4343
#elif defined(__arm__) && SANITIZER_LINUX
4444
# define CAN_SANITIZE_LEAKS 1

compiler-rt/lib/lsan/lsan_common_mac.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#include "sanitizer_common/sanitizer_libc.h"
1616
#include "lsan_common.h"
1717

18-
#if CAN_SANITIZE_LEAKS && SANITIZER_MAC
18+
#if CAN_SANITIZE_LEAKS && SANITIZER_APPLE
1919

2020
#include "sanitizer_common/sanitizer_allocator_internal.h"
2121
#include "lsan_allocator.h"
@@ -201,4 +201,4 @@ void LockStuffAndStopTheWorld(StopTheWorldCallback callback,
201201

202202
} // namespace __lsan
203203

204-
#endif // CAN_SANITIZE_LEAKS && SANITIZER_MAC
204+
#endif // CAN_SANITIZE_LEAKS && SANITIZER_APPLE

0 commit comments

Comments
 (0)