[llvm] r190423 - Add getenv() wrapper that works on multibyte environment variable.

Eli Friedman eli.friedman at gmail.com
Tue Sep 10 14:31:47 PDT 2013


On Tue, Sep 10, 2013 at 12:45 PM, Rui Ueyama <ruiu at google.com> wrote:

> Author: ruiu
> Date: Tue Sep 10 14:45:51 2013
> New Revision: 190423
>
> URL: http://llvm.org/viewvc/llvm-project?rev=190423&view=rev
> Log:
> Add getenv() wrapper that works on multibyte environment variable.
>
> Modified: llvm/trunk/lib/Support/Windows/Windows.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Windows/Windows.h?rev=190423&r1=190422&r2=190423&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Support/Windows/Windows.h (original)
> +++ llvm/trunk/lib/Support/Windows/Windows.h Tue Sep 10 14:45:51 2013
> @@ -24,13 +24,17 @@
>  #define _WIN32_IE    0x0600 // MinGW at it again.
>  #define WIN32_LEAN_AND_MEAN
>
> +#include "llvm/ADT/SmallVector.h"
> +#include "llvm/ADT/StringRef.h"
>  #include "llvm/Config/config.h" // Get build system configuration settings
>  #include "llvm/Support/Compiler.h"
> +#include "llvm/Support/system_error.h"
>  #include <windows.h>
>  #include <wincrypt.h>
>  #include <shlobj.h>
>  #include <cassert>
>  #include <string>
> +#include <vector>
>
>  inline bool MakeErrMsg(std::string* ErrMsg, const std::string& prefix) {
>    if (!ErrMsg)
> @@ -148,4 +152,13 @@ c_str(SmallVectorImpl<T> &str) {
>    str.pop_back();
>    return str.data();
>  }
> +
> +namespace sys {
> +namespace windows {
> +error_code UTF8ToUTF16(StringRef utf8,
> +                       SmallVectorImpl<wchar_t> &utf16);
> +error_code UTF16ToUTF8(const wchar_t *utf16, size_t utf16_len,
> +                       SmallVectorImpl<char> &utf8);
> +} // end namespace windows
> +} // end namespace sys
>  } // end namespace llvm.>
>
> We already have include/llvm/Support/ConvertUTF.h; we shouldn't need
> Windows-specific version.
>
> -Eli
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130910/2a2c4cab/attachment.html>


More information about the llvm-commits mailing list