[PATCH] D30991: [Driver] Fix cross compiling with Visual Studio 2017

Hamza Sood via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 16 10:46:45 PDT 2017

hamzasood updated this revision to Diff 92019.
hamzasood added a comment.

- Added an assertion in Command::Execute to ensure the environment vector is null-terminated before using it.
- Split Command::setEnvironment so that there's an overload to specifically handle the case where the input vector is to be copied in. While this adds a small amount of extra code complexity, it allows us to reduce the worst case from two copies (copy into the function, re-allocate/copy when appending the null-terminator) to just one. Considering the non-trivial size of environment blocks (and that we're already quite inefficient by going from UTF16 -> UTF8 -> UTF16), I think it's worth the few extra lines of code. However it's simple to revert if anyone disagrees.



-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30991.92019.patch
Type: text/x-patch
Size: 9121 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170316/46216139/attachment.bin>

More information about the cfe-commits mailing list