From: Martin Storsjo Date: Fri, 11 Oct 2019 08:44:51 +0000 (+0000) Subject: [LLDB] [Driver] Use llvm::InitLLVM to do unicode argument conversion on Windows X-Git-Tag: llvmorg-11-init~6794 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4778f40f782f4df6bdd0fb40e4c3fe8b5f3b571e;p=platform%2Fupstream%2Fllvm.git [LLDB] [Driver] Use llvm::InitLLVM to do unicode argument conversion on Windows This avoids the currently MSVC specific codepath of using the wchar entry point and converting that to utf8. Differential Revision: https://reviews.llvm.org/D68770 llvm-svn: 374526 --- diff --git a/lldb/tools/driver/Driver.cpp b/lldb/tools/driver/Driver.cpp index 661c10a..4a403a7 100644 --- a/lldb/tools/driver/Driver.cpp +++ b/lldb/tools/driver/Driver.cpp @@ -19,8 +19,8 @@ #include "lldb/API/SBStringList.h" #include "llvm/ADT/StringRef.h" -#include "llvm/Support/ConvertUTF.h" #include "llvm/Support/Format.h" +#include "llvm/Support/InitLLVM.h" #include "llvm/Support/Path.h" #include "llvm/Support/PrettyStackTrace.h" #include "llvm/Support/Process.h" @@ -807,23 +807,9 @@ llvm::Optional InitializeReproducer(opt::InputArgList &input_args) { return llvm::None; } -int -#ifdef _MSC_VER -wmain(int argc, wchar_t const *wargv[]) -#else -main(int argc, char const *argv[]) -#endif +int main(int argc, char const *argv[]) { -#ifdef _MSC_VER - // Convert wide arguments to UTF-8 - std::vector argvStrings(argc); - std::vector argvPointers(argc); - for (int i = 0; i != argc; ++i) { - llvm::convertWideToUTF8(wargv[i], argvStrings[i]); - argvPointers[i] = argvStrings[i].c_str(); - } - const char **argv = argvPointers.data(); -#endif + llvm::InitLLVM IL(argc, argv); // Print stack trace on crash. llvm::StringRef ToolName = llvm::sys::path::filename(argv[0]);