@@ -397,9 +397,10 @@ static void replaceObjcDeclarationsWithSwiftOnes(const Decl *D,
397
397
OS << Doc;
398
398
}
399
399
400
- static LineList getLineListFromComment (const StringRef Text) {
400
+ static LineList getLineListFromComment (SourceManager &SourceMgr,
401
+ swift::markup::MarkupContext &MC,
402
+ const StringRef Text) {
401
403
LangOptions LangOpts;
402
- SourceManager SourceMgr;
403
404
auto Tokens = swift::tokenize (LangOpts, SourceMgr,
404
405
SourceMgr.addMemBufferCopy (Text));
405
406
std::vector<SingleRawComment> Comments;
@@ -413,12 +414,13 @@ static LineList getLineListFromComment(const StringRef Text) {
413
414
return {};
414
415
415
416
RawComment Comment (Comments);
416
- swift::markup::MarkupContext MC;
417
417
return MC.getLineList (Comment);
418
418
}
419
419
420
420
std::string ide::extractPlainTextFromComment (const StringRef Text) {
421
- return getLineListFromComment (Text).str ();
421
+ SourceManager SourceMgr;
422
+ swift::markup::MarkupContext MC;
423
+ return getLineListFromComment (SourceMgr, MC, Text).str ();
422
424
}
423
425
424
426
bool ide::getDocumentationCommentAsXML (const Decl *D, raw_ostream &OS) {
@@ -467,8 +469,9 @@ bool ide::convertMarkupToXML(StringRef Text, raw_ostream &OS) {
467
469
llvm::raw_string_ostream OS (Comment);
468
470
OS << " /**\n " << Text << " \n " << " */" ;
469
471
}
470
- LineList LL = getLineListFromComment (Comment) ;
472
+ SourceManager SourceMgr ;
471
473
MarkupContext MC;
474
+ LineList LL = getLineListFromComment (SourceMgr, MC, Comment);
472
475
if (auto *Doc = swift::markup::parseDocument (MC, LL)) {
473
476
CommentToXMLConverter Converter (OS);
474
477
Converter.visitCommentParts (extractCommentParts (MC, Doc));
0 commit comments