jkorous created this revision.
jkorous added reviewers: arphaman, erik.pilkington, vsapsai.
jkorous added a project: clang.
Herald added a subscriber: cfe-commits.

E. g. use "10.11" instead of "10_11".

This is just a consistency fix - the dotted format is already used everywhere 
else.

rdar://problem/39845032


Repository:
  rC Clang

https://reviews.llvm.org/D46747

Files:
  lib/Sema/SemaDeclAttr.cpp
  test/FixIt/fixit-availability-method.mm


Index: test/FixIt/fixit-availability-method.mm
===================================================================
--- /dev/null
+++ test/FixIt/fixit-availability-method.mm
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -triple x86_64-apple-macosx-10.11 -Wunguarded-availability 
-fdiagnostics-parseable-fixits -fsyntax-only -verify %s
+
+@interface foo
+- (void) method_bar __attribute__((availability(macos, introduced = 10.12))); 
// expected-note {{'method_bar' has been explicitly marked partial here}}
+@end
+
+int main() {
+    [foo method_bar]; // \
+    // expected-warning {{'method_bar' is only available on macOS 10.12 or 
newer}} \
+    // expected-note {{enclose 'method_bar' in an @available check to silence 
this warning}} \
+    // CHECK: "fix-it:.*if (@available(macOS 10.12, *))"
+    return 0;
+}
Index: lib/Sema/SemaDeclAttr.cpp
===================================================================
--- lib/Sema/SemaDeclAttr.cpp
+++ lib/Sema/SemaDeclAttr.cpp
@@ -7467,6 +7467,7 @@
     const AvailabilityAttr *AA =
       getAttrForPlatform(SemaRef.getASTContext(), OffendingDecl);
     VersionTuple Introduced = AA->getIntroduced();
+    Introduced.UseDotAsSeparator();
 
     if (AvailabilityStack.back() >= Introduced)
       return;


Index: test/FixIt/fixit-availability-method.mm
===================================================================
--- /dev/null
+++ test/FixIt/fixit-availability-method.mm
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -triple x86_64-apple-macosx-10.11 -Wunguarded-availability -fdiagnostics-parseable-fixits -fsyntax-only -verify %s
+
+@interface foo
+- (void) method_bar __attribute__((availability(macos, introduced = 10.12))); // expected-note {{'method_bar' has been explicitly marked partial here}}
+@end
+
+int main() {
+    [foo method_bar]; // \
+    // expected-warning {{'method_bar' is only available on macOS 10.12 or newer}} \
+    // expected-note {{enclose 'method_bar' in an @available check to silence this warning}} \
+    // CHECK: "fix-it:.*if (@available(macOS 10.12, *))"
+    return 0;
+}
Index: lib/Sema/SemaDeclAttr.cpp
===================================================================
--- lib/Sema/SemaDeclAttr.cpp
+++ lib/Sema/SemaDeclAttr.cpp
@@ -7467,6 +7467,7 @@
     const AvailabilityAttr *AA =
       getAttrForPlatform(SemaRef.getASTContext(), OffendingDecl);
     VersionTuple Introduced = AA->getIntroduced();
+    Introduced.UseDotAsSeparator();
 
     if (AvailabilityStack.back() >= Introduced)
       return;
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to