[SourceKit][CodeFormat] Indent case label items of a case statement as siblings. rdar://24279926

This commit is contained in:
Xi Ge
2016-01-21 13:57:30 -08:00
parent 29214253e5
commit 562de320d3
2 changed files with 31 additions and 0 deletions

View File

@@ -1929,6 +1929,13 @@ class FormatWalker: public ide::SourceEntityWalker {
FindAlignLoc(AE->getElement(I)->getStartLoc()), tok::comma);
}
}
// Case label items in a case statement are siblings.
if (auto CS = dyn_cast_or_null<CaseStmt>(Node.dyn_cast<Stmt *>())) {
for(const CaseLabelItem& Item : CS->getCaseLabelItems()) {
addPair(Item.getEndLoc(), FindAlignLoc(Item.getStartLoc()), tok::comma);
}
}
};
SourceLoc findSibling() {