aboutsummaryrefslogtreecommitdiff
path: root/clang-tools-extra/clang-tidy/bugprone/ComparePointerToMemberVirtualFunctionCheck.cpp
diff options
context:
space:
mode:
authorMatheus Izvekov <mizvekov@gmail.com>2025-03-21 10:54:24 -0300
committerGitHub <noreply@github.com>2025-03-21 10:54:24 -0300
commit141656644959ea43b61868ef16e3d2782d40ea51 (patch)
treed6be138e2335bdf573b8872b2d46b4629bb30905 /clang-tools-extra/clang-tidy/bugprone/ComparePointerToMemberVirtualFunctionCheck.cpp
parentac9049df7e62e2ca4dc5d103593b51639b5715e3 (diff)
downloadllvm-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.cpp5
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;