[PATCH] D87720: Sema: add support for `__attribute__((__swift_private__))`

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 17 07:22:52 PDT 2020


aaron.ballman added inline comments.


================
Comment at: clang/include/clang/Basic/Attr.td:2189
+  let Subjects =
+      SubjectList<[Enum, Function, Struct, TypedefName,
+                   ObjCClassMethod, ObjCInstanceMethod, ObjCInterface, ObjCProperty, ObjCProtocol],
----------------
Similar concerns here with listing all of the subjects as with the other review? (I don't have strong opinions.)


================
Comment at: clang/lib/Sema/SemaDecl.cpp:2613-2614
                                    SNA->getName(), AMK == Sema::AMK_Override);
+  else if (isa<SwiftPrivateAttr>(Attr) && AMK == Sema::AMK_Override)
+    NewAttr = nullptr;
   else if (const auto *OA = dyn_cast<OptimizeNoneAttr>(Attr))
----------------
Hmm, I'm a bit confused. The attribute is an inheritable attribute, but when we try to merge attributes between declarations, we drop it?


================
Comment at: clang/test/SemaObjC/attr-swift-private.m:1
+// RUN: %clang_cc1 -verify -fsyntax-only -fobjc-arc -fblocks %s
+
----------------
No need for blocks support?


================
Comment at: clang/test/SemaObjC/attr-swift-private.m:25
+};
+
+typedef struct { } T __attribute__((__swift_private__));
----------------
Should also have tests for the subjects you expect not to work.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87720



More information about the cfe-commits mailing list