From cefbbfadae87135ff37fb4fc1058c6baf8de0140 Mon Sep 17 00:00:00 2001 From: Yury Delendik Date: Mon, 17 Sep 2018 10:05:43 -0500 Subject: Add debug information locations to the function prolog/epilog (#1674) The current patch: * Preserves the debug locations from function prolog and epilog * Preserves the debug locations of the nested blocks --- src/wasm-s-parser.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/wasm-s-parser.h') diff --git a/src/wasm-s-parser.h b/src/wasm-s-parser.h index 02a20b651..d492d0c3c 100644 --- a/src/wasm-s-parser.h +++ b/src/wasm-s-parser.h @@ -51,7 +51,7 @@ class Element { bool quoted_; public: - Element(MixedArena& allocator) : isList_(true), list_(allocator), line(-1), col(-1), loc(nullptr) {} + Element(MixedArena& allocator) : isList_(true), list_(allocator), line(-1), col(-1), startLoc(nullptr), endLoc(nullptr) {} bool isList() const { return isList_; } bool isStr() const { return !isList_; } @@ -59,7 +59,9 @@ public: bool quoted() const { return isStr() && quoted_; } size_t line, col; - SourceLocation* loc; + // original locations at the start/end of the S-Expression list + SourceLocation* startLoc; + SourceLocation* endLoc; // list methods List& list(); @@ -72,7 +74,7 @@ public: cashew::IString str() const; const char* c_str() const; Element* setString(cashew::IString str__, bool dollared__, bool quoted__); - Element* setMetadata(size_t line_, size_t col_, SourceLocation* loc_); + Element* setMetadata(size_t line_, size_t col_, SourceLocation* startLoc_); // printing friend std::ostream& operator<<(std::ostream& o, Element& e); @@ -218,6 +220,8 @@ private: void parseElem(Element& s); void parseInnerElem(Element& s, Index i = 1, Expression* offset = nullptr); void parseType(Element& s); + + Function::DebugLocation getDebugLocation(const SourceLocation& loc); }; } // namespace wasm -- cgit v1.2.3