uint32_t Index;
WasmGlobalType Type;
WasmInitExpr InitExpr;
- StringRef Name; // from the "linking" or "names" section
+ StringRef SymbolName; // from the "linking" section
};
struct WasmImport {
ArrayRef<uint8_t> Body;
uint32_t CodeSectionOffset;
uint32_t Size;
- StringRef Name; // from the "linking" or "names" section
+ StringRef SymbolName; // from the "linking" section
+ StringRef DebugName; // from the "name" section
uint32_t Comdat; // from the "comdat info" section
};
uint32_t MemoryIndex;
WasmInitExpr Offset;
ArrayRef<uint8_t> Content;
- StringRef Name;
+ StringRef Name; // from the "segment info" section
uint32_t Alignment;
uint32_t Flags;
uint32_t Comdat; // from the "comdat info" section
uint8_t Kind;
uint32_t Flags;
union {
- // For function or global symbols, the index in function of global index
+ // For function or global symbols, the index in function or global index
// space.
uint32_t ElementIndex;
// For a data symbols, the address of the data relative to segment.
return make_error<GenericBinaryError>("Invalid name entry",
object_error::parse_failed);
DebugNames.push_back(wasm::WasmFunctionName{Index, Name});
- if (isDefinedFunctionIndex(Index)) {
- // Override any existing name; the name specified by the "names"
- // section is the Function's canonical name.
- getDefinedFunction(Index).Name = Name;
- }
+ if (isDefinedFunctionIndex(Index))
+ getDefinedFunction(Index).DebugName = Name;
}
break;
}
unsigned FuncIndex = Info.ElementIndex - NumImportedFunctions;
FunctionType = &Signatures[FunctionTypes[FuncIndex]];
wasm::WasmFunction &Function = Functions[FuncIndex];
- if (Function.Name.empty()) {
- // Use the symbol's name to set a name for the Function, but only if
- // one hasn't already been set.
- Function.Name = Info.Name;
- }
+ if (Function.SymbolName.empty())
+ Function.SymbolName = Info.Name;
} else {
wasm::WasmImport &Import = *ImportedFunctions[Info.ElementIndex];
FunctionType = &Signatures[Import.SigIndex];
unsigned GlobalIndex = Info.ElementIndex - NumImportedGlobals;
wasm::WasmGlobal &Global = Globals[GlobalIndex];
GlobalType = &Global.Type;
- if (Global.Name.empty()) {
- // Use the symbol's name to set a name for the Global, but only if
- // one hasn't already been set.
- Global.Name = Info.Name;
- }
+ if (Global.SymbolName.empty())
+ Global.SymbolName = Info.Name;
} else {
wasm::WasmImport &Import = *ImportedGlobals[Info.ElementIndex];
Info.Name = Import.Field;