[PATCH] D50318: Support Swift in platform availability attribute

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 1 08:18:19 PDT 2018


aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM aside from a few small nits.



================
Comment at: lib/Parse/ParseDecl.cpp:1005
+    if (Keyword == Ident_deprecated && Platform->Ident &&
+        Platform->Ident->getName() == "swift") {
+      // For swift, we deprecate for all versions.
----------------
You can use `Platform->Ident->isStr("swift")` here instead.


================
Comment at: lib/Parse/ParseDecl.cpp:1007
+      // For swift, we deprecate for all versions.
+      if (!Changes[Deprecated].KeywordLoc.isInvalid()) {
+        Diag(KeywordLoc, diag::err_availability_redundant)
----------------
Might as well switch the logic around to using `isValid()` instead.


================
Comment at: lib/Sema/SemaDeclAttr.cpp:2368
 
+  if (II->getName() == "swift") {
+    if (Introduced.isValid() || Obsoleted.isValid() ||
----------------
`II->isStr()` here as well.


Repository:
  rC Clang

https://reviews.llvm.org/D50318





More information about the cfe-commits mailing list