[llvm-branch-commits] [clang] release/22.x: [C++20] [Modules] Don't profile the callee of CXXFoldExpr (#190732) (PR #193885)
Chuanqi Xu via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Apr 24 06:44:44 PDT 2026
================
@@ -2369,7 +2369,35 @@ void StmtProfiler::VisitMaterializeTemporaryExpr(
}
void StmtProfiler::VisitCXXFoldExpr(const CXXFoldExpr *S) {
- VisitExpr(S);
+ // For CXXFoldExpr, not profile the call expression as it may
+ // be affected by the context. e.g.,
+ //
+ // "a.h"
+ //
+ // struct F {
+ // template <typename... T> requires ((sizeof(T) > 0) && ...)
+ // void operator()(T...) {}
+ // } f;
+ //
+ // and
+ //
+ // "c.h"
+ //
+ // void operator&&(struct X, struct X);
+ // #include "a.h"
+ //
+ // Here we may give different profile results to F::operator() in
----------------
ChuanqiXu9 wrote:
Oh, nice question. Previously I thought we can't have other binary expression. But after trying, I see it is actually possible, https://godbolt.org/z/rc5br469M , in nested require clause!
So the reason why this was not reported may be simply no people wrote such code with modules before...
I'll revert the patch and thinking about other solutions. I'll invite you to review this time.
https://github.com/llvm/llvm-project/pull/193885
More information about the llvm-branch-commits
mailing list