Skip to content

Commit 334a1de

Browse files
committed
tidy
1 parent 3e5039d commit 334a1de

File tree

10 files changed

+51
-64
lines changed

10 files changed

+51
-64
lines changed

CMakeLists.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,9 +236,12 @@ if (BUILD_TESTING)
236236
message(FATAL_ERROR "Java is needed to run xml-lint")
237237
endif()
238238

239-
add_custom_target(mrdox.rng ALL DEPENDS mrdox.rnc
240-
COMMAND ${Java_JAVA_EXECUTABLE} -jar ${CMAKE_CURRENT_SOURCE_DIR}/tools/trang.jar
241-
${CMAKE_CURRENT_SOURCE_DIR}/mrdox.rnc ${CMAKE_CURRENT_BINARY_DIR}/mrdox.rng)
239+
add_custom_target(
240+
mrdox.rng ALL
241+
DEPENDS mrdox.rnc
242+
COMMAND ${Java_JAVA_EXECUTABLE} -jar ${CMAKE_CURRENT_SOURCE_DIR}/tools/trang.jar
243+
${CMAKE_CURRENT_SOURCE_DIR}/mrdox.rnc ${CMAKE_CURRENT_BINARY_DIR}/mrdox.rng
244+
SOURCES mrdox.rnc)
242245

243246

