[PATCH] D84005: Introduce ns_error_domain attribute.

Dmitri Gribenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 27 00:43:41 PDT 2020


gribozavr2 accepted this revision.
gribozavr2 added inline comments.
This revision is now accepted and ready to land.


================
Comment at: clang/include/clang/Basic/AttrDocs.td:3340
+
+    const char *MyErrorDomain;
+    typedef NS_ERROR_ENUM(unsigned char, MyErrorEnum, MyErrorDomain) {
----------------
const char * => NSString * const?


================
Comment at: clang/test/Sema/ns_error_enum.c:25
+
+const char *MyErrorDomain;
+typedef NS_ERROR_ENUM(unsigned char, MyErrorEnum, MyErrorDomain) {
----------------
const char * => NSString * const? You'd need to define a fake NSString type, but that should be rather easy:

```
@interface NSString
@end
```


================
Comment at: clang/test/Sema/ns_error_enum.c:30
+};
+struct __attribute__((ns_error_domain(MyErrorDomain))) MyStructErrorDomain {};
+  // expected-error at -1{{'ns_error_domain' attribute only applies to enums}}
----------------
"MyStructWithErrorDomain" would be a better name, I think.


================
Comment at: clang/test/Sema/ns_error_enum.c:42
+
+typedef NS_ERROR_ENUM(unsigned char, MyErrorEnumInvalid, "domain-string");
+  // expected-error at -1{{'ns_error_domain' attribute requires parameter 1 to be an identifier}}
----------------
Also a test for passing 0 or more than 1 argument to the attribute?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84005/new/

https://reviews.llvm.org/D84005





More information about the cfe-commits mailing list