/**
* \brief A comma separator (',').
*/
- CXCompletionChunk_Comma
+ CXCompletionChunk_Comma,
+ /**
+ * \brief Text that specifies the result type of a given result.
+ *
+ * This special kind of informative chunk is not meant to be inserted into
+ * the text buffer. Rather, it is meant to illustrate the type that an
+ * expression using the given completion string would have.
+ */
+ CXCompletionChunk_ResultType
};
/**
/// \brief A piece of text that describes something about the result but
/// should not be inserted into the buffer.
CK_Informative,
+ /// \brief A piece of text that describes the type of an entity or, for
+ /// functions and methods, the return type.
+ CK_ResultType,
/// \brief A piece of text that describes the parameter that corresponds
/// to the code-completion location within a function call, message send,
/// macro invocation, etc.
/// \brief Create a new informative chunk.
static Chunk CreateInformative(llvm::StringRef Informative);
+ /// \brief Create a new result type chunk.
+ static Chunk CreateResultType(llvm::StringRef ResultType);
+
/// \brief Create a new current-parameter chunk.
static Chunk CreateCurrentParameter(llvm::StringRef CurrentParameter);
Chunks.push_back(Chunk::CreateInformative(Text));
}
+ /// \brief Add a new result-type chunk.
+ /// The text will be copied.
+ void AddResultTypeChunk(llvm::StringRef ResultType) {
+ Chunks.push_back(Chunk::CreateResultType(ResultType));
+ }
+
/// \brief Add a new current-parameter chunk.
/// The text will be copied.
void AddCurrentParameterChunk(llvm::StringRef CurrentParameter) {
case CK_Text:
case CK_Placeholder:
case CK_Informative:
+ case CK_ResultType:
case CK_CurrentParameter: {
char *New = new char [Text.size() + 1];
std::memcpy(New, Text.data(), Text.size());
return Chunk(CK_Informative, Informative);
}
+CodeCompletionString::Chunk
+CodeCompletionString::Chunk::CreateResultType(StringRef ResultType) {
+ return Chunk(CK_ResultType, ResultType);
+}
+
CodeCompletionString::Chunk
CodeCompletionString::Chunk::CreateCurrentParameter(
StringRef CurrentParameter) {
case CK_Text:
case CK_Placeholder:
case CK_Informative:
+ case CK_ResultType:
case CK_CurrentParameter:
case CK_LeftParen:
case CK_RightParen:
case CK_Text:
case CK_Placeholder:
case CK_Informative:
+ case CK_ResultType:
case CK_CurrentParameter:
delete [] Text;
break;
switch (C->Kind) {
case CK_Optional: OS << "{#" << C->Optional->getAsString() << "#}"; break;
case CK_Placeholder: OS << "<#" << C->Text << "#>"; break;
- case CK_Informative: OS << "[#" << C->Text << "#]"; break;
+
+ case CK_Informative:
+ case CK_ResultType:
+ OS << "[#" << C->Text << "#]";
+ break;
+
case CK_CurrentParameter: OS << "<#" << C->Text << "#>"; break;
default: OS << C->Text; break;
}
case CK_Text:
case CK_Placeholder:
case CK_Informative:
+ case CK_ResultType:
case CK_CurrentParameter: {
const char *Text = C->Text;
unsigned StrLen = strlen(Text);
case CK_Text:
case CK_Placeholder:
case CK_Informative:
+ case CK_ResultType:
case CK_CurrentParameter: {
unsigned StrLen;
if (ReadUnsigned(Str, StrEnd, StrLen) || (Str + StrLen > StrEnd))
}
}
+/// \brief If the given declaration has an associated type, add it as a result
+/// type chunk.
+static void AddResultTypeChunk(ASTContext &Context,
+ NamedDecl *ND,
+ CodeCompletionString *Result) {
+ if (!ND)
+ return;
+
+ // Determine the type of the declaration (if it has a type).
+ QualType T;
+ if (FunctionDecl *Function = dyn_cast<FunctionDecl>(ND))
+ T = Function->getResultType();
+ else if (ObjCMethodDecl *Method = dyn_cast<ObjCMethodDecl>(ND))
+ T = Method->getResultType();
+ else if (FunctionTemplateDecl *FunTmpl = dyn_cast<FunctionTemplateDecl>(ND))
+ T = FunTmpl->getTemplatedDecl()->getResultType();
+ else if (EnumConstantDecl *Enumerator = dyn_cast<EnumConstantDecl>(ND))
+ T = Context.getTypeDeclType(cast<TypeDecl>(Enumerator->getDeclContext()));
+ else if (isa<UnresolvedUsingValueDecl>(ND)) {
+ /* Do nothing: ignore unresolved using declarations*/
+ } else if (ValueDecl *Value = dyn_cast<ValueDecl>(ND))
+ T = Value->getType();
+ else if (ObjCPropertyDecl *Property = dyn_cast<ObjCPropertyDecl>(ND))
+ T = Property->getType();
+
+ if (T.isNull() || Context.hasSameType(T, Context.DependentTy))
+ return;
+
+ std::string TypeStr;
+ T.getAsStringInternal(TypeStr, Context.PrintingPolicy);
+ Result->AddResultTypeChunk(TypeStr);
+}
+
/// \brief Add function parameter chunks to the given code completion string.
static void AddFunctionParameterChunks(ASTContext &Context,
FunctionDecl *Function,
return Result;
}
+ AddResultTypeChunk(S.Context, ND, Result);
+
if (FunctionDecl *Function = dyn_cast<FunctionDecl>(ND)) {
AddQualifierToCompletionString(Result, Qualifier, QualifierIsInformative,
S.Context);
CodeCompletionString *Result = new CodeCompletionString;
FunctionDecl *FDecl = getFunction();
+ AddResultTypeChunk(S.Context, FDecl, Result);
const FunctionProtoType *Proto
= dyn_cast<FunctionProtoType>(getFunctionType());
if (!FDecl && !Proto) {
switch (color) {
case
// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:23:8 %s -o - | FileCheck -check-prefix=CC1 %s
- // CHECK-CC1: Blue : 0 : N::C::Blue
- // CHECK-CC1-NEXT: Green : 0 : N::C::Green
- // CHECK-CC1-NEXT: Indigo : 0 : N::C::Indigo
- // CHECK-CC1-NEXT: Orange : 0 : N::C::Orange
- // CHECK-CC1-NEXT: Red : 0 : N::C::Red
- // CHECK-CC1-NEXT: Violet : 0 : N::C::Violet
- // CHECK-CC1: Yellow : 0 : N::C::Yellow
+ // CHECK-CC1: Blue : 0 : [#enum M::N::C::Color#]N::C::Blue
+ // CHECK-CC1-NEXT: Green : 0 : [#enum M::N::C::Color#]N::C::Green
+ // CHECK-CC1-NEXT: Indigo : 0 : [#enum M::N::C::Color#]N::C::Indigo
+ // CHECK-CC1-NEXT: Orange : 0 : [#enum M::N::C::Color#]N::C::Orange
+ // CHECK-CC1-NEXT: Red : 0 : [#enum M::N::C::Color#]N::C::Red
+ // CHECK-CC1-NEXT: Violet : 0 : [#enum M::N::C::Color#]N::C::Violet
+ // CHECK-CC1: Yellow : 0 : [#enum M::N::C::Color#]N::C::Yellow
case
// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:21:8 %s -o - | FileCheck -check-prefix=CC1 %s
- // CHECK-CC1: Blue : 0 : N::Blue
- // CHECK-CC1-NEXT: Green : 0 : N::Green
- // CHECK-CC1-NEXT: Indigo : 0 : N::Indigo
- // CHECK-CC1-NEXT: Orange : 0 : N::Orange
- // CHECK-CC1-NEXT: Violet : 0 : N::Violet
+ // CHECK-CC1: Blue : 0 : [#enum N::Color#]N::Blue
+ // CHECK-CC1-NEXT: Green : 0 : [#enum N::Color#]N::Green
+ // CHECK-CC1-NEXT: Indigo : 0 : [#enum N::Color#]N::Indigo
+ // CHECK-CC1-NEXT: Orange : 0 : [#enum N::Color#]N::Orange
+ // CHECK-CC1-NEXT: Violet : 0 : [#enum N::Color#]N::Violet
void test(const Proxy &p) {
p->
// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:29:6 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
- // CHECK-CC1: member1 : 0 : [#Base1::#]member1
- // CHECK-CC1: member1 : 0 : [#Base2::#]member1
- // CHECK-CC1: member2 : 0 : [#Base1::#]member2
+ // CHECK-CC1: member1 : 0 : [#int#][#Base1::#]member1
+ // CHECK-CC1: member1 : 0 : [#int#][#Base2::#]member1
+ // CHECK-CC1: member2 : 0 : [#float#][#Base1::#]member2
// CHECK-CC1: member3 : 0
// CHECK-CC1: member4 : 0
- // CHECK-CC1: memfun1 : 0 : [#Base3::#]memfun1(<#float#>)
- // CHECK-CC1: memfun1 : 0 : [#Base3::#]memfun1(<#double#>)[# const#]
- // CHECK-CC1: memfun2 : 0 : [#Base3::#]memfun2(<#int#>)
- // CHECK-CC1: memfun3 : 0 : memfun3(<#int#>)
- // CHECK-CC1: memfun1 : 0 (Hidden) : Base2::memfun1(<#int#>)
+ // CHECK-CC1: memfun1 : 0 : [#void#][#Base3::#]memfun1(<#float#>)
+ // CHECK-CC1: memfun1 : 0 : [#void#][#Base3::#]memfun1(<#double#>)[# const#]
+ // CHECK-CC1: memfun2 : 0 : [#void#][#Base3::#]memfun2(<#int#>)
+ // CHECK-CC1: memfun3 : 0 : [#int#]memfun3(<#int#>)
+ // CHECK-CC1: memfun1 : 0 (Hidden) : [#void#]Base2::memfun1(<#int#>)
// CHECK-CC1: Base1 : 3 : Base1::
overloaded(Z(), 0);
}
-// CHECK-MEMBER: FieldDecl:{TypedText member}
-// CHECK-MEMBER: FunctionDecl:{Informative Y::}{TypedText memfunc}{LeftParen (}{Optional {Placeholder int i}}{RightParen )}
-// CHECK-MEMBER: EnumConstantDecl:{Informative E::}{TypedText Val1}
-// CHECK-MEMBER: FunctionDecl:{Informative X::}{TypedText ~X}{LeftParen (}{RightParen )}
-// CHECK-MEMBER: FunctionDecl:{TypedText operator int}{LeftParen (}{RightParen )}
-// CHECK-MEMBER: FunctionDecl:{TypedText operator=}{LeftParen (}{Placeholder struct Z const &}{RightParen )}
-// CHECK-MEMBER: FieldDecl:{Text X::}{TypedText member}
-// CHECK-MEMBER: FieldDecl:{Text Y::}{TypedText member}
-// CHECK-MEMBER: FunctionDecl:{Text X::}{TypedText operator=}{LeftParen (}{Placeholder struct X const &}{RightParen )}
-// CHECK-MEMBER: FunctionDecl:{Text Y::}{TypedText operator=}{LeftParen (}{Placeholder struct Y const &}{RightParen )}
+// CHECK-MEMBER: FieldDecl:{ResultType double}{TypedText member}
+// CHECK-MEMBER: FunctionDecl:{ResultType void}{Informative Y::}{TypedText memfunc}{LeftParen (}{Optional {Placeholder int i}}{RightParen )}
+// CHECK-MEMBER: EnumConstantDecl:{ResultType enum X::E}{Informative E::}{TypedText Val1}
+// CHECK-MEMBER: FunctionDecl:{ResultType void}{Informative X::}{TypedText ~X}{LeftParen (}{RightParen )}
+// CHECK-MEMBER: FunctionDecl:{ResultType void}{Informative Y::}{TypedText ~Y}{LeftParen (}{RightParen )}
+// CHECK-MEMBER: FunctionDecl:{ResultType void}{TypedText ~Z}{LeftParen (}{RightParen )}
+// CHECK-MEMBER: FunctionDecl:{ResultType int}{TypedText operator int}{LeftParen (}{RightParen )}{Informative const}
+// CHECK-MEMBER: FunctionDecl:{ResultType struct Z &}{TypedText operator=}{LeftParen (}{Placeholder struct Z const &}{RightParen )}
+// CHECK-MEMBER: FieldDecl:{ResultType int}{Text X::}{TypedText member}
+// CHECK-MEMBER: FieldDecl:{ResultType float}{Text Y::}{TypedText member}
+// CHECK-MEMBER: FunctionDecl:{ResultType struct X &}{Text X::}{TypedText operator=}{LeftParen (}{Placeholder struct X const &}{RightParen )}
+// CHECK-MEMBER: FunctionDecl:{ResultType struct Y &}{Text Y::}{TypedText operator=}{LeftParen (}{Placeholder struct Y const &}{RightParen )}
// CHECK-MEMBER: StructDecl:{TypedText X}{Text ::}
// CHECK-MEMBER: StructDecl:{TypedText Y}{Text ::}
// CHECK-MEMBER: StructDecl:{TypedText Z}{Text ::}
-// CHECK-OVERLOAD: NotImplemented:{Text overloaded}{LeftParen (}{Text struct Z z}{Comma , }{CurrentParameter int second}{RightParen )}
-// CHECK-OVERLOAD: NotImplemented:{Text overloaded}{LeftParen (}{Text int i}{Comma , }{CurrentParameter long second}{RightParen )}
-// CHECK-OVERLOAD: NotImplemented:{Text overloaded}{LeftParen (}{Text float f}{Comma , }{CurrentParameter int second}{RightParen )}
+// CHECK-OVERLOAD: NotImplemented:{ResultType int &}{Text overloaded}{LeftParen (}{Text struct Z z}{Comma , }{CurrentParameter int second}{RightParen )}
+// CHECK-OVERLOAD: NotImplemented:{ResultType float &}{Text overloaded}{LeftParen (}{Text int i}{Comma , }{CurrentParameter long second}{RightParen )}
+// CHECK-OVERLOAD: NotImplemented:{ResultType double &}{Text overloaded}{LeftParen (}{Text float f}{Comma , }{CurrentParameter int second}{RightParen )}
}
// RUN: c-index-test -code-completion-at=%s:21:7 %s | FileCheck -check-prefix=CHECK-CC1 %s
-// CHECK-CC1: ObjCPropertyDecl:{TypedText prop1}
-// CHECK-CC1: ObjCPropertyDecl:{TypedText ProtoProp}
+// CHECK-CC1: ObjCPropertyDecl:{ResultType int}{TypedText prop1}
+// CHECK-CC1: ObjCPropertyDecl:{ResultType float}{TypedText ProtoProp}
// RUN: c-index-test -code-completion-at=%s:22:8 %s | FileCheck -check-prefix=CHECK-CC2 %s
-// CHECK-CC2: ObjCIvarDecl:{TypedText IVar}
-// CHECK-CC2: ObjCIvarDecl:{TypedText SuperIVar}
+// CHECK-CC2: ObjCIvarDecl:{ResultType int}{TypedText IVar}
+// CHECK-CC2: ObjCIvarDecl:{ResultType int}{TypedText SuperIVar}
// CHECK-CC2: {TypedText instanceMethod1}
// CHECK-CC2: {TypedText protocolInstanceMethod:}{Placeholder (int)value}
// RUN: c-index-test -code-completion-at=%s:61:16 %s | FileCheck -check-prefix=CHECK-CC3 %s
-// CHECK-CC3: ObjCClassMethodDecl:{TypedText MyClassMethod:}{Placeholder (id)obj}
-// CHECK-CC3: ObjCClassMethodDecl:{TypedText MyPrivateMethod}
+// CHECK-CC3: ObjCClassMethodDecl:{ResultType int}{TypedText MyClassMethod:}{Placeholder (id)obj}
+// CHECK-CC3: ObjCClassMethodDecl:{ResultType int}{TypedText MyPrivateMethod}
// RUN: c-index-test -code-completion-at=%s:65:16 %s | FileCheck -check-prefix=CHECK-CC4 %s
-// CHECK-CC4: ObjCInstanceMethodDecl:{TypedText MyInstMethod:}{Placeholder (id)x}{Text second:}{Placeholder (id)y}
-// CHECK-CC4: ObjCInstanceMethodDecl:{TypedText MyPrivateInstMethod}
+// CHECK-CC4: ObjCInstanceMethodDecl:{ResultType int}{TypedText MyInstMethod:}{Placeholder (id)x}{Text second:}{Placeholder (id)y}
+// CHECK-CC4: ObjCInstanceMethodDecl:{ResultType int}{TypedText MyPrivateInstMethod}
// RUN: c-index-test -code-completion-at=%s:74:9 %s | FileCheck -check-prefix=CHECK-CC5 %s
-// CHECK-CC5: ObjCInstanceMethodDecl:{TypedText MyInstMethod:}{Placeholder (id)x}{Text second:}{Placeholder (id)y}
-// CHECK-CC5: ObjCInstanceMethodDecl:{TypedText MySubInstMethod}
+// CHECK-CC5: ObjCInstanceMethodDecl:{ResultType int}{TypedText MyInstMethod:}{Placeholder (id)x}{Text second:}{Placeholder (id)y}
+// CHECK-CC5: ObjCInstanceMethodDecl:{ResultType int}{TypedText MySubInstMethod}
// RUN: c-index-test -code-completion-at=%s:82:8 %s | FileCheck -check-prefix=CHECK-CC6 %s
-// CHECK-CC6: ObjCInstanceMethodDecl:{TypedText protocolInstanceMethod:}{Placeholder (int)value}
-// CHECK-CC6: ObjCInstanceMethodDecl:{TypedText secondProtocolInstanceMethod}
+// CHECK-CC6: ObjCInstanceMethodDecl:{ResultType id}{TypedText protocolInstanceMethod:}{Placeholder (int)value}
+// CHECK-CC6: ObjCInstanceMethodDecl:{ResultType int}{TypedText secondProtocolInstanceMethod}
// RUN: c-index-test -code-completion-at=%s:95:8 %s | FileCheck -check-prefix=CHECK-CC7 %s
-// CHECK-CC7: ObjCInstanceMethodDecl:{TypedText Method}
-// CHECK-CC7: ObjCInstanceMethodDecl:{TypedText Method:}{Placeholder (int)i}
-// CHECK-CC7: ObjCInstanceMethodDecl:{TypedText Method:}{Placeholder (float)f}{Text Arg1:}{Placeholder (int)i1}{Text Arg2:}{Placeholder (int)i2}
-// CHECK-CC7: ObjCInstanceMethodDecl:{TypedText Method:}{Placeholder (float)f}{Text Arg1:}{Placeholder (int)i1}{Text OtherArg:}{Placeholder (id)obj}
-// CHECK-CC7: ObjCInstanceMethodDecl:{TypedText Method:}{Placeholder (float)f}{Text SomeArg:}{Placeholder (int)i1}{Text OtherArg:}{Placeholder (id)obj}
-// CHECK-CC7: ObjCInstanceMethodDecl:{TypedText OtherMethod:}{Placeholder (float)f}{Text Arg1:}{Placeholder (int)i1}{Text Arg2:}{Placeholder (int)i2}
+// CHECK-CC7: ObjCInstanceMethodDecl:{ResultType int}{TypedText Method}
+// CHECK-CC7: ObjCInstanceMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (int)i}
+// CHECK-CC7: ObjCInstanceMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (float)f}{Text Arg1:}{Placeholder (int)i1}{Text Arg2:}{Placeholder (int)i2}
+// CHECK-CC7: ObjCInstanceMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (float)f}{Text Arg1:}{Placeholder (int)i1}{Text OtherArg:}{Placeholder (id)obj}
+// CHECK-CC7: ObjCInstanceMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (float)f}{Text SomeArg:}{Placeholder (int)i1}{Text OtherArg:}{Placeholder (id)obj}
+// CHECK-CC7: ObjCInstanceMethodDecl:{ResultType int}{TypedText OtherMethod:}{Placeholder (float)f}{Text Arg1:}{Placeholder (int)i1}{Text Arg2:}{Placeholder (int)i2}
// RUN: c-index-test -code-completion-at=%s:95:17 %s | FileCheck -check-prefix=CHECK-CC8 %s
-// CHECK-CC8: ObjCInstanceMethodDecl:{Informative Method:}{TypedText }
-// CHECK-CC8: ObjCInstanceMethodDecl:{Informative Method:}{TypedText Arg1:}{Placeholder (int)i1}{Text Arg2:}{Placeholder (int)i2}
-// CHECK-CC8: ObjCInstanceMethodDecl:{Informative Method:}{TypedText Arg1:}{Placeholder (int)i1}{Text OtherArg:}{Placeholder (id)obj}
-// CHECK-CC8: ObjCInstanceMethodDecl:{Informative Method:}{TypedText SomeArg:}{Placeholder (int)i1}{Text OtherArg:}{Placeholder (id)obj}
+// CHECK-CC8: ObjCInstanceMethodDecl:{ResultType int}{Informative Method:}{TypedText }
+// CHECK-CC8: ObjCInstanceMethodDecl:{ResultType int}{Informative Method:}{TypedText Arg1:}{Placeholder (int)i1}{Text Arg2:}{Placeholder (int)i2}
+// CHECK-CC8: ObjCInstanceMethodDecl:{ResultType int}{Informative Method:}{TypedText Arg1:}{Placeholder (int)i1}{Text OtherArg:}{Placeholder (id)obj}
+// CHECK-CC8: ObjCInstanceMethodDecl:{ResultType int}{Informative Method:}{TypedText SomeArg:}{Placeholder (int)i1}{Text OtherArg:}{Placeholder (id)obj}
// RUN: c-index-test -code-completion-at=%s:95:24 %s | FileCheck -check-prefix=CHECK-CC9 %s
-// CHECK-CC9: ObjCInstanceMethodDecl:{Informative Method:}{Informative Arg1:}{TypedText Arg2:}{Placeholder (int)i2}
-// CHECK-CC9: ObjCInstanceMethodDecl:{Informative Method:}{Informative Arg1:}{TypedText OtherArg:}{Placeholder (id)obj}
+// CHECK-CC9: ObjCInstanceMethodDecl:{ResultType int}{Informative Method:}{Informative Arg1:}{TypedText Arg2:}{Placeholder (int)i2}
+// CHECK-CC9: ObjCInstanceMethodDecl:{ResultType int}{Informative Method:}{Informative Arg1:}{TypedText OtherArg:}{Placeholder (id)obj}
// RUN: c-index-test -code-completion-at=%s:61:11 %s | FileCheck -check-prefix=CHECK-CCA %s
-// CHECK-CCA: {TypedText _cmd}
-// CHECK-CCA: {TypedText self}
+// CHECK-CCA: {ResultType SEL}{TypedText _cmd}
+// CHECK-CCA: {ResultType Class}{TypedText self}
// CHECK-CCA: TypedefDecl:{TypedText Class}
// CHECK-CCA: ObjCInterfaceDecl:{TypedText Foo}
-// CHECK-CCA: FunctionDecl:{TypedText func}{LeftParen (}{RightParen )}
+// CHECK-CCA: FunctionDecl:{ResultType void}{TypedText func}{LeftParen (}{RightParen )}
// CHECK-CCA: TypedefDecl:{TypedText id}
// CHECK-CCA: ObjCInterfaceDecl:{TypedText MyClass}
// CHECK-CCA: ObjCInterfaceDecl:{TypedText MySubClass}
@end
// RUN: c-index-test -code-completion-at=%s:20:13 %s | FileCheck -check-prefix=CHECK-CC1 %s
-// CHECK-CC1: ObjCPropertyDecl:{TypedText Prop0}
-// CHECK-CC1: ObjCPropertyDecl:{TypedText Prop1}
-// CHECK-CC1: ObjCPropertyDecl:{TypedText Prop2}
-// CHECK-CC1: ObjCPropertyDecl:{TypedText Prop3}
-// CHECK-CC1: ObjCPropertyDecl:{TypedText Prop4}
+// CHECK-CC1: ObjCPropertyDecl:{ResultType int}{TypedText Prop0}
+// CHECK-CC1: ObjCPropertyDecl:{ResultType int}{TypedText Prop1}
+// CHECK-CC1: ObjCPropertyDecl:{ResultType float}{TypedText Prop2}
+// CHECK-CC1: ObjCPropertyDecl:{ResultType id}{TypedText Prop3}
+// CHECK-CC1: ObjCPropertyDecl:{ResultType id}{TypedText Prop4}
// RUN: c-index-test -code-completion-at=%s:20:20 %s | FileCheck -check-prefix=CHECK-CC2 %s
-// CHECK-CC2: ObjCPropertyDecl:{TypedText Prop0}
-// CHECK-CC2: ObjCPropertyDecl:{TypedText Prop1}
-// CHECK-CC2-NEXT: ObjCPropertyDecl:{TypedText Prop3}
-// CHECK-CC2: ObjCPropertyDecl:{TypedText Prop4}
+// CHECK-CC2: ObjCPropertyDecl:{ResultType int}{TypedText Prop0}
+// CHECK-CC2: ObjCPropertyDecl:{ResultType int}{TypedText Prop1}
+// CHECK-CC2-NEXT: ObjCPropertyDecl:{ResultType id}{TypedText Prop3}
+// CHECK-CC2: ObjCPropertyDecl:{ResultType id}{TypedText Prop4}
// RUN: c-index-test -code-completion-at=%s:20:35 %s | FileCheck -check-prefix=CHECK-CC3 %s
-// CHECK-CC3: ObjCIvarDecl:{TypedText RandomIVar}
-// CHECK-CC3: ObjCIvarDecl:{TypedText StoredProp3}
+// CHECK-CC3: ObjCIvarDecl:{ResultType int}{TypedText RandomIVar}
+// CHECK-CC3: ObjCIvarDecl:{ResultType id}{TypedText StoredProp3}
// RUN: c-index-test -code-completion-at=%s:21:10 %s | FileCheck -check-prefix=CHECK-CC4 %s
-// CHECK-CC4: ObjCPropertyDecl:{TypedText Prop0}
-// CHECK-CC4-NEXT: ObjCPropertyDecl:{TypedText Prop4}
+// CHECK-CC4: ObjCPropertyDecl:{ResultType int}{TypedText Prop0}
+// CHECK-CC4-NEXT: ObjCPropertyDecl:{ResultType id}{TypedText Prop4}
@end
// RUN: c-index-test -code-completion-at=%s:13:21 %s | FileCheck -check-prefix=CHECK-CC1 %s
-// CHECK-CC1: ObjCInstanceMethodDecl:{TypedText getter1}
+// CHECK-CC1: ObjCInstanceMethodDecl:{ResultType int}{TypedText getter1}
// CHECK-CC1-NOT: getter2
-// CHECK-CC1: ObjCInstanceMethodDecl:{TypedText getter3}
+// CHECK-CC1: ObjCInstanceMethodDecl:{ResultType int}{TypedText getter3}
// RUN: c-index-test -code-completion-at=%s:13:39 %s | FileCheck -check-prefix=CHECK-CC2 %s
-// CHECK-CC2: ObjCInstanceMethodDecl:{TypedText getter2_not:}
-// CHECK-CC2: ObjCInstanceMethodDecl:{TypedText setter1:}
+// CHECK-CC2: ObjCInstanceMethodDecl:{ResultType int}{TypedText getter2_not:}
+// CHECK-CC2: ObjCInstanceMethodDecl:{ResultType void}{TypedText setter1:}
// CHECK-CC2-NOT: setter2
-// CHECK-CC2: ObjCInstanceMethodDecl:{TypedText setter3:}
+// CHECK-CC2: ObjCInstanceMethodDecl:{ResultType void}{TypedText setter3:}
// RUN: c-index-test -code-completion-at=%s:19:21 %s | FileCheck -check-prefix=CHECK-CC3 %s
-// CHECK-CC3: ObjCInstanceMethodDecl:{TypedText getter1}
+// CHECK-CC3: ObjCInstanceMethodDecl:{ResultType int}{TypedText getter1}
// CHECK-CC3-NOT: getter2
-// CHECK-CC3: ObjCInstanceMethodDecl:{TypedText getter3}
-// CHECK-CC3: ObjCInstanceMethodDecl:{TypedText getter4}
+// CHECK-CC3: ObjCInstanceMethodDecl:{ResultType int}{TypedText getter3}
+// CHECK-CC3: ObjCInstanceMethodDecl:{ResultType int}{TypedText getter4}
// RUN: c-index-test -code-completion-at=%s:19:39 %s | FileCheck -check-prefix=CHECK-CC4 %s
-// CHECK-CC4: ObjCInstanceMethodDecl:{TypedText getter2_not:}{Informative (int)x}
-// CHECK-CC4: ObjCInstanceMethodDecl:{TypedText setter1:}{Informative (int)x}
+// CHECK-CC4: ObjCInstanceMethodDecl:{ResultType int}{TypedText getter2_not:}{Informative (int)x}
+// CHECK-CC4: ObjCInstanceMethodDecl:{ResultType void}{TypedText setter1:}{Informative (int)x}
// CHECK-CC4-NOT: setter2
-// CHECK-CC4: ObjCInstanceMethodDecl:{TypedText setter3:}{Informative (int)y}
-// CHECK-CC4: ObjCInstanceMethodDecl:{TypedText setter4:}{Informative (int)x}
+// CHECK-CC4: ObjCInstanceMethodDecl:{ResultType void}{TypedText setter3:}{Informative (int)y}
+// CHECK-CC4: ObjCInstanceMethodDecl:{ResultType void}{TypedText setter4:}{Informative (int)x}
// RUN: c-index-test -code-completion-at=%s:1:12 -remap-file="%s;%S/Inputs/remap-complete-to.c" %s | FileCheck %s
// XFAIL: win32
-// CHECK: FunctionDecl:{TypedText f0}{LeftParen (}{RightParen )}
+// CHECK: FunctionDecl:{ResultType void}{TypedText f0}{LeftParen (}{RightParen )}
void f() { }
return CXCompletionChunk_Placeholder;
case CodeCompletionString::CK_Informative:
return CXCompletionChunk_Informative;
+ case CodeCompletionString::CK_ResultType:
+ return CXCompletionChunk_ResultType;
case CodeCompletionString::CK_CurrentParameter:
return CXCompletionChunk_CurrentParameter;
case CodeCompletionString::CK_LeftParen:
case CodeCompletionString::CK_LeftAngle:
case CodeCompletionString::CK_RightAngle:
case CodeCompletionString::CK_Comma:
+ case CodeCompletionString::CK_ResultType:
return (*CCStr)[chunk_number].Text;
case CodeCompletionString::CK_Optional:
case CodeCompletionString::CK_LeftAngle:
case CodeCompletionString::CK_RightAngle:
case CodeCompletionString::CK_Comma:
+ case CodeCompletionString::CK_ResultType:
return 0;
case CodeCompletionString::CK_Optional:
case CXCompletionChunk_LeftAngle: return "LeftAngle";
case CXCompletionChunk_RightAngle: return "RightAngle";
case CXCompletionChunk_Comma: return "Comma";
+ case CXCompletionChunk_ResultType: return "ResultType";
}
return "Unknown";