<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Oct 17, 2014 at 1:27 PM, Aaron Ballman <span dir="ltr"><<a href="mailto:aaron.ballman@gmail.com" target="_blank">aaron.ballman@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class="">On Fri, Oct 17, 2014 at 4:22 PM, Zachary Turner <<a href="mailto:zturner@google.com">zturner@google.com</a>> wrote:<br>
><br>
><br>
> On Fri, Oct 17, 2014 at 12:48 PM, Aaron Ballman <<a href="mailto:aaron.ballman@gmail.com">aaron.ballman@gmail.com</a>><br>
> wrote:<br>
>><br>
>> On Fri, Oct 17, 2014 at 3:06 PM, Zachary Turner <<a href="mailto:zturner@google.com">zturner@google.com</a>><br>
>> wrote:<br>
>> > -<br>
>> >  std::unique_ptr<Command> visualstudio::Compile::GetCommand(<br>
>> >      Compilation &C, const JobAction &JA, const InputInfo &Output,<br>
>> >      const InputInfoList &Inputs, const ArgList &Args,<br>
>> > Index: lib/Driver/WindowsToolChain.cpp<br>
>> > ===================================================================<br>
>> > --- lib/Driver/WindowsToolChain.cpp<br>
>> > +++ lib/Driver/WindowsToolChain.cpp<br>
>> > @@ -77,61 +77,59 @@<br>
>> >    return getArch() == llvm::Triple::x86_64;<br>
>> >  }<br>
>> ><br>
>> > +#ifdef USE_WIN32<br>
>> > +static bool readFullStringValue(HKEY hkey, const char *valueName,<br>
>> > +                                std::string &value) {<br>
>><br>
>> We should be preferring the W versions of these APIs instead of the A<br>
>> versions, especially since this is being used to pull out file paths.<br>
><br>
> How does this work, since ultimately all of clang uses non-wide character<br>
> strings anyway.  I mean I know how to convert between the two, but I was<br>
> under the impression that everything was just already broken because afaik<br>
> we don't ever use W functions anywhere else.<br>
<br>
</span>My understanding is that we use the W versions of the APIs and<br>
immediately convert to UTF-8 to store internally. When we require<br>
interaction in the other direction, we convert back to UTF-16. At<br>
least, this is how we work with things like command line arguments and<br>
files. As an example, see Process::GetArgumentVector.</blockquote><div><br></div><div>So llvm::sys::windows::UTF8ToUTF16 and its counterpart are not exposed in a public header.  Is there an accepted way to re-use them here, or do I need to duplicate the code in clang?</div></div></div></div>