Skip to content

Commit f5aa95b

Browse files
authored
Revert "Add -prefix-serialized-debugging-options" (#39544)
Reverts #39138 This is causing a failure on Windows: https://ci-external.swift.org/job/oss-swift-windows-x86_64-vs2019/6659/consoleText
1 parent 5e06bbe commit f5aa95b

File tree

13 files changed

+31
-239
lines changed

13 files changed

+31
-239
lines changed

include/swift/AST/SearchPathOptions.h

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

1616
#include "swift/Basic/ArrayRefView.h"
17-
#include "swift/Basic/PathRemapper.h"
1817
#include "llvm/ADT/Hashing.h"
1918

2019
#include <string>
@@ -98,11 +97,6 @@ class SearchPathOptions {
9897

9998
/// A file containing modules we should perform batch scanning.
10099
std::string BatchScanInputFilePath;
101-
102-
/// Debug path mappings to apply to serialized search paths. These are
103-
/// specified in LLDB from the target.source-map entries.
104-
PathRemapper SearchPathRemapper;
105-
106100
private:
107101
static StringRef
108102
pathStringFromFrameworkSearchPath(const FrameworkSearchPath &next) {

include/swift/Basic/LangOptions.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -771,9 +771,6 @@ namespace swift {
771771
DisableOverlayModules,
772772
EnableClangSPI);
773773
}
774-
775-
std::vector<std::string> getRemappedExtraArgs(
776-
std::function<std::string(StringRef)> pathRemapCallback) const;
777774
};
778775

779776
} // end namespace swift

