Skip to content

Commit 8fe719a

Browse files
committed
public interface does not use SmallString or SmallVector
1 parent e416156 commit 8fe719a

File tree

16 files changed

+57
-72
lines changed

16 files changed

+57
-72
lines changed

include/mrdox/Metadata/Enum.hpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,9 @@
1515
#include <mrdox/Platform.hpp>
1616
#include <mrdox/Metadata/Symbol.hpp>
1717
#include <mrdox/Metadata/Type.hpp>
18-
#include <llvm/ADT/SmallString.h>
19-
#include <llvm/ADT/SmallVector.h>
20-
#include <llvm/ADT/StringRef.h>
2118
#include <optional>
19+
#include <string>
20+
#include <string_view>
2221
#include <utility>
2322

2423
namespace clang {
@@ -28,24 +27,24 @@ namespace mrdox {
2827
// Information for a single possible value of an enumeration.
2928
struct EnumValueInfo
3029
{
31-
llvm::SmallString<16> Name;
30+
std::string Name;
3231

3332
// The computed value of the enumeration constant. This could be the result of
3433
// evaluating the ValueExpr, or it could be automatically generated according
3534
// to C rules.
36-
llvm::SmallString<16> Value;
35+
std::string Value;
3736

3837
// Stores the user-supplied initialization expression for this enumeration
3938
// constant. This will be empty for implicit enumeration values.
40-
llvm::SmallString<16> ValueExpr;
39+
std::string ValueExpr;
4140

4241
//--------------------------------------------
4342

4443
explicit
4544
EnumValueInfo(
46-
llvm::StringRef Name = llvm::StringRef(),
47-
llvm::StringRef Value = llvm::StringRef("0"),
48-
llvm::StringRef ValueExpr = llvm::StringRef())
45+
std::string_view Name = "",
46+
std::string_view Value = "0",
47+
std::string_view ValueExpr = "")
4948
: Name(Name)
5049
, Value(Value)
5150
, ValueExpr(ValueExpr)
@@ -78,16 +77,17 @@ struct EnumInfo
7877
// this will be "short".
7978
std::optional<TypeInfo> BaseType;
8079

81-
llvm::SmallVector<EnumValueInfo, 4> Members; // List of enum members.
80+
// Enumeration members.
81+
std::vector<EnumValueInfo> Members;
8282

8383
//--------------------------------------------
8484

8585
static constexpr InfoType type_id = InfoType::IT_enum;
8686

8787
explicit
8888
EnumInfo(
89-
SymbolID id = SymbolID::zero)
90-
: SymbolInfo(InfoType::IT_enum, id)
89+
SymbolID ID = SymbolID::zero)
90+
: SymbolInfo(InfoType::IT_enum, ID)
9191
{
9292
}
9393
};

include/mrdox/Metadata/Field.hpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#include <mrdox/Metadata/Symbol.hpp>
1919
#include <mrdox/Metadata/Type.hpp>
2020
#include <mrdox/ADT/BitField.hpp>
21-
#include <llvm/ADT/SmallString.h>
2221
#include <utility>
2322

2423
namespace clang {
@@ -60,9 +59,8 @@ struct FieldInfo
6059
static constexpr InfoType type_id = InfoType::IT_field;
6160

6261
FieldInfo(
63-
SymbolID ID = SymbolID::zero,
64-
llvm::StringRef Name = llvm::StringRef())
65-
: SymbolInfo(InfoType::IT_field, ID, Name)
62+
SymbolID ID = SymbolID::zero)
63+
: SymbolInfo(InfoType::IT_field, ID)
6664
{
6765
}
6866
};

include/mrdox/Metadata/Function.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ getFunctionKind(
9696

9797
/** Return a unique string constant for the kind.
9898
*/
99-
llvm::StringRef
99+
std::string_view
100100
getFunctionKindString(
101101
FunctionKind kind) noexcept;
102102

@@ -194,8 +194,8 @@ struct FunctionInfo
194194

195195
explicit
196196
FunctionInfo(
197-
SymbolID id_ = SymbolID::zero)
198-
: SymbolInfo(InfoType::IT_function, id_)
197+
SymbolID ID = SymbolID::zero)
198+
: SymbolInfo(InfoType::IT_function, ID)
199199
{
200200
}
201201

include/mrdox/Metadata/Info.hpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
#include <mrdox/Metadata/Javadoc.hpp>
1717
#include <mrdox/Metadata/Reference.hpp>
1818
#include <mrdox/Metadata/Symbols.hpp>
19-
#include <llvm/ADT/StringRef.h>
20-
#include <llvm/ADT/SmallVector.h>
2119
#include <array>
2220
#include <memory>
2321
#include <string>
@@ -59,11 +57,9 @@ struct Info
5957
explicit
6058
Info(
6159
InfoType IT = InfoType::IT_default,
62-
SymbolID id_ = SymbolID::zero,
63-
llvm::StringRef Name = llvm::StringRef())
64-
: id(id_)
60+
SymbolID ID = SymbolID::zero)
61+
: id(ID)
6562
, IT(IT)
66-
, Name(Name)
6763
{
6864
}
6965

