[migrator] Add a viewer utility for child indices to facilitate access. NFC (#8925)

This commit is contained in:
Xi Ge
2017-04-21 15:15:58 -07:00
committed by GitHub
parent 72e7f9a7d7
commit e57232dbe9
2 changed files with 9 additions and 0 deletions

View File

@@ -59,6 +59,11 @@ CommonDiffItem(SDKNodeKind NodeKind, NodeAnnotation DiffKind,
RightUsr(RightUsr), LeftComment(LeftComment),
RightComment(RightComment), ModuleName(ModuleName) {
assert(!ChildIndex.empty() && "Child index is empty.");
llvm::SmallVector<StringRef, 4> Pieces;
ChildIndex.split(Pieces, ":");
std::transform(Pieces.begin(), Pieces.end(),
std::back_inserter(ChildIndexPieces),
[](StringRef Piece) { return std::stoi(Piece); });
}
StringRef swift::ide::api::CommonDiffItem::head() {