Skip to content

Commit 7912247

Browse files
committed
flip condition order
1 parent 3fa590c commit 7912247

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/Demangling/DemanglerAssert.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,22 @@
2222
#include "swift/Demangling/Demangle.h"
2323
#include "swift/Demangling/NamespaceMacros.h"
2424

25-
#if !defined(NDEBUG) && !SWIFT_RUNTIME
25+
#if SWIFT_RUNTIME || defined(NDEBUG)
2626

27-
// Except in the runtime, DEMANGLER_ASSERT() works like assert()
27+
// In the runtime and non-asserts builds, DEMANGLER_ASSERT() returns an error
2828
#define DEMANGLER_ASSERT(expr, node) \
2929
do { \
3030
if (!(expr)) \
31-
swift::Demangle::failAssert(__FILE__, __LINE__, node, #expr); \
31+
return ManglingError(ManglingError::AssertionFailed, (node), __LINE__); \
3232
} while (0)
3333

3434
#else
3535

36-
// In the runtime and non-asserts builds, DEMANGLER_ASSERT() returns an error
36+
// Except in the runtime, assert builds cause DEMANGLER_ASSERT() to assert()
3737
#define DEMANGLER_ASSERT(expr, node) \
3838
do { \
3939
if (!(expr)) \
40-
return ManglingError(ManglingError::AssertionFailed, (node), __LINE__); \
40+
swift::Demangle::failAssert(__FILE__, __LINE__, node, #expr); \
4141
} while (0)
4242

4343
#endif // !defined(NDEBUG) && !SWIFT_RUNTIME

0 commit comments

Comments
 (0)