Skip to content

Commit cb56564

Browse files
committed
Revert remapping of search paths in serialized modules.
1 parent 346e1c3 commit cb56564

File tree

5 files changed

+7
-75
lines changed

5 files changed

+7
-75
lines changed

include/swift/Option/Options.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ def gdwarf_types : Flag<["-"], "gdwarf-types">,
472472
HelpText<"Emit full DWARF type info.">;
473473
def debug_prefix_map : Separate<["-"], "debug-prefix-map">,
474474
Flags<[FrontendOption]>,
475-
HelpText<"Remap source paths and search paths in debug info">;
475+
HelpText<"Remap source paths in debug info">;
476476

477477
def debug_info_format : Joined<["-"], "debug-info-format=">,
478478
Flags<[FrontendOption]>,

include/swift/Serialization/SerializationOptions.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#define SWIFT_SERIALIZATION_SERIALIZATIONOPTIONS_H
1515

1616
#include "swift/Basic/LLVM.h"
17-
#include "swift/Basic/PathRemapper.h"
1817

1918
namespace swift {
2019

@@ -35,7 +34,6 @@ namespace swift {
3534
StringRef ImportedHeader;
3635
StringRef ModuleLinkName;
3736
ArrayRef<std::string> ExtraClangOptions;
38-
PathRemapper DebugPrefixMap;
3937

4038
bool AutolinkForceLoad = false;
4139
bool EnableNestedTypeLookupTable = false;

lib/FrontendTool/FrontendTool.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,8 +1052,6 @@ computeSerializationOptions(const CompilerInvocation &Invocation,
10521052
opts.EnableSerializationNestedTypeLookupTable;
10531053
if (!Invocation.getIRGenOptions().ForceLoadSymbolName.empty())
10541054
serializationOpts.AutolinkForceLoad = true;
1055-
serializationOpts.DebugPrefixMap =
1056-
Invocation.getIRGenOptions().DebugPrefixMap;
10571055

10581056
// Options contain information about the developer's computer,
10591057
// so only serialize them if the module isn't going to be shipped to

lib/Serialization/Serialization.cpp

Lines changed: 6 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444

4545
#include "llvm/ADT/SmallString.h"
4646
#include "llvm/ADT/StringExtras.h"
47-
#include "llvm/ADT/StringSet.h"
4847
#include "llvm/Bitcode/BitstreamWriter.h"
4948
#include "llvm/Bitcode/RecordLayout.h"
5049
#include "llvm/Config/config.h"
@@ -966,9 +965,7 @@ void Serializer::writeHeader(const SerializationOptions &options) {
966965
options_block::SDKPathLayout SDKPath(Out);
967966
options_block::XCCLayout XCC(Out);
968967

969-
SDKPath.emit(ScratchRecord,
970-
options.DebugPrefixMap.remapPath(
971-
M->getASTContext().SearchPathOpts.SDKPath));
968+
SDKPath.emit(ScratchRecord, M->getASTContext().SearchPathOpts.SDKPath);
972969
auto &Opts = options.ExtraClangOptions;
973970
for (auto Arg = Opts.begin(), E = Opts.end(); Arg != E; ++Arg) {
974971
// FIXME: This is a hack and calls for a better design.
@@ -986,23 +983,6 @@ void Serializer::writeHeader(const SerializationOptions &options) {
986983
continue;
987984
}
988985
}
989-
// Remap the absolute working directory path that the driver adds to
990-
// the Clang arguments.
991-
if (StringRef(*Arg) == "-working-directory") {
992-
XCC.emit(ScratchRecord, *Arg);
993-
auto Next = std::next(Arg);
994-
if (Next != E) {
995-
XCC.emit(ScratchRecord, options.DebugPrefixMap.remapPath(*Next));
996-
++Arg;
997-
continue;
998-
}
999-
}
1000-
// Filter out any -fdebug-prefix-map flags, since they can't be
1001-
// meaningfully remapped. They're only needed during codegen, not when
1002-
// the module is loaded for debugging.
1003-
if (StringRef(*Arg).startswith("-fdebug-prefix-map="))
1004-
continue;
1005-
1006986
XCC.emit(ScratchRecord, *Arg);
1007987
}
1008988
}
@@ -1093,33 +1073,14 @@ void Serializer::writeInputBlock(const SerializationOptions &options) {
10931073
input_block::SearchPathLayout SearchPath(Out);
10941074

10951075
if (options.SerializeOptionsForDebugging) {
1096-
// Remapping the paths can result in duplicates when the same path is passed
1097-
// to the compiler that is also loaded from an imported module; the
1098-
// compilation invocation will contain the unmapped path but the loaded
1099-
// module will have the remapped path. We uniquify the paths before writing
1100-
// to prevent this.
1101-
llvm::StringSet<> FrameworkPathsSeen;
1102-
llvm::StringSet<> ImportPathsSeen;
1103-
11041076
const SearchPathOptions &searchPathOpts = M->getASTContext().SearchPathOpts;
11051077
// Put the framework search paths first so that they'll be preferred upon
11061078
// deserialization.
1107-
for (auto &framepath : searchPathOpts.FrameworkSearchPaths) {
1108-
auto remapped = options.DebugPrefixMap.remapPath(framepath.Path);
1109-
if (FrameworkPathsSeen.find(remapped) == FrameworkPathsSeen.end()) {
1110-
SearchPath.emit(ScratchRecord, /*framework=*/true, framepath.IsSystem,
1111-
remapped);
1112-
FrameworkPathsSeen.insert(remapped);
1113-
}
1114-
}
1115-
for (auto &path : searchPathOpts.ImportSearchPaths) {
1116-
auto remapped = options.DebugPrefixMap.remapPath(path);
1117-
if (ImportPathsSeen.find(remapped) == ImportPathsSeen.end()) {
1118-
SearchPath.emit(ScratchRecord, /*framework=*/false, /*system=*/false,
1119-
remapped);
1120-
ImportPathsSeen.insert(remapped);
1121-
}
1122-
}
1079+
for (auto &framepath : searchPathOpts.FrameworkSearchPaths)
1080+
SearchPath.emit(ScratchRecord, /*framework=*/true, framepath.IsSystem,
1081+
framepath.Path);
1082+
for (auto &path : searchPathOpts.ImportSearchPaths)
1083+
SearchPath.emit(ScratchRecord, /*framework=*/false, /*system=*/false, path);
11231084
}
11241085

11251086
// FIXME: Having to deal with private imports as a superset of public imports

test/Serialization/search-paths-remapped.swift

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)