Skip to content

Commit 50d7172

Browse files
committed
Move SWIFT_ASSERT_ONLY to Compiler.h
1 parent e5a4b6b commit 50d7172

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

include/swift/Basic/Compiler.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,4 +103,12 @@
103103
#define SWIFT_CRASH_BUG_REPORT_MESSAGE \
104104
"Please " SWIFT_BUG_REPORT_MESSAGE_BASE " and the crash backtrace."
105105

106+
#ifdef NDEBUG
107+
#define SWIFT_ASSERT_ONLY_DECL(X)
108+
#define SWIFT_ASSERT_ONLY(X) do { } while (false)
109+
#else
110+
#define SWIFT_ASSERT_ONLY_DECL(X) X
111+
#define SWIFT_ASSERT_ONLY(X) do { X; } while (false)
112+
#endif
113+
106114
#endif // SWIFT_BASIC_COMPILER_H

include/swift/SILOptimizer/Utils/PrunedLiveness.h

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,6 @@
9090

9191
#include "swift/SIL/SILBasicBlock.h"
9292

93-
#ifdef NDEBUG
94-
#define SWIFT_ASSERT_ONLY_MEMBER(X)
95-
#define SWIFT_ASSERT_ONLY(X) do { } while (false)
96-
#else
97-
#define SWIFT_ASSERT_ONLY_MEMBER(X) X
98-
#define SWIFT_ASSERT_ONLY(X) do { X; } while (false)
99-
#endif
100-
10193
namespace swift {
10294

10395
/// Discover "pruned" liveness for an arbitrary set of uses. The client builds
@@ -140,7 +132,7 @@ class PrunedLiveBlocks {
140132
llvm::SmallDenseMap<SILBasicBlock *, bool, 4> liveBlocks;
141133

142134
// Once the first use has been seen, no definitions can be added.
143-
SWIFT_ASSERT_ONLY_MEMBER(bool seenUse = false);
135+
SWIFT_ASSERT_ONLY_DECL(bool seenUse = false);
144136

145137
public:
146138
bool empty() const { return liveBlocks.empty(); }

0 commit comments

Comments
 (0)