Skip to content

Commit 8aa5cae

Browse files
author
Harlan Haskins
authored
Merge pull request #27175 from harlanhaskins/mods-are-asleep-post-cleanups
NFC: Excise ParseableInterface from code
2 parents 83e7763 + d3b8ce7 commit 8aa5cae

File tree

222 files changed

+880
-809
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

222 files changed

+880
-809
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ set(SWIFT_NATIVE_CLANG_TOOLS_PATH "" CACHE STRING
219219
set(SWIFT_NATIVE_SWIFT_TOOLS_PATH "" CACHE STRING
220220
"Path to the directory that contains Swift tools that are executable on the build machine")
221221

222-
option(SWIFT_ENABLE_PARSEABLE_MODULE_INTERFACES
222+
option(SWIFT_ENABLE_MODULE_INTERFACES
223223
"Generate .swiftinterface files alongside .swiftmodule files"
224224
TRUE)
225225

cmake/modules/StandaloneOverlay.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ set(SWIFT_NATIVE_CLANG_TOOLS_PATH "${TOOLCHAIN_DIR}/usr/bin" CACHE STRING
5858
set(SWIFT_NATIVE_SWIFT_TOOLS_PATH "${TOOLCHAIN_DIR}/usr/bin" CACHE STRING
5959
"Path to Swift tools that are executable on the build machine.")
6060

61-
option(SWIFT_ENABLE_PARSEABLE_MODULE_INTERFACES
61+
option(SWIFT_ENABLE_MODULE_INTERFACES
6262
"Generate .swiftinterface files alongside .swiftmodule files."
6363
TRUE)
6464

cmake/modules/SwiftSource.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,10 +323,10 @@ function(_compile_swift_files
323323
set(sibopt_file "${module_base}.O.sib")
324324
set(sibgen_file "${module_base}.sibgen")
325325

326-
if(SWIFT_ENABLE_PARSEABLE_MODULE_INTERFACES)
326+
if(SWIFT_ENABLE_MODULE_INTERFACES)
327327
set(interface_file "${module_base}.swiftinterface")
328328
list(APPEND swift_module_flags
329-
"-emit-parseable-module-interface-path" "${interface_file}")
329+
"-emit-module-interface-path" "${interface_file}")
330330
endif()
331331

332332
# If we have extra regexp flags, check if we match any of the regexps. If so

include/swift/AST/PrintOptions.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -490,14 +490,17 @@ struct PrintOptions {
490490
return result;
491491
}
492492

493-
/// Retrieve the set of options suitable for parseable module interfaces.
493+
/// Retrieve the set of options suitable for module interfaces.
494494
///
495495
/// This is a format that will be parsed again later, so the output must be
496496
/// consistent and well-formed.
497497
///
498-
/// \see swift::emitParseableInterface
499-
static PrintOptions printParseableInterfaceFile(bool preferTypeRepr);
498+
/// \see swift::emitSwiftInterface
499+
static PrintOptions printSwiftInterfaceFile(bool preferTypeRepr);
500500

501+
/// Retrieve the set of options suitable for "Generated Interfaces", which
502+
/// are a prettified representation of the public API of a module, to be
503+
/// displayed to users in an editor.
501504
static PrintOptions printModuleInterface();
502505
static PrintOptions printTypeInterface(Type T);
503506

include/swift/Basic/FileTypes.def

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ TYPE("dependencies", Dependencies, "d", "")
4949
TYPE("autolink", AutolinkFile, "autolink", "")
5050
TYPE("swiftmodule", SwiftModuleFile, "swiftmodule", "")
5151
TYPE("swiftdoc", SwiftModuleDocFile, "swiftdoc", "")
52-
TYPE("swiftinterface", SwiftParseableInterfaceFile, \
53-
"swiftinterface", "")
52+
TYPE("swiftinterface", SwiftModuleInterfaceFile, "swiftinterface", "")
5453
TYPE("assembly", Assembly, "s", "")
5554
TYPE("raw-sil", RawSIL, "sil", "")
5655
TYPE("raw-sib", RawSIB, "sib", "")

include/swift/Basic/SupplementaryOutputPaths.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,16 +113,16 @@ struct SupplementaryOutputPaths {
113113
/// \sa swift::writeTBDFile
114114
std::string TBDPath;
115115

116-
/// The path to which we should emit a parseable module interface, which can
116+
/// The path to which we should emit a module interface, which can
117117
/// be used by a client source file to import this module.
118118
///
119119
/// This format is similar to the binary format used for #ModuleOutputPath,
120120
/// but is intended to be stable across compiler versions.
121121
///
122122
/// Currently only makes sense when the compiler has whole-module knowledge.
123123
///
124-
/// \sa swift::emitParseableInterface
125-
std::string ParseableInterfaceOutputPath;
124+
/// \sa swift::emitSwiftInterface
125+
std::string ModuleInterfaceOutputPath;
126126

127127
SupplementaryOutputPaths() = default;
128128
SupplementaryOutputPaths(const SupplementaryOutputPaths &) = default;
@@ -132,7 +132,7 @@ struct SupplementaryOutputPaths {
132132
ModuleDocOutputPath.empty() && DependenciesFilePath.empty() &&
133133
ReferenceDependenciesFilePath.empty() &&
134134
SerializedDiagnosticsPath.empty() && LoadedModuleTracePath.empty() &&
135-
TBDPath.empty() && ParseableInterfaceOutputPath.empty();
135+
TBDPath.empty() && ModuleInterfaceOutputPath.empty();
136136
}
137137
};
138138
} // namespace swift

include/swift/Driver/Driver.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -354,10 +354,10 @@ class Driver {
354354
StringRef workingDirectory,
355355
CommandOutput *Output) const;
356356

357-
void chooseParseableInterfacePath(Compilation &C, const JobAction *JA,
358-
StringRef workingDirectory,
359-
llvm::SmallString<128> &buffer,
360-
CommandOutput *output) const;
357+
void chooseModuleInterfacePath(Compilation &C, const JobAction *JA,
358+
StringRef workingDirectory,
359+
llvm::SmallString<128> &buffer,
360+
CommandOutput *output) const;
361361

362362
void chooseRemappingOutputPath(Compilation &C, const TypeToPathMap *OutputMap,
363363
CommandOutput *Output) const;

include/swift/Frontend/Frontend.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#include "swift/ClangImporter/ClangImporter.h"
3232
#include "swift/ClangImporter/ClangImporterOptions.h"
3333
#include "swift/Frontend/FrontendOptions.h"
34-
#include "swift/Frontend/ParseableInterfaceSupport.h"
34+
#include "swift/Frontend/ModuleInterfaceSupport.h"
3535
#include "swift/Migrator/MigratorOptions.h"
3636
#include "swift/Parse/CodeCompletionCallbacks.h"
3737
#include "swift/Parse/Parser.h"
@@ -78,7 +78,7 @@ class CompilerInvocation {
7878
SILOptions SILOpts;
7979
IRGenOptions IRGenOpts;
8080
TBDGenOptions TBDGenOpts;
81-
ParseableInterfaceOptions ParseableInterfaceOpts;
81+
ModuleInterfaceOptions ModuleInterfaceOpts;
8282
/// The \c SyntaxParsingCache to use when parsing the main file of this
8383
/// invocation
8484
SyntaxParsingCache *MainFileSyntaxParsingCache = nullptr;
@@ -208,8 +208,8 @@ class CompilerInvocation {
208208
TBDGenOptions &getTBDGenOptions() { return TBDGenOpts; }
209209
const TBDGenOptions &getTBDGenOptions() const { return TBDGenOpts; }
210210

211-
ParseableInterfaceOptions &getParseableInterfaceOptions() { return ParseableInterfaceOpts; }
212-
const ParseableInterfaceOptions &getParseableInterfaceOptions() const { return ParseableInterfaceOpts; }
211+
ModuleInterfaceOptions &getModuleInterfaceOptions() { return ModuleInterfaceOpts; }
212+
const ModuleInterfaceOptions &getModuleInterfaceOptions() const { return ModuleInterfaceOpts; }
213213

214214
ClangImporterOptions &getClangImporterOptions() { return ClangImporterOpts; }
215215
const ClangImporterOptions &getClangImporterOptions() const {
@@ -353,10 +353,10 @@ class CompilerInvocation {
353353
/// if not in that mode.
354354
std::string getTBDPathForWholeModule() const;
355355

356-
/// ParseableInterfaceOutputPath only makes sense in whole module compilation
357-
/// mode, so return the ParseableInterfaceOutputPath when in that mode and
356+
/// ModuleInterfaceOutputPath only makes sense in whole module compilation
357+
/// mode, so return the ModuleInterfaceOutputPath when in that mode and
358358
/// fail an assert if not in that mode.
359-
std::string getParseableInterfaceOutputPathForWholeModule() const;
359+
std::string getModuleInterfaceOutputPathForWholeModule() const;
360360

361361
SerializationOptions
362362
computeSerializationOptions(const SupplementaryOutputPaths &outs,

include/swift/Frontend/FrontendInputsAndOutputs.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ class FrontendInputsAndOutputs {
173173

174174
private:
175175
friend class ArgsToFrontendOptionsConverter;
176-
friend class ParseableInterfaceBuilder;
176+
friend class ModuleInterfaceBuilder;
177177
void setMainAndSupplementaryOutputs(
178178
ArrayRef<std::string> outputFiles,
179179
ArrayRef<SupplementaryOutputPaths> supplementaryOutputs);
@@ -235,7 +235,7 @@ class FrontendInputsAndOutputs {
235235
bool hasLoadedModuleTracePath() const;
236236
bool hasModuleOutputPath() const;
237237
bool hasModuleDocOutputPath() const;
238-
bool hasParseableInterfaceOutputPath() const;
238+
bool hasModuleInterfaceOutputPath() const;
239239
bool hasTBDPath() const;
240240

241241
bool hasDependencyTrackerPath() const;

include/swift/Frontend/FrontendOptions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class FrontendOptions {
7272
/// The path to which we should store indexing data, if any.
7373
std::string IndexStorePath;
7474

75-
/// The path to look in when loading a parseable interface file, to see if a
75+
/// The path to look in when loading a module interface file, to see if a
7676
/// binary module has already been built for use by the compiler.
7777
std::string PrebuiltModuleCachePath;
7878

include/swift/Frontend/ParseableInterfaceModuleLoader.h renamed to include/swift/Frontend/ModuleInterfaceLoader.h

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===--- ParseableInterfaceModuleLoader.h - Loads .swiftinterface files ---===//
1+
//===-------- ModuleInterfaceLoader.h - Loads .swiftinterface files -------===//
22
//
33
// This source file is part of the Swift.org open source project
44
//
@@ -10,10 +10,10 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212
///
13-
/// \file This implements the logic for loading and building parseable module
13+
/// \file This implements the logic for loading and building module
1414
/// interfaces.
1515
///
16-
/// === Loading Parseable Modules ===
16+
/// === Loading Module Interfaces ===
1717
///
1818
/// If there is a .swiftinterface file corresponding to a given module name
1919
/// present in the frontend's search paths, then this module loader will look in
@@ -79,18 +79,19 @@
7979
/// installed 2 forwarding modules. For the other 2 frameworks, we'll have
8080
/// compiled the interfaces and put them in the module cache.
8181
///
82-
/// ┌─────┐
83-
/// ┌─────────────────────────────┤ SDK ├─────────────────────────┐
84-
/// │ ┌────────────────┐ └─────┘ ┌────────────────┐ │
85-
/// │ ┌───────┤ Framework Dirs ├────────┐ ┌┤ Prebuilt Cache ├┐ │
86-
/// │ │ └────────────────┘ │ │└────────────────┘│ │
87-
/// │ │ ┌───┐ ┌───┐ ┌───┐ ┌───┐ │ │ ┌───┐ ┌───┐ │ │
88-
/// │ │ │ I │ │ I │ │ I │ │ I │◀─┼───┼───│ P │ │ P │◀═╗│ │
89-
/// │ │ └───┘ └───┘ └───┘ └───┘ │ │ └───┘ └───┘ ║│ │
90-
/// │ │ ▲ ▲ ▲ │ │ ▲ │ ║│ │
91-
/// │ └────┼───────┼───────┼────────────┘ └─────╫──────┼────╫┘ │
92-
/// │ │ │ └──────────────────────╫──────┘ ║ │
93-
/// └───────┼───────┼──────────────────────────────╫───────────╫──┘
82+
/// ┌─────┐
83+
/// ┌────────────────┤ SDK ├───────────────┐
84+
/// │ └─────┘ │
85+
/// │ ┌────────────────┐ │ ┌────────────────┐
86+
/// │ ┌───────┤ Framework Dirs ├────────┐ │ ┌┤ Prebuilt Cache ├┐
87+
/// │ │ └────────────────┘ │ │ │└────────────────┘│
88+
/// │ │ ┌───┐ ┌───┐ ┌───┐ ┌───┐ │ │ │ ┌───┐ ┌───┐ │
89+
/// │ │ │ I │ │ I │ │ I │ │ I │◀─┼─┼─┼───│ P │ │ P │◀═╗│
90+
/// │ │ └───┘ └───┘ └───┘ └───┘ │ │ │ └───┘ └───┘ ║│
91+
/// │ │ ▲ ▲ ▲ │ │ │ ▲ │ ║│
92+
/// │ └────┼───────┼───────┼────────────┘ │ └─────╫──────┼────╫┘
93+
/// │ │ │ └──────────────┼───────╫──────┘ ║
94+
/// └───────┼───────┼──────────────────────┘ ║ ║
9495
/// │ │ ┌───────────────┐ ║ ║
9596
/// │ ┌────┼───┤ Module Cache ├────────┐ ║ ║
9697
/// │ │ │ └───────────────┘ │ ║ ║
@@ -103,19 +104,19 @@
103104
///
104105
//===----------------------------------------------------------------------===//
105106

106-
#ifndef SWIFT_FRONTEND_PARSEABLEINTERFACEMODULELOADER_H
107-
#define SWIFT_FRONTEND_PARSEABLEINTERFACEMODULELOADER_H
107+
#ifndef SWIFT_FRONTEND_MODULEINTERFACELOADER_H
108+
#define SWIFT_FRONTEND_MODULEINTERFACELOADER_H
108109

109110
#include "swift/Basic/LLVM.h"
110-
#include "swift/Frontend/ParseableInterfaceSupport.h"
111+
#include "swift/Frontend/ModuleInterfaceSupport.h"
111112
#include "swift/Serialization/SerializedModuleLoader.h"
112113

113114
namespace clang {
114115
class CompilerInstance;
115116
}
116117

117118
namespace unittest {
118-
class ParseableInterfaceModuleLoaderTest;
119+
class ModuleInterfaceLoaderTest;
119120
}
120121

121122
namespace swift {
@@ -127,9 +128,9 @@ class SearchPathOptions;
127128
/// \c CompilerInstance to convert .swiftinterface files to .swiftmodule
128129
/// files on the fly, caching the resulting .swiftmodules in the module cache
129130
/// directory, and loading the serialized .swiftmodules from there.
130-
class ParseableInterfaceModuleLoader : public SerializedModuleLoaderBase {
131-
friend class unittest::ParseableInterfaceModuleLoaderTest;
132-
explicit ParseableInterfaceModuleLoader(
131+
class ModuleInterfaceLoader : public SerializedModuleLoaderBase {
132+
friend class unittest::ModuleInterfaceLoaderTest;
133+
explicit ModuleInterfaceLoader(
133134
ASTContext &ctx, StringRef cacheDir, StringRef prebuiltCacheDir,
134135
DependencyTracker *tracker, ModuleLoadingMode loadMode,
135136
ArrayRef<std::string> PreferInterfaceForModules,
@@ -154,13 +155,13 @@ class ParseableInterfaceModuleLoader : public SerializedModuleLoaderBase {
154155
bool isCached(StringRef DepPath) override;
155156

156157
public:
157-
static std::unique_ptr<ParseableInterfaceModuleLoader>
158+
static std::unique_ptr<ModuleInterfaceLoader>
158159
create(ASTContext &ctx, StringRef cacheDir, StringRef prebuiltCacheDir,
159160
DependencyTracker *tracker, ModuleLoadingMode loadMode,
160161
ArrayRef<std::string> PreferInterfaceForModules = {},
161162
bool RemarkOnRebuildFromInterface = false) {
162-
return std::unique_ptr<ParseableInterfaceModuleLoader>(
163-
new ParseableInterfaceModuleLoader(ctx, cacheDir, prebuiltCacheDir,
163+
return std::unique_ptr<ModuleInterfaceLoader>(
164+
new ModuleInterfaceLoader(ctx, cacheDir, prebuiltCacheDir,
164165
tracker, loadMode,
165166
PreferInterfaceForModules,
166167
RemarkOnRebuildFromInterface));
@@ -186,7 +187,7 @@ class ParseableInterfaceModuleLoader : public SerializedModuleLoaderBase {
186187

187188
/// Extract the specified-or-defaulted -module-cache-path that winds up in
188189
/// the clang importer, for reuse as the .swiftmodule cache path when
189-
/// building a ParseableInterfaceModuleLoader.
190+
/// building a ModuleInterfaceLoader.
190191
std::string
191192
getModuleCachePathFromClang(const clang::CompilerInstance &Instance);
192193

include/swift/Frontend/ParseableInterfaceSupport.h renamed to include/swift/Frontend/ModuleInterfaceSupport.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===--- ParseableInterfaceSupport.h - swiftinterface files -----*- C++ -*-===//
1+
//===------ ModuleInterfaceSupport.h - swiftinterface files -----*- C++ -*-===//
22
//
33
// This source file is part of the Swift.org open source project
44
//
@@ -10,8 +10,8 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
#ifndef SWIFT_FRONTEND_PARSEABLEINTERFACESUPPORT_H
14-
#define SWIFT_FRONTEND_PARSEABLEINTERFACESUPPORT_H
13+
#ifndef SWIFT_FRONTEND_MODULEINTERFACESUPPORT_H
14+
#define SWIFT_FRONTEND_MODULEINTERFACESUPPORT_H
1515

1616
#include "swift/Basic/LLVM.h"
1717
#include "swift/Basic/Version.h"
@@ -26,23 +26,23 @@ namespace swift {
2626
class ModuleDecl;
2727

2828
/// Options for controlling the generation of the .swiftinterface output.
29-
struct ParseableInterfaceOptions {
29+
struct ModuleInterfaceOptions {
3030
/// Should we prefer printing TypeReprs when writing out types in a module
3131
/// interface, or should we fully-qualify them?
3232
bool PreserveTypesAsWritten = false;
3333

3434
/// Copy of all the command-line flags passed at .swiftinterface
3535
/// generation time, re-applied to CompilerInvocation when reading
3636
/// back .swiftinterface and reconstructing .swiftmodule.
37-
std::string ParseableInterfaceFlags;
37+
std::string Flags;
3838
};
3939

4040
extern version::Version InterfaceFormatVersion;
4141

4242
llvm::Regex getSwiftInterfaceFormatVersionRegex();
4343
llvm::Regex getSwiftInterfaceModuleFlagsRegex();
4444

45-
/// Emit a stable, parseable interface for \p M, which can be used by a client
45+
/// Emit a stable module interface for \p M, which can be used by a client
4646
/// source file to import this module, subject to options given by \p Opts.
4747
///
4848
/// Unlike a serialized module, the textual format generated by
@@ -55,9 +55,9 @@ llvm::Regex getSwiftInterfaceModuleFlagsRegex();
5555
/// \return true if an error occurred
5656
///
5757
/// \sa swift::serialize
58-
bool emitParseableInterface(raw_ostream &out,
59-
ParseableInterfaceOptions const &Opts,
60-
ModuleDecl *M);
58+
bool emitSwiftInterface(raw_ostream &out,
59+
ModuleInterfaceOptions const &Opts,
60+
ModuleDecl *M);
6161

6262
} // end namespace swift
6363

include/swift/Parse/Lexer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ class Lexer {
105105
Token NextToken;
106106

107107
/// The kind of source we're lexing. This either enables special behavior for
108-
/// parseable interfaces, or enables things like the 'sil' keyword if lexing
108+
/// module interfaces, or enables things like the 'sil' keyword if lexing
109109
/// a .sil file.
110110
const LexerMode LexMode;
111111

include/swift/Serialization/SerializationOptions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ namespace swift {
3333
StringRef GroupInfoPath;
3434
StringRef ImportedHeader;
3535
StringRef ModuleLinkName;
36-
StringRef ParseableInterface;
36+
StringRef ModuleInterface;
3737
ArrayRef<std::string> ExtraClangOptions;
3838

3939
/// Describes a single-file dependency for this module, along with the

include/swift/Serialization/SerializedModuleLoader.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,17 @@ namespace swift {
2121
class ModuleFile;
2222
class LazyResolver;
2323

24-
/// Spceifies how to load modules when both a parseable interface and serialized
24+
/// Spceifies how to load modules when both a module interface and serialized
2525
/// AST are present, or whether to disallow one format or the other altogether.
2626
enum class ModuleLoadingMode {
27-
PreferParseable,
27+
PreferInterface,
2828
PreferSerialized,
29-
OnlyParseable,
29+
OnlyInterface,
3030
OnlySerialized
3131
};
3232

3333
/// Common functionality shared between \c SerializedModuleLoader and
34-
/// \c ParseableInterfaceModuleLoader.
34+
/// \c ModuleInterfaceLoader.
3535
class SerializedModuleLoaderBase : public ModuleLoader {
3636
/// A { module, generation # } pair.
3737
using LoadedModulePair = std::pair<std::unique_ptr<ModuleFile>, unsigned>;

0 commit comments

Comments
 (0)