Index: Index/code-completion.cpp =================================================================== --- Index/code-completion.cpp +++ Index/code-completion.cpp @@ -59,9 +59,9 @@ // CHECK-MEMBER: StructDecl:{TypedText X}{Text ::} // CHECK-MEMBER: StructDecl:{TypedText Y}{Text ::} // CHECK-MEMBER: StructDecl:{TypedText Z}{Text ::} -// CHECK-MEMBER: CXXDestructor:{ResultType void}{Informative X::}{TypedText ~X}{LeftParen (}{RightParen )} -// CHECK-MEMBER: CXXDestructor:{ResultType void}{Informative Y::}{TypedText ~Y}{LeftParen (}{RightParen )} -// CHECK-MEMBER: CXXDestructor:{ResultType void}{TypedText ~Z}{LeftParen (}{RightParen )} +// CHECK-MEMBER: CXXDestructor:{Informative X::}{TypedText ~X}{LeftParen (}{RightParen )} +// CHECK-MEMBER: CXXDestructor:{Informative Y::}{TypedText ~Y}{LeftParen (}{RightParen )} +// CHECK-MEMBER: CXXDestructor:{TypedText ~Z}{LeftParen (}{RightParen )} // CHECK-MEMBER: Completion contexts: // CHECK-MEMBER-NEXT: Dot member access // CHECK-MEMBER-NEXT: Container Kind: StructDecl Index: Index/complete-access-checks.cpp =================================================================== --- Index/complete-access-checks.cpp +++ Index/complete-access-checks.cpp @@ -45,8 +45,8 @@ // CHECK-SUPER-ACCESS: CXXMethod:{ResultType X &}{Text X::}{TypedText operator=}{LeftParen (}{Placeholder const X &}{RightParen )} (81) // CHECK-SUPER-ACCESS: StructDecl:{TypedText X}{Text ::} (77) // CHECK-SUPER-ACCESS: StructDecl:{TypedText Y}{Text ::} (75) -// CHECK-SUPER-ACCESS: CXXDestructor:{ResultType void}{Informative X::}{TypedText ~X}{LeftParen (}{RightParen )} (81) -// CHECK-SUPER-ACCESS: CXXDestructor:{ResultType void}{TypedText ~Y}{LeftParen (}{RightParen )} (79) +// CHECK-SUPER-ACCESS: CXXDestructor:{Informative X::}{TypedText ~X}{LeftParen (}{RightParen )} (81) +// CHECK-SUPER-ACCESS: CXXDestructor:{TypedText ~Y}{LeftParen (}{RightParen )} (79) // CHECK-ACCESS: CXXMethod:{ResultType void}{TypedText func1}{LeftParen (}{RightParen )} (34) // CHECK-ACCESS: CXXMethod:{ResultType void}{TypedText func2}{LeftParen (}{RightParen )} (34) (inaccessible) @@ -56,7 +56,7 @@ // CHECK-ACCESS: FieldDecl:{ResultType int}{TypedText member3} (35) (inaccessible) // CHECK-ACCESS: CXXMethod:{ResultType Z &}{TypedText operator=}{LeftParen (}{Placeholder const Z &}{RightParen )} (79) // CHECK-ACCESS: ClassDecl:{TypedText Z}{Text ::} (75) -// CHECK-ACCESS: CXXDestructor:{ResultType void}{TypedText ~Z}{LeftParen (}{RightParen )} (79) +// CHECK-ACCESS: CXXDestructor:{TypedText ~Z}{LeftParen (}{RightParen )} (79) class P { protected: @@ -78,15 +78,15 @@ // CHECK-USING-INACCESSIBLE: FieldDecl:{ResultType int}{TypedText member} (35) (inaccessible) // CHECK-USING-INACCESSIBLE: CXXMethod:{ResultType P &}{TypedText operator=}{LeftParen (}{Placeholder const P &}{RightParen )} (79) // CHECK-USING-INACCESSIBLE: ClassDecl:{TypedText P}{Text ::} (75) -// CHECK-USING-INACCESSIBLE: CXXDestructor:{ResultType void}{TypedText ~P}{LeftParen (}{RightParen )} (79) +// CHECK-USING-INACCESSIBLE: CXXDestructor:{TypedText ~P}{LeftParen (}{RightParen )} (79) // CHECK-USING-ACCESSIBLE: FieldDecl:{ResultType int}{TypedText member} (35) // CHECK-USING-ACCESSIBLE: CXXMethod:{ResultType Q &}{TypedText operator=}{LeftParen (}{Placeholder const Q &}{RightParen )} (79) // CHECK-USING-ACCESSIBLE: CXXMethod:{ResultType P &}{Text P::}{TypedText operator=}{LeftParen (}{Placeholder const P &}{RightParen )} (81) // CHECK-USING-ACCESSIBLE: ClassDecl:{TypedText P}{Text ::} (77) // CHECK-USING-ACCESSIBLE: ClassDecl:{TypedText Q}{Text ::} (75) -// CHECK-USING-ACCESSIBLE: CXXDestructor:{ResultType void}{Informative P::}{TypedText ~P}{LeftParen (}{RightParen )} (81) -// CHECK-USING-ACCESSIBLE: CXXDestructor:{ResultType void}{TypedText ~Q}{LeftParen (}{RightParen )} (79) +// CHECK-USING-ACCESSIBLE: CXXDestructor:{Informative P::}{TypedText ~P}{LeftParen (}{RightParen )} (81) +// CHECK-USING-ACCESSIBLE: CXXDestructor:{TypedText ~Q}{LeftParen (}{RightParen )} (79) class B { protected: Index: Index/complete-arrow-dot.cpp =================================================================== --- Index/complete-arrow-dot.cpp +++ Index/complete-arrow-dot.cpp @@ -22,7 +22,7 @@ // CHECK-NOT: CXXMethod:{ResultType X &}{TypedText operator=}{LeftParen (}{Placeholder const X &}{RightParen )} (79) (requires fix-it:{{.*}} // CHECK-NOT: CXXMethod:{ResultType X &}{TypedText operator=}{LeftParen (}{Placeholder X &&}{RightParen )} (79) (requires fix-it:{{.*}} // CHECK-NOT: StructDecl:{TypedText X}{Text ::} (75) (requires fix-it:{{.*}} -// CHECK-NOT: CXXDestructor:{ResultType void}{TypedText ~X}{LeftParen (}{RightParen )} (79) (requires fix-it:{{.*}} +// CHECK-NOT: CXXDestructor:{TypedText ~X}{LeftParen (}{RightParen )} (79) (requires fix-it:{{.*}} // CHECK: Completion contexts: // CHECK-NEXT: Dot member access @@ -31,7 +31,7 @@ // CHECK-WITH-CORRECTION-NEXT: CXXMethod:{ResultType X &}{TypedText operator=}{LeftParen (}{Placeholder const X &}{RightParen )} (79) (requires fix-it:{{.*}} // CHECK-WITH-CORRECTION-NEXT: CXXMethod:{ResultType X &}{TypedText operator=}{LeftParen (}{Placeholder X &&}{RightParen )} (79) (requires fix-it:{{.*}} // CHECK-WITH-CORRECTION-NEXT: StructDecl:{TypedText X}{Text ::} (75) (requires fix-it:{{.*}} -// CHECK-WITH-CORRECTION-NEXT: CXXDestructor:{ResultType void}{TypedText ~X}{LeftParen (}{RightParen )} (79) (requires fix-it:{{.*}} +// CHECK-WITH-CORRECTION-NEXT: CXXDestructor:{TypedText ~X}{LeftParen (}{RightParen )} (79) (requires fix-it:{{.*}} // CHECK-WITH-CORRECTION-NEXT: Completion contexts: // CHECK-WITH-CORRECTION-NEXT: Dot member access @@ -40,7 +40,7 @@ // CHECK-ARROW-TO-DOT-NOT: CXXMethod:{ResultType X &}{TypedText operator=}{LeftParen (}{Placeholder const X &}{RightParen )} (79) (requires fix-it:{{.*}} // CHECK-ARROW-TO-DOT-NOT: CXXMethod:{ResultType X &}{TypedText operator=}{LeftParen (}{Placeholder X &&}{RightParen )} (79) (requires fix-it:{{.*}} // CHECK-ARROW-TO-DOT-NOT: StructDecl:{TypedText X}{Text ::} (75) (requires fix-it:{{.*}} -// CHECK-ARROW-TO-DOT-NOT: CXXDestructor:{ResultType void}{TypedText ~X}{LeftParen (}{RightParen )} (79) (requires fix-it:{{.*}} +// CHECK-ARROW-TO-DOT-NOT: CXXDestructor:{TypedText ~X}{LeftParen (}{RightParen )} (79) (requires fix-it:{{.*}} // CHECK-ARROW-TO-DOT: Completion contexts: // CHECK-ARROW-TO-DOT-NEXT: Unknown @@ -49,6 +49,6 @@ // CHECK-ARROW-TO-DOT-WITH-CORRECTION-NEXT: CXXMethod:{ResultType X &}{TypedText operator=}{LeftParen (}{Placeholder const X &}{RightParen )} (79) (requires fix-it:{{.*}} // CHECK-ARROW-TO-DOT-WITH-CORRECTION-NEXT: CXXMethod:{ResultType X &}{TypedText operator=}{LeftParen (}{Placeholder X &&}{RightParen )} (79) (requires fix-it:{{.*}} // CHECK-ARROW-TO-DOT-WITH-CORRECTION-NEXT: StructDecl:{TypedText X}{Text ::} (75) (requires fix-it:{{.*}} -// CHECK-ARROW-TO-DOT-WITH-CORRECTION-NEXT: CXXDestructor:{ResultType void}{TypedText ~X}{LeftParen (}{RightParen )} (79) (requires fix-it:{{.*}} +// CHECK-ARROW-TO-DOT-WITH-CORRECTION-NEXT: CXXDestructor:{TypedText ~X}{LeftParen (}{RightParen )} (79) (requires fix-it:{{.*}} // CHECK-ARROW-TO-DOT-WITH-CORRECTION-NEXT: Completion contexts: // CHECK-ARROW-TO-DOT-WITH-CORRECTION-NEXT: Arrow member access Index: Index/complete-cxx-inline-methods.cpp =================================================================== --- Index/complete-cxx-inline-methods.cpp +++ Index/complete-cxx-inline-methods.cpp @@ -29,7 +29,7 @@ // CHECK-NEXT: StructDecl:{TypedText Vec}{Text ::} (75) // CHECK-NEXT: FieldDecl:{ResultType int}{TypedText x} (35) // CHECK-NEXT: FieldDecl:{ResultType int}{TypedText y} (35) -// CHECK-NEXT: CXXDestructor:{ResultType void}{TypedText ~Vec}{LeftParen (}{RightParen )} (79) +// CHECK-NEXT: CXXDestructor:{TypedText ~Vec}{LeftParen (}{RightParen )} (79) // CHECK-NEXT: Completion contexts: // CHECK-NEXT: Dot member access // CHECK-NEXT: Container Kind: StructDecl Index: Index/complete-qualified.cpp =================================================================== --- Index/complete-qualified.cpp +++ Index/complete-qualified.cpp @@ -17,4 +17,4 @@ // CHECK-CC1: FieldDecl:{ResultType C}{TypedText c} (35) // CHECK-CC1: ClassDecl:{TypedText Foo} (35) // CHECK-CC1: CXXMethod:{ResultType Foo &}{TypedText operator=}{LeftParen (}{Placeholder const Foo &}{RightParen )} -// CHECK-CC1: CXXDestructor:{ResultType void}{TypedText ~Foo}{LeftParen (}{RightParen )} (80) +// CHECK-CC1: CXXDestructor:{TypedText ~Foo}{LeftParen (}{RightParen )} (80) Index: Index/complete-with-annotations.cpp =================================================================== --- Index/complete-with-annotations.cpp +++ Index/complete-with-annotations.cpp @@ -19,5 +19,5 @@ // CHECK: FieldDecl:{ResultType int}{TypedText member2} (35) ("another annotation", "some annotation") // CHECK: CXXMethod:{ResultType X &}{TypedText operator=}{LeftParen (}{Placeholder const X &}{RightParen )} (79) // CHECK: ClassDecl:{TypedText X}{Text ::} (75) -// CHECK: CXXDestructor:{ResultType void}{TypedText ~X}{LeftParen (}{RightParen )} (79) +// CHECK: CXXDestructor:{TypedText ~X}{LeftParen (}{RightParen )} (79) Index: Sema/SemaCodeComplete.cpp =================================================================== --- Sema/SemaCodeComplete.cpp +++ Sema/SemaCodeComplete.cpp @@ -851,6 +851,12 @@ return isa(ND); } +static bool isDestructor(const Decl *ND) { + if (const auto *Tmpl = dyn_cast(ND)) + ND = Tmpl->getTemplatedDecl(); + return isa(ND); +} + void ResultBuilder::MaybeAddResult(Result R, DeclContext *CurContext) { assert(!ShadowMaps.empty() && "Must enter into a results scope"); @@ -2154,9 +2160,9 @@ if (!ND) return; - // Skip constructors and conversion functions, which have their return types - // built into their names. - if (isConstructor(ND) || isa(ND)) + // Skip functions which have their return types built into their name or + // don't have a return type. + if (isConstructor(ND) || isDestructor(ND) || isa(ND)) return; // Determine the type of the declaration (if it has a type).