Skip to content

Commit 9e4657d

Browse files
committed
remove old comment visitor
1 parent ed8326c commit 9e4657d

10 files changed

+24
-678
lines changed

source/lib/ast/BitcodeIDs.hpp

-12
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ enum BlockId
5959
BI_BASE_RECORD_BLOCK_ID,
6060
BI_FUNCTION_BLOCK_ID,
6161
BI_JAVADOC_BLOCK_ID,
62-
BI_COMMENT_BLOCK_ID,
6362
BI_REFERENCE_BLOCK_ID,
6463
BI_TEMPLATE_BLOCK_ID,
6564
BI_TEMPLATE_SPECIALIZATION_BLOCK_ID,
@@ -81,17 +80,6 @@ enum RecordId
8180
FUNCTION_ACCESS,
8281
FUNCTION_IS_METHOD,
8382
JAVADOC_NODE_KIND,
84-
COMMENT_KIND,
85-
COMMENT_TEXT,
86-
COMMENT_NAME,
87-
COMMENT_DIRECTION,
88-
COMMENT_PARAMNAME,
89-
COMMENT_CLOSENAME,
90-
COMMENT_SELFCLOSING,
91-
COMMENT_EXPLICIT,
92-
COMMENT_ATTRKEY,
93-
COMMENT_ATTRVAL,
94-
COMMENT_ARG,
9583
FIELD_TYPE_NAME,
9684
FIELD_DEFAULT_VALUE,
9785
MEMBER_TYPE_NAME,

source/lib/ast/BitcodeReader.cpp

-87
Original file line numberDiff line numberDiff line change
@@ -226,44 +226,6 @@ getJavadoc(MemberTypeInfo* I)
226226

227227
//------------------------------------------------
228228