244247
file(GLOB_RECURSE XML_SOURCES CONFIGURE_DEPENDS test-files/*.xml)

mrdox.rnc

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ grammar
4444
RecordContent =
4545
(
4646
Name,
47+
Access ?,
4748
ID,
4849
Location *,
4950
(
@@ -61,7 +62,7 @@ grammar
6162
element base
6263
{
6364
Name,
64-
Access,
65+
Access ?,
6566
attribute class { "virtual" } ?,
6667
ID
6768
}
@@ -72,7 +73,7 @@ grammar
7273
Name,
7374
attribute type { text },
7475
attribute value { text } ?,
75-
Access,
76+
Access ?,
7677
ID ?,
7778
Attr *
7879
}
@@ -167,7 +168,11 @@ grammar
167168
element symbol { Symbol }
168169
} *
169170

170-
TemplateParamInfo = element tparam { attribute decl { text } }
171+
TemplateParamInfo =
172+
element tparam
173+
{
174+
attribute decl { text }
175+
}
171176

172177
Location =
173178
element file

source/lib/api/AST/ASTVisitor.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -786,11 +786,6 @@ constructFunction(
786786
//
787787
if constexpr(std::derived_from<DeclTy, CXXMethodDecl>)
788788
{
789-
NamedDecl const* PD = nullptr;
790-
if(auto const* SD = dyn_cast<ClassTemplateSpecializationDecl>(D->getParent()))
791-
PD = SD->getSpecializedTemplate();
792-
else
793-
PD = D->getParent();
794789
I.specs0.isVirtual = D->isVirtual();
795790
I.specs0.isVirtualAsWritten = D->isVirtualAsWritten();
796791
I.specs0.isPure = D->isPure();

source/lib/api/AST/AnyBlock.hpp

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -56,18 +56,9 @@ struct BitcodeReader::AnyBlock
5656
class VersionBlock
5757
: public BitcodeReader::AnyBlock
5858
{
59-
BitcodeReader& br_;
60-
6159
public:
6260
unsigned V;
6361

64-
explicit
65-
VersionBlock(
66-
BitcodeReader& br) noexcept
67-
: br_(br)
68-
{
69-
}
70-
7162
llvm::Error
7263
parseRecord(Record const& R,
7364
unsigned ID, llvm::StringRef Blob) override
@@ -568,16 +559,13 @@ class MemberTypeBlock
568559
class BaseBlock
569560
: public BitcodeReader::AnyBlock
570561
{
571-
BitcodeReader& br_;
572562
std::vector<BaseInfo>& v_;
573563

574564
public:
575565
explicit
576566
BaseBlock(
577-
std::vector<BaseInfo>& v,
578-
BitcodeReader& br) noexcept
579-
: br_(br)
580-
, v_(v)
567+
std::vector<BaseInfo>& v) noexcept
568+
: v_(v)
581569
{
582570
v_.emplace_back();
583571
}
@@ -885,7 +873,7 @@ class RecordBlock
885873
}
886874
case BI_BASE_BLOCK_ID:
887875
{
888-
BaseBlock B(I->Bases, br_);
876+
BaseBlock B(I->Bases);
889877
return br_.readBlock(B, ID);
890878
}
891879
case BI_TEMPLATE_BLOCK_ID:
@@ -1031,15 +1019,12 @@ class TypedefBlock
10311019

10321020
class EnumValueBlock : public BitcodeReader::AnyBlock
10331021
{
1034-
BitcodeReader& br_;
10351022
EnumValueInfo& I_;
10361023

10371024
public:
10381025
EnumValueBlock(
1039-
EnumValueInfo& I,
1040-
BitcodeReader& br) noexcept
1041-
: br_(br)
1042-
, I_(I)
1026+
EnumValueInfo& I) noexcept
1027+
: I_(I)
10431028
{
10441029
}
10451030

@@ -1101,7 +1086,7 @@ class EnumBlock
11011086
case BI_ENUM_VALUE_BLOCK_ID:
11021087
{
11031088
I->Members.emplace_back();
1104-
EnumValueBlock B(I->Members.back(), br_);
1089+
EnumValueBlock B(I->Members.back());
11051090
if(auto Err = br_.readBlock(B, ID))
11061091
return Err;
11071092
return llvm::Error::success();

source/lib/api/AST/BitcodeReader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ getInfos()
4444
// Top level Version is first
4545
case BI_VERSION_BLOCK_ID:
4646
{
47-
VersionBlock B(*this);
47+
VersionBlock B;
4848
if (auto Err = readBlock(B, ID))
4949
return std::move(Err);
5050
continue;

source/lib/api/AST/ParseJavadoc.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,6 @@ class JavadocVisitor
401401
AnyList<Javadoc::Block> blocks_;
402402
AnyList<Javadoc::Param> params_;
403403
Javadoc::Paragraph* para_ = nullptr;
404-
llvm::raw_string_ostream* os_ = nullptr;
405404
};
406405

407406
//------------------------------------------------

source/lib/api/CorpusImpl.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,14 +145,11 @@ class CorpusImpl::
145145
Canonicalizer : public MutableVisitor
146146
{
147147
CorpusImpl& corpus_;
148-
Reporter& R_;
149148

150149
public:
151150
Canonicalizer(
152-
CorpusImpl& corpus,
153-
Reporter& R) noexcept
151+
CorpusImpl& corpus) noexcept
154152
: corpus_(corpus)
155-
, R_(R)
156153
{
157154
}
158155

@@ -250,7 +247,7 @@ canonicalize(
250247
return;
251248
if(config_->verboseOutput)
252249
R.print("Canonicalizing...");
253-
Canonicalizer cn(*this, R);
250+
Canonicalizer cn(*this);
254251
traverse(cn, globalNamespaceID);
255252
std::string temp0;
256253
std::string temp1;

source/lib/api/_XML/XMLWriter.cpp

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -525,15 +525,26 @@ XMLWriter::
525525
writeMemberType(
526526
MemberTypeInfo const& I)
527527
{
528-
tags_.open(dataMemberTagName, {
529-
{ "name", I.Name },
530-
{ "type", I.Type.Name },
531-
{ "value", I.DefaultValue, ! I.DefaultValue.empty() },
532-
{ &I.access },
533-
{ I.Type.id } });
534-
535-
write(I.Flags, tags_);
536-
tags_.close("data");
528+
if(I.Flags.raw == 0)
529+
{
530+
tags_.write(dataMemberTagName, "", {
531+
{ "name", I.Name },
532+
{ "type", I.Type.Name },
533+
{ "value", I.DefaultValue, ! I.DefaultValue.empty() },
534+
{ &I.access },
535+
{ I.Type.id } });
536+
}
537+
else
538+
{
539+
tags_.open(dataMemberTagName, {
540+
{ "name", I.Name },
541+
{ "type", I.Type.Name },
542+
{ "value", I.DefaultValue, ! I.DefaultValue.empty() },
543+
{ &I.access },
544+
{ I.Type.id } });
545+
write(I.Flags, tags_);
546+
tags_.close(dataMemberTagName);
547+
}
537548
}
538549

539550
//------------------------------------------------

test-files/old-tests/no_unique_address.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
<namespace name="">
55
<struct name="T" id="CgGNdHpW5mG/i5741WPYQDw28OQ=">
66
<file path="no_unique_address.cpp" line="5" class="def"/>
7-
<data name="i" type="int">
8-
</data>
7+
<data name="i" type="int"/>
98
<data name="e" type="Empty" id="iczIHP1J59EwYw3xxL3w2C3Q43Q=">
109
<attr id="nodiscard"/>
1110
<attr id="deprecated"/>

test-files/old-tests/record-data.xml

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,22 @@
44
<namespace name="">
55
<struct name="T" id="CgGNdHpW5mG/i5741WPYQDw28OQ=">
66
<file path="record-data.cpp" line="3" class="def"/>
7-
<data name="i" type="int">
8-
</data>
9-
<data name="j" type="double">
10-
</data>
7+
<data name="i" type="int"/>
8+
<data name="j" type="double"/>
119
</struct>
1210
<struct name="U" id="FLgkhM3m0U3Lo2o3XLPUizWPH00=">
1311
<file path="record-data.cpp" line="9" class="def"/>
14-
<data name="t" type="T" id="CgGNdHpW5mG/i5741WPYQDw28OQ=">
15-
</data>
12+
<data name="t" type="T" id="CgGNdHpW5mG/i5741WPYQDw28OQ="/>
1613
</struct>
1714
<struct name="W" id="6OhcFM3BV6KlrvmfpsljaMHxpdA=">
1815
<file path="record-data.cpp" line="23" class="def"/>
19-
<data name="buf" type="char[64]">
20-
</data>
16+
<data name="buf" type="char[64]"/>
2117
</struct>
2218
<class name="V" id="9kzYwt0WPztMEDUaFxul1Jvqqs8=">
2319
<file path="record-data.cpp" line="14" class="def"/>
24-
<data name="i" type="int" access="private">
25-
</data>
26-
<data name="j" type="unsigned long" access="protected">
27-
</data>
28-
<data name="k" type="double" access="private">
29-
</data>
20+
<data name="i" type="int" access="private"/>
21+
<data name="j" type="unsigned long" access="protected"/>
22+
<data name="k" type="double" access="private"/>
3023
</class>
3124
</namespace>
3225
</mrdox>

0 commit comments

Comments
 (0)