Skip to content

Commit 421175a

Browse files
committed
extract override attribute
fix #77
1 parent a3d947a commit 421175a

File tree

5 files changed

+73
-56
lines changed

5 files changed

+73
-56
lines changed

Diff for: include/mrdox/meta/Function.hpp

+15-14
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,21 @@ struct FunctionInfo : SymbolInfo
3535
enum : std::uint32_t
3636
{
3737
// 11 bits
38-
constBit = 0x0001,
39-
constevalBit = 0x0002,
40-
constexprBit = 0x0004,
41-
inlineBit = 0x0008,
42-
noexceptBit = 0x0010,
43-
pureBit = 0x0020,
44-
specialBit = 0x0040, // dtor, move/copy construct or assign
45-
trailReturnBit = 0x0080,
46-
variadicBit = 0x0100, // has a C-style "..." variadic
47-
virtualBit = 0x0200,
48-
volatileBit = 0x0400,
49-
50-
refQualifierMask = 0x1800, // 2 bits
51-
storageClassMask = 0xE000 // top 3 bits
38+
constBit = 0x00000001,
39+
constevalBit = 0x00000002,
40+
constexprBit = 0x00000004,
41+
inlineBit = 0x00000008,
42+
noexceptBit = 0x00000010,
43+
overrideBit = 0x00000020,
44+
pureBit = 0x00000040,
45+
specialBit = 0x00000080, // dtor, move/copy construct or assign
46+
trailReturnBit = 0x00000100,
47+
variadicBit = 0x00000200, // has a C-style "..." variadic
48+
virtualBit = 0x00000400,
49+
volatileBit = 0x00000800,
50+
51+
refQualifierMask = 0x18000000, // 2 bits
52+
storageClassMask = 0xE0000000 // top 3 bits
5253
};
5354

