[PATCH] D14274: Add alloc_size attribute to clang

George Burgess IV via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 9 15:13:50 PST 2015


george.burgess.iv updated the summary for this revision.
george.burgess.iv updated this revision to Diff 42348.
george.burgess.iv added a comment.

As discussed offline:

- Added support for treating `const` variables as `constexpr`
- Added requirement for `LValue`s with an invalid `alloc_size` base to have an array index as their first designator entry (along with support for having an array of unknown size as the first entry in an `LValue`'s designator)

Additionally:

- Fixed a bug with the prior impl where we'd report too many bytes for type=3 with alloc_size
- Refactored a fair amount of duplicated logic
- Added checks to be sure that `LValue`s with invalid bases don't get moved into `APValues`

...I didn't end up refactoring the `LValue` designator walking, because we only needed one change in one place (because invalid bases can't find their way into `APValue`s). I'm happy to try to make a visitor-like thing and use it to refactor the ~4-5 places we walk {`LValue`,`APValue`} designators (3 of which reside in ExprConstant.cpp) if we still think that would be relatively valuable.


http://reviews.llvm.org/D14274

Files:
  include/clang/Basic/Attr.td
  include/clang/Basic/AttrDocs.td
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/AST/ExprConstant.cpp
  lib/Sema/SemaDeclAttr.cpp
  test/CodeGen/alloc-size.c
  test/CodeGenCXX/global-init.cpp
  test/Sema/alloc-size.c
  test/SemaCXX/constant-expression-cxx11.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14274.42348.patch
Type: text/x-patch
Size: 53493 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151209/a39f1589/attachment-0001.bin>


More information about the cfe-commits mailing list