[IDE/SyntaxModel] Make sure to properly annotate comment markers in single-line comment blocks

rdar://51893731
This commit is contained in:
Argyrios Kyrtzidis
2019-06-24 12:19:12 -07:00
parent 747c69c1ba
commit dbc35b4531
2 changed files with 6 additions and 2 deletions

View File

@@ -1272,6 +1272,10 @@ bool ModelASTWalker::processComment(CharSourceRange Range) {
if (NewLinePos != StringRef::npos) { if (NewLinePos != StringRef::npos) {
Text = Text.substr(0, NewLinePos); Text = Text.substr(0, NewLinePos);
} }
if (Text.endswith("*/")) {
Text = Text.drop_back(2);
}
Text = Text.rtrim();
CharSourceRange BeforeMarker{ SM, Range.getStart(), Loc }; CharSourceRange BeforeMarker{ SM, Range.getStart(), Loc };
CharSourceRange Marker(Loc, Text.size()); CharSourceRange Marker(Loc, Text.size());

View File

@@ -36,9 +36,9 @@ func f(x: Int) -> Int {
/* FIXME: blah*/ /* FIXME: blah */
// CHECK: <comment-block>/* <comment-marker>FIXME: blah*/</comment-marker></comment-block> // CHECK: <comment-block>/* <comment-marker>FIXME: blah</comment-marker> */</comment-block>
/* /*
* FIXME: blah * FIXME: blah