This is an archive of the discontinued LLVM Phabricator instance.

[Driver] Add verbatim dry run option
AcceptedPublic

Authored by smeenai on Aug 6 2019, 6:01 PM.

Details

Summary

When writing driver tests, it's useful to have a way to output arguments
verbatim (i.e. without any quoting and escaping). For example, on
Windows today, the installation directory is output without backslashes
being escaped, but any -internal-isystem arguments passed by the driver
to the frontend will have backslashes escaped in the -### output, making
it impossible to write a FileCheck match against the installation
directory. Add a new argument to avoid any quoting and escaping to ease
driver testing. Make this argument output to stdout instead of stderr to
avoid needing 2>&1 in all the driver tests.

Event Timeline

smeenai created this revision.Aug 6 2019, 6:01 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 6 2019, 6:01 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript

I'm not tied to the name -###-verbatim and am open to suggestions if anyone can think of something better.

My troll suggestion was -####, but @compnerd didn't like that for some reason...

smeenai updated this revision to Diff 213773.Aug 6 2019, 6:18 PM
smeenai edited the summary of this revision. (Show Details)

Output to stdout

MaskRay added a subscriber: MaskRay.Aug 6 2019, 6:39 PM
compnerd added inline comments.Aug 6 2019, 8:36 PM
clang/include/clang/Driver/Options.td
333

What about -print-raw-commands?

phosek accepted this revision.Jan 31 2020, 4:12 PM

I'm fine with -###-verbatim.

This revision is now accepted and ready to land.Jan 31 2020, 4:12 PM

One thing I (a zsh user) feel inconvenient about -### is that.......

% echo -###
zsh: bad pattern: -###
% echo '-###'
-###