[PATCH] D87331: Sema: add support for `__attribute__((__swift_error__))`
Saleem Abdulrasool via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 9 12:35:32 PDT 2020
compnerd added inline comments.
================
Comment at: clang/include/clang/Basic/AttrDocs.td:3394
+parameter. Currently, the error parameter is always the last parameter of type
+``NSError**`` or ``CFErrorRef*``. Swift will remove the error parameter from
+the imported API. When calling the API, Swift will always pass a valid address
----------------
rjmccall wrote:
> compnerd wrote:
> > aaron.ballman wrote:
> > > Canonical type or are typedefs to these types also fine? May want to mention that the type has to be cv-unqualified, but I do wonder whether something like `NSError * const *` is fine.
> > I am definitely not the authority on this, but I believe that the common thing is to take `NSError **` or `CFErrorRef **` by canonical name. The cv-qualified versions, except on the outermost pointer, is something that can be treated as valid, though it is certainly extremely unusual. I've added test cases for them as well.
> `NSError * const *` actually does not really work; the whole point is that this is an out-parameter.
Oh right, its the `const NSError ** const` that can work, because the outer pointer can be non-mutable as it is a pointer by-reference scenario. Should we diagnose the `NSError * const *` case then? Any `const` qualified value is really unidiomatic to say the least.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D87331/new/
https://reviews.llvm.org/D87331
More information about the cfe-commits
mailing list