================
@@ -1060,238 +1061,331 @@ 
CodeGenFunction::evaluateOrEmitBuiltinObjectSize(const Expr *E, unsigned Type,
   return ConstantInt::get(ResType, ObjectSize, /*isSigned=*/true);
 }
 
-const FieldDecl *CodeGenFunction::FindFlexibleArrayMemberFieldAndOffset(
-    ASTContext &Ctx, const RecordDecl *RD, const FieldDecl *FAMDecl,
-    uint64_t &Offset) {
+namespace {
+
+/// StructFieldAccess is a simple visitor class to grab the first MemberExpr
+/// from an Expr. It records any ArraySubscriptExpr we meet along the way.
+struct StructFieldAccess
----------------
bwendling wrote:

Both GCC and Clang return the same value for `__bdos(*ptr->array)` with my new 
change. For `__bdos(&ptr->array)` GCC returns -1 and Clang returns the 
calculated value (it does that even without this patch). So it's behavior that 
existed before the advent of `__counted_by` and is probably wrong, but maybe 
not? People have different expectations for `__bdos` in various situations it 
seems...

I'm tempted to leave it as is since it isn't a regression, unless you have 
strong feelings about it.

https://github.com/llvm/llvm-project/pull/122198
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to