File tree 10 files changed +25
-23
lines changed
10 files changed +25
-23
lines changed Original file line number Diff line number Diff line change 19
19
#include < llvm/ADT/StringRef.h>
20
20
#include < llvm/ADT/SmallVector.h>
21
21
#include < array>
22
- #include < optional >
22
+ #include < memory >
23
23
#include < string>
24
24
#include < vector>
25
25
@@ -48,7 +48,7 @@ struct Info
48
48
49
49
/* * The extracted javadoc for this declaration.
50
50
*/
51
- std::optional <Javadoc> javadoc;
51
+ std::unique_ptr <Javadoc> javadoc;
52
52
53
53
// --------------------------------------------
54
54
Original file line number Diff line number Diff line change @@ -578,9 +578,9 @@ writeTemplate(
578
578
void
579
579
XMLWriter::
580
580
writeJavadoc (
581
- std::optional <Javadoc> const & javadoc)
581
+ std::unique_ptr <Javadoc> const & javadoc)
582
582
{
583
- if (! javadoc. has_value () )
583
+ if (! javadoc)
584
584
return ;
585
585
tags_.open (javadocTagName);
586
586
if (auto brief = javadoc->getBrief ())
Original file line number Diff line number Diff line change @@ -84,7 +84,7 @@ class XMLWriter
84
84
void writeInfo (Info const &);
85
85
void writeSymbol (SymbolInfo const & I);
86
86
void writeLocation (Location const & loc, bool def = false );
87
- void writeJavadoc (std::optional <Javadoc> const & javadoc);
87
+ void writeJavadoc (std::unique_ptr <Javadoc> const & javadoc);
88
88
void writeTemplate (const TemplateInfo& I);
89
89
90
90
template <class T >
Original file line number Diff line number Diff line change @@ -529,10 +529,10 @@ writeNestedTypes(
529
529
void
530
530
AdocWriter::
531
531
writeBrief (
532
- std::optional <Javadoc> const & javadoc,
532
+ std::unique_ptr <Javadoc> const & javadoc,
533
533
bool withNewline)
534
534
{
535
- if (! javadoc. has_value () )
535
+ if (! javadoc)
536
536
return ;
537
537
auto const node = javadoc->getBrief ();
538
538
if (! node)
@@ -547,9 +547,9 @@ writeBrief(
547
547
void
548
548
AdocWriter::
549
549
writeDescription (
550
- std::optional <Javadoc> const & javadoc)
550
+ std::unique_ptr <Javadoc> const & javadoc)
551
551
{
552
- if (! javadoc. has_value () )
552
+ if (! javadoc)
553
553
return ;
554
554
555
555
// os_ << '\n';
Original file line number Diff line number Diff line change @@ -109,10 +109,10 @@ class AdocWriter
109
109
FunctionInfo const & I);
110
110
111
111
void writeBrief (
112
- std::optional <Javadoc> const & javadoc,
112
+ std::unique_ptr <Javadoc> const & javadoc,
113
113
bool withNewline = true );
114
114
void writeDescription (
115
- std::optional <Javadoc> const & javadoc);
115
+ std::unique_ptr <Javadoc> const & javadoc);
116
116
void writeLocation (SymbolInfo const & I);
117
117
118
118
template <class T >
Original file line number Diff line number Diff line change @@ -517,7 +517,7 @@ applyDecayToParameters(
517
517
void
518
518
ASTVisitor::
519
519
parseRawComment (
520
- std::optional <Javadoc>& javadoc,
520
+ std::unique_ptr <Javadoc>& javadoc,
521
521
Decl const * D,
522
522
Reporter& R)
523
523
{
@@ -528,7 +528,8 @@ parseRawComment(
528
528
if (RC)
529
529
{
530
530
RC->setAttached ();
531
- javadoc.emplace (parseJavadoc (RC, D, R));
531
+ javadoc = std::make_unique<Javadoc>(
532
+ parseJavadoc (RC, D, R));
532
533
}
533
534
else
534
535
{
Original file line number Diff line number Diff line change @@ -176,7 +176,7 @@ class ASTVisitor
176
176
177
177
void
178
178
parseRawComment (
179
- std::optional <Javadoc>& javadoc,
179
+ std::unique_ptr <Javadoc>& javadoc,
180
180
Decl const * D,
181
181
Reporter& R);
182
182
Original file line number Diff line number Diff line change @@ -254,19 +254,19 @@ class JavadocBlock
254
254
: public BitcodeReader::AnyBlock
255
255
{
256
256
BitcodeReader& br_;
257
- std::optional <Javadoc>& I_;
257
+ std::unique_ptr <Javadoc>& I_;
258
258
AnyNodeList* stack_ = nullptr ;
259
259
AnyNodeList J_;
260
260
261
261
public:
262
262
JavadocBlock (
263
- std::optional <Javadoc>& I,
263
+ std::unique_ptr <Javadoc>& I,
264
264
BitcodeReader& br) noexcept
265
265
: br_(br)
266
266
, I_(I)
267
267
, J_(stack_)
268
268
{
269
- I_. emplace ();
269
+ I_ = std::make_unique<Javadoc> ();
270
270
}
271
271
272
272
llvm::Error
Original file line number Diff line number Diff line change @@ -747,8 +747,7 @@ emitInfoPart(
747
747
StreamSubBlockGuard Block (Stream, BI_INFO_PART_ID);
748
748
emitRecord (I.id , INFO_PART_ID);
749
749
emitRecord (I.Name , INFO_PART_NAME);
750
- if (I.javadoc )
751
- emitBlock (*I.javadoc );
750
+ emitBlock (I.javadoc );
752
751
for (const auto & N : I.Namespace )
753
752
emitBlock (N, FieldId::F_namespace);
754
753
}
@@ -849,12 +848,14 @@ emitBlock(
849
848
void
850
849
BitcodeWriter::
851
850
emitBlock (
852
- Javadoc const & jd)
851
+ std::unique_ptr< Javadoc> const & jd)
853
852
{
854
- // If the optional<Javadoc> has a value then we
853
+ if (! jd)
854
+ return ;
855
+ // If the unique_ptr<Javadoc> has a value then we
855
856
// always want to emit it, even if it is empty.
856
857
StreamSubBlockGuard Block (Stream, BI_JAVADOC_BLOCK_ID);
857
- emitBlock (jd. getBlocks ());
858
+ emitBlock (jd-> getBlocks ());
858
859
}
859
860
860
861
void
Original file line number Diff line number Diff line change @@ -124,7 +124,7 @@ class BitcodeWriter
124
124
void emitBlock (EnumValueInfo const & I);
125
125
void emitBlock (FunctionInfo const & I);
126
126
void emitBlock (Param const & I);
127
- void emitBlock (Javadoc const & jd);
127
+ void emitBlock (std::unique_ptr< Javadoc> const & jd);
128
128
void emitBlock (Javadoc::Node const & I);
129
129
void emitBlock (NamespaceInfo const & I);
130
130
void emitBlock (RecordInfo const & I);
You can’t perform that action at this time.
0 commit comments