[BoundsSafety] Introduce a notion of `this` for C
Certain thread safety and bounds safety annotations in C need to reference other fields within the same structure. For example:
struct f {
int n;
int *__counted_by(n) buf;
};
In C++, this provides a well-defined way to express such self-referential relationships. C has no equivalent, so the current implementation works around this limitation by allowing DeclRefExpr to refer directly to a FieldDecl.
This is semantically incorrect — FieldDecl should only be referenced via MemberExpr, never via DeclRefExpr. Introducing a C equivalent of CXXThisExpr would resolve this improper usage and provide a clean, principled foundation for self-referential annotations in C.
Proposed solution: Add a new AST node (e.g., CThisExpr or similar) that mirrors CXXThisExpr semantics for C, enabling bounds safety and thread safety annotations to correctly express field-to-field references within a struct.
Hey, can i work on this issue?
Blocked by https://github.com/swiftlang/llvm-project/issues/13568