Merge pull request #15301 from nathawes/rdar38550117-range-info-on-comment-mark-crashing

[refactoring] fix RangeInfo crash inside comment, due to unhandled invalid CharSourceRange
This commit is contained in:
Nathan Hawes
2018-03-16 14:46:10 -07:00
committed by GitHub
2 changed files with 17 additions and 1 deletions

View File

@@ -1516,9 +1516,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;