45 const CommentOptions &CommentOpts)
46 : Traits(Allocator, CommentOpts), Allocator() {
48 if (Documentation.empty())
51 CommentWithMarkers.reserve(Documentation.size() +
52 Documentation.count(
'\n') * 3);
59 CommentWithMarkers =
"///";
61 for (
char C : Documentation) {
63 CommentWithMarkers +=
"\n///";
66 if (NewLine && (C ==
'<')) {
73 CommentWithMarkers +=
' ';
75 CommentWithMarkers += C;
79 SourceManagerForFile SourceMgrForFile(
"mock_file.cpp", CommentWithMarkers);
81 SourceManager &SourceMgr = SourceMgrForFile.get();
85 SourceMgr.getDiagnostics().setClient(
new IgnoringDiagConsumer);
87 comments::Sema S(Allocator, SourceMgr, SourceMgr.getDiagnostics(), Traits,
89 comments::Lexer L(Allocator, SourceMgr.getDiagnostics(), Traits,
90 SourceMgr.getLocForStartOfFile(SourceMgr.getMainFileID()),
91 CommentWithMarkers.data(),
92 CommentWithMarkers.data() + CommentWithMarkers.size());
93 comments::Parser P(L, S, Allocator, SourceMgr, SourceMgr.getDiagnostics(),
95 comments::FullComment *FC = P.parseFullComment();
100 for (
auto *
Block : FC->getBlocks()) {