Subzero: Use C++11 member initializers where practical.
Also change the pattern "foo() {}" into "foo() = default;" for ctors and dtors.
Generally avoids initializing unique_ptr<> members to nullptr in a .h file, because that requires knowing the definition of the underlying class which may not be available to all includers.
BUG= none
R=jpp@chromium.org
Review URL: https://codereview.chromium.org/1197223002
diff --git a/src/IceELFSection.h b/src/IceELFSection.h
index c2ef9bf..ecbf555 100644
--- a/src/IceELFSection.h
+++ b/src/IceELFSection.h
@@ -44,7 +44,7 @@
// incrementally or only after the program is completely defined.
ELFSection(const IceString &Name, Elf64_Word ShType, Elf64_Xword ShFlags,
Elf64_Xword ShAddralign, Elf64_Xword ShEntsize)
- : Name(Name), Header(), Number(NoSectionNumber) {
+ : Name(Name), Header() {
Header.sh_type = ShType;
Header.sh_flags = ShFlags;
Header.sh_addralign = ShAddralign;
@@ -81,7 +81,7 @@
template <bool IsELF64> void writeHeader(ELFStreamer &Str);
protected:
- ~ELFSection() {}
+ ~ELFSection() = default;
// Name of the section in convenient string form (instead of a index
// into the Section Header String Table, which is not known till later).
@@ -92,7 +92,7 @@
Elf64_Shdr Header;
// The number of the section after laying out sections.
- SizeT Number;
+ SizeT Number = NoSectionNumber;
};
// Models text/code sections. Code is written out incrementally and the