[PATCH] D153001: [clang][ThreadSafety] Add __builtin_instance_member (WIP)

Aaron Puchert via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jun 24 14:36:21 PDT 2023


aaronpuchert added a comment.

I'm wondering why you chose this over a direct equivalent to `this`, say `__builtin_instance()`, such that instead of `__builtin_instance_member(M)` one would write `__builtin_instance().M` or `__builtin_instance()->M`? While allowing to reference the same fields, it would additionally allow referencing the object itself. That's not so interesting for Thread Safety Analysis, because many attributes refer to `this` if no argument is given, but it might be helpful for other analyses.

It also seems cleaner C/C++ to me, as you can read the expression in the usual way, whereas in `__builtin_instance_member(M)`, `M` is not a `DeclRefExpr`. And you could do `#define THIS __builtin_instance()`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D153001/new/

https://reviews.llvm.org/D153001



More information about the cfe-commits mailing list