Skip to content

Commit 7a57818

Browse files
Merge pull request #37017 from apple/revert-36542-QuietMisdreavus/supplementary-symbol-graph
Revert "[Driver][Frontend] add the symbol graph dir to the supplementary file map"
2 parents 5a7fd68 + 87fe71e commit 7a57818

File tree

10 files changed

+12
-80
lines changed

10 files changed

+12
-80
lines changed

include/swift/Basic/FileTypes.def

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,6 @@ TYPE("index-unit-output-path", IndexUnitOutputPath, "", "")
8383
TYPE("yaml-opt-record", YAMLOptRecord, "opt.yaml", "")
8484
TYPE("bitstream-opt-record",BitstreamOptRecord, "opt.bitstream", "")
8585

86-
TYPE("symbol-graph-output-path", SymbolGraphOutputPath, "", "")
87-
8886
// Overlay files declare wrapper modules, called "separately-imported overlays",
8987
// that should be automatically imported when a particular module is imported.
9088
// Cross-import directories conditionalize overlay files so they only take

include/swift/Basic/SupplementaryOutputPaths.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,6 @@ struct SupplementaryOutputPaths {
152152

153153
/// The path to which we should emit module summary file.
154154
std::string ModuleSummaryOutputPath;
155-
156-
/// The directory to which we should emit symbol graphs for the current module.
157-
std::string SymbolGraphOutputDir;
158155

159156
SupplementaryOutputPaths() = default;
160157
SupplementaryOutputPaths(const SupplementaryOutputPaths &) = default;
@@ -189,8 +186,6 @@ struct SupplementaryOutputPaths {
189186
fn(LdAddCFilePath);
190187
if (!ModuleSummaryOutputPath.empty())
191188
fn(ModuleSummaryOutputPath);
192-
if (!SymbolGraphOutputDir.empty())
193-
fn(SymbolGraphOutputDir);
194189
}
195190

196191
bool empty() const {
@@ -199,8 +194,7 @@ struct SupplementaryOutputPaths {
199194
ReferenceDependenciesFilePath.empty() &&
200195
SerializedDiagnosticsPath.empty() && LoadedModuleTracePath.empty() &&
201196
TBDPath.empty() && ModuleInterfaceOutputPath.empty() &&
202-
ModuleSourceInfoOutputPath.empty() && LdAddCFilePath.empty() &&
203-
SymbolGraphOutputDir.empty();
197+
ModuleSourceInfoOutputPath.empty() && LdAddCFilePath.empty();
204198
}
205199
};
206200
} // namespace swift

include/swift/Driver/Driver.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -416,11 +416,6 @@ class Driver {
416416
const TypeToPathMap *OutputMap,
417417
StringRef workingDirectory,
418418
CommandOutput *Output) const;
419-
420-
void chooseSymbolGraphOutputPath(Compilation &C,
421-
const TypeToPathMap *OutputMap,
422-
StringRef workingDirectory,
423-
CommandOutput *Output) const;
424419

