diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/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, diff --git a/clang/test/Sema/attr-availability-maccatalyst-dump.c b/clang/test/Sema/attr-availability-maccatalyst-dump.c new file mode 100644 --- /dev/null +++ b/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{{[^ ]*}} Implicit maccatalyst 13.1 0 0 "" "" 2 +// CHECK: FunctionDecl 0x{{[^ ]*}} <{{[^:]*}}:4:1, col:55> col:6 bar +// CHECK: AvailabilityAttr 0x{{[^ ]*}} Implicit maccatalyst 13.1 0 0 "" "" 2