Skip to content

Commit d860f56

Browse files
committed
Merge remote-tracking branch 'origin/main' into rebranch
2 parents ac9304d + ad7f9a7 commit d860f56

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

lib/Demangling/DemanglerAssert.h

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

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

27-
// In the runtime, DEMANGLER_ASSERT() returns an error
27+
// In the runtime and non-asserts builds, DEMANGLER_ASSERT() returns an error
2828
#define DEMANGLER_ASSERT(expr, node) \
2929
do { \
3030
if (!(expr)) \
3131
return ManglingError(ManglingError::AssertionFailed, (node), __LINE__); \
3232
} while (0)
3333

34-
#elif !defined(NDEBUG)
34+
#else
3535

36-
// If NDEBUG is not defined, DEMANGLER_ASSERT() works like assert()
36+
// Except in the runtime, assert builds cause DEMANGLER_ASSERT() to assert()
3737
#define DEMANGLER_ASSERT(expr, node) \
3838
do { \
3939
if (!(expr)) \
4040
swift::Demangle::failAssert(__FILE__, __LINE__, node, #expr); \
4141
} while (0)
4242

43-
#else
44-
45-
// Otherwise, DEMANGLER_ASSERT() does nothing
46-
#define DEMANGLER_ASSERT(expr, node)
47-
48-
#endif // SWIFT_RUNTIME
43+
#endif // SWIFT_RUNTIME || defined(NDEBUG)
4944

5045
namespace swift {
5146
namespace Demangle {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// RUN: %target-typecheck-verify-swift -solver-expression-time-threshold=1
2+
// REQUIRES: tools-release,no_asan
3+
4+
// TODO(performance): This should be converted in a scale test once performance issue is fixed
5+
func test(bytes: Int, length: UInt32) {
6+
// left-hand side of `>=` is `Int` and right-hand side is a chain of `UInt32` inferred from `length`
7+
_ = bytes >= 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + length
8+
// expected-error@-1 {{reasonable time}}
9+
}

0 commit comments

Comments
 (0)