This is an archive of the discontinued LLVM Phabricator instance.

add clang_CXXMethod_isDeleted function
ClosedPublic

Authored by anderslanglands on Sep 15 2022, 2:31 AM.

Details

Summary

Adds a function to check if a method has been deleted by copy-pasting the existing implementation of clang_CXXMethod_isDefaulted and changing it to call CXXMethod::isDeleted() instead.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptSep 15 2022, 2:31 AM
Herald added a subscriber: arphaman. · View Herald Transcript
anderslanglands requested review of this revision.Sep 15 2022, 2:31 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 15 2022, 2:31 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
anderslanglands edited the summary of this revision. (Show Details)Sep 15 2022, 2:38 AM
anderslanglands added a reviewer: aaron.ballman.
tbaeder added inline comments.
clang/tools/libclang/CIndex.cpp
8870 ↗(On Diff #460335)

Thanks for this! Can you add a release note to clang/docs/ReleaseNotes.rst and some test coverage for the change to clang/test/Index for the change? Also, it looks like precommit CI found a relevant failure that needs to be fixed:

******************** TEST 'Clang :: Index/availability.cpp' FAILED ********************
Script:
--
: 'RUN: at line 9';   c:\ws\w3\llvm-project\premerge-checks\build\bin\c-index-test.exe -test-print-type --std=c++11 C:\ws\w3\llvm-project\premerge-checks\clang\test\Index\availability.cpp | c:\ws\w3\llvm-project\premerge-checks\build\bin\filecheck.exe C:\ws\w3\llvm-project\premerge-checks\clang\test\Index\availability.cpp
--
Exit Code: 1
 
Command Output (stdout):
--
$ ":" "RUN: at line 9"
$ "c:\ws\w3\llvm-project\premerge-checks\build\bin\c-index-test.exe" "-test-print-type" "--std=c++11" "C:\ws\w3\llvm-project\premerge-checks\clang\test\Index\availability.cpp"
$ "c:\ws\w3\llvm-project\premerge-checks\build\bin\filecheck.exe" "C:\ws\w3\llvm-project\premerge-checks\clang\test\Index\availability.cpp"
# command stderr:
C:\ws\w3\llvm-project\premerge-checks\clang\test\Index\availability.cpp:12:11: error: CHECK: expected string not found in input
// CHECK: CXXMethod=foo:4:7 (unavailable) [type=int (){{.*}}] [typekind=FunctionProto] [resulttype=int] [resulttypekind=Int] [isPOD=0]
          ^
<stdin>:394:71: note: scanning from here
StructDecl=Foo:3:8 (Definition) [type=Foo] [typekind=Record] [isPOD=1] [isAnonRecDecl=0]
                                                                      ^
<stdin>:395:1: note: possible intended match here
CXXMethod=foo:4:7 (unavailable) (deleted) [type=int ()] [typekind=FunctionProto] [resulttype=int] [resulttypekind=Int] [isPOD=0] [isAnonRecDecl=0]
^
 
Input file: <stdin>
Check file: C:\ws\w3\llvm-project\premerge-checks\clang\test\Index\availability.cpp
 
-dump-input=help explains the following input dump.
 
Input was:
<<<<<<
            .
            .
            .
          389: macro definition=__STDCPP_DEFAULT_NEW_ALIGNMENT__ [type=] [typekind=Invalid] [isPOD=0] [isAnonRecDecl=0]
          390: macro definition=__STDCPP_THREADS__ [type=] [typekind=Invalid] [isPOD=0] [isAnonRecDecl=0]
          391: macro definition=__STDC_UTF_16__ [type=] [typekind=Invalid] [isPOD=0] [isAnonRecDecl=0]
          392: macro definition=__STDC_UTF_32__ [type=] [typekind=Invalid] [isPOD=0] [isAnonRecDecl=0]
          393: FunctionDecl=foo:1:6 (unavailable) [type=void ()] [typekind=FunctionProto] [resulttype=void] [resulttypekind=Void] [isPOD=0] [isAnonRecDecl=0]
          394: StructDecl=Foo:3:8 (Definition) [type=Foo] [typekind=Record] [isPOD=1] [isAnonRecDecl=0]
check:12'0                                                                           X~~~~~~~~~~~~~~~~~~ error: no match found
          395: CXXMethod=foo:4:7 (unavailable) (deleted) [type=int ()] [typekind=FunctionProto] [resulttype=int] [resulttypekind=Int] [isPOD=0] [isAnonRecDecl=0]
check:12'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
check:12'1     ?                                                                                                                                                   possible intended match
          396: CXXConstructor=Foo:5:3 (unavailable) (default constructor) (deleted) [type=void ()] [typekind=FunctionProto] [resulttype=void] [resulttypekind=Void] [isPOD=0] [isAnonRecDecl=0]
check:12'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>>>>
 
error: command failed with exit status: 1
 
--
 
********************

Updating based on review

  • Add new function to release notes
  • Fix failing test and add a new test specifically for this function

Looks like the new version you uploaded is only the changes to the last version. You need to merge that into your previous commit and upload a patch of that. (e.g. using git rebase -i or even just git commit --amend).

squashing all commits into one to hopefully fix the revision

tbaeder added inline comments.Sep 16 2022, 12:49 AM
clang/docs/ReleaseNotes.rst
323

Adding in the dyn_cast_is_present change I missed on the previous one

OK that should all be good now. Thanks for your patience, it's my first time doing all this.

aaron.ballman accepted this revision.Sep 16 2022, 5:10 AM

LGTM aside from the one minor nit.

Do you need someone to commit on your behalf? If so, what name and email address would you like used for patch attribution?

clang/docs/ReleaseNotes.rst
323

Looks like this change still needs to be applied.

This revision is now accepted and ready to land.Sep 16 2022, 5:10 AM

Adding missing backtick

Yes it's probably safest if someone commits on my behalf, unless someone's got time to walk me through it. Just use Anders Langlands anderslangands@gmail.com for attribution please.

This revision was automatically updated to reflect the committed changes.