Skip to content

Commit 5c8f7ec

Browse files
committed
[Serialization] Add support for @execution attribute
1 parent ca96a2b commit 5c8f7ec

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

lib/Serialization/Deserialization.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5734,6 +5734,14 @@ llvm::Error DeclDeserializer::deserializeDeclCommon() {
57345734
DeclAttribute *Attr = nullptr;
57355735
bool skipAttr = false;
57365736
switch (recordID) {
5737+
case decls_block::Execution_DECL_ATTR: {
5738+
unsigned behavior;
5739+
serialization::decls_block::ExecutionDeclAttrLayout::readRecord(
5740+
scratch, behavior);
5741+
Attr = new (ctx) ExecutionAttr(static_cast<ExecutionKind>(behavior),
5742+
/*Implicit=*/false);
5743+
break;
5744+
}
57375745
case decls_block::ABI_DECL_ATTR: {
57385746
bool isImplicit;
57395747
DeclID abiDeclID;

lib/Serialization/ModuleFormat.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ const uint16_t SWIFTMODULE_VERSION_MAJOR = 0;
5858
/// describe what change you made. The content of this comment isn't important;
5959
/// it just ensures a conflict if two people change the module format.
6060
/// Don't worry about adhering to the 80-column limit for this line.
61-
const uint16_t SWIFTMODULE_VERSION_MINOR = 913; // @safe removal
61+
const uint16_t SWIFTMODULE_VERSION_MINOR = 914; // @execution attribute
6262

6363
/// A standard hash seed used for all string hashes in a serialized module.
6464
///
@@ -2355,6 +2355,11 @@ namespace decls_block {
23552355
BCFixed<2> // exclusivity mode
23562356
>;
23572357

2358+
using ExecutionDeclAttrLayout = BCRecordLayout<
2359+
Execution_DECL_ATTR,
2360+
BCFixed<1> // execution behavior kind
2361+
>;
2362+
23582363
using ABIDeclAttrLayout = BCRecordLayout<
23592364
ABI_DECL_ATTR,
23602365
BCFixed<1>, // implicit flag

lib/Serialization/Serialization.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2891,6 +2891,14 @@ class Serializer::DeclSerializer : public DeclVisitor<DeclSerializer> {
28912891
}
28922892
#include "swift/AST/DeclAttr.def"
28932893

2894+
case DeclAttrKind::Execution: {
2895+
auto *theAttr = cast<ExecutionAttr>(DA);
2896+
auto abbrCode = S.DeclTypeAbbrCodes[ExecutionDeclAttrLayout::Code];
2897+
ExecutionDeclAttrLayout::emitRecord(S.Out, S.ScratchRecord, abbrCode,
2898+
(unsigned)theAttr->getKind());
2899+
return;
2900+
}
2901+
28942902
case DeclAttrKind::ABI: {
28952903
auto *theAttr = cast<ABIAttr>(DA);
28962904
auto abbrCode = S.DeclTypeAbbrCodes[ABIDeclAttrLayout::Code];

0 commit comments

Comments
 (0)