Skip to content

Commit db42b86

Browse files
committed
fix: change FieldFlags::isNodiscard to FieldFlags::isMaybeUnused
1 parent c98b4de commit db42b86

File tree

5 files changed

+6
-8
lines changed

5 files changed

+6
-8
lines changed

include/mrdox/Metadata/Field.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ union FieldFlags
2929

3030
// KRYSTIAN FIXME: nodiscard cannot be applied to fields; this should
3131
// instead be isMaybeUnused. we should also store the spelling
32-
BitFlag<0> isNodiscard;
32+
BitFlag<0> isMaybeUnused;
3333
BitFlag<1> isDeprecated;
3434
BitFlag<2> hasNoUniqueAddress;
3535
};
@@ -49,7 +49,7 @@ struct FieldInfo
4949
*/
5050
std::string Default;
5151

52-
// attributes (nodiscard, no_unique_address, deprecated)
52+
// attributes (maybe_unused, no_unique_address, deprecated)
5353
FieldFlags specs;
5454

5555
//--------------------------------------------

source/-XML/CXXTags.hpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,7 @@ inline void write(FieldFlags const& bits, XMLTags& tags)
172172
{
173173
BitFieldWriter<FieldFlags> fw(bits, tags);
174174

175-
// KRYSTIAN FIXME: non-static data members cannot be nodiscard
176-
fw.write(&FieldFlags::isNodiscard, "nodiscard");
175+
fw.write(&FieldFlags::isMaybeUnused, "maybe-unused");
177176
fw.write(&FieldFlags::isDeprecated, "deprecated");
178177
fw.write(&FieldFlags::hasNoUniqueAddress, "no-unique-address");
179178
}

source/AST/ASTVisitor.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -1277,8 +1277,7 @@ buildField(
12771277

12781278
I.specs.hasNoUniqueAddress = D->hasAttr<NoUniqueAddressAttr>();
12791279
I.specs.isDeprecated = D->hasAttr<DeprecatedAttr>();
1280-
// KRYSTIAN FIXME: isNodiscard should be isMaybeUnused
1281-
I.specs.isNodiscard = D->hasAttr<UnusedAttr>();
1280+
I.specs.isMaybeUnused = D->hasAttr<UnusedAttr>();
12821281

12831282
bool member_spec = getParentNamespaces(I.Namespace, D);
12841283

source/Metadata/DomMetadata.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,7 @@ DomInfo<T>::construct() const
787787
entries.insert(entries.end(), {
788788
{ "type", domCreate(I_.Type, corpus_) },
789789
{ "default", dom::stringOrNull(I_.Default) },
790-
{ "isNodiscard", I_.specs.isNodiscard.get() },
790+
{ "isMaybeUnused", I_.specs.isMaybeUnused.get() },
791791
{ "isDeprecated", I_.specs.isDeprecated.get() },
792792
{ "hasNoUniqueAddress", I_.specs.hasNoUniqueAddress.get() }
793793
});

test-files/old-tests/no_unique_address.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
</field>
1414
<field name="e" id="h2j8f921HD+Fyaokcs4ndGM/yNk=">
1515
<file path="no_unique_address.cpp" line="8" class="def"/>
16-
<attr id="nodiscard"/>
16+
<attr id="maybe-unused"/>
1717
<attr id="deprecated"/>
1818
<type class="tag" id="iczIHP1J59EwYw3xxL3w2C3Q43Q=" name="Empty"/>
1919
</field>

0 commit comments

Comments
 (0)