diff options
| author | Nicholas Wilson <nicholas@nicholaswilson.me.uk> | 2018-04-20 17:28:12 +0000 |
|---|---|---|
| committer | Nicholas Wilson <nicholas@nicholaswilson.me.uk> | 2018-04-20 17:28:12 +0000 |
| commit | 358af38d37da648a0829d554c5242b68e7eb5002 (patch) | |
| tree | a7431b5eaa7329ce2e2696baf0d0ce9bbd44a723 /lld/wasm/InputGlobal.h | |
| parent | 3a1b697d6e4ae861ef23965e2d4948aeb5b065b0 (diff) | |
| download | bcm5719-llvm-358af38d37da648a0829d554c5242b68e7eb5002.tar.gz bcm5719-llvm-358af38d37da648a0829d554c5242b68e7eb5002.zip | |
[WebAssembly] Implement -print-gc-sections, to better test GC of globals
Differential Revision: https://reviews.llvm.org/D44311
llvm-svn: 330456
Diffstat (limited to 'lld/wasm/InputGlobal.h')
| -rw-r--r-- | lld/wasm/InputGlobal.h | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lld/wasm/InputGlobal.h b/lld/wasm/InputGlobal.h index 16a6b7dd689..37d0ab90370 100644 --- a/lld/wasm/InputGlobal.h +++ b/lld/wasm/InputGlobal.h @@ -26,8 +26,10 @@ namespace wasm { // combined to form the final GLOBALS section. class InputGlobal { public: - InputGlobal(const WasmGlobal &G) : Global(G) {} + InputGlobal(const WasmGlobal &G, ObjFile *F) + : File(F), Global(G), Live(!Config->GcSections) {} + StringRef getName() const { return Global.SymbolName; } const WasmGlobalType &getType() const { return Global.Type; } uint32_t getGlobalIndex() const { return GlobalIndex.getValue(); } @@ -37,16 +39,21 @@ public: GlobalIndex = Index; } - bool Live = false; - + ObjFile *File; WasmGlobal Global; + bool Live = false; + protected: llvm::Optional<uint32_t> GlobalIndex; }; } // namespace wasm +inline std::string toString(const wasm::InputGlobal *G) { + return (toString(G->File) + ":(" + G->getName() + ")").str(); +} + } // namespace lld #endif // LLD_WASM_INPUT_GLOBAL_H |

