summaryrefslogtreecommitdiff
path: root/src/support
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2019-01-15 13:20:05 -0800
committerGitHub <noreply@github.com>2019-01-15 13:20:05 -0800
commitd24427dcc8cd6e0dbcd8c302eb2e8a5d0d6fdead (patch)
tree37575895001e5dd9509c5c42fd539253516e21fd /src/support
parent45714b5fc6cf14c112bc4f188aca427464ab69d8 (diff)
downloadbinaryen-d24427dcc8cd6e0dbcd8c302eb2e8a5d0d6fdead.tar.gz
binaryen-d24427dcc8cd6e0dbcd8c302eb2e8a5d0d6fdead.tar.bz2
binaryen-d24427dcc8cd6e0dbcd8c302eb2e8a5d0d6fdead.zip
Code style improvements (#1868)
* Use modern T p = v; notation to initialize class fields * Use modern X() = default; notation for empty class constructors
Diffstat (limited to 'src/support')
-rw-r--r--src/support/archive.h2
-rw-r--r--src/support/json.h8
-rw-r--r--src/support/sorted_vector.h2
3 files changed, 6 insertions, 6 deletions
diff --git a/src/support/archive.h b/src/support/archive.h
index 95af1ac94..0ca066ff1 100644
--- a/src/support/archive.h
+++ b/src/support/archive.h
@@ -71,7 +71,7 @@ class Archive {
Child child;
bool error = false; // TODO: use std::error_code instead?
public:
- child_iterator() {}
+ child_iterator() = default;
explicit child_iterator(bool error) : error(error) {}
child_iterator(const Child& c) : child(c) {}
const Child* operator->() const { return &child; }
diff --git a/src/support/json.h b/src/support/json.h
index 034cdc9b9..7ffa1211f 100644
--- a/src/support/json.h
+++ b/src/support/json.h
@@ -47,7 +47,7 @@ typedef cashew::IString IString;
// Main value type
struct Value {
struct Ref : public std::shared_ptr<Value> {
- Ref() : std::shared_ptr<Value>() {}
+ Ref() = default;
Ref(Value* value) : std::shared_ptr<Value>(value) {}
Ref& operator[](size_t x) {
@@ -67,7 +67,7 @@ struct Value {
Object = 5,
};
- Type type;
+ Type type = Null;
typedef std::vector<Ref> ArrayStorage;
typedef std::unordered_map<IString, Ref> ObjectStorage;
@@ -79,7 +79,7 @@ struct Value {
#ifndef _MSC_VER
IString str;
#endif
- double num;
+ double num = 0;
ArrayStorage *arr; // manually allocated/freed
bool boo;
ObjectStorage *obj; // manually allocated/freed
@@ -87,7 +87,7 @@ struct Value {
};
// constructors all copy their input
- Value() : type(Null), num(0) {}
+ Value() {}
explicit Value(const char *s) : type(Null) {
setString(s);
}
diff --git a/src/support/sorted_vector.h b/src/support/sorted_vector.h
index 8f33de03a..da991ce78 100644
--- a/src/support/sorted_vector.h
+++ b/src/support/sorted_vector.h
@@ -26,7 +26,7 @@
namespace wasm {
struct SortedVector : public std::vector<Index> {
- SortedVector() {}
+ SortedVector() = default;
SortedVector merge(const SortedVector& other) const {
SortedVector ret;