Skip to content

Commit 5274d94

Browse files
authored
standardize on 'template<' over 'template <' (i.e., remove a space) (WebAssembly#1782)
1 parent 0b42563 commit 5274d94

18 files changed

Lines changed: 33 additions & 32 deletions

.clang-format

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ ColumnLimit: 100
55
ContinuationIndentWidth: 2
66
ConstructorInitializerIndentWidth: 2
77
AlignAfterOpenBracket: DontAlign
8+
SpaceAfterTemplateKeyword: false

src/cfg/Relooper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
namespace CFG {
3131

32-
template <class T, class U> static bool contains(const T& container, const U& contained) {
32+
template<class T, class U> static bool contains(const T& container, const U& contained) {
3333
return !!container.count(contained);
3434
}
3535

src/emscripten-optimizer/istring.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,13 +157,13 @@ struct IString {
157157

158158
namespace std {
159159

160-
template <> struct hash<cashew::IString> : public unary_function<cashew::IString, size_t> {
160+
template<> struct hash<cashew::IString> : public unary_function<cashew::IString, size_t> {
161161
size_t operator()(const cashew::IString& str) const {
162162
return std::hash<size_t>{}(size_t(str.str));
163163
}
164164
};
165165

166-
template <> struct equal_to<cashew::IString> : public binary_function<cashew::IString, cashew::IString, bool> {
166+
template<> struct equal_to<cashew::IString> : public binary_function<cashew::IString, cashew::IString, bool> {
167167
bool operator()(const cashew::IString& x, const cashew::IString& y) const {
168168
return x == y;
169169
}

src/emscripten-optimizer/simple_ast.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ struct TraverseInfo {
195195
int index;
196196
};
197197

198-
template <class T, int init>
198+
template<class T, int init>
199199
struct StackedStack { // a stack, on the stack
200200
T stackStorage[init];
201201
T* storage;

src/mixed_arena.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ struct MixedArena {
158158
//
159159
// TODO: specialize on the initial size of the array
160160

161-
template <typename SubType, typename T>
161+
template<typename SubType, typename T>
162162
class ArenaVectorBase {
163163
protected:
164164
T* data = nullptr;
@@ -321,7 +321,7 @@ class ArenaVectorBase {
321321
// passed in when needed, would make this (and thus Blocks etc.
322322
// smaller)
323323

324-
template <typename T>
324+
template<typename T>
325325
class ArenaVector : public ArenaVectorBase<ArenaVector<T>, T> {
326326
private:
327327
MixedArena& allocator;

src/pass.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ class Pass {
262262
// Core pass class that uses AST walking. This class can be parameterized by
263263
// different types of AST walkers.
264264
//
265-
template <typename WalkerType>
265+
template<typename WalkerType>
266266
class WalkerPass : public Pass, public WalkerType {
267267
PassRunner *runner;
268268

src/passes/I64ToI32Lowering.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ struct I64ToI32Lowering : public WalkerPass<PostWalker<I64ToI32Lowering>> {
236236
}
237237

238238
// If and Select have identical code
239-
template <typename T>
239+
template<typename T>
240240
void visitBranching(T* curr) {
241241
if (!hasOutParam(curr->ifTrue)) return;
242242
assert(curr->ifFalse != nullptr && "Nullable ifFalse found");
@@ -323,10 +323,10 @@ struct I64ToI32Lowering : public WalkerPass<PostWalker<I64ToI32Lowering>> {
323323
replaceCurrent(result);
324324
}
325325

326-
template <typename T>
326+
template<typename T>
327327
using BuilderFunc = std::function<T*(std::vector<Expression*>&, Type)>;
328328

329-
template <typename T>
329+
template<typename T>
330330
void visitGenericCall(T* curr, BuilderFunc<T> callBuilder) {
331331
std::vector<Expression*> args;
332332
for (auto* e : curr->operands) {

src/passes/TrapMode.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ Function* generateBinaryFunc(Module& wasm, Binary *curr) {
125125
return func;
126126
}
127127

128-
template <typename IntType, typename FloatType>
128+
template<typename IntType, typename FloatType>
129129
void makeClampLimitLiterals(Literal& iMin, Literal& fMin, Literal& fMax) {
130130
IntType minVal = std::numeric_limits<IntType>::min();
131131
IntType maxVal = std::numeric_limits<IntType>::max();

src/shell-interface.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ struct ShellExternalInterface final : ModuleInstance::ExternalInterface {
4444
class Memory {
4545
// Use char because it doesn't run afoul of aliasing rules.
4646
std::vector<char> memory;
47-
template <typename T>
47+
template<typename T>
4848
static bool aligned(const char* address) {
4949
static_assert(!(sizeof(T) & (sizeof(T) - 1)), "must be a power of 2");
5050
return 0 == (reinterpret_cast<uintptr_t>(address) & (sizeof(T) - 1));
@@ -68,15 +68,15 @@ struct ShellExternalInterface final : ModuleInstance::ExternalInterface {
6868
std::memset(&memory[newSize], 0, minSize - newSize);
6969
}
7070
}
71-
template <typename T>
71+
template<typename T>
7272
void set(size_t address, T value) {
7373
if (aligned<T>(&memory[address])) {
7474
*reinterpret_cast<T*>(&memory[address]) = value;
7575
} else {
7676
std::memcpy(&memory[address], &value, sizeof(T));
7777
}
7878
}
79-
template <typename T>
79+
template<typename T>
8080
T get(size_t address) {
8181
if (aligned<T>(&memory[address])) {
8282
return *reinterpret_cast<T*>(&memory[address]);

src/support/bits.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,30 +56,30 @@ extern template int CountLeadingZeroes(uint64_t);
5656

5757
// Convenience signed -> unsigned. It usually doesn't make much sense to use bit
5858
// functions on signed types.
59-
template <typename T>
59+
template<typename T>
6060
int PopCount(T v) {
6161
return PopCount(typename std::make_unsigned<T>::type(v));
6262
}
63-
template <typename T>
63+
template<typename T>
6464
int CountTrailingZeroes(T v) {
6565
return CountTrailingZeroes(typename std::make_unsigned<T>::type(v));
6666
}
67-
template <typename T>
67+
template<typename T>
6868
int CountLeadingZeroes(T v) {
6969
return CountLeadingZeroes(typename std::make_unsigned<T>::type(v));
7070
}
71-
template <typename T>
71+
template<typename T>
7272
bool IsPowerOf2(T v) {
7373
return v != 0 && PopCount(v) == 1;
7474
}
7575

76-
template <typename T, typename U>
76+
template<typename T, typename U>
7777
inline static T RotateLeft(T val, U count) {
7878
T mask = sizeof(T) * CHAR_BIT - 1;
7979
count &= mask;
8080
return (val << count) | (val >> (-count & mask));
8181
}
82-
template <typename T, typename U>
82+
template<typename T, typename U>
8383
inline static T RotateRight(T val, U count) {
8484
T mask = sizeof(T) * CHAR_BIT - 1;
8585
count &= mask;

0 commit comments

Comments
 (0)