Skip to content

Commit e3ccde3

Browse files
authored
Briefly describe all of the formats in SupplementaryOutputPaths.h. (#18187)
1 parent 0e3ed0a commit e3ccde3

File tree

1 file changed

+62
-4
lines changed

1 file changed

+62
-4
lines changed

include/swift/Basic/SupplementaryOutputPaths.h

Lines changed: 62 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,49 +21,107 @@
2121
namespace swift {
2222
struct SupplementaryOutputPaths {
2323
/// The path to which we should emit an Objective-C header for the module.
24+
///
2425
/// Currently only makes sense when the compiler has whole module knowledge.
2526
/// The modes for which it makes sense incuide both WMO and the "merge
2627
/// modules" job that happens after the normal compilation jobs. That's where
2728
/// the header is emitted in single-file mode, since it needs whole-module
2829
/// information.
29-
30+
///
31+
/// \sa swift::printAsObjC
3032
std::string ObjCHeaderOutputPath;
3133

3234
/// The path to which we should emit a serialized module.
3335
/// It is valid whenever there are any inputs.
36+
///
37+
/// This binary format is used to describe the interface of a module when
38+
/// imported by client source code. The swiftmodule format is described in
39+
/// docs/Serialization.rst.
40+
///
41+
/// \sa swift::serialize
3442
std::string ModuleOutputPath;
3543

3644
/// The path to which we should emit a module documentation file.
3745
/// It is valid whenever there are any inputs.
46+
///
47+
/// This binary format stores doc comments and other information about the
48+
/// declarations in a module.
49+
///
50+
/// \sa swift::serialize
3851
std::string ModuleDocOutputPath;
3952

4053
/// The path to which we should output a Make-style dependencies file.
4154
/// It is valid whenever there are any inputs.
55+
///
56+
/// Swift's compilation model means that Make-style dependencies aren't
57+
/// well-suited to model fine-grained dependencies. See docs/Driver.md for
58+
/// more information.
59+
///
60+
/// \sa ReferenceDependenciesFilePath
4261
std::string DependenciesFilePath;
4362

44-
/// The path to which we should output a Swift reference dependencies file.
63+
/// The path to which we should output a Swift "reference dependencies" file.
4564
/// It is valid whenever there are any inputs.
65+
///
66+
/// "Reference dependencies" track dependencies on a more fine-grained level
67+
/// than just "this file depends on that file". With Swift's "implicit
68+
/// visibility" within a module, that becomes very important for any sort of
69+
/// incremental build. These files are consumed by the Swift driver to decide
70+
/// whether a source file needs to be recompiled during a build. See
71+
/// docs/DependencyAnalysis.rst for more information.
72+
///
73+
/// \sa swift::emitReferenceDependencies
74+
/// \sa DependencyGraph
4675
std::string ReferenceDependenciesFilePath;
4776

4877
/// Path to a file which should contain serialized diagnostics for this
4978
/// frontend invocation.
79+
///
80+
/// This uses the same serialized diagnostics format as Clang, for tools that
81+
/// want machine-parseable diagnostics. There's a bit more information on
82+
/// how clients might use this in docs/Driver.md.
83+
///
84+
/// \sa swift::serialized_diagnostics::createConsumer
5085
std::string SerializedDiagnosticsPath;
5186

5287
/// The path to which we should output fix-its as source edits.
88+
///
89+
/// This is a JSON-based format that is used by the migrator, but is not
90+
/// really vetted for anything else.
91+
///
92+
/// \sa swift::writeEditsInJson
5393
std::string FixItsOutputPath;
5494

5595
/// The path to which we should output a loaded module trace file.
56-
/// It is currently only used with WMO, but could be generalized.
96+
/// It is valid whenever there are any inputs.
97+
///
98+
/// The file is appended to, and consists of line-delimited JSON objects,
99+
/// where each line is of the form `{ "name": NAME, "target": TARGET,
100+
/// "swiftmodules": [PATH, PATH, ...] }`, representing the (real-path) PATHs
101+
/// to each .swiftmodule that was loaded while building module NAME for target
102+
/// TARGET. This format is subject to arbitrary change, however.
57103
std::string LoadedModuleTracePath;
58104

59105
/// The path to which we should output a TBD file.
60-
/// It is currently only used with WMO, but could be generalized.
106+
///
107+
/// "TBD" stands for "text-based dylib". It's a YAML-based format that
108+
/// describes the public ABI of a library, which clients can link against
109+
/// without having an actual dynamic library binary.
110+
///
111+
/// Only makes sense when the compiler has whole-module knowledge.
112+
///
113+
/// \sa swift::writeTBDFile
61114
std::string TBDPath;
62115

63116
/// The path to which we should emit a textual module interface, which can be
64117
/// used by a client source file to import this module.
65118
///
119+
/// This format is similar to the binary format used for #ModuleOutputPath,
120+
/// but is intended to be stable across compiler versions.
121+
///
66122
/// Currently only makes sense when the compiler has whole-module knowledge.
123+
///
124+
/// \sa ModuleOutputPath
67125
std::string ModuleInterfaceOutputPath;
68126

69127
SupplementaryOutputPaths() = default;

0 commit comments

Comments
 (0)