mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Dependency Scanning] Keep track of each imported module's access control
Adds an access control field for each imported module identified. When multiple imports of the same module are found, this keeps track of the most "open" access specifier.
This commit is contained in:
@@ -156,30 +156,35 @@ struct ScannerImportStatementInfo {
|
||||
uint32_t columnNumber;
|
||||
};
|
||||
|
||||
ScannerImportStatementInfo(std::string importIdentifier, bool isExported)
|
||||
: importLocations(), importIdentifier(importIdentifier),
|
||||
isExported(isExported) {}
|
||||
ScannerImportStatementInfo(std::string importIdentifier, bool isExported,
|
||||
AccessLevel accessLevel)
|
||||
: importIdentifier(importIdentifier), importLocations(),
|
||||
isExported(isExported), accessLevel(accessLevel) {}
|
||||
|
||||
ScannerImportStatementInfo(std::string importIdentifier, bool isExported,
|
||||
AccessLevel accessLevel,
|
||||
ImportDiagnosticLocationInfo location)
|
||||
: importLocations({location}), importIdentifier(importIdentifier),
|
||||
isExported(isExported) {}
|
||||
: importIdentifier(importIdentifier), importLocations({location}),
|
||||
isExported(isExported), accessLevel(accessLevel) {}
|
||||
|
||||
ScannerImportStatementInfo(std::string importIdentifier, bool isExported,
|
||||
AccessLevel accessLevel,
|
||||
SmallVector<ImportDiagnosticLocationInfo, 4> locations)
|
||||
: importLocations(locations), importIdentifier(importIdentifier),
|
||||
isExported(isExported) {}
|
||||
: importIdentifier(importIdentifier), importLocations(locations),
|
||||
isExported(isExported), accessLevel(accessLevel) {}
|
||||
|
||||
void addImportLocation(ImportDiagnosticLocationInfo location) {
|
||||
importLocations.push_back(location);
|
||||
}
|
||||
|
||||
/// Buffer, line & column number of the import statement
|
||||
SmallVector<ImportDiagnosticLocationInfo, 4> importLocations;
|
||||
/// Imported module string. e.g. "Foo.Bar" in 'import Foo.Bar'
|
||||
std::string importIdentifier;
|
||||
/// Buffer, line & column number of the import statement
|
||||
SmallVector<ImportDiagnosticLocationInfo, 4> importLocations;
|
||||
/// Is this an @_exported import
|
||||
bool isExported;
|
||||
/// Access level of this dependency
|
||||
AccessLevel accessLevel;
|
||||
};
|
||||
|
||||
/// Base class for the variant storage of ModuleDependencyInfo.
|
||||
@@ -942,6 +947,7 @@ public:
|
||||
/// Add a dependency on the given module, if it was not already in the set.
|
||||
void
|
||||
addOptionalModuleImport(StringRef module, bool isExported,
|
||||
AccessLevel accessLevel,
|
||||
llvm::StringSet<> *alreadyAddedModules = nullptr);
|
||||
|
||||
/// Add all of the module imports in the given source
|
||||
@@ -952,12 +958,14 @@ public:
|
||||
|
||||
/// Add a dependency on the given module, if it was not already in the set.
|
||||
void addModuleImport(ImportPath::Module module, bool isExported,
|
||||
AccessLevel accessLevel,
|
||||
llvm::StringSet<> *alreadyAddedModules = nullptr,
|
||||
const SourceManager *sourceManager = nullptr,
|
||||
SourceLoc sourceLocation = SourceLoc());
|
||||
|
||||
/// Add a dependency on the given module, if it was not already in the set.
|
||||
void addModuleImport(StringRef module, bool isExported,
|
||||
AccessLevel accessLevel,
|
||||
llvm::StringSet<> *alreadyAddedModules = nullptr,
|
||||
const SourceManager *sourceManager = nullptr,
|
||||
SourceLoc sourceLocation = SourceLoc());
|
||||
|
||||
Reference in New Issue
Block a user