[clang] 315c904 - [clang][NFC] Simplify implementation of `IgnoreExprNodes` (#164193)
via cfe-commits
cfe-commits at lists.llvm.org
Sat Dec 6 15:02:49 PST 2025
Author: Victor Chernyakin
Date: 2025-12-06T15:02:45-08:00
New Revision: 315c904e3e1c00ea1ec7f0757e4c538ec2513624
URL: https://github.com/llvm/llvm-project/commit/315c904e3e1c00ea1ec7f0757e4c538ec2513624
DIFF: https://github.com/llvm/llvm-project/commit/315c904e3e1c00ea1ec7f0757e4c538ec2513624.diff
LOG: [clang][NFC] Simplify implementation of `IgnoreExprNodes` (#164193)
Using a fold instead of template recursion.
Added:
Modified:
clang/include/clang/AST/IgnoreExpr.h
Removed:
################################################################################
diff --git a/clang/include/clang/AST/IgnoreExpr.h b/clang/include/clang/AST/IgnoreExpr.h
index 917bada61fa6f..bf098f3f09068 100644
--- a/clang/include/clang/AST/IgnoreExpr.h
+++ b/clang/include/clang/AST/IgnoreExpr.h
@@ -17,16 +17,6 @@
#include "clang/AST/ExprCXX.h"
namespace clang {
-namespace detail {
-/// Given an expression E and functions Fn_1,...,Fn_n : Expr * -> Expr *,
-/// Return Fn_n(...(Fn_1(E)))
-inline Expr *IgnoreExprNodesImpl(Expr *E) { return E; }
-template <typename FnTy, typename... FnTys>
-Expr *IgnoreExprNodesImpl(Expr *E, FnTy &&Fn, FnTys &&... Fns) {
- return IgnoreExprNodesImpl(std::forward<FnTy>(Fn)(E),
- std::forward<FnTys>(Fns)...);
-}
-} // namespace detail
/// Given an expression E and functions Fn_1,...,Fn_n : Expr * -> Expr *,
/// Recursively apply each of the functions to E until reaching a fixed point.
@@ -35,7 +25,7 @@ template <typename... FnTys> Expr *IgnoreExprNodes(Expr *E, FnTys &&... Fns) {
Expr *LastE = nullptr;
while (E != LastE) {
LastE = E;
- E = detail::IgnoreExprNodesImpl(E, std::forward<FnTys>(Fns)...);
+ ((E = std::forward<FnTys>(Fns)(E)), ...);
}
return E;
}
More information about the cfe-commits
mailing list