[Sema] Report public imports of private modules

Intro the concept of library access or distribution level to identify
layers of libraries and report public imports of private libraries from
public ones.

rdar://62934005
This commit is contained in:
Alexis Laferrière
2021-03-12 09:32:03 -08:00
parent 58f03e8490
commit cf58bb7eb4
19 changed files with 207 additions and 0 deletions

View File

@@ -55,6 +55,20 @@ namespace swift {
Complete,
};
/// Access or distribution level of a library.
enum class LibraryLevel : uint8_t {
/// Application Programming Interface that is publicly distributed so
/// public decls are really public and only @_spi decls are SPI.
API,
/// System Programming Interface that has restricted distribution
/// all decls in the module are considered to be SPI including public ones.
SPI,
/// The library has some other undefined distribution.
Other
};
/// A collection of options that affect the language dialect and
/// provide compiler debugging facilities.
class LangOptions final {
@@ -306,6 +320,9 @@ namespace swift {
/// Objective-C-derived classes and 'dynamic' members.
bool EnableSwift3ObjCInference = false;
/// Access or distribution level of the whole module being parsed.
LibraryLevel LibraryLevel = LibraryLevel::Other;
/// Warn about cases where Swift 3 would infer @objc but later versions
/// of Swift do not.
Swift3ObjCInferenceWarnings WarnSwift3ObjCInference =