summaryrefslogtreecommitdiff
path: root/src/support
diff options
context:
space:
mode:
Diffstat (limited to 'src/support')
-rw-r--r--src/support/bits.cpp8
-rw-r--r--src/support/bits.h8
-rw-r--r--src/support/colors.h2
-rw-r--r--src/support/path.cpp8
-rw-r--r--src/support/path.h8
-rw-r--r--src/support/space.h4
-rw-r--r--src/support/string.h9
7 files changed, 14 insertions, 33 deletions
diff --git a/src/support/bits.cpp b/src/support/bits.cpp
index 749e6fb54..aa24edadb 100644
--- a/src/support/bits.cpp
+++ b/src/support/bits.cpp
@@ -22,9 +22,7 @@
#include <intrin.h>
#endif
-namespace wasm {
-
-namespace Bits {
+namespace wasm::Bits {
int popCount(uint8_t v) {
// Small table lookup.
@@ -198,6 +196,4 @@ uint32_t log2(uint32_t v) {
uint32_t pow2(uint32_t v) { return v < 32 ? 1 << v : 0; }
-} // namespace Bits
-
-} // namespace wasm
+} // namespace wasm::Bits
diff --git a/src/support/bits.h b/src/support/bits.h
index a34bc5067..9c68a7a15 100644
--- a/src/support/bits.h
+++ b/src/support/bits.h
@@ -31,9 +31,7 @@
* avoiding implementations with large lookup tables.
*/
-namespace wasm {
-
-namespace Bits {
+namespace wasm::Bits {
int popCount(uint8_t);
int popCount(uint16_t);
@@ -96,8 +94,6 @@ template<typename T, typename U> inline static T rotateRight(T val, U count) {
uint32_t log2(uint32_t v);
uint32_t pow2(uint32_t v);
-} // namespace Bits
-
-} // namespace wasm
+} // namespace wasm::Bits
#endif // wasm_support_bits_h
diff --git a/src/support/colors.h b/src/support/colors.h
index f2c446025..ec6147842 100644
--- a/src/support/colors.h
+++ b/src/support/colors.h
@@ -20,6 +20,7 @@
#include <iosfwd>
namespace Colors {
+
void setEnabled(bool enabled);
bool isEnabled();
@@ -58,6 +59,7 @@ inline void green(std::ostream& stream) {}
inline void blue(std::ostream& stream) {}
inline void bold(std::ostream& stream) {}
#endif
+
} // namespace Colors
#endif // wasm_support_color_h
diff --git a/src/support/path.cpp b/src/support/path.cpp
index 1cf5c736d..d3f5075c2 100644
--- a/src/support/path.cpp
+++ b/src/support/path.cpp
@@ -20,9 +20,7 @@
#include "support/path.h"
-namespace wasm {
-
-namespace Path {
+namespace wasm::Path {
char getPathSeparator() {
// TODO: use c++17's path separator
@@ -93,6 +91,4 @@ std::string getBinaryenBinaryTool(const std::string& name) {
return getBinaryenBinDir() + name;
}
-} // namespace Path
-
-} // namespace wasm
+} // namespace wasm::Path
diff --git a/src/support/path.h b/src/support/path.h
index e9f675142..78e85ca5c 100644
--- a/src/support/path.h
+++ b/src/support/path.h
@@ -24,9 +24,7 @@
#include <cstdlib>
#include <string>
-namespace wasm {
-
-namespace Path {
+namespace wasm::Path {
char getPathSeparator();
std::string getDirName(const std::string& path);
@@ -44,8 +42,6 @@ void setBinaryenBinDir(const std::string& dir);
// Gets the path to a binaryen binary tool, like wasm-opt.
std::string getBinaryenBinaryTool(const std::string& name);
-} // namespace Path
-
-} // namespace wasm
+} // namespace wasm::Path
#endif // wasm_support_path_h
diff --git a/src/support/space.h b/src/support/space.h
index 9d940c872..a132d986b 100644
--- a/src/support/space.h
+++ b/src/support/space.h
@@ -48,9 +48,7 @@ struct DisjointSpans {
// Insert the new span. We can then find its predecessor and successor.
// They are disjoint by assumption, so the question is then does the new
// span overlap with them, or not.
- decltype(spans)::iterator iter;
- bool inserted;
- std::tie(iter, inserted) = spans.insert(span);
+ auto [iter, inserted] = spans.insert(span);
if (!inserted) {
// This exact span was already there, so there is definite overlap.
return true;
diff --git a/src/support/string.h b/src/support/string.h
index 120835b80..a73121f6b 100644
--- a/src/support/string.h
+++ b/src/support/string.h
@@ -22,13 +22,12 @@
#define wasm_support_string_h
#include "support/utilities.h"
+#include <algorithm>
#include <cctype>
#include <string>
#include <vector>
-namespace wasm {
-
-namespace String {
+namespace wasm::String {
// Creates a vector of the split parts of a string, by a delimiter.
class Split : public std::vector<std::string> {
@@ -120,8 +119,6 @@ inline bool isNumber(const std::string& str) {
return !str.empty() && std::all_of(str.begin(), str.end(), ::isdigit);
}
-} // namespace String
-
-} // namespace wasm
+} // namespace wasm::String
#endif // wasm_support_string_h