[PATCH] D87331: Sema: add support for `__attribute__((__swift_error__))`
John McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 9 11:06:34 PDT 2020
rjmccall added inline comments.
================
Comment at: clang/include/clang/Basic/Attr.td:2128
+ ];
+ let Subjects = SubjectList<[Function, ObjCMethod], ErrorDiag>;
+ let Documentation = [SwiftErrorDocs];
----------------
compnerd wrote:
> aaron.ballman wrote:
> > Should this apply to function-like things such as blocks or function pointers? If so, you should use `HasFunctionProto`.
> I believe not.
Correct, it's just declared functions for now.
================
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
----------------
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.
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