Skip to content

Commit 1b6bb13

Browse files
committed
chore: RecordInfo member refs are just symbol IDs
1 parent bcf02e8 commit 1b6bb13

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+949
-1538
lines changed

include/mrdox/Corpus.hpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,6 @@ class MRDOX_VISIBLE
105105
MRDOX_DECL virtual bool visit(VarInfo const&);
106106
MRDOX_DECL virtual bool visit(FieldInfo const&);
107107
MRDOX_DECL virtual bool visit(SpecializationInfo const&);
108-
109-
MRDOX_DECL virtual bool visit(MemberEnum const&, Access);
110-
MRDOX_DECL virtual bool visit(MemberFunction const&, Access);
111-
MRDOX_DECL virtual bool visit(MemberRecord const&, Access);
112-
MRDOX_DECL virtual bool visit(MemberType const&, Access);
113-
MRDOX_DECL virtual bool visit(DataMember const&, Access);
114-
MRDOX_DECL virtual bool visit(StaticDataMember const&, Access);
115108
};
116109

117110
/** Traverse the symbol, list, or its children.

include/mrdox/Metadata/Info.hpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,17 @@ struct MRDOX_VISIBLE
3737
*/
3838
InfoKind Kind;
3939

40+
/** Declaration access.
41+
42+
Class members use:
43+
@li `AccessKind::Public`,
44+
@li `AccessKind::Protected`, and
45+
@li `AccessKind::Private`.
46+
47+
Namespace members use `AccessKind::None`.
48+
*/
49+
AccessKind Access = AccessKind::None;
50+
4051
/** The unqualified name.
4152
*/
4253
std::string Name;

include/mrdox/Metadata/Interface.hpp

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,42 @@
2222
namespace clang {
2323
namespace mrdox {
2424

25+
struct DataMember
26+
{
27+
FieldInfo const* I;
28+
RecordInfo const* From;
29+
};
30+
31+
struct MemberEnum
32+
{
33+
EnumInfo const* I;
34+
RecordInfo const* From;
35+
};
36+
37+
struct MemberFunction
38+
{
39+
FunctionInfo const* I;
40+
RecordInfo const* From;
41+
};
42+
43+
struct MemberRecord
44+
{
45+
RecordInfo const* I;
46+
RecordInfo const* From;
47+
};
48+
49+
struct MemberType
50+
{
51+
TypedefInfo const* I;
52+
RecordInfo const* From;
53+
};
54+
55+
struct StaticDataMember
56+
{
57+
VarInfo const* I;
58+
RecordInfo const* From;
59+
};
60+
2561
/** The aggregated interface for a given struct, class, or union.
2662
*/
2763
class Interface

include/mrdox/Metadata/Record.hpp

Lines changed: 7 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -30,45 +30,6 @@
3030
namespace clang {
3131
namespace mrdox {
3232

33-
/** Access specifier.
34-
35-
Public is set to zero since it is the most
36-
frequently occurring access, and it is
37-
elided by the bitstream encoder because it
38-
has an all-zero bit pattern. This improves
39-
compression in the bitstream.
40-
41-
@note It is by design that there is no
42-
constant to represent "none."
43-
*/
44-
enum class Access
45-
{
46-
Public = 0,
47-
Protected,
48-
Private
49-
};
50-
51-
/** A reference to a symbol, and an access specifier.
52-
53-
This is used in records to refer to nested
54-
elements with access control.
55-
*/
56-
struct MemberRef
57-
{
58-
SymbolID id;
59-
Access access;
60-
61-
constexpr MemberRef() = default;
62-
63-
constexpr MemberRef(
64-
const SymbolID& id_,
65-
Access access_)
66-
: id(id_)
67-
, access(access_)
68-
{
69-
}
70-
};
71-
7233
/** Bit constants used with Record metadata
7334
*/
7435
union RecFlags0
@@ -85,13 +46,13 @@ struct BaseInfo
8546
{
8647
SymbolID id;
8748
std::string Name;
88-
Access access;
49+
AccessKind access;
8950
bool IsVirtual;
9051

9152
BaseInfo(
9253
SymbolID const& id_ = SymbolID::zero,
9354
std::string_view Name_ = "",
94-
Access access_ = Access::Public,
55+
AccessKind access_ = AccessKind::Public,
9556
bool IsVirtual_ = false)
9657
: id(id_)
9758
, Name(Name_)
@@ -101,19 +62,6 @@ struct BaseInfo
10162
}
10263
};
10364

104-
/** Members of a class, struct, or union.
105-
*/
106-
struct RecordScope
107-
{
108-
std::vector<MemberRef> Records;
109-
std::vector<MemberRef> Functions;
110-
std::vector<MemberRef> Enums;
111-
std::vector<MemberRef> Types;
112-
std::vector<MemberRef> Fields;
113-
std::vector<MemberRef> Vars;
114-
std::vector<SymbolID> Specializations;
115-
};
116-
11765
enum class RecordKeyKind
11866
{
11967
Struct,
@@ -155,7 +103,11 @@ struct RecordInfo
155103

156104
/** Record members
157105
*/
158-
RecordScope Members;
106+
std::vector<SymbolID> Members;
107+
108+
/** Record member specializations
109+
*/
110+
std::vector<SymbolID> Specializations;
159111

160112
//--------------------------------------------
161113

@@ -175,42 +127,6 @@ struct RecordInfo
175127
}
176128
};
177129

178-
struct DataMember
179-
{
180-
FieldInfo const* I;
181-
RecordInfo const* From;
182-
};
183-
184-
struct MemberEnum
185-
{
186-
EnumInfo const* I;
187-
RecordInfo const* From;
188-
};
189-
190-
struct MemberFunction
191-
{
192-
FunctionInfo const* I;
193-
RecordInfo const* From;
194-
};
195-
196-
struct MemberRecord
197-
{
198-
RecordInfo const* I;
199-
RecordInfo const* From;
200-
};
201-
202-
struct MemberType
203-
{
204-
TypedefInfo const* I;
205-
RecordInfo const* From;
206-
};
207-
208-
struct StaticDataMember
209-
{
210-
VarInfo const* I;
211-
RecordInfo const* From;
212-
};
213-
214130
} // mrdox
215131
} // clang
216132

