Skip to content

Commit

Permalink
Rename various IncludeUsableFromInlineAndInlineable to IncludeUsableF…
Browse files Browse the repository at this point in the history
…romInline

`@inlinable` implies `@usableFromInline`.

NFC intended.
  • Loading branch information
aschwaighofer committed Oct 14, 2020
1 parent db8402f commit 96a0d0e
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion include/swift/AST/Decl.h
Expand Up @@ -2188,7 +2188,7 @@ class ValueDecl : public Decl {
/// the default implementations are not visible to name lookup.
bool isAccessibleFrom(const DeclContext *DC,
bool forConformance = false,
bool includeInlineable = false) const;
bool allowUsableFromInline = false) const;

/// Returns whether this declaration should be treated as \c open from
/// \p useDC. This is very similar to #getFormalAccess, but takes
Expand Down
2 changes: 1 addition & 1 deletion include/swift/AST/LookupKinds.h
Expand Up @@ -51,7 +51,7 @@ enum NLOptions : unsigned {
NL_IncludeAttributeImplements = 1 << 5,

// Include @usableFromInline and @inlinable
NL_IncludeUsableFromInlineAndInlineable = 1 << 6,
NL_IncludeUsableFromInline = 1 << 6,

/// The default set of options used for qualified name lookup.
///
Expand Down
2 changes: 1 addition & 1 deletion include/swift/AST/ModuleNameLookup.h
Expand Up @@ -57,7 +57,7 @@ void simple_display(llvm::raw_ostream &out, ResolutionKind kind);
/// being performed, for checking access. This must be either a
/// FileUnit or a Module.
/// \param options name lookup options. Currently only used to communicate the
/// NL_IncludeUsableFromInlineAndInlineable option.
/// NL_IncludeUsableFromInline option.
void lookupInModule(const DeclContext *moduleOrFile,
DeclName name, SmallVectorImpl<ValueDecl *> &decls,
NLKind lookupKind, ResolutionKind resolutionKind,
Expand Down
2 changes: 1 addition & 1 deletion include/swift/AST/NameLookup.h
Expand Up @@ -227,7 +227,7 @@ enum class UnqualifiedLookupFlags {
IncludeOuterResults = 1 << 4,
// This lookup should include results that are @inlinable or
// @usableFromInline.
IncludeInlineableAndUsableFromInline = 1 << 5,
IncludeUsableFromInline = 1 << 5,
};

using UnqualifiedLookupOptions = OptionSet<UnqualifiedLookupFlags>;
Expand Down
4 changes: 2 additions & 2 deletions lib/AST/Decl.cpp
Expand Up @@ -3394,8 +3394,8 @@ static bool checkAccess(const DeclContext *useDC, const ValueDecl *VD,

bool ValueDecl::isAccessibleFrom(const DeclContext *useDC,
bool forConformance,
bool includeInlineable) const {
return checkAccess(useDC, this, forConformance, includeInlineable,
bool allowUsableFromInline) const {
return checkAccess(useDC, this, forConformance, allowUsableFromInline,
[&]() { return getFormalAccess(); });
}

Expand Down
2 changes: 1 addition & 1 deletion lib/AST/ModuleNameLookup.cpp
Expand Up @@ -145,7 +145,7 @@ void ModuleNameLookup<LookupStrategy>::lookupInModule(

const size_t initialCount = decls.size();
size_t currentCount = decls.size();
bool includeInlineable = options & NL_IncludeUsableFromInlineAndInlineable;
bool includeInlineable = options & NL_IncludeUsableFromInline;

auto updateNewDecls = [&](const DeclContext *moduleScopeContext) {
if (decls.size() == currentCount)
Expand Down
2 changes: 1 addition & 1 deletion lib/AST/NameLookup.cpp
Expand Up @@ -1502,7 +1502,7 @@ static bool isAcceptableLookupResult(const DeclContext *dc,
// Check access.
if (!(options & NL_IgnoreAccessControl) &&
!dc->getASTContext().isAccessControlDisabled()) {
bool allowInlinable = options & NL_IncludeUsableFromInlineAndInlineable;
bool allowInlinable = options & NL_IncludeUsableFromInline;
return decl->isAccessibleFrom(dc, /*forConformance*/ false, allowInlinable);
}

Expand Down
6 changes: 3 additions & 3 deletions lib/AST/UnqualifiedLookup.cpp
Expand Up @@ -384,8 +384,8 @@ void UnqualifiedLookupFactory::addImportedResults(const DeclContext *const dc) {
auto resolutionKind = isOriginallyTypeLookup ? ResolutionKind::TypesOnly
: ResolutionKind::Overloadable;
auto nlOptions = NL_UnqualifiedDefault;
if (options.contains(Flags::IncludeInlineableAndUsableFromInline))
nlOptions |= NL_IncludeUsableFromInlineAndInlineable;
if (options.contains(Flags::IncludeUsableFromInline))
nlOptions |= NL_IncludeUsableFromInline;
lookupInModule(dc, Name.getFullName(), CurModuleResults,
NLKind::UnqualifiedLookup, resolutionKind, dc, nlOptions);

Expand Down Expand Up @@ -841,4 +841,4 @@ ValueDecl *ASTScope::lookupSingleLocalDecl(SourceFile *sf, DeclName name,
if (result.size() != 1)
return nullptr;
return result[0];
}
}
2 changes: 1 addition & 1 deletion lib/Sema/TypeCheckAttr.cpp
Expand Up @@ -2465,7 +2465,7 @@ static void lookupReplacedDecl(DeclNameRef replacedDeclName,

auto options = NL_QualifiedDefault;
if (declCtxt->isInSpecializeExtensionContext())
options |= NL_IncludeUsableFromInlineAndInlineable;
options |= NL_IncludeUsableFromInline;

if (typeCtx)
moduleScopeCtxt->lookupQualified({typeCtx}, replacedDeclName, options,
Expand Down
8 changes: 4 additions & 4 deletions lib/Sema/TypeCheckNameLookup.cpp
Expand Up @@ -211,8 +211,8 @@ convertToUnqualifiedLookupOptions(NameLookupOptions options) {
newOptions |= UnqualifiedLookupFlags::IgnoreAccessControl;
if (options.contains(NameLookupFlags::IncludeOuterResults))
newOptions |= UnqualifiedLookupFlags::IncludeOuterResults;
if (options.contains(NameLookupFlags::IncludeInlineableAndUsableFromInline))
newOptions |= UnqualifiedLookupFlags::IncludeInlineableAndUsableFromInline;
if (options.contains(NameLookupFlags::IncludeUsableFromInline))
newOptions |= UnqualifiedLookupFlags::IncludeUsableFromInline;

return newOptions;
}
Expand Down Expand Up @@ -388,8 +388,8 @@ LookupTypeResult TypeChecker::lookupMemberType(DeclContext *dc,

if (options.contains(NameLookupFlags::IgnoreAccessControl))
subOptions |= NL_IgnoreAccessControl;
if (options.contains(NameLookupFlags::IncludeInlineableAndUsableFromInline))
subOptions |= NL_IncludeUsableFromInlineAndInlineable;
if (options.contains(NameLookupFlags::IncludeUsableFromInline))
subOptions |= NL_IncludeUsableFromInline;

// Make sure we've resolved implicit members, if we need them.
if (auto *current = type->getAnyNominal()) {
Expand Down
4 changes: 2 additions & 2 deletions lib/Sema/TypeCheckType.cpp
Expand Up @@ -1323,7 +1323,7 @@ static Type resolveTopLevelIdentTypeComponent(TypeResolution resolution,

NameLookupOptions lookupOptions = defaultUnqualifiedLookupOptions;
if (options.contains(TypeResolutionFlags::AllowInlinable))
lookupOptions |= NameLookupFlags::IncludeInlineableAndUsableFromInline;
lookupOptions |= NameLookupFlags::IncludeUsableFromInline;
auto globals = TypeChecker::lookupUnqualifiedType(DC, id, comp->getLoc(),
lookupOptions);

Expand Down Expand Up @@ -1527,7 +1527,7 @@ static Type resolveNestedIdentTypeComponent(TypeResolution resolution,
// Look for member types with the given name.
NameLookupOptions lookupOptions = defaultMemberLookupOptions;
if (options.contains(TypeResolutionFlags::AllowInlinable))
lookupOptions |= NameLookupFlags::IncludeInlineableAndUsableFromInline;
lookupOptions |= NameLookupFlags::IncludeUsableFromInline;
LookupTypeResult memberTypes;
if (parentTy->mayHaveMembers())
memberTypes = TypeChecker::lookupMemberType(
Expand Down
2 changes: 1 addition & 1 deletion lib/Sema/TypeChecker.h
Expand Up @@ -153,7 +153,7 @@ enum class NameLookupFlags {
/// result.
IncludeOuterResults = 1 << 1,
// Whether to include results that are marked @inlinable or @usableFromInline.
IncludeInlineableAndUsableFromInline = 1 << 2,
IncludeUsableFromInline = 1 << 2,
};

/// A set of options that control name lookup.
Expand Down

0 comments on commit 96a0d0e

Please sign in to comment.