[PATCH] D148381: [WIP][Clang] Add element_count attribute

2023-08-10 Thread Bill Wendling via Phabricator via cfe-commits
void updated this revision to Diff 549232. void added a comment. Update to more match Qing's GCC implementation. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148381/new/ https://reviews.llvm.org/D148381 Files: clang/include/clang/Basic/Attr.td

[PATCH] D148381: [WIP][Clang] Add element_count attribute

2023-07-11 Thread Bill Wendling via Phabricator via cfe-commits
void updated this revision to Diff 539219. void added a comment. Rebasing Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148381/new/ https://reviews.llvm.org/D148381 Files: clang/include/clang/Basic/Attr.td clang/include/clang/Basic/AttrDocs.td

[PATCH] D148381: [WIP][Clang] Add element_count attribute

2023-05-22 Thread Bill Wendling via Phabricator via cfe-commits
void updated this revision to Diff 524541. void added a comment. Herald added a subscriber: ormris. Add bounds checking for the "ArrayBounds" saniziter kind. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148381/new/ https://reviews.llvm.org/D148381

[PATCH] D148381: [WIP][Clang] Add element_count attribute

2023-05-12 Thread Florian Hahn via Phabricator via cfe-commits
fhahn added reviewers: rapidsna, fcloutier. fhahn added a comment. Adding a few people who have been working on `-fbounds-safety` proposal (https://llvm.swoogo.com/2023eurollvm/session/1414468/keynote-“-fbounds-safety”-enforcing-bounds-safety-for-production-c-code) Repository: rG LLVM Github

[PATCH] D148381: [WIP][Clang] Add element_count attribute

2023-05-11 Thread Bill Wendling via Phabricator via cfe-commits
void updated this revision to Diff 521406. void added a comment. Use strings for the attribute argument. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148381/new/ https://reviews.llvm.org/D148381 Files: clang/include/clang/Basic/Attr.td clang/

[PATCH] D148381: [WIP][Clang] Add element_count attribute

2023-05-04 Thread Bill Wendling via Phabricator via cfe-commits
void updated this revision to Diff 519605. void marked an inline comment as done. void added a comment. Use "Expected" for the SourceRange imports. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148381/new/ https://reviews.llvm.org/D148381 Files:

[PATCH] D148381: [WIP][Clang] Add element_count attribute

2023-05-03 Thread Balázs Kéri via Phabricator via cfe-commits
balazske added inline comments. Comment at: clang/lib/AST/ASTImporter.cpp:8992-8993 +for (unsigned I = 0, E = ECA->elementCountFields_size(); I != E; ++I) { + SourceRange SR = Import(ECA->getCountFieldSourceRange(I)).get(); + AI.getAttrAs()->addCountFieldSourceRange

[PATCH] D148381: [WIP][Clang] Add element_count attribute

2023-05-03 Thread Kees Cook via Phabricator via cfe-commits
kees added a comment. This is great! It passes my own testing for the sanitizer too. I'm looking forward to __bdos support. :) FWIW, similar progress is being made on the GCC side: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108896 Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACT

[PATCH] D148381: [WIP][Clang] Add element_count attribute

2023-05-01 Thread Bill Wendling via Phabricator via cfe-commits
void updated this revision to Diff 518546. void added a comment. Improve error message to use the unknown field's name. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148381/new/ https://reviews.llvm.org/D148381 Files: clang/include/clang/Basic/A

[PATCH] D148381: [WIP][Clang] Add element_count attribute

2023-04-28 Thread Bill Wendling via Phabricator via cfe-commits
void updated this revision to Diff 518106. void added a comment. Change sanitizer scope because instructions may be created. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148381/new/ https://reviews.llvm.org/D148381 Files: clang/include/clang/Ba

[PATCH] D148381: [WIP][Clang] Add element_count attribute

2023-04-28 Thread Bill Wendling via Phabricator via cfe-commits
void updated this revision to Diff 518013. void marked an inline comment as done. void added a comment. Fix the way the source ranges are imported via the ASTImporter. Do other minor fixes according to feedback. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.l

[PATCH] D148381: [WIP][Clang] Add element_count attribute

2023-04-28 Thread Bill Wendling via Phabricator via cfe-commits
void marked an inline comment as done. void added inline comments. Comment at: clang/include/clang/Basic/Attr.td:4170 +private: + mutable SmallVector CountFieldRanges; +public: nickdesaulniers wrote: > `mutable`...my least favorite keyword in C++. I

[PATCH] D148381: [WIP][Clang] Add element_count attribute

2023-04-28 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers added inline comments. Comment at: clang/include/clang/Basic/Attr.td:4170 +private: + mutable SmallVector CountFieldRanges; +public: `mutable`...my least favorite keyword in C++. If you drop `const` from `addCountFieldSourceRange` t

[PATCH] D148381: [WIP][Clang] Add element_count attribute

2023-04-27 Thread Balázs Kéri via Phabricator via cfe-commits
balazske added inline comments. Comment at: clang/lib/AST/ASTImporter.cpp:8768 class AttrImporter { + friend ASTImporter; + This line is not necessary. Comment at: clang/lib/AST/ASTImporter.cpp:8987 +cast(FromAttr)->copyCountFieldSourceRa

[PATCH] D148381: [WIP][Clang] Add element_count attribute

2023-04-27 Thread Bill Wendling via Phabricator via cfe-commits
void updated this revision to Diff 517734. void added a comment. Use the new memory location. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148381/new/ https://reviews.llvm.org/D148381 Files: clang/include/clang/Basic/Attr.td clang/include/cla

[PATCH] D148381: [WIP][Clang] Add element_count attribute

2023-04-27 Thread Bill Wendling via Phabricator via cfe-commits
void added a comment. This is a precursor to specifying the field with the designated initializer syntax. Therefore, it may be a bit cumbersome. The code in `CGExpr.cpp` is decidedly gross. I would appreciate any advice on how to de-grossify it. Repository: rG LLVM Github Monorepo CHANGES

[PATCH] D148381: [WIP][Clang] Add element_count attribute

2023-04-27 Thread Bill Wendling via Phabricator via cfe-commits
void updated this revision to Diff 517704. void added a comment. Fix ICE when the FD isn't found. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148381/new/ https://reviews.llvm.org/D148381 Files: clang/include/clang/Basic/Attr.td clang/include

[PATCH] D148381: [WIP][Clang] Add element_count attribute

2023-04-27 Thread Bill Wendling via Phabricator via cfe-commits
void updated this revision to Diff 517700. void added a comment. Add the ability to specify a "path" to the element count if it resides within a sub-structure. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148381/new/ https://reviews.llvm.org/D148

[PATCH] D148381: [WIP][Clang] Add element_count attribute

2023-04-17 Thread Bill Wendling via Phabricator via cfe-commits
void updated this revision to Diff 514451. void added a comment. Herald added a subscriber: jdoerfert. Fix failing testcase. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148381/new/ https://reviews.llvm.org/D148381 Files: clang/include/clang/Ba

[PATCH] D148381: [WIP][Clang] Add element_count attribute

2023-04-17 Thread Bill Wendling via Phabricator via cfe-commits
void added inline comments. Comment at: clang/lib/CodeGen/CGExpr.cpp:951-952 +if (auto *ME = dyn_cast(CE->getSubExpr())) { + if (ME->isFlexibleArrayMemberLike(CGF.getContext(), +StrictFlexArraysLevel, true)) { +if (auto *MD

[PATCH] D148381: [WIP][Clang] Add element_count attribute

2023-04-17 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers added inline comments. Comment at: clang/lib/CodeGen/CGExpr.cpp:951-952 +if (auto *ME = dyn_cast(CE->getSubExpr())) { + if (ME->isFlexibleArrayMemberLike(CGF.getContext(), +StrictFlexArraysLevel, true)) { +i

[PATCH] D148381: [WIP][Clang] Add element_count attribute

2023-04-17 Thread Bill Wendling via Phabricator via cfe-commits
void added a comment. In D148381#4274857 , @nickdesaulniers wrote: > Cool! > > How about some codegen tests? I'll add those to the next iteration. :-) > This looks a lot like the EuroLLVM keynote: > https://llvm.swoogo.com/2023eurollvm/agenda (Thursda

[PATCH] D148381: [WIP][Clang] Add element_count attribute

2023-04-17 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers added a comment. Cool! How about some codegen tests? This looks a lot like the EuroLLVM keynote: https://llvm.swoogo.com/2023eurollvm/agenda (Thursday `-fbounds-safety`). What's your plan for reconciling this with the authors of that? Have you reached out to them with this pro

[PATCH] D148381: [WIP][Clang] Add element_count attribute

2023-04-14 Thread Bill Wendling via Phabricator via cfe-commits
void added a comment. Note: This is a work-in-progress, so there's no need for a formal review, though any suggestions will definitely be appreciated. :-) Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148381/new/ https://reviews.llvm.org/D148381

[PATCH] D148381: [WIP][Clang] Add element_count attribute

2023-04-14 Thread Bill Wendling via Phabricator via cfe-commits
void created this revision. void added reviewers: kees, nickdesaulniers. Herald added a subscriber: martong. Herald added a reviewer: shafik. Herald added a reviewer: aaron.ballman. Herald added a project: All. void requested review of this revision. Herald added a project: clang. Herald added a su