Skip to content

Commit d952f49

Browse files
committed
[Proj] Assign default vals to bit-fields
1 parent b2001d3 commit d952f49

19 files changed

+59
-72
lines changed

include/ADT/Mach-O/BindInfo.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -350,14 +350,13 @@ namespace MachO {
350350
std::unique_ptr<BindOpcodeIterateInfo> Info;
351351

352352
const BindByte *Prev;
353-
bool ReachedEnd : 1;
353+
bool ReachedEnd : 1 = false;
354354
public:
355355
constexpr explicit
356356
BindOpcodeIteratorBase(const BindByte *const Begin,
357357
const BindByte *const End) noexcept
358358
: Iter(reinterpret_cast<const uint8_t *>(Begin),
359-
reinterpret_cast<const uint8_t *>(End)),
360-
ReachedEnd(false)
359+
reinterpret_cast<const uint8_t *>(End))
361360
{
362361
Info = std::make_unique<BindOpcodeIterateInfo>();
363362
Info->Kind = BindKind;

include/ADT/Mach-O/ObjcInfo.h

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,17 @@ namespace MachO {
2727
std::string Name;
2828
uint64_t DylibOrdinal = 0;
2929

30-
bool sIsExternal : 1;
31-
bool sIsNull : 1;
32-
bool sIsSwift : 1;
30+
bool sIsExternal : 1 = false;
31+
bool sIsNull : 1 = false;
32+
bool sIsSwift : 1 = false;
3333

3434
ObjcClassRoFlags Flags;
3535
CategoryListType CategoryList;
3636
public:
37-
ObjcClassInfo() noexcept : sIsExternal(false), sIsNull(false) {}
37+
ObjcClassInfo() noexcept {}
3838

3939
explicit ObjcClassInfo(const std::string_view Name) noexcept
40-
: Name(Name), sIsExternal(false), sIsNull(false) {}
40+
: Name(Name) {}
4141

4242
[[nodiscard]]
4343
inline TreeNode *createNew() const noexcept override {
@@ -212,17 +212,15 @@ namespace MachO {
212212
std::string Name;
213213
const ObjcClassInfo *Class = nullptr;
214214
uint64_t Address = 0;
215-
bool sIsNull : 1;
215+
bool sIsNull : 1 = false;
216216
public:
217-
ObjcClassCategoryInfo() : sIsNull(false) {}
217+
ObjcClassCategoryInfo() {}
218218

219-
[[nodiscard]]
220-
constexpr std::string_view getName() const noexcept {
219+
[[nodiscard]] constexpr std::string_view getName() const noexcept {
221220
return Name;
222221
}
223222

224-
[[nodiscard]]
225-
constexpr const ObjcClassInfo *getClass() const noexcept {
223+
[[nodiscard]] constexpr const ObjcClassInfo *getClass() const noexcept {
226224
return Class;
227225
}
228226

include/ADT/Mach-O/RebaseInfo.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,14 +264,13 @@ namespace MachO {
264264
std::unique_ptr<RebaseOpcodeIterateInfo> Info;
265265

266266
const RebaseByte *Prev;
267-
bool ReachedEnd : 1;
267+
bool ReachedEnd : 1 = false;
268268
public:
269269
explicit
270270
RebaseOpcodeIterator(const RebaseByte *const Begin,
271271
const RebaseByte *const End) noexcept
272272
: Iter(reinterpret_cast<const uint8_t *>(Begin),
273273
reinterpret_cast<const uint8_t *>(End)),
274-
ReachedEnd(false)
275274
{
276275
Info = std::make_unique<RebaseOpcodeIterateInfo>();
277276
Advance();

include/ADT/Mach-O/SymbolTableUtil.h

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -157,17 +157,14 @@ namespace MachO {
157157
SymbolTableEntryCollection() noexcept = default;
158158

159159
struct ParseOptions {
160-
bool IgnoreAbsolute : 1;
161-
bool IgnoreExternal : 1;
162-
bool IgnoreUndefined : 1;
163-
bool IgnoreIndirect : 1;
164-
bool IgnorePreboundUndefined : 1;
165-
bool IgnoreSectionDefined : 1;
166-
167-
ParseOptions() noexcept
168-
: IgnoreAbsolute(false), IgnoreExternal(false),
169-
IgnoreUndefined(false), IgnoreIndirect(false),
170-
IgnorePreboundUndefined(false), IgnoreSectionDefined(false) {}
160+
bool IgnoreAbsolute : 1 = false;
161+
bool IgnoreExternal : 1 = false;
162+
bool IgnoreUndefined : 1 = false;
163+
bool IgnoreIndirect : 1 = false;
164+
bool IgnorePreboundUndefined : 1 = false;
165+
bool IgnoreSectionDefined : 1 = false;
166+
167+
ParseOptions() noexcept {}
171168
};
172169

173170
SymbolTableEntryCollection &

include/Operations/PrintArchList.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ struct PrintArchListOperation : public Operation {
3131
return (Opt.getKind() == OpKind);
3232
}
3333

34-
Options() noexcept : Operation::Options(OpKind), Verbose(false) {}
35-
bool Verbose : 1;
34+
Options() noexcept : Operation::Options(OpKind) {}
35+
bool Verbose : 1 = false;
3636
};
3737
protected:
3838
Options Options;

include/Operations/PrintBindActionList.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ struct PrintBindActionListOperation : public Operation {
2828
return (Opt.getKind() == OpKind);
2929
}
3030

31-
Options() noexcept : Operation::Options(OpKind), Verbose(false) {}
31+
Options() noexcept : Operation::Options(OpKind) {}
3232

3333
union {
3434
uint8_t PrintAll;
@@ -48,7 +48,7 @@ struct PrintBindActionListOperation : public Operation {
4848
};
4949

5050
std::vector<SortKind> SortKindList;
51-
bool Verbose : 1;
51+
bool Verbose : 1 = false;
5252
};
5353
protected:
5454
Options Options;

include/Operations/PrintBindOpcodeList.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ struct PrintBindOpcodeListOperation : public Operation {
2727
return (Opt.getKind() == OpKind);
2828
}
2929

30-
Options() noexcept : Operation::Options(OpKind), Verbose(false) {}
30+
Options() noexcept : Operation::Options(OpKind) {}
3131

3232
union {
3333
uint8_t PrintAll;
@@ -39,7 +39,7 @@ struct PrintBindOpcodeListOperation : public Operation {
3939
};
4040
};
4141

42-
bool Verbose : 1;
42+
bool Verbose : 1 = false;
4343
};
4444
protected:
4545
Options Options;

include/Operations/PrintBindSymbolList.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ struct PrintBindSymbolListOperation : public Operation {
2828
return (Opt.getKind() == OpKind);
2929
}
3030

31-
Options() noexcept : Operation::Options(OpKind), Verbose(false) {}
31+
Options() noexcept : Operation::Options(OpKind) {}
3232

3333
union {
3434
uint8_t PrintAll;
@@ -46,7 +46,7 @@ struct PrintBindSymbolListOperation : public Operation {
4646
ByType
4747
};
4848

49-
bool Verbose : 1;
49+
bool Verbose : 1 = false;
5050
std::vector<SortKind> SortKindList;
5151
};
5252
protected:

include/Operations/PrintCStringSection.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,10 @@ struct PrintCStringSectionOperation : public Operation {
2727
std::string_view SegmentName;
2828
std::string_view SectionName;
2929

30-
Options() noexcept
31-
: Operation::Options(OpKind), Sort(false), Verbose(false) {}
30+
Options() noexcept : Operation::Options(OpKind) {}
3231

33-
bool Sort : 1;
34-
bool Verbose : 1;
32+
bool Sort : 1 = false;
33+
bool Verbose : 1 = false;
3534
};
3635
protected:
3736
Options Options;

include/Operations/PrintExportTrie.h

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,12 @@ struct PrintExportTrieOperation : public Operation {
4444
}
4545
};
4646

47-
Options() noexcept
48-
: Operation::Options(OpKind), PrintTree(false), OnlyCount(false),
49-
Sort(false), Verbose(false) {}
50-
51-
bool PrintTree : 1;
52-
bool OnlyCount : 1;
53-
bool Sort : 1;
54-
bool Verbose : 1;
47+
Options() noexcept : Operation::Options(OpKind) {}
48+
49+
bool PrintTree : 1 = false;
50+
bool OnlyCount : 1 = false;
51+
bool Sort : 1 = false;
52+
bool Verbose : 1 = false;
5553

5654
std::vector<SegmentSectionPair> SectionRequirements;
5755
std::set<MachO::ExportTrieExportKind> KindRequirements;

0 commit comments

Comments
 (0)