Add getenv() wrapper that works on multibyte environment variable.
authorRui Ueyama <ruiu@google.com>
Tue, 10 Sep 2013 19:45:51 +0000 (19:45 +0000)
committerRui Ueyama <ruiu@google.com>
Tue, 10 Sep 2013 19:45:51 +0000 (19:45 +0000)
commitf42d4247ae1138c6deed50f92dcd1a4f34e07dec
tree0e4fd79f9e891171d4b70ecfc5cc055876d91dc3
parent8e12d95d15e4140311919a3b60461817baf68ca5
Add getenv() wrapper that works on multibyte environment variable.

On Windows, character encoding of multibyte environment variable varies
depending on settings. The only reliable way to handle it I think is to use
GetEnvironmentVariableW().

GetEnvironmentVariableW() works on wchar_t string, which is on Windows UTF16
string. That's not ideal because we use UTF-8 as the internal encoding in LLVM.
This patch defines a wrapper function which takes and returns UTF-8 string for
GetEnvironmentVariableW().

The wrapper function does not do any conversion and just forwards the argument
to getenv() on Unix.

Differential Revision: http://llvm-reviews.chandlerc.com/D1612

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190423 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Support/Process.h
lib/Support/Unix/Process.inc
lib/Support/Windows/Path.inc
lib/Support/Windows/Process.inc
lib/Support/Windows/Windows.h
unittests/Support/ProcessTest.cpp