425420
void chooseLoadedModuleTracePath(Compilation &C,
426421
StringRef workingDirectory,

lib/Basic/FileTypes.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ bool file_types::isTextual(ID Id) {
106106
case file_types::TY_IndexData:
107107
case file_types::TY_BitstreamOptRecord:
108108
case file_types::TY_IndexUnitOutputPath:
109-
case file_types::TY_SymbolGraphOutputPath:
110109
return false;
111110
case file_types::TY_INVALID:
112111
llvm_unreachable("Invalid type ID.");
@@ -158,7 +157,6 @@ bool file_types::isAfterLLVM(ID Id) {
158157
case file_types::TY_JSONDependencies:
159158
case file_types::TY_JSONFeatures:
160159
case file_types::TY_IndexUnitOutputPath:
161-
case file_types::TY_SymbolGraphOutputPath:
162160
return false;
163161
case file_types::TY_INVALID:
164162
llvm_unreachable("Invalid type ID.");
@@ -210,7 +208,6 @@ bool file_types::isPartOfSwiftCompilation(ID Id) {
210208
case file_types::TY_JSONDependencies:
211209
case file_types::TY_JSONFeatures:
212210
case file_types::TY_IndexUnitOutputPath:
213-
case file_types::TY_SymbolGraphOutputPath:
214211
return false;
215212
case file_types::TY_INVALID:
216213
llvm_unreachable("Invalid type ID.");

lib/Driver/Driver.cpp

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2045,7 +2045,6 @@ void Driver::buildActions(SmallVectorImpl<const Action *> &TopLevelActions,
20452045
case file_types::TY_RawSIL:
20462046
case file_types::TY_Nothing:
20472047
case file_types::TY_IndexUnitOutputPath:
2048-
case file_types::TY_SymbolGraphOutputPath:
20492048
case file_types::TY_INVALID:
20502049
llvm_unreachable("these types should never be inferred");
20512050
}
@@ -2945,9 +2944,6 @@ Job *Driver::buildJobsForAction(Compilation &C, const JobAction *JA,
29452944
options::OPT_emit_objc_header_path))
29462945
chooseObjectiveCHeaderOutputPath(C, OutputMap, workingDirectory,
29472946
Output.get());
2948-
2949-
if (C.getArgs().hasArg(options::OPT_emit_symbol_graph))
2950-
chooseSymbolGraphOutputPath(C, OutputMap, workingDirectory, Output.get());
29512947

29522948
// 4. Construct a Job which produces the right CommandOutput.
29532949
std::unique_ptr<Job> ownedJob = TC.constructJob(*JA, C, std::move(InputJobs),
@@ -3418,31 +3414,6 @@ void Driver::chooseOptimizationRecordPath(Compilation &C,
34183414
Diags.diagnose({}, diag::warn_opt_remark_disabled);
34193415
}
34203416

3421-
void Driver::chooseSymbolGraphOutputPath(Compilation &C,
3422-
const TypeToPathMap *OutputMap,
3423-
StringRef workingDirectory,
3424-
CommandOutput *Output) const {
3425-
StringRef optionOutput = C.getArgs().getLastArgValue(options::OPT_emit_symbol_graph_dir);
3426-
if (hasExistingAdditionalOutput(*Output, file_types::TY_SymbolGraphOutputPath, optionOutput)) {
3427-
return;
3428-
}
3429-
3430-
StringRef SymbolGraphDir;
3431-
if (OutputMap) {
3432-
auto iter = OutputMap->find(file_types::TY_SymbolGraphOutputPath);
3433-
if (iter != OutputMap->end())
3434-
SymbolGraphDir = iter->second;
3435-
}
3436-
3437-
if (SymbolGraphDir.empty() && !optionOutput.empty()) {
3438-
SymbolGraphDir = optionOutput;
3439-
}
3440-
3441-
if (!SymbolGraphDir.empty()) {
3442-
Output->setAdditionalOutputForType(file_types::TY_SymbolGraphOutputPath, SymbolGraphDir);
3443-
}
3444-
}
3445-
34463417
void Driver::chooseObjectiveCHeaderOutputPath(Compilation &C,
34473418
const TypeToPathMap *OutputMap,
34483419
StringRef workingDirectory,

lib/Driver/ToolChains.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,11 @@ ToolChain::constructInvocation(const CompileJobAction &job,
578578
options::
579579
OPT_disable_autolinking_runtime_compatibility_dynamic_replacements);
580580

581+
if (context.OI.CompilerMode == OutputInfo::Mode::SingleCompile) {
582+
context.Args.AddLastArg(Arguments, options::OPT_emit_symbol_graph);
583+
context.Args.AddLastArg(Arguments, options::OPT_emit_symbol_graph_dir);
584+
}
585+
581586
return II;
582587
}
583588

@@ -655,7 +660,6 @@ const char *ToolChain::JobContext::computeFrontendModeForCompile() const {
655660
case file_types::TY_SwiftCrossImportDir:
656661
case file_types::TY_SwiftOverlayFile:
657662
case file_types::TY_IndexUnitOutputPath:
658-
case file_types::TY_SymbolGraphOutputPath:
659663
llvm_unreachable("Output type can never be primary output.");
660664
case file_types::TY_INVALID:
661665
llvm_unreachable("Invalid type ID");
@@ -797,8 +801,6 @@ void ToolChain::JobContext::addFrontendSupplementaryOutputArguments(
797801
addOutputsOfType(arguments, Output, Args,
798802
file_types::TY_SwiftModuleSummaryFile,
799803
"-emit-module-summary-path");
800-
addOutputsOfType(arguments, Output, Args, file_types::TY_SymbolGraphOutputPath,
801-
"-emit-symbol-graph-dir");
802804
}
803805

804806
ToolChain::InvocationInfo
@@ -916,7 +918,6 @@ ToolChain::constructInvocation(const BackendJobAction &job,
916918
case file_types::TY_SwiftCrossImportDir:
917919
case file_types::TY_SwiftOverlayFile:
918920
case file_types::TY_IndexUnitOutputPath:
919-
case file_types::TY_SymbolGraphOutputPath:
920921
llvm_unreachable("Output type can never be primary output.");
921922
case file_types::TY_INVALID:
922923
llvm_unreachable("Invalid type ID");

lib/Frontend/ArgsToFrontendOutputsConverter.cpp

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -341,14 +341,11 @@ SupplementaryOutputPathsComputer::getSupplementaryOutputPathsFromArguments()
341341
options::OPT_emit_ldadd_cfile_path);
342342
auto moduleSummaryOutput = getSupplementaryFilenamesFromArguments(
343343
options::OPT_emit_module_summary_path);
344-
auto symbolGraphOutput = getSupplementaryFilenamesFromArguments(
345-
options::OPT_emit_symbol_graph_dir);
346344
if (!objCHeaderOutput || !moduleOutput || !moduleDocOutput ||
347345
!dependenciesFile || !referenceDependenciesFile ||
348346
!serializedDiagnostics || !fixItsOutput || !loadedModuleTrace || !TBD ||
349347
!moduleInterfaceOutput || !privateModuleInterfaceOutput ||
350-
!moduleSourceInfoOutput || !ldAddCFileOutput || !moduleSummaryOutput ||
351-
!symbolGraphOutput) {
348+
!moduleSourceInfoOutput || !ldAddCFileOutput || !moduleSummaryOutput) {
352349
return None;
353350
}
354351
std::vector<SupplementaryOutputPaths> result;
@@ -371,7 +368,6 @@ SupplementaryOutputPathsComputer::getSupplementaryOutputPathsFromArguments()
371368
sop.ModuleSourceInfoOutputPath = (*moduleSourceInfoOutput)[i];
372369
sop.LdAddCFilePath = (*ldAddCFileOutput)[i];
373370
sop.ModuleSummaryOutputPath = (*moduleSummaryOutput)[i];
374-
sop.SymbolGraphOutputDir = (*symbolGraphOutput)[i];
375371
result.push_back(sop);
376372
}
377373
return result;
@@ -463,11 +459,6 @@ SupplementaryOutputPathsComputer::computeOutputPathsForOneInput(
463459
OPT_emit_module_summary, pathsFromArguments.ModuleSummaryOutputPath,
464460
file_types::TY_SwiftModuleSummaryFile, "",
465461
defaultSupplementaryOutputPathExcludingExtension);
466-
467-
auto symbolGraphOutputDir = determineSupplementaryOutputFilename(
468-
OPT_emit_symbol_graph_dir, pathsFromArguments.SymbolGraphOutputDir,
469-
file_types::TY_SymbolGraphOutputPath, "",
470-
defaultSupplementaryOutputPathExcludingExtension);
471462

472463
// There is no non-path form of -emit-interface-path
473464
auto ModuleInterfaceOutputPath =
@@ -501,7 +492,6 @@ SupplementaryOutputPathsComputer::computeOutputPathsForOneInput(
501492
sop.ModuleSourceInfoOutputPath = moduleSourceInfoOutputPath;
502493
sop.LdAddCFilePath = pathsFromArguments.LdAddCFilePath;
503494
sop.ModuleSummaryOutputPath = moduleSummaryOutputPath;
504-
sop.SymbolGraphOutputDir = symbolGraphOutputDir;
505495
return sop;
506496
}
507497

@@ -584,7 +574,6 @@ createFromTypeToPathMap(const TypeToPathMap *map) {
584574
{file_types::TY_SwiftModuleSummaryFile, paths.ModuleSummaryOutputPath},
585575
{file_types::TY_PrivateSwiftModuleInterfaceFile,
586576
paths.PrivateModuleInterfaceOutputPath},
587-
{file_types::TY_SymbolGraphOutputPath, paths.SymbolGraphOutputDir},
588577
};
589578
for (const std::pair<file_types::ID, std::string &> &typeAndString :
590579
typesAndStrings) {
@@ -608,8 +597,7 @@ SupplementaryOutputPathsComputer::readSupplementaryOutputFileMap() const {
608597
options::OPT_emit_private_module_interface_path,
609598
options::OPT_emit_module_source_info_path,
610599
options::OPT_emit_tbd_path,
611-
options::OPT_emit_ldadd_cfile_path,
612-
options::OPT_emit_symbol_graph_dir)) {
600+
options::OPT_emit_ldadd_cfile_path)) {
613601
Diags.diagnose(SourceLoc(),
614602
diag::error_cannot_have_supplementary_outputs,
615603
A->getSpelling(), "-supplementary-output-file-map");

lib/Frontend/Frontend.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,7 @@ SerializationOptions CompilerInvocation::computeSerializationOptions(
156156
serializationOpts.ModuleLinkName = opts.ModuleLinkName;
157157
serializationOpts.ExtraClangOptions = getClangImporterOptions().ExtraArgs;
158158

159-
if (!outs.SymbolGraphOutputDir.empty()) {
160-
serializationOpts.SymbolGraphOutputDir = outs.SymbolGraphOutputDir;
161-
} else if (opts.EmitSymbolGraph) {
159+
if (opts.EmitSymbolGraph) {
162160
if (!opts.SymbolGraphOutputDir.empty()) {
163161
serializationOpts.SymbolGraphOutputDir = opts.SymbolGraphOutputDir;
164162
} else {

test/Driver/filelists.swift

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,6 @@
3535
// CHECK-WMO-NOT: Handled
3636

3737

38-
// RUN: %swiftc_driver -save-temps -driver-print-jobs -c %S/Inputs/lib.swift -module-name lib -target x86_64-apple-macosx10.9 -driver-filelist-threshold=0 -whole-module-optimization -emit-module -emit-symbol-graph -emit-symbol-graph-dir %t 2>&1 | tee %t/forWMOFilelistCapture | %FileCheck -check-prefix=CHECK-WMO-SYM-FILELIST %s
39-
// RUN: grep -e ' -supplementary-output-file-map ' %t/forWMOFilelistCapture | tail -1 | sed 's/.*-supplementary-output-file-map //' | sed 's/ .*//' > %t/supplementary-output
40-
// RUN: cat $(cat %t/supplementary-output) | %FileCheck -check-prefix CHECK-WMO-SYM-SUPP %s
41-
42-
// CHECK-WMO-SYM-FILELIST: swift
43-
// CHECK-WMO-SYM-FILELIST-DAG: -supplementary-output-file-map
44-
45-
// CHECK-WMO-SYM-SUPP: symbol-graph-output-path
46-
47-
4838
// RUN: %empty-directory(%t/bin)
4939
// RUN: ln -s %S/Inputs/filelists/fake-ld.py %t/bin/ld
5040

@@ -87,8 +77,8 @@
8777
// RUN: echo "int dummy;" >%t/a.cpp
8878
// RUN: %target-clang -c %t/a.cpp -o %t/a.o
8979
// RUN: %swiftc_driver -save-temps -driver-print-jobs %S/../Inputs/empty.swift %t/a.o -lto=llvm-full -target x86_64-apple-macosx10.9 -driver-filelist-threshold=0 -o filelist 2>&1 | tee %t/forFilelistCapture | %FileCheck -check-prefix FILELIST %s
90-
// RUN: grep -e ' -output-filelist ' %t/forFilelistCapture | tail -1 | sed 's/.*-output-filelist //' | sed 's/ .*//' > %t/output-filelist
91-
// RUN: grep -e ' -filelist ' %t/forFilelistCapture | tail -1 | sed 's/.*-filelist //' | sed 's/ .*//' > %t/input-filelist
80+
// RUN: tail -2 %t/forFilelistCapture | head -1 | sed 's/.*-output-filelist //' | sed 's/ .*//' > %t/output-filelist
81+
// RUN: tail -1 %t/forFilelistCapture | sed 's/.*-filelist //' | sed 's/ .*//' > %t/input-filelist
9282
// RUN: cat $(cat %t/output-filelist) | %FileCheck -check-prefix OUTPUT-FILELIST-CONTENTS %s
9383
// RUN: cat $(cat %t/input-filelist) | %FileCheck -check-prefix INPUT-FILELIST-CONTENTS %s
9484

test/SymbolGraph/Inputs/EmitWhileBuilding.output.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
},
55
"EmitWhileBuilding.swift": {
66
"object": "./EmitWhileBuilding.o",
7-
"swiftmodule": "./EmitWhileBuilding.swiftmodule",
7+
"swiftmodule": "./EmitWhileBuilding_partial.swiftmodule",
88
"dependencies": "./EmitWhileBuilding.d",
99
"swift-dependencies": "./EmitWhileBuilding.swiftdeps"
1010
}

0 commit comments

Comments
 (0)