You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix a rarely occurring crash when processing certain symbols for many platforms (#1227)
* Fix a rare crash that sometimes (depending on file read order) happen when processing members of structs nested in unions for many platforms.
rdar://151854292
* update test to correctly trigger underlying issue
* recursively clone children and transplant those with mismatched languages
* Simplify and correct deep cloning of path hierarchy nodes
---------
Co-authored-by: Vera Mitchell <[email protected]>
assert(!otherLanguages.contains(separatedLanguage),"The caller should have already removed '\(separatedLanguage.id)' from '\(languages.sorted().map(\.id).joined(separator:", "))'")
582
+
583
+
letclone:Node
584
+
iflet currentSymbol = symbol {
585
+
// If a representation of the symbol exist in the current local symbol graph, prefer that for more correct disambiguation information.
assertionFailure("Unexpectedly cloned a non-symbol node '\(name)' into separate language representations ('\(separatedLanguage.id)' vs '\(otherLanguages.sorted().map(\.id).joined(separator:", "))').")
591
+
clone =Node(name: name)
592
+
}
593
+
// Update languages and counterparts
594
+
clone.languages =[separatedLanguage]
595
+
languages.remove(separatedLanguage)
596
+
assert(!languages.isEmpty,"""
597
+
Unexpectedly cloned '\(symbol?.identifier.precise ??"non-symbol named \(name)")' for '\(separatedLanguage.id)' when it was already the only language it was available for.
598
+
""")
599
+
600
+
clone.counterpart =self
601
+
self.counterpart = clone
602
+
603
+
// Assign all the children to either the original, the clone, or both.
604
+
letoriginalChildren= children
605
+
children.removeAll(keepingCapacity:true)
606
+
607
+
func addOrMove(_ node:Node, to containerNode:Node){
assertionFailure("Node \(node.name) (\(node.languages.sorted().map(\.id).joined(separator:","))) doesn't belong in either '\(separatedLanguage.id)' or '\(otherLanguages.sorted().map(\.id).joined(separator:", "))'.")
643
+
continue
644
+
}
645
+
}
646
+
}
647
+
648
+
return clone
613
649
}
614
650
615
651
/// Adds a descendant to this node, providing disambiguation information from the node's symbol.
0 commit comments