================
@@ -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 *'
----------------
AaronBallman wrote:

For AST dumping, we can kind of do whatever we think makes the most sense. But 
we still need AST printing to generate the source code roughly the same as the 
user wrote it, so my preference is to print the canonicalized attribute. e.g., 
if we translate `__counted_by(size + 0)` into `__counted_by(size)`, I think 
it's fine to print that instead of with the `+ 0` but I'd prefer to see either 
form over `__counted_by(this->size)`.

https://github.com/llvm/llvm-project/pull/199241
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to