[cfe-dev] [LLVMdev] Unicode path handling on Windows

Aaron Ballman aaron at aaronballman.com
Tue Sep 20 16:41:12 PDT 2011


On Tue, Sep 20, 2011 at 4:15 PM, Nikola Smiljanic <popizdeh at gmail.com> wrote:
> OK since this approach makes sense I'll shoot with my questions :)
> 1. Where should get_utf8_argv go and is the name of this function OK? Right
> now the function is inside llvm::sys::fs namespace because I need access to
> Windows.h, should I leave it there.

I don't think it belongs there as it has nothing to do with the file
system.  However, I'm not familiar enough to know of a better place
for it either.  Hopefully someone else can chime in with an idea.

> 2. get_utf8_argv allocates new char** representing utf8 argv, should I
> deallocate this inside driver.cpp, use std::vector<std::string> instead or
> ignore the allocation completely?

Perhaps some SmallVectors would make sense here?  An inner one to hold
the arg data, and an outer one to hold the list of inner vectors.
Then you can do the cleanup within the call.

> 3. There is an #ifdef inside driver.cpp right now that I don't like.
> get_utf8_argv works for windows only, but I could change the function to
> accept argv and return it as vector of utf8 strings. It would convert char*
> to std::string on unix and use GetCommandLine + utf8 conversion on windows.

I have no concrete opinion one way or the other on this.

> 4. Should I wrap functions like ::fstat and ::close for consistency even
> though they don't work with paths?

I don't believe so.

> I'll fix everything that is formatting related. You're right, current patch
> has Open only for windows but I'll add the other one as well.

Thanks for the help!

~Aaron



More information about the cfe-dev mailing list