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 {
4335
4335
return SourceLoc ();
4336
4336
4337
4337
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;
4339
4346
}
4340
4347
4341
4348
// / 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
30
30
31
31
class HasStatics {
32
32
// 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]}}
34
34
}
35
35
36
36
@unsafe
You can’t perform that action at this time.
0 commit comments