include/swift/Frontend/FrontendOptions.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,11 +182,6 @@ class FrontendOptions {
182182
/// module appears to not be a public module.
183183
Optional<bool> SerializeOptionsForDebugging;
184184

185-
/// When true the debug prefix map entries will be applied to debugging
186-
/// options before serialization. These can be reconstructed at debug time by
187-
/// applying the inverse map in SearchPathOptions.SearchPathRemapper.
188-
bool DebugPrefixSerializedDebuggingOptions = false;
189-
190185
/// When true, check if all required SwiftOnoneSupport symbols are present in
191186
/// the module.
192187
bool CheckOnoneSupportCompleteness = false;

include/swift/Option/Options.td

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ def disable_bridging_pch : Flag<["-"], "disable-bridging-pch">,
559559
def lto : Joined<["-"], "lto=">,
560560
Flags<[FrontendOption, NoInteractiveOption]>,
561561
HelpText<"Specify the LTO type to either 'llvm-thin' or 'llvm-full'">;
562-
562+
563563
def lto_library : Separate<["-"], "lto-library">,
564564
Flags<[FrontendOption, ArgumentIsPath, NoInteractiveOption]>,
565565
HelpText<"Perform LTO with <lto-library>">, MetaVarName<"<lto-library>">;
@@ -815,10 +815,6 @@ def debug_info_format : Joined<["-"], "debug-info-format=">,
815815
Flags<[FrontendOption]>,
816816
HelpText<"Specify the debug info format type to either 'dwarf' or 'codeview'">;
817817

818-
def prefix_serialized_debugging_options : Flag<["-"], "prefix-serialized-debugging-options">,
819-
Flags<[FrontendOption]>,
820-
HelpText<"Apply debug prefix mappings to serialized debug info in Swiftmodule files">;
821-
822818
// Verify debug info
823819
def verify_debug_info : Flag<["-"], "verify-debug-info">,
824820
Flags<[NoInteractiveOption, DoesNotAffectIncrementalBuild]>,

include/swift/Serialization/SerializationOptions.h

Lines changed: 1 addition & 5 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
#include "llvm/Support/VersionTuple.h"
1918

2019
namespace swift {
@@ -43,10 +42,7 @@ namespace swift {
4342
StringRef ImportedHeader;
4443
StringRef ModuleLinkName;
4544
StringRef ModuleInterface;
46-
std::vector<std::string> ExtraClangOptions;
47-
48-
/// Path prefixes that should be rewritten in debug info.
49-
PathRemapper DebuggingOptionsPrefixMap;
45+
ArrayRef<std::string> ExtraClangOptions;
5046

5147
/// Describes a single-file dependency for this module, along with the
5248
/// appropriate strategy for how to verify if it's up-to-date.

lib/Basic/LangOptions.cpp

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -408,56 +408,3 @@ DiagnosticBehavior LangOptions::getAccessNoteFailureLimit() const {
408408
}
409409
llvm_unreachable("covered switch");
410410
}
411-
412-
std::vector<std::string> ClangImporterOptions::getRemappedExtraArgs(
413-
std::function<std::string(StringRef)> pathRemapCallback) const {
414-
auto consumeIncludeOption = [](StringRef &arg, StringRef &prefix) {
415-
static StringRef options[] = {"-I",
416-
"-F",
417-
"-fmodule-map-file=",
418-
"-iquote",
419-
"-idirafter",
420-
"-iframeworkwithsysroot",
421-
"-iframework",
422-
"-iprefix",
423-
"-iwithprefixbefore",
424-
"-iwithprefix",
425-
"-isystemafter",
426-
"-isystem",
427-
"-isysroot",
428-
"-ivfsoverlay",
429-
"-working-directory=",
430-
"-working-directory"};
431-
for (StringRef &option : options)
432-
if (arg.consume_front(option)) {
433-
prefix = option;
434-
return true;
435-
}
436-
return false;
437-
};
438-
439-
// true if the previous argument was the dash-option of an option pair
440-
bool remap_next = false;
441-
std::vector<std::string> args;
442-
for (auto A : ExtraArgs) {
443-
StringRef prefix;
444-
StringRef arg(A);
445-
446-
if (remap_next) {
447-
remap_next = false;
448-
args.push_back(pathRemapCallback(arg));
449-
} else if (consumeIncludeOption(arg, prefix)) {
450-
if (arg.empty()) {
451-
// Option pair
452-
remap_next = true;
453-
args.push_back(prefix.str());
454-
} else {
455-
// Combine prefix with remapped path value
456-
args.push_back(prefix.str() + pathRemapCallback(arg));
457-
}
458-
} else {
459-
args.push_back(A);
460-
}
461-
}
462-
return args;
463-
}

lib/Frontend/ArgsToFrontendOptionsConverter.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,6 @@ bool ArgsToFrontendOptionsConverter::convert(
258258
A->getOption().matches(OPT_serialize_debugging_options);
259259
}
260260

261-
Opts.DebugPrefixSerializedDebuggingOptions |=
262-
Args.hasArg(OPT_prefix_serialized_debugging_options);
263261
Opts.EnableSourceImport |= Args.hasArg(OPT_enable_source_import);
264262
Opts.ImportUnderlyingModule |= Args.hasArg(OPT_import_underlying_module);
265263
Opts.EnableIncrementalDependencyVerifier |= Args.hasArg(OPT_verify_incremental_dependencies);

lib/Frontend/Frontend.cpp

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ SerializationOptions CompilerInvocation::computeSerializationOptions(
147147
serializationOpts.ImportedHeader = opts.ImplicitObjCHeaderPath;
148148
serializationOpts.ModuleLinkName = opts.ModuleLinkName;
149149
serializationOpts.UserModuleVersion = opts.UserModuleVersion;
150-
150+
serializationOpts.ExtraClangOptions = getClangImporterOptions().ExtraArgs;
151151
serializationOpts.PublicDependentLibraries =
152152
getIRGenOptions().PublicLinkLibraries;
153153
serializationOpts.SDKName = getLangOptions().SDKName;
@@ -176,20 +176,6 @@ SerializationOptions CompilerInvocation::computeSerializationOptions(
176176
opts.SerializeOptionsForDebugging.getValueOr(
177177
!module->isExternallyConsumed());
178178

179-
if (serializationOpts.SerializeOptionsForDebugging &&
180-
opts.DebugPrefixSerializedDebuggingOptions) {
181-
serializationOpts.DebuggingOptionsPrefixMap =
182-
getIRGenOptions().DebugPrefixMap;
183-
auto &remapper = serializationOpts.DebuggingOptionsPrefixMap;
184-
auto remapClangPaths = [&remapper](StringRef path) {
185-
return remapper.remapPath(path);
186-
};
187-
serializationOpts.ExtraClangOptions =
188-
getClangImporterOptions().getRemappedExtraArgs(remapClangPaths);
189-
} else {
190-
serializationOpts.ExtraClangOptions = getClangImporterOptions().ExtraArgs;
191-
}
192-
193179
serializationOpts.DisableCrossModuleIncrementalInfo =
194180
opts.DisableCrossModuleIncrementalBuild;
195181

lib/Serialization/ModuleFile.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,9 @@ Status ModuleFile::associateWithFileContext(FileUnit *file, SourceLoc diagLoc,
158158
return error(status);
159159
}
160160

161-
for (const auto &searchPath : Core->SearchPaths) {
162-
ctx.addSearchPath(
163-
ctx.SearchPathOpts.SearchPathRemapper.remapPath(searchPath.Path),
164-
searchPath.IsFramework, searchPath.IsSystem);
165-
}
161+
for (const auto &searchPath : Core->SearchPaths)
162+
ctx.addSearchPath(searchPath.Path, searchPath.IsFramework,
163+
searchPath.IsSystem);
166164

167165
auto clangImporter = static_cast<ClangImporter *>(ctx.getClangModuleLoader());
168166

lib/Serialization/Serialization.cpp

Lines changed: 25 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
#include "swift/Basic/Defer.h"
4141
#include "swift/Basic/Dwarf.h"
4242
#include "swift/Basic/FileSystem.h"
43-
#include "swift/Basic/PathRemapper.h"
4443
#include "swift/Basic/STLExtras.h"
4544
#include "swift/Basic/Version.h"
4645
#include "swift/ClangImporter/ClangImporter.h"
@@ -49,9 +48,9 @@
4948
#include "swift/Demangling/ManglingMacros.h"
5049
#include "swift/Serialization/SerializationOptions.h"
5150
#include "swift/Strings.h"
52-
#include "swift/SymbolGraphGen/SymbolGraphGen.h"
53-
#include "swift/SymbolGraphGen/SymbolGraphOptions.h"
5451
#include "clang/AST/DeclTemplate.h"
52+
#include "swift/SymbolGraphGen/SymbolGraphOptions.h"
53+
#include "swift/SymbolGraphGen/SymbolGraphGen.h"
5554
#include "llvm/ADT/SmallSet.h"
5655
#include "llvm/ADT/SmallString.h"
5756
#include "llvm/ADT/StringExtras.h"
@@ -512,7 +511,7 @@ static uint8_t getRawOpaqueReadOwnership(swift::OpaqueReadOwnership ownership) {
512511
CASE(OwnedOrBorrowed)
513512
#undef CASE
514513
}
515-
llvm_unreachable("bad kind");
514+
llvm_unreachable("bad kind");
516515
}
517516

518517
static uint8_t getRawReadImplKind(swift::ReadImplKind kind) {
@@ -1059,35 +1058,25 @@ void Serializer::writeHeader(const SerializationOptions &options) {
10591058
options_block::SDKPathLayout SDKPath(Out);
10601059
options_block::XCCLayout XCC(Out);
10611060

1062-
const auto &PathRemapper = options.DebuggingOptionsPrefixMap;
1063-
SDKPath.emit(
1064-
ScratchRecord,
1065-
PathRemapper.remapPath(M->getASTContext().SearchPathOpts.SDKPath));
1061+
SDKPath.emit(ScratchRecord, M->getASTContext().SearchPathOpts.SDKPath);
10661062
auto &Opts = options.ExtraClangOptions;
1067-
for (auto Arg = Opts.begin(), E = Opts.end(); Arg != E; ++Arg) {
1068-
StringRef arg(*Arg);
1069-
if (arg.startswith("-ivfsoverlay")) {
1070-
// FIXME: This is a hack and calls for a better design.
1071-
//
1072-
// Filter out any -ivfsoverlay options that include an
1073-
// unextended-module-overlay.yaml overlay. By convention the Xcode
1074-
// buildsystem uses these while *building* mixed Objective-C and
1075-
// Swift frameworks; but they should never be used to *import* the
1076-
// module defined in the framework.
1063+
for (auto Arg = Opts.begin(), E = Opts.end(); Arg != E; ++Arg) {
1064+
// FIXME: This is a hack and calls for a better design.
1065+
//
1066+
// Filter out any -ivfsoverlay options that include an
1067+
// unextended-module-overlay.yaml overlay. By convention the Xcode
1068+
// buildsystem uses these while *building* mixed Objective-C and Swift
1069+
// frameworks; but they should never be used to *import* the module
1070+
// defined in the framework.
1071+
if (StringRef(*Arg).startswith("-ivfsoverlay")) {
10771072
auto Next = std::next(Arg);
10781073
if (Next != E &&
10791074
StringRef(*Next).endswith("unextended-module-overlay.yaml")) {
10801075
++Arg;
10811076
continue;
10821077
}
1083-
} else if (arg.startswith("-fdebug-prefix-map=")) {
1084-
// We don't serialize the debug prefix map flags as these
1085-
// contain absoute paths that are not usable on different
1086-
// machines. These flags are not necessary to compile the
1087-
// clang modules again so are safe to remove.
1088-
continue;
10891078
}
1090-
XCC.emit(ScratchRecord, arg);
1079+
XCC.emit(ScratchRecord, *Arg);
10911080
}
10921081
}
10931082
}
@@ -1138,16 +1127,14 @@ void Serializer::writeInputBlock(const SerializationOptions &options) {
11381127
input_block::ModuleInterfaceLayout ModuleInterface(Out);
11391128

11401129
if (options.SerializeOptionsForDebugging) {
1141-
const auto &PathMapper = options.DebuggingOptionsPrefixMap;
11421130
const SearchPathOptions &searchPathOpts = M->getASTContext().SearchPathOpts;
11431131
// Put the framework search paths first so that they'll be preferred upon
11441132
// deserialization.
11451133
for (auto &framepath : searchPathOpts.FrameworkSearchPaths)
11461134
SearchPath.emit(ScratchRecord, /*framework=*/true, framepath.IsSystem,
1147-
PathMapper.remapPath(framepath.Path));
1135+
framepath.Path);
11481136
for (auto &path : searchPathOpts.ImportSearchPaths)
1149-
SearchPath.emit(ScratchRecord, /*framework=*/false, /*system=*/false,
1150-
PathMapper.remapPath(path));
1137+
SearchPath.emit(ScratchRecord, /*framework=*/false, /*system=*/false, path);
11511138
}
11521139

11531140
// Note: We're not using StringMap here because we don't need to own the
@@ -1481,7 +1468,7 @@ void Serializer::writeASTBlockEntity(const SILLayout *layout) {
14811468
typeRef |= 0x80000000U;
14821469
data.push_back(typeRef);
14831470
}
1484-
1471+
14851472
unsigned abbrCode
14861473
= DeclTypeAbbrCodes[SILLayoutLayout::Code];
14871474

@@ -1716,7 +1703,7 @@ static bool shouldSerializeMember(Decl *D) {
17161703

17171704
case DeclKind::OpaqueType:
17181705
return true;
1719-
1706+
17201707
case DeclKind::EnumElement:
17211708
case DeclKind::Protocol:
17221709
case DeclKind::Constructor:
@@ -1814,14 +1801,14 @@ void Serializer::writeCrossReference(const DeclContext *DC, uint32_t pathLen) {
18141801
if (auto opaque = dyn_cast<OpaqueTypeDecl>(generic)) {
18151802
if (!opaque->hasName()) {
18161803
abbrCode = DeclTypeAbbrCodes[XRefOpaqueReturnTypePathPieceLayout::Code];
1817-
1804+
18181805
XRefOpaqueReturnTypePathPieceLayout::emitRecord(Out, ScratchRecord,
18191806
abbrCode,
18201807
addDeclBaseNameRef(opaque->getOpaqueReturnTypeIdentifier()));
18211808
break;
18221809
}
18231810
}
1824-
1811+
18251812
assert(generic->hasName());
18261813

18271814
abbrCode = DeclTypeAbbrCodes[XRefTypePathPieceLayout::Code];
@@ -1862,7 +1849,7 @@ void Serializer::writeCrossReference(const DeclContext *DC, uint32_t pathLen) {
18621849
case DeclContextKind::SubscriptDecl: {
18631850
auto SD = cast<SubscriptDecl>(DC);
18641851
writeCrossReference(DC->getParent(), pathLen + 1);
1865-
1852+
18661853
Type ty = SD->getInterfaceType()->getCanonicalType();
18671854

18681855
abbrCode = DeclTypeAbbrCodes[XRefValuePathPieceLayout::Code];
@@ -1873,7 +1860,7 @@ void Serializer::writeCrossReference(const DeclContext *DC, uint32_t pathLen) {
18731860
SD->isStatic());
18741861
break;
18751862
}
1876-
1863+
18771864
case DeclContextKind::AbstractFunctionDecl: {
18781865
if (auto fn = dyn_cast<AccessorDecl>(DC)) {
18791866
auto storage = fn->getStorage();
@@ -1985,7 +1972,7 @@ void Serializer::writeCrossReference(const Decl *D) {
19851972
addDeclBaseNameRef(opaque->getOpaqueReturnTypeIdentifier()));
19861973
return;
19871974
}
1988-
1975+
19891976
if (auto genericParam = dyn_cast<GenericTypeParamDecl>(D)) {
19901977
assert(!D->getDeclContext()->isModuleScopeContext() &&
19911978
"Cannot cross reference a generic type decl at module scope.");
@@ -4686,7 +4673,7 @@ class ClangToSwiftBasicWriter :
46864673

46874674
Serializer &S;
46884675
SmallVectorImpl<uint64_t> &Record;
4689-
using TypeWriter =
4676+
using TypeWriter =
46904677
clang::serialization::AbstractTypeWriter<ClangToSwiftBasicWriter>;
46914678
TypeWriter Types;
46924679

@@ -5490,7 +5477,7 @@ void Serializer::writeAST(ModuleOrSourceFile DC) {
54905477
/*isLocal=*/true);
54915478
}
54925479
}
5493-
5480+
54945481
for (auto OTD : opaqueReturnTypeDecls) {
54955482
// FIXME: We should delay parsing function bodies so these type decls
54965483
// don't even get added to the file.

0 commit comments

Comments
 (0)