[clang] 595c375 - Fix the const overload of IgnoreExprNodes

Dmitri Gribenko via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 13 09:05:30 PDT 2021


Author: Jesse Zhang
Date: 2021-04-13T17:59:59+02:00
New Revision: 595c3758e47042c876e7390d09642ea050ba6dbf

URL: https://github.com/llvm/llvm-project/commit/595c3758e47042c876e7390d09642ea050ba6dbf
DIFF: https://github.com/llvm/llvm-project/commit/595c3758e47042c876e7390d09642ea050ba6dbf.diff

LOG: Fix the const overload of IgnoreExprNodes

The existing code causes an infinite recursion. This is likely an
oversight of commit c0e5e3fbfa504c37 [1] where the intent must have been
to call the non-const overload.

[1] https://reviews.llvm.org/D87278

Reviewed By: gribozavr2

Differential Revision: https://reviews.llvm.org/D100347

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 1c2b538e5b635..b2f53d1d2a798 100644
--- a/clang/include/clang/AST/IgnoreExpr.h
+++ b/clang/include/clang/AST/IgnoreExpr.h
@@ -41,7 +41,7 @@ template <typename... FnTys> Expr *IgnoreExprNodes(Expr *E, FnTys &&... Fns) {
 
 template <typename... FnTys>
 const Expr *IgnoreExprNodes(const Expr *E, FnTys &&...Fns) {
-  return const_cast<Expr *>(IgnoreExprNodes(E, std::forward<FnTys>(Fns)...));
+  return IgnoreExprNodes(const_cast<Expr *>(E), std::forward<FnTys>(Fns)...);
 }
 
 inline Expr *IgnoreImplicitCastsSingleStep(Expr *E) {


        


More information about the cfe-commits mailing list