DirectXShaderCompiler/lib/Option
Tex Riddell 780506e714
Intuitively handle space in joined option syntax (#3024)
* Intuitively handle space in joined option syntax

A frequent mistake is to pass arguments to the compiler API where the
option is in the same string as the value, separated by a space, such
as L"-T ps_6_0".  This is normally interpreted as a joined form of the
"-T" option, with the value being " ps_6_0" - note the leading space in
the value.  This is not intentional and leads to confusion.

This change handles the case where an option is either the SeparateClass
or JoinedOrSeparateClass, and it appears to be joined form, starting with
spaces.  It's more than likely this is the mistake, so the spaces are
skipped, and the value starts after the spaces.  If you really want a
value that starts with space, that value can still be provided by using
the separate option: L"-Fo", L" filename-starting-with-space.dxo".

* Handle trailing spaces.

Tried resetting JoinedSpaces when value would be empty, but this leads
to errors that are still hard for user to interpret.  So this just handles
(ignores) the trailing spaces here, which doesn't seem too bad.
2020-07-02 21:23:12 -07:00
..
Arg.cpp Revert license text in banner comments to original llvm verbage (#33) 2017-01-24 17:54:00 -08:00
ArgList.cpp Revert license text in banner comments to original llvm verbage (#33) 2017-01-24 17:54:00 -08:00
CMakeLists.txt Revert license text in banner comments to original llvm verbage (#33) 2017-01-24 17:54:00 -08:00
LLVMBuild.txt Revert license text in banner comments to original llvm verbage (#33) 2017-01-24 17:54:00 -08:00
OptTable.cpp Clean up for versions (#829) 2017-11-20 11:09:28 -08:00
Option.cpp Intuitively handle space in joined option syntax (#3024) 2020-07-02 21:23:12 -07:00