[PATCH] D87331: Sema: add support for `__attribute__((__swift_error__))`

Saleem Abdulrasool via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 8 14:49:12 PDT 2020


compnerd created this revision.
compnerd added a reviewer: aaron.ballman.
Herald added a reviewer: jdoerfert.
Herald added a project: clang.
compnerd requested review of this revision.

Introduce a new attribute that is used to indicate the error handling
convention used by a function.  This is used to translate the error
semantics from the decorated interface to a compatible Swift interface.

The supported error convention is one of:

- none: no error handling
- nonnull_error: a non-null error parameter indicates an error signifier
- null_result: a return value of NULL is an error signifier
- zero_result: a return value of 0 is an error signifier
- nonzero_result: a non-zero return value is an error signifier

Since this is the first of the attributes needed to support the semantic
annotation for Swift, this change also includes the necessary supporting
infrastructure for a new category of attributes (Swift).

This is based on the work of the original changes in
https://github.com/llvm/llvm-project-staging/commit/8afaf3aad2af43cfedca7a24cd817848c4e95c0c


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D87331

Files:
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/AttrDocs.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Sema/SemaDeclAttr.cpp
  clang/test/Misc/pragma-attribute-supported-attributes-list.test
  clang/test/SemaObjC/attr-swift-error.m

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87331.290588.patch
Type: text/x-patch
Size: 14690 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200908/c28d7d67/attachment-0001.bin>


More information about the cfe-commits mailing list