[PATCH] D100347: Fix the const overload of IgnoreExprNodes

Jesse Zhang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 12 15:06:21 PDT 2021


d created this revision.
d requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

The existing code causes an infinite recursion. This is likely an
oversight of commit c0e5e3fbfa504c37 <https://reviews.llvm.org/rGc0e5e3fbfa504c3792023d0db9008b08caa6b6d7> [1] where the intent must have been
to call the non-const overload.

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D100347

Files:
  clang/include/clang/AST/IgnoreExpr.h


Index: clang/include/clang/AST/IgnoreExpr.h
===================================================================
--- clang/include/clang/AST/IgnoreExpr.h
+++ clang/include/clang/AST/IgnoreExpr.h
@@ -41,7 +41,7 @@
 
 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) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100347.336973.patch
Type: text/x-patch
Size: 524 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210412/ae7faa38/attachment.bin>


More information about the cfe-commits mailing list