Skip to content

Commit b03cf78

Browse files
committed
tidy up javadoc code
1 parent d903a52 commit b03cf78

File tree

7 files changed

+28
-94
lines changed

7 files changed

+28
-94
lines changed

include/mrdox/meta/Javadoc.hpp

+8-42
Original file line numberDiff line numberDiff line change
@@ -284,11 +284,9 @@ struct Javadoc
284284

285285
/** Constructor
286286
*/
287+
explicit
287288
Javadoc(
288-
List<Block> blocks,
289-
List<Param> params,
290-
List<TParam> tparams,
291-
Returns returns);
289+
List<Block> blocks);
292290

293291
/** Return true if this is empty
294292
*/
@@ -314,28 +312,12 @@ struct Javadoc
314312
return blocks_;
315313
}
316314

317-
/** Return a paragraph describing the return value.
318-
*/
319-
Returns const&
320-
getReturns() const noexcept
321-
{
322-
return returns_;
323-
}
324-
325-
/** Return the list of param commands
326-
*/
327-
List<Param> const&
328-
getParams() const noexcept
329-
{
330-
return params_;
331-
}
332-
333-
/** Return the list of tparam commands
334-
*/
335-
List<TParam> const&
336-
getTParams() const noexcept
315+
// VFALCO This is unfortunately necessary for
316+
// the deserialization from bitcode...
317+
List<Block>&
318+
getBlocks() noexcept
337319
{
338-
return tparams_;
320+
return blocks_;
339321
}
340322

341323
//--------------------------------------------
@@ -423,32 +405,16 @@ struct Javadoc
423405

424406
/** Add a top level element to the doc comment.
425407
*/
426-
/** @{ */
427408
void append(Block node)
428409
{
429410
append(blocks_, std::move(node));
430411
}
431412

432-
void append(Param node)
433-
{
434-
append(params_, std::move(node));
435-
}
436-
437-
void append(TParam node)
438-
{
439-
append(tparams_, std::move(node));
440-
}
441-
/** @} */
442-
443413
//--------------------------------------------
444414

445-
//private:
446-
public: // VFALCO sigh...
415+
private:
447416
std::shared_ptr<Paragraph const> brief_;
448417
List<Block> blocks_;
449-
List<Param> params_;
450-
List<TParam> tparams_;
451-
std::shared_ptr<Returns const> returns_ptr_;
452418
Returns returns_;
453419
};
454420

source/lib/ast/BitcodeReader.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,7 @@ readSubBlock(
800800
return err;
801801
if(! J.isTopLevel())
802802
return J.spliceIntoParent();
803-
return J.spliceInto(javadoc_->blocks_);
803+
return J.spliceInto(javadoc_->getBlocks());
804804
}
805805

806806
case BI_JAVADOC_NODE_BLOCK_ID:

source/lib/ast/ParseJavadoc.cpp

+1-23
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,7 @@ class JavadocVisitor
152152
{
153153
visit(FC_);
154154

155-
return Javadoc(
156-
std::move(blocks_),
157-
std::move(params_),
158-
std::move(tparams_),
159-
std::move(returns_));
155+
return Javadoc(std::move(blocks_));
160156
}
161157

162158
void visitComment(
@@ -660,24 +656,6 @@ dumpJavadoc(
660656
if(! jd.getBlocks().empty())
661657
dump(os, jd.getBlocks());
662658

663-
if(! jd.getReturns().empty())
664-
{
665-
os << " @returns ";
666-
dump(os, jd.getReturns());
667-
}
668-
669-
if(! jd.getParams().empty())
670-
{
671-
os << '\n';
672-
dump(os, jd.getParams());
673-
}
674-
675-
if(! jd.getTParams().empty())
676-
{
677-
os << '\n';
678-
dump(os, jd.getTParams());
679-
}
680-
681659
os <<
682660
"*/\n"
683661
"\n\n";

source/lib/format/xml/XML.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -499,9 +499,6 @@ writeJavadoc(Javadoc const& jd)
499499
if(auto brief = jd.getBrief())
500500
writeBrief(brief);
501501
writeNodes(jd.getBlocks());
502-
writeReturns(jd.getReturns());
503-
writeNodes(jd.getParams());
504-
writeNodes(jd.getTParams());
505502
closeTag("doc");
506503
}
507504

source/lib/meta/Javadoc.cpp

+4-25
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
//
1111

1212
#include <mrdox/meta/Javadoc.hpp>
13-
#include <mrdox/meta/Namespace.hpp>
14-
#include <mrdox/Config.hpp>
1513
#include <llvm/Support/Error.h>
1614
#include <llvm/Support/Path.h>
1715

@@ -36,26 +34,17 @@ static_assert(a_Node<Javadoc::Code>);
3634

3735
Javadoc::
3836
Javadoc(
39-
List<Block> blocks,
40-
List<Param> params,
41-
List<TParam> tparams,
42-
Returns returns)
37+
List<Block> blocks)
4338
: blocks_(std::move(blocks))
44-
, params_(std::move(params))
45-
, tparams_(std::move(tparams))
46-
, returns_(std::move(returns))
4739
{
4840
}
4941

