This is an archive of the discontinued LLVM Phabricator instance.

[index] Add support for type of pointers to class members
AcceptedPublic

Authored by OikawaKirie on May 17 2021, 4:50 AM.

Details

Reviewers
akyrtzi
Summary

Required in D102159 that we should add support for the unhandled items instead of workaround them.
In this patch, support is added for indexing the type of pointers to class members. Such usages are found in MySQL.
The format is <class index>::*<member index>.

Diff Detail

Event Timeline

OikawaKirie created this revision.May 17 2021, 4:50 AM
OikawaKirie requested review of this revision.May 17 2021, 4:50 AM
akyrtzi added inline comments.May 19 2021, 3:25 PM
clang/lib/Index/USRGeneration.cpp
897

A bit better to do VisitTagDecl(MPT->getClass()), what do you think?

OikawaKirie added inline comments.May 19 2021, 10:22 PM
clang/lib/Index/USRGeneration.cpp
897

This was my first version of the patch, which was VisitTagDecl(MPT->getMostRecentCXXRecordDecl()). However, it cannot handle the TemplateTypeParmType type, which is presented in the last two CHECKs of the test case. Call to method MemberPointerType::getMostRecentCXXRecordDecl will dereference a nullptr in the function (getClass()->getAsCXXRecordDecl() returns nullptr) . To fully handle all circumstances, I finally choose to use the VisitType method.

akyrtzi accepted this revision.May 20 2021, 10:05 AM
This revision is now accepted and ready to land.May 20 2021, 10:05 AM

Update the test case to avoid a crash in the Windows version of the c-index-test tool.

ping

What do you think about this patch? Can it be landed now? Or I should debug the crash in the Windows version detected with the previous version of my patch.

What do you think about this patch? Can it be landed now? Or I should debug the crash in the Windows version detected with the previous version of my patch.

Is your change introducing the crash or is the crash triggered with the test file without your changes as well?