From 11d5d6d4caeea75261f3d07d94ddbb9a1c212538 Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Thu, 2 Dec 2021 08:18:23 -0800 Subject: [PATCH] Revert "serialization: obfuscate the serialized search paths" --- include/swift/AST/FileUnit.h | 2 -- include/swift/AST/Module.h | 2 -- include/swift/AST/SearchPathOptions.h | 4 --- include/swift/Basic/PathRemapper.h | 15 --------- include/swift/Frontend/FrontendOptions.h | 5 --- include/swift/Option/FrontendOptions.td | 4 --- .../Serialization/SerializationOptions.h | 4 --- .../Serialization/SerializedModuleLoader.h | 3 -- include/swift/Serialization/Validation.h | 4 +-- lib/AST/Module.cpp | 9 ----- .../ArgsToFrontendOptionsConverter.cpp | 4 --- lib/Frontend/CompilerInvocation.cpp | 5 --- lib/Frontend/Frontend.cpp | 1 - lib/Serialization/ModuleFile.cpp | 8 ----- lib/Serialization/ModuleFile.h | 3 +- lib/Serialization/ModuleFileSharedCore.cpp | 33 ++++++++----------- lib/Serialization/ModuleFileSharedCore.h | 11 +++---- lib/Serialization/Serialization.cpp | 9 ++--- lib/Serialization/SerializedModuleLoader.cpp | 13 ++------ test/Serialization/path_obfuscator.swift | 13 -------- tools/swift-ide-test/swift-ide-test.cpp | 14 -------- 21 files changed, 27 insertions(+), 139 deletions(-) delete mode 100644 test/Serialization/path_obfuscator.swift diff --git a/include/swift/AST/FileUnit.h b/include/swift/AST/FileUnit.h index 0417ea846368c..187ec4619aa71 100644 --- a/include/swift/AST/FileUnit.h +++ b/include/swift/AST/FileUnit.h @@ -405,8 +405,6 @@ class LoadedFile : public FileUnit { virtual void collectBasicSourceFileInfo( llvm::function_ref callback) const {} - virtual void collectSerializedSearchPath( - llvm::function_ref callback) const {} static bool classof(const FileUnit *file) { return file->getKind() == FileUnitKind::SerializedAST || file->getKind() == FileUnitKind::ClangModule || diff --git a/include/swift/AST/Module.h b/include/swift/AST/Module.h index 31bb84ad0480b..30ac36b4be5ee 100644 --- a/include/swift/AST/Module.h +++ b/include/swift/AST/Module.h @@ -833,8 +833,6 @@ class ModuleDecl void collectBasicSourceFileInfo( llvm::function_ref callback) const; - void collectSerializedSearchPath( - llvm::function_ref callback) const; /// Retrieve a fingerprint value that summarizes the contents of this module. /// /// This interface hash a of a module is guaranteed to change if the interface diff --git a/include/swift/AST/SearchPathOptions.h b/include/swift/AST/SearchPathOptions.h index b21e6691b216d..0b20a86a1015d 100644 --- a/include/swift/AST/SearchPathOptions.h +++ b/include/swift/AST/SearchPathOptions.h @@ -103,10 +103,6 @@ class SearchPathOptions { /// specified in LLDB from the target.source-map entries. PathRemapper SearchPathRemapper; - /// Recover the search paths deserialized from .swiftmodule files to their - /// original form. - PathObfuscator DeserializedPathRecoverer; - private: static StringRef pathStringFromFrameworkSearchPath(const FrameworkSearchPath &next) { diff --git a/include/swift/Basic/PathRemapper.h b/include/swift/Basic/PathRemapper.h index b214b47929591..996c889b5f494 100644 --- a/include/swift/Basic/PathRemapper.h +++ b/include/swift/Basic/PathRemapper.h @@ -58,21 +58,6 @@ class PathRemapper { } }; -class PathObfuscator { - PathRemapper obfuscator, recoverer; -public: - void addMapping(StringRef FromPrefix, StringRef ToPrefix) { - obfuscator.addMapping(FromPrefix, ToPrefix); - recoverer.addMapping(ToPrefix, FromPrefix); - } - std::string obfuscate(StringRef Path) const { - return obfuscator.remapPath(Path); - } - std::string recover(StringRef Path) const { - return recoverer.remapPath(Path); - } -}; - } // end namespace swift #endif // SWIFT_BASIC_PATHREMAPPER_H diff --git a/include/swift/Frontend/FrontendOptions.h b/include/swift/Frontend/FrontendOptions.h index fc1a33247a43f..11b774a78d88b 100644 --- a/include/swift/Frontend/FrontendOptions.h +++ b/include/swift/Frontend/FrontendOptions.h @@ -15,7 +15,6 @@ #include "swift/Basic/FileTypes.h" #include "swift/Basic/Version.h" -#include "swift/Basic/PathRemapper.h" #include "swift/Frontend/FrontendInputsAndOutputs.h" #include "swift/Frontend/InputFile.h" #include "llvm/ADT/Hashing.h" @@ -438,10 +437,6 @@ class FrontendOptions { /// Whether to include symbols with SPI information in the symbol graph. bool IncludeSPISymbolsInSymbolGraph = false; - /// This is used to obfuscate the serialized search paths so we don't have - /// to encode the actual paths into the .swiftmodule file. - PathObfuscator serializedPathObfuscator; - private: static bool canActionEmitDependencies(ActionType); static bool canActionEmitReferenceDependencies(ActionType); diff --git a/include/swift/Option/FrontendOptions.td b/include/swift/Option/FrontendOptions.td index ac1a582948688..7517fdfdb2221 100644 --- a/include/swift/Option/FrontendOptions.td +++ b/include/swift/Option/FrontendOptions.td @@ -165,10 +165,6 @@ def print_clang_stats : Flag<["-"], "print-clang-stats">, def serialize_debugging_options : Flag<["-"], "serialize-debugging-options">, HelpText<"Always serialize options for debugging (default: only for apps)">; - -def serialized_path_obfuscate : Separate<["-"], "serialized-path-obfuscate">, - HelpText<"Remap source paths in debug info">, MetaVarName<"">; - def no_serialize_debugging_options : Flag<["-"], "no-serialize-debugging-options">, HelpText<"Never serialize options for debugging (default: only for apps)">; diff --git a/include/swift/Serialization/SerializationOptions.h b/include/swift/Serialization/SerializationOptions.h index bd53a15ebbbb8..76235ec6ae5f1 100644 --- a/include/swift/Serialization/SerializationOptions.h +++ b/include/swift/Serialization/SerializationOptions.h @@ -45,10 +45,6 @@ namespace swift { /// Path prefixes that should be rewritten in debug info. PathRemapper DebuggingOptionsPrefixMap; - /// Obfuscate the serialized paths so we don't have the actual paths encoded - /// in the .swiftmodule file. - PathObfuscator PathObfuscator; - /// Describes a single-file dependency for this module, along with the /// appropriate strategy for how to verify if it's up-to-date. class FileDependency { diff --git a/include/swift/Serialization/SerializedModuleLoader.h b/include/swift/Serialization/SerializedModuleLoader.h index 1ed970827c092..4248d050b2479 100644 --- a/include/swift/Serialization/SerializedModuleLoader.h +++ b/include/swift/Serialization/SerializedModuleLoader.h @@ -465,9 +465,6 @@ class SerializedASTFile final : public LoadedFile { virtual void collectBasicSourceFileInfo( llvm::function_ref) const override; - virtual void collectSerializedSearchPath( - llvm::function_ref callback) const override; - static bool classof(const FileUnit *file) { return file->getKind() == FileUnitKind::SerializedAST; } diff --git a/include/swift/Serialization/Validation.h b/include/swift/Serialization/Validation.h index 24838e6663ef7..2b1c2d0e1421e 100644 --- a/include/swift/Serialization/Validation.h +++ b/include/swift/Serialization/Validation.h @@ -104,7 +104,7 @@ struct ValidationInfo { /// \sa validateSerializedAST() class ExtendedValidationInfo { SmallVector ExtraClangImporterOpts; - std::string SDKPath; + StringRef SDKPath; StringRef ModuleABIName; struct { unsigned ArePrivateImportsEnabled : 1; @@ -121,7 +121,7 @@ class ExtendedValidationInfo { ExtendedValidationInfo() : Bits() {} StringRef getSDKPath() const { return SDKPath; } - void setSDKPath(std::string path) { + void setSDKPath(StringRef path) { assert(SDKPath.empty()); SDKPath = path; } diff --git a/lib/AST/Module.cpp b/lib/AST/Module.cpp index 1142acba8e1ea..3490354353d5e 100644 --- a/lib/AST/Module.cpp +++ b/lib/AST/Module.cpp @@ -1808,15 +1808,6 @@ void ModuleDecl::collectBasicSourceFileInfo( } } -void ModuleDecl::collectSerializedSearchPath( - llvm::function_ref callback) const { - for (const FileUnit *fileUnit : getFiles()) { - if (auto *serialized = dyn_cast(fileUnit)) { - serialized->collectSerializedSearchPath(callback); - } - } -} - Fingerprint ModuleDecl::getFingerprint() const { StableHasher hasher = StableHasher::defaultHasher(); SmallVector FPs; diff --git a/lib/Frontend/ArgsToFrontendOptionsConverter.cpp b/lib/Frontend/ArgsToFrontendOptionsConverter.cpp index d037d7f0b196e..7ff4627f6a060 100644 --- a/lib/Frontend/ArgsToFrontendOptionsConverter.cpp +++ b/lib/Frontend/ArgsToFrontendOptionsConverter.cpp @@ -292,10 +292,6 @@ bool ArgsToFrontendOptionsConverter::convert( Opts.HermeticSealAtLink = Args.hasArg(OPT_experimental_hermetic_seal_at_link); - for (auto A : Args.getAllArgValues(options::OPT_serialized_path_obfuscate)) { - auto SplitMap = StringRef(A).split('='); - Opts.serializedPathObfuscator.addMapping(SplitMap.first, SplitMap.second); - } return false; } diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index 02d4a95c7a6b7..535c031bbbe72 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -1214,11 +1214,6 @@ static bool ParseSearchPathArgs(SearchPathOptions &Opts, Opts.PlaceholderDependencyModuleMap = A->getValue(); if (const Arg *A = Args.getLastArg(OPT_batch_scan_input_file)) Opts.BatchScanInputFilePath = A->getValue(); - - for (auto A : Args.getAllArgValues(options::OPT_serialized_path_obfuscate)) { - auto SplitMap = StringRef(A).split('='); - Opts.DeserializedPathRecoverer.addMapping(SplitMap.first, SplitMap.second); - } // Opts.RuntimeIncludePath is set by calls to // setRuntimeIncludePath() or setMainExecutablePath(). // Opts.RuntimeImportPath is set by calls to diff --git a/lib/Frontend/Frontend.cpp b/lib/Frontend/Frontend.cpp index 0616f08e3d775..a469e7b6ddf9f 100644 --- a/lib/Frontend/Frontend.cpp +++ b/lib/Frontend/Frontend.cpp @@ -164,7 +164,6 @@ SerializationOptions CompilerInvocation::computeSerializationOptions( opts.SerializeOptionsForDebugging.getValueOr( !module->isExternallyConsumed()); - serializationOpts.PathObfuscator = opts.serializedPathObfuscator; if (serializationOpts.SerializeOptionsForDebugging && opts.DebugPrefixSerializedDebuggingOptions) { serializationOpts.DebuggingOptionsPrefixMap = diff --git a/lib/Serialization/ModuleFile.cpp b/lib/Serialization/ModuleFile.cpp index ae894ba6c3992..6fe480532f4f8 100644 --- a/lib/Serialization/ModuleFile.cpp +++ b/lib/Serialization/ModuleFile.cpp @@ -361,7 +361,6 @@ ModuleFile::getModuleName(ASTContext &Ctx, StringRef modulePath, serialization::ValidationInfo loadInfo = ModuleFileSharedCore::load( modulePath.str(), std::move(newBuf), nullptr, nullptr, /*isFramework*/ isFramework, Ctx.SILOpts.EnableOSSAModules, - Ctx.SearchPathOpts.DeserializedPathRecoverer, loadedModuleFile); Name = loadedModuleFile->Name.str(); return std::move(moduleBuf.get()); @@ -1000,13 +999,6 @@ Optional ModuleFile::getCommentForDecl(const Decl *D) const { return getCommentForDeclByUSR(USRBuffer.str()); } -void ModuleFile::collectSerializedSearchPath( - llvm::function_ref callback) const { - for (auto path: Core->SearchPaths) { - callback(path.Path); - } -} - void ModuleFile::collectBasicSourceFileInfo( llvm::function_ref callback) const { if (Core->SourceFileListData.empty()) diff --git a/lib/Serialization/ModuleFile.h b/lib/Serialization/ModuleFile.h index cdc202e89efca..4641a76f0b199 100644 --- a/lib/Serialization/ModuleFile.h +++ b/lib/Serialization/ModuleFile.h @@ -743,8 +743,7 @@ class ModuleFile Optional loadFingerprint(const IterableDeclContext *IDC) const; void collectBasicSourceFileInfo( llvm::function_ref callback) const; - void collectSerializedSearchPath( - llvm::function_ref callback) const; + // MARK: Deserialization interface diff --git a/lib/Serialization/ModuleFileSharedCore.cpp b/lib/Serialization/ModuleFileSharedCore.cpp index b394d95902499..c93cc0ec0a797 100644 --- a/lib/Serialization/ModuleFileSharedCore.cpp +++ b/lib/Serialization/ModuleFileSharedCore.cpp @@ -84,8 +84,7 @@ static bool enterTopLevelModuleBlock(llvm::BitstreamCursor &cursor, /// Returns true on success. static bool readOptionsBlock(llvm::BitstreamCursor &cursor, SmallVectorImpl &scratch, - ExtendedValidationInfo &extendedInfo, - PathObfuscator &pathRecoverer) { + ExtendedValidationInfo &extendedInfo) { while (!cursor.AtEndOfStream()) { Expected maybeEntry = cursor.advance(); if (!maybeEntry) { @@ -120,7 +119,7 @@ static bool readOptionsBlock(llvm::BitstreamCursor &cursor, unsigned kind = maybeKind.get(); switch (kind) { case options_block::SDK_PATH: - extendedInfo.setSDKPath(pathRecoverer.recover(blobData)); + extendedInfo.setSDKPath(blobData); break; case options_block::XCC: extendedInfo.addExtraClangImporterOption(blobData); @@ -172,8 +171,7 @@ static bool readOptionsBlock(llvm::BitstreamCursor &cursor, static ValidationInfo validateControlBlock( llvm::BitstreamCursor &cursor, SmallVectorImpl &scratch, std::pair expectedVersion, bool requiresOSSAModules, - ExtendedValidationInfo *extendedInfo, - PathObfuscator &pathRecoverer) { + ExtendedValidationInfo *extendedInfo) { // The control block is malformed until we've at least read a major version // number. ValidationInfo result; @@ -204,7 +202,7 @@ static ValidationInfo validateControlBlock( result.status = Status::Malformed; return result; } - if (!readOptionsBlock(cursor, scratch, *extendedInfo, pathRecoverer)) { + if (!readOptionsBlock(cursor, scratch, *extendedInfo)) { result.status = Status::Malformed; return result; } @@ -467,11 +465,10 @@ ValidationInfo serialization::validateSerializedAST( result.status = Status::Malformed; return result; } - PathObfuscator localObfuscator; result = validateControlBlock( cursor, scratch, {SWIFTMODULE_VERSION_MAJOR, SWIFTMODULE_VERSION_MINOR}, - requiresOSSAModules, extendedInfo, localObfuscator); + requiresOSSAModules, extendedInfo); if (result.status == Status::Malformed) return result; } else if (dependencies && @@ -941,7 +938,7 @@ getActualImportControl(unsigned rawValue) { } } -bool ModuleFileSharedCore::readModuleDocIfPresent(PathObfuscator &pathRecoverer) { +bool ModuleFileSharedCore::readModuleDocIfPresent() { if (!this->ModuleDocInputBuffer) return true; @@ -980,7 +977,7 @@ bool ModuleFileSharedCore::readModuleDocIfPresent(PathObfuscator &pathRecoverer) info = validateControlBlock( docCursor, scratch, {SWIFTDOC_VERSION_MAJOR, SWIFTDOC_VERSION_MINOR}, RequiresOSSAModules, - /*extendedInfo*/ nullptr, pathRecoverer); + /*extendedInfo*/ nullptr); if (info.status != Status::Valid) return false; // Check that the swiftdoc is actually for this module. @@ -1086,7 +1083,7 @@ bool ModuleFileSharedCore::readDeclLocsBlock(llvm::BitstreamCursor &cursor) { return false; } -bool ModuleFileSharedCore::readModuleSourceInfoIfPresent(PathObfuscator &pathRecoverer) { +bool ModuleFileSharedCore::readModuleSourceInfoIfPresent() { if (!this->ModuleSourceInfoInputBuffer) return true; @@ -1124,8 +1121,7 @@ bool ModuleFileSharedCore::readModuleSourceInfoIfPresent(PathObfuscator &pathRec infoCursor, scratch, {SWIFTSOURCEINFO_VERSION_MAJOR, SWIFTSOURCEINFO_VERSION_MINOR}, RequiresOSSAModules, - /*extendedInfo*/ nullptr, - pathRecoverer); + /*extendedInfo*/ nullptr); if (info.status != Status::Valid) return false; // Check that the swiftsourceinfo is actually for this module. @@ -1200,7 +1196,7 @@ ModuleFileSharedCore::ModuleFileSharedCore( std::unique_ptr moduleDocInputBuffer, std::unique_ptr moduleSourceInfoInputBuffer, bool isFramework, bool requiresOSSAModules, - serialization::ValidationInfo &info, PathObfuscator &pathRecoverer) + serialization::ValidationInfo &info) : ModuleInputBuffer(std::move(moduleInputBuffer)), ModuleDocInputBuffer(std::move(moduleDocInputBuffer)), ModuleSourceInfoInputBuffer(std::move(moduleSourceInfoInputBuffer)), @@ -1251,7 +1247,7 @@ ModuleFileSharedCore::ModuleFileSharedCore( info = validateControlBlock( cursor, scratch, {SWIFTMODULE_VERSION_MAJOR, SWIFTMODULE_VERSION_MINOR}, - RequiresOSSAModules, &extInfo, pathRecoverer); + RequiresOSSAModules, &extInfo); if (info.status != Status::Valid) { error(info.status); return; @@ -1376,8 +1372,7 @@ ModuleFileSharedCore::ModuleFileSharedCore( bool isSystem; input_block::SearchPathLayout::readRecord(scratch, isFramework, isSystem); - SearchPaths.push_back({pathRecoverer.recover(blobData), isFramework, - isSystem}); + SearchPaths.push_back({blobData, isFramework, isSystem}); break; } case input_block::MODULE_INTERFACE_PATH: { @@ -1577,8 +1572,8 @@ ModuleFileSharedCore::ModuleFileSharedCore( return; } // Read source info file. - readModuleSourceInfoIfPresent(pathRecoverer); - if (!readModuleDocIfPresent(pathRecoverer)) { + readModuleSourceInfoIfPresent(); + if (!readModuleDocIfPresent()) { info.status = error(Status::MalformedDocumentation); return; } diff --git a/lib/Serialization/ModuleFileSharedCore.h b/lib/Serialization/ModuleFileSharedCore.h index 6dd500924541f..384a1c5512556 100644 --- a/lib/Serialization/ModuleFileSharedCore.h +++ b/lib/Serialization/ModuleFileSharedCore.h @@ -149,7 +149,7 @@ class ModuleFileSharedCore { SmallVector Dependencies; struct SearchPath { - std::string Path; + StringRef Path; bool IsFramework; bool IsSystem; }; @@ -374,7 +374,7 @@ class ModuleFileSharedCore { std::unique_ptr moduleDocInputBuffer, std::unique_ptr moduleSourceInfoInputBuffer, bool isFramework, bool requiresOSSAModules, - serialization::ValidationInfo &info, PathObfuscator &pathRecoverer); + serialization::ValidationInfo &info); /// Change the status of the current module. Status error(Status issue) { @@ -464,7 +464,7 @@ class ModuleFileSharedCore { /// Loads data from #ModuleDocInputBuffer. /// /// Returns false if there was an error. - bool readModuleDocIfPresent(PathObfuscator &pathRecoverer); + bool readModuleDocIfPresent(); /// Reads the source loc block, which contains USR to decl location mapping. /// @@ -474,7 +474,7 @@ class ModuleFileSharedCore { /// Loads data from #ModuleSourceInfoInputBuffer. /// /// Returns false if there was an error. - bool readModuleSourceInfoIfPresent(PathObfuscator &pathRecoverer); + bool readModuleSourceInfoIfPresent(); /// Read an on-disk decl hash table stored in /// \c sourceinfo_block::DeclUSRSLayout format. @@ -510,13 +510,12 @@ class ModuleFileSharedCore { std::unique_ptr moduleDocInputBuffer, std::unique_ptr moduleSourceInfoInputBuffer, bool isFramework, bool requiresOSSAModules, - PathObfuscator &pathRecoverer, std::shared_ptr &theModule) { serialization::ValidationInfo info; auto *core = new ModuleFileSharedCore( std::move(moduleInputBuffer), std::move(moduleDocInputBuffer), std::move(moduleSourceInfoInputBuffer), isFramework, - requiresOSSAModules, info, pathRecoverer); + requiresOSSAModules, info); if (!moduleInterfacePath.empty()) { ArrayRef path; core->allocateBuffer(path, moduleInterfacePath); diff --git a/lib/Serialization/Serialization.cpp b/lib/Serialization/Serialization.cpp index 591134ff33c11..a070747364d3e 100644 --- a/lib/Serialization/Serialization.cpp +++ b/lib/Serialization/Serialization.cpp @@ -1077,11 +1077,9 @@ void Serializer::writeHeader(const SerializationOptions &options) { options_block::XCCLayout XCC(Out); const auto &PathRemapper = options.DebuggingOptionsPrefixMap; - const auto &PathObfuscator = options.PathObfuscator; - auto sdkPath = M->getASTContext().SearchPathOpts.SDKPath; SDKPath.emit( ScratchRecord, - PathObfuscator.obfuscate(PathRemapper.remapPath(sdkPath))); + PathRemapper.remapPath(M->getASTContext().SearchPathOpts.SDKPath)); auto &Opts = options.ExtraClangOptions; for (auto Arg = Opts.begin(), E = Opts.end(); Arg != E; ++Arg) { StringRef arg(*Arg); @@ -1159,17 +1157,16 @@ void Serializer::writeInputBlock(const SerializationOptions &options) { input_block::ModuleInterfaceLayout ModuleInterface(Out); if (options.SerializeOptionsForDebugging) { - const auto &PathObfuscator = options.PathObfuscator; const auto &PathMapper = options.DebuggingOptionsPrefixMap; const SearchPathOptions &searchPathOpts = M->getASTContext().SearchPathOpts; // Put the framework search paths first so that they'll be preferred upon // deserialization. for (auto &framepath : searchPathOpts.FrameworkSearchPaths) SearchPath.emit(ScratchRecord, /*framework=*/true, framepath.IsSystem, - PathObfuscator.obfuscate(PathMapper.remapPath(framepath.Path))); + PathMapper.remapPath(framepath.Path)); for (auto &path : searchPathOpts.ImportSearchPaths) SearchPath.emit(ScratchRecord, /*framework=*/false, /*system=*/false, - PathObfuscator.obfuscate(PathMapper.remapPath(path))); + PathMapper.remapPath(path)); } // Note: We're not using StringMap here because we don't need to own the diff --git a/lib/Serialization/SerializedModuleLoader.cpp b/lib/Serialization/SerializedModuleLoader.cpp index eec8abfb17941..5c1df16e2271c 100644 --- a/lib/Serialization/SerializedModuleLoader.cpp +++ b/lib/Serialization/SerializedModuleLoader.cpp @@ -404,9 +404,7 @@ llvm::ErrorOr SerializedModuleLoaderBase::scanModuleFile( bool isFramework = false; serialization::ValidationInfo loadInfo = ModuleFileSharedCore::load( modulePath.str(), std::move(moduleBuf.get()), nullptr, nullptr, - isFramework, isRequiredOSSAModules(), - Ctx.SearchPathOpts.DeserializedPathRecoverer, - loadedModuleFile); + isFramework, isRequiredOSSAModules(), loadedModuleFile); const std::string moduleDocPath; const std::string sourceInfoPath; @@ -732,9 +730,7 @@ LoadedFile *SerializedModuleLoaderBase::loadAST( serialization::ValidationInfo loadInfo = ModuleFileSharedCore::load( moduleInterfacePath, std::move(moduleInputBuffer), std::move(moduleDocInputBuffer), std::move(moduleSourceInfoInputBuffer), - isFramework, isRequiredOSSAModules(), - Ctx.SearchPathOpts.DeserializedPathRecoverer, - loadedModuleFileCore); + isFramework, isRequiredOSSAModules(), loadedModuleFileCore); SerializedASTFile *fileUnit = nullptr; if (loadInfo.status == serialization::Status::Valid) { @@ -1559,8 +1555,3 @@ void SerializedASTFile::collectBasicSourceFileInfo( llvm::function_ref callback) const { File.collectBasicSourceFileInfo(callback); } - -void SerializedASTFile::collectSerializedSearchPath( - llvm::function_ref callback) const { - File.collectSerializedSearchPath(callback); -} diff --git a/test/Serialization/path_obfuscator.swift b/test/Serialization/path_obfuscator.swift deleted file mode 100644 index 6c3f674e3b715..0000000000000 --- a/test/Serialization/path_obfuscator.swift +++ /dev/null @@ -1,13 +0,0 @@ -// RUN: %empty-directory(%t) -// RUN: %empty-directory(%t.module-cache) -// RUN: %target-swift-frontend -emit-module -o %t/Foo.swiftmodule %s -parse-as-library -serialized-path-obfuscate /FOO=/CHANGED_FOO -serialized-path-obfuscate /BAR=/CHANGED_BAR -I /FOO/contents -I /BAR/contents -module-name Foo -serialize-debugging-options -// RUN: %target-swift-ide-test -print-module-metadata -module-to-print Foo -enable-swiftsourceinfo -I %t -source-filename %s | %FileCheck %s --check-prefix=CHECK-ORIGINAL -// RUN: %target-swift-ide-test -print-module-metadata -module-to-print Foo -enable-swiftsourceinfo -I %t -source-filename %s -serialized-path-obfuscate /FOO=/CHANGED_FOO -serialized-path-obfuscate /BAR=/CHANGED_BAR | %FileCheck %s --check-prefix=CHECK-RECOVER - -public class A {} - -// CHECK-ORIGINAL: /CHANGED_FOO/contents -// CHECK-ORIGINAL: /CHANGED_BAR/contents - -// CHECK-RECOVER: /FOO/contents -// CHECK-RECOVER: /BAR/contents \ No newline at end of file diff --git a/tools/swift-ide-test/swift-ide-test.cpp b/tools/swift-ide-test/swift-ide-test.cpp index e232aa0953199..4f2e816878ac4 100644 --- a/tools/swift-ide-test/swift-ide-test.cpp +++ b/tools/swift-ide-test/swift-ide-test.cpp @@ -803,10 +803,6 @@ static llvm::cl::opt llvm::cl::desc("Define a macro for @available"), llvm::cl::cat(Category)); -static llvm::cl::list -SerializedPathObfuscate("serialized-path-obfuscate", llvm::cl::desc("Path to access notes file"), - llvm::cl::cat(Category)); - } // namespace options static std::unique_ptr @@ -2823,9 +2819,6 @@ static void printModuleMetadata(ModuleDecl *MD) { OS << "size=" << info.getFileSize(); OS << "\n"; }); - MD->collectSerializedSearchPath([&](StringRef path) { - OS << "searchpath=" << path << ";\n"; - }); } static int doPrintModuleMetaData(const CompilerInvocation &InitInvok, @@ -4125,13 +4118,6 @@ int main(int argc, char *argv[]) { if (!options::DefineAvailability.empty()) { InitInvok.getLangOptions().AvailabilityMacros.push_back(options::DefineAvailability); } - for (auto map: options::SerializedPathObfuscate) { - auto SplitMap = StringRef(map).split('='); - InitInvok.getFrontendOptions().serializedPathObfuscator - .addMapping(SplitMap.first, SplitMap.second); - InitInvok.getSearchPathOptions().DeserializedPathRecoverer - .addMapping(SplitMap.first, SplitMap.second); - } InitInvok.getLangOptions().CollectParsedToken = true; InitInvok.getLangOptions().BuildSyntaxTree = true; InitInvok.getLangOptions().EnableCrossImportOverlays =