diff options
author | Nicholas Wilson <nicholas@nicholaswilson.me.uk> | 2018-03-12 16:04:04 +0000 |
---|---|---|
committer | Nicholas Wilson <nicholas@nicholaswilson.me.uk> | 2018-03-12 16:04:04 +0000 |
commit | 0185281ad1750c7b0b52bdd76f098eb80de798b9 (patch) | |
tree | 3b74947fb9a5b044e1be03610270a99b9f6255a9 /lld/wasm/Writer.cpp | |
parent | 6f01e654b4cea9a641f495211373e2a39938ec50 (diff) | |
download | bcm5719-llvm-0185281ad1750c7b0b52bdd76f098eb80de798b9.tar.gz bcm5719-llvm-0185281ad1750c7b0b52bdd76f098eb80de798b9.zip |
[WebAssembly] Add test for imported ctor and fix indexing bug found
This bug was found by accident while trying to expand out testcases
for imported symbols, and is covered by the additional test case.
Differential Revision: https://reviews.llvm.org/D44331
llvm-svn: 327290
Diffstat (limited to 'lld/wasm/Writer.cpp')
-rw-r--r-- | lld/wasm/Writer.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/lld/wasm/Writer.cpp b/lld/wasm/Writer.cpp index dc2210b1146..b5eafe5abdd 100644 --- a/lld/wasm/Writer.cpp +++ b/lld/wasm/Writer.cpp @@ -657,12 +657,11 @@ void Writer::calculateImports() { continue; DEBUG(dbgs() << "import: " << Sym->getName() << "\n"); - Sym->setOutputIndex(ImportedSymbols.size()); ImportedSymbols.emplace_back(Sym); if (isa<FunctionSymbol>(Sym)) - ++NumImportedFunctions; + Sym->setOutputIndex(NumImportedFunctions++); else - ++NumImportedGlobals; + Sym->setOutputIndex(NumImportedGlobals++); } } |