|
36 | 36 |
|
37 | 37 | using namespace swift;
|
38 | 38 |
|
39 |
| -version::Version swift::InterfaceFormatVersion({1, 0}); |
| 39 | +// MARK: Module interface header comments |
40 | 40 |
|
41 |
| -/// Diagnose any scoped imports in \p imports, i.e. those with a non-empty |
42 |
| -/// access path. These are not yet supported by module interfaces, since the |
43 |
| -/// information about the declaration kind is not preserved through the binary |
44 |
| -/// serialization that happens as an intermediate step in non-whole-module |
45 |
| -/// builds. |
46 |
| -/// |
47 |
| -/// These come from declarations like `import class FooKit.MainFooController`. |
48 |
| -static void diagnoseScopedImports(DiagnosticEngine &diags, |
49 |
| - ArrayRef<ImportedModule> imports){ |
50 |
| - for (const ImportedModule &importPair : imports) { |
51 |
| - if (importPair.accessPath.empty()) |
52 |
| - continue; |
53 |
| - diags.diagnose(importPair.accessPath.front().Loc, |
54 |
| - diag::module_interface_scoped_import_unsupported); |
55 |
| - } |
56 |
| -} |
| 41 | +version::Version swift::InterfaceFormatVersion({1, 0}); |
57 | 42 |
|
58 | 43 | /// Prints to \p out a comment containing a format version number, tool version
|
59 | 44 | /// string as well as any relevant command-line flags in \p Opts used to
|
@@ -93,6 +78,25 @@ llvm::Regex swift::getSwiftInterfaceCompilerVersionRegex() {
|
93 | 78 | ": (.+)$", llvm::Regex::Newline);
|
94 | 79 | }
|
95 | 80 |
|
| 81 | +// MARK: Import statements |
| 82 | + |
| 83 | +/// Diagnose any scoped imports in \p imports, i.e. those with a non-empty |
| 84 | +/// access path. These are not yet supported by module interfaces, since the |
| 85 | +/// information about the declaration kind is not preserved through the binary |
| 86 | +/// serialization that happens as an intermediate step in non-whole-module |
| 87 | +/// builds. |
| 88 | +/// |
| 89 | +/// These come from declarations like `import class FooKit.MainFooController`. |
| 90 | +static void diagnoseScopedImports(DiagnosticEngine &diags, |
| 91 | + ArrayRef<ImportedModule> imports){ |
| 92 | + for (const ImportedModule &importPair : imports) { |
| 93 | + if (importPair.accessPath.empty()) |
| 94 | + continue; |
| 95 | + diags.diagnose(importPair.accessPath.front().Loc, |
| 96 | + diag::module_interface_scoped_import_unsupported); |
| 97 | + } |
| 98 | +} |
| 99 | + |
96 | 100 | /// Prints the imported modules in \p M to \p out in the form of \c import
|
97 | 101 | /// source declarations.
|
98 | 102 | static void printImports(raw_ostream &out,
|
@@ -174,6 +178,8 @@ static void printImports(raw_ostream &out,
|
174 | 178 | }
|
175 | 179 | }
|
176 | 180 |
|
| 181 | +// MARK: Dummy protocol conformances |
| 182 | + |
177 | 183 | // FIXME: Copied from ASTPrinter.cpp...
|
178 | 184 | static bool isPublicOrUsableFromInline(const ValueDecl *VD) {
|
179 | 185 | AccessScope scope =
|
@@ -561,6 +567,8 @@ const StringLiteral InheritedProtocolCollector::DummyProtocolName =
|
561 | 567 | "_ConstraintThatIsNotPartOfTheAPIOfThisLibrary";
|
562 | 568 | } // end anonymous namespace
|
563 | 569 |
|
| 570 | +// MARK: Interface emission |
| 571 | + |
564 | 572 | bool swift::emitSwiftInterface(raw_ostream &out,
|
565 | 573 | ModuleInterfaceOptions const &Opts,
|
566 | 574 | ModuleDecl *M) {
|
|
0 commit comments