anderslanglands created this revision. Herald added a subscriber: arphaman. Herald added a project: All. anderslanglands requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits.
fix copy/paste error in doc comment fix failing test now deleted is supported add new test for clang_CXXMethod_isDeleted Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D133991 Files: clang/docs/ReleaseNotes.rst clang/include/clang-c/Index.h clang/test/Index/availability.cpp clang/test/Index/deletion.cpp Index: clang/test/Index/deletion.cpp =================================================================== --- /dev/null +++ clang/test/Index/deletion.cpp @@ -0,0 +1,14 @@ +struct Foo { + int foo() = delete; + int bar(); + Foo() = delete; + Foo(int); +}; + + +// 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: 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] +// CHECK: CXXConstructor=Foo:5:3 (converting constructor) [type=void (int){{.*}}] [typekind=FunctionProto] [resulttype=void] [resulttypekind=Void] [args= [int] [Int]] [isPOD=0] Index: clang/test/Index/availability.cpp =================================================================== --- clang/test/Index/availability.cpp +++ clang/test/Index/availability.cpp @@ -9,5 +9,5 @@ // 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: CXXMethod=foo:4:7 (unavailable) [type=int (){{.*}}] [typekind=FunctionProto] [resulttype=int] [resulttypekind=Int] [isPOD=0] -// CHECK: CXXConstructor=Foo:5:3 (unavailable) (default constructor) [type=void (){{.*}}] [typekind=FunctionProto] [resulttype=void] [resulttypekind=Void] [isPOD=0] +// 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] Index: clang/include/clang-c/Index.h =================================================================== --- clang/include/clang-c/Index.h +++ clang/include/clang-c/Index.h @@ -4925,7 +4925,7 @@ CINDEX_LINKAGE unsigned clang_CXXMethod_isDefaulted(CXCursor C); /** - * Determine if a C++ method is declared '= default'. + * Determine if a C++ method is declared '= delete'. */ CINDEX_LINKAGE unsigned clang_CXXMethod_isDeleted(CXCursor C); Index: clang/docs/ReleaseNotes.rst =================================================================== --- clang/docs/ReleaseNotes.rst +++ clang/docs/ReleaseNotes.rst @@ -319,6 +319,8 @@ the behavior of `QualType::getUnqualifiedType` for `CXType`. - Introduced the new function `clang_getNonReferenceType`, which mimics the behavior of `QualType::getNonReferenceType` for `CXType`. +- Introduced the new function `clang_CXXMethod_isDeleted`, which queries + whether the method is declared `= delete. Static Analyzer ---------------
Index: clang/test/Index/deletion.cpp =================================================================== --- /dev/null +++ clang/test/Index/deletion.cpp @@ -0,0 +1,14 @@ +struct Foo { + int foo() = delete; + int bar(); + Foo() = delete; + Foo(int); +}; + + +// 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: 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] +// CHECK: CXXConstructor=Foo:5:3 (converting constructor) [type=void (int){{.*}}] [typekind=FunctionProto] [resulttype=void] [resulttypekind=Void] [args= [int] [Int]] [isPOD=0] Index: clang/test/Index/availability.cpp =================================================================== --- clang/test/Index/availability.cpp +++ clang/test/Index/availability.cpp @@ -9,5 +9,5 @@ // 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: CXXMethod=foo:4:7 (unavailable) [type=int (){{.*}}] [typekind=FunctionProto] [resulttype=int] [resulttypekind=Int] [isPOD=0] -// CHECK: CXXConstructor=Foo:5:3 (unavailable) (default constructor) [type=void (){{.*}}] [typekind=FunctionProto] [resulttype=void] [resulttypekind=Void] [isPOD=0] +// 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] Index: clang/include/clang-c/Index.h =================================================================== --- clang/include/clang-c/Index.h +++ clang/include/clang-c/Index.h @@ -4925,7 +4925,7 @@ CINDEX_LINKAGE unsigned clang_CXXMethod_isDefaulted(CXCursor C); /** - * Determine if a C++ method is declared '= default'. + * Determine if a C++ method is declared '= delete'. */ CINDEX_LINKAGE unsigned clang_CXXMethod_isDeleted(CXCursor C); Index: clang/docs/ReleaseNotes.rst =================================================================== --- clang/docs/ReleaseNotes.rst +++ clang/docs/ReleaseNotes.rst @@ -319,6 +319,8 @@ the behavior of `QualType::getUnqualifiedType` for `CXType`. - Introduced the new function `clang_getNonReferenceType`, which mimics the behavior of `QualType::getNonReferenceType` for `CXType`. +- Introduced the new function `clang_CXXMethod_isDeleted`, which queries + whether the method is declared `= delete. Static Analyzer ---------------
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits