@@ -189,6 +189,7 @@ DescriptiveDeclKind Decl::getDescriptiveKind() const {
189189 TRIVIAL_KIND (MissingMember);
190190 TRIVIAL_KIND (Macro);
191191 TRIVIAL_KIND (MacroExpansion);
192+ TRIVIAL_KIND (Using);
192193
193194 case DeclKind::TypeAlias:
194195 return cast<TypeAliasDecl>(this )->getGenericParams ()
@@ -400,6 +401,7 @@ StringRef Decl::getDescriptiveKindName(DescriptiveDeclKind K) {
400401 ENTRY (OpaqueVarType, " type" );
401402 ENTRY (Macro, " macro" );
402403 ENTRY (MacroExpansion, " pound literal" );
404+ ENTRY (Using, " using" );
403405 }
404406#undef ENTRY
405407 llvm_unreachable (" bad DescriptiveDeclKind" );
@@ -1711,6 +1713,7 @@ ImportKind ImportDecl::getBestImportKind(const ValueDecl *VD) {
17111713 case DeclKind::Missing:
17121714 case DeclKind::MissingMember:
17131715 case DeclKind::MacroExpansion:
1716+ case DeclKind::Using:
17141717 llvm_unreachable (" not a ValueDecl" );
17151718
17161719 case DeclKind::AssociatedType:
@@ -1838,6 +1841,30 @@ bool ImportDecl::isAccessLevelImplicit() const {
18381841 return true ;
18391842}
18401843
1844+ UsingDecl::UsingDecl (SourceLoc usingLoc, SourceLoc specifierLoc,
1845+ UsingSpecifier specifier, DeclContext *parent)
1846+ : Decl(DeclKind::Using, parent), UsingLoc(usingLoc),
1847+ SpecifierLoc(specifierLoc) {
1848+ Bits.UsingDecl .Specifier = static_cast <unsigned >(specifier);
1849+ assert (getSpecifier () == specifier &&
1850+ " not enough bits in UsingDecl flags for specifier" );
1851+ }
1852+
1853+ std::string UsingDecl::getSpecifierName () const {
1854+ switch (getSpecifier ()) {
1855+ case UsingSpecifier::MainActor:
1856+ return " @MainActor" ;
1857+ case UsingSpecifier::nonisolated:
1858+ return " nonisolated" ;
1859+ }
1860+ }
1861+
1862+ UsingDecl *UsingDecl::create (ASTContext &ctx, SourceLoc usingLoc,
1863+ SourceLoc specifierLoc, UsingSpecifier specifier,
1864+ DeclContext *parent) {
1865+ return new (ctx) UsingDecl (usingLoc, specifierLoc, specifier, parent);
1866+ }
1867+
18411868void NominalTypeDecl::setConformanceLoader (LazyMemberLoader *lazyLoader,
18421869 uint64_t contextData) {
18431870 assert (!Bits.NominalTypeDecl .HasLazyConformances &&
@@ -3652,6 +3679,7 @@ bool ValueDecl::isInstanceMember() const {
36523679 case DeclKind::Missing:
36533680 case DeclKind::MissingMember:
36543681 case DeclKind::MacroExpansion:
3682+ case DeclKind::Using:
36553683 llvm_unreachable (" Not a ValueDecl" );
36563684
36573685 case DeclKind::Class:
@@ -4765,6 +4793,7 @@ SourceLoc Decl::getAttributeInsertionLoc(bool forModifier) const {
47654793 case DeclKind::MissingMember:
47664794 case DeclKind::MacroExpansion:
47674795 case DeclKind::BuiltinTuple:
4796+ case DeclKind::Using:
47684797 // These don't take attributes.
47694798 return SourceLoc ();
47704799
0 commit comments