[SPI] Serialize SPI attributes on imports

This commit is contained in:
Alexis Laferrière
2020-02-06 12:28:21 -08:00
parent 501f458879
commit 6a5a858408
4 changed files with 68 additions and 12 deletions

View File

@@ -106,6 +106,8 @@ public:
public:
ModuleDecl::ImportedModule Import = {};
const StringRef RawPath;
const StringRef RawSPIs;
SmallVector<Identifier, 4> spis;
private:
using ImportFilterKind = ModuleDecl::ImportFilterKind;
@@ -120,9 +122,9 @@ public:
return static_cast<ImportFilterKind>(1 << RawImportControl);
}
Dependency(StringRef path, bool isHeader, ImportFilterKind importControl,
Dependency(StringRef path, StringRef spis, bool isHeader, ImportFilterKind importControl,
bool isScoped)
: RawPath(path), RawImportControl(rawControlFromKind(importControl)),
: RawPath(path), RawSPIs(spis), RawImportControl(rawControlFromKind(importControl)),
IsHeader(isHeader), IsScoped(isScoped) {
assert(llvm::countPopulation(static_cast<unsigned>(importControl)) == 1 &&
"must be a particular filter option, not a bitset");
@@ -130,13 +132,13 @@ public:
}
public:
Dependency(StringRef path, ImportFilterKind importControl, bool isScoped)
: Dependency(path, false, importControl, isScoped) {}
Dependency(StringRef path, StringRef spis, ImportFilterKind importControl, bool isScoped)
: Dependency(path, spis, false, importControl, isScoped) {}
static Dependency forHeader(StringRef headerPath, bool exported) {
auto importControl = exported ? ImportFilterKind::Public
: ImportFilterKind::Private;
return Dependency(headerPath, true, importControl, false);
return Dependency(headerPath, StringRef(), true, importControl, false);
}
bool isLoaded() const {