This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] Remove unneeded Chunk::getFileName() method. NFC.
ClosedPublic

Authored by sbc100 on Feb 16 2018, 12:43 PM.

Diff Detail

Repository
rL LLVM

Event Timeline

sbc100 created this revision.Feb 16 2018, 12:43 PM
sbc100 added a reviewer: ruiu.Feb 16 2018, 3:37 PM
ruiu accepted this revision.Feb 16 2018, 3:40 PM

LGTM

But I believe a better way of doing this kind of stuff is to define toString(InputChunk *). toString() function is a common interface to stringize objects to create debug messages.

This revision is now accepted and ready to land.Feb 16 2018, 3:40 PM

LGTM

But I believe a better way of doing this kind of stuff is to define toString(InputChunk *). toString() function is a common interface to stringize objects to create debug messages.

But in this case the only user actually wants the filename on its own.. not the string description of the chunk. (ELF does basically exactly the same thing here BTW)

This revision was automatically updated to reflect the committed changes.
ruiu added a comment.Feb 16 2018, 3:58 PM

Good observation, but I think we should use toString() in ELF too. toString() is there for you so that you don't need to construct a string like this, and doing this is error-prone. In this case, if file foo.o is in bar.a, toString generates something like

bar.a(foo.o):(.text)

while this string construction generates a string like

'.text' in file 'foo.o'

which isn't very helpful if you don't know which file foo.o is in.