[PATCH] Adding a new [[clang::impossible_enum]] attribute to clang

Chris Bieneman beanz at apple.com
Mon Dec 22 15:34:59 PST 2014


Hi alexr, aaron.ballman,

This attribute provides a way to instruct the compiler that a given enum value is never valid. This specification can allow large segments of code to be dead stripped.

One hypothetical use of this is my RFC on stripping intrinsics for un-used targets in LLVM (http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-December/079818.html).

In this case the attribute would allow us to remove the code and constant data for unusable attributes without needing to litter around #ifdefs.

Disclaimer: This idea came from Alex Rosenberg... Beware.

http://reviews.llvm.org/D6763

Files:
  include/clang/Basic/Attr.td
  include/clang/Basic/AttrDocs.td
  include/clang/Sema/AttributeList.h
  lib/CodeGen/CGExprScalar.cpp
  lib/CodeGen/CGStmt.cpp
  lib/Sema/SemaDeclAttr.cpp
  test/CodeGenCXX/impossible_enum.cpp
  utils/TableGen/ClangAttrEmitter.cpp

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6763.17576.patch
Type: text/x-patch
Size: 9049 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20141222/d51681dd/attachment.bin>


More information about the cfe-commits mailing list