1f276624eSJulie Hockett //===-- clang-doc/BitcodeTest.cpp -----------------------------------------===//
2f276624eSJulie Hockett //
32946cd70SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
42946cd70SChandler Carruth // See https://llvm.org/LICENSE.txt for license information.
52946cd70SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6f276624eSJulie Hockett //
7f276624eSJulie Hockett //===----------------------------------------------------------------------===//
8f276624eSJulie Hockett
9f276624eSJulie Hockett #include "BitcodeReader.h"
10f276624eSJulie Hockett #include "BitcodeWriter.h"
11f276624eSJulie Hockett #include "ClangDocTest.h"
12f276624eSJulie Hockett #include "Representation.h"
13e0308279SFrancis Visoiu Mistrih #include "llvm/Bitstream/BitstreamReader.h"
14e0308279SFrancis Visoiu Mistrih #include "llvm/Bitstream/BitstreamWriter.h"
15f276624eSJulie Hockett #include "gtest/gtest.h"
16f276624eSJulie Hockett
17f276624eSJulie Hockett namespace clang {
18f276624eSJulie Hockett namespace doc {
19f276624eSJulie Hockett
writeInfo(T & I)20bf445b87SJulie Hockett template <typename T> static std::string writeInfo(T &I) {
21f276624eSJulie Hockett SmallString<2048> Buffer;
22f276624eSJulie Hockett llvm::BitstreamWriter Stream(Buffer);
23f276624eSJulie Hockett ClangDocBitcodeWriter Writer(Stream);
24bf445b87SJulie Hockett Writer.emitBlock(I);
25f276624eSJulie Hockett return Buffer.str().str();
26f276624eSJulie Hockett }
27f276624eSJulie Hockett
writeInfo(Info * I)28bf445b87SJulie Hockett std::string writeInfo(Info *I) {
29bf445b87SJulie Hockett switch (I->IT) {
30bf445b87SJulie Hockett case InfoType::IT_namespace:
31bf445b87SJulie Hockett return writeInfo(*static_cast<NamespaceInfo *>(I));
32bf445b87SJulie Hockett case InfoType::IT_record:
33bf445b87SJulie Hockett return writeInfo(*static_cast<RecordInfo *>(I));
34bf445b87SJulie Hockett case InfoType::IT_enum:
35bf445b87SJulie Hockett return writeInfo(*static_cast<EnumInfo *>(I));
36bf445b87SJulie Hockett case InfoType::IT_function:
37bf445b87SJulie Hockett return writeInfo(*static_cast<FunctionInfo *>(I));
3821fb70c6SBrett Wilson case InfoType::IT_typedef:
3921fb70c6SBrett Wilson return writeInfo(*static_cast<TypedefInfo *>(I));
40bf445b87SJulie Hockett default:
41bf445b87SJulie Hockett return "";
42bf445b87SJulie Hockett }
43bf445b87SJulie Hockett }
44bf445b87SJulie Hockett
readInfo(StringRef Bitcode,size_t NumInfos)45f276624eSJulie Hockett std::vector<std::unique_ptr<Info>> readInfo(StringRef Bitcode,
46f276624eSJulie Hockett size_t NumInfos) {
47f276624eSJulie Hockett llvm::BitstreamCursor Stream(Bitcode);
48f276624eSJulie Hockett doc::ClangDocBitcodeReader Reader(Stream);
49f276624eSJulie Hockett auto Infos = Reader.readBitcode();
50f276624eSJulie Hockett
51f276624eSJulie Hockett // Check that there was no error in the read.
52f276624eSJulie Hockett assert(Infos);
53f276624eSJulie Hockett EXPECT_EQ(Infos.get().size(), NumInfos);
54f276624eSJulie Hockett return std::move(Infos.get());
55f276624eSJulie Hockett }
56f276624eSJulie Hockett
TEST(BitcodeTest,emitNamespaceInfoBitcode)57f276624eSJulie Hockett TEST(BitcodeTest, emitNamespaceInfoBitcode) {
58f276624eSJulie Hockett NamespaceInfo I;
59f276624eSJulie Hockett I.Name = "r";
60f276624eSJulie Hockett I.Namespace.emplace_back(EmptySID, "A", InfoType::IT_namespace);
61f276624eSJulie Hockett
6221fb70c6SBrett Wilson I.Children.Namespaces.emplace_back(EmptySID, "ChildNamespace",
63f276624eSJulie Hockett InfoType::IT_namespace);
6421fb70c6SBrett Wilson I.Children.Records.emplace_back(EmptySID, "ChildStruct", InfoType::IT_record);
6521fb70c6SBrett Wilson I.Children.Functions.emplace_back();
6621fb70c6SBrett Wilson I.Children.Enums.emplace_back();
67f276624eSJulie Hockett
68f276624eSJulie Hockett std::string WriteResult = writeInfo(&I);
69f276624eSJulie Hockett EXPECT_TRUE(WriteResult.size() > 0);
70f276624eSJulie Hockett std::vector<std::unique_ptr<Info>> ReadResults = readInfo(WriteResult, 1);
71f276624eSJulie Hockett
72f276624eSJulie Hockett CheckNamespaceInfo(&I, InfoAsNamespace(ReadResults[0].get()));
73f276624eSJulie Hockett }
74f276624eSJulie Hockett
TEST(BitcodeTest,emitRecordInfoBitcode)75f276624eSJulie Hockett TEST(BitcodeTest, emitRecordInfoBitcode) {
76f276624eSJulie Hockett RecordInfo I;
77f276624eSJulie Hockett I.Name = "r";
78f276624eSJulie Hockett I.Namespace.emplace_back(EmptySID, "A", InfoType::IT_namespace);
79f276624eSJulie Hockett
80f276624eSJulie Hockett I.DefLoc = Location(10, llvm::SmallString<16>{"test.cpp"});
81f276624eSJulie Hockett I.Loc.emplace_back(12, llvm::SmallString<16>{"test.cpp"});
82f276624eSJulie Hockett
830afc6085SBrett Wilson I.Members.emplace_back(TypeInfo("int"), "X", AccessSpecifier::AS_private);
84*edd690b0SVlad Serebrennikov I.TagType = TagTypeKind::Class;
85b1f01e27SJulie Hockett I.IsTypeDef = true;
86ba3d595fSDiego Astiazaran I.Bases.emplace_back(EmptySID, "F", "path/to/F", true,
87ba3d595fSDiego Astiazaran AccessSpecifier::AS_public, true);
8821fb70c6SBrett Wilson I.Bases.back().Children.Functions.emplace_back();
890afc6085SBrett Wilson I.Bases.back().Members.emplace_back(TypeInfo("int"), "X",
900afc6085SBrett Wilson AccessSpecifier::AS_private);
91f276624eSJulie Hockett I.Parents.emplace_back(EmptySID, "F", InfoType::IT_record);
92f276624eSJulie Hockett I.VirtualParents.emplace_back(EmptySID, "G", InfoType::IT_record);
93f276624eSJulie Hockett
9499baa10fSBrett Wilson // Documentation for the data member.
9599baa10fSBrett Wilson CommentInfo TopComment;
9699baa10fSBrett Wilson TopComment.Kind = "FullComment";
9799baa10fSBrett Wilson TopComment.Children.emplace_back(std::make_unique<CommentInfo>());
9899baa10fSBrett Wilson CommentInfo *Brief = TopComment.Children.back().get();
9999baa10fSBrett Wilson Brief->Kind = "ParagraphComment";
10099baa10fSBrett Wilson Brief->Children.emplace_back(std::make_unique<CommentInfo>());
10199baa10fSBrett Wilson Brief->Children.back()->Kind = "TextComment";
10299baa10fSBrett Wilson Brief->Children.back()->Name = "ParagraphComment";
10399baa10fSBrett Wilson Brief->Children.back()->Text = "Value of the thing.";
10499baa10fSBrett Wilson I.Bases.back().Members.back().Description.emplace_back(std::move(TopComment));
10599baa10fSBrett Wilson
10621fb70c6SBrett Wilson I.Children.Records.emplace_back(EmptySID, "ChildStruct", InfoType::IT_record);
10721fb70c6SBrett Wilson I.Children.Functions.emplace_back();
10821fb70c6SBrett Wilson I.Children.Enums.emplace_back();
109f276624eSJulie Hockett
110f276624eSJulie Hockett std::string WriteResult = writeInfo(&I);
111f276624eSJulie Hockett EXPECT_TRUE(WriteResult.size() > 0);
112f276624eSJulie Hockett std::vector<std::unique_ptr<Info>> ReadResults = readInfo(WriteResult, 1);
113f276624eSJulie Hockett
114f276624eSJulie Hockett CheckRecordInfo(&I, InfoAsRecord(ReadResults[0].get()));
115f276624eSJulie Hockett }
116f276624eSJulie Hockett
TEST(BitcodeTest,emitFunctionInfoBitcode)117f276624eSJulie Hockett TEST(BitcodeTest, emitFunctionInfoBitcode) {
118f276624eSJulie Hockett FunctionInfo I;
119f276624eSJulie Hockett I.Name = "f";
120f276624eSJulie Hockett I.Namespace.emplace_back(EmptySID, "A", InfoType::IT_namespace);
121f276624eSJulie Hockett
122f276624eSJulie Hockett I.DefLoc = Location(10, llvm::SmallString<16>{"test.cpp"});
123f276624eSJulie Hockett I.Loc.emplace_back(12, llvm::SmallString<16>{"test.cpp"});
124f276624eSJulie Hockett
1250afc6085SBrett Wilson I.ReturnType = TypeInfo("void");
1260afc6085SBrett Wilson I.Params.emplace_back(TypeInfo("int"), "P");
127f276624eSJulie Hockett
1286a29ae4bSDiego Astiazaran I.Access = AccessSpecifier::AS_none;
1296a29ae4bSDiego Astiazaran
130f276624eSJulie Hockett std::string WriteResult = writeInfo(&I);
131f276624eSJulie Hockett EXPECT_TRUE(WriteResult.size() > 0);
132f276624eSJulie Hockett std::vector<std::unique_ptr<Info>> ReadResults = readInfo(WriteResult, 1);
133f276624eSJulie Hockett
134f276624eSJulie Hockett CheckFunctionInfo(&I, InfoAsFunction(ReadResults[0].get()));
135f276624eSJulie Hockett }
136f276624eSJulie Hockett
TEST(BitcodeTest,emitMethodInfoBitcode)137f276624eSJulie Hockett TEST(BitcodeTest, emitMethodInfoBitcode) {
138f276624eSJulie Hockett FunctionInfo I;
139f276624eSJulie Hockett I.Name = "f";
140f276624eSJulie Hockett I.Namespace.emplace_back(EmptySID, "A", InfoType::IT_namespace);
141f276624eSJulie Hockett
142f276624eSJulie Hockett I.DefLoc = Location(10, llvm::SmallString<16>{"test.cpp"});
143f276624eSJulie Hockett I.Loc.emplace_back(12, llvm::SmallString<16>{"test.cpp"});
144f276624eSJulie Hockett
1450afc6085SBrett Wilson I.ReturnType = TypeInfo("void");
1460afc6085SBrett Wilson I.Params.emplace_back(TypeInfo("int"), "P");
147f276624eSJulie Hockett I.IsMethod = true;
148f276624eSJulie Hockett I.Parent = Reference(EmptySID, "Parent", InfoType::IT_record);
149f276624eSJulie Hockett
1506a29ae4bSDiego Astiazaran I.Access = AccessSpecifier::AS_public;
151f276624eSJulie Hockett
152f276624eSJulie Hockett std::string WriteResult = writeInfo(&I);
153f276624eSJulie Hockett EXPECT_TRUE(WriteResult.size() > 0);
154f276624eSJulie Hockett std::vector<std::unique_ptr<Info>> ReadResults = readInfo(WriteResult, 1);
155f276624eSJulie Hockett
156f276624eSJulie Hockett CheckFunctionInfo(&I, InfoAsFunction(ReadResults[0].get()));
157f276624eSJulie Hockett }
158f276624eSJulie Hockett
TEST(BitcodeTest,emitEnumInfoBitcode)159f276624eSJulie Hockett TEST(BitcodeTest, emitEnumInfoBitcode) {
160f276624eSJulie Hockett EnumInfo I;
161f276624eSJulie Hockett I.Name = "e";
162f276624eSJulie Hockett I.Namespace.emplace_back(EmptySID, "A", InfoType::IT_namespace);
163f276624eSJulie Hockett
164f276624eSJulie Hockett I.DefLoc = Location(10, llvm::SmallString<16>{"test.cpp"});
165f276624eSJulie Hockett I.Loc.emplace_back(12, llvm::SmallString<16>{"test.cpp"});
166f276624eSJulie Hockett
167f276624eSJulie Hockett I.Members.emplace_back("X");
168f276624eSJulie Hockett I.Scoped = true;
169f276624eSJulie Hockett
170f276624eSJulie Hockett std::string WriteResult = writeInfo(&I);
171f276624eSJulie Hockett EXPECT_TRUE(WriteResult.size() > 0);
172f276624eSJulie Hockett std::vector<std::unique_ptr<Info>> ReadResults = readInfo(WriteResult, 1);
173f276624eSJulie Hockett
174f276624eSJulie Hockett CheckEnumInfo(&I, InfoAsEnum(ReadResults[0].get()));
175f276624eSJulie Hockett }
176f276624eSJulie Hockett
TEST(BitcodeTest,emitTypedefInfoBitcode)17721fb70c6SBrett Wilson TEST(BitcodeTest, emitTypedefInfoBitcode) {
17821fb70c6SBrett Wilson TypedefInfo I;
17921fb70c6SBrett Wilson I.Name = "MyInt";
18021fb70c6SBrett Wilson I.Namespace.emplace_back(EmptySID, "A", InfoType::IT_namespace);
18121fb70c6SBrett Wilson
18221fb70c6SBrett Wilson I.DefLoc = Location(10, llvm::SmallString<16>{"test.cpp"});
18321fb70c6SBrett Wilson I.Underlying = TypeInfo("unsigned");
18421fb70c6SBrett Wilson I.IsUsing = true;
18521fb70c6SBrett Wilson
1867231c996SBrett Wilson CommentInfo Top;
1877231c996SBrett Wilson Top.Kind = "FullComment";
1887231c996SBrett Wilson
1897231c996SBrett Wilson Top.Children.emplace_back(std::make_unique<CommentInfo>());
1907231c996SBrett Wilson CommentInfo *BlankLine = Top.Children.back().get();
1917231c996SBrett Wilson BlankLine->Kind = "ParagraphComment";
1927231c996SBrett Wilson BlankLine->Children.emplace_back(std::make_unique<CommentInfo>());
1937231c996SBrett Wilson BlankLine->Children.back()->Kind = "TextComment";
1947231c996SBrett Wilson
1957231c996SBrett Wilson I.Description.emplace_back(std::move(Top));
1967231c996SBrett Wilson
19721fb70c6SBrett Wilson std::string WriteResult = writeInfo(&I);
19821fb70c6SBrett Wilson EXPECT_TRUE(WriteResult.size() > 0);
19921fb70c6SBrett Wilson std::vector<std::unique_ptr<Info>> ReadResults = readInfo(WriteResult, 1);
20021fb70c6SBrett Wilson
20121fb70c6SBrett Wilson CheckTypedefInfo(&I, InfoAsTypedef(ReadResults[0].get()));
2027231c996SBrett Wilson
2037231c996SBrett Wilson // Check one with no IsUsing set, no description, and no definition location.
2047231c996SBrett Wilson TypedefInfo I2;
2057231c996SBrett Wilson I2.Name = "SomethingElse";
2067231c996SBrett Wilson I2.IsUsing = false;
2077231c996SBrett Wilson I2.Underlying = TypeInfo("int");
2087231c996SBrett Wilson
2097231c996SBrett Wilson WriteResult = writeInfo(&I2);
2107231c996SBrett Wilson EXPECT_TRUE(WriteResult.size() > 0);
2117231c996SBrett Wilson ReadResults = readInfo(WriteResult, 1);
2127231c996SBrett Wilson CheckTypedefInfo(&I2, InfoAsTypedef(ReadResults[0].get()));
21321fb70c6SBrett Wilson }
21421fb70c6SBrett Wilson
TEST(SerializeTest,emitInfoWithCommentBitcode)215f276624eSJulie Hockett TEST(SerializeTest, emitInfoWithCommentBitcode) {
216f276624eSJulie Hockett FunctionInfo F;
217f276624eSJulie Hockett F.Name = "F";
2180afc6085SBrett Wilson F.ReturnType = TypeInfo("void");
219f276624eSJulie Hockett F.DefLoc = Location(0, llvm::SmallString<16>{"test.cpp"});
2200afc6085SBrett Wilson F.Params.emplace_back(TypeInfo("int"), "I");
221f276624eSJulie Hockett
222f276624eSJulie Hockett CommentInfo Top;
223f276624eSJulie Hockett Top.Kind = "FullComment";
224f276624eSJulie Hockett
2251c705d9cSJonas Devlieghere Top.Children.emplace_back(std::make_unique<CommentInfo>());
226f276624eSJulie Hockett CommentInfo *BlankLine = Top.Children.back().get();
227f276624eSJulie Hockett BlankLine->Kind = "ParagraphComment";
2281c705d9cSJonas Devlieghere BlankLine->Children.emplace_back(std::make_unique<CommentInfo>());
229f276624eSJulie Hockett BlankLine->Children.back()->Kind = "TextComment";
230f276624eSJulie Hockett
2311c705d9cSJonas Devlieghere Top.Children.emplace_back(std::make_unique<CommentInfo>());
232f276624eSJulie Hockett CommentInfo *Brief = Top.Children.back().get();
233f276624eSJulie Hockett Brief->Kind = "ParagraphComment";
2341c705d9cSJonas Devlieghere Brief->Children.emplace_back(std::make_unique<CommentInfo>());
235f276624eSJulie Hockett Brief->Children.back()->Kind = "TextComment";
236f276624eSJulie Hockett Brief->Children.back()->Name = "ParagraphComment";
237f276624eSJulie Hockett Brief->Children.back()->Text = " Brief description.";
238f276624eSJulie Hockett
2391c705d9cSJonas Devlieghere Top.Children.emplace_back(std::make_unique<CommentInfo>());
240f276624eSJulie Hockett CommentInfo *Extended = Top.Children.back().get();
241f276624eSJulie Hockett Extended->Kind = "ParagraphComment";
2421c705d9cSJonas Devlieghere Extended->Children.emplace_back(std::make_unique<CommentInfo>());
243f276624eSJulie Hockett Extended->Children.back()->Kind = "TextComment";
244f276624eSJulie Hockett Extended->Children.back()->Text = " Extended description that";
2451c705d9cSJonas Devlieghere Extended->Children.emplace_back(std::make_unique<CommentInfo>());
246f276624eSJulie Hockett Extended->Children.back()->Kind = "TextComment";
247f276624eSJulie Hockett Extended->Children.back()->Text = " continues onto the next line.";
248f276624eSJulie Hockett
2491c705d9cSJonas Devlieghere Top.Children.emplace_back(std::make_unique<CommentInfo>());
250f276624eSJulie Hockett CommentInfo *HTML = Top.Children.back().get();
251f276624eSJulie Hockett HTML->Kind = "ParagraphComment";
2521c705d9cSJonas Devlieghere HTML->Children.emplace_back(std::make_unique<CommentInfo>());
253f276624eSJulie Hockett HTML->Children.back()->Kind = "TextComment";
2541c705d9cSJonas Devlieghere HTML->Children.emplace_back(std::make_unique<CommentInfo>());
255f276624eSJulie Hockett HTML->Children.back()->Kind = "HTMLStartTagComment";
256f276624eSJulie Hockett HTML->Children.back()->Name = "ul";
257f276624eSJulie Hockett HTML->Children.back()->AttrKeys.emplace_back("class");
258f276624eSJulie Hockett HTML->Children.back()->AttrValues.emplace_back("test");
2591c705d9cSJonas Devlieghere HTML->Children.emplace_back(std::make_unique<CommentInfo>());
260f276624eSJulie Hockett HTML->Children.back()->Kind = "HTMLStartTagComment";
261f276624eSJulie Hockett HTML->Children.back()->Name = "li";
2621c705d9cSJonas Devlieghere HTML->Children.emplace_back(std::make_unique<CommentInfo>());
263f276624eSJulie Hockett HTML->Children.back()->Kind = "TextComment";
264f276624eSJulie Hockett HTML->Children.back()->Text = " Testing.";
2651c705d9cSJonas Devlieghere HTML->Children.emplace_back(std::make_unique<CommentInfo>());
266f276624eSJulie Hockett HTML->Children.back()->Kind = "HTMLEndTagComment";
267f276624eSJulie Hockett HTML->Children.back()->Name = "ul";
268f276624eSJulie Hockett HTML->Children.back()->SelfClosing = true;
269f276624eSJulie Hockett
2701c705d9cSJonas Devlieghere Top.Children.emplace_back(std::make_unique<CommentInfo>());
271f276624eSJulie Hockett CommentInfo *Verbatim = Top.Children.back().get();
272f276624eSJulie Hockett Verbatim->Kind = "VerbatimBlockComment";
273f276624eSJulie Hockett Verbatim->Name = "verbatim";
274f276624eSJulie Hockett Verbatim->CloseName = "endverbatim";
2751c705d9cSJonas Devlieghere Verbatim->Children.emplace_back(std::make_unique<CommentInfo>());
276f276624eSJulie Hockett Verbatim->Children.back()->Kind = "VerbatimBlockLineComment";
277f276624eSJulie Hockett Verbatim->Children.back()->Text = " The description continues.";
278f276624eSJulie Hockett
2791c705d9cSJonas Devlieghere Top.Children.emplace_back(std::make_unique<CommentInfo>());
280f276624eSJulie Hockett CommentInfo *ParamOut = Top.Children.back().get();
281f276624eSJulie Hockett ParamOut->Kind = "ParamCommandComment";
282f276624eSJulie Hockett ParamOut->Direction = "[out]";
283f276624eSJulie Hockett ParamOut->ParamName = "I";
284f276624eSJulie Hockett ParamOut->Explicit = true;
2851c705d9cSJonas Devlieghere ParamOut->Children.emplace_back(std::make_unique<CommentInfo>());
286f276624eSJulie Hockett ParamOut->Children.back()->Kind = "ParagraphComment";
287f276624eSJulie Hockett ParamOut->Children.back()->Children.emplace_back(
2881c705d9cSJonas Devlieghere std::make_unique<CommentInfo>());
289f276624eSJulie Hockett ParamOut->Children.back()->Children.back()->Kind = "TextComment";
290f276624eSJulie Hockett ParamOut->Children.back()->Children.emplace_back(
2911c705d9cSJonas Devlieghere std::make_unique<CommentInfo>());
292f276624eSJulie Hockett ParamOut->Children.back()->Children.back()->Kind = "TextComment";
293f276624eSJulie Hockett ParamOut->Children.back()->Children.back()->Text = " is a parameter.";
294f276624eSJulie Hockett
2951c705d9cSJonas Devlieghere Top.Children.emplace_back(std::make_unique<CommentInfo>());
296f276624eSJulie Hockett CommentInfo *ParamIn = Top.Children.back().get();
297f276624eSJulie Hockett ParamIn->Kind = "ParamCommandComment";
298f276624eSJulie Hockett ParamIn->Direction = "[in]";
299f276624eSJulie Hockett ParamIn->ParamName = "J";
3001c705d9cSJonas Devlieghere ParamIn->Children.emplace_back(std::make_unique<CommentInfo>());
301f276624eSJulie Hockett ParamIn->Children.back()->Kind = "ParagraphComment";
302f276624eSJulie Hockett ParamIn->Children.back()->Children.emplace_back(
3031c705d9cSJonas Devlieghere std::make_unique<CommentInfo>());
304f276624eSJulie Hockett ParamIn->Children.back()->Children.back()->Kind = "TextComment";
305f276624eSJulie Hockett ParamIn->Children.back()->Children.back()->Text = " is a parameter.";
306f276624eSJulie Hockett ParamIn->Children.back()->Children.emplace_back(
3071c705d9cSJonas Devlieghere std::make_unique<CommentInfo>());
308f276624eSJulie Hockett ParamIn->Children.back()->Children.back()->Kind = "TextComment";
309f276624eSJulie Hockett
3101c705d9cSJonas Devlieghere Top.Children.emplace_back(std::make_unique<CommentInfo>());
311f276624eSJulie Hockett CommentInfo *Return = Top.Children.back().get();
312f276624eSJulie Hockett Return->Kind = "BlockCommandComment";
313f276624eSJulie Hockett Return->Name = "return";
314f276624eSJulie Hockett Return->Explicit = true;
3151c705d9cSJonas Devlieghere Return->Children.emplace_back(std::make_unique<CommentInfo>());
316f276624eSJulie Hockett Return->Children.back()->Kind = "ParagraphComment";
317f276624eSJulie Hockett Return->Children.back()->Children.emplace_back(
3181c705d9cSJonas Devlieghere std::make_unique<CommentInfo>());
319f276624eSJulie Hockett Return->Children.back()->Children.back()->Kind = "TextComment";
320f276624eSJulie Hockett Return->Children.back()->Children.back()->Text = "void";
321f276624eSJulie Hockett
322f276624eSJulie Hockett F.Description.emplace_back(std::move(Top));
323f276624eSJulie Hockett
324f276624eSJulie Hockett std::string WriteResult = writeInfo(&F);
325f276624eSJulie Hockett EXPECT_TRUE(WriteResult.size() > 0);
326f276624eSJulie Hockett std::vector<std::unique_ptr<Info>> ReadResults = readInfo(WriteResult, 1);
327f276624eSJulie Hockett
328f276624eSJulie Hockett CheckFunctionInfo(&F, InfoAsFunction(ReadResults[0].get()));
329f276624eSJulie Hockett }
330f276624eSJulie Hockett
331f276624eSJulie Hockett } // namespace doc
332f276624eSJulie Hockett } // namespace clang
333