diff --git a/clang/bindings/python/clang/cindex.py b/clang/bindings/python/clang/cindex.py --- a/clang/bindings/python/clang/cindex.py +++ b/clang/bindings/python/clang/cindex.py @@ -1509,6 +1509,60 @@ """ return conf.lib.clang_CXXRecord_isAbstract(self) + def record_defaulted_copy_constructor_is_deleted(self): + """Returns True if the cursor refers to a C++ record declaration + that has its default copy constructor deleted. + """ + return conf.lib.clang_CXXRecord_defaultedCopyConstructorIsDeleted(self) + + def record_defaulted_move_constructor_is_deleted(self): + """Returns True if the cursor refers to a C++ record declaration + that has its default move constructor deleted. + """ + return conf.lib.clang_CXXRecord_defaultedMoveConstructorIsDeleted(self) + + def record_defaulted_destructor_is_deleted(self): + """Returns True if the cursor refers to a C++ record declaration + that has its default destructor deleted. + """ + return conf.lib.clang_CXXRecord_defaultedDestructorIsDeleted(self) + + def record_needs_implicit_default_constructor(self): + """Returns True if the cursor refers to a C++ record declaration + that needs an implicit default constructor declared for it. + """ + return conf.lib.clang_CXXRecord_needsImplicitDefaultConstructor(self) + + def record_needs_implicit_copy_constructor(self): + """Returns True if the cursor refers to a C++ record declaration + that needs an implicit copy constructor declared for it. + """ + return conf.lib.clang_CXXRecord_needsImplicitCopyConstructor(self) + + def record_needs_implicit_copy_assignment(self): + """Returns True if the cursor refers to a C++ record declaration + that needs an implicit copy assignment declared for it. + """ + return conf.lib.clang_CXXRecord_needsImplicitCopyAssignment(self) + + def record_needs_implicit_move_constructor(self): + """Returns True if the cursor refers to a C++ record declaration + that needs an implicit move constructor declared for it. + """ + return conf.lib.clang_CXXRecord_needsImplicitMoveConstructor(self) + + def record_needs_implicit_move_assignment(self): + """Returns True if the cursor refers to a C++ record declaration + that needs an implicit move assignment declared for it. + """ + return conf.lib.clang_CXXRecord_needsImplicitMoveAssignment(self) + + def record_needs_implicit_destructor(self): + """Returns True if the cursor refers to a C++ record declaration + that needs an implicit destructor declared for it. + """ + return conf.lib.clang_CXXRecord_needsImplicitDestructor(self) + def is_scoped_enum(self): """Returns True if the cursor refers to a scoped enum declaration. """ diff --git a/clang/include/clang-c/Index.h b/clang/include/clang-c/Index.h --- a/clang/include/clang-c/Index.h +++ b/clang/include/clang-c/Index.h @@ -4289,6 +4289,75 @@ */ CINDEX_LINKAGE unsigned clang_CXXRecord_isAbstract(CXCursor C); +/** + * Returns true if a default copy constructor for this class or struct + * would be deleted. + * If this cursor does not refer to a class or struct, returns false. + */ +CINDEX_LINKAGE unsigned +clang_CXXRecord_defaultedCopyConstructorIsDeleted(CXCursor C); + +/** + * Returns true if a default copy constructor for this class or struct + * would be deleted. + * If this cursor does not refer to a class or struct, returns false. + */ +CINDEX_LINKAGE unsigned +clang_CXXRecord_defaultedMoveConstructorIsDeleted(CXCursor C); + +/** + * Returns true if a default destructor for this class or struct + * would be deleted. + * If this cursor does not refer to a class or struct, returns false. + */ +CINDEX_LINKAGE unsigned +clang_CXXRecord_defaultedDestructorIsDeleted(CXCursor C); + +/** + * Returns true if the class requires a default constructor to be generated for + * it implicitly. If this cursor does not refer to a class or struct, returns + * false. + */ +CINDEX_LINKAGE unsigned +clang_CXXRecord_needsImplicitDefaultConstructor(CXCursor C); + +/** + * Returns true if the class requires a copy constructor to be generated for it + * implicitly. If this cursor does not refer to a class or struct, returns + * false. + */ +CINDEX_LINKAGE unsigned +clang_CXXRecord_needsImplicitCopyConstructor(CXCursor C); + +/** + * Returns true if the class requires a copy assignment operator to be generated + * for it implicitly. If this cursor does not refer to a class or struct, + * returns false. + */ +CINDEX_LINKAGE unsigned clang_CXXRecord_needsImplicitCopyAssignment(CXCursor C); + +/** + * Returns true if the class requires a move constructor to be generated for it + * implicitly. If this cursor does not refer to a class or struct, returns + * false. + */ +CINDEX_LINKAGE unsigned +clang_CXXRecord_needsImplicitMoveConstructor(CXCursor C); + +/** + * Returns true if the class requires a move assignment operator to be generated + * for it implicitly. If this cursor does not refer to a class or struct, + * returns false. + */ +CINDEX_LINKAGE unsigned clang_CXXRecord_needsImplicitMoveAssignment(CXCursor C); + +/** + * Returns true if the class requires a destructor to be generated for it + * implicitly. If this cursor does not refer to a class or struct, returns + * false. + */ +CINDEX_LINKAGE unsigned clang_CXXRecord_needsImplicitDestructor(CXCursor C); + /** * Determine if an enum declaration refers to a scoped enum. */ diff --git a/clang/test/Index/annotate-attribute.cpp b/clang/test/Index/annotate-attribute.cpp --- a/clang/test/Index/annotate-attribute.cpp +++ b/clang/test/Index/annotate-attribute.cpp @@ -22,7 +22,7 @@ template int templateFunction(T value) __attribute__((annotate("works"))); -// CHECK: ClassDecl=Test:3:7 (Definition) Extent=[3:1 - 17:2] +// CHECK: ClassDecl=Test:3:7 (Definition) (needs ctor) (needs cctor) (needs mctor) (needs cassign) (needs massign) (needs dtor) Extent=[3:1 - 17:2] // CHECK-NEXT: CXXAccessSpecifier=:4:1 (Definition) Extent=[4:1 - 4:8] // CHECK-NEXT: CXXMethod=aMethod:5:51 Extent=[5:3 - 5:60] // CHECK-NEXT: attribute(annotate)=spiffy_method Extent=[5:18 - 5:43] diff --git a/clang/test/Index/availability.cpp b/clang/test/Index/availability.cpp --- a/clang/test/Index/availability.cpp +++ b/clang/test/Index/availability.cpp @@ -8,6 +8,6 @@ // RUN: c-index-test -test-print-type --std=c++11 %s | FileCheck %s // CHECK: FunctionDecl=foo:1:6 (unavailable) [type=void ()] [typekind=FunctionProto] [resulttype=void] [resulttypekind=Void] [isPOD=0] -// CHECK: StructDecl=Foo:3:8 (Definition) [type=Foo] [typekind=Record] [isPOD=1] +// CHECK: StructDecl=Foo:3:8 (Definition) (needs cassign) (needs massign) (needs dtor) [type=Foo] [typekind=Record] [isPOD=1] // CHECK: CXXMethod=foo:4:7 (unavailable) (deleted) [type=int (){{.*}}] [typekind=FunctionProto] [resulttype=int] [resulttypekind=Int] [isPOD=0] // CHECK: CXXConstructor=Foo:5:3 (unavailable) (default constructor) (deleted) [type=void (){{.*}}] [typekind=FunctionProto] [resulttype=void] [resulttypekind=Void] [isPOD=0] diff --git a/clang/test/Index/deletion.cpp b/clang/test/Index/deletion.cpp --- a/clang/test/Index/deletion.cpp +++ b/clang/test/Index/deletion.cpp @@ -7,7 +7,7 @@ // RUN: c-index-test -test-print-type --std=c++11 %s | FileCheck %s -// CHECK: StructDecl=Foo:1:8 (Definition) [type=Foo] [typekind=Record] [isPOD=1] +// CHECK: StructDecl=Foo:1:8 (Definition) (needs cassign) (needs massign) (needs dtor) [type=Foo] [typekind=Record] [isPOD=1] // CHECK: CXXMethod=foo:2:7 (unavailable) (deleted) [type=int (){{.*}}] [typekind=FunctionProto] [resulttype=int] [resulttypekind=Int] [isPOD=0] // CHECK: CXXMethod=bar:3:7 [type=int (){{.*}}] [typekind=FunctionProto] [resulttype=int] [resulttypekind=Int] [isPOD=0] // CHECK: CXXConstructor=Foo:4:3 (unavailable) (default constructor) (deleted) [type=void (){{.*}}] [typekind=FunctionProto] [resulttype=void] [resulttypekind=Void] [isPOD=0] diff --git a/clang/test/Index/file-refs.cpp b/clang/test/Index/file-refs.cpp --- a/clang/test/Index/file-refs.cpp +++ b/clang/test/Index/file-refs.cpp @@ -58,7 +58,7 @@ // RUN: -file-refs-at=%s:2:9 \ // CHECK-NEXT: ClassDecl=C:2:9 (Definition) -// CHECK-NEXT: ClassDecl=C:2:9 (Definition) =[2:9 - 2:10] +// CHECK-NEXT: ClassDecl=C:2:9 (Definition) (needs cassign) (needs massign) =[2:9 - 2:10] // CHECK-NEXT: CXXConstructor=C:4:5 (Definition) (default constructor) =[4:5 - 4:6] // CHECK-NEXT: TypeRef=class NS::C:2:9 =[9:10 - 9:11] // CHECK-NEXT: TypeRef=class NS::C:2:9 =[10:3 - 10:4] @@ -68,7 +68,7 @@ // RUN: -file-refs-at=%s:16:18 \ // CHECK-NEXT: CallExpr=C:4:5 -// CHECK-NEXT: ClassDecl=C:2:9 (Definition) =[2:9 - 2:10] +// CHECK-NEXT: ClassDecl=C:2:9 (Definition) (needs cassign) (needs massign) =[2:9 - 2:10] // CHECK-NEXT: CXXConstructor=C:4:5 (Definition) (default constructor) =[4:5 - 4:6] // CHECK-NEXT: TypeRef=class NS::C:2:9 =[9:10 - 9:11] // CHECK-NEXT: TypeRef=class NS::C:2:9 =[10:3 - 10:4] diff --git a/clang/test/Index/get-cursor.cpp b/clang/test/Index/get-cursor.cpp --- a/clang/test/Index/get-cursor.cpp +++ b/clang/test/Index/get-cursor.cpp @@ -221,7 +221,7 @@ // CHECK-TEMPLPARAM: 55:23 TypeRef=struct X:3:8 Extent=[55:23 - 55:24] Spelling=struct X ([55:23 - 55:24]) // RUN: c-index-test -cursor-at=%s:66:23 %s | FileCheck -check-prefix=CHECK-TEMPLSPEC %s -// CHECK-TEMPLSPEC: 66:23 ClassDecl=TC:66:23 (Definition) [Specialization of TC:59:7] [Template arg 0: kind: 1, type: char] Extent=[66:1 - 66:31] Spelling=TC ([66:23 - 66:25]) +// CHECK-TEMPLSPEC: 66:23 ClassDecl=TC:66:23 (Definition) (needs ctor) (needs cctor) (needs mctor) (needs cassign) (needs massign) (needs dtor) [Specialization of TC:59:7] [Template arg 0: kind: 1, type: char] Extent=[66:1 - 66:31] Spelling=TC ([66:23 - 66:25]) // RUN: c-index-test -cursor-at=%s:69:3 -cursor-at=%s:70:11 -cursor-at=%s:73:6 -cursor-at=%s:74:6 -cursor-at=%s:77:8 -cursor-at=%s:78:8 -cursor-at=%s:79:8 -cursor-at=%s:80:8 -cursor-at=%s:81:8 -cursor-at=%s:82:8 -cursor-at=%s:85:6 -cursor-at=%s:86:6 -cursor-at=%s:87:6 -cursor-at=%s:88:6 -cursor-at=%s:91:5 -cursor-at=%s:92:5 -cursor-at=%s:93:5 -cursor-at=%s:94:5 -cursor-at=%s:95:5 -cursor-at=%s:96:5 -cursor-at=%s:97:5 -cursor-at=%s:98:5 -cursor-at=%s:100:5 -cursor-at=%s:101:5 -cursor-at=%s:104:6 -cursor-at=%s:105:6 -cursor-at=%s:106:6 -cursor-at=%s:107:6 -cursor-at=%s:108:6 -cursor-at=%s:109:6 -cursor-at=%s:110:6 -cursor-at=%s:111:6 -cursor-at=%s:113:6 -cursor-at=%s:114:6 -cursor-at=%s:117:8 -cursor-at=%s:118:8 -cursor-at=%s:120:8 -cursor-at=%s:121:8 -cursor-at=%s:122:8 -cursor-at=%s:123:8 -cursor-at=%s:124:8 -cursor-at=%s:125:8 -cursor-at=%s:128:6 -cursor-at=%s:129:6 -cursor-at=%s:130:6 -cursor-at=%s:132:3 -cursor-at=%s:146:15 -cursor-at=%s:149:6 -cursor-at=%s:150:25 -cursor-at=%s:151:6 -cursor-at=%s:152:6 -cursor-at=%s:153:6 -cursor-at=%s:154:6 -cursor-at=%s:155:6 -std=c++11 %s | FileCheck -check-prefix=CHECK-SPELLING %s // CHECK-SPELLING: 69:3 CXXConstructor=A:69:3 (default constructor) Extent=[69:3 - 69:6] Spelling=A ([69:3 - 69:4]) diff --git a/clang/test/Index/index-templates.cpp b/clang/test/Index/index-templates.cpp --- a/clang/test/Index/index-templates.cpp +++ b/clang/test/Index/index-templates.cpp @@ -130,14 +130,14 @@ // CHECK-LOAD: index-templates.cpp:8:31: TemplateTypeParameter=Alloc:8:31 (Definition) Extent=[8:22 - 8:51] // CHECK-LOAD: index-templates.cpp:8:39: TemplateRef=allocator:6:28 Extent=[8:39 - 8:48] // CHECK-LOAD: index-templates.cpp:10:8: CXXMethod=clear:10:8 Extent=[10:3 - 10:15] -// CHECK-LOAD: index-templates.cpp:14:7: ClassTemplatePartialSpecialization=vector:14:7 (Definition) [Specialization of vector:9:7] [Template arg 0: kind: 1, type: type-parameter-0-0 *] [Template arg 1: kind: 1, type: allocator] Extent=[13:1 - 14:21] +// CHECK-LOAD: index-templates.cpp:14:7: ClassTemplatePartialSpecialization=vector:14:7 (Definition) (needs ctor) (needs cctor) (needs mctor) (needs cassign) (needs massign) (needs dtor) [Specialization of vector:9:7] [Template arg 0: kind: 1, type: type-parameter-0-0 *] [Template arg 1: kind: 1, type: allocator] Extent=[13:1 - 14:21] // CHECK-LOAD: index-templates.cpp:13:19: TemplateTypeParameter=T:13:19 (Definition) Extent=[13:10 - 13:20] -// CHECK-LOAD: index-templates.cpp:16:8: StructDecl=Z1:16:8 (Definition) Extent=[16:1 - 16:14] -// CHECK-LOAD: index-templates.cpp:18:16: ClassDecl=vector:18:16 (Definition) [Specialization of vector:9:7] [Template arg 0: kind: 1, type: Z1] [Template arg 1: kind: 1, type: allocator] Extent=[18:1 - 18:26] +// CHECK-LOAD: index-templates.cpp:16:8: StructDecl=Z1:16:8 (Definition) (needs ctor) (needs cctor) (needs mctor) (needs cassign) (needs massign) (needs dtor) Extent=[16:1 - 16:14] +// CHECK-LOAD: index-templates.cpp:18:16: ClassDecl=vector:18:16 (Definition) (needs ctor) (needs cctor) (needs mctor) (needs cassign) (needs massign) (needs dtor) [Specialization of vector:9:7] [Template arg 0: kind: 1, type: Z1] [Template arg 1: kind: 1, type: allocator] Extent=[18:1 - 18:26] // CHECK-LOAD: index-templates.cpp:18:23: TypeRef=struct Z1:16:8 Extent=[18:23 - 18:25] // CHECK-LOAD-NOT: CXXMethod=clear -// CHECK-LOAD: index-templates.cpp:20:8: StructDecl=Z2:20:8 (Definition) Extent=[20:1 - 20:14] -// CHECK-LOAD: index-templates.cpp:23:7: ClassDecl=vector:23:7 (Definition) [Specialization of vector:9:7] [Template arg 0: kind: 1, type: Z2] [Template arg 1: kind: 1, type: allocator] Extent=[22:1 - 25:2] +// CHECK-LOAD: index-templates.cpp:20:8: StructDecl=Z2:20:8 (Definition) (needs ctor) (needs cctor) (needs mctor) (needs cassign) (needs massign) (needs dtor) Extent=[20:1 - 20:14] +// CHECK-LOAD: index-templates.cpp:23:7: ClassDecl=vector:23:7 (Definition) (needs ctor) (needs cctor) (needs mctor) (needs cassign) (needs massign) (needs dtor) [Specialization of vector:9:7] [Template arg 0: kind: 1, type: Z2] [Template arg 1: kind: 1, type: allocator] Extent=[22:1 - 25:2] // CHECK-LOAD: index-templates.cpp:23:14: TypeRef=struct Z2:20:8 Extent=[23:14 - 23:16] // CHECK-LOAD: index-templates.cpp:24:8: CXXMethod=clear:24:8 Extent=[24:3 - 24:15] // CHECK-LOAD: index-templates.cpp:28:8: ClassTemplate=Y:28:8 (Definition) Extent=[27:1 - 31:2] @@ -163,8 +163,8 @@ // CHECK-LOAD: index-templates.cpp:44:19: TemplateTypeParameter=T:44:19 (Definition) Extent=[44:10 - 44:20] // CHECK-LOAD: index-templates.cpp:44:31: NonTypeTemplateParameter=Value:44:31 (Definition) Extent=[44:22 - 44:36] // CHECK-LOAD: index-templates.cpp:44:22: TypeRef=Unsigned:42:18 Extent=[44:22 - 44:30] -// CHECK-LOAD: index-templates.cpp:47:16: ClassDecl=vector:47:16 (Definition) [Specialization of vector:14:7] [Template arg 0: kind: 1, type: int *] [Template arg 1: kind: 1, type: allocator] Extent=[47:1 - 47:28] -// CHECK-LOAD: index-templates.cpp:49:8: StructDecl=Z4:49:8 (Definition) Extent=[49:1 - 51:2] +// CHECK-LOAD: index-templates.cpp:47:16: ClassDecl=vector:47:16 (Definition) (needs ctor) (needs cctor) (needs mctor) (needs cassign) (needs massign) (needs dtor) [Specialization of vector:14:7] [Template arg 0: kind: 1, type: int *] [Template arg 1: kind: 1, type: allocator] Extent=[47:1 - 47:28] +// CHECK-LOAD: index-templates.cpp:49:8: StructDecl=Z4:49:8 (Definition) (needs cassign) (needs massign) Extent=[49:1 - 51:2] // CHECK-LOAD: index-templates.cpp:50:26: FunctionTemplate=getAs:50:26 Extent=[50:3 - 50:33] // CHECK-LOAD: index-templates.cpp:50:21: TemplateTypeParameter=T:50:21 (Definition) Extent=[50:12 - 50:22] // CHECK-LOAD: index-templates.cpp:53:6: FunctionDecl=template_exprs:53:6 (Definition) @@ -186,7 +186,7 @@ // CHECK-LOAD: index-templates.cpp:85:20: DeclRefExpr=t:82:18 Extent=[85:20 - 85:21] // CHECK-LOAD: index-templates.cpp:85:23: TypeRef=second_type:83:13 Extent=[85:23 - 85:34] // CHECK-LOAD: index-templates.cpp:85:35: DeclRefExpr=u:82:23 Extent=[85:35 - 85:36] -// CHECK-LOAD: index-templates.cpp:98:16: StructDecl=Pair:98:16 (Definition) [Specialization of Pair:76:8] [Template arg 0: kind: 1, type: int] [Template arg 1: kind: 1, type: int] Extent=[98:1 - 98:30] +// CHECK-LOAD: index-templates.cpp:98:16: StructDecl=Pair:98:16 (Definition) (needs ctor) (needs cctor) (needs mctor) (needs cassign) (needs massign) (needs dtor) [Specialization of Pair:76:8] [Template arg 0: kind: 1, type: int] [Template arg 1: kind: 1, type: int] Extent=[98:1 - 98:30] // CHECK-LOAD: index-templates.cpp:101:8: ClassTemplate=SuperPair:101:8 (Definition) Extent=[100:1 - 101:50] // CHECK-LOAD: index-templates.cpp:100:19: TemplateTypeParameter=T:100:19 (Definition) Extent=[100:10 - 100:20] // CHECK-LOAD: index-templates.cpp:100:31: TemplateTypeParameter=U:100:31 (Definition) Extent=[100:22 - 100:32] diff --git a/clang/test/Index/keep-going.cpp b/clang/test/Index/keep-going.cpp --- a/clang/test/Index/keep-going.cpp +++ b/clang/test/Index/keep-going.cpp @@ -25,10 +25,10 @@ // CHECK: TemplateTypeParameter=T:3:16 (Definition) [type=T] [typekind=Unexposed] [canonicaltype=type-parameter-0-0] [canonicaltypekind=Unexposed] [isPOD=0] // CHECK: FieldDecl=a:4:13 (Definition) [type=T] [typekind=Unexposed] [canonicaltype=type-parameter-0-0] [canonicaltypekind=Unexposed] [isPOD=0] // CHECK: TypeRef=T:3:16 [type=T] [typekind=Unexposed] [canonicaltype=type-parameter-0-0] [canonicaltypekind=Unexposed] [isPOD=0] -// CHECK: ClassDecl=B:6:7 (Definition) [type=B] [typekind=Record] [isPOD=0] +// CHECK: ClassDecl=B:6:7 (Definition) (needs ctor) (needs cctor) (needs mctor) (needs cassign) (needs massign) (needs dtor) [type=B] [typekind=Record] [isPOD=0] // CHECK: C++ base class specifier=A:4:7 [access=public isVirtual=false] [type=A] [typekind=Elaborated] [templateargs/1= [type=int] [typekind=Int]] [canonicaltype=A] [canonicaltypekind=Record] [canonicaltemplateargs/1= [type=int] [typekind=Int]] [isPOD=0] [nbFields=1] // CHECK: TemplateRef=A:4:7 [type=] [typekind=Invalid] [isPOD=0] -// CHECK: ClassDecl=C:10:7 (Definition) [type=C] [typekind=Record] [isPOD=0] +// CHECK: ClassDecl=C:10:7 (Definition) (needs ctor) (needs cctor) (needs mctor) (needs cassign) (needs massign) (needs dtor) [type=C] [typekind=Record] [isPOD=0] // CHECK: C++ base class specifier=A:4:7 [access=public isVirtual=false] [type=A] [typekind=Elaborated] [templateargs/1= [type=float] [typekind=Float]] [canonicaltype=A] [canonicaltypekind=Record] [canonicaltemplateargs/1= [type=float] [typekind=Float]] [isPOD=0] [nbFields=1] // CHECK: TemplateRef=A:4:7 [type=] [typekind=Invalid] [isPOD=0] diff --git a/clang/test/Index/load-stmts.cpp b/clang/test/Index/load-stmts.cpp --- a/clang/test/Index/load-stmts.cpp +++ b/clang/test/Index/load-stmts.cpp @@ -119,7 +119,7 @@ // RUN: c-index-test -test-load-source all -fno-delayed-template-parsing -frtti %s | FileCheck %s // CHECK: load-stmts.cpp:1:13: TypedefDecl=T:1:13 (Definition) Extent=[1:1 - 1:14] -// CHECK: load-stmts.cpp:2:8: StructDecl=X:2:8 (Definition) Extent=[2:1 - 2:23] +// CHECK: load-stmts.cpp:2:8: StructDecl=X:2:8 (Definition) (needs ctor) (needs cctor) (needs mctor) (needs cassign) (needs massign) (needs dtor) Extent=[2:1 - 2:23] // CHECK: load-stmts.cpp:2:16: FieldDecl=a:2:16 (Definition) Extent=[2:12 - 2:17] // CHECK: load-stmts.cpp:2:19: FieldDecl=b:2:19 (Definition) Extent=[2:12 - 2:20] // CHECK: load-stmts.cpp:3:6: FunctionDecl=f:3:6 (Definition) Extent=[3:1 - 11:2] @@ -151,15 +151,15 @@ // CHECK: load-stmts.cpp:8:18: DeclRefExpr=x:3:12 Extent=[8:18 - 8:19] // CHECK: load-stmts.cpp:8:13: DeclRefExpr=z4:8:13 Extent=[8:13 - 8:15] // CHECK: load-stmts.cpp:9:8: IntegerLiteral= Extent=[9:8 - 9:10] -// CHECK: load-stmts.cpp:14:7: ClassDecl=A:14:7 (Definition) Extent=[14:1 - 16:2] +// CHECK: load-stmts.cpp:14:7: ClassDecl=A:14:7 (Definition) (needs ctor) (needs cctor) (needs mctor) Extent=[14:1 - 16:2] // CHECK: load-stmts.cpp:15:8: CXXMethod=doA:15:8 Extent=[15:3 - 15:13] -// CHECK: load-stmts.cpp:18:7: ClassDecl=B:18:7 (Definition) Extent=[18:1 - 20:2] +// CHECK: load-stmts.cpp:18:7: ClassDecl=B:18:7 (Definition) (needs ctor) (needs cctor) (needs mctor) Extent=[18:1 - 20:2] // CHECK: load-stmts.cpp:19:8: CXXMethod=doB:19:8 Extent=[19:3 - 19:13] -// CHECK: load-stmts.cpp:22:7: ClassDecl=C:22:7 (Definition) Extent=[22:1 - 24:2] +// CHECK: load-stmts.cpp:22:7: ClassDecl=C:22:7 (Definition) (needs ctor) (needs cctor) (needs mctor) Extent=[22:1 - 24:2] // CHECK: load-stmts.cpp:22:18: C++ base class specifier=A:14:7 [access=public isVirtual=false] // CHECK: load-stmts.cpp:22:29: C++ base class specifier=B:18:7 [access=private isVirtual=false] // CHECK: load-stmts.cpp:23:8: CXXMethod=doC:23:8 Extent=[23:3 - 23:13] -// CHECK: load-stmts.cpp:26:7: ClassDecl=D:26:7 (Definition) Extent=[26:1 - 26:49] +// CHECK: load-stmts.cpp:26:7: ClassDecl=D:26:7 (Definition) (needs ctor) (needs cctor) (needs mctor) Extent=[26:1 - 26:49] // CHECK: load-stmts.cpp:26:26: C++ base class specifier=C:22:7 [access=public isVirtual=true] // CHECK: load-stmts.cpp:26:45: C++ base class specifier=A:14:7 [access=private isVirtual=true] // CHECK: load-stmts.cpp:33:7: VarDecl=typeid_marker:33:7 (Definition) diff --git a/clang/test/Index/print-display-names.cpp b/clang/test/Index/print-display-names.cpp --- a/clang/test/Index/print-display-names.cpp +++ b/clang/test/Index/print-display-names.cpp @@ -22,7 +22,7 @@ // RUN: env CINDEXTEST_PRINTINGPOLICY_TERSEOUTPUT=1 c-index-test -test-load-source all-pretty %s | FileCheck %s --check-prefix=PRETTY // PRETTY: print-display-names.cpp:2:7: ClassTemplate=template class ClassTmpl {}:2:7 (Definition) Extent=[1:1 - 2:20] // PRETTY: print-display-names.cpp:4:13: TypedefDecl=typedef int Integer:4:13 (Definition) Extent=[4:1 - 4:20] -// PRETTY: print-display-names.cpp:6:16: ClassDecl=template<> class ClassTmpl {}:6:16 (Definition) [Specialization of ClassTmpl:2:7] [Template arg 0: kind: 1, type: int] [Template arg 1: kind: 1, type: int] Extent=[6:1 - 6:43] +// PRETTY: print-display-names.cpp:6:16: ClassDecl=template<> class ClassTmpl {}:6:16 (Definition) (needs ctor) (needs cctor) (needs mctor) (needs cassign) (needs massign) (needs dtor) [Specialization of ClassTmpl:2:7] [Template arg 0: kind: 1, type: int] [Template arg 1: kind: 1, type: int] Extent=[6:1 - 6:43] // PRETTY: print-display-names.cpp:8:6: FunctionDecl=void f(ClassTmpl p):8:6 Extent=[8:1 - 8:36] // PRETTY: print-display-names.cpp:8:34: ParmDecl=ClassTmpl p:8:34 (Definition) Extent=[8:8 - 8:35] // PRETTY: print-display-names.cpp:11:6: FunctionTemplate=template void g(ClassTmpl):11:6 Extent=[10:1 - 11:24] diff --git a/clang/test/Index/print-type-size.cpp b/clang/test/Index/print-type-size.cpp --- a/clang/test/Index/print-type-size.cpp +++ b/clang/test/Index/print-type-size.cpp @@ -13,8 +13,8 @@ void *v1; // offsetof -// CHECK64: StructDecl=simple:[[@LINE+2]]:8 (Definition) [type=basic::simple] [typekind=Record] [sizeof=48] [alignof=8] -// CHECK32: StructDecl=simple:[[@LINE+1]]:8 (Definition) [type=basic::simple] [typekind=Record] [sizeof=36] [alignof=4] +// CHECK64: StructDecl=simple:[[@LINE+2]]:8 (Definition) (needs cassign) (needs massign) (needs dtor) [type=basic::simple] [typekind=Record] [sizeof=48] [alignof=8] +// CHECK32: StructDecl=simple:[[@LINE+1]]:8 (Definition) (needs cassign) (needs massign) (needs dtor) [type=basic::simple] [typekind=Record] [sizeof=36] [alignof=4] struct simple { int a; char b; @@ -211,21 +211,21 @@ namespace Sizes { -// CHECK64: StructDecl=A:[[@LINE+2]]:8 (Definition) [type=Sizes::A] [typekind=Record] [sizeof=8] [alignof=4] -// CHECK32: StructDecl=A:[[@LINE+1]]:8 (Definition) [type=Sizes::A] [typekind=Record] [sizeof=8] [alignof=4] +// CHECK64: StructDecl=A:[[@LINE+2]]:8 (Definition) (needs cassign) (needs massign) [type=Sizes::A] [typekind=Record] [sizeof=8] [alignof=4] +// CHECK32: StructDecl=A:[[@LINE+1]]:8 (Definition) (needs cassign) (needs massign) [type=Sizes::A] [typekind=Record] [sizeof=8] [alignof=4] struct A { int a; char b; }; -// CHECK64: StructDecl=B:[[@LINE+2]]:8 (Definition) [type=Sizes::B] [typekind=Record] [sizeof=12] [alignof=4] -// CHECK32: StructDecl=B:[[@LINE+1]]:8 (Definition) [type=Sizes::B] [typekind=Record] [sizeof=12] [alignof=4] +// CHECK64: StructDecl=B:[[@LINE+2]]:8 (Definition) (needs ctor) (needs cctor) (needs mctor) (needs cassign) (needs massign) (needs dtor) [type=Sizes::B] [typekind=Record] [sizeof=12] [alignof=4] +// CHECK32: StructDecl=B:[[@LINE+1]]:8 (Definition) (needs ctor) (needs cctor) (needs mctor) (needs cassign) (needs massign) (needs dtor) [type=Sizes::B] [typekind=Record] [sizeof=12] [alignof=4] struct B : A { char c; }; -// CHECK64: StructDecl=C:[[@LINE+2]]:8 (Definition) [type=Sizes::C] [typekind=Record] [sizeof=8] [alignof=4] -// CHECK32: StructDecl=C:[[@LINE+1]]:8 (Definition) [type=Sizes::C] [typekind=Record] [sizeof=8] [alignof=4] +// CHECK64: StructDecl=C:[[@LINE+2]]:8 (Definition) (needs ctor) (needs cctor) (needs mctor) (needs cassign) (needs massign) (needs dtor) [type=Sizes::C] [typekind=Record] [sizeof=8] [alignof=4] +// CHECK32: StructDecl=C:[[@LINE+1]]:8 (Definition) (needs ctor) (needs cctor) (needs mctor) (needs cassign) (needs massign) (needs dtor) [type=Sizes::C] [typekind=Record] [sizeof=8] [alignof=4] struct C { // Make fields private so C won't be a POD type. private: @@ -233,32 +233,32 @@ char b; }; -// CHECK64: StructDecl=D:[[@LINE+2]]:8 (Definition) [type=Sizes::D] [typekind=Record] [sizeof=8] [alignof=4] -// CHECK32: StructDecl=D:[[@LINE+1]]:8 (Definition) [type=Sizes::D] [typekind=Record] [sizeof=8] [alignof=4] +// CHECK64: StructDecl=D:[[@LINE+2]]:8 (Definition) (needs ctor) (needs cctor) (needs mctor) (needs cassign) (needs massign) (needs dtor) [type=Sizes::D] [typekind=Record] [sizeof=8] [alignof=4] +// CHECK32: StructDecl=D:[[@LINE+1]]:8 (Definition) (needs ctor) (needs cctor) (needs mctor) (needs cassign) (needs massign) (needs dtor) [type=Sizes::D] [typekind=Record] [sizeof=8] [alignof=4] struct D : C { char c; }; -// CHECK64: StructDecl=E:[[@LINE+2]]:32 (Definition) [type=Sizes::E] [typekind=Record] [sizeof=5] [alignof=1] -// CHECK32: StructDecl=E:[[@LINE+1]]:32 (Definition) [type=Sizes::E] [typekind=Record] [sizeof=5] [alignof=1] +// CHECK64: StructDecl=E:[[@LINE+2]]:32 (Definition) (needs ctor) (needs cctor) (needs mctor) (needs cassign) (needs massign) (needs dtor) [type=Sizes::E] [typekind=Record] [sizeof=5] [alignof=1] +// CHECK32: StructDecl=E:[[@LINE+1]]:32 (Definition) (needs ctor) (needs cctor) (needs mctor) (needs cassign) (needs massign) (needs dtor) [type=Sizes::E] [typekind=Record] [sizeof=5] [alignof=1] struct __attribute__((packed)) E { char b; int a; }; -// CHECK64: StructDecl=F:[[@LINE+2]]:32 (Definition) [type=Sizes::F] [typekind=Record] [sizeof=6] [alignof=1] -// CHECK32: StructDecl=F:[[@LINE+1]]:32 (Definition) [type=Sizes::F] [typekind=Record] [sizeof=6] [alignof=1] +// CHECK64: StructDecl=F:[[@LINE+2]]:32 (Definition) (needs ctor) (needs cctor) (needs mctor) (needs cassign) (needs massign) (needs dtor) [type=Sizes::F] [typekind=Record] [sizeof=6] [alignof=1] +// CHECK32: StructDecl=F:[[@LINE+1]]:32 (Definition) (needs ctor) (needs cctor) (needs mctor) (needs cassign) (needs massign) (needs dtor) [type=Sizes::F] [typekind=Record] [sizeof=6] [alignof=1] struct __attribute__((packed)) F : E { char d; }; struct G { G(); }; -// CHECK64: StructDecl=H:[[@LINE+2]]:8 (Definition) [type=Sizes::H] [typekind=Record] [sizeof=1] [alignof=1] -// CHECK32: StructDecl=H:[[@LINE+1]]:8 (Definition) [type=Sizes::H] [typekind=Record] [sizeof=1] [alignof=1] +// CHECK64: StructDecl=H:[[@LINE+2]]:8 (Definition) (needs ctor) (needs cctor) (needs mctor) (needs cassign) (needs massign) (needs dtor) [type=Sizes::H] [typekind=Record] [sizeof=1] [alignof=1] +// CHECK32: StructDecl=H:[[@LINE+1]]:8 (Definition) (needs ctor) (needs cctor) (needs mctor) (needs cassign) (needs massign) (needs dtor) [type=Sizes::H] [typekind=Record] [sizeof=1] [alignof=1] struct H : G { }; -// CHECK64: StructDecl=I:[[@LINE+2]]:8 (Definition) [type=Sizes::I] [typekind=Record] [sizeof=5] [alignof=1] -// CHECK32: StructDecl=I:[[@LINE+1]]:8 (Definition) [type=Sizes::I] [typekind=Record] [sizeof=5] [alignof=1] +// CHECK64: StructDecl=I:[[@LINE+2]]:8 (Definition) (needs cassign) (needs massign) [type=Sizes::I] [typekind=Record] [sizeof=5] [alignof=1] +// CHECK32: StructDecl=I:[[@LINE+1]]:8 (Definition) (needs cassign) (needs massign) [type=Sizes::I] [typekind=Record] [sizeof=5] [alignof=1] struct I { char b; int a; @@ -275,8 +275,8 @@ struct D : virtual B { }; struct E : C, virtual D { }; class F : virtual E { }; -// CHECK64: StructDecl=G:[[@LINE+2]]:8 (Definition) [type=Test1::G] [typekind=Record] [sizeof=24] [alignof=8] -// CHECK32: StructDecl=G:[[@LINE+1]]:8 (Definition) [type=Test1::G] [typekind=Record] [sizeof=16] [alignof=4] +// CHECK64: StructDecl=G:[[@LINE+2]]:8 (Definition) (needs ctor) (needs cctor) (needs mctor) [type=Test1::G] [typekind=Record] [sizeof=24] [alignof=8] +// CHECK32: StructDecl=G:[[@LINE+1]]:8 (Definition) (needs ctor) (needs cctor) (needs mctor) [type=Test1::G] [typekind=Record] [sizeof=16] [alignof=4] struct G : virtual E, F { }; } @@ -291,8 +291,8 @@ struct E : virtual B, D { }; struct F : E, virtual C { }; struct G : virtual F, A { }; -// CHECK64: StructDecl=H:[[@LINE+2]]:8 (Definition) [type=Test2::H] [typekind=Record] [sizeof=24] [alignof=8] -// CHECK32: StructDecl=H:[[@LINE+1]]:8 (Definition) [type=Test2::H] [typekind=Record] [sizeof=12] [alignof=4] +// CHECK64: StructDecl=H:[[@LINE+2]]:8 (Definition) (needs ctor) (needs cctor) (needs mctor) (needs cassign) (needs massign) (needs dtor) [type=Test2::H] [typekind=Record] [sizeof=24] [alignof=8] +// CHECK32: StructDecl=H:[[@LINE+1]]:8 (Definition) (needs ctor) (needs cctor) (needs mctor) (needs cassign) (needs massign) (needs dtor) [type=Test2::H] [typekind=Record] [sizeof=12] [alignof=4] struct H { G g; }; } @@ -395,8 +395,8 @@ plopplop; -// CHECK64: StructDecl=lastValid:[[@LINE+2]]:8 (Definition) [type=CrashTest::lastValid] [typekind=Record] [sizeof=1] [alignof=1] -// CHECK32: StructDecl=lastValid:[[@LINE+1]]:8 (Definition) [type=CrashTest::lastValid] [typekind=Record] [sizeof=1] [alignof=1] +// CHECK64: StructDecl=lastValid:[[@LINE+2]]:8 (Definition) (needs ctor) (needs cctor) (needs mctor) (needs cassign) (needs massign) (needs dtor) [type=CrashTest::lastValid] [typekind=Record] [sizeof=1] [alignof=1] +// CHECK32: StructDecl=lastValid:[[@LINE+1]]:8 (Definition) (needs ctor) (needs cctor) (needs mctor) (needs cassign) (needs massign) (needs dtor) [type=CrashTest::lastValid] [typekind=Record] [sizeof=1] [alignof=1] struct lastValid { }; diff --git a/clang/test/Index/print-type.cpp b/clang/test/Index/print-type.cpp --- a/clang/test/Index/print-type.cpp +++ b/clang/test/Index/print-type.cpp @@ -103,7 +103,7 @@ // CHECK: NonTypeTemplateParameter=U:8:32 (Definition) [type=unsigned int] [typekind=UInt] [isPOD=1] // CHECK: TemplateTemplateParameter=W:8:60 (Definition) [type=] [typekind=Invalid] [isPOD=0] // CHECK: Namespace=inner:14:11 (Definition) [type=] [typekind=Invalid] [isPOD=0] -// CHECK: StructDecl=Bar:16:8 (Definition) [type=outer::inner::Bar] [typekind=Record] [isPOD=0] [nbFields=3] +// CHECK: StructDecl=Bar:16:8 (Definition) (needs cassign) (needs massign) (needs dtor) [type=outer::inner::Bar] [typekind=Record] [isPOD=0] [nbFields=3] // CHECK: CXXConstructor=Bar:17:3 (Definition) (converting constructor) [type=void (outer::Foo *){{.*}}] [typekind=FunctionProto] [canonicaltype=void (outer::Foo *){{.*}}] [canonicaltypekind=FunctionProto] [resulttype=void] [resulttypekind=Void] [args= [outer::Foo *] [Pointer]] [isPOD=0] // CHECK: ParmDecl=foo:17:25 (Definition) [type=outer::Foo *] [typekind=Pointer] [canonicaltype=outer::Foo *] [canonicaltypekind=Pointer] [isPOD=1] [pointeetype=outer::Foo] [pointeekind=Elaborated] // CHECK: NamespaceRef=outer:1:11 [type=] [typekind=Invalid] [isPOD=0] @@ -161,7 +161,7 @@ // CHECK: DeclStmt= [type=] [typekind=Invalid] [isPOD=0] // CHECK: VarDecl=variable_array:44:47 (Definition) [type=int[i]] [typekind=VariableArray] [isPOD=1] // CHECK: DeclRefExpr=i:44:14 [type=int] [typekind=Int] [isPOD=1] -// CHECK: StructDecl=Blob:46:8 (Definition) [type=Blob] [typekind=Record] [isPOD=1] [nbFields=2] +// CHECK: StructDecl=Blob:46:8 (Definition) (needs cassign) (needs massign) (needs dtor) [type=Blob] [typekind=Record] [isPOD=1] [nbFields=2] // CHECK: FieldDecl=i:47:7 (Definition) [type=int] [typekind=Int] [isPOD=1] // CHECK: VarDecl=member_pointer:50:12 (Definition) [type=int Blob::*] [typekind=MemberPointer] [isPOD=1] // CHECK: FunctionDecl=elaboratedNamespaceType:52:42 [type=NS::Type (const NS::Type)] [typekind=FunctionProto] [canonicaltype=NS::Type (NS::Type)] [canonicaltypekind=FunctionProto] [resulttype=NS::Type] [resulttypekind=Elaborated] [args= [const NS::Type] [Elaborated]] [isPOD=0] @@ -201,8 +201,8 @@ // CHECK: TypeAliasDecl=baz:76:7 (Definition) [type=baz] [typekind=Typedef] [templateargs/1= [type=A] [typekind=Elaborated]] [canonicaltype=A] [canonicaltypekind=Record] [canonicaltemplateargs/1= [type=void] [typekind=Void]] [isPOD=0] // CHECK: VarDecl=autoTemplPointer:78:6 (Definition) [type=Specialization &> *] [typekind=Auto] [canonicaltype=Specialization &> *] [canonicaltypekind=Pointer] [isPOD=1] [pointeetype=Specialization &>] [pointeekind=Auto] // CHECK: CallExpr=Bar:17:3 [type=outer::inner::Bar] [typekind=Elaborated] [canonicaltype=outer::inner::Bar] [canonicaltypekind=Record] [args= [outer::Foo *] [Pointer]] [isPOD=0] [nbFields=3] -// CHECK: StructDecl=:84:3 (Definition) [type=X::(anonymous struct at {{.*}}print-type.cpp:84:3)] [typekind=Record] [isPOD=1] [nbFields=1] [isAnon=1] -// CHECK: ClassDecl=:85:3 (Definition) [type=X::(anonymous class at {{.*}}print-type.cpp:85:3)] [typekind=Record] [isPOD=1] [nbFields=1] [isAnon=1] +// CHECK: StructDecl=:84:3 (Definition) (needs ctor) (needs cctor) (needs mctor) (needs cassign) (needs massign) (needs dtor) [type=X::(anonymous struct at {{.*}}print-type.cpp:84:3)] [typekind=Record] [isPOD=1] [nbFields=1] [isAnon=1] +// CHECK: ClassDecl=:85:3 (Definition) (needs ctor) (needs cctor) (needs mctor) (needs cassign) (needs massign) (needs dtor) [type=X::(anonymous class at {{.*}}print-type.cpp:85:3)] [typekind=Record] [isPOD=1] [nbFields=1] [isAnon=1] // CHECK: UnionDecl=:86:3 (Definition) [type=X::(anonymous union at {{.*}}print-type.cpp:86:3)] [typekind=Record] [isPOD=1] [nbFields=2] [isAnon=1] // CHECK: EnumDecl=:87:3 (Definition) [type=X::(unnamed enum at {{.*}}print-type.cpp:87:3)] [typekind=Enum] [isPOD=1] [isAnon=1] // CHECK: Namespace=:90:11 (Definition) [type=] [typekind=Invalid] [isPOD=0] [isAnon=1] diff --git a/clang/test/Index/recursive-cxx-member-calls.cpp b/clang/test/Index/recursive-cxx-member-calls.cpp --- a/clang/test/Index/recursive-cxx-member-calls.cpp +++ b/clang/test/Index/recursive-cxx-member-calls.cpp @@ -1542,8 +1542,8 @@ // CHECK: 8:3: TypeRef=size_t:2:25 Extent=[8:3 - 8:9] // CHECK: 8:29: ParmDecl=:8:29 (Definition) Extent=[8:17 - 8:29] // CHECK: 10:17: Namespace=clang:10:17 (Definition) Extent=[10:1 - 35:2] -// CHECK: 11:9: ClassDecl=IdentifierInfo:11:9 Extent=[11:3 - 11:23] -// CHECK: 12:9: ClassDecl=AttributeList:12:9 (Definition) Extent=[12:3 - 34:4] +// CHECK: 11:9: ClassDecl=IdentifierInfo:11:9 (needs cassign) (needs massign) (needs dtor) Extent=[11:3 - 11:23] +// CHECK: 12:9: ClassDecl=AttributeList:12:9 (Definition) (needs ctor) (needs cctor) (needs mctor) (needs cassign) (needs massign) (needs dtor) Extent=[12:3 - 34:4] // CHECK: 13:10: EnumDecl=Kind:13:10 (Definition) Extent=[13:5 - 32:6] // CHECK: 14:7: EnumConstantDecl=AT_IBAction:14:7 (Definition) Extent=[14:7 - 14:18] // CHECK: 14:20: EnumConstantDecl=AT_IBOutlet:14:20 (Definition) Extent=[14:20 - 14:31] @@ -1624,7 +1624,7 @@ // CHECK: 36:1: TypeRef=size_t:2:25 Extent=[36:1 - 36:7] // CHECK: 36:33: ParmDecl=s:36:33 (Definition) Extent=[36:21 - 36:34] // CHECK: 37:11: Namespace=llvm:37:11 (Definition) Extent=[37:1 - 64:2] -// CHECK: 38:7: ClassDecl=StringRef:38:7 (Definition) Extent=[38:1 - 63:2] +// CHECK: 38:7: ClassDecl=StringRef:38:7 (Definition) (needs massign) Extent=[38:1 - 63:2] // CHECK: 39:1: CXXAccessSpecifier=:39:1 (Definition) Extent=[39:1 - 39:8] // CHECK: 40:23: TypedefDecl=iterator:40:23 (Definition) Extent=[40:3 - 40:31] // CHECK: 41:23: VarDecl=npos:41:23 Extent=[41:3 - 41:40] @@ -1766,7 +1766,7 @@ // CHECK: 61:43: MemberRefExpr=Length:44:10 Extent=[61:43 - 61:49] // CHECK: 61:52: DeclRefExpr=Start:60:27 Extent=[61:52 - 61:57] // CHECK: 65:11: Namespace=clang:65:11 (Definition) Extent=[65:1 - 81:2] -// CHECK: 66:7: ClassDecl=IdentifierInfo:66:7 (Definition) Extent=[66:1 - 80:2] +// CHECK: 66:7: ClassDecl=IdentifierInfo:66:7 (Definition) (needs cassign) (needs massign) (needs dtor) Extent=[66:1 - 80:2] // CHECK: 67:1: CXXAccessSpecifier=:67:1 (Definition) Extent=[67:1 - 67:8] // CHECK: 67:8: CXXConstructor=IdentifierInfo:67:8 (default constructor) Extent=[67:8 - 67:24] // CHECK: 68:15: CXXMethod=getNameStart:68:15 (Definition) (const) Extent=[68:3 - 71:4] [access=public] diff --git a/clang/test/Index/redeclarations.cpp b/clang/test/Index/redeclarations.cpp --- a/clang/test/Index/redeclarations.cpp +++ b/clang/test/Index/redeclarations.cpp @@ -6,16 +6,16 @@ // RUN: env CINDEXTEST_EDITING=1 c-index-test -test-load-source-reparse 2 all -I%S/Inputs -fno-delayed-template-parsing -fno-ms-compatibility -fno-ms-extensions %s | FileCheck %s -// CHECK: redeclarations.h:1:7: ClassDecl=X:1:7 (Definition) Extent=[1:1 - 4:2] +// CHECK: redeclarations.h:1:7: ClassDecl=X:1:7 (Definition) (needs ctor) (needs cctor) (needs mctor) (needs cassign) (needs massign) (needs dtor) Extent=[1:1 - 4:2] // CHECK: redeclarations.h:8:7: ClassTemplate=B:8:7 (Definition) Extent=[7:1 - 10:2] // CHECK: redeclarations.h:7:20: TemplateTypeParameter=T1:7:20 (Definition) Extent=[7:11 - 7:22] // CHECK: redeclarations.h:7:33: TemplateTypeParameter=T2:7:33 (Definition) Extent=[7:24 - 7:35] // CHECK: redeclarations.h:13:8: ClassTemplate=C:13:8 (Definition) Extent=[12:1 - 15:2] // CHECK: redeclarations.h:12:17: TemplateTypeParameter=T:12:17 (Definition) Extent=[12:11 - 12:18] -// CHECK: redeclarations.h:17:7: ClassDecl=D:17:7 (Definition) Extent=[17:1 - 21:2] -// CHECK: redeclarations.h:19:16: ClassDecl=A:19:16 Extent=[19:10 - 19:17] +// CHECK: redeclarations.h:17:7: ClassDecl=D:17:7 (Definition) (needs ctor) (needs cctor) (needs mctor) (needs cassign) (needs massign) (needs dtor) Extent=[17:1 - 21:2] +// CHECK: redeclarations.h:19:16: ClassDecl=A:19:16 (needs ctor) (needs cctor) (needs mctor) (needs cassign) (needs massign) (needs dtor) Extent=[19:10 - 19:17] // CHECK: redeclarations.h:19:19: FieldDecl=x:19:19 (Definition) Extent=[19:5 - 19:20] // CHECK: redeclarations.h:19:5: TemplateRef=B:8:7 Extent=[19:5 - 19:6] // CHECK: redeclarations.h:19:7: TypeRef=class D:17:7 Extent=[19:7 - 19:8] // CHECK: redeclarations.h:19:16: TypeRef=class A:3:7 Extent=[19:16 - 19:17] -// CHECK: redeclarations.cpp:3:7: ClassDecl=A:3:7 (Definition) Extent=[3:1 - 5:2] +// CHECK: redeclarations.cpp:3:7: ClassDecl=A:3:7 (Definition) (needs ctor) (needs cctor) (needs mctor) (needs cassign) (needs massign) (needs dtor) Extent=[3:1 - 5:2] diff --git a/clang/test/Parser/skip-function-bodies.mm b/clang/test/Parser/skip-function-bodies.mm --- a/clang/test/Parser/skip-function-bodies.mm +++ b/clang/test/Parser/skip-function-bodies.mm @@ -28,11 +28,11 @@ } // RUN: env CINDEXTEST_SKIP_FUNCTION_BODIES=1 c-index-test -test-load-source all %s | FileCheck %s -// CHECK: skip-function-bodies.mm:3:7: ClassDecl=A:3:7 (Definition) Extent=[3:1 - 14:2] -// CHECK: skip-function-bodies.mm:4:9: ClassDecl=B:4:9 (Definition) Extent=[4:3 - 4:13] +// CHECK: skip-function-bodies.mm:3:7: ClassDecl=A:3:7 (Definition) (needs cassign) (needs massign) (needs dtor) Extent=[3:1 - 14:2] +// CHECK: skip-function-bodies.mm:4:9: ClassDecl=B:4:9 (Definition) (needs ctor) (needs cctor) (needs mctor) (needs cassign) (needs massign) (needs dtor) Extent=[4:3 - 4:13] // CHECK: skip-function-bodies.mm:6:1: CXXAccessSpecifier=:6:1 (Definition) Extent=[6:1 - 6:8] // CHECK: skip-function-bodies.mm:7:3: CXXConstructor=A:7:3 (default constructor) Extent=[7:3 - 7:6] -// CHECK-NOT: skip-function-bodies.mm:8:12: StructDecl=C:8:12 (Definition) Extent=[8:5 - 10:6] +// CHECK-NOT: skip-function-bodies.mm:8:12: StructDecl=C:8:12 (Definition) (needs ctor) (needs cctor) (needs mctor) (needs cassign) (needs massign) (needs dtor) Extent=[8:5 - 10:6] // CHECK-NOT: skip-function-bodies.mm:9:12: CXXMethod=d:9:12 (Definition) Extent=[9:7 - 9:18] // CHECK: skip-function-bodies.mm:13:13: TypedefDecl=E:13:13 (Definition) Extent=[13:3 - 13:14] // CHECK: skip-function-bodies.mm:13:11: TypeRef=class A::B:4:9 Extent=[13:11 - 13:12] @@ -52,5 +52,5 @@ // RUN: c-index-test -test-load-source all %s | FileCheck -check-prefix=CHECK-PREAMBLE %s // CHECK-PREAMBLE: skip-function-bodies.h:1:5: FunctionDecl=header1:1:5 Extent=[1:1 - 1:19] // CHECK-PREAMBLE-NOT: skip-function-bodies.h:2:3: ReturnStmt= Extent=[2:3 - 2:11] -// CHECK-PREAMBLE: skip-function-bodies.mm:8:12: StructDecl=C:8:12 (Definition) Extent=[8:5 - 10:6] +// CHECK-PREAMBLE: skip-function-bodies.mm:8:12: StructDecl=C:8:12 (Definition) (needs ctor) (needs cctor) (needs mctor) (needs cassign) (needs massign) (needs dtor) Extent=[8:5 - 10:6] // CHECK-PREAMBLE: skip-function-bodies.mm:9:12: CXXMethod=d:9:12 (Definition) Extent=[9:7 - 9:18] diff --git a/clang/tools/c-index-test/c-index-test.c b/clang/tools/c-index-test/c-index-test.c --- a/clang/tools/c-index-test/c-index-test.c +++ b/clang/tools/c-index-test/c-index-test.c @@ -920,6 +920,24 @@ printf(" (@optional)"); if (clang_isInvalidDeclaration(Cursor)) printf(" (invalid)"); + if (clang_CXXRecord_defaultedCopyConstructorIsDeleted(Cursor)) + printf(" (default-deleted cctor)"); + if (clang_CXXRecord_defaultedMoveConstructorIsDeleted(Cursor)) + printf(" (default-deleted mctor)"); + if (clang_CXXRecord_defaultedDestructorIsDeleted(Cursor)) + printf(" (default-deleted dtor)"); + if (clang_CXXRecord_needsImplicitDefaultConstructor(Cursor)) + printf(" (needs ctor)"); + if (clang_CXXRecord_needsImplicitCopyConstructor(Cursor)) + printf(" (needs cctor)"); + if (clang_CXXRecord_needsImplicitMoveConstructor(Cursor)) + printf(" (needs mctor)"); + if (clang_CXXRecord_needsImplicitCopyAssignment(Cursor)) + printf(" (needs cassign)"); + if (clang_CXXRecord_needsImplicitMoveAssignment(Cursor)) + printf(" (needs massign)"); + if (clang_CXXRecord_needsImplicitDestructor(Cursor)) + printf(" (needs dtor)"); switch (clang_getCursorExceptionSpecificationType(Cursor)) { diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp --- a/clang/tools/libclang/CIndex.cpp +++ b/clang/tools/libclang/CIndex.cpp @@ -2181,8 +2181,8 @@ void VisitOMPMaskedTaskLoopDirective(const OMPMaskedTaskLoopDirective *D); void VisitOMPMasterTaskLoopSimdDirective(const OMPMasterTaskLoopSimdDirective *D); - void VisitOMPMaskedTaskLoopSimdDirective( - const OMPMaskedTaskLoopSimdDirective *D); + void + VisitOMPMaskedTaskLoopSimdDirective(const OMPMaskedTaskLoopSimdDirective *D); void VisitOMPParallelMasterTaskLoopDirective( const OMPParallelMasterTaskLoopDirective *D); void VisitOMPParallelMaskedTaskLoopDirective( @@ -4767,7 +4767,7 @@ int reserved; enum CXChildVisitResult (*invoke)(struct _CXChildVisitResult *, CXCursor, CXCursor); -} * CXCursorVisitorBlock; +} *CXCursorVisitorBlock; static enum CXChildVisitResult visitWithBlock(CXCursor cursor, CXCursor parent, CXClientData client_data) { @@ -8903,6 +8903,109 @@ return (RD && RD->isAbstract()) ? 1 : 0; } +unsigned clang_CXXRecord_defaultedCopyConstructorIsDeleted(CXCursor C) { + if (!clang_isDeclaration(C.kind)) + return 0; + + const auto *D = cxcursor::getCursorDecl(C); + const auto *RD = dyn_cast_if_present(D); + if (RD && !RD->isUnion()) + RD = RD->getDefinition(); + return (RD && RD->defaultedCopyConstructorIsDeleted()) ? 1 : 0; +} + +unsigned clang_CXXRecord_defaultedMoveConstructorIsDeleted(CXCursor C) { + if (!clang_isDeclaration(C.kind)) + return 0; + + const auto *D = cxcursor::getCursorDecl(C); + const auto *RD = dyn_cast_if_present(D); + if (RD) + RD = RD->getDefinition(); + return (RD && !RD->isUnion() && RD->defaultedMoveConstructorIsDeleted()) ? 1 + : 0; +} + +unsigned clang_CXXRecord_defaultedDestructorIsDeleted(CXCursor C) { + if (!clang_isDeclaration(C.kind)) + return 0; + + const auto *D = cxcursor::getCursorDecl(C); + const auto *RD = dyn_cast_if_present(D); + if (RD) + RD = RD->getDefinition(); + return (RD && !RD->isUnion() && RD->defaultedDestructorIsDeleted()) ? 1 : 0; +} + +unsigned clang_CXXRecord_needsImplicitDefaultConstructor(CXCursor C) { + if (!clang_isDeclaration(C.kind)) + return 0; + + const auto *D = cxcursor::getCursorDecl(C); + const auto *RD = dyn_cast_if_present(D); + if (RD) + RD = RD->getDefinition(); + return (RD && !RD->isUnion() && RD->needsImplicitDefaultConstructor()) ? 1 + : 0; +} + +unsigned clang_CXXRecord_needsImplicitCopyConstructor(CXCursor C) { + if (!clang_isDeclaration(C.kind)) + return 0; + + const auto *D = cxcursor::getCursorDecl(C); + const auto *RD = dyn_cast_if_present(D); + if (RD) + RD = RD->getDefinition(); + return (RD && !RD->isUnion() && RD->needsImplicitDefaultConstructor()) ? 1 + : 0; +} + +unsigned clang_CXXRecord_needsImplicitCopyAssignment(CXCursor C) { + if (!clang_isDeclaration(C.kind)) + return 0; + + const auto *D = cxcursor::getCursorDecl(C); + const auto *RD = dyn_cast_if_present(D); + if (RD) + RD = RD->getDefinition(); + return (RD && !RD->isUnion() && RD->needsImplicitCopyAssignment()) ? 1 : 0; +} + +unsigned clang_CXXRecord_needsImplicitMoveConstructor(CXCursor C) { + if (!clang_isDeclaration(C.kind)) + return 0; + + const auto *D = cxcursor::getCursorDecl(C); + const auto *RD = dyn_cast_if_present(D); + if (RD) + RD = RD->getDefinition(); + return (RD && !RD->isUnion() && RD->needsImplicitDefaultConstructor()) ? 1 + : 0; +} + +unsigned clang_CXXRecord_needsImplicitMoveAssignment(CXCursor C) { + if (!clang_isDeclaration(C.kind)) + return 0; + + const auto *D = cxcursor::getCursorDecl(C); + const auto *RD = dyn_cast_if_present(D); + if (RD) + RD = RD->getDefinition(); + return (RD && !RD->isUnion() && RD->needsImplicitMoveAssignment()) ? 1 : 0; +} + +unsigned clang_CXXRecord_needsImplicitDestructor(CXCursor C) { + if (!clang_isDeclaration(C.kind)) + return 0; + + const auto *D = cxcursor::getCursorDecl(C); + const auto *RD = dyn_cast_if_present(D); + if (RD) + RD = RD->getDefinition(); + return (RD && !RD->isUnion() && RD->needsImplicitDestructor()) ? 1 : 0; +} + unsigned clang_EnumDecl_isScoped(CXCursor C) { if (!clang_isDeclaration(C.kind)) return 0; diff --git a/clang/tools/libclang/libclang.map b/clang/tools/libclang/libclang.map --- a/clang/tools/libclang/libclang.map +++ b/clang/tools/libclang/libclang.map @@ -410,6 +410,15 @@ clang_getUnqualifiedType; clang_getNonReferenceType; clang_CXXMethod_isDeleted; + clang_CXXRecord_defaultedCopyConstructorIsDeleted; + clang_CXXRecord_defaultedMoveConstructorIsDeleted; + clang_CXXRecord_defaultedDestructorIsDeleted; + clang_CXXRecord_needsImplicitDefaultConstructor; + clang_CXXRecord_needsImplicitCopyConstructor; + clang_CXXRecord_needsImplicitCopyAssignment; + clang_CXXRecord_needsImplicitMoveConstructor; + clang_CXXRecord_needsImplicitMoveAssignment; + clang_CXXRecord_needsImplicitDestructor; }; # Example of how to add a new symbol version entry. If you do add a new symbol