Skip to content

Commit 0aaa4fa

Browse files
committed
bitcode work
1 parent d2da585 commit 0aaa4fa

File tree

9 files changed

+775
-531
lines changed

9 files changed

+775
-531
lines changed

include/mrdox/meta/Javadoc.hpp

Lines changed: 33 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -29,31 +29,33 @@ struct Javadoc
2929

3030
enum class Kind : int
3131
{
32-
text,
33-
styledText,
32+
text = 1, // needed by bitstream
33+
styled,
34+
block, // used by bitcodes
3435
paragraph,
3536
brief,
3637
admonition,
3738
code,
38-
returns,
3939
param,
40-
tparam
40+
tparam,
41+
returns
4142
};
4243

4344
/** A text style.
4445
*/
45-
enum class Style
46+
enum class Style : int
4647
{
47-
none,
48+
none = 1, // needed by bitstream
4849
mono,
4950
bold,
5051
italic
5152
};
5253

5354
/** An admonishment style.
5455
*/
55-
enum class Admonish
56+
enum class Admonish : int
5657
{
58+
none = 1, // needed by bitstream
5759
note,
5860
tip,
5961
important,
@@ -85,7 +87,7 @@ struct Javadoc
8587

8688
explicit
8789
Text(
88-
String text_)
90+
String text_ = String())
8991
: Node(Kind::text)
9092
, text(std::move(text_))
9193
{
@@ -110,9 +112,9 @@ struct Javadoc
110112
auto operator<=>(StyledText const&) const noexcept = default;
111113

112114
StyledText(
113-
String text,
114-
Style style_)
115-
: Text(std::move(text), Kind::styledText)
115+
String text = String(),
116+
Style style_ = Style::none)
117+
: Text(std::move(text), Kind::styled)
116118
, style(style_)
117119
{
118120
}
@@ -181,7 +183,8 @@ struct Javadoc
181183
auto operator<=>(Admonition const&) const noexcept = default;
182184

183185
explicit
184-
Admonition(Admonish style_)
186+
Admonition(
187+
Admonish style_ = Admonish::none)
185188
: Paragraph(Kind::admonition)
186189
, style(style_)
187190
{
@@ -203,18 +206,6 @@ struct Javadoc
203206
}
204207
};
205208

206-
/** Documentation for a function return type
207-
*/
208-
struct Returns : Paragraph
209-
{
210-
auto operator<=>(Returns const&) const noexcept = default;
211-
212-
Returns()
213-
: Paragraph(Kind::returns)
214-
{
215-
}
216-
};
217-
218209
/** Documentation for a function parameter
219210
*/
220211
struct Param : Block
@@ -225,8 +216,8 @@ struct Javadoc
225216
auto operator<=>(Param const&) const noexcept = default;
226217

227218
Param(
228-
String name_,
229-
Paragraph details_)
219+
String name_ = String(),
220+
Paragraph details_ = Paragraph())
230221
: Block(Kind::param)
231222
, name(std::move(name_))
232223
, details(std::move(details_))
@@ -244,15 +235,27 @@ struct Javadoc
244235
auto operator<=>(TParam const&) const noexcept = default;
245236

246237
TParam(
247-
String name_,
248-
Paragraph details_)
238+
String name_ = String(),
239+
Paragraph details_ = Paragraph())
249240
: Block(Kind::param)
250241
, name(std::move(name_))
251242
, details(std::move(details_))
252243
{
253244
}
254245
};
255246

247+
/** Documentation for a function return type
248+
*/
249+
struct Returns : Paragraph
250+
{
251+
auto operator<=>(Returns const&) const noexcept = default;
252+
253+
Returns()
254+
: Paragraph(Kind::returns)
255+
{
256+
}
257+
};
258+
256259
// VFALCO LEGACY
257260
llvm::SmallString<32> brief;
258261
std::string desc;
@@ -326,6 +329,8 @@ struct Javadoc
326329

327330
void merge(Javadoc& other);
328331

332+
bool dummy = false;
333+
329334
private:
330335
static Paragraph const s_empty_;
331336

include/mrdox/meta/List.hpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class List
8181
bool erase_first_of_if(Pred&& pred) noexcept;
8282

8383
template<class U>
84-
iterator emplace_back(U&& u);
84+
U& emplace_back(U&& u);
8585

8686
template<class U>
8787
void splice_back(List<U>& other);
@@ -210,7 +210,6 @@ struct List<T>::Item : Node
210210
return new Item(next, u_);
211211
}
212212

213-
private:
214213
U u_;
215214
};
216215

@@ -492,13 +491,13 @@ template<class U>
492491
auto
493492
List<T>::
494493
emplace_back(U&& u) ->
495-
iterator
494+
U&
496495
{
497496
static_assert(std::is_convertible_v<U*, T*>);
498497

499498
auto item = new Item<U>(&end_, std::forward<U>(u));
500499
append(item);
501-
return iterator(item);
500+
return item->u_;
502501
}
503502

504503
template<class T>

source/lib/ast/BitcodeIDs.hpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ struct BitCodeConstants
3636
static constexpr unsigned USRLengthSize = 6U;
3737
static constexpr unsigned USRBitLengthSize = 8U;
3838
static constexpr unsigned USRHashSize = 20;
39-
static constexpr unsigned JavadocKindSize = 1U;
4039
static constexpr unsigned char Signature[4] = {'D', 'O', 'C', 'S'};
4140
};
4241

@@ -59,6 +58,8 @@ enum BlockId
5958
BI_BASE_RECORD_BLOCK_ID,
6059
BI_FUNCTION_BLOCK_ID,
6160
BI_JAVADOC_BLOCK_ID,
61+
BI_JAVADOC_LIST_BLOCK_ID,
62+
BI_JAVADOC_NODE_BLOCK_ID,
6263
BI_REFERENCE_BLOCK_ID,
6364
BI_TEMPLATE_BLOCK_ID,
6465
BI_TEMPLATE_SPECIALIZATION_BLOCK_ID,
@@ -79,7 +80,12 @@ enum RecordId
7980
FUNCTION_LOCATION,
8081
FUNCTION_ACCESS,
8182
FUNCTION_IS_METHOD,
83+
JAVADOC_DUMMY,
84+
JAVADOC_LIST_KIND,
8285
JAVADOC_NODE_KIND,
86+
JAVADOC_NODE_STRING,
87+
JAVADOC_NODE_STYLE,
88+
JAVADOC_NODE_ADMONISH,
8389
FIELD_TYPE_NAME,
8490
FIELD_DEFAULT_VALUE,
8591
MEMBER_TYPE_NAME,

0 commit comments

Comments
 (0)