diff options
author | Matheus Izvekov <mizvekov@gmail.com> | 2025-03-21 10:54:24 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-21 10:54:24 -0300 |
commit | 141656644959ea43b61868ef16e3d2782d40ea51 (patch) | |
tree | d6be138e2335bdf573b8872b2d46b4629bb30905 /clang-tools-extra/clang-tidy/bugprone/ComparePointerToMemberVirtualFunctionCheck.cpp | |
parent | ac9049df7e62e2ca4dc5d103593b51639b5715e3 (diff) | |
download | llvm-141656644959ea43b61868ef16e3d2782d40ea51.zip llvm-141656644959ea43b61868ef16e3d2782d40ea51.tar.gz llvm-141656644959ea43b61868ef16e3d2782d40ea51.tar.bz2 |
Reland: [clang] NFC: Clear some uses of MemberPointerType::getClass (#132317)
Relands Original PR: https://github.com/llvm/llvm-project/pull/131965
Addresses
https://github.com/llvm/llvm-project/pull/131965#issuecomment-2741619498
* Fixes isIncompleteType for injected classes
This clears up some uses of getClass on MemberPointerType when
equivalent uses of getMostRecentCXXRecordDecl would be just as simple or
simpler.
This is split-off from a larger patch which removes getClass, in order
to facilitate review.
Diffstat (limited to 'clang-tools-extra/clang-tidy/bugprone/ComparePointerToMemberVirtualFunctionCheck.cpp')
-rw-r--r-- | clang-tools-extra/clang-tidy/bugprone/ComparePointerToMemberVirtualFunctionCheck.cpp | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/clang-tools-extra/clang-tidy/bugprone/ComparePointerToMemberVirtualFunctionCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/ComparePointerToMemberVirtualFunctionCheck.cpp index 9d1d92b..a8a9e6b 100644 --- a/clang-tools-extra/clang-tidy/bugprone/ComparePointerToMemberVirtualFunctionCheck.cpp +++ b/clang-tools-extra/clang-tidy/bugprone/ComparePointerToMemberVirtualFunctionCheck.cpp @@ -70,10 +70,7 @@ void ComparePointerToMemberVirtualFunctionCheck::check( // compare with variable which type is pointer to member function. llvm::SmallVector<SourceLocation, 12U> SameSignatureVirtualMethods{}; const auto *MPT = cast<MemberPointerType>(DRE->getType().getCanonicalType()); - const Type *T = MPT->getClass(); - if (T == nullptr) - return; - const CXXRecordDecl *RD = T->getAsCXXRecordDecl(); + const CXXRecordDecl *RD = MPT->getMostRecentCXXRecordDecl(); if (RD == nullptr) return; |