include/mrdox/Metadata/Symbols.hpp

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ using OptionalSymbolID = Optional<SymbolID>;
109109
*/
110110
enum class InfoKind
111111
{
112-
Namespace,
112+
Namespace = 0,
113113
Record,
114114
Function,
115115
Enum,
@@ -119,6 +119,25 @@ enum class InfoKind
119119
Specialization
120120
};
121121

122+
/** Access specifier.
123+
124+
Public is set to zero since it is the most
125+
frequently occurring access, and it is
126+
elided by the bitstream encoder because it
127+
has an all-zero bit pattern. This improves
128+
compression in the bitstream.
129+
130+
None is used for namespace members and friend;
131+
such declarations have no access.
132+
*/
133+
enum class AccessKind
134+
{
135+
Public = 0,
136+
Protected,
137+
Private,
138+
None
139+
};
140+
122141
/** Return the result of comparing s0 to s1.
123142
124143
This function returns true if the string

include/mrdox/MetadataFwd.hpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Corpus;
2525

2626
class Interface;
2727

28-
enum class Access;
28+
enum class AccessKind;
2929
enum class FunctionKind;
3030

3131
struct BaseInfo;
@@ -36,10 +36,8 @@ struct FunctionInfo;
3636
struct Info;
3737
struct Javadoc;
3838
struct Location;
39-
struct MemberRef;
4039
struct NamespaceInfo;
4140
struct RecordInfo;
42-
struct RecordScope;
4341
struct Param;
4442
struct SpecializationInfo;
4543
struct SpecializedMember;

source/-XML/XMLTags.hpp

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -106,26 +106,29 @@ struct Attribute
106106
}
107107

108108
Attribute(
109-
Access access)
109+
AccessKind access)
110110
: name("access")
111111
, value(
112112
[access]
113113
{
114114
switch(access)
115115
{
116-
case Access::Public: return std::string("public");
117-
case Access::Protected: return std::string("protected");
118-
case Access::Private: return std::string("private");
116+
case AccessKind::None:
117+
return std::string();
118+
case AccessKind::Public: return std::string("public");
119+
case AccessKind::Protected: return std::string("protected");
120+
case AccessKind::Private: return std::string("private");
119121
default:
120122
llvm_unreachable("unknown Access");
121123
}
122124
}())
123-
, pred(true)
125+
, pred(access == AccessKind::Private || access == AccessKind::Protected)
124126
{
125127
}
126128

129+
#if 0
127130
Attribute(
128-
Access const* access)
131+
AccessKind const* access)
129132
: name("access")
130133
, value(
131134
[access]
@@ -134,16 +137,17 @@ struct Attribute
134137
return std::string();
135138
switch(*access)
136139
{
137-
case Access::Public: return std::string("public");
138-
case Access::Protected: return std::string("protected");
139-
case Access::Private: return std::string("private");
140+
case AccessKind::Public: return std::string("public");
141+
case AccessKind::Protected: return std::string("protected");
142+
case AccessKind::Private: return std::string("private");
140143
default:
141144
llvm_unreachable("unknown Access");
142145
}
143146
}())
144-
, pred(access != nullptr && *access != Access::Public)
147+
, pred(access != nullptr && *access != AccessKind::Public)
145148
{
146149
}
150+
#endif
147151

148152
Attribute(
149153
std::optional<TypeInfo> const& opt)

0 commit comments

Comments
 (0)