[WebAssembly] Fix inaccurate comments / assertion messages

Reviewers: sbc100

Subscribers: dschuff, jgravelle-google, sunfish, llvm-commits

Differential Revision: https://reviews.llvm.org/D54688

llvm-svn: 347273
This commit is contained in:
Heejin Ahn 2018-11-19 23:31:28 +00:00
parent aeaab9925e
commit 6f4286fb97
3 changed files with 4 additions and 6 deletions

View File

@ -62,7 +62,7 @@ void ObjFile::dumpInfo() const {
// Relocations contain either symbol or type indices. This function takes a
// relocation and returns relocated index (i.e. translates from the input
// sybmol/type space to the output symbol/type space).
// symbol/type space to the output symbol/type space).
uint32_t ObjFile::calcNewIndex(const WasmRelocation &Reloc) const {
if (Reloc.Type == R_WEBASSEMBLY_TYPE_INDEX_LEB) {
assert(TypeIsUsed[Reloc.Index]);

View File

@ -97,6 +97,8 @@ static void reportTypeError(const Symbol *Existing, const InputFile *File,
" in " + toString(File));
}
// Check the type of new symbol matches that of the symbol is replacing.
// For functions this can also involve verifying that the signatures match.
static void checkFunctionType(Symbol *Existing, const InputFile *File,
const WasmSignature *NewSig) {
auto ExistingFunction = dyn_cast<FunctionSymbol>(Existing);
@ -121,8 +123,6 @@ static void checkFunctionType(Symbol *Existing, const InputFile *File,
toString(*NewSig) + " in " + toString(File));
}
// Check the type of new symbol matches that of the symbol is replacing.
// For functions this can also involve verifying that the signatures match.
static void checkGlobalType(const Symbol *Existing, const InputFile *File,
const WasmGlobalType *NewType) {
if (!isa<GlobalSymbol>(Existing)) {

View File

@ -245,8 +245,6 @@ protected:
const WasmGlobalType *GlobalType)
: Symbol(Name, K, Flags, F), GlobalType(GlobalType) {}
// Explicit function type, needed for undefined or synthetic functions only.
// For regular defined globals this information comes from the InputChunk.
const WasmGlobalType *GlobalType;
uint32_t GlobalIndex = INVALID_INDEX;
};
@ -338,7 +336,7 @@ template <typename T, typename... ArgT>
T *replaceSymbol(Symbol *S, ArgT &&... Arg) {
static_assert(std::is_trivially_destructible<T>(),
"Symbol types must be trivially destructible");
static_assert(sizeof(T) <= sizeof(SymbolUnion), "Symbol too small");
static_assert(sizeof(T) <= sizeof(SymbolUnion), "SymbolUnion too small");
static_assert(alignof(T) <= alignof(SymbolUnion),
"SymbolUnion not aligned enough");
assert(static_cast<Symbol *>(static_cast<T *>(nullptr)) == nullptr &&