Skip to content

Commit aebd771

Browse files
authored
Merge pull request #40368 from apple/revert-40357-obfuscate-searialized-paths
Revert "serialization: obfuscate the serialized search paths"
2 parents 5b8714e + 11d5d6d commit aebd771

21 files changed

+27
-139
lines changed

include/swift/AST/FileUnit.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,8 +405,6 @@ class LoadedFile : public FileUnit {
405405
virtual void collectBasicSourceFileInfo(
406406
llvm::function_ref<void(const BasicSourceFileInfo &)> callback) const {}
407407

408-
virtual void collectSerializedSearchPath(
409-
llvm::function_ref<void(StringRef)> callback) const {}
410408
static bool classof(const FileUnit *file) {
411409
return file->getKind() == FileUnitKind::SerializedAST ||
412410
file->getKind() == FileUnitKind::ClangModule ||

include/swift/AST/Module.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -833,8 +833,6 @@ class ModuleDecl
833833
void collectBasicSourceFileInfo(
834834
llvm::function_ref<void(const BasicSourceFileInfo &)> callback) const;
835835

836-
void collectSerializedSearchPath(
837-
llvm::function_ref<void(StringRef)> callback) const;
838836
/// Retrieve a fingerprint value that summarizes the contents of this module.
839837
///
840838
/// This interface hash a of a module is guaranteed to change if the interface

include/swift/AST/SearchPathOptions.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,6 @@ class SearchPathOptions {
103103
/// specified in LLDB from the target.source-map entries.
104104
PathRemapper SearchPathRemapper;
105105

106-
/// Recover the search paths deserialized from .swiftmodule files to their
107-
/// original form.
108-
PathObfuscator DeserializedPathRecoverer;
109-
110106
private:
111107
static StringRef
112108
pathStringFromFrameworkSearchPath(const FrameworkSearchPath &next) {

include/swift/Basic/PathRemapper.h

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -58,21 +58,6 @@ class PathRemapper {
5858
}
5959
};
6060

61-
class PathObfuscator {
62-
PathRemapper obfuscator, recoverer;
63-
public:
64-
void addMapping(StringRef FromPrefix, StringRef ToPrefix) {
65-
obfuscator.addMapping(FromPrefix, ToPrefix);
66-
recoverer.addMapping(ToPrefix, FromPrefix);
67-
}
68-
std::string obfuscate(StringRef Path) const {
69-
return obfuscator.remapPath(Path);
70-
}
71-
std::string recover(StringRef Path) const {
72-
return recoverer.remapPath(Path);
73-
}
74-
};
75-
7661
} // end namespace swift
7762

7863
#endif // SWIFT_BASIC_PATHREMAPPER_H

include/swift/Frontend/FrontendOptions.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
#include "swift/Basic/FileTypes.h"
1717
#include "swift/Basic/Version.h"
18-
#include "swift/Basic/PathRemapper.h"
1918
#include "swift/Frontend/FrontendInputsAndOutputs.h"
2019
#include "swift/Frontend/InputFile.h"
2120
#include "llvm/ADT/Hashing.h"
@@ -438,10 +437,6 @@ class FrontendOptions {
438437
/// Whether to include symbols with SPI information in the symbol graph.
439438
bool IncludeSPISymbolsInSymbolGraph = false;
440439

441-
/// This is used to obfuscate the serialized search paths so we don't have
442-
/// to encode the actual paths into the .swiftmodule file.
443-
PathObfuscator serializedPathObfuscator;
444-
445440
private:
446441
static bool canActionEmitDependencies(ActionType);
447442
static bool canActionEmitReferenceDependencies(ActionType);

include/swift/Option/FrontendOptions.td

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,6 @@ def print_clang_stats : Flag<["-"], "print-clang-stats">,
165165

166166
def serialize_debugging_options : Flag<["-"], "serialize-debugging-options">,
167167
HelpText<"Always serialize options for debugging (default: only for apps)">;
168-
169-
def serialized_path_obfuscate : Separate<["-"], "serialized-path-obfuscate">,
170-
HelpText<"Remap source paths in debug info">, MetaVarName<"<prefix=replacement>">;
171-
172168
def no_serialize_debugging_options :
173169
Flag<["-"], "no-serialize-debugging-options">,
174170
HelpText<"Never serialize options for debugging (default: only for apps)">;

include/swift/Serialization/SerializationOptions.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,6 @@ namespace swift {
4545
/// Path prefixes that should be rewritten in debug info.
4646
PathRemapper DebuggingOptionsPrefixMap;
4747

48-
/// Obfuscate the serialized paths so we don't have the actual paths encoded
49-
/// in the .swiftmodule file.
50-
PathObfuscator PathObfuscator;
51-
5248
/// Describes a single-file dependency for this module, along with the
5349
/// appropriate strategy for how to verify if it's up-to-date.
5450
class FileDependency {

include/swift/Serialization/SerializedModuleLoader.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -465,9 +465,6 @@ class SerializedASTFile final : public LoadedFile {
465465
virtual void collectBasicSourceFileInfo(
466466
llvm::function_ref<void(const BasicSourceFileInfo &)>) const override;
467467

468-
virtual void collectSerializedSearchPath(
469-
llvm::function_ref<void(StringRef)> callback) const override;
470-
471468
static bool classof(const FileUnit *file) {
472469
return file->getKind() == FileUnitKind::SerializedAST;
473470
}

include/swift/Serialization/Validation.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ struct ValidationInfo {
104104
/// \sa validateSerializedAST()
105105
class ExtendedValidationInfo {
106106
SmallVector<StringRef, 4> ExtraClangImporterOpts;
107-
std::string SDKPath;
107+
StringRef SDKPath;
108108
StringRef ModuleABIName;
109109
struct {
110110
unsigned ArePrivateImportsEnabled : 1;
@@ -121,7 +121,7 @@ class ExtendedValidationInfo {
121121
ExtendedValidationInfo() : Bits() {}
122122

123123
StringRef getSDKPath() const { return SDKPath; }
124-
void setSDKPath(std::string path) {
124+
void setSDKPath(StringRef path) {
125125
assert(SDKPath.empty());
126126
SDKPath = path;
127127
}

lib/AST/Module.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1808,15 +1808,6 @@ void ModuleDecl::collectBasicSourceFileInfo(
18081808
}
18091809
}
18101810

1811-
void ModuleDecl::collectSerializedSearchPath(
1812-
llvm::function_ref<void(StringRef)> callback) const {
1813-
for (const FileUnit *fileUnit : getFiles()) {
1814-
if (auto *serialized = dyn_cast<LoadedFile>(fileUnit)) {
1815-
serialized->collectSerializedSearchPath(callback);
1816-
}
1817-
}
1818-
}
1819-
18201811
Fingerprint ModuleDecl::getFingerprint() const {
18211812
StableHasher hasher = StableHasher::defaultHasher();
18221813
SmallVector<Fingerprint, 16> FPs;

0 commit comments

Comments
 (0)