================
@@ -440,14 +440,23 @@ const RawComment *ASTContext::getRawCommentForAnyRedecl(
// Any redeclarations of D that we haven't checked for comments yet?
// We can't use DenseMap::iterator directly since it'd get invalid.
- auto LastCheckedRedecl = [this, CanonicalD]() -> const Decl * {
- return CommentlessRedeclChains.lookup(CanonicalD);
- }();
+ const Decl *LastCheckedRedecl = CommentlessRedeclChains.lookup(CanonicalD);
+ bool CanUseCommentlessCache = false;
+ if (LastCheckedRedecl) {
+ for (auto *Redecl : CanonicalD->redecls()) {
+ if (Redecl == D) {
+ CanUseCommentlessCache = true;
+ break;
+ }
+ if (Redecl == LastCheckedRedecl)
+ break;
+ }
+ }
----------------
AaronBallman wrote:
I was thinking something similar -- let `LastCheckedRedecl == nullptr` be the
test for `CanUseCommentlessCache` instead of using a dedicated variable for
that.
https://github.com/llvm/llvm-project/pull/108475
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits