diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp index 76ef85ecd7bed..dbe39b9b5cf85 100644 --- a/lib/Parse/ParseDecl.cpp +++ b/lib/Parse/ParseDecl.cpp @@ -1506,7 +1506,7 @@ bool Parser::parseExternAttribute(DeclAttributes &Attributes, return false; } - auto AttrRange = SourceRange(Loc, Tok.getLoc()); + auto AttrRange = SourceRange(Loc, rParenLoc); // Reject duplicate attributes with the same kind. if (ExternAttr::find(Attributes, kind)) { @@ -2329,7 +2329,7 @@ bool Parser::parseBackDeployedAttribute(DeclAttributes &Attributes, } assert(!PlatformAndVersions.empty()); - auto AttrRange = SourceRange(Loc, Tok.getLoc()); + auto AttrRange = SourceRange(Loc, RightLoc); for (auto &Item : PlatformAndVersions) { Attributes.add(new (Context) BackDeployedAttr(AtLoc, AttrRange, Item.first, Item.second, diff --git a/test/SourceKit/Misc/rdar123405070.swift b/test/SourceKit/Misc/rdar123405070.swift new file mode 100644 index 0000000000000..81fafb3efb075 --- /dev/null +++ b/test/SourceKit/Misc/rdar123405070.swift @@ -0,0 +1,10 @@ +// RUN: %sourcekitd-test -req=open %s -- %s +// Test that this doesn't crash sourcekitd + +@_backDeploy(before: macOS 14.0) +@inline(never) +public func foo() {} + +@_extern(wasm, module: "b", name: "c") +@_extern(c) +private func bar()