Skip to content

Commit c779d10

Browse files
committed
[Concurrency] adjust how we fail creating an IsIsolatingCurrentContextDecision
1 parent 22b20e7 commit c779d10

File tree

2 files changed

+25
-22
lines changed

2 files changed

+25
-22
lines changed

include/swift/ABI/Executor.h

+3-22
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
#ifndef SWIFT_ABI_EXECUTOR_H
1818
#define SWIFT_ABI_EXECUTOR_H
1919

20-
#include "../../../stdlib/public/Concurrency/Error.h"
21-
2220
#include "swift/ABI/Actor.h"
2321
#include "swift/ABI/HeapObject.h"
2422
#include "swift/Runtime/Casting.h"
@@ -427,27 +425,10 @@ enum class IsIsolatingCurrentContextDecision : int8_t {
427425
Isolated,
428426
};
429427

430-
inline IsIsolatingCurrentContextDecision
431-
getIsIsolatingCurrentContextDecisionFromInt(int8_t value) {
432-
switch (value) {
433-
case -1: return IsIsolatingCurrentContextDecision::Unknown;
434-
case 0: return IsIsolatingCurrentContextDecision::NotIsolated;
435-
case 1: return IsIsolatingCurrentContextDecision::Isolated;
436-
default:
437-
swift_Concurrency_fatalError(0, "Unexpected IsIsolatingCurrentContextDecision value");
438-
return IsIsolatingCurrentContextDecision::Unknown; // silence warning about missing return
439-
}
440-
}
428+
IsIsolatingCurrentContextDecision
429+
getIsIsolatingCurrentContextDecisionFromInt(int8_t value);
441430

442-
inline StringRef getIsIsolatingCurrentContextDecisionNameStr(IsIsolatingCurrentContextDecision decision) {
443-
switch (decision) {
444-
case IsIsolatingCurrentContextDecision::Unknown: return "Unknown";
445-
case IsIsolatingCurrentContextDecision::NotIsolated: return "NotIsolated";
446-
case IsIsolatingCurrentContextDecision::Isolated: return "Isolated";
447-
}
448-
swift_Concurrency_fatalError(0, "Unexpected IsIsolatingCurrentContextDecision value");
449-
return "<Unexpected Value>"; // silence warning about missing return
450-
}
431+
StringRef getIsIsolatingCurrentContextDecisionNameStr(IsIsolatingCurrentContextDecision decision);
451432

452433
}
453434

stdlib/public/Concurrency/GlobalExecutor.cpp

+22
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,28 @@ extern "C" void swift_job_dealloc(SwiftJob *job, void *ptr) {
160160
return _swift_task_dealloc_specific(task, ptr);
161161
}
162162

163+
IsIsolatingCurrentContextDecision
164+
swift::getIsIsolatingCurrentContextDecisionFromInt(int8_t value) {
165+
switch (value) {
166+
case -1: return IsIsolatingCurrentContextDecision::Unknown;
167+
case 0: return IsIsolatingCurrentContextDecision::NotIsolated;
168+
case 1: return IsIsolatingCurrentContextDecision::Isolated;
169+
default:
170+
swift_Concurrency_fatalError(0, "Unexpected IsIsolatingCurrentContextDecision value");
171+
}
172+
}
173+
174+
StringRef
175+
swift::getIsIsolatingCurrentContextDecisionNameStr(IsIsolatingCurrentContextDecision decision) {
176+
switch (decision) {
177+
case IsIsolatingCurrentContextDecision::Unknown: return "Unknown";
178+
case IsIsolatingCurrentContextDecision::NotIsolated: return "NotIsolated";
179+
case IsIsolatingCurrentContextDecision::Isolated: return "Isolated";
180+
}
181+
swift_Concurrency_fatalError(0, "Unexpected IsIsolatingCurrentContextDecision value");
182+
}
183+
184+
163185
/*****************************************************************************/
164186
/****************************** MAIN EXECUTOR *******************************/
165187
/*****************************************************************************/

0 commit comments

Comments
 (0)