5455
/** Specifiers for the function.

Diff for: source/lib/ast/Serialize.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -973,9 +973,9 @@ build(
973973
I.specs.set(FunctionInfo::constexprBit, D->isConstexprSpecified() && ! D->isExplicitlyDefaulted());
974974
I.specs.set(FunctionInfo::inlineBit, D->isInlineSpecified());
975975
I.specs.set(FunctionInfo::noexceptBit, isNoexceptExceptionSpec(D->getExceptionSpecType()));
976+
I.specs.set(FunctionInfo::overrideBit, D->hasAttr<OverrideAttr>());
976977
I.specs.set(FunctionInfo::pureBit, D->isPure());
977978
//I.specs.set(FunctionInfo::specialBit);
978-
//isOverrideSpecified();
979979
//D->isCopyAssignmentOperator()
980980
//D->isMoveAssignmentOperator()
981981
//D->isOverloadedOperator();

Diff for: source/lib/format/xml/XML.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,8 @@ visit(
438438
os << "<inline/>";
439439
if(I.specs.isSet(FunctionInfo::noexceptBit))
440440
os << "<noexcept/>";
441+
if(I.specs.isSet(FunctionInfo::overrideBit))
442+
os << "<override/>";
441443
if(I.specs.isSet(FunctionInfo::pureBit))
442444
os << "<pure/>";
443445
if(I.specs.isSet(FunctionInfo::specialBit))

Diff for: tests/decls/functions-1.cpp renamed to tests/decls/mem-fn.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,8 @@ struct U
2525
static inline constexpr auto f2() noexcept -> char { return ' '; }
2626
virtual int f3() const volatile noexcept = 0;
2727
};
28+
29+
struct V : U
30+
{
31+
int f3() const volatile noexcept override;
32+
};

Diff for: tests/decls/functions-1.xml renamed to tests/decls/mem-fn.xml

+50-41
Original file line numberDiff line numberDiff line change
@@ -39,136 +39,145 @@
3939
<symbol name="U::f1" tag="function" id="DBXd564vaQo7GHkh6XCC6HV78/I="/>
4040
<symbol name="U::f2" tag="function" id="II436kVwM/ZBYOf9q474VxRXK6c="/>
4141
<symbol name="U::f3" tag="function" id="YOkqb7VjZXBs2Rg5gWCOYGX3Tnw="/>
42+
<symbol name="V" tag="struct" id="9kzYwt0WPztMEDUaFxul1Jvqqs8="/>
43+
<symbol name="V::f3" tag="function" id="/C2pxLlwRMKnr6YRbVnykUArzEI="/>
4244
</symbols>
4345
<namespace name="">
4446
<struct name="T01" id="O2UBDeG42PMrk1up8f8PGVFhIGk=">
45-
<file path="functions-1.cpp" line="3" class="def"/>
47+
<file path="mem-fn.cpp" line="3" class="def"/>
4648
<function name="f" access="public" id="dmtEtFE6EVKE6hWuugP9vFuib6Y=">
47-
<file path="functions-1.cpp" line="3"/>
49+
<file path="mem-fn.cpp" line="3"/>
4850
</function>
4951
</struct>
5052
<struct name="T02" id="H+pnPDuG6B+W6+srjVP2qhqXCrQ=">
51-
<file path="functions-1.cpp" line="4" class="def"/>
53+
<file path="mem-fn.cpp" line="4" class="def"/>
5254
<function name="f" access="public" id="QPLurkQ2BXODb4xY6bw1mlNtQ28=">
53-
<file path="functions-1.cpp" line="4"/>
54-
<static/>
55+
<file path="mem-fn.cpp" line="4"/>
5556
</function>
5657
</struct>
5758
<struct name="T03" id="rM+ml6ikwiS9Twa1IwpCHbSHTbg=">
58-
<file path="functions-1.cpp" line="5" class="def"/>
59+
<file path="mem-fn.cpp" line="5" class="def"/>
5960
<function name="f" access="public" id="p6A5dCCvCkASDE6pH4cJA/27/o8=">
60-
<file path="functions-1.cpp" line="5"/>
61-
<lvref/>
61+
<file path="mem-fn.cpp" line="5"/>
62+
<volatile/>
6263
</function>
6364
</struct>
6465
<struct name="T04" id="MBpLzhyCDdQBHul4AN2i2fR8fw0=">
65-
<file path="functions-1.cpp" line="6" class="def"/>
66+
<file path="mem-fn.cpp" line="6" class="def"/>
6667
<function name="f" access="public" id="G71rDzcAZPSKGoGGoDswQjD1JuA=">
67-
<file path="functions-1.cpp" line="6"/>
68-
<rvref/>
68+
<file path="mem-fn.cpp" line="6"/>
6969
</function>
7070
</struct>
7171
<struct name="T05" id="5s81XyCIgauM5viJN9KAwx2A6DU=">
72-
<file path="functions-1.cpp" line="7" class="def"/>
72+
<file path="mem-fn.cpp" line="7" class="def"/>
7373
<function name="f" access="public" id="rWLMsKBEv1FtDyk7Y7XNzcgmt68=">
74-
<file path="functions-1.cpp" line="7"/>
74+
<file path="mem-fn.cpp" line="7"/>
7575
<const/>
7676
</function>
7777
</struct>
7878
<struct name="T06" id="SzwXGFnhX4HlHjHolU7XF/KEqDs=">
79-
<file path="functions-1.cpp" line="8" class="def"/>
79+
<file path="mem-fn.cpp" line="8" class="def"/>
8080
<function name="f" access="public" id="A3MUO5+pwkURxw+SBeh1y0BKv7c=">
81-
<file path="functions-1.cpp" line="8" class="def"/>
81+
<file path="mem-fn.cpp" line="8" class="def"/>
8282
<constexpr/>
8383
</function>
8484
</struct>
8585
<struct name="T08" id="WU9ZeQm0IOT8cYJkWXom3NXeWsM=">
86-
<file path="functions-1.cpp" line="10" class="def"/>
86+
<file path="mem-fn.cpp" line="10" class="def"/>
8787
<function name="f" access="public" id="jlrEtbnYd1B6OAjYlF0gQ/oYu5w=">
88-
<file path="functions-1.cpp" line="10"/>
88+
<file path="mem-fn.cpp" line="10"/>
8989
<inline/>
9090
</function>
9191
</struct>
9292
<struct name="T09" id="SX7tpa77UInh7a4AsMFjfiCtoLY=">
93-
<file path="functions-1.cpp" line="11" class="def"/>
93+
<file path="mem-fn.cpp" line="11" class="def"/>
9494
<function name="f" access="public" id="u+MePKsNF/sYSk6UpgNS65+USGU=">
95-
<file path="functions-1.cpp" line="11"/>
95+
<file path="mem-fn.cpp" line="11"/>
9696
<noexcept/>
9797
</function>
9898
</struct>
9999
<struct name="T10" id="TJnjDRnoO8E/5XEw8BaODsKxlwQ=">
100-
<file path="functions-1.cpp" line="12" class="def"/>
100+
<file path="mem-fn.cpp" line="12" class="def"/>
101101
<function name="f" access="public" id="0hjrVGeDlQhdYkOu4shvWWPqNKU=">
102-
<file path="functions-1.cpp" line="12"/>
102+
<file path="mem-fn.cpp" line="12"/>
103103
<trailing/>
104104
</function>
105105
</struct>
106106
<struct name="T11" id="MXMa4TZZfdRkREzWSLpIF6ruUyw=">
107-
<file path="functions-1.cpp" line="13" class="def"/>
107+
<file path="mem-fn.cpp" line="13" class="def"/>
108108
<function name="f" access="public" id="+NevzZlqigIe1KSKS7eqq7pCd40=">
109-
<file path="functions-1.cpp" line="13"/>
109+
<file path="mem-fn.cpp" line="13"/>
110110
<trailing/>
111111
<return name="int"/>
112112
</function>
113113
</struct>
114114
<struct name="T12" id="7rg34TfmIwu+7zOd7DN+Dq8mLCc=">
115-
<file path="functions-1.cpp" line="14" class="def"/>
115+
<file path="mem-fn.cpp" line="14" class="def"/>
116116
<function name="f" access="public" id="I0S8eMgTnTkagm+IrM34MBiU4XI=">
117-
<file path="functions-1.cpp" line="14"/>
117+
<file path="mem-fn.cpp" line="14"/>
118118
<variadic/>
119119
</function>
120120
</struct>
121121
<struct name="T13" id="NyLraUP0R3lYeyTpHQYZpyZMstc=">
122-
<file path="functions-1.cpp" line="15" class="def"/>
122+
<file path="mem-fn.cpp" line="15" class="def"/>
123123
<function name="f" access="public" id="5d5eSOvkYwBOnpbLcrkRuFvJGP4=">
124-
<file path="functions-1.cpp" line="15"/>
124+
<file path="mem-fn.cpp" line="15"/>
125125
<virtual/>
126126
</function>
127127
</struct>
128128
<struct name="T14" id="SLJhBKx+2u4KxSJ78Fg6wqlObPc=">
129-
<file path="functions-1.cpp" line="16" class="def"/>
129+
<file path="mem-fn.cpp" line="16" class="def"/>
130130
<function name="f" access="public" id="1Lz3aFupR+OsCqiPOaIFWqGuyCc=">
131-
<file path="functions-1.cpp" line="16"/>
131+
<file path="mem-fn.cpp" line="16"/>
132132
<pure/><virtual/>
133133
</function>
134134
</struct>
135135
<struct name="T15" id="Bu7lz+fvOPzOR6oSlAo9R8R0alg=">
136-
<file path="functions-1.cpp" line="17" class="def"/>
136+
<file path="mem-fn.cpp" line="17" class="def"/>
137137
<function name="f" access="public" id="wSFf8IAx5Twq6aD5T8XdnXGuhw8=">
138-
<file path="functions-1.cpp" line="17"/>
138+
<file path="mem-fn.cpp" line="17"/>
139139
<volatile/>
140140
</function>
141141
</struct>
142142
<struct name="T16" id="75395VGvKeZbe1EhfJwktZuWLs0=">
143-
<file path="functions-1.cpp" line="18" class="def"/>
143+
<file path="mem-fn.cpp" line="18" class="def"/>
144144
<function name="f" access="public" id="OEX+TUed8FjXJPiI4c3+9WHzJl4=">
145-
<file path="functions-1.cpp" line="18"/>
146-
<static/>
145+
<file path="mem-fn.cpp" line="18"/>
147146
</function>
148147
</struct>
149148
<struct name="T17" id="HL3/1NhKSels2G5ay7F0IYzlSLs=">
150-
<file path="functions-1.cpp" line="20" class="def"/>
149+
<file path="mem-fn.cpp" line="20" class="def"/>
151150
<base name="T14" access="public" id="SLJhBKx+2u4KxSJ78Fg6wqlObPc="/>
152151
<function name="f" access="public" id="5+yfyWtDpz80IwKT3xugro18Ev0=">
153-
<file path="functions-1.cpp" line="20"/>
152+
<file path="mem-fn.cpp" line="20"/>
153+
<override/>
154154
</function>
155155
</struct>
156156
<struct name="U" id="FLgkhM3m0U3Lo2o3XLPUizWPH00=">
157-
<file path="functions-1.cpp" line="22" class="def"/>
157+
<file path="mem-fn.cpp" line="22" class="def"/>
158158
<function name="f1" access="public" id="DBXd564vaQo7GHkh6XCC6HV78/I=">
159-
<file path="functions-1.cpp" line="24" class="def"/>
159+
<file path="mem-fn.cpp" line="24" class="def"/>
160160
<const/><constexpr/><inline/><noexcept/><trailing/><variadic/><volatile/>
161161
</function>
162162
<function name="f2" access="public" id="II436kVwM/ZBYOf9q474VxRXK6c=">
163-
<file path="functions-1.cpp" line="25" class="def"/>
164-
<static/><constexpr/><inline/><noexcept/><trailing/>
163+
<file path="mem-fn.cpp" line="25" class="def"/>
164+
<constexpr/><inline/><noexcept/><trailing/>
165165
<return name="char"/>
166166
</function>
167167
<function name="f3" access="public" id="YOkqb7VjZXBs2Rg5gWCOYGX3Tnw=">
168-
<file path="functions-1.cpp" line="26"/>
168+
<file path="mem-fn.cpp" line="26"/>
169169
<const/><noexcept/><pure/><virtual/><volatile/>
170170
<return name="int"/>
171171
</function>
172172
</struct>
173+
<struct name="V" id="9kzYwt0WPztMEDUaFxul1Jvqqs8=">
174+
<file path="mem-fn.cpp" line="29" class="def"/>
175+
<base name="U" access="public" id="FLgkhM3m0U3Lo2o3XLPUizWPH00="/>
176+
<function name="f3" access="public" id="/C2pxLlwRMKnr6YRbVnykUArzEI=">
177+
<file path="mem-fn.cpp" line="31"/>
178+
<const/><noexcept/><override/><volatile/>
179+
<return name="int"/>
180+
</function>
181+
</struct>
173182
</namespace>
174183
</mrdox>

0 commit comments

Comments
 (0)