Skip to content

Commit 0a24844

Browse files
committed
[Sema] Move getImportAccessFrom to Decl
1 parent 97668d5 commit 0a24844

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

include/swift/AST/Decl.h

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -982,6 +982,16 @@ class alignas(1 << DeclAlignInBits) Decl : public ASTAllocated<Decl> {
982982
/// Returns the source range of the declaration including its attributes.
983983
SourceRange getSourceRangeIncludingAttrs() const;
984984

985+
using ImportAccessLevel = llvm::Optional<AttributedImport<ImportedModule>>;
986+
987+
/// Returns the import that may restrict the access to this decl
988+
/// from \p useDC.
989+
///
990+
/// If this decl and \p useDC are from the same module it returns
991+
/// \c llvm::None. If there are many imports, it returns the most
992+
/// permissive one.
993+
ImportAccessLevel getImportAccessFrom(const DeclContext *useDC) const;
994+
985995
SourceLoc TrailingSemiLoc;
986996

987997
/// Whether this declaration is within a macro expansion relative to
@@ -2793,15 +2803,6 @@ class ValueDecl : public Decl {
27932803
bool forConformance = false,
27942804
bool allowUsableFromInline = false) const;
27952805

2796-
using ImportAccessLevel = llvm::Optional<AttributedImport<ImportedModule>>;
2797-
2798-
/// Returns the import that may restrict the access to this decl
2799-
/// from \p useDC.
2800-
///
2801-
/// If this decl and \p useDC are from the same module it returns
2802-
/// \c llvm::None. If there are many imports, it returns the most
2803-
/// permissive one.
2804-
ImportAccessLevel getImportAccessFrom(const DeclContext *useDC) const;
28052806

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

lib/AST/Decl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4345,7 +4345,7 @@ bool ValueDecl::isAccessibleFrom(const DeclContext *useDC,
43454345
[&]() { return getFormalAccess(); });
43464346
}
43474347

4348-
ImportAccessLevel ValueDecl::getImportAccessFrom(const DeclContext *useDC) const {
4348+
ImportAccessLevel Decl::getImportAccessFrom(const DeclContext *useDC) const {
43494349
ModuleDecl *Mod = getModuleContext();
43504350
if (useDC && useDC->getParentModule() != Mod) {
43514351
if (auto useSF = useDC->getParentSourceFile()) {

0 commit comments

Comments
 (0)