mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Merge remote-tracking branch 'origin/main' into main-to-rebranch
Conflicts: - `lib/Serialization/ModuleFileSharedCore.cpp` new headers on main
This commit is contained in:
@@ -14,7 +14,9 @@
|
||||
#include "BCReadingExtras.h"
|
||||
#include "DeserializationErrors.h"
|
||||
#include "ModuleFileCoreTableInfo.h"
|
||||
#include "ModuleFormat.h"
|
||||
#include "SerializationFormat.h"
|
||||
#include "swift/AST/Module.h"
|
||||
#include "swift/Basic/Assertions.h"
|
||||
#include "swift/Basic/LangOptions.h"
|
||||
#include "swift/Parse/ParseVersion.h"
|
||||
@@ -1131,6 +1133,22 @@ getActualImportControl(unsigned rawValue) {
|
||||
}
|
||||
}
|
||||
|
||||
static std::optional<ExternalMacroPlugin::Access>
|
||||
getActualMacroAccess(unsigned rawValue) {
|
||||
// We switch on the raw value rather than the enum in order to handle future
|
||||
// values.
|
||||
switch (rawValue) {
|
||||
case static_cast<unsigned>(serialization::AccessLevel::Public):
|
||||
return ExternalMacroPlugin::Public;
|
||||
case static_cast<unsigned>(serialization::AccessLevel::Package):
|
||||
return ExternalMacroPlugin::Package;
|
||||
case static_cast<unsigned>(serialization::AccessLevel::Internal):
|
||||
return ExternalMacroPlugin::Internal;
|
||||
default:
|
||||
return std::nullopt;
|
||||
}
|
||||
}
|
||||
|
||||
bool ModuleFileSharedCore::readModuleDocIfPresent(PathObfuscator &pathRecoverer) {
|
||||
if (!this->ModuleDocInputBuffer)
|
||||
return true;
|
||||
@@ -1592,6 +1610,18 @@ ModuleFileSharedCore::ModuleFileSharedCore(
|
||||
ModuleInterfacePath = blobData;
|
||||
break;
|
||||
}
|
||||
case input_block::EXTERNAL_MACRO: {
|
||||
uint8_t rawKind;
|
||||
input_block::ExternalMacroLayout::readRecord(scratch, rawKind);
|
||||
auto accessKind = getActualMacroAccess(rawKind);
|
||||
if (!accessKind) {
|
||||
info.status = error(Status::Malformed);
|
||||
return;
|
||||
}
|
||||
|
||||
MacroModuleNames.push_back({blobData.str(), *accessKind});
|
||||
break;
|
||||
}
|
||||
default:
|
||||
// Unknown input kind, possibly for use by a future version of the
|
||||
// module format.
|
||||
|
||||
Reference in New Issue
Block a user