mirror of
https://github.com/intel/llvm.git
synced 2026-01-27 06:06:34 +08:00
[clang] Improve ctor initializer completions.
Summary: Instead of providing generic "args" for member and base class initializers, tries to fetch relevant constructors and show their signatures. Reviewers: ilya-biryukov Reviewed By: ilya-biryukov Subscribers: ZaMaZaN4iK, eraman, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D53654 llvm-svn: 345844
This commit is contained in:
@@ -808,12 +808,20 @@ void ResultBuilder::AdjustResultPriorityForDecl(Result &R) {
|
||||
}
|
||||
}
|
||||
|
||||
DeclContext::lookup_result getConstructors(ASTContext &Context,
|
||||
const CXXRecordDecl *Record) {
|
||||
QualType RecordTy = Context.getTypeDeclType(Record);
|
||||
DeclarationName ConstructorName =
|
||||
Context.DeclarationNames.getCXXConstructorName(
|
||||
Context.getCanonicalType(RecordTy));
|
||||
return Record->lookup(ConstructorName);
|
||||
}
|
||||
|
||||
void ResultBuilder::MaybeAddConstructorResults(Result R) {
|
||||
if (!SemaRef.getLangOpts().CPlusPlus || !R.Declaration ||
|
||||
!CompletionContext.wantConstructorResults())
|
||||
return;
|
||||
|
||||
ASTContext &Context = SemaRef.Context;
|
||||
const NamedDecl *D = R.Declaration;
|
||||
const CXXRecordDecl *Record = nullptr;
|
||||
if (const ClassTemplateDecl *ClassTemplate = dyn_cast<ClassTemplateDecl>(D))
|
||||
@@ -831,16 +839,8 @@ void ResultBuilder::MaybeAddConstructorResults(Result R) {
|
||||
if (!Record)
|
||||
return;
|
||||
|
||||
|
||||
QualType RecordTy = Context.getTypeDeclType(Record);
|
||||
DeclarationName ConstructorName
|
||||
= Context.DeclarationNames.getCXXConstructorName(
|
||||
Context.getCanonicalType(RecordTy));
|
||||
DeclContext::lookup_result Ctors = Record->lookup(ConstructorName);
|
||||
for (DeclContext::lookup_iterator I = Ctors.begin(),
|
||||
E = Ctors.end();
|
||||
I != E; ++I) {
|
||||
R.Declaration = *I;
|
||||
for(auto Ctor : getConstructors(SemaRef.Context, Record)) {
|
||||
R.Declaration = Ctor;
|
||||
R.CursorKind = getCursorKindForDecl(R.Declaration);
|
||||
Results.push_back(R);
|
||||
}
|
||||
@@ -5073,11 +5073,77 @@ void Sema::CodeCompleteConstructorInitializer(
|
||||
}
|
||||
|
||||
// Add completions for base classes.
|
||||
CodeCompletionBuilder Builder(Results.getAllocator(),
|
||||
Results.getCodeCompletionTUInfo());
|
||||
PrintingPolicy Policy = getCompletionPrintingPolicy(*this);
|
||||
bool SawLastInitializer = Initializers.empty();
|
||||
CXXRecordDecl *ClassDecl = Constructor->getParent();
|
||||
|
||||
auto GenerateCCS = [&](const NamedDecl *ND, const char *Name) {
|
||||
CodeCompletionBuilder Builder(Results.getAllocator(),
|
||||
Results.getCodeCompletionTUInfo());
|
||||
Builder.AddTypedTextChunk(Name);
|
||||
Builder.AddChunk(CodeCompletionString::CK_LeftParen);
|
||||
if (auto Function = dyn_cast<FunctionDecl>(ND))
|
||||
AddFunctionParameterChunks(PP, Policy, Function, Builder);
|
||||
else if (auto FunTemplDecl = dyn_cast<FunctionTemplateDecl>(ND))
|
||||
AddFunctionParameterChunks(PP, Policy, FunTemplDecl->getTemplatedDecl(),
|
||||
Builder);
|
||||
Builder.AddChunk(CodeCompletionString::CK_RightParen);
|
||||
return Builder.TakeString();
|
||||
};
|
||||
auto AddDefaultCtorInit = [&](const char *Name, const char *Type,
|
||||
const NamedDecl *ND) {
|
||||
CodeCompletionBuilder Builder(Results.getAllocator(),
|
||||
Results.getCodeCompletionTUInfo());
|
||||
Builder.AddTypedTextChunk(Name);
|
||||
Builder.AddChunk(CodeCompletionString::CK_LeftParen);
|
||||
Builder.AddPlaceholderChunk(Type);
|
||||
Builder.AddChunk(CodeCompletionString::CK_RightParen);
|
||||
if (ND) {
|
||||
auto CCR = CodeCompletionResult(
|
||||
Builder.TakeString(), ND,
|
||||
SawLastInitializer ? CCP_NextInitializer : CCP_MemberDeclaration);
|
||||
if (isa<FieldDecl>(ND))
|
||||
CCR.CursorKind = CXCursor_MemberRef;
|
||||
return Results.AddResult(CCR);
|
||||
}
|
||||
return Results.AddResult(CodeCompletionResult(
|
||||
Builder.TakeString(),
|
||||
SawLastInitializer ? CCP_NextInitializer : CCP_MemberDeclaration));
|
||||
};
|
||||
auto AddCtorsWithName = [&](const CXXRecordDecl *RD, unsigned int Priority,
|
||||
const char *Name, const FieldDecl *FD) {
|
||||
if (!RD)
|
||||
return AddDefaultCtorInit(Name,
|
||||
FD ? Results.getAllocator().CopyString(
|
||||
FD->getType().getAsString(Policy))
|
||||
: Name,
|
||||
FD);
|
||||
auto Ctors = getConstructors(Context, RD);
|
||||
if (Ctors.begin() == Ctors.end())
|
||||
return AddDefaultCtorInit(Name, Name, RD);
|
||||
for (const auto Ctor : Ctors) {
|
||||
auto CCR = CodeCompletionResult(GenerateCCS(Ctor, Name), RD, Priority);
|
||||
CCR.CursorKind = getCursorKindForDecl(Ctor);
|
||||
Results.AddResult(CCR);
|
||||
}
|
||||
};
|
||||
auto AddBase = [&](const CXXBaseSpecifier &Base) {
|
||||
const char *BaseName =
|
||||
Results.getAllocator().CopyString(Base.getType().getAsString(Policy));
|
||||
const auto *RD = Base.getType()->getAsCXXRecordDecl();
|
||||
AddCtorsWithName(
|
||||
RD, SawLastInitializer ? CCP_NextInitializer : CCP_MemberDeclaration,
|
||||
BaseName, nullptr);
|
||||
};
|
||||
auto AddField = [&](const FieldDecl *FD) {
|
||||
const char *FieldName =
|
||||
Results.getAllocator().CopyString(FD->getIdentifier()->getName());
|
||||
const CXXRecordDecl *RD = FD->getType()->getAsCXXRecordDecl();
|
||||
AddCtorsWithName(
|
||||
RD, SawLastInitializer ? CCP_NextInitializer : CCP_MemberDeclaration,
|
||||
FieldName, FD);
|
||||
};
|
||||
|
||||
for (const auto &Base : ClassDecl->bases()) {
|
||||
if (!InitializedBases.insert(Context.getCanonicalType(Base.getType()))
|
||||
.second) {
|
||||
@@ -5089,15 +5155,7 @@ void Sema::CodeCompleteConstructorInitializer(
|
||||
continue;
|
||||
}
|
||||
|
||||
Builder.AddTypedTextChunk(
|
||||
Results.getAllocator().CopyString(
|
||||
Base.getType().getAsString(Policy)));
|
||||
Builder.AddChunk(CodeCompletionString::CK_LeftParen);
|
||||
Builder.AddPlaceholderChunk("args");
|
||||
Builder.AddChunk(CodeCompletionString::CK_RightParen);
|
||||
Results.AddResult(CodeCompletionResult(Builder.TakeString(),
|
||||
SawLastInitializer? CCP_NextInitializer
|
||||
: CCP_MemberDeclaration));
|
||||
AddBase(Base);
|
||||
SawLastInitializer = false;
|
||||
}
|
||||
|
||||
@@ -5113,15 +5171,7 @@ void Sema::CodeCompleteConstructorInitializer(
|
||||
continue;
|
||||
}
|
||||
|
||||
Builder.AddTypedTextChunk(
|
||||
Builder.getAllocator().CopyString(
|
||||
Base.getType().getAsString(Policy)));
|
||||
Builder.AddChunk(CodeCompletionString::CK_LeftParen);
|
||||
Builder.AddPlaceholderChunk("args");
|
||||
Builder.AddChunk(CodeCompletionString::CK_RightParen);
|
||||
Results.AddResult(CodeCompletionResult(Builder.TakeString(),
|
||||
SawLastInitializer? CCP_NextInitializer
|
||||
: CCP_MemberDeclaration));
|
||||
AddBase(Base);
|
||||
SawLastInitializer = false;
|
||||
}
|
||||
|
||||
@@ -5139,17 +5189,7 @@ void Sema::CodeCompleteConstructorInitializer(
|
||||
if (!Field->getDeclName())
|
||||
continue;
|
||||
|
||||
Builder.AddTypedTextChunk(Builder.getAllocator().CopyString(
|
||||
Field->getIdentifier()->getName()));
|
||||
Builder.AddChunk(CodeCompletionString::CK_LeftParen);
|
||||
Builder.AddPlaceholderChunk("args");
|
||||
Builder.AddChunk(CodeCompletionString::CK_RightParen);
|
||||
Results.AddResult(CodeCompletionResult(Builder.TakeString(),
|
||||
SawLastInitializer? CCP_NextInitializer
|
||||
: CCP_MemberDeclaration,
|
||||
CXCursor_MemberRef,
|
||||
CXAvailability_Available,
|
||||
Field));
|
||||
AddField(Field);
|
||||
SawLastInitializer = false;
|
||||
}
|
||||
Results.ExitScope();
|
||||
|
||||
@@ -2,14 +2,14 @@ struct Base1 {
|
||||
Base1() : {}
|
||||
// RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:2:12 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
|
||||
// RUN: %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:2:12 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
|
||||
// CHECK-CC1: COMPLETION: Pattern : member1(<#args#>)
|
||||
// CHECK-CC1: COMPLETION: Pattern : member2(<#args#>
|
||||
// CHECK-CC1: COMPLETION: Pattern : member1(<#int#>)
|
||||
// CHECK-CC1: COMPLETION: Pattern : member2(<#float#>)
|
||||
|
||||
Base1(int) : member1(123), {}
|
||||
// RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:8:30 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
|
||||
// RUN: %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:8:30 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
|
||||
// CHECK-CC2-NOT: COMPLETION: Pattern : member1(<#args#>)
|
||||
// CHECK-CC2: COMPLETION: Pattern : member2(<#args#>
|
||||
// CHECK-CC2-NOT: COMPLETION: Pattern : member1(<#int#>)
|
||||
// CHECK-CC2: COMPLETION: Pattern : member2(<#float#>)
|
||||
|
||||
int member1;
|
||||
float member2;
|
||||
@@ -25,43 +25,42 @@ struct Derived : public Base1 {
|
||||
Derived::Derived() : {}
|
||||
// RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:25:22 %s -o - | FileCheck -check-prefix=CHECK-CC3 %s
|
||||
// RUN: %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:25:22 %s -o - | FileCheck -check-prefix=CHECK-CC3 %s
|
||||
// CHECK-CC3: COMPLETION: Pattern : Base1(<#args#>)
|
||||
// CHECK-CC3: COMPLETION: Pattern : deriv1(<#args#>)
|
||||
// CHECK-CC3: COMPLETION: Pattern : Base1()
|
||||
// CHECK-CC3: COMPLETION: Pattern : Base1(<#int#>)
|
||||
// CHECK-CC3: COMPLETION: Pattern : deriv1(<#int#>)
|
||||
|
||||
Derived::Derived(int) try : {
|
||||
} catch (...) {
|
||||
}
|
||||
// RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:31:29 %s -o - | FileCheck -check-prefix=CHECK-CC4 %s
|
||||
// RUN: %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:31:29 %s -o - | FileCheck -check-prefix=CHECK-CC4 %s
|
||||
// CHECK-CC4: COMPLETION: Pattern : Base1(<#args#>)
|
||||
// CHECK-CC4: COMPLETION: Pattern : deriv1(<#args#>)
|
||||
// RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:32:29 %s -o - | FileCheck -check-prefix=CHECK-CC3 %s
|
||||
// RUN: %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:32:29 %s -o - | FileCheck -check-prefix=CHECK-CC3 %s
|
||||
|
||||
Derived::Derived(float) try : Base1(),
|
||||
{
|
||||
} catch (...) {
|
||||
}
|
||||
// RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:39:39 %s -o - | FileCheck -check-prefix=CHECK-CC5 %s
|
||||
// RUN: %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:39:39 %s -o - | FileCheck -check-prefix=CHECK-CC5 %s
|
||||
// CHECK-CC5-NOT: COMPLETION: Pattern : Base1(<#args#>)
|
||||
// CHECK-CC5: COMPLETION: Pattern : deriv1(<#args#>)
|
||||
// RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:38:39 %s -o - | FileCheck -check-prefix=CHECK-CC5 %s
|
||||
// RUN: %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:38:39 %s -o - | FileCheck -check-prefix=CHECK-CC5 %s
|
||||
// CHECK-CC5-NOT: COMPLETION: Pattern : Base1
|
||||
// CHECK-CC5: COMPLETION: Pattern : deriv1(<#int#>)
|
||||
|
||||
struct A {
|
||||
A() : , member2() {}
|
||||
// RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:49:9 %s -o - | FileCheck -check-prefix=CHECK-CC6 %s
|
||||
// RUN: %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:49:9 %s -o - | FileCheck -check-prefix=CHECK-CC6 %s
|
||||
// CHECK-CC6: COMPLETION: Pattern : member1(<#args#>
|
||||
// RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:48:9 %s -o - | FileCheck -check-prefix=CHECK-CC6 %s
|
||||
// RUN: %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:48:9 %s -o - | FileCheck -check-prefix=CHECK-CC6 %s
|
||||
// CHECK-CC6: COMPLETION: Pattern : member1(<#int#>)
|
||||
int member1, member2;
|
||||
};
|
||||
|
||||
struct B {
|
||||
B() : member2() {}
|
||||
// RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:57:9 %s -o - | FileCheck -check-prefix=CHECK-CC7 %s
|
||||
// RUN: %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:57:9 %s -o - | FileCheck -check-prefix=CHECK-CC7 %s
|
||||
// CHECK-CC7: COMPLETION: Pattern : member1(<#args#>
|
||||
// RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:56:9 %s -o - | FileCheck -check-prefix=CHECK-CC7 %s
|
||||
// RUN: %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:56:9 %s -o - | FileCheck -check-prefix=CHECK-CC7 %s
|
||||
// CHECK-CC7: COMPLETION: Pattern : member1(<#int#>)
|
||||
// Check in the middle and at the end of identifier too.
|
||||
// RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:57:13 %s -o - | FileCheck -check-prefix=CHECK-CC8 %s
|
||||
// RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:57:16 %s -o - | FileCheck -check-prefix=CHECK-CC8 %s
|
||||
// CHECK-CC8: COMPLETION: Pattern : member2(<#args#>
|
||||
// RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:56:13 %s -o - | FileCheck -check-prefix=CHECK-CC8 %s
|
||||
// RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:56:16 %s -o - | FileCheck -check-prefix=CHECK-CC8 %s
|
||||
// CHECK-CC8: COMPLETION: Pattern : member2(<#int#>)
|
||||
int member1, member2;
|
||||
};
|
||||
|
||||
@@ -70,9 +69,9 @@ struct Base2 {
|
||||
};
|
||||
|
||||
struct Composition1 {
|
||||
Composition1() : b2_elem() {}
|
||||
// RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:73:28 %s -o - | FileCheck -check-prefix=CHECK-CC9 %s
|
||||
// RUN: %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:73:28 %s -o - | FileCheck -check-prefix=CHECK-CC9 %s
|
||||
Composition1() : b2_elem(2) {}
|
||||
// RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:72:28 %s -o - | FileCheck -check-prefix=CHECK-CC9 %s
|
||||
// RUN: %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:72:28 %s -o - | FileCheck -check-prefix=CHECK-CC9 %s
|
||||
// CHECK-CC9: OVERLOAD: Base2(<#int#>)
|
||||
// CHECK-CC9: OVERLOAD: Base2(<#const Base2 &#>)
|
||||
// CHECK-CC9-NOT: OVERLOAD: Composition1
|
||||
@@ -82,9 +81,25 @@ struct Composition1 {
|
||||
|
||||
struct Composition2 {
|
||||
Composition2() : c1_elem(Base2(1)) {}
|
||||
// RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:84:34 %s -o - | FileCheck -check-prefix=CHECK-CC9 %s
|
||||
// RUN: %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:84:34 %s -o - | FileCheck -check-prefix=CHECK-CC9 %s
|
||||
// RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:84:35 %s -o - | FileCheck -check-prefix=CHECK-CC9 %s
|
||||
// RUN: %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:84:35 %s -o - | FileCheck -check-prefix=CHECK-CC9 %s
|
||||
// RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:83:34 %s -o - | FileCheck -check-prefix=CHECK-CC9 %s
|
||||
// RUN: %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:83:34 %s -o - | FileCheck -check-prefix=CHECK-CC9 %s
|
||||
// RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:83:35 %s -o - | FileCheck -check-prefix=CHECK-CC9 %s
|
||||
// RUN: %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:83:35 %s -o - | FileCheck -check-prefix=CHECK-CC9 %s
|
||||
Composition1 c1_elem;
|
||||
};
|
||||
// RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:83:20 %s -o - | FileCheck -check-prefix=CHECK-CC10 %s
|
||||
// RUN: %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:83:20 %s -o - | FileCheck -check-prefix=CHECK-CC10 %s
|
||||
// CHECK-CC10: Pattern : c1_elem()
|
||||
// CHECK-CC10: Pattern : c1_elem(<#Base2#>)
|
||||
|
||||
template <class T>
|
||||
struct Y : T {};
|
||||
|
||||
template <class T>
|
||||
struct X : Y<T> {
|
||||
X() : Y<T>() {};
|
||||
};
|
||||
|
||||
// RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:100:9 %s -o - | FileCheck -check-prefix=CHECK-CC11 %s
|
||||
// RUN: %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:100:9 %s -o - | FileCheck -check-prefix=CHECK-CC11 %s
|
||||
// CHECK-CC11: Pattern : Y<T>(<#Y<T>#>)
|
||||
|
||||
@@ -30,27 +30,33 @@ struct PR23948 {
|
||||
};
|
||||
|
||||
// RUN: c-index-test -code-completion-at=%s:18:10 %s | FileCheck -check-prefix=CHECK-CC1 %s
|
||||
// CHECK-CC1: MemberRef:{TypedText a}{LeftParen (}{Placeholder args}{RightParen )} (35)
|
||||
// CHECK-CC1: MemberRef:{TypedText b}{LeftParen (}{Placeholder args}{RightParen )} (35)
|
||||
// CHECK-CC1: MemberRef:{TypedText c}{LeftParen (}{Placeholder args}{RightParen )} (35)
|
||||
// CHECK-CC1: NotImplemented:{TypedText Virt}{LeftParen (}{Placeholder args}{RightParen )} (35)
|
||||
// CHECK-CC1: NotImplemented:{TypedText X<int>}{LeftParen (}{Placeholder args}{RightParen )} (7)
|
||||
// CHECK-CC1: NotImplemented:{TypedText Y}{LeftParen (}{Placeholder args}{RightParen )} (35)
|
||||
// CHECK-CC1: MemberRef:{TypedText a}{LeftParen (}{Placeholder int}{RightParen )} (35)
|
||||
// CHECK-CC1: MemberRef:{TypedText b}{LeftParen (}{Placeholder int}{RightParen )} (35)
|
||||
// CHECK-CC1: MemberRef:{TypedText c}{LeftParen (}{Placeholder int}{RightParen )} (35)
|
||||
// CHECK-CC1: CXXConstructor:{TypedText Virt}{LeftParen (}{Placeholder const Virt &}{RightParen )} (35)
|
||||
// CHECK-CC1: CXXConstructor:{TypedText Virt}{LeftParen (}{Placeholder Virt &&}{RightParen )} (35)
|
||||
// CHECK-CC1: CXXConstructor:{TypedText X<int>}{LeftParen (}{Placeholder int}{RightParen )} (7)
|
||||
// CHECK-CC1: CXXConstructor:{TypedText Y}{LeftParen (}{Placeholder const Y &}{RightParen )} (35)
|
||||
// CHECK-CC1: CXXConstructor:{TypedText Y}{LeftParen (}{Placeholder Y &&}{RightParen )} (35)
|
||||
|
||||
// RUN: c-index-test -code-completion-at=%s:18:23 %s | FileCheck -check-prefix=CHECK-CC2 %s
|
||||
// CHECK-CC2: MemberRef:{TypedText a}{LeftParen (}{Placeholder args}{RightParen )} (35)
|
||||
// CHECK-CC2: MemberRef:{TypedText b}{LeftParen (}{Placeholder args}{RightParen )} (35)
|
||||
// CHECK-CC2: MemberRef:{TypedText c}{LeftParen (}{Placeholder args}{RightParen )} (35)
|
||||
// CHECK-CC2: NotImplemented:{TypedText Virt}{LeftParen (}{Placeholder args}{RightParen )} (35)
|
||||
// CHECK-CC2: NotImplemented:{TypedText Y}{LeftParen (}{Placeholder args}{RightParen )} (7)
|
||||
// CHECK-CC2: MemberRef:{TypedText a}{LeftParen (}{Placeholder int}{RightParen )} (35)
|
||||
// CHECK-CC2: MemberRef:{TypedText b}{LeftParen (}{Placeholder int}{RightParen )} (35)
|
||||
// CHECK-CC2: MemberRef:{TypedText c}{LeftParen (}{Placeholder int}{RightParen )} (35)
|
||||
// CHECK-CC2: CXXConstructor:{TypedText Virt}{LeftParen (}{Placeholder const Virt &}{RightParen )} (35)
|
||||
// CHECK-CC2: CXXConstructor:{TypedText Virt}{LeftParen (}{Placeholder Virt &&}{RightParen )} (35)
|
||||
// CHECK-CC2: CXXConstructor:{TypedText Y}{LeftParen (}{Placeholder const Y &}{RightParen )} (7)
|
||||
// CHECK-CC2: CXXConstructor:{TypedText Y}{LeftParen (}{Placeholder Y &&}{RightParen )} (7)
|
||||
|
||||
// RUN: c-index-test -code-completion-at=%s:18:36 %s | FileCheck -check-prefix=CHECK-CC3 %s
|
||||
// CHECK-CC3: MemberRef:{TypedText a}{LeftParen (}{Placeholder args}{RightParen )} (35)
|
||||
// CHECK-CC3-NOT: MemberRef:{TypedText b}{LeftParen (}{Placeholder args}{RightParen )}
|
||||
// CHECK-CC3: MemberRef:{TypedText c}{LeftParen (}{Placeholder args}{RightParen )} (7)
|
||||
// CHECK-CC3-NOT: NotImplemented:{TypedText Virt}{LeftParen (}{Placeholder args}{RightParen )}
|
||||
// CHECK-CC3: NotImplemented:{TypedText Y}{LeftParen (}{Placeholder args}{RightParen )} (35)
|
||||
// CHECK-CC3: MemberRef:{TypedText a}{LeftParen (}{Placeholder int}{RightParen )} (35)
|
||||
// CHECK-CC3-NOT: MemberRef:{TypedText b}{LeftParen (}{Placeholder int}{RightParen )}
|
||||
// CHECK-CC3: MemberRef:{TypedText c}{LeftParen (}{Placeholder int}{RightParen )} (7)
|
||||
// CHECK-CC3-NOT: CXXConstructor:{TypedText Virt}{LeftParen (}{Placeholder const Virt &}{RightParen )} (35)
|
||||
// CHECK-CC3-NOT: CXXConstructor:{TypedText Virt}{LeftParen (}{Placeholder Virt &&}{RightParen )} (35)
|
||||
// CHECK-CC3: CXXConstructor:{TypedText Y}{LeftParen (}{Placeholder const Y &}{RightParen )} (35)
|
||||
// CHECK-CC3: CXXConstructor:{TypedText Y}{LeftParen (}{Placeholder Y &&}{RightParen )} (35)
|
||||
|
||||
// RUN: c-index-test -code-completion-at=%s:22:10 -target i386-apple-darwin %s | FileCheck -check-prefix=CHECK-CC4 %s
|
||||
// CHECK-CC4: MemberRef:{TypedText a}{LeftParen (}{Placeholder args}{RightParen )} (7)
|
||||
// CHECK-CC4: MemberRef:{TypedText a}{LeftParen (}{Placeholder int}{RightParen )} (7)
|
||||
// RUN: c-index-test -code-completion-at=%s:26:10 %s
|
||||
|
||||
@@ -21,6 +21,13 @@ private:
|
||||
int value;
|
||||
MyCls *object;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
class X {};
|
||||
|
||||
class Y : public X<int> {
|
||||
Y() : X<int>() {}
|
||||
};
|
||||
}
|
||||
|
||||
// RUN: c-index-test -code-completion-at=%s:4:9 -std=c++98 %s | FileCheck %s
|
||||
@@ -35,10 +42,12 @@ private:
|
||||
// CHECK-NEXT: Container Kind: StructDecl
|
||||
|
||||
// RUN: c-index-test -code-completion-at=%s:18:41 %s | FileCheck -check-prefix=CHECK-CTOR-INIT %s
|
||||
// CHECK-CTOR-INIT: NotImplemented:{TypedText MyCls}{LeftParen (}{Placeholder args}{RightParen )} (7)
|
||||
// CHECK-CTOR-INIT: MemberRef:{TypedText object}{LeftParen (}{Placeholder args}{RightParen )} (35)
|
||||
// CHECK-CTOR-INIT: MemberRef:{TypedText value}{LeftParen (}{Placeholder args}{RightParen )} (35)
|
||||
// CHECK-CTOR-INIT: ClassDecl:{TypedText MyCls}{LeftParen (}{Placeholder MyCls}{RightParen )} (7)
|
||||
// CHECK-CTOR-INIT: MemberRef:{TypedText object}{LeftParen (}{Placeholder MyCls *}{RightParen )} (35)
|
||||
// CHECK-CTOR-INIT: MemberRef:{TypedText value}{LeftParen (}{Placeholder int}{RightParen )} (35)
|
||||
// RUN: c-index-test -code-completion-at=%s:18:55 %s | FileCheck -check-prefix=CHECK-CTOR-INIT-2 %s
|
||||
// CHECK-CTOR-INIT-2-NOT: NotImplemented:{TypedText MyCls}{LeftParen (}{Placeholder args}{RightParen )}
|
||||
// CHECK-CTOR-INIT-2: MemberRef:{TypedText object}{LeftParen (}{Placeholder args}{RightParen )} (35)
|
||||
// CHECK-CTOR-INIT-2: MemberRef:{TypedText value}{LeftParen (}{Placeholder args}{RightParen )} (7)
|
||||
// CHECK-CTOR-INIT-2-NOT: ClassDecl:{TypedText MyCls}{LeftParen (}{Placeholder MyCls}{RightParen )} (7)
|
||||
// CHECK-CTOR-INIT-2: MemberRef:{TypedText object}{LeftParen (}{Placeholder MyCls *}{RightParen )} (35)
|
||||
// CHECK-CTOR-INIT-2: MemberRef:{TypedText value}{LeftParen (}{Placeholder int}{RightParen )} (7)
|
||||
// RUN: c-index-test -code-completion-at=%s:29:9 %s | FileCheck -check-prefix=CHECK-CTOR-INIT-3 %s
|
||||
// CHECK-CTOR-INIT-3: ClassDecl:{TypedText X<int>}{LeftParen (}{Placeholder X<int>}{RightParen )} (7)
|
||||
|
||||
Reference in New Issue
Block a user