229-
template <typename T> llvm::Expected<CommentInfo*> getCommentInfo(T I) {
230-
return makeError("invalid type cannot contain CommentInfo");
231-
}
232-
233-
template<> llvm::Expected<CommentInfo*> getCommentInfo(FunctionInfo* I) {
234-
return &I->Description.emplace_back();
235-
}
236-
237-
template<> llvm::Expected<CommentInfo*> getCommentInfo(NamespaceInfo* I) {
238-
return &I->Description.emplace_back();
239-
}
240-
241-
template<> llvm::Expected<CommentInfo*> getCommentInfo(RecordInfo* I) {
242-
return &I->Description.emplace_back();
243-
}
244-
245-
template<> llvm::Expected<CommentInfo*> getCommentInfo(MemberTypeInfo* I) {
246-
return &I->Description.emplace_back();
247-
}
248-
249-
template<> llvm::Expected<CommentInfo*> getCommentInfo(EnumInfo* I) {
250-
return &I->Description.emplace_back();
251-
}
252-
253-
template<> llvm::Expected<CommentInfo*> getCommentInfo(TypedefInfo* I) {
254-
return &I->Description.emplace_back();
255-
}
256-
257-
template<> llvm::Expected<CommentInfo*> getCommentInfo(CommentInfo* I) {
258-
I->Children.emplace_back(std::make_unique<CommentInfo>());
259-
return I->Children.back().get();
260-
}
261-
262-
template<>
263-
llvm::Expected<CommentInfo*> getCommentInfo(std::unique_ptr<CommentInfo>& I) {
264-
return getCommentInfo(I.get());
265-
}
266-
267229
// When readSubBlock encounters a TypeInfo sub-block, it calls addTypeInfo on
268230
// the parent block to set it. The template specializations define what to do
269231
// for each supported parent block.
@@ -708,8 +670,6 @@ class BitcodeReader
708670
llvm::StringRef Blob, FieldTypeInfo* I);
709671
llvm::Error parseRecord(Record const& R, unsigned ID,
710672
llvm::StringRef Blob, MemberTypeInfo* I);
711-
llvm::Error parseRecord(const Record& R, unsigned ID,
712-
llvm::StringRef Blob, CommentInfo* I);
713673
llvm::Error parseRecord(const Record& R, unsigned ID,
714674
llvm::StringRef Blob, Reference* I, FieldId& F);
715675
llvm::Error parseRecord(const Record& R, unsigned ID,
@@ -786,7 +746,6 @@ getInfos()
786746
case BI_FIELD_TYPE_BLOCK_ID:
787747
case BI_MEMBER_TYPE_BLOCK_ID:
788748
case BI_JAVADOC_BLOCK_ID:
789-
case BI_COMMENT_BLOCK_ID:
790749
case BI_REFERENCE_BLOCK_ID:
791750
return makeError("invalid top level block");
792751
case BI_NAMESPACE_BLOCK_ID:
@@ -954,15 +913,6 @@ readSubBlock(
954913
return llvm::Error::success();
955914
}
956915

957-
case BI_COMMENT_BLOCK_ID:
958-
{
959-
auto Comment = getCommentInfo(I);
960-
if (!Comment)
961-
return Comment.takeError();
962-
if (auto Err = readBlock(ID, Comment.get()))
963-
return Err;
964-
return llvm::Error::success();
965-
}
966916
case BI_TYPE_BLOCK_ID:
967917
{
968918
TypeInfo TI;
@@ -1341,43 +1291,6 @@ parseRecord(
13411291
return llvm::Error::success();
13421292
}
13431293

1344-
llvm::Error
1345-
BitcodeReader::
1346-
parseRecord(
1347-
const Record& R,
1348-
unsigned ID,
1349-
llvm::StringRef Blob,
1350-
CommentInfo* I)
1351-
{
1352-
switch (ID)
1353-
{
1354-
case COMMENT_KIND:
1355-
return decodeRecord(R, I->Kind, Blob);
1356-
case COMMENT_TEXT:
1357-
return decodeRecord(R, I->Text, Blob);
1358-
case COMMENT_NAME:
1359-
return decodeRecord(R, I->Name, Blob);
1360-
case COMMENT_DIRECTION:
1361-
return decodeRecord(R, I->Direction, Blob);
1362-
case COMMENT_PARAMNAME:
1363-
return decodeRecord(R, I->ParamName, Blob);
1364-
case COMMENT_CLOSENAME:
1365-
return decodeRecord(R, I->CloseName, Blob);
1366-
case COMMENT_ATTRKEY:
1367-
return decodeRecord(R, I->AttrKeys, Blob);
1368-
case COMMENT_ATTRVAL:
1369-
return decodeRecord(R, I->AttrValues, Blob);
1370-
case COMMENT_ARG:
1371-
return decodeRecord(R, I->Args, Blob);
1372-
case COMMENT_SELFCLOSING:
1373-
return decodeRecord(R, I->SelfClosing, Blob);
1374-
case COMMENT_EXPLICIT:
1375-
return decodeRecord(R, I->Explicit, Blob);
1376-
default:
1377-
return makeError("invalid field for CommentInfo");
1378-
}
1379-
}
1380-
13811294
llvm::Error
13821295
BitcodeReader::
13831296
parseRecord(

source/lib/ast/BitcodeWriter.cpp

-58
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ BlockIdNameMap = []()
160160
{BI_BASE_RECORD_BLOCK_ID, "BaseRecordBlock"},
161161
{BI_FUNCTION_BLOCK_ID, "FunctionBlock"},
162162
{BI_JAVADOC_BLOCK_ID, "JavadocBlock"},
163-
{BI_COMMENT_BLOCK_ID, "CommentBlock"},
164163
{BI_REFERENCE_BLOCK_ID, "ReferenceBlock"},
165164
{BI_TEMPLATE_BLOCK_ID, "TemplateBlock"},
166165
{BI_TEMPLATE_SPECIALIZATION_BLOCK_ID, "TemplateSpecializationBlock"},
@@ -184,17 +183,6 @@ RecordIdNameMap = []()
184183
static const std::vector<std::pair<RecordId, RecordIdDsc>> Inits = {
185184
{VERSION, {"Version", &IntAbbrev}},
186185
{JAVADOC_NODE_KIND, {"NodeKind", &IntAbbrev}},
187-
{COMMENT_KIND, {"Kind", &StringAbbrev}},
188-
{COMMENT_TEXT, {"Text", &StringAbbrev}},
189-
{COMMENT_NAME, {"Name", &StringAbbrev}},
190-
{COMMENT_DIRECTION, {"Direction", &StringAbbrev}},
191-
{COMMENT_PARAMNAME, {"ParamName", &StringAbbrev}},
192-
{COMMENT_CLOSENAME, {"CloseName", &StringAbbrev}},
193-
{COMMENT_SELFCLOSING, {"SelfClosing", &BoolAbbrev}},
194-
{COMMENT_EXPLICIT, {"Explicit", &BoolAbbrev}},
195-
{COMMENT_ATTRKEY, {"AttrKey", &StringAbbrev}},
196-
{COMMENT_ATTRVAL, {"AttrVal", &StringAbbrev}},
197-
{COMMENT_ARG, {"Arg", &StringAbbrev}},
198186
{FIELD_TYPE_NAME, {"Name", &StringAbbrev}},
199187
{FIELD_DEFAULT_VALUE, {"DefaultValue", &StringAbbrev}},
200188
{MEMBER_TYPE_NAME, {"Name", &StringAbbrev}},
@@ -259,11 +247,6 @@ RecordsByBlock{
259247
// Javadoc Block
260248
{BI_JAVADOC_BLOCK_ID,
261249
{JAVADOC_NODE_KIND}},
262-
// Comment Block
263-
{BI_COMMENT_BLOCK_ID,
264-
{COMMENT_KIND, COMMENT_TEXT, COMMENT_NAME, COMMENT_DIRECTION,
265-
COMMENT_PARAMNAME, COMMENT_CLOSENAME, COMMENT_SELFCLOSING,
266-
COMMENT_EXPLICIT, COMMENT_ATTRKEY, COMMENT_ATTRVAL, COMMENT_ARG}},
267250
// Type Block
268251
{BI_TYPE_BLOCK_ID, {}},
269252
// <mrdox/FieldType.hpp> Block
@@ -618,8 +601,6 @@ emitBlock(
618601
for (const auto& N : I.Namespace)
619602
emitBlock(N, FieldId::F_namespace);
620603
emitBlock(I.javadoc);
621-
for (const auto& CI : I.Description)
622-
emitBlock(CI);
623604
for (const auto& C : I.Children.Namespaces)
624605
emitBlock(C, FieldId::F_child_namespace);
625606
for (const auto& C : I.Children.Records)
@@ -644,8 +625,6 @@ emitBlock(
644625
for (const auto& N : I.Namespace)
645626
emitBlock(N, FieldId::F_namespace);
646627
emitBlock(I.javadoc);
647-
for (const auto& CI : I.Description)
648-
emitBlock(CI);
649628
if (I.DefLoc)
650629
emitRecord(*I.DefLoc, RECORD_DEFLOCATION);
651630
for (const auto& L : I.Loc)
@@ -700,8 +679,6 @@ emitBlock(
700679
for (const auto& N : I.Namespace)
701680
emitBlock(N, FieldId::F_namespace);
702681
emitBlock(I.javadoc);
703-
for (const auto& CI : I.Description)
704-
emitBlock(CI);
705682
emitRecord(I.Access, FUNCTION_ACCESS);
706683
emitRecord(I.IsMethod, FUNCTION_IS_METHOD);
707684
if (I.DefLoc)
@@ -751,8 +728,6 @@ emitBlock(
751728
for (const auto& N : T.Namespace)
752729
emitBlock(N, FieldId::F_namespace);
753730
emitBlock(T.javadoc);
754-
for (const auto& CI : T.Description)
755-
emitBlock(CI);
756731
if (T.DefLoc)
757732
emitRecord(*T.DefLoc, TYPEDEF_DEFLOCATION);
758733
emitRecord(T.IsUsing, TYPEDEF_IS_USING);
@@ -780,8 +755,6 @@ emitBlock(
780755
emitRecord(T.Name, MEMBER_TYPE_NAME);
781756
emitRecord(T.Access, MEMBER_TYPE_ACCESS);
782757
emitBlock(T.javadoc);
783-
for (const auto& CI : T.Description)
784-
emitBlock(CI);
785758
}
786759

787760
void
@@ -855,35 +828,6 @@ emitBlock(List<T> const& list)
855828
}
856829
}
857830

858-
void
859-
BitcodeWriter::
860-
emitBlock(
861-
CommentInfo const& I)
862-
{
863-
StreamSubBlockGuard Block(Stream, BI_COMMENT_BLOCK_ID);
864-
for (auto const& L : std::vector<std::pair<
865-
llvm::StringRef, RecordId>>{
866-
{I.Kind, COMMENT_KIND},
867-
{I.Text, COMMENT_TEXT},
868-
{I.Name, COMMENT_NAME},
869-
{I.Direction, COMMENT_DIRECTION},
870-
{I.ParamName, COMMENT_PARAMNAME},
871-
{I.CloseName, COMMENT_CLOSENAME} })
872-
{
873-
emitRecord(L.first, L.second);
874-
}
875-
emitRecord(I.SelfClosing, COMMENT_SELFCLOSING);
876-
emitRecord(I.Explicit, COMMENT_EXPLICIT);
877-
for (const auto& A : I.AttrKeys)
878-
emitRecord(A, COMMENT_ATTRKEY);
879-
for (const auto& A : I.AttrValues)
880-
emitRecord(A, COMMENT_ATTRVAL);
881-
for (const auto& A : I.Args)
882-
emitRecord(A, COMMENT_ARG);
883-
for (const auto& C : I.Children)
884-
emitBlock(*C);
885-
}
886-
887831
void
888832
BitcodeWriter::
889833
emitBlock(
@@ -895,8 +839,6 @@ emitBlock(
895839
for (const auto& N : I.Namespace)
896840
emitBlock(N, FieldId::F_namespace);
897841
emitBlock(I.javadoc);
898-
for (const auto& CI : I.Description)
899-
emitBlock(CI);
900842
if (I.DefLoc)
901843
emitRecord(*I.DefLoc, ENUM_DEFLOCATION);
902844
for (const auto& L : I.Loc)

source/lib/ast/BitcodeWriter.hpp

-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ class BitcodeWriter
9595
void emitBlock(Javadoc const& jd);
9696
template<class T>
9797
void emitBlock(List<T> const& list);
98-
void emitBlock(CommentInfo const& B);
9998
void emitBlock(TemplateInfo const& T);
10099
void emitBlock(TemplateSpecializationInfo const& T);
101100
void emitBlock(TemplateParamInfo const& T);

0 commit comments

Comments
 (0)