[clang] [clang][NFC] Simplify implementation of `IgnoreExprNodes` (PR #164193)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Oct 19 16:56:50 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Victor Chernyakin (localspook)
<details>
<summary>Changes</summary>
Using a fold instead of template recursion.
---
Full diff: https://github.com/llvm/llvm-project/pull/164193.diff
1 Files Affected:
- (modified) clang/include/clang/AST/IgnoreExpr.h (+1-11)
``````````diff
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;
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/164193
More information about the cfe-commits
mailing list