This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] Add support for response file parsing
ClosedPublic

Authored by sbc100 on May 29 2018, 3:05 PM.

Event Timeline

sbc100 created this revision.May 29 2018, 3:05 PM
sbc100 edited the summary of this revision. (Show Details)May 29 2018, 3:06 PM
alexcrichton accepted this revision.May 29 2018, 3:12 PM

Awesome, thanks for the quick fix!

This revision is now accepted and ready to land.May 29 2018, 3:12 PM
ruiu added inline comments.May 29 2018, 4:09 PM
wasm/Options.td
76–77 ↗(On Diff #148991)

Do you really need to support both Windows and Unix-style quoting rules? IMO Windows' quoting rule is pretty hairly, and you should always use Unix-style quoting rule if possible. Since you are the only generator who create response files, you can just create response files in Unix style, no?

sbc100 added inline comments.May 29 2018, 4:17 PM
wasm/Options.td
76–77 ↗(On Diff #148991)

My understanding is that the higher level toolchain driver can generate a repsonse file. e.g. visual studio CMake, or ninja? I would have thought that we want to at least use windows quoting when running on windows even if we don't really need to the command line flag.

Perhaps you are right though and we should add this if and when we get our first windows user who wants to include unquoted filenames.

Also, I'm not sure why you mention complexity is an issue. We are not generating these files, only consuming them and it seems that llvm already handle both types of quoting.

ruiu added inline comments.May 29 2018, 4:38 PM
wasm/Options.td
76–77 ↗(On Diff #148991)

I'd support only Unix-style first. We can support Windows-style quoting later when it is proved to be needed.

As to the complexity, adding a new command line option or a new feature always adds some complexity. Once we start supporting some feature, we'll have to support it virtually forever. Also, by adding this option, you allow users to write response files in two different styles, whose default choice depends on your platform. It is not hard to imagine that that could theoretically allow you to write code that works on your platform but doesn't on the other. Having less number of moving parts is generally preferred.

sbc100 updated this revision to Diff 149027.May 29 2018, 7:57 PM
  • feedback
sbc100 marked an inline comment as done.May 29 2018, 7:57 PM
ruiu added inline comments.May 29 2018, 8:07 PM
wasm/Driver.cpp
149

I think you should add ExpandResponseFiles before this line.

sbc100 added inline comments.May 29 2018, 8:35 PM
wasm/Driver.cpp
149

ParseArgs is called twice, once before and once after. This is the how COFF and ELF do it too.

ruiu added inline comments.May 29 2018, 8:42 PM
wasm/Driver.cpp
149

But you don't need to cargo-cult that, no?

sbc100 updated this revision to Diff 149032.May 29 2018, 8:48 PM
  • feedback
wasm/Driver.cpp
149

Oh, sorry yes. The double parsing is only needed in order to handle OPT_rsp_quoting which I removed from this change.

ruiu accepted this revision.May 29 2018, 8:50 PM

LGTM

test/wasm/responsefile.test
3

It is perhaps better to move %t.o before -o so that -o would never be interpreted as an argument for the echo command.

9–10

Looks like this can fit in one line.

sbc100 updated this revision to Diff 149033.May 29 2018, 8:55 PM
  • feedback
This revision was automatically updated to reflect the committed changes.