diff options
author | Alon Zakai <azakai@google.com> | 2019-04-26 16:59:41 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-26 16:59:41 -0700 |
commit | db9124f1de0478dcac525009b6f1589b44a7edd8 (patch) | |
tree | fa26395a0f6cca53cf5cb6e10189f989c5bfa847 /src/wasm-s-parser.h | |
parent | 87636dccd404a340d75acb1d96301581343f29ca (diff) | |
download | binaryen-db9124f1de0478dcac525009b6f1589b44a7edd8.tar.gz binaryen-db9124f1de0478dcac525009b6f1589b44a7edd8.tar.bz2 binaryen-db9124f1de0478dcac525009b6f1589b44a7edd8.zip |
Apply format changes from #2048 (#2059)
Mass change to apply clang-format to everything. We are applying this in a PR by me so the (git) blame is all mine ;) but @aheejin did all the work to get clang-format set up and all the manual work to tidy up some things to make the output nicer in #2048
Diffstat (limited to 'src/wasm-s-parser.h')
-rw-r--r-- | src/wasm-s-parser.h | 54 |
1 files changed, 28 insertions, 26 deletions
diff --git a/src/wasm-s-parser.h b/src/wasm-s-parser.h index 295e6b6c9..004fd9840 100644 --- a/src/wasm-s-parser.h +++ b/src/wasm-s-parser.h @@ -22,20 +22,21 @@ #ifndef wasm_wasm_s_parser_h #define wasm_wasm_s_parser_h -#include "wasm.h" #include "mixed_arena.h" #include "parsing.h" // for UniqueNameMapper. TODO: move dependency to cpp file? +#include "wasm.h" namespace wasm { -class SourceLocation -{ +class SourceLocation { public: cashew::IString filename; uint32_t line; uint32_t column; - SourceLocation(cashew::IString filename_, uint32_t line_, uint32_t column_ = 0) - : filename(filename_), line(line_), column(column_) {} + SourceLocation(cashew::IString filename_, + uint32_t line_, + uint32_t column_ = 0) + : filename(filename_), line(line_), column(column_) {} }; // @@ -59,7 +60,7 @@ public: bool quoted() const { return isStr() && quoted_; } size_t line = -1; - size_t col = -1; + size_t col = -1; // original locations at the start/end of the S-Expression list SourceLocation* startLoc = nullptr; SourceLocation* endLoc = nullptr; @@ -67,9 +68,7 @@ public: // list methods List& list(); Element* operator[](unsigned i); - size_t size() { - return list().size(); - } + size_t size() { return list().size(); } // string methods cashew::IString str() const; @@ -116,15 +115,19 @@ class SExpressionWasmBuilder { std::vector<Name> globalNames; int functionCounter; int globalCounter = 0; - std::map<Name, Type> functionTypes; // we need to know function return types before we parse their contents + // we need to know function return types before we parse their contents + std::map<Name, Type> functionTypes; std::unordered_map<cashew::IString, Index> debugInfoFileIndices; public: // Assumes control of and modifies the input. - SExpressionWasmBuilder(Module& wasm, Element& module, Name* moduleName = nullptr); + SExpressionWasmBuilder(Module& wasm, + Element& module, + Name* moduleName = nullptr); private: - // pre-parse types and function definitions, so we know function return types before parsing their contents + // pre-parse types and function definitions, so we know function return types + // before parsing their contents void preParseFunctionType(Element& s); bool isImport(Element& curr); void preParseImports(Element& curr); @@ -142,30 +145,27 @@ private: Name getFunctionName(Element& s); Name getFunctionTypeName(Element& s); Name getGlobalName(Element& s); - void parseStart(Element& s) { wasm.addStart(getFunctionName(*s[1]));} + void parseStart(Element& s) { wasm.addStart(getFunctionName(*s[1])); } // returns the next index in s size_t parseFunctionNames(Element& s, Name& name, Name& exportName); void parseFunction(Element& s, bool preParseImport = false); - Type stringToType(cashew::IString str, bool allowError=false, bool prefix=false) { + Type stringToType(cashew::IString str, + bool allowError = false, + bool prefix = false) { return stringToType(str.str, allowError, prefix); } - Type stringToType(const char* str, bool allowError=false, bool prefix=false); + Type + stringToType(const char* str, bool allowError = false, bool prefix = false); Type stringToLaneType(const char* str); - bool isType(cashew::IString str) { - return stringToType(str, true) != none; - } + bool isType(cashew::IString str) { return stringToType(str, true) != none; } public: - Expression* parseExpression(Element* s) { - return parseExpression(*s); - } + Expression* parseExpression(Element* s) { return parseExpression(*s); } Expression* parseExpression(Element& s); - MixedArena& getAllocator() { - return allocator; - } + MixedArena& getAllocator() { return allocator; } private: Expression* makeExpression(Element& s); @@ -188,8 +188,10 @@ private: Expression* makeLoad(Element& s, Type type, bool isAtomic); Expression* makeStore(Element& s, Type type, bool isAtomic); Expression* makeAtomicRMWOrCmpxchg(Element& s, Type type); - Expression* makeAtomicRMW(Element& s, Type type, uint8_t bytes, const char* extra); - Expression* makeAtomicCmpxchg(Element& s, Type type, uint8_t bytes, const char* extra); + Expression* + makeAtomicRMW(Element& s, Type type, uint8_t bytes, const char* extra); + Expression* + makeAtomicCmpxchg(Element& s, Type type, uint8_t bytes, const char* extra); Expression* makeAtomicWait(Element& s, Type type); Expression* makeAtomicNotify(Element& s); Expression* makeSIMDExtract(Element& s, SIMDExtractOp op, size_t lanes); |