[PATCH] D102614: [index] Add support for type of pointers to class members
Ella Ma via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed May 19 22:22:05 PDT 2021
OikawaKirie added inline comments.
================
Comment at: clang/lib/Index/USRGeneration.cpp:897
+ if (const MemberPointerType *MPT = T->getAs<MemberPointerType>()) {
+ VisitType(QualType(MPT->getClass(), 0));
+ Out << "::*";
----------------
akyrtzi wrote:
> A bit better to do `VisitTagDecl(MPT->getClass())`, what do you think?
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.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D102614/new/
https://reviews.llvm.org/D102614
More information about the cfe-commits
mailing list