include/mrdox/Metadata/Location.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,23 @@
1313
#define MRDOX_API_METADATA_LOCATION_HPP
1414

1515
#include <mrdox/Platform.hpp>
16-
#include <llvm/ADT/SmallString.h>
17-
#include <llvm/ADT/StringRef.h>
16+
#include <string>
17+
#include <string_view>
1818

1919
namespace clang {
2020
namespace mrdox {
2121

2222
struct Location
2323
{
24-
int LineNumber = 0; // Line number of this Location.
25-
llvm::SmallString<32> Filename; // File for this Location.
26-
bool IsFileInRootDir = false; // Indicates if file is inside root directory
24+
int LineNumber = 0; // Line number of this Location.
25+
std::string Filename; // File for this Location.
26+
bool IsFileInRootDir = false; // Indicates if file is inside root directory
2727

2828
//--------------------------------------------
2929

3030
Location(
3131
int LineNumber = 0,
32-
llvm::StringRef Filename = llvm::StringRef(),
32+
std::string_view Filename = "",
3333
bool IsFileInRootDir = false)
3434
: LineNumber(LineNumber)
3535
, Filename(Filename)

include/mrdox/Metadata/Namespace.hpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include <mrdox/Platform.hpp>
1616
#include <mrdox/Metadata/Info.hpp>
1717
#include <mrdox/Metadata/Scope.hpp>
18-
#include <llvm/ADT/StringRef.h>
1918

2019
namespace clang {
2120
namespace mrdox {
@@ -33,9 +32,8 @@ struct NamespaceInfo
3332

3433
NamespaceInfo();
3534

36-
NamespaceInfo(
37-
SymbolID id,
38-
llvm::StringRef Name = llvm::StringRef());
35+
explicit NamespaceInfo(
36+
SymbolID id);
3937
};
4038

4139
} // mrdox

include/mrdox/Metadata/Record.hpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
#include <mrdox/Metadata/Symbols.hpp>
2323
#include <mrdox/Metadata/Template.hpp>
2424
#include <mrdox/Metadata/Var.hpp>
25-
#include <clang/AST/Type.h>
26-
#include <llvm/ADT/SmallVector.h>
2725
#include <memory>
2826
#include <string>
2927
#include <string_view>
@@ -166,9 +164,8 @@ struct RecordInfo
166164

167165
explicit
168166
RecordInfo(
169-
SymbolID id = SymbolID::zero,
170-
llvm::StringRef Name = llvm::StringRef())
171-
: SymbolInfo(InfoType::IT_record, id, Name)
167+
SymbolID ID = SymbolID::zero)
168+
: SymbolInfo(InfoType::IT_record, ID)
172169
{
173170
}
174171

include/mrdox/Metadata/Reference.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414

1515
#include <mrdox/Platform.hpp>
1616
#include <mrdox/Metadata/Symbols.hpp>
17-
#include <llvm/ADT/SmallString.h>
18-
#include <llvm/ADT/StringRef.h>
17+
#include <string>
18+
#include <string_view>
1919
#include <utility>
2020

2121
namespace clang {
@@ -30,7 +30,7 @@ struct Reference
3030
// Name of type (possibly unresolved). Not including namespaces or template
3131
// parameters (so for a std::vector<int> this would be "vector"). See also
3232
// QualName.
33-
llvm::SmallString<16> Name;
33+
std::string Name;
3434

3535
/** The type of the referenced symbol.
3636
*/
@@ -44,10 +44,10 @@ struct Reference
4444
// string as a valid input for the global namespace (it will have
4545
// "GlobalNamespace" as the name, but an empty QualName).
4646
Reference(
47-
SymbolID id_ = SymbolID::zero,
48-
llvm::StringRef Name = llvm::StringRef(),
47+
SymbolID ID = SymbolID::zero,
48+
std::string_view Name = "",
4949
InfoType IT = InfoType::IT_default)
50-
: id(id_)
50+
: id(ID)
5151
, Name(Name)
5252
, RefType(IT)
5353
{

include/mrdox/Metadata/Symbol.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,8 @@ struct SymbolInfo
4646
explicit
4747
SymbolInfo(
4848
InfoType IT,
49-
SymbolID id = SymbolID::zero,
50-
llvm::StringRef Name = llvm::StringRef())
51-
: Info(IT, id, Name)
49+
SymbolID ID = SymbolID::zero)
50+
: Info(IT, ID)
5251
{
5352
}
5453
};

include/mrdox/Metadata/Type.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ struct TypeInfo
4949
// (normally used for built-in types in tests).
5050
explicit
5151
TypeInfo(
52-
llvm::StringRef Name)
52+
std::string_view Name)
5353
: Reference(
5454
SymbolID::zero, Name, InfoType::IT_default)
5555
{

0 commit comments

Comments
 (0)