@@ -2966,7 +2966,8 @@ void CompletionLookup::getGenericRequirementCompletions(
29662966
29672967bool CompletionLookup::canUseAttributeOnDecl (DeclAttrKind DAK, bool IsInSil,
29682968 bool IsConcurrencyEnabled,
2969- Optional<DeclKind> DK) {
2969+ Optional<DeclKind> DK,
2970+ StringRef Name) {
29702971 if (DeclAttribute::isUserInaccessible (DAK))
29712972 return false ;
29722973 if (DeclAttribute::isDeclModifier (DAK))
@@ -2979,6 +2980,11 @@ bool CompletionLookup::canUseAttributeOnDecl(DeclAttrKind DAK, bool IsInSil,
29792980 return false ;
29802981 if (!DK.has_value ())
29812982 return true ;
2983+ // Hide underscored attributes even if they are not marked as user
2984+ // inaccessible. This can happen for attributes that are an underscored
2985+ // variant of a user-accessible attribute (like @_backDeployed)
2986+ if (Name.empty () || Name[0 ] == ' _' )
2987+ return false ;
29822988 return DeclAttribute::canAttributeAppearOnDeclKind (DAK, DK.value ());
29832989}
29842990
@@ -2997,9 +3003,10 @@ void CompletionLookup::getAttributeDeclCompletions(bool IsInSil,
29973003 }
29983004 bool IsConcurrencyEnabled = Ctx.LangOpts .EnableExperimentalConcurrency ;
29993005 std::string Description = TargetName.str () + " Attribute" ;
3006+ #define DECL_ATTR_ALIAS (KEYWORD, NAME ) DECL_ATTR(KEYWORD, NAME, 0 , 0 )
30003007#define DECL_ATTR (KEYWORD, NAME, ...) \
3001- if (canUseAttributeOnDecl (DAK_##NAME, IsInSil, IsConcurrencyEnabled, \
3002- DK)) \
3008+ if (canUseAttributeOnDecl (DAK_##NAME, IsInSil, IsConcurrencyEnabled, DK, \
3009+ #KEYWORD)) \
30033010 addDeclAttrKeyword (#KEYWORD, Description);
30043011#include " swift/AST/Attr.def"
30053012}
0 commit comments