[PATCH] D148381: [Clang] Implement the 'counted_by' attribute

2023-10-04 Thread Bill Wendling via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG9a954c693573: [Clang] Implement the 'counted_by' attribute (authored by void). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148381/new/ https://reviews.llv

[PATCH] D148381: [Clang] Implement the 'counted_by' attribute

2023-10-04 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision. aaron.ballman added a comment. This revision is now accepted and ready to land. In D148381#4652825 , @void wrote: > Yes, I mean to do it as a direct follow-up. 😊 Okay, let's go that route then. This gets a fairly sig

Re: [PATCH] D148381: [Clang] Implement the 'counted_by' attribute

2023-10-03 Thread Bill Wendling via cfe-commits
Yes, I mean to do it as a direct follow-up. 😊 -bw On Tue, Oct 3, 2023, 6:31 AM Aaron Ballman via Phabricator < revi...@reviews.llvm.org> wrote: > aaron.ballman added inline comments. > > > > Comment at: clang/lib/Sema/SemaDeclAttr.cpp:8420-8428 > +if (Result.getResultKind()

[PATCH] D148381: [Clang] Implement the 'counted_by' attribute

2023-10-03 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/lib/Sema/SemaDeclAttr.cpp:8420-8428 +if (Result.getResultKind() == LookupResult::Found) { + SourceRange SR = CBA->getCountedByFieldLoc(); + Diag(SR.getBegin(), + diag::err_flexible_array_counted_by_att

[PATCH] D148381: [Clang] Implement the 'counted_by' attribute

2023-10-03 Thread Bill Wendling via Phabricator via cfe-commits
void added inline comments. Comment at: clang/lib/Sema/SemaDeclAttr.cpp:8420-8428 +if (Result.getResultKind() == LookupResult::Found) { + SourceRange SR = CBA->getCountedByFieldLoc(); + Diag(SR.getBegin(), + diag::err_flexible_array_counted_by_attr_field_n

[PATCH] D148381: [Clang] Implement the 'counted_by' attribute

2023-10-02 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. In D148381#4652056 , @void wrote: > FINALLY! found out how to do suggestions for typos. <3 Thank you for your perseverance! Comment at: clang/lib/Sema/SemaDeclAttr.cpp:8420-8428 +if (Result.getResult

[PATCH] D148381: [Clang] Implement the 'counted_by' attribute

2023-09-29 Thread Bill Wendling via Phabricator via cfe-commits
void added a comment. Okay, I now have a suggested fix hint. PTAL. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148381/new/ https://reviews.llvm.org/D148381 ___ cfe-commits mailing list cfe-commits@list

[PATCH] D148381: [Clang] Implement the 'counted_by' attribute

2023-09-29 Thread Bill Wendling via Phabricator via cfe-commits
void updated this revision to Diff 557496. void added a comment. FINALLY! found out how to do suggestions for typos. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148381/new/ https://reviews.llvm.org/D148381 Files: clang/docs/ReleaseNotes.rst

[PATCH] D148381: [Clang] Implement the 'counted_by' attribute

2023-09-28 Thread Bill Wendling via Phabricator via cfe-commits
void updated this revision to Diff 557473. void added a comment. Add a "FIXME" to improve the diagnostics with a typo hint. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148381/new/ https://reviews.llvm.org/D148381 Files: clang/docs/ReleaseNotes

[PATCH] D148381: [Clang] Implement the 'counted_by' attribute

2023-09-28 Thread Bill Wendling via Phabricator via cfe-commits
void added inline comments. Comment at: clang/include/clang/Basic/Attr.td:4246 +private: + SourceRange countedByFieldLoc; +public: aaron.ballman wrote: > void wrote: > > aaron.ballman wrote: > > > void wrote: > > > > erichkeane wrote: > > > > > aaron

[PATCH] D148381: [Clang] Implement the 'counted_by' attribute

2023-09-28 Thread Bill Wendling via Phabricator via cfe-commits
void updated this revision to Diff 557462. void marked an inline comment as done. void added a comment. Move attribute checking over to SemaDeclAttr.cpp Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148381/new/ https://reviews.llvm.org/D148381 Fil

[PATCH] D148381: [Clang] Implement the 'counted_by' attribute

2023-09-28 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/include/clang/Basic/Attr.td:4246 +private: + SourceRange countedByFieldLoc; +public: void wrote: > aaron.ballman wrote: > > void wrote: > > > erichkeane wrote: > > > > aaron.ballman wrote: > > >

[PATCH] D148381: [Clang] Implement the 'counted_by' attribute

2023-09-27 Thread Bill Wendling via Phabricator via cfe-commits
void updated this revision to Diff 557415. void added a comment. Use CBA as an acronym of CountedByAttribute instead of EBA, which is oldspeak. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148381/new/ https://reviews.llvm.org/D148381 Files: cla

[PATCH] D148381: [Clang] Implement the 'counted_by' attribute

2023-09-21 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added a comment. In D148381#4649683 , @void wrote: > Friendly Ping. Aaron is away at a conference this week, so hopefully he'll do another pass when he gets back next week. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D148381: [Clang] Implement the 'counted_by' attribute

2023-09-21 Thread Bill Wendling via Phabricator via cfe-commits
void added a comment. Friendly Ping. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148381/new/ https://reviews.llvm.org/D148381 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.

[PATCH] D148381: [Clang] Implement the 'counted_by' attribute

2023-09-18 Thread Bill Wendling via Phabricator via cfe-commits
void added inline comments. Comment at: clang/include/clang/AST/Decl.h:4272-4275 +FieldDecl *FD = nullptr; +for (FieldDecl *Field : fields()) + FD = Field; +return FD; erichkeane wrote: > aaron.ballman wrote: > > void wrote: > > > aaron.ballman w

[PATCH] D148381: [Clang] Implement the 'counted_by' attribute

2023-09-18 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added a comment. I've got no further comments/concerns. Comment at: clang/include/clang/AST/Decl.h:4272-4275 +FieldDecl *FD = nullptr; +for (FieldDecl *Field : fields()) + FD = Field; +return FD; aaron.ballman wrote: > void wrote: >

[PATCH] D148381: [Clang] Implement the 'counted_by' attribute

2023-09-15 Thread Félix Cloutier via Phabricator via cfe-commits
fcloutier added a comment. In D148381#4646833 , @rapidsna wrote: > `-fbounds-safety` doesn't allow this. In our internal adoption experience, we > haven't encountered such use cases yet. So, I think it's best to make the > model restrictive to avoid sur

[PATCH] D148381: [Clang] Implement the 'counted_by' attribute

2023-09-15 Thread Yeoul Na via Phabricator via cfe-commits
rapidsna added a comment. struct V { int Sizes[2]; int FAM[] __counted_by(Sizes[0]); // Thoughts? }; `-fbounds-safety` doesn't allow this. In our internal adoption experience, we haven't encountered such use cases yet. So, I think it's best to make the model restrictive to avoid sur

[PATCH] D148381: [Clang] Implement the 'counted_by' attribute

2023-09-15 Thread Bill Wendling via Phabricator via cfe-commits
void added a comment. In D148381#4646780 , @kees wrote: > In D148381#4645600 , @void wrote: > >> Added more error messages. Changed some code around to align with coding >> practices. Added some more test cases.

[PATCH] D148381: [Clang] Implement the 'counted_by' attribute

2023-09-15 Thread Kees Cook via Phabricator via cfe-commits
kees added a comment. In D148381#4645600 , @void wrote: > Added more error messages. Changed some code around to align with coding > practices. Added some more test cases. Doing a full "allmodconfig" Linux kernel build with my 200ish __counted_by annot

[PATCH] D148381: [Clang] Implement the 'counted_by' attribute

2023-09-14 Thread Bill Wendling via Phabricator via cfe-commits
void added inline comments. Comment at: clang/include/clang/Basic/Attr.td:4246 +private: + SourceRange countedByFieldLoc; +public: aaron.ballman wrote: > void wrote: > > erichkeane wrote: > > > aaron.ballman wrote: > > > > Teeny tiniest of coding sty

[PATCH] D148381: [Clang] Implement the 'counted_by' attribute

2023-09-14 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/include/clang/AST/Decl.h:4272-4275 +FieldDecl *FD = nullptr; +for (FieldDecl *Field : fields()) + FD = Field; +return FD; void wrote: > aaron.ballman wrote: > > Could this be implemented as:

[PATCH] D148381: [Clang] Implement the 'counted_by' attribute

2023-09-14 Thread Bill Wendling via Phabricator via cfe-commits
void updated this revision to Diff 556749. void added a comment. Add release note. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148381/new/ https://reviews.llvm.org/D148381 Files: clang/docs/ReleaseNotes.rst clang/include/clang/AST/Decl.h c

[PATCH] D148381: [Clang] Implement the 'counted_by' attribute

2023-09-13 Thread Bill Wendling via Phabricator via cfe-commits
void added inline comments. Comment at: clang/include/clang/AST/Decl.h:4272-4275 +FieldDecl *FD = nullptr; +for (FieldDecl *Field : fields()) + FD = Field; +return FD; aaron.ballman wrote: > Could this be implemented as: `return !field_empty() ?

[PATCH] D148381: [Clang] Implement the 'counted_by' attribute

2023-09-13 Thread Bill Wendling via Phabricator via cfe-commits
void updated this revision to Diff 556734. void marked 36 inline comments as done. void added a comment. Added more error messages. Changed some code around to align with coding practices. Added some more test cases. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://rev

[PATCH] D148381: [Clang] Implement the 'counted_by' attribute

2023-09-13 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added inline comments. Comment at: clang/include/clang/AST/DeclBase.h:482 + /// Whether it resembles a flexible array member. + static bool isFlexibleArrayMemberLike( + ASTContext &Context, const Decl *D, QualType Ty, Why isn't this a member fun

[PATCH] D148381: [Clang] Implement the 'counted_by' attribute

2023-09-13 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers added inline comments. Comment at: clang/lib/CodeGen/CGBuiltin.cpp:857 + if (IsDynamic) { +const LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel = +getLangOpts().getStrictFlexArraysLevel(); aaron.ballman wrote: > nickdesa

[PATCH] D148381: [Clang] Implement the 'counted_by' attribute

2023-09-13 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/lib/CodeGen/CGBuiltin.cpp:857 + if (IsDynamic) { +const LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel = +getLangOpts().getStrictFlexArraysLevel(); nickdesaulniers wrote: > aaron.ba

[PATCH] D148381: [Clang] Implement the 'counted_by' attribute

2023-09-13 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers added a subscriber: jyknight. nickdesaulniers added inline comments. Comment at: clang/lib/CodeGen/CGBuiltin.cpp:857 + if (IsDynamic) { +const LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel = +getLangOpts().getStrictFlexArraysLevel(); --

[PATCH] D148381: [Clang] Implement the 'counted_by' attribute

2023-09-13 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman requested changes to this revision. aaron.ballman added reviewers: efriedma, rjmccall, erichkeane. aaron.ballman added a comment. This revision now requires changes to proceed. Thank you for working on this! Please be sure to also add a release note to `clang/docs/ReleaseNotes.rst`

[PATCH] D148381: [Clang] Implement the 'counted_by' attribute

2023-09-13 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers added a comment. Perhaps worth updating the release notes, too. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148381/new/ https://reviews.llvm.org/D148381 ___ cfe-commits mailing list cfe

[PATCH] D148381: [Clang] Implement the 'counted_by' attribute

2023-09-13 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers added a comment. Also, I encourage you to test a build of the linux kernel with __counted_by BEFORE merging this! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148381/new/ https://reviews.llvm.org/D148381 _

[PATCH] D148381: [Clang] Implement the 'counted_by' attribute

2023-09-13 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers accepted this revision. nickdesaulniers added a comment. This revision is now accepted and ready to land. Thanks for the patch! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148381/new/ https://reviews.llvm.org/D148381

[PATCH] D148381: [Clang] Implement the 'counted_by' attribute

2023-09-12 Thread Bill Wendling via Phabricator via cfe-commits
void updated this revision to Diff 556619. void added a comment. This is ready for review. Please take a look. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148381/new/ https://reviews.llvm.org/D148381 Files: clang/include/clang/AST/Decl.h cla

[PATCH] D148381: [Clang] Implement the 'counted_by' attribute

2023-09-08 Thread Bill Wendling via Phabricator via cfe-commits
void updated this revision to Diff 556324. void added a comment. Add test output when the attribute isn't used. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148381/new/ https://reviews.llvm.org/D148381 Files: clang/include/clang/AST/Decl.h cl

[PATCH] D148381: [Clang] Implement the 'counted_by' attribute

2023-09-08 Thread Bill Wendling via Phabricator via cfe-commits
void added inline comments. Comment at: clang/test/CodeGen/attr-counted-by.c:2 +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3 +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -O2 -Wall -fsanitize=array-bounds,object-size

[PATCH] D148381: [Clang] Implement the 'counted_by' attribute

2023-09-08 Thread Bill Wendling via Phabricator via cfe-commits
void added inline comments. Comment at: clang/test/CodeGen/attr-counted-by.c:2 +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3 +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -O2 -Wall -fsanitize=array-bounds,object-size

[PATCH] D148381: [Clang] Implement the 'counted_by' attribute

2023-09-08 Thread Bill Wendling via Phabricator via cfe-commits
void updated this revision to Diff 556323. void edited the summary of this revision. void added a comment. Fix docs to use the correct code examples throughout. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148381/new/ https://reviews.llvm.org/D148