forked from OSchip/llvm-project
Provide result types for code completions that describe built-in
expressions (this, sizeof, etc.). llvm-svn: 142424
This commit is contained in:
parent
91aee685d8
commit
e5c79d5ea8
|
@ -1376,12 +1376,55 @@ static bool WantTypesInContext(Sema::ParserCompletionContext CCC,
|
|||
return false;
|
||||
}
|
||||
|
||||
/// \brief Retrieve a printing policy suitable for code completion.
|
||||
static PrintingPolicy getCompletionPrintingPolicy(Sema &S) {
|
||||
PrintingPolicy Policy = S.getPrintingPolicy();
|
||||
Policy.AnonymousTagLocations = false;
|
||||
Policy.SuppressStrongLifetime = true;
|
||||
return Policy;
|
||||
}
|
||||
|
||||
/// \brief Retrieve the string representation of the given type as a string
|
||||
/// that has the appropriate lifetime for code completion.
|
||||
///
|
||||
/// This routine provides a fast path where we provide constant strings for
|
||||
/// common type names.
|
||||
static const char *GetCompletionTypeString(QualType T,
|
||||
ASTContext &Context,
|
||||
const PrintingPolicy &Policy,
|
||||
CodeCompletionAllocator &Allocator) {
|
||||
if (!T.getLocalQualifiers()) {
|
||||
// Built-in type names are constant strings.
|
||||
if (const BuiltinType *BT = dyn_cast<BuiltinType>(T))
|
||||
return BT->getName(Policy);
|
||||
|
||||
// Anonymous tag types are constant strings.
|
||||
if (const TagType *TagT = dyn_cast<TagType>(T))
|
||||
if (TagDecl *Tag = TagT->getDecl())
|
||||
if (!Tag->getIdentifier() && !Tag->getTypedefNameForAnonDecl()) {
|
||||
switch (Tag->getTagKind()) {
|
||||
case TTK_Struct: return "struct <anonymous>";
|
||||
case TTK_Class: return "class <anonymous>";
|
||||
case TTK_Union: return "union <anonymous>";
|
||||
case TTK_Enum: return "enum <anonymous>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Slow path: format the type as a string.
|
||||
std::string Result;
|
||||
T.getAsStringInternal(Result, Policy);
|
||||
return Allocator.CopyString(Result);
|
||||
}
|
||||
|
||||
/// \brief Add language constructs that show up for "ordinary" names.
|
||||
static void AddOrdinaryNameResults(Sema::ParserCompletionContext CCC,
|
||||
Scope *S,
|
||||
Sema &SemaRef,
|
||||
ResultBuilder &Results) {
|
||||
CodeCompletionBuilder Builder(Results.getAllocator());
|
||||
CodeCompletionAllocator &Allocator = Results.getAllocator();
|
||||
CodeCompletionBuilder Builder(Allocator);
|
||||
PrintingPolicy Policy = getCompletionPrintingPolicy(SemaRef);
|
||||
|
||||
typedef CodeCompletionResult Result;
|
||||
switch (CCC) {
|
||||
|
@ -1709,13 +1752,25 @@ static void AddOrdinaryNameResults(Sema::ParserCompletionContext CCC,
|
|||
case Sema::PCC_Expression: {
|
||||
if (SemaRef.getLangOptions().CPlusPlus) {
|
||||
// 'this', if we're in a non-static member function.
|
||||
if (CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(SemaRef.CurContext))
|
||||
if (!Method->isStatic())
|
||||
Results.AddResult(Result("this"));
|
||||
QualType ThisTy = SemaRef.getCurrentThisType(false);
|
||||
if (!ThisTy.isNull()) {
|
||||
Builder.AddResultTypeChunk(GetCompletionTypeString(ThisTy,
|
||||
SemaRef.Context,
|
||||
Policy,
|
||||
Allocator));
|
||||
Builder.AddTypedTextChunk("this");
|
||||
Results.AddResult(Result(Builder.TakeString()));
|
||||
}
|
||||
|
||||
// true, false
|
||||
Results.AddResult(Result("true"));
|
||||
Results.AddResult(Result("false"));
|
||||
// true
|
||||
Builder.AddResultTypeChunk("bool");
|
||||
Builder.AddTypedTextChunk("true");
|
||||
Results.AddResult(Result(Builder.TakeString()));
|
||||
|
||||
// false
|
||||
Builder.AddResultTypeChunk("bool");
|
||||
Builder.AddTypedTextChunk("false");
|
||||
Results.AddResult(Result(Builder.TakeString()));
|
||||
|
||||
if (SemaRef.getLangOptions().RTTI) {
|
||||
// dynamic_cast < type-id > ( expression )
|
||||
|
@ -1761,6 +1816,7 @@ static void AddOrdinaryNameResults(Sema::ParserCompletionContext CCC,
|
|||
|
||||
if (SemaRef.getLangOptions().RTTI) {
|
||||
// typeid ( expression-or-type )
|
||||
Builder.AddResultTypeChunk("std::type_info");
|
||||
Builder.AddTypedTextChunk("typeid");
|
||||
Builder.AddChunk(CodeCompletionString::CK_LeftParen);
|
||||
Builder.AddPlaceholderChunk("expression-or-type");
|
||||
|
@ -1790,12 +1846,14 @@ static void AddOrdinaryNameResults(Sema::ParserCompletionContext CCC,
|
|||
Results.AddResult(Result(Builder.TakeString()));
|
||||
|
||||
// delete expression
|
||||
Builder.AddResultTypeChunk("void");
|
||||
Builder.AddTypedTextChunk("delete");
|
||||
Builder.AddChunk(CodeCompletionString::CK_HorizontalSpace);
|
||||
Builder.AddPlaceholderChunk("expression");
|
||||
Results.AddResult(Result(Builder.TakeString()));
|
||||
|
||||
// delete [] expression
|
||||
Builder.AddResultTypeChunk("void");
|
||||
Builder.AddTypedTextChunk("delete");
|
||||
Builder.AddChunk(CodeCompletionString::CK_HorizontalSpace);
|
||||
Builder.AddChunk(CodeCompletionString::CK_LeftBracket);
|
||||
|
@ -1806,6 +1864,7 @@ static void AddOrdinaryNameResults(Sema::ParserCompletionContext CCC,
|
|||
|
||||
if (SemaRef.getLangOptions().CXXExceptions) {
|
||||
// throw expression
|
||||
Builder.AddResultTypeChunk("void");
|
||||
Builder.AddTypedTextChunk("throw");
|
||||
Builder.AddChunk(CodeCompletionString::CK_HorizontalSpace);
|
||||
Builder.AddPlaceholderChunk("expression");
|
||||
|
@ -1816,10 +1875,12 @@ static void AddOrdinaryNameResults(Sema::ParserCompletionContext CCC,
|
|||
|
||||
if (SemaRef.getLangOptions().CPlusPlus0x) {
|
||||
// nullptr
|
||||
Builder.AddResultTypeChunk("std::nullptr_t");
|
||||
Builder.AddTypedTextChunk("nullptr");
|
||||
Results.AddResult(Result(Builder.TakeString()));
|
||||
|
||||
// alignof
|
||||
Builder.AddResultTypeChunk("size_t");
|
||||
Builder.AddTypedTextChunk("alignof");
|
||||
Builder.AddChunk(CodeCompletionString::CK_LeftParen);
|
||||
Builder.AddPlaceholderChunk("type");
|
||||
|
@ -1827,6 +1888,7 @@ static void AddOrdinaryNameResults(Sema::ParserCompletionContext CCC,
|
|||
Results.AddResult(Result(Builder.TakeString()));
|
||||
|
||||
// noexcept
|
||||
Builder.AddResultTypeChunk("bool");
|
||||
Builder.AddTypedTextChunk("noexcept");
|
||||
Builder.AddChunk(CodeCompletionString::CK_LeftParen);
|
||||
Builder.AddPlaceholderChunk("expression");
|
||||
|
@ -1834,6 +1896,7 @@ static void AddOrdinaryNameResults(Sema::ParserCompletionContext CCC,
|
|||
Results.AddResult(Result(Builder.TakeString()));
|
||||
|
||||
// sizeof... expression
|
||||
Builder.AddResultTypeChunk("size_t");
|
||||
Builder.AddTypedTextChunk("sizeof...");
|
||||
Builder.AddChunk(CodeCompletionString::CK_LeftParen);
|
||||
Builder.AddPlaceholderChunk("parameter-pack");
|
||||
|
@ -1847,14 +1910,23 @@ static void AddOrdinaryNameResults(Sema::ParserCompletionContext CCC,
|
|||
if (ObjCMethodDecl *Method = SemaRef.getCurMethodDecl()) {
|
||||
// The interface can be NULL.
|
||||
if (ObjCInterfaceDecl *ID = Method->getClassInterface())
|
||||
if (ID->getSuperClass())
|
||||
Results.AddResult(Result("super"));
|
||||
if (ID->getSuperClass()) {
|
||||
std::string SuperType;
|
||||
SuperType = ID->getSuperClass()->getNameAsString();
|
||||
if (Method->isInstanceMethod())
|
||||
SuperType += " *";
|
||||
|
||||
Builder.AddResultTypeChunk(Allocator.CopyString(SuperType));
|
||||
Builder.AddTypedTextChunk("super");
|
||||
Results.AddResult(Result(Builder.TakeString()));
|
||||
}
|
||||
}
|
||||
|
||||
AddObjCExpressionResults(Results, true);
|
||||
}
|
||||
|
||||
// sizeof expression
|
||||
Builder.AddResultTypeChunk("size_t");
|
||||
Builder.AddTypedTextChunk("sizeof");
|
||||
Builder.AddChunk(CodeCompletionString::CK_LeftParen);
|
||||
Builder.AddPlaceholderChunk("expression-or-type");
|
||||
|
@ -1875,47 +1947,6 @@ static void AddOrdinaryNameResults(Sema::ParserCompletionContext CCC,
|
|||
Results.AddResult(Result("operator"));
|
||||
}
|
||||
|
||||
/// \brief Retrieve a printing policy suitable for code completion.
|
||||
static PrintingPolicy getCompletionPrintingPolicy(Sema &S) {
|
||||
PrintingPolicy Policy = S.getPrintingPolicy();
|
||||
Policy.AnonymousTagLocations = false;
|
||||
Policy.SuppressStrongLifetime = true;
|
||||
return Policy;
|
||||
}
|
||||
|
||||
/// \brief Retrieve the string representation of the given type as a string
|
||||
/// that has the appropriate lifetime for code completion.
|
||||
///
|
||||
/// This routine provides a fast path where we provide constant strings for
|
||||
/// common type names.
|
||||
static const char *GetCompletionTypeString(QualType T,
|
||||
ASTContext &Context,
|
||||
const PrintingPolicy &Policy,
|
||||
CodeCompletionAllocator &Allocator) {
|
||||
if (!T.getLocalQualifiers()) {
|
||||
// Built-in type names are constant strings.
|
||||
if (const BuiltinType *BT = dyn_cast<BuiltinType>(T))
|
||||
return BT->getName(Policy);
|
||||
|
||||
// Anonymous tag types are constant strings.
|
||||
if (const TagType *TagT = dyn_cast<TagType>(T))
|
||||
if (TagDecl *Tag = TagT->getDecl())
|
||||
if (!Tag->getIdentifier() && !Tag->getTypedefNameForAnonDecl()) {
|
||||
switch (Tag->getTagKind()) {
|
||||
case TTK_Struct: return "struct <anonymous>";
|
||||
case TTK_Class: return "class <anonymous>";
|
||||
case TTK_Union: return "union <anonymous>";
|
||||
case TTK_Enum: return "enum <anonymous>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Slow path: format the type as a string.
|
||||
std::string Result;
|
||||
T.getAsStringInternal(Result, Policy);
|
||||
return Allocator.CopyString(Result);
|
||||
}
|
||||
|
||||
/// \brief If the given declaration has an associated type, add it as a result
|
||||
/// type chunk.
|
||||
static void AddResultTypeChunk(ASTContext &Context,
|
||||
|
@ -4218,6 +4249,11 @@ static void AddObjCExpressionResults(ResultBuilder &Results, bool NeedAt) {
|
|||
CodeCompletionBuilder Builder(Results.getAllocator());
|
||||
|
||||
// @encode ( type-name )
|
||||
const char *EncodeType = "char[]";
|
||||
if (Results.getSema().getLangOptions().CPlusPlus ||
|
||||
Results.getSema().getLangOptions().ConstStrings)
|
||||
EncodeType = " const char[]";
|
||||
Builder.AddResultTypeChunk(EncodeType);
|
||||
Builder.AddTypedTextChunk(OBJC_AT_KEYWORD_NAME(NeedAt,encode));
|
||||
Builder.AddChunk(CodeCompletionString::CK_LeftParen);
|
||||
Builder.AddPlaceholderChunk("type-name");
|
||||
|
@ -4225,6 +4261,7 @@ static void AddObjCExpressionResults(ResultBuilder &Results, bool NeedAt) {
|
|||
Results.AddResult(Result(Builder.TakeString()));
|
||||
|
||||
// @protocol ( protocol-name )
|
||||
Builder.AddResultTypeChunk("Protocol *");
|
||||
Builder.AddTypedTextChunk(OBJC_AT_KEYWORD_NAME(NeedAt,protocol));
|
||||
Builder.AddChunk(CodeCompletionString::CK_LeftParen);
|
||||
Builder.AddPlaceholderChunk("protocol-name");
|
||||
|
@ -4232,6 +4269,7 @@ static void AddObjCExpressionResults(ResultBuilder &Results, bool NeedAt) {
|
|||
Results.AddResult(Result(Builder.TakeString()));
|
||||
|
||||
// @selector ( selector )
|
||||
Builder.AddResultTypeChunk("SEL");
|
||||
Builder.AddTypedTextChunk(OBJC_AT_KEYWORD_NAME(NeedAt,selector));
|
||||
Builder.AddChunk(CodeCompletionString::CK_LeftParen);
|
||||
Builder.AddPlaceholderChunk("selector");
|
||||
|
|
|
@ -40,6 +40,6 @@ void test(enum Color color) {
|
|||
// CHECK-CC2-NEXT: COMPLETION: Indigo : [#enum Color#]Indigo
|
||||
// CHECK-CC2-NEXT: COMPLETION: Orange : [#enum Color#]Orange
|
||||
// CHECK-CC2-NEXT: COMPLETION: Red : [#enum Color#]Red
|
||||
// CHECK-CC2-NEXT: COMPLETION: Pattern : sizeof(<#expression-or-type#>)
|
||||
// CHECK-CC2-NEXT: COMPLETION: Pattern : [#size_t#]sizeof(<#expression-or-type#>)
|
||||
// CHECK-CC2-NEXT: COMPLETION: Violet : [#enum Color#]Violet
|
||||
// CHECK-CC2-NEXT: COMPLETION: Yellow : [#enum Color#]Yellow
|
||||
|
|
|
@ -10,14 +10,14 @@ void foo() {
|
|||
// CHECK-CC1-NEXT: COMPLETION: class
|
||||
// CHECK-CC1-NEXT: COMPLETION: const
|
||||
// CHECK-CC1-NEXT: COMPLETION: Pattern : const_cast<<#type#>>(<#expression#>)
|
||||
// CHECK-CC1: COMPLETION: Pattern : delete <#expression#>
|
||||
// CHECK-CC1-NEXT: COMPLETION: Pattern : delete [] <#expression#>
|
||||
// CHECK-CC1: COMPLETION: Pattern : [#void#]delete <#expression#>
|
||||
// CHECK-CC1-NEXT: COMPLETION: Pattern : [#void#]delete [] <#expression#>
|
||||
// CHECK-CC1-NEXT: COMPLETION: Pattern : do{<#statements#>
|
||||
// CHECK-CC1: COMPLETION: double
|
||||
// CHECK-CC1-NEXT: COMPLETION: Pattern : dynamic_cast<<#type#>>(<#expression#>)
|
||||
// CHECK-CC1-NEXT: COMPLETION: enum
|
||||
// CHECK-CC1-NEXT: COMPLETION: extern
|
||||
// CHECK-CC1-NEXT: COMPLETION: false
|
||||
// CHECK-CC1-NEXT: COMPLETION: Pattern : [#bool#]false
|
||||
// CHECK-CC1-NEXT: COMPLETION: float
|
||||
// CHECK-CC1-NEXT: COMPLETION: foo : [#void#]foo()
|
||||
// CHECK-CC1-NEXT: COMPLETION: Pattern : for(<#init-statement#>;<#condition#>;<#inc-expression#>){
|
||||
|
@ -32,18 +32,18 @@ void foo() {
|
|||
// CHECK-CC1-NEXT: COMPLETION: Pattern : return
|
||||
// CHECK-CC1-NEXT: COMPLETION: short
|
||||
// CHECK-CC1-NEXT: COMPLETION: signed
|
||||
// CHECK-CC1-NEXT: COMPLETION: Pattern : sizeof(<#expression-or-type#>)
|
||||
// CHECK-CC1-NEXT: COMPLETION: Pattern : [#size_t#]sizeof(<#expression-or-type#>)
|
||||
// CHECK-CC1-NEXT: COMPLETION: static
|
||||
// CHECK-CC1-NEXT: COMPLETION: Pattern : static_cast<<#type#>>(<#expression#>)
|
||||
// CHECK-CC1-NEXT: COMPLETION: struct
|
||||
// CHECK-CC1-NEXT: COMPLETION: Pattern : switch(<#condition#>){
|
||||
// CHECK-CC1: COMPLETION: t : t
|
||||
// CHECK-CC1-NEXT: COMPLETION: Pattern : throw <#expression#>
|
||||
// CHECK-CC1-NEXT: COMPLETION: true
|
||||
// CHECK-CC1-NEXT: COMPLETION: Pattern : [#void#]throw <#expression#>
|
||||
// CHECK-CC1-NEXT: COMPLETION: Pattern : [#bool#]true
|
||||
// CHECK-CC1-NEXT: COMPLETION: Pattern : try{<#statements#>
|
||||
// CHECK-CC1: COMPLETION: TYPEDEF : TYPEDEF
|
||||
// CHECK-CC1-NEXT: COMPLETION: Pattern : typedef <#type#> <#name#>
|
||||
// CHECK-CC1-NEXT: COMPLETION: Pattern : typeid(<#expression-or-type#>)
|
||||
// CHECK-CC1-NEXT: COMPLETION: Pattern : [#std::type_info#]typeid(<#expression-or-type#>)
|
||||
// CHECK-CC1-NEXT: COMPLETION: Pattern : typename <#qualifier#>::<#name#>
|
||||
// CHECK-CC1-NEXT: COMPLETION: Pattern : typeof <#expression#>
|
||||
// CHECK-CC1-NEXT: COMPLETION: Pattern : typeof(<#type#>)
|
||||
|
@ -138,12 +138,12 @@ void foo() {
|
|||
// CHECK-CC4-NEXT: COMPLETION: class
|
||||
// CHECK-CC4-NEXT: COMPLETION: const
|
||||
// CHECK-CC4-NEXT: COMPLETION: Pattern : const_cast<<#type#>>(<#expression#>)
|
||||
// CHECK-CC4-NEXT: COMPLETION: Pattern : delete <#expression#>
|
||||
// CHECK-CC4-NEXT: COMPLETION: Pattern : delete [] <#expression#>
|
||||
// CHECK-CC4-NEXT: COMPLETION: Pattern : [#void#]delete <#expression#>
|
||||
// CHECK-CC4-NEXT: COMPLETION: Pattern : [#void#]delete [] <#expression#>
|
||||
// CHECK-CC4-NEXT: COMPLETION: double
|
||||
// CHECK-CC4-NEXT: COMPLETION: Pattern : dynamic_cast<<#type#>>(<#expression#>)
|
||||
// CHECK-CC4-NEXT: COMPLETION: enum
|
||||
// CHECK-CC4-NEXT: COMPLETION: false
|
||||
// CHECK-CC4-NEXT: COMPLETION: Pattern : [#bool#]false
|
||||
// CHECK-CC4-NEXT: COMPLETION: float
|
||||
// CHECK-CC4-NEXT: COMPLETION: foo : [#void#]foo()
|
||||
// CHECK-CC4-NEXT: COMPLETION: int
|
||||
|
@ -154,14 +154,14 @@ void foo() {
|
|||
// CHECK-CC4-NEXT: COMPLETION: Pattern : reinterpret_cast<<#type#>>(<#expression#>)
|
||||
// CHECK-CC4-NEXT: COMPLETION: short
|
||||
// CHECK-CC4-NEXT: COMPLETION: signed
|
||||
// CHECK-CC4-NEXT: COMPLETION: Pattern : sizeof(<#expression-or-type#>)
|
||||
// CHECK-CC4-NEXT: COMPLETION: Pattern : [#size_t#]sizeof(<#expression-or-type#>)
|
||||
// CHECK-CC4-NEXT: COMPLETION: Pattern : static_cast<<#type#>>(<#expression#>)
|
||||
// CHECK-CC4-NEXT: COMPLETION: struct
|
||||
// CHECK-CC4-NEXT: COMPLETION: t : t
|
||||
// CHECK-CC4-NEXT: COMPLETION: Pattern : throw <#expression#>
|
||||
// CHECK-CC4-NEXT: COMPLETION: true
|
||||
// CHECK-CC4-NEXT: COMPLETION: Pattern : [#void#]throw <#expression#>
|
||||
// CHECK-CC4-NEXT: COMPLETION: Pattern : [#bool#]true
|
||||
// CHECK-CC4-NEXT: COMPLETION: TYPEDEF : TYPEDEF
|
||||
// CHECK-CC4-NEXT: COMPLETION: Pattern : typeid(<#expression-or-type#>)
|
||||
// CHECK-CC4-NEXT: COMPLETION: Pattern : [#std::type_info#]typeid(<#expression-or-type#>)
|
||||
// CHECK-CC4-NEXT: COMPLETION: Pattern : typename <#qualifier#>::<#name#>
|
||||
// CHECK-CC4-NEXT: COMPLETION: Pattern : typeof <#expression#>
|
||||
// CHECK-CC4-NEXT: COMPLETION: Pattern : typeof(<#type#>)
|
||||
|
@ -180,14 +180,14 @@ void foo() {
|
|||
// CHECK-NO-RTTI-NEXT: COMPLETION: class
|
||||
// CHECK-NO-RTTI-NEXT: COMPLETION: const
|
||||
// CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : const_cast<<#type#>>(<#expression#>)
|
||||
// CHECK-NO-RTTI: COMPLETION: Pattern : delete <#expression#>
|
||||
// CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : delete [] <#expression#>
|
||||
// CHECK-NO-RTTI: COMPLETION: Pattern : [#void#]delete <#expression#>
|
||||
// CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : [#void#]delete [] <#expression#>
|
||||
// CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : do{<#statements#>
|
||||
// CHECK-NO-RTTI: COMPLETION: double
|
||||
// CHECK-NO-RTTI-NOT: dynamic_cast
|
||||
// CHECK-NO-RTTI: COMPLETION: enum
|
||||
// CHECK-NO-RTTI-NEXT: COMPLETION: extern
|
||||
// CHECK-NO-RTTI-NEXT: COMPLETION: false
|
||||
// CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : [#bool#]false
|
||||
// CHECK-NO-RTTI-NEXT: COMPLETION: float
|
||||
// CHECK-NO-RTTI-NEXT: COMPLETION: foo : [#void#]foo()
|
||||
// CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : for(<#init-statement#>;<#condition#>;<#inc-expression#>){
|
||||
|
@ -202,14 +202,14 @@ void foo() {
|
|||
// CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : return
|
||||
// CHECK-NO-RTTI-NEXT: COMPLETION: short
|
||||
// CHECK-NO-RTTI-NEXT: COMPLETION: signed
|
||||
// CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : sizeof(<#expression-or-type#>)
|
||||
// CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : [#size_t#]sizeof(<#expression-or-type#>)
|
||||
// CHECK-NO-RTTI-NEXT: COMPLETION: static
|
||||
// CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : static_cast<<#type#>>(<#expression#>)
|
||||
// CHECK-NO-RTTI-NEXT: COMPLETION: struct
|
||||
// CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : switch(<#condition#>){
|
||||
// CHECK-NO-RTTI: COMPLETION: t : t
|
||||
// CHECK-NO-RTTI-NOT: throw
|
||||
// CHECK-NO-RTTI: COMPLETION: true
|
||||
// CHECK-NO-RTTI: COMPLETION: Pattern : [#bool#]true
|
||||
// CHECK-NO-RTTI-NOT: try
|
||||
// CHECK-NO-RTTI: COMPLETION: TYPEDEF : TYPEDEF
|
||||
// CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : typedef <#type#> <#name#>
|
||||
|
|
|
@ -31,9 +31,9 @@ void f() {
|
|||
// CHECK-CC2: {TypedText protocol}{LeftParen (}{Placeholder protocol-name}{RightParen )}
|
||||
// CHECK-CC2: {TypedText selector}{LeftParen (}{Placeholder selector}{RightParen )}
|
||||
// RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:9:3 %s | FileCheck -check-prefix=CHECK-CC3 %s
|
||||
// CHECK-CC3: NotImplemented:{TypedText @encode}{LeftParen (}{Placeholder type-name}{RightParen )}
|
||||
// CHECK-CC3: NotImplemented:{TypedText @protocol}{LeftParen (}{Placeholder protocol-name}{RightParen )}
|
||||
// CHECK-CC3: NotImplemented:{TypedText @selector}{LeftParen (}{Placeholder selector}{RightParen )}
|
||||
// CHECK-CC3: NotImplemented:{ResultType char[]}{TypedText @encode}{LeftParen (}{Placeholder type-name}{RightParen )}
|
||||
// CHECK-CC3: NotImplemented:{ResultType Protocol *}{TypedText @protocol}{LeftParen (}{Placeholder protocol-name}{RightParen )}
|
||||
// CHECK-CC3: NotImplemented:{ResultType SEL}{TypedText @selector}{LeftParen (}{Placeholder selector}{RightParen )}
|
||||
// CHECK-CC3: NotImplemented:{TypedText @synchronized}{HorizontalSpace }{LeftParen (}{Placeholder expression}{RightParen )}{LeftBrace {}{Placeholder statements}{RightBrace }}
|
||||
// CHECK-CC3: NotImplemented:{TypedText @throw}{HorizontalSpace }{Placeholder expression}
|
||||
// CHECK-CC3: NotImplemented:{TypedText @try}{LeftBrace {}{Placeholder statements}{RightBrace }}{Text @catch}{LeftParen (}{Placeholder parameter}{RightParen )}{LeftBrace {}{Placeholder statements}{RightBrace }}{Text @finally}{LeftBrace {}{Placeholder statements}{RightBrace }}
|
||||
|
|
|
@ -39,12 +39,12 @@
|
|||
// CHECK-CC3-NOT: VarDecl:{ResultType int}{TypedText q2}
|
||||
// CHECK-CC3-NOT: VarDecl:{ResultType id}{TypedText q}
|
||||
// CHECK-CC3: NotImplemented:{ResultType A *}{TypedText self} (34)
|
||||
// CHECK-CC3: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40)
|
||||
// CHECK-CC3: NotImplemented:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40)
|
||||
// RUN: c-index-test -code-completion-at=%s:15:15 %s | FileCheck -check-prefix=CHECK-CC4 %s
|
||||
// CHECK-CC4: ParmDecl:{ResultType id}{TypedText param1} (34)
|
||||
// CHECK-CC4-NOT: VarDecl:{ResultType int}{TypedText q2}
|
||||
// CHECK-CC4: NotImplemented:{ResultType A *}{TypedText self} (34)
|
||||
// CHECK-CC4: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40)
|
||||
// CHECK-CC4: NotImplemented:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40)
|
||||
// RUN: c-index-test -code-completion-at=%s:23:10 %s | FileCheck -check-prefix=CHECK-CC5 %s
|
||||
// CHECK-CC5: NotImplemented:{TypedText _Bool} (50)
|
||||
// CHECK-CC5: NotImplemented:{TypedText _Complex} (50)
|
||||
|
|
|
@ -31,7 +31,7 @@ void f5(float f) {
|
|||
// CHECK-CC1: FunctionDecl:{ResultType int}{TypedText f}{LeftParen (}{Placeholder int}{RightParen )} (12) (unavailable)
|
||||
// CHECK-CC1-NOT: NotImplemented:{TypedText float} (65)
|
||||
// CHECK-CC1: ParmDecl:{ResultType int}{TypedText j} (8)
|
||||
// CHECK-CC1: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40)
|
||||
// CHECK-CC1: NotImplemented:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40)
|
||||
// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:7:9 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC1 %s
|
||||
// RUN: c-index-test -code-completion-at=%s:7:14 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC3 %s
|
||||
// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:7:14 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC3 %s
|
||||
|
@ -39,7 +39,7 @@ void f5(float f) {
|
|||
// CHECK-CC3: FunctionDecl:{ResultType int}{TypedText f}{LeftParen (}{Placeholder int}{RightParen )} (50)
|
||||
// CHECK-CC3-NOT: NotImplemented:{TypedText float}
|
||||
// CHECK-CC3: ParmDecl:{ResultType int}{TypedText j} (34)
|
||||
// CHECK-CC3: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expressio
|
||||
// CHECK-CC3: NotImplemented:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expressio
|
||||
|
||||
// RUN: c-index-test -code-completion-at=%s:7:18 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC3 %s
|
||||
// RUN: c-index-test -code-completion-at=%s:7:22 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC3 %s
|
||||
|
@ -48,7 +48,7 @@ void f5(float f) {
|
|||
// CHECK-CC2: FunctionDecl:{ResultType int}{TypedText f}{LeftParen (}{Placeholder int}{RightParen )} (50)
|
||||
// CHECK-CC2: NotImplemented:{TypedText float} (50)
|
||||
// CHECK-CC2: ParmDecl:{ResultType int}{TypedText j} (34)
|
||||
// CHECK-CC2: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40)
|
||||
// CHECK-CC2: NotImplemented:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40)
|
||||
// RUN: c-index-test -code-completion-at=%s:11:16 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC4 %s
|
||||
// CHECK-CC4: FunctionDecl:{ResultType int}{TypedText f}{LeftParen (}{Placeholder int}{RightParen )} (50)
|
||||
// CHECK-CC4: VarDecl:{ResultType struct X}{TypedText f1} (50) (deprecated)
|
||||
|
|
|
@ -28,9 +28,9 @@ void g() {
|
|||
|
||||
// RUN: c-index-test -code-completion-at=%s:20:2 %s -std=c++0x | FileCheck -check-prefix=CHECK-CC1 %s
|
||||
// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:20:2 -std=c++0x %s | FileCheck -check-prefix=CHECK-CC1 %s
|
||||
// CHECK-CC1: NotImplemented:{TypedText alignof}{LeftParen (}{Placeholder type}{RightParen )} (40)
|
||||
// CHECK-CC1: NotImplemented:{TypedText noexcept}{LeftParen (}{Placeholder expression}{RightParen )} (40)
|
||||
// CHECK-CC1: NotImplemented:{TypedText nullptr} (40)
|
||||
// CHECK-CC1: NotImplemented:{ResultType size_t}{TypedText alignof}{LeftParen (}{Placeholder type}{RightParen )} (40)
|
||||
// CHECK-CC1: NotImplemented:{ResultType bool}{TypedText noexcept}{LeftParen (}{Placeholder expression}{RightParen )} (40)
|
||||
// CHECK-CC1: NotImplemented:{ResultType std::nullptr_t}{TypedText nullptr} (40)
|
||||
// CHECK-CC1: NotImplemented:{TypedText operator} (40)
|
||||
// CHECK-CC1-NOT: push_back
|
||||
// CHECK-CC1: ClassDecl:{TypedText string} (50)
|
||||
|
@ -54,3 +54,6 @@ void g() {
|
|||
// CHECK-CC3: ClassTemplate:{TypedText vector}{LeftAngle <}{Placeholder typename T}{RightAngle >} (50)
|
||||
// CHECK-CC3: CXXConstructor:{TypedText vector}{LeftAngle <}{Placeholder typename T}{RightAngle >}{LeftParen (}{Placeholder const T &}{Comma , }{Placeholder unsigned int n}{RightParen )} (50)
|
||||
// CHECK-CC3: FunctionTemplate:{ResultType void}{TypedText vector}{LeftAngle <}{Placeholder typename T}{RightAngle >}{LeftParen (}{Placeholder InputIterator first}{Comma , }{Placeholder InputIterator last}{RightParen )} (50)
|
||||
|
||||
// RUN: c-index-test -code-completion-at=%s:18:60 %s -std=c++0x | FileCheck -check-prefix=CHECK-CC4 %s
|
||||
// CHECK-CC4: NotImplemented:{ResultType vector<T> *}{TypedText this} (40)
|
||||
|
|
|
@ -26,7 +26,7 @@ __strong id global;
|
|||
// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:14:7 %s | FileCheck -check-prefix=CHECK-CC2 %s
|
||||
// CHECK-CC2: TypedefDecl:{TypedText BOOL} (50)
|
||||
// CHECK-CC2: NotImplemented:{TypedText char} (50)
|
||||
// CHECK-CC2: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40)
|
||||
// CHECK-CC2: NotImplemented:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40)
|
||||
// RUN: c-index-test -code-completion-at=%s:15:1 -fobjc-arc -fobjc-nonfragile-abi %s | FileCheck -check-prefix=CHECK-CC3 %s
|
||||
// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:15:1 -fobjc-arc -fobjc-nonfragile-abi %s | FileCheck -check-prefix=CHECK-CC3 %s
|
||||
// CHECK-CC3: FunctionDecl:{ResultType void}{TypedText foo}{LeftParen (}{Placeholder ^bool(id x, A *y)block}{RightParen )} (34)
|
||||
|
|
|
@ -18,16 +18,16 @@
|
|||
|
||||
// RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:9:20 %s 2>%t | FileCheck -check-prefix=CHECK-CC1 %s
|
||||
// RUN: not grep error %t
|
||||
// CHECK-CC1: NotImplemented:{TypedText @encode}{LeftParen (}{Placeholder type-name}{RightParen )}
|
||||
// CHECK-CC1: NotImplemented:{ResultType char[]}{TypedText @encode}{LeftParen (}{Placeholder type-name}{RightParen )}
|
||||
// CHECK-CC1-NOT: NotImplemented:{TypedText _Bool}
|
||||
// CHECK-CC1: VarDecl:{ResultType A *}{TypedText a}
|
||||
// CHECK-CC1: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )}
|
||||
// CHECK-CC1: NotImplemented:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )}
|
||||
|
||||
// RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:10:24 %s | FileCheck -check-prefix=CHECK-CC2 %s
|
||||
// CHECK-CC2: NotImplemented:{TypedText @encode}{LeftParen (}{Placeholder type-name}{RightParen )}
|
||||
// CHECK-CC2: NotImplemented:{ResultType char[]}{TypedText @encode}{LeftParen (}{Placeholder type-name}{RightParen )}
|
||||
// CHECK-CC2: NotImplemented:{TypedText _Bool}
|
||||
// CHECK-CC2: VarDecl:{ResultType A *}{TypedText a}
|
||||
// CHECK-CC2: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )}
|
||||
// CHECK-CC2: NotImplemented:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )}
|
||||
// RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:12:11 %s | FileCheck -check-prefix=CHECK-CC3 %s
|
||||
// CHECK-CC3: ObjCInstanceMethodDecl:{ResultType void}{TypedText method:}{Placeholder (int)} (32)
|
||||
// RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:13:22 %s | FileCheck -check-prefix=CHECK-CC3 %s
|
||||
|
|
|
@ -44,7 +44,7 @@ void test2(A *a) {
|
|||
// CHECK-CC1: EnumConstantDecl:{ResultType enum Priority}{TypedText Low} (32)
|
||||
// CHECK-CC1: ParmDecl:{ResultType enum Priority}{TypedText priority} (17)
|
||||
// CHECK-CC1: EnumConstantDecl:{ResultType enum Color}{TypedText Red} (32)
|
||||
// CHECK-CC1: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40)
|
||||
// CHECK-CC1: NotImplemented:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40)
|
||||
// CHECK-CC1: FunctionDecl:{ResultType enum Priority}{TypedText test1}{LeftParen (}{Placeholder enum Priority priority}{Comma , }{Placeholder enum Color color}{Comma , }{Placeholder int integer}{RightParen )} (25)
|
||||
// RUN: c-index-test -code-completion-at=%s:17:18 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC2 %s
|
||||
// CHECK-CC2: EnumConstantDecl:{ResultType enum Color}{TypedText Blue} (16)
|
||||
|
@ -59,7 +59,7 @@ void test2(A *a) {
|
|||
// CHECK-CC2: EnumConstantDecl:{ResultType enum Priority}{TypedText Low} (65)
|
||||
// CHECK-CC2: ParmDecl:{ResultType enum Priority}{TypedText priority} (34)
|
||||
// CHECK-CC2: EnumConstantDecl:{ResultType enum Color}{TypedText Red} (16)
|
||||
// CHECK-CC2: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40)
|
||||
// CHECK-CC2: NotImplemented:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40)
|
||||
// CHECK-CC2: FunctionDecl:{ResultType enum Priority}{TypedText test1}{LeftParen (}{Placeholder enum Priority priority}{Comma , }{Placeholder enum Color color}{Comma , }{Placeholder int integer}{RightParen )} (50)
|
||||
// RUN: c-index-test -code-completion-at=%s:18:10 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC3 %s
|
||||
// CHECK-CC3: EnumConstantDecl:{ResultType enum Color}{TypedText Blue} (65)
|
||||
|
@ -75,7 +75,7 @@ void test2(A *a) {
|
|||
// CHECK-CC3: EnumConstantDecl:{ResultType enum Priority}{TypedText Low} (16)
|
||||
// CHECK-CC3: ParmDecl:{ResultType enum Priority}{TypedText priority} (8)
|
||||
// CHECK-CC3: EnumConstantDecl:{ResultType enum Color}{TypedText Red} (65)
|
||||
// CHECK-CC3: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40)
|
||||
// CHECK-CC3: NotImplemented:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40)
|
||||
// CHECK-CC3: FunctionDecl:{ResultType enum Priority}{TypedText test1}{LeftParen (}{Placeholder enum Priority priority}{Comma , }{Placeholder enum Color color}{Comma , }{Placeholder int integer}{RightParen )} (12)
|
||||
// RUN: c-index-test -code-completion-at=%s:19:9 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC4 %s
|
||||
// CHECK-CC4: EnumConstantDecl:{ResultType enum Color}{TypedText Blue} (16)
|
||||
|
@ -91,7 +91,7 @@ void test2(A *a) {
|
|||
// CHECK-CC4: EnumConstantDecl:{ResultType enum Priority}{TypedText Low} (65)
|
||||
// CHECK-CC4: ParmDecl:{ResultType enum Priority}{TypedText priority} (34)
|
||||
// CHECK-CC4: EnumConstantDecl:{ResultType enum Color}{TypedText Red} (16)
|
||||
// CHECK-CC4: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40)
|
||||
// CHECK-CC4: NotImplemented:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40)
|
||||
// CHECK-CC4: FunctionDecl:{ResultType enum Priority}{TypedText test1}{LeftParen (}{Placeholder enum Priority priority}{Comma , }{Placeholder enum Color color}{Comma , }{Placeholder int integer}{RightParen )} (50)
|
||||
// RUN: c-index-test -code-completion-at=%s:21:9 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC4 %s
|
||||
// RUN: c-index-test -code-completion-at=%s:22:7 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC6 %s
|
||||
|
@ -109,7 +109,7 @@ void test2(A *a) {
|
|||
// CHECK-CC6: EnumConstantDecl:{ResultType enum Priority}{TypedText Low} (65)
|
||||
// CHECK-CC6: ParmDecl:{ResultType enum Priority}{TypedText priority} (34)
|
||||
// CHECK-CC6: EnumConstantDecl:{ResultType enum Color}{TypedText Red} (16)
|
||||
// CHECK-CC6: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40)
|
||||
// CHECK-CC6: NotImplemented:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40)
|
||||
// CHECK-CC6: FunctionDecl:{ResultType enum Priority}{TypedText test1}{LeftParen (}{Placeholder enum Priority priority}{Comma , }{Placeholder enum Color color}{Comma , }{Placeholder int integer}{RightParen )} (50)
|
||||
// RUN: c-index-test -code-completion-at=%s:31:13 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC7 %s
|
||||
// RUN: c-index-test -code-completion-at=%s:32:13 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC7 %s
|
||||
|
|
Loading…
Reference in New Issue