STYLE: Use default member initialization

Converts a default constructor’s member initializers into the new
default member initializers in C++11. Other member initializers that match the
default member initializer are removed. This can reduce repeated code or allow
use of ‘= default’.

SRCDIR=/Users/johnsonhj/src/jsoncpp/ #My local SRC
BLDDIR=/Users/johnsonhj/src/jsoncpp/cmake-build-debug/ #My local BLD

cd /Users/johnsonhj/src/jsoncpp/cmake-build-debug/
run-clang-tidy.py -extra-arg=-D__clang__ -checks=-*,modernize-use-default-member-init  -header-filter=.* -fix
This commit is contained in:
Hans Johnson
2019-01-14 17:09:22 -06:00
committed by Hans Johnson
parent b5093e8122
commit e817e4fc25
11 changed files with 48 additions and 51 deletions

View File

@@ -60,8 +60,7 @@ typedef std::auto_ptr<CharReader> CharReaderPtr;
// ////////////////////////////////
Features::Features()
: allowComments_(true), strictRoot_(false),
allowDroppedNullPlaceholders_(false), allowNumericKeys_(false) {}
{}
Features Features::all() { return {}; }

View File

@@ -233,7 +233,7 @@ JSONCPP_NORETURN void throwLogicError(JSONCPP_STRING const& msg) {
// //////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////
Value::CommentInfo::CommentInfo() : comment_(nullptr) {}
Value::CommentInfo::CommentInfo() {}
Value::CommentInfo::~CommentInfo() {
if (comment_)
@@ -1575,7 +1575,7 @@ Value::iterator Value::end() {
// class PathArgument
// //////////////////////////////////////////////////////////////////
PathArgument::PathArgument() : key_(), index_(), kind_(kindNone) {}
PathArgument::PathArgument() : key_() {}
PathArgument::PathArgument(ArrayIndex index)
: key_(), index_(index), kind_(kindIndex) {}

View File

@@ -16,7 +16,7 @@ namespace Json {
// //////////////////////////////////////////////////////////////////
ValueIteratorBase::ValueIteratorBase()
: current_(), isNull_(true) {
: current_() {
}
ValueIteratorBase::ValueIteratorBase(

View File

@@ -352,8 +352,8 @@ Writer::~Writer() {}
// //////////////////////////////////////////////////////////////////
FastWriter::FastWriter()
: yamlCompatibilityEnabled_(false), dropNullPlaceholders_(false),
omitEndingLineFeed_(false) {}
{}
void FastWriter::enableYAMLCompatibility() { yamlCompatibilityEnabled_ = true; }
@@ -428,7 +428,7 @@ void FastWriter::writeValue(const Value& value) {
// //////////////////////////////////////////////////////////////////
StyledWriter::StyledWriter()
: rightMargin_(74), indentSize_(3), addChildValues_(false) {}
{}
JSONCPP_STRING StyledWriter::write(const Value& root) {
document_.clear();