[clang] [BoundsSafety][Clang][Sema][AST] Introduce CThisExpr for C __counted_by attributes (PR #199241)
Oliver Hunt via cfe-commits
cfe-commits at lists.llvm.org
Sat May 23 20:22:26 PDT 2026
================
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -fsyntax-only -ast-dump %s | FileCheck %s
+
+// Verifying that CThisExpr generation works for sturct fields
+struct Packet {
+ int size;
+ int *data __attribute__((counted_by(size)));
+};
+
+// CHECK: RecordDecl {{.*}} struct Packet definition
+// CHECK: FieldDecl {{.*}} size 'int'
+// CHECK: FieldDecl {{.*}} data 'int * __counted_by(this->size)':'int *'
----------------
ojhunt wrote:
dumb idea: in C say `{this}` or `"this"` maybe? some indicator that it's not a real keyword
https://github.com/llvm/llvm-project/pull/199241
More information about the cfe-commits
mailing list