Author: serge-sans-paille Date: 2022-07-07T08:02:29+02:00 New Revision: 011d2bf86487520c3515f16e0b1d32994bf2b48f
URL: https://github.com/llvm/llvm-project/commit/011d2bf86487520c3515f16e0b1d32994bf2b48f DIFF: https://github.com/llvm/llvm-project/commit/011d2bf86487520c3515f16e0b1d32994bf2b48f.diff LOG: [clang-tidy] Fix confusable identifier interaction with unavailable class def Fix #56404 Added: Modified: clang-tools-extra/clang-tidy/misc/ConfusableIdentifierCheck.cpp Removed: ################################################################################ diff --git a/clang-tools-extra/clang-tidy/misc/ConfusableIdentifierCheck.cpp b/clang-tools-extra/clang-tidy/misc/ConfusableIdentifierCheck.cpp index ce83a7778d80..556d76136526 100644 --- a/clang-tools-extra/clang-tidy/misc/ConfusableIdentifierCheck.cpp +++ b/clang-tools-extra/clang-tidy/misc/ConfusableIdentifierCheck.cpp @@ -127,11 +127,13 @@ static bool mayShadow(const NamedDecl *ND0, const NamedDecl *ND1) { const DeclContext *DC1 = ND1->getDeclContext()->getPrimaryContext(); if (const CXXRecordDecl *RD0 = dyn_cast<CXXRecordDecl>(DC0)) { - if (ND1->getAccess() != AS_private && isMemberOf(ND1, RD0)) + RD0 = RD0->getDefinition(); + if (RD0 && ND1->getAccess() != AS_private && isMemberOf(ND1, RD0)) return true; } if (const CXXRecordDecl *RD1 = dyn_cast<CXXRecordDecl>(DC1)) { - if (ND0->getAccess() != AS_private && isMemberOf(ND0, RD1)) + RD1 = RD1->getDefinition(); + if (RD1 && ND0->getAccess() != AS_private && isMemberOf(ND0, RD1)) return true; } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits