[PATCH] D147661: [Sema] Tweak merging of availability attributes

Richard Sandiford via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 6 08:29:27 PDT 2023


rsandifo-arm updated this revision to Diff 511425.
rsandifo-arm added a comment.

Add AST dump test


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147661

Files:
  clang/lib/Sema/SemaDeclAttr.cpp
  clang/test/Sema/attr-availability-maccatalyst-dump.c


Index: clang/test/Sema/attr-availability-maccatalyst-dump.c
===================================================================
--- /dev/null
+++ clang/test/Sema/attr-availability-maccatalyst-dump.c
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 "-triple" "x86_64-apple-ios13.1-macabi" -std=c2x -fsyntax-only -ast-dump %s | FileCheck %s
+
+void foo() __attribute__((availability(ios,introduced=2.0)));
+void bar [[clang::availability(ios,introduced=2.0)]] ();
+
+// CHECK: FunctionDecl 0x{{[^ ]*}} <{{[^:]*}}:3:1, col:60> col:6 foo
+// CHECK: AvailabilityAttr 0x{{[^ ]*}} <col:27, col:58> Implicit maccatalyst 13.1 0 0 "" "" 2
+// CHECK: FunctionDecl 0x{{[^ ]*}} <{{[^:]*}}:4:1, col:55> col:6 bar
+// CHECK: AvailabilityAttr 0x{{[^ ]*}} <col:19, col:50> Implicit maccatalyst 13.1 0 0 "" "" 2
Index: clang/lib/Sema/SemaDeclAttr.cpp
===================================================================
--- clang/lib/Sema/SemaDeclAttr.cpp
+++ clang/lib/Sema/SemaDeclAttr.cpp
@@ -2775,7 +2775,7 @@
         return V;
       };
       AvailabilityAttr *NewAttr = S.mergeAvailabilityAttr(
-          ND, AL.getRange(), NewII, true /*Implicit*/,
+          ND, AL, NewII, true /*Implicit*/,
           MinMacCatalystVersion(Introduced.Version),
           MinMacCatalystVersion(Deprecated.Version),
           MinMacCatalystVersion(Obsoleted.Version), IsUnavailable, Str,
@@ -2817,7 +2817,7 @@
             return V ? *V : VersionTuple();
           };
           AvailabilityAttr *NewAttr = S.mergeAvailabilityAttr(
-              ND, AL.getRange(), NewII, true /*Implicit*/,
+              ND, AL, NewII, true /*Implicit*/,
               VersionOrEmptyVersion(NewIntroduced),
               VersionOrEmptyVersion(NewDeprecated),
               VersionOrEmptyVersion(NewObsoleted), /*IsUnavailable=*/false, Str,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147661.511425.patch
Type: text/x-patch
Size: 1795 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230406/70b600c0/attachment.bin>


More information about the cfe-commits mailing list