[refactoring] fix RangeInfo crash inside comment, due to unhandled invalid CharSourceRange.

Resolves rdar://problem/38550117
This commit is contained in:
Nathan Hawes
2018-03-16 11:24:44 -07:00
parent 4058407f8f
commit ff76c265f3
2 changed files with 17 additions and 1 deletions

View File

@@ -1513,9 +1513,16 @@ static void resolveRange(SwiftLangSupport &Lang,
CompilerInvocation CompInvok;
ASTInvok->applyTo(CompInvok);
RangeInfo Result;
Result.RangeKind = Lang.getUIDForRangeKind(Info.Kind);
Result.RangeContent = Info.ContentRange.str();
if (Info.Kind == RangeKind::Invalid) {
Result.RangeContent = "";
} else {
assert(Info.ContentRange.isValid());
Result.RangeContent = Info.ContentRange.str();
}
switch (Info.Kind) {
case RangeKind::SingleExpression: {
SmallString<64> SS;