[PATCH] D58152: [Sema] Delay checking whether objc_designated_initializer is being applied to an init method

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 13 07:16:58 PST 2019


aaron.ballman added inline comments.


================
Comment at: clang/lib/Sema/SemaDeclAttr.cpp:5252
                                             const ParsedAttr &AL) {
+  auto *Ctx = D->getDeclContext();
+
----------------
Please don't use `auto` here.


================
Comment at: clang/lib/Sema/SemaDeclAttr.cpp:7258-7267
+  // Do this check after processing D's attributes because the attribute
+  // objc_method_family can change whether the given method is in the init
+  // family, and it can be applied after objc_designated_initializer. This is a
+  // bit of a hack, but we need it to be compatible with versions of clang that
+  // processed the attribute list in the wrong order.
+  if (D->hasAttr<ObjCDesignatedInitializerAttr>() &&
+      cast<ObjCMethodDecl>(D)->getMethodFamily() != OMF_init) {
----------------
Do you also have to handle redeclaration merging, or is that not a thing for ObjC method declarations?

I'm wondering if this is better handled with the `mergeFooAttr()` pattern from `Sema::mergeDeclAttribute()`?


Repository:
  rC Clang

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

https://reviews.llvm.org/D58152





More information about the cfe-commits mailing list