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

Bill Wendling via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 13 02:56:54 PDT 2024


================
@@ -537,15 +537,21 @@ class Expr : public ValueStmt {
   /// semantically correspond to a bool.
   bool isKnownToHaveBooleanValue(bool Semantic = true) const;
 
-  /// Check whether this array fits the idiom of a flexible array member,
-  /// depending on the value of -fstrict-flex-array.
+  /// isFlexibleArrayMemberLike - Check whether this array fits the idiom of a
+  /// flexible array member, depending on the value of -fstrict-flex-array.
   /// When IgnoreTemplateOrMacroSubstitution is set, it doesn't consider sizes
   /// resulting from the substitution of a macro or a template as special sizes.
   bool isFlexibleArrayMemberLike(
       ASTContext &Context,
       LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel,
       bool IgnoreTemplateOrMacroSubstitution = false) const;
 
+  /// getMemberExpr - Find the first MemberExpr of the Expr. This method
+  /// intentionally looks through all casts, array subscripts, and unary
+  /// operators to find an underlying MemberExpr. If one doesn't exist, it
+  /// returns a nullptr.
+  const MemberExpr *getMemberExpr() const;
----------------
bwendling wrote:

I put it here because I need to use it in both Sema and CodeGen. I didn't want to have a layering violation. Maybe it should go in ASTContext or ASTRecordLayout?

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


More information about the cfe-commits mailing list