File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -4335,7 +4335,14 @@ SourceLoc Decl::getAttributeInsertionLoc(bool forModifier) const {
43354335 return SourceLoc ();
43364336
43374337 SourceLoc resultLoc = getAttrs ().getStartLoc (forModifier);
4338- return resultLoc.isValid () ? resultLoc : introDecl->getStartLoc ();
4338+ if (resultLoc.isInvalid ())
4339+ return introDecl->getStartLoc ();
4340+
4341+ SourceLoc startLoc = introDecl->getStartLoc ();
4342+ if (!forModifier && getASTContext ().SourceMgr .isBefore (startLoc, resultLoc))
4343+ return startLoc;
4344+
4345+ return resultLoc;
43394346}
43404347
43414348// / Returns true if \p VD needs to be treated as publicly-accessible
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ func rethrowing(body: (UnsafeType) throws -> Void) rethrows { } // expected-warn
3030
3131class HasStatics {
3232 // expected-note@+1{{make static method 'f' @unsafe to indicate that its use is not memory-safe}}{{3-3=@unsafe }}
33- static func f( _: UnsafeType ) { } // expected-warning{{reference to unsafe struct 'UnsafeType' [Unsafe]}}
33+ static internal func f( _: UnsafeType ) { } // expected-warning{{reference to unsafe struct 'UnsafeType' [Unsafe]}}
3434}
3535
3636@unsafe
You can’t perform that action at this time.
0 commit comments