[clang] [Clang] Speed up Sema virtual-method no-work paths (NFC) (PR #223045)
Mehdi Amini via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 11 14:57:02 PDT 2026
================
@@ -10648,7 +10648,9 @@ static void AddMostOverridenMethods(const CXXMethodDecl *MD,
void Sema::FindHiddenVirtualMethods(CXXMethodDecl *MD,
SmallVectorImpl<CXXMethodDecl*> &OverloadedMethods) {
- if (!MD->getDeclName().isIdentifier())
+ CXXRecordDecl *DC = MD->getParent();
+ if (DC->getNumBases() == 0 || !DC->isPolymorphic() ||
+ !MD->getDeclName().isIdentifier())
----------------
joker-eph wrote:
Right, `!MD->getDeclName().isIdentifier()` is cheap, but are you asking why the new checks are there? Or just asking about the ordering?
I think the point here is that `isIdentifier()` it didn't catch it all, and it'll let some methods that match `isIdentifier()` through, going through the slow lookup path, while we filter them early here.
https://github.com/llvm/llvm-project/pull/223045
More information about the cfe-commits
mailing list