5042
bool
5143
Javadoc::
5244
empty() const noexcept
5345
{
54-
if( (! brief_) &&
55-
blocks_.empty() &&
56-
params_.empty() &&
57-
tparams_.empty() &&
58-
returns_.empty())
46+
if( ! brief_ &&
47+
blocks_.empty())
5948
{
6049
return true;
6150
}
@@ -67,11 +56,7 @@ Javadoc::
6756
operator==(
6857
Javadoc const& other) const noexcept
6958
{
70-
return
71-
blocks_ == other.blocks_ &&
72-
params_ == other.params_ &&
73-
tparams_ == other.tparams_ &&
74-
returns_ == other.returns_;
59+
return blocks_ == other.blocks_;
7560
}
7661

7762
bool
@@ -89,13 +74,7 @@ merge(Javadoc&& other)
8974
// Unconditionally extend the blocks
9075
// since each decl may have a comment.
9176
if(other != *this)
92-
{
9377
append(blocks_, std::move(other.blocks_));
94-
append(params_, std::move(other.params_));
95-
append(tparams_, std::move(other.tparams_));
96-
if( returns_.empty())
97-
returns_ = std::move(other.returns_);
98-
}
9978
}
10079

10180
auto

tests/decls/record-access.xml

+12
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,24 @@
44
<symbols>
55
<symbol name="" tag="namespace"/>
66
<symbol name="C0" tag="class" id="sTaqkoFcVbtntbfpe777v5/pWL0="/>
7+
<symbol name="C0::f0" tag="function" id="IdInRLjINkaIuyTqWyEUhoM1DZM="/>
78
<symbol name="C0::f1" tag="function" id="EyRDT2mXtRNmcISD2rsC6/mLusw="/>
89
<symbol name="C0::f2" tag="function" id="ZOAAp99eH9zKUZqx0JzW6AuhRTQ="/>
910
<symbol name="S0" tag="struct" id="u38+snleg17KL7EQuD9FV1Z8b9E="/>
1011
<symbol name="S0::f0" tag="function" id="STTnU4grbgOl2xPE6okWC57zruc="/>
1112
<symbol name="S0::f1" tag="function" id="IaPeEIwn9q94M3MuwxsB3qhBOSE="/>
13+
<symbol name="S0::f2" tag="function" id="QicvGhxlL09TrpXiFYAS+pz8/9g="/>
1214
<symbol name="U0" tag="union" id="SHIJWZPzfYtLVfe/rzFAmeVpANk="/>
1315
<symbol name="U0::f0" tag="function" id="eY4R9etszWK2H42p4kWNm5XfpnE="/>
1416
<symbol name="U0::f1" tag="function" id="KjiG7Uufpmd65dhiSV+Jv2RjgHA="/>
17+
<symbol name="U0::f2" tag="function" id="KXASSTkImsSKBg6l0hOSkbt1K7M="/>
1518
</symbols>
1619
<namespace name="">
1720
<class name="C0" id="sTaqkoFcVbtntbfpe777v5/pWL0=">
1821
<file path="record-access.cpp" line="12" class="def"/>
22+
<function name="f0" access="private" id="IdInRLjINkaIuyTqWyEUhoM1DZM=">
23+
<file path="record-access.cpp" line="14"/>
24+
</function>
1925
<function name="f1" access="protected" id="EyRDT2mXtRNmcISD2rsC6/mLusw=">
2026
<file path="record-access.cpp" line="16"/>
2127
</function>
@@ -31,6 +37,9 @@
3137
<function name="f1" access="protected" id="IaPeEIwn9q94M3MuwxsB3qhBOSE=">
3238
<file path="record-access.cpp" line="7"/>
3339
</function>
40+
<function name="f2" access="private" id="QicvGhxlL09TrpXiFYAS+pz8/9g=">
41+
<file path="record-access.cpp" line="9"/>
42+
</function>
3443
</struct>
3544
<union name="U0" id="SHIJWZPzfYtLVfe/rzFAmeVpANk=">
3645
<file path="record-access.cpp" line="21" class="def"/>
@@ -40,6 +49,9 @@
4049
<function name="f1" access="protected" id="KjiG7Uufpmd65dhiSV+Jv2RjgHA=">
4150
<file path="record-access.cpp" line="25"/>
4251
</function>
52+
<function name="f2" access="private" id="KXASSTkImsSKBg6l0hOSkbt1K7M=">
53+
<file path="record-access.cpp" line="27"/>
54+
</function>
4355
</union>
4456
</namespace>
4557
</mrdox>

tests/decls/record-data.xml

+2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
</struct>
2121
<class name="V" id="9kzYwt0WPztMEDUaFxul1Jvqqs8=">
2222
<file path="record-data.cpp" line="14" class="def"/>
23+
<data name="i" type="int" access="private"/>
2324
<data name="j" type="unsigned long" access="protected"/>
25+
<data name="k" type="double" access="private"/>
2426
</class>
2527
<struct name="W" id="6OhcFM3BV6KlrvmfpsljaMHxpdA=">
2628
<file path="record-data.cpp" line="23" class="def"/>

0 commit comments

Comments
 (0)