Skip to content

Commit 55c1a94

Browse files
committed
replace use of deprecated llvm::Optional with std::optional
1 parent 78ec84f commit 55c1a94

19 files changed

+52
-52
lines changed

include/mrdox/Metadata/Enum.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
#include <mrdox/Platform.hpp>
1616
#include <mrdox/Metadata/Symbol.hpp>
1717
#include <mrdox/Metadata/Type.hpp>
18-
#include <llvm/ADT/Optional.h>
1918
#include <llvm/ADT/SmallString.h>
2019
#include <llvm/ADT/SmallVector.h>
2120
#include <llvm/ADT/StringRef.h>
21+
#include <optional>
2222
#include <utility>
2323

2424
namespace clang {
@@ -74,7 +74,7 @@ struct EnumInfo : SymbolInfo
7474
// Set to nonempty to the type when this is an explicitly typed enum. For
7575
// enum Foo : short { ... };
7676
// this will be "short".
77-
llvm::Optional<TypeInfo> BaseType;
77+
std::optional<TypeInfo> BaseType;
7878

7979
llvm::SmallVector<EnumValueInfo, 4> Members; // List of enum members.
8080

include/mrdox/Metadata/Function.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
#include <mrdox/Metadata/Symbols.hpp>
2222
#include <mrdox/Metadata/Template.hpp>
2323
#include <clang/Basic/Specifiers.h>
24-
#include <llvm/ADT/Optional.h>
2524
#include <llvm/ADT/SmallString.h>
2625
#include <llvm/ADT/SmallVector.h>
2726
#include <clang/AST/Attr.h>
27+
#include <optional>
2828
#include <vector>
2929

3030
namespace clang {
@@ -106,7 +106,7 @@ struct FunctionInfo : SymbolInfo
106106
std::vector<Param> Params; // List of parameters.
107107

108108
// When present, this function is a template or specialization.
109-
llvm::Optional<TemplateInfo> Template;
109+
std::optional<TemplateInfo> Template;
110110

111111
FnFlags0 specs0{.raw{0}};
112112
FnFlags1 specs1{.raw{0}};

include/mrdox/Metadata/Info.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616
#include <mrdox/Metadata/Javadoc.hpp>
1717
#include <mrdox/Metadata/Reference.hpp>
1818
#include <mrdox/Metadata/Symbols.hpp>
19-
#include <llvm/ADT/Optional.h>
2019
#include <llvm/ADT/StringRef.h>
2120
#include <llvm/ADT/SmallVector.h>
2221
#include <array>
23-
#include <vector>
22+
#include <optional>
2423
#include <string>
24+
#include <vector>
2525

2626
namespace clang {
2727
namespace mrdox {
@@ -48,7 +48,7 @@ struct Info
4848

4949
/** The extracted javadoc for this declaration.
5050
*/
51-
llvm::Optional<Javadoc> javadoc;
51+
std::optional<Javadoc> javadoc;
5252

5353
//--------------------------------------------
5454

include/mrdox/Metadata/MemberType.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include <mrdox/Metadata/Javadoc.hpp>
1818
#include <mrdox/Metadata/FieldType.hpp>
1919
#include <mrdox/Metadata/Function.hpp>
20-
#include <llvm/ADT/Optional.h>
20+
#include <optional>
2121

2222
namespace clang {
2323
namespace mrdox {
@@ -30,12 +30,12 @@ struct MemberTypeInfo
3030
{
3131
Access access = Access::Public;
3232

33-
llvm::Optional<Javadoc> javadoc;
33+
std::optional<Javadoc> javadoc;
3434

3535
//--------------------------------------------
3636

3737
MemberTypeInfo() = default;
38-
38+
3939
MemberTypeInfo(
4040
TypeInfo const& TI,
4141
llvm::StringRef Name,

include/mrdox/Metadata/Record.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
#include <mrdox/Metadata/Template.hpp>
2323
#include <mrdox/Metadata/Symbols.hpp>
2424
#include <clang/AST/Type.h>
25-
#include <llvm/ADT/Optional.h>
2625
#include <llvm/ADT/SmallVector.h>
26+
#include <optional>
2727
#include <string>
2828
#include <string_view>
2929
#include <vector>
@@ -83,7 +83,7 @@ struct RecordInfo : SymbolInfo
8383
TagTypeKind TagType = TagTypeKind::TTK_Struct;
8484

8585
// When present, this record is a template or specialization.
86-
llvm::Optional<TemplateInfo> Template;
86+
std::optional<TemplateInfo> Template;
8787

8888
// Indicates if the record was declared using a typedef. Things like anonymous
8989
// structs in a typedef:

include/mrdox/Metadata/Symbol.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
#include <mrdox/Platform.hpp>
1616
#include <mrdox/Metadata/Info.hpp>
1717
#include <mrdox/Metadata/Location.hpp>
18-
#include <llvm/ADT/Optional.h>
1918
#include <llvm/ADT/SmallVector.h>
19+
#include <optional>
2020

2121
namespace clang {
2222
namespace mrdox {
@@ -25,7 +25,7 @@ namespace mrdox {
2525
*/
2626
struct SymbolInfo : Info
2727
{
28-
llvm::Optional<Location> DefLoc; // Location where this decl is defined.
28+
std::optional<Location> DefLoc; // Location where this decl is defined.
2929
llvm::SmallVector<Location, 2> Loc; // Locations where this decl is declared.
3030

3131
//--------------------------------------------

source/-XML/XMLGenerator.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include <mrdox/Generator.hpp>
1717
#include <mrdox/MetadataFwd.hpp>
1818
#include <mrdox/Metadata/Javadoc.hpp>
19-
#include <llvm/ADT/Optional.h>
19+
#include <optional>
2020

2121
namespace clang {
2222
namespace mrdox {

source/-XML/XMLTags.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
#include <mrdox/Metadata/Symbols.hpp>
1919
#include <mrdox/Metadata/Type.hpp>
2020
#include <clang/Basic/Specifiers.h>
21-
#include <llvm/ADT/Optional.h>
2221
#include <llvm/ADT/StringRef.h>
2322
#include <llvm/Support/raw_ostream.h>
23+
#include <optional>
2424

2525
/*
2626
Object for assisting with generating
@@ -146,7 +146,7 @@ struct Attribute
146146
}
147147

148148
Attribute(
149-
llvm::Optional<TypeInfo> const& opt)
149+
std::optional<TypeInfo> const& opt)
150150
: name("type")
151151
, value(opt ? opt->Type.Name.str() : std::string())
152152
, pred(opt)

source/-XML/XMLWriter.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ writeMemberType(
534534

535535
//------------------------------------------------
536536

537-
void
537+
void
538538
XMLWriter::
539539
writeTemplate(
540540
const std::optional<TemplateInfo>& I)
@@ -560,7 +560,7 @@ writeTemplate(
560560
tags_.open(templateTagName, {
561561
{"class", spec, !! spec},
562562
{id}
563-
});
563+
});
564564

565565
for(const TParam& tparam : I->Params)
566566
writeTemplateParam(tparam, tags_);
@@ -575,7 +575,7 @@ writeTemplate(
575575
void
576576
XMLWriter::
577577
writeJavadoc(
578-
llvm::Optional<Javadoc> const& javadoc)
578+
std::optional<Javadoc> const& javadoc)
579579
{
580580
if(! javadoc.has_value())
581581
return;

source/-XML/XMLWriter.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ class XMLWriter
8484
void writeSymbol(SymbolInfo const& I);
8585
void writeLocation(Location const& loc, bool def = false);
8686
void writeMemberType(MemberTypeInfo const& I);
87-
void writeJavadoc(llvm::Optional<Javadoc> const& javadoc);
87+
void writeJavadoc(std::optional<Javadoc> const& javadoc);
8888
void writeTemplate(const std::optional<TemplateInfo>& I);
89-
89+
9090
template<class T>
9191
void writeNodes(AnyList<T> const& list);
9292
void writeNode(Javadoc::Node const& node);

0 commit comments

Comments
 (0)