[clang] [Clang] Add __builtin_get_counted_by builtin (PR #102549)

Bill Wendling via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 14 14:04:39 PDT 2024


================
@@ -222,6 +222,49 @@ bool Expr::isFlexibleArrayMemberLike(
                                          IgnoreTemplateOrMacroSubstitution);
 }
 
+namespace {
+
+/// MemberExprVisitor - Find the MemberExpr through all of the casts, array
+/// subscripts, and unary ops. This intentionally avoids all of them because
+/// we're interested only in the MemberExpr to check if it's a flexible array
+/// member.
+class MemberExprVisitor
+    : public ConstStmtVisitor<MemberExprVisitor, const Expr *> {
+public:
+  //===--------------------------------------------------------------------===//
+  //                            Visitor Methods
+  //===--------------------------------------------------------------------===//
+
+  const Expr *Visit(const Expr *E) {
+    return ConstStmtVisitor<MemberExprVisitor, const Expr *>::Visit(E);
+  }
----------------
bwendling wrote:

It looks like his (and the `VisitStmt`) aren't needed. Removed.

https://github.com/llvm/llvm-project/pull/102549


More information about the cfe-commits mailing list