[clang] [WIP][Clang] Add __builtin_get_counted_by builtin (PR #102549)

2024-08-09 Thread Bill Wendling via cfe-commits
https://github.com/bwendling updated https://github.com/llvm/llvm-project/pull/102549 >From 7ba43ae2b737fbd868848a23b58b3965f8d36ce1 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Tue, 6 Aug 2024 17:49:01 -0700 Subject: [PATCH 01/10] [WIP][Clang] Add __builtin_get_counted_by builtin The __

[clang] [WIP][Clang] Add __builtin_get_counted_by builtin (PR #102549)

2024-08-09 Thread Bill Wendling via cfe-commits
bwendling wrote: > So the idea here is that if the struct in question uses counted_by, you > automatically set the count... and if, for whatever reason, the compiler > can't find the corresponding field, you just throw away the count? That seems > like an terrifying API; it's impossible to pre

[clang] [WIP][Clang] Add __builtin_get_counted_by builtin (PR #102549)

2024-08-09 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: So the idea here is that if the struct in question uses counted_by, you automatically set the count... and if, for whatever reason, the compiler can't find the corresponding field, you just throw away the count? That seems like an terrifying API; it's impossible to predic

[clang] [WIP][Clang] Add __builtin_get_counted_by builtin (PR #102549)

2024-08-08 Thread Kees Cook via cfe-commits
kees wrote: > > I'd expect some kind of diagnostic when the specified field doesn't have a > > corresponding counted_by field. > > So there's a complication with that. The use case for this builtin is to > automatically set the `count` field during allocation in the Linux kernel. > (It could

[clang] [WIP][Clang] Add __builtin_get_counted_by builtin (PR #102549)

2024-08-08 Thread Bill Wendling via cfe-commits
https://github.com/bwendling updated https://github.com/llvm/llvm-project/pull/102549 >From 7ba43ae2b737fbd868848a23b58b3965f8d36ce1 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Tue, 6 Aug 2024 17:49:01 -0700 Subject: [PATCH 1/9] [WIP][Clang] Add __builtin_get_counted_by builtin The __bu

[clang] [WIP][Clang] Add __builtin_get_counted_by builtin (PR #102549)

2024-08-08 Thread Bill Wendling via cfe-commits
bwendling wrote: > I'd expect some kind of diagnostic when the specified field doesn't have a > corresponding counted_by field. So there's a complication with that. The use case for this builtin is to automatically set the `count` field during allocation in the Linux kernel. (It could be used

[clang] [WIP][Clang] Add __builtin_get_counted_by builtin (PR #102549)

2024-08-08 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: I'd expect some kind of diagnostic when the specified field doesn't have a corresponding counted_by field. https://github.com/llvm/llvm-project/pull/102549 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm

[clang] [WIP][Clang] Add __builtin_get_counted_by builtin (PR #102549)

2024-08-08 Thread Bill Wendling via cfe-commits
https://github.com/bwendling updated https://github.com/llvm/llvm-project/pull/102549 >From 7ba43ae2b737fbd868848a23b58b3965f8d36ce1 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Tue, 6 Aug 2024 17:49:01 -0700 Subject: [PATCH 1/8] [WIP][Clang] Add __builtin_get_counted_by builtin The __bu

[clang] [WIP][Clang] Add __builtin_get_counted_by builtin (PR #102549)

2024-08-08 Thread via cfe-commits
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff bb7143f6669345825c214b26fbe336857f4bf523 197cd1c945c4b1c5cdd38d07f6ed5dd2baa96ab2 --e

[clang] [WIP][Clang] Add __builtin_get_counted_by builtin (PR #102549)

2024-08-08 Thread Bill Wendling via cfe-commits
bwendling wrote: There's still some cleanup to do. Firstly, the code to get the `MemberExpr` for the flexible array member. It's sloppy. https://github.com/llvm/llvm-project/pull/102549 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://l

[clang] [WIP][Clang] Add __builtin_get_counted_by builtin (PR #102549)

2024-08-08 Thread via cfe-commits
github-actions[bot] wrote: ⚠️ We detected that you are using a GitHub private e-mail address to contribute to the repo. Please turn off [Keep my email addresses private](https://github.com/settings/emails) setting in your account. See [LLVM Discourse](https://discourse.llvm.org/t/hidden-email

[clang] [WIP][Clang] Add __builtin_get_counted_by builtin (PR #102549)

2024-08-08 Thread Bill Wendling via cfe-commits
bwendling wrote: @kees https://github.com/llvm/llvm-project/pull/102549 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [WIP][Clang] Add __builtin_get_counted_by builtin (PR #102549)

2024-08-08 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Bill Wendling (bwendling) Changes The __builtin_get_counted_by builtin is used on a flexible array pointer and returns a pointer to the "counted_by" attribute's COUNT argument, which is a field in the same non-anonymous struct as the flexib

[clang] [WIP][Clang] Add __builtin_get_counted_by builtin (PR #102549)

2024-08-08 Thread Bill Wendling via cfe-commits
https://github.com/bwendling created https://github.com/llvm/llvm-project/pull/102549 The __builtin_get_counted_by builtin is used on a flexible array pointer and returns a pointer to the "counted_by" attribute's COUNT argument, which is a field in the same non-anonymous struct as the flexible a