File tree Expand file tree Collapse file tree 8 files changed +23
-31
lines changed Expand file tree Collapse file tree 8 files changed +23
-31
lines changed Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ struct HeapObject {
65
65
{ }
66
66
67
67
#ifndef NDEBUG
68
- void dump () const LLVM_ATTRIBUTE_USED ;
68
+ void dump () const SWIFT_USED ;
69
69
#endif
70
70
71
71
#endif // __swift__
Original file line number Diff line number Diff line change @@ -182,7 +182,7 @@ namespace swift {
182
182
}
183
183
184
184
// FIXME: HACK: copied from HeapObject.cpp
185
- extern " C" SWIFT_LIBRARY_VISIBILITY SWIFT_NOINLINE LLVM_ATTRIBUTE_USED void
185
+ extern " C" SWIFT_LIBRARY_VISIBILITY SWIFT_NOINLINE SWIFT_USED void
186
186
_swift_release_dealloc (swift::HeapObject *object);
187
187
188
188
namespace swift {
Original file line number Diff line number Diff line change 72
72
#define SWIFT_NOINLINE
73
73
#endif
74
74
75
+ #if __has_attribute(used)
76
+ #define SWIFT_USED __attribute__ ((__used__))
77
+ #else
78
+ #define SWIFT_USED
79
+ #endif
80
+
75
81
#if __has_attribute(unavailable)
76
82
#define SWIFT_ATTRIBUTE_UNAVAILABLE __attribute__ ((__unavailable__))
77
83
#else
Original file line number Diff line number Diff line change @@ -56,9 +56,7 @@ void OpaqueExistentialContainer::deinit() {
56
56
57
57
// *NOTE* This routine performs unused memory reads on purpose to try to catch
58
58
// use-after-frees in conjunction with ASAN or Guard Malloc.
59
- template <>
60
- LLVM_ATTRIBUTE_USED
61
- void OpaqueExistentialContainer::verify () const {
59
+ template <> SWIFT_USED void OpaqueExistentialContainer::verify () const {
62
60
// We do not actually care about value. We just want to see if the
63
61
// memory is valid or not. So convert to a uint8_t and try to
64
62
// memcpy into firstByte. We use volatile to just ensure that this
@@ -70,9 +68,7 @@ void OpaqueExistentialContainer::verify() const {
70
68
}
71
69
72
70
// / Dump information about this specific container and its contents.
73
- template <>
74
- LLVM_ATTRIBUTE_USED
75
- void OpaqueExistentialContainer::dump () const {
71
+ template <> SWIFT_USED void OpaqueExistentialContainer::dump () const {
76
72
// Quickly verify to make sure we are well formed.
77
73
verify ();
78
74
Original file line number Diff line number Diff line change @@ -327,7 +327,7 @@ HeapObject *swift::swift_allocEmptyBox() {
327
327
}
328
328
329
329
// Forward-declare this, but define it after swift_release.
330
- extern " C" SWIFT_LIBRARY_VISIBILITY SWIFT_NOINLINE LLVM_ATTRIBUTE_USED void
330
+ extern " C" SWIFT_LIBRARY_VISIBILITY SWIFT_NOINLINE SWIFT_USED void
331
331
_swift_release_dealloc (HeapObject *object);
332
332
333
333
static HeapObject *_swift_retain_ (HeapObject *object) {
Original file line number Diff line number Diff line change @@ -31,17 +31,17 @@ struct HeapObject;
31
31
}
32
32
33
33
SWIFT_CC (swift)
34
- SWIFT_RUNTIME_EXPORT SWIFT_NOINLINE LLVM_ATTRIBUTE_USED
35
- void _swift_leaks_startTrackingObjects(const char *);
34
+ SWIFT_RUNTIME_EXPORT SWIFT_NOINLINE SWIFT_USED void
35
+ _swift_leaks_startTrackingObjects(const char *);
36
36
37
37
SWIFT_CC (swift)
38
- SWIFT_RUNTIME_EXPORT SWIFT_NOINLINE LLVM_ATTRIBUTE_USED
39
- int _swift_leaks_stopTrackingObjects(const char *);
38
+ SWIFT_RUNTIME_EXPORT SWIFT_NOINLINE SWIFT_USED int
39
+ _swift_leaks_stopTrackingObjects(const char *);
40
40
41
- SWIFT_RUNTIME_EXPORT SWIFT_NOINLINE LLVM_ATTRIBUTE_USED void
41
+ SWIFT_RUNTIME_EXPORT SWIFT_NOINLINE SWIFT_USED void
42
42
_swift_leaks_startTrackingObject (swift::HeapObject *);
43
43
44
- SWIFT_RUNTIME_EXPORT SWIFT_NOINLINE LLVM_ATTRIBUTE_USED void
44
+ SWIFT_RUNTIME_EXPORT SWIFT_NOINLINE SWIFT_USED void
45
45
_swift_leaks_stopTrackingObject (swift::HeapObject *);
46
46
47
47
#define SWIFT_LEAKS_START_TRACKING_OBJECT (obj ) \
Original file line number Diff line number Diff line change @@ -4142,9 +4142,7 @@ StringRef swift::getStringForMetadataKind(MetadataKind kind) {
4142
4142
/* **************************************************************************/
4143
4143
4144
4144
#ifndef NDEBUG
4145
- template <>
4146
- LLVM_ATTRIBUTE_USED
4147
- void Metadata::dump () const {
4145
+ template <> SWIFT_USED void Metadata::dump () const {
4148
4146
printf (" TargetMetadata.\n " );
4149
4147
printf (" Kind: %s.\n " , getStringForMetadataKind (getKind ()).data ());
4150
4148
printf (" Value Witnesses: %p.\n " , getValueWitnesses ());
@@ -4197,9 +4195,7 @@ void Metadata::dump() const {
4197
4195
#endif
4198
4196
}
4199
4197
4200
- template <>
4201
- LLVM_ATTRIBUTE_USED
4202
- void ContextDescriptor::dump () const {
4198
+ template <> SWIFT_USED void ContextDescriptor::dump () const {
4203
4199
printf (" TargetTypeContextDescriptor.\n " );
4204
4200
printf (" Flags: 0x%x.\n " , this ->Flags .getIntValue ());
4205
4201
printf (" Parent: %p.\n " , this ->Parent .get ());
@@ -4211,9 +4207,7 @@ void ContextDescriptor::dump() const {
4211
4207
}
4212
4208
}
4213
4209
4214
- template <>
4215
- LLVM_ATTRIBUTE_USED
4216
- void EnumDescriptor::dump () const {
4210
+ template <> SWIFT_USED void EnumDescriptor::dump () const {
4217
4211
printf (" TargetEnumDescriptor.\n " );
4218
4212
printf (" Flags: 0x%x.\n " , this ->Flags .getIntValue ());
4219
4213
printf (" Parent: %p.\n " , this ->Parent .get ());
Original file line number Diff line number Diff line change 31
31
using namespace swift ;
32
32
33
33
#ifndef NDEBUG
34
- template <>
35
- LLVM_ATTRIBUTE_USED
36
- void ProtocolDescriptor::dump () const {
34
+ template <> SWIFT_USED void ProtocolDescriptor::dump () const {
37
35
printf (" TargetProtocolDescriptor.\n "
38
36
" Name: \" %s\" .\n " ,
39
37
Name.get ());
@@ -95,9 +93,7 @@ template<> void ProtocolConformanceDescriptor::dump() const {
95
93
#endif
96
94
97
95
#ifndef NDEBUG
98
- template <>
99
- LLVM_ATTRIBUTE_USED
100
- void ProtocolConformanceDescriptor::verify () const {
96
+ template <> SWIFT_USED void ProtocolConformanceDescriptor::verify () const {
101
97
auto typeKind = unsigned (getTypeKind ());
102
98
assert (((unsigned (TypeReferenceKind::First_Kind) <= typeKind) &&
103
99
(unsigned (TypeReferenceKind::Last_Kind) >= typeKind)) &&
@@ -302,7 +298,7 @@ struct ConformanceState {
302
298
}
303
299
304
300
#ifndef NDEBUG
305
- void verify () const LLVM_ATTRIBUTE_USED ;
301
+ void verify () const SWIFT_USED ;
306
302
#endif
307
303
};
308
304
You can’t perform that action at this time.
0 commit comments