[PATCH] D43112: [WebAssembly] Use Symbol class heirarchy. NFC.
Sam Clegg via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 9 16:23:33 PST 2018
sbc100 added inline comments.
================
Comment at: wasm/InputFiles.h:111
+ FunctionSymbol *getFunctionSymbol(uint32_t Index) const {
+ return cast<FunctionSymbol>(FunctionSymbols[Index]);
}
----------------
ruiu wrote:
> Can you make this type safe? I.e. can you change the type of FunctionSymbols so that you don't need to use cast?
Hmm... i just tried it and realized why I didn't do it like this in the first place.
The problem is that FunctionSymbols is constructed as we parse the object, and before all symbols have been resolved, and at that time archive symbols are Lazy... and will eventually transform in the DefinedFunction symbols or DefinedGlobal symbols. And Lazy symbol can't be cast to either of those types.
I could perhaps work around this by delaying the construction of this vector, or perhaps by introducing a LazyGlobal and LazyFunction subtype?
Repository:
rLLD LLVM Linker
https://reviews.llvm.org/D43112
More information about the llvm-commits
mailing list