Remove most user-inaccessbile attributes from the

code completion strings.

Swift SVN r25790
This commit is contained in:
Xi Ge
2015-03-05 23:12:24 +00:00
parent 40ffcc0148
commit 039674b492
4 changed files with 20 additions and 16 deletions

View File

@@ -73,7 +73,8 @@ TYPE_ATTR(opened)
//
DECL_ATTR(asmname, Asmname,
OnFunc | OnConstructor | OnDestructor | LongAttribute, 0)
OnFunc | OnConstructor | OnDestructor | LongAttribute |
UserInaccessible, 0)
DECL_ATTR(availability, Availability,
OnFunc | OnStruct | OnEnum | OnClass | OnProtocol | OnVar |
@@ -95,7 +96,7 @@ SIMPLE_DECL_ATTR(optional, Optional,
SIMPLE_DECL_ATTR(noreturn, NoReturn, OnFunc, 7)
SIMPLE_DECL_ATTR(exported, Exported, OnImport, 8)
SIMPLE_DECL_ATTR(exported, Exported, OnImport | UserInaccessible, 8)
/// NOTE: 9 is unused.
@@ -118,14 +119,14 @@ SIMPLE_DECL_ATTR(NSManaged, NSManaged, OnVar, 15)
SIMPLE_DECL_ATTR(lazy, Lazy, OnVar|DeclModifier, 16)
SIMPLE_DECL_ATTR(LLDBDebuggerFunction, LLDBDebuggerFunction,
SIMPLE_DECL_ATTR(LLDBDebuggerFunction, LLDBDebuggerFunction, RejectByParser |
OnFunc, 17)
SIMPLE_DECL_ATTR(UIApplicationMain, UIApplicationMain,
OnClass, 18)
SIMPLE_DECL_ATTR(unsafe_no_objc_tagged_pointer, UnsafeNoObjCTaggedPointer,
OnProtocol, 19)
OnProtocol | UserInaccessible, 19)
SIMPLE_DECL_ATTR(objc_non_lazy_realization, ObjCNonLazyRealization,
OnClass, 53)
@@ -133,7 +134,8 @@ SIMPLE_DECL_ATTR(objc_non_lazy_realization, ObjCNonLazyRealization,
DECL_ATTR(inline, Inline, OnFunc | OnConstructor, 20)
DECL_ATTR(semantics, Semantics,
OnFunc | OnConstructor | OnDestructor | OnSubscript, 21)
OnFunc | OnConstructor | OnDestructor | OnSubscript |
UserInaccessible, 21)
SIMPLE_DECL_ATTR(dynamic, Dynamic,
OnFunc | OnVar | OnSubscript | OnConstructor | DeclModifier, 22)
@@ -143,7 +145,7 @@ SIMPLE_DECL_ATTR(prefix , Prefix , OnFunc | OnOperator | DeclModifier, 24)
SIMPLE_DECL_ATTR(postfix, Postfix, OnFunc | OnOperator | DeclModifier, 25)
SIMPLE_DECL_ATTR(transparent, Transparent,
OnFunc|OnConstructor|OnVar|OnExtension, 26)
OnFunc|OnConstructor|OnVar|OnExtension|UserInaccessible, 26)
SIMPLE_DECL_ATTR(requires_stored_property_inits, RequiresStoredPropertyInits,
OnClass, 27)
DECL_ATTR(autoclosure, AutoClosure, OnParam, 28)
@@ -187,7 +189,8 @@ DECL_ATTR(__raw_doc_comment, RawDocComment, OnAnyDecl |
DECL_ATTR(weak, Ownership, OnVar | OnParam | DeclModifier | NotSerialized,
/* Not serialized */49)
DECL_ATTR(effects, Effects, OnFunc | OnConstructor | OnDestructor, 50)
DECL_ATTR(effects, Effects, OnFunc | OnConstructor | OnDestructor |
UserInaccessible, 50)
DECL_ATTR_ALIAS(unowned, Ownership)

View File

@@ -403,6 +403,9 @@ public:
/// The attribute should be reported by parser as unknown.
RejectByParser = 1 << 5,
/// Whether client code cannot use the attribute.
UserInaccessible = 1 << 6,
// There is one entry for each DeclKind here, and some higher level buckets
// down below. These are used in Attr.def to control which kinds of
// declarations an attribute can be attached to.
@@ -511,6 +514,10 @@ public:
return getOptions(DK) & SILOnly;
}
static bool isUserInaccessible(DeclAttrKind DK) {
return getOptions(DK) & UserInaccessible;
}
bool isDeclModifier() const {
return isDeclModifier(getKind());
}

View File

@@ -2029,7 +2029,8 @@ public:
void getAttributeDeclCompletions(bool IsInSil) {
// FIXME: also include user-defined attribute keywords
#define DECL_ATTR(KEYWORD, NAME, ...) \
if (!DeclAttribute::isDeclModifier(DAK_##NAME) && \
if (!DeclAttribute::isUserInaccessible(DAK_##NAME) && \
!DeclAttribute::isDeclModifier(DAK_##NAME) && \
!DeclAttribute::shouldBeRejectedByParser(DAK_##NAME) && \
(!DeclAttribute::isSilOnly(DAK_##NAME) || IsInSil)) \
addDeclAttrKeyword(#KEYWORD, "Declaration Attribute");

View File

@@ -26,28 +26,21 @@
@#^KEYWORD1^#
// KEYWORD1: Begin completions, 23 items
// KEYWORD1-NEXT: Keyword/None: asmname[#Declaration Attribute#]; name=asmname
// KEYWORD1: Begin completions, 16 items
// KEYWORD1-NEXT: Keyword/None: availability[#Declaration Attribute#]; name=availability
// KEYWORD1-NEXT: Keyword/None: objc[#Declaration Attribute#]; name=objc
// KEYWORD1-NEXT: Keyword/None: noreturn[#Declaration Attribute#]; name=noreturn
// KEYWORD1-NEXT: Keyword/None: exported[#Declaration Attribute#]; name=exported
// KEYWORD1-NEXT: Keyword/None: NSCopying[#Declaration Attribute#]; name=NSCopying
// KEYWORD1-NEXT: Keyword/None: IBAction[#Declaration Attribute#]; name=IBAction
// KEYWORD1-NEXT: Keyword/None: IBDesignable[#Declaration Attribute#]; name=IBDesignable
// KEYWORD1-NEXT: Keyword/None: IBInspectable[#Declaration Attribute#]; name=IBInspectable
// KEYWORD1-NEXT: Keyword/None: IBOutlet[#Declaration Attribute#]; name=IBOutlet
// KEYWORD1-NEXT: Keyword/None: NSManaged[#Declaration Attribute#]; name=NSManaged
// KEYWORD1-NEXT: Keyword/None: LLDBDebuggerFunction[#Declaration Attribute#]; name=LLDBDebuggerFunction
// KEYWORD1-NEXT: Keyword/None: UIApplicationMain[#Declaration Attribute#]; name=UIApplicationMain
// KEYWORD1-NEXT: Keyword/None: unsafe_no_objc_tagged_pointer[#Declaration Attribute#]; name=unsafe_no_objc_tagged_pointer
// KEYWORD1-NEXT: Keyword/None: objc_non_lazy_realization[#Declaration Attribute#]; name=objc_non_lazy_realization
// KEYWORD1-NEXT: Keyword/None: inline[#Declaration Attribute#]; name=inline
// KEYWORD1-NEXT: Keyword/None: semantics[#Declaration Attribute#]; name=semantics
// KEYWORD1-NEXT: Keyword/None: transparent[#Declaration Attribute#]; name=transparent
// KEYWORD1-NEXT: Keyword/None: requires_stored_property_inits[#Declaration Attribute#]; name=requires_stored_property_inits
// KEYWORD1-NEXT: Keyword/None: autoclosure[#Declaration Attribute#]; name=autoclosure
// KEYWORD1-NEXT: Keyword/None: noescape[#Declaration Attribute#]; name=noescape
// KEYWORD1-NEXT: Keyword/None: effects[#Declaration Attribute#]; name=effects
// KEYWORD1-NEXT: Keyword/None: NSApplicationMain[#Declaration Attribute#]; name=NSApplicationMain
// KEYWORD1-NEXT: End completions