mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Exclusivity] Suggest Fix-Its to replace swap() with swapAt()
Extend the static diagnostics for exclusivity violations to suggest replacing swap(&collection[index1], &collection[index2] with collection.swapAt(index1, index2). when 'collection' is a MutableCollection. To do so, repurpose some vestigial code that was previously used to suppress all exclusivity diagnostics for calls to swap() and add some additional syntactic, semantic, and textual pattern matching. rdar://problem/31916085
This commit is contained in:
@@ -1378,8 +1378,6 @@ static bool ParseSILArgs(SILOptions &Opts, ArgList &Args,
|
||||
|= Args.hasArg(OPT_assume_parsing_unqualified_ownership_sil);
|
||||
Opts.EnableMandatorySemanticARCOpts |=
|
||||
!Args.hasArg(OPT_disable_mandatory_semantic_arc_opts);
|
||||
Opts.SuppressStaticExclusivitySwap |=
|
||||
Args.hasArg(OPT_suppress_static_exclusivity_swap);
|
||||
|
||||
if (Args.hasArg(OPT_debug_on_sil)) {
|
||||
// Derive the name of the SIL file for debugging from
|
||||
|
||||
Reference in New Issue
Block a user