Skip to content

Commit 8b170f9

Browse files
Merge pull request #34304 from aschwaighofer/rename_usableFromInline_flags
Rename various IncludeUsableFromInlineAndInlineable to IncludeUsableFromInline
2 parents 43a795b + c880be6 commit 8b170f9

15 files changed

+29
-27
lines changed

include/swift/AST/Decl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2188,7 +2188,7 @@ class ValueDecl : public Decl {
21882188
/// the default implementations are not visible to name lookup.
21892189
bool isAccessibleFrom(const DeclContext *DC,
21902190
bool forConformance = false,
2191-
bool includeInlineable = false) const;
2191+
bool allowUsableFromInline = false) const;
21922192

21932193
/// Returns whether this declaration should be treated as \c open from
21942194
/// \p useDC. This is very similar to #getFormalAccess, but takes

include/swift/AST/LookupKinds.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ enum NLOptions : unsigned {
5151
NL_IncludeAttributeImplements = 1 << 5,
5252

5353
// Include @usableFromInline and @inlinable
54-
NL_IncludeUsableFromInlineAndInlineable = 1 << 6,
54+
NL_IncludeUsableFromInline = 1 << 6,
5555

5656
/// The default set of options used for qualified name lookup.
5757
///

include/swift/AST/ModuleNameLookup.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ void simple_display(llvm::raw_ostream &out, ResolutionKind kind);
5757
/// being performed, for checking access. This must be either a
5858
/// FileUnit or a Module.
5959
/// \param options name lookup options. Currently only used to communicate the
60-
/// NL_IncludeUsableFromInlineAndInlineable option.
60+
/// NL_IncludeUsableFromInline option.
6161
void lookupInModule(const DeclContext *moduleOrFile,
6262
DeclName name, SmallVectorImpl<ValueDecl *> &decls,
6363
NLKind lookupKind, ResolutionKind resolutionKind,

include/swift/AST/NameLookup.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ enum class UnqualifiedLookupFlags {
227227
IncludeOuterResults = 1 << 4,
228228
// This lookup should include results that are @inlinable or
229229
// @usableFromInline.
230-
IncludeInlineableAndUsableFromInline = 1 << 5,
230+
IncludeUsableFromInline = 1 << 5,
231231
};
232232

233233
using UnqualifiedLookupOptions = OptionSet<UnqualifiedLookupFlags>;

lib/AST/Decl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3394,8 +3394,8 @@ static bool checkAccess(const DeclContext *useDC, const ValueDecl *VD,
33943394

33953395
bool ValueDecl::isAccessibleFrom(const DeclContext *useDC,
33963396
bool forConformance,
3397-
bool includeInlineable) const {
3398-
return checkAccess(useDC, this, forConformance, includeInlineable,
3397+
bool allowUsableFromInline) const {
3398+
return checkAccess(useDC, this, forConformance, allowUsableFromInline,
33993399
[&]() { return getFormalAccess(); });
34003400
}
34013401

lib/AST/ModuleNameLookup.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ void ModuleNameLookup<LookupStrategy>::lookupInModule(
145145

146146
const size_t initialCount = decls.size();
147147
size_t currentCount = decls.size();
148-
bool includeInlineable = options & NL_IncludeUsableFromInlineAndInlineable;
148+
bool includeUsableFromInline = options & NL_IncludeUsableFromInline;
149149

150150
auto updateNewDecls = [&](const DeclContext *moduleScopeContext) {
151151
if (decls.size() == currentCount)
@@ -157,7 +157,8 @@ void ModuleNameLookup<LookupStrategy>::lookupInModule(
157157
if (resolutionKind == ResolutionKind::TypesOnly && !isa<TypeDecl>(VD))
158158
return true;
159159
if (respectAccessControl &&
160-
!VD->isAccessibleFrom(moduleScopeContext, false, includeInlineable))
160+
!VD->isAccessibleFrom(moduleScopeContext, false,
161+
includeUsableFromInline))
161162
return true;
162163
return false;
163164
});

lib/AST/NameLookup.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1502,8 +1502,9 @@ static bool isAcceptableLookupResult(const DeclContext *dc,
15021502
// Check access.
15031503
if (!(options & NL_IgnoreAccessControl) &&
15041504
!dc->getASTContext().isAccessControlDisabled()) {
1505-
bool allowInlinable = options & NL_IncludeUsableFromInlineAndInlineable;
1506-
return decl->isAccessibleFrom(dc, /*forConformance*/ false, allowInlinable);
1505+
bool allowUsableFromInline = options & NL_IncludeUsableFromInline;
1506+
return decl->isAccessibleFrom(dc, /*forConformance*/ false,
1507+
allowUsableFromInline);
15071508
}
15081509

15091510
return true;

lib/AST/UnqualifiedLookup.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -384,8 +384,8 @@ void UnqualifiedLookupFactory::addImportedResults(const DeclContext *const dc) {
384384
auto resolutionKind = isOriginallyTypeLookup ? ResolutionKind::TypesOnly
385385
: ResolutionKind::Overloadable;
386386
auto nlOptions = NL_UnqualifiedDefault;
387-
if (options.contains(Flags::IncludeInlineableAndUsableFromInline))
388-
nlOptions |= NL_IncludeUsableFromInlineAndInlineable;
387+
if (options.contains(Flags::IncludeUsableFromInline))
388+
nlOptions |= NL_IncludeUsableFromInline;
389389
lookupInModule(dc, Name.getFullName(), CurModuleResults,
390390
NLKind::UnqualifiedLookup, resolutionKind, dc, nlOptions);
391391

@@ -841,4 +841,4 @@ ValueDecl *ASTScope::lookupSingleLocalDecl(SourceFile *sf, DeclName name,
841841
if (result.size() != 1)
842842
return nullptr;
843843
return result[0];
844-
}
844+
}

lib/Sema/TypeCheckAttr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2458,7 +2458,7 @@ static void lookupReplacedDecl(DeclNameRef replacedDeclName,
24582458

24592459
auto options = NL_QualifiedDefault;
24602460
if (declCtxt->isInSpecializeExtensionContext())
2461-
options |= NL_IncludeUsableFromInlineAndInlineable;
2461+
options |= NL_IncludeUsableFromInline;
24622462

24632463
if (typeCtx)
24642464
moduleScopeCtxt->lookupQualified({typeCtx}, replacedDeclName, options,

lib/Sema/TypeCheckDecl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2190,7 +2190,7 @@ static Type validateParameterType(ParamDecl *decl) {
21902190
options |= TypeResolutionFlags::Direct;
21912191

21922192
if (dc->isInSpecializeExtensionContext())
2193-
options |= TypeResolutionFlags::AllowInlinable;
2193+
options |= TypeResolutionFlags::AllowUsableFromInline;
21942194

21952195
const auto resolution =
21962196
TypeResolution::forInterface(dc, options, unboundTyOpener);
@@ -2727,7 +2727,7 @@ ExtendedTypeRequest::evaluate(Evaluator &eval, ExtensionDecl *ext) const {
27272727
// Compute the extended type.
27282728
TypeResolutionOptions options(TypeResolverContext::ExtensionBinding);
27292729
if (ext->isInSpecializeExtensionContext())
2730-
options |= TypeResolutionFlags::AllowInlinable;
2730+
options |= TypeResolutionFlags::AllowUsableFromInline;
27312731
const auto resolution = TypeResolution::forStructural(
27322732
ext->getDeclContext(), options,
27332733
[](auto unboundTy) {

0 commit comments

Comments
 (0)