mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Merge pull request #70274 from adrian-prantl/117824367
Revert "Don't require a strict revision match in LLDB."
This commit is contained in:
@@ -251,8 +251,6 @@ struct SearchPath {
|
||||
/// compiled with -enable-ossa-modules.
|
||||
/// \param requiredSDK If not empty, only accept modules built with
|
||||
/// a compatible SDK. The StringRef represents the canonical SDK name.
|
||||
/// \param requiresRevisionMatch if true, expects the swift tag to match in
|
||||
/// addition to the module format version number.
|
||||
/// \param[out] extendedInfo If present, will be populated with additional
|
||||
/// compilation options serialized into the AST at build time that may be
|
||||
/// necessary to load it properly.
|
||||
@@ -260,7 +258,6 @@ struct SearchPath {
|
||||
/// input files the module depends on, if present in INPUT_BLOCK.
|
||||
ValidationInfo validateSerializedAST(
|
||||
StringRef data, bool requiresOSSAModules, StringRef requiredSDK,
|
||||
bool requiresRevisionMatch = true,
|
||||
ExtendedValidationInfo *extendedInfo = nullptr,
|
||||
SmallVectorImpl<SerializationOptions::FileDependency> *dependencies =
|
||||
nullptr,
|
||||
|
||||
@@ -57,8 +57,7 @@ swift::parseASTSection(MemoryBufferSerializedModuleLoader &Loader,
|
||||
// headers. Iterate over all AST modules.
|
||||
while (!buf.empty()) {
|
||||
auto info = serialization::validateSerializedAST(
|
||||
buf, Loader.isRequiredOSSAModules(), /*requiredSDK*/ StringRef(),
|
||||
/*requiresRevisionMatch*/ false);
|
||||
buf, Loader.isRequiredOSSAModules(), /*requiredSDK*/StringRef());
|
||||
|
||||
assert(info.name.size() < (2 << 10) && "name failed sanity check");
|
||||
|
||||
|
||||
@@ -3234,8 +3234,7 @@ serialization::Status
|
||||
CompilerInvocation::loadFromSerializedAST(StringRef data) {
|
||||
serialization::ExtendedValidationInfo extendedInfo;
|
||||
serialization::ValidationInfo info = serialization::validateSerializedAST(
|
||||
data, getSILOptions().EnableOSSAModules, LangOpts.SDKName,
|
||||
!LangOpts.DebuggerSupport, &extendedInfo);
|
||||
data, getSILOptions().EnableOSSAModules, LangOpts.SDKName, &extendedInfo);
|
||||
|
||||
if (info.status != serialization::Status::Valid)
|
||||
return info.status;
|
||||
@@ -3271,7 +3270,7 @@ CompilerInvocation::setUpInputForSILTool(
|
||||
|
||||
auto result = serialization::validateSerializedAST(
|
||||
fileBufOrErr.get()->getBuffer(), getSILOptions().EnableOSSAModules,
|
||||
LangOpts.SDKName, !LangOpts.DebuggerSupport, &extendedInfo);
|
||||
LangOpts.SDKName, &extendedInfo);
|
||||
bool hasSerializedAST = result.status == serialization::Status::Valid;
|
||||
|
||||
if (hasSerializedAST) {
|
||||
|
||||
@@ -211,10 +211,10 @@ namespace path = llvm::sys::path;
|
||||
|
||||
static bool serializedASTLooksValid(const llvm::MemoryBuffer &buf,
|
||||
bool requiresOSSAModules,
|
||||
StringRef requiredSDK,
|
||||
bool requiresRevisionMatch) {
|
||||
auto VI = serialization::validateSerializedAST(
|
||||
buf.getBuffer(), requiresOSSAModules, requiredSDK, requiresRevisionMatch);
|
||||
StringRef requiredSDK) {
|
||||
auto VI = serialization::validateSerializedAST(buf.getBuffer(),
|
||||
requiresOSSAModules,
|
||||
requiredSDK);
|
||||
return VI.status == serialization::Status::Valid;
|
||||
}
|
||||
|
||||
@@ -462,7 +462,6 @@ public:
|
||||
LLVM_DEBUG(llvm::dbgs() << "Validating deps of " << path << "\n");
|
||||
auto validationInfo = serialization::validateSerializedAST(
|
||||
buf.getBuffer(), requiresOSSAModules, ctx.LangOpts.SDKName,
|
||||
!ctx.LangOpts.DebuggerSupport,
|
||||
/*ExtendedValidationInfo=*/nullptr, &allDeps);
|
||||
|
||||
if (validationInfo.status != serialization::Status::Valid) {
|
||||
@@ -621,8 +620,7 @@ class ModuleInterfaceLoaderImpl {
|
||||
// First, make sure the underlying module path exists and is valid.
|
||||
auto modBuf = fs.getBufferForFile(fwd.underlyingModulePath);
|
||||
if (!modBuf || !serializedASTLooksValid(*modBuf.get(), requiresOSSAModules,
|
||||
ctx.LangOpts.SDKName,
|
||||
!ctx.LangOpts.DebuggerSupport))
|
||||
ctx.LangOpts.SDKName))
|
||||
return false;
|
||||
|
||||
// Next, check the dependencies in the forwarding file.
|
||||
@@ -2233,7 +2231,7 @@ bool ExplicitSwiftModuleLoader::canImportModule(
|
||||
}
|
||||
auto metaData = serialization::validateSerializedAST(
|
||||
(*moduleBuf)->getBuffer(), Ctx.SILOpts.EnableOSSAModules,
|
||||
Ctx.LangOpts.SDKName, !Ctx.LangOpts.DebuggerSupport);
|
||||
Ctx.LangOpts.SDKName);
|
||||
versionInfo->setVersion(metaData.userModuleVersion,
|
||||
ModuleVersionSourceKind::SwiftBinaryModule);
|
||||
return true;
|
||||
@@ -2564,7 +2562,7 @@ bool ExplicitCASModuleLoader::canImportModule(
|
||||
}
|
||||
auto metaData = serialization::validateSerializedAST(
|
||||
(*moduleBuf)->getBuffer(), Ctx.SILOpts.EnableOSSAModules,
|
||||
Ctx.LangOpts.SDKName, !Ctx.LangOpts.DebuggerSupport);
|
||||
Ctx.LangOpts.SDKName);
|
||||
versionInfo->setVersion(metaData.userModuleVersion,
|
||||
ModuleVersionSourceKind::SwiftBinaryModule);
|
||||
return true;
|
||||
|
||||
@@ -547,7 +547,7 @@ bool serialization::isSerializedAST(StringRef data) {
|
||||
|
||||
ValidationInfo serialization::validateSerializedAST(
|
||||
StringRef data, bool requiresOSSAModules, StringRef requiredSDK,
|
||||
bool requiresRevisionMatch, ExtendedValidationInfo *extendedInfo,
|
||||
ExtendedValidationInfo *extendedInfo,
|
||||
SmallVectorImpl<SerializationOptions::FileDependency> *dependencies,
|
||||
SmallVectorImpl<SearchPath> *searchPaths) {
|
||||
ValidationInfo result;
|
||||
@@ -590,7 +590,7 @@ ValidationInfo serialization::validateSerializedAST(
|
||||
result = validateControlBlock(
|
||||
cursor, scratch,
|
||||
{SWIFTMODULE_VERSION_MAJOR, SWIFTMODULE_VERSION_MINOR},
|
||||
requiresOSSAModules, requiresRevisionMatch,
|
||||
requiresOSSAModules, /*requiresRevisionMatch=*/true,
|
||||
requiredSDK,
|
||||
extendedInfo, localObfuscator);
|
||||
if (result.status != Status::Valid)
|
||||
|
||||
@@ -1389,7 +1389,7 @@ bool SerializedModuleLoaderBase::canImportModule(
|
||||
if (swiftInterfaceVersion.empty() && moduleInputBuffer) {
|
||||
auto metaData = serialization::validateSerializedAST(
|
||||
moduleInputBuffer->getBuffer(), Ctx.SILOpts.EnableOSSAModules,
|
||||
Ctx.LangOpts.SDKName, !Ctx.LangOpts.DebuggerSupport);
|
||||
Ctx.LangOpts.SDKName);
|
||||
versionInfo->setVersion(metaData.userModuleVersion,
|
||||
ModuleVersionSourceKind::SwiftBinaryModule);
|
||||
} else {
|
||||
|
||||
@@ -51,8 +51,8 @@ static bool validateModule(
|
||||
llvm::SmallVectorImpl<swift::serialization::SearchPath> &searchPaths) {
|
||||
info = swift::serialization::validateSerializedAST(
|
||||
data, requiresOSSAModules,
|
||||
/*requiredSDK*/ StringRef(), /*requiresRevisionMatch*/ false,
|
||||
&extendedInfo, /* dependencies*/ nullptr, &searchPaths);
|
||||
/*requiredSDK*/ StringRef(), &extendedInfo, /* dependencies*/ nullptr,
|
||||
&searchPaths);
|
||||
if (info.status != swift::serialization::Status::Valid) {
|
||||
llvm::outs() << "error: validateSerializedAST() failed\n";
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user