summaryrefslogtreecommitdiffstats
path: root/lld/wasm/Symbols.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lld/wasm/Symbols.cpp')
-rw-r--r--lld/wasm/Symbols.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/lld/wasm/Symbols.cpp b/lld/wasm/Symbols.cpp
index 07b895a2e67..284fafddfe5 100644
--- a/lld/wasm/Symbols.cpp
+++ b/lld/wasm/Symbols.cpp
@@ -63,6 +63,12 @@ InputChunk *Symbol::getChunk() const {
return nullptr;
}
+bool Symbol::isDiscarded() const {
+ if (InputChunk *C = getChunk())
+ return C->Discarded;
+ return false;
+}
+
bool Symbol::isLive() const {
if (auto *G = dyn_cast<DefinedGlobal>(this))
return G->Global->Live;
@@ -74,6 +80,7 @@ bool Symbol::isLive() const {
}
void Symbol::markLive() {
+ assert(!isDiscarded());
if (auto *G = dyn_cast<DefinedGlobal>(this))
G->Global->Live = true;
if (auto *E = dyn_cast<DefinedEvent>(this))
OpenPOWER on IntegriCloud