[PATCH] D64380: Add 'require_designated_init' and 'required' attribute to clang

Emmett Neyman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 8 16:31:11 PDT 2019


emmettneyman created this revision.
emmettneyman added a reviewer: hiraditya.
Herald added subscribers: cfe-commits, jfb, aheejin, dschuff.
Herald added a project: clang.

Add two new attributes for struct initialization: 'require_designated_init' and 'required'. The first attribute attaches to a struct or class and specifies that
whenever a new variable of that type is declared, designated initializer syntax must be used. The second attribute attaches to a specific field and requires that that field
must be explicitly initialized with a value whenever a new instance of the struct is declared.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D64380

Files:
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/AttrDocs.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaDeclAttr.cpp
  clang/test/Misc/pragma-attribute-supported-attributes-list.test
  clang/test/SemaCXX/attr-require-designated-init.cpp
  clang/test/SemaCXX/attr-required.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64380.208537.patch
Type: text/x-patch
Size: 416524 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190708/16f7e482/attachment-0001.bin>


More information about the cfe-commits mailing list