mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-28 05:19:42 +00:00
Windows: Add support for unicode command lines
Summary: The MSVCRT deliberately sends main() code-page specific characters. This isn't too useful to LLVM as we end up converting the arguments to UTF-16 and subsequently attempt to use the result as, for example, a file name. Instead, we need to have the ability to access the Unicode command line and transform it to UTF-8. This has the distinct advantage over using the MSVC-specific wmain() function as our entry point because: - It doesn't work on cygwin. - It only work on MinGW with caveats and only then on certain versions. - We get to keep our entry point as main(). :) N.B. This patch includes fixes to other parts of lib/Support/Windows s.t. we would be able to take advantage of getting the Unicode paths. E.G. clang spawning clang -cc1 would want to give it Unicode arguments. Reviewers: aaron.ballman, Bigcheese, rnk, ruiu Reviewed By: rnk CC: llvm-commits, ygao Differential Revision: http://llvm-reviews.chandlerc.com/D1834 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192069 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -203,6 +203,9 @@
|
||||
/* Define to 1 if you have the `pthread' library (-lpthread). */
|
||||
#cmakedefine HAVE_LIBPTHREAD ${HAVE_LIBPTHREAD}
|
||||
|
||||
/* Define to 1 if you have the `shell32' library (-lshell32). */
|
||||
#cmakedefine HAVE_LIBSHELL32 ${HAVE_LIBSHELL32}
|
||||
|
||||
/* Define to 1 if you have the `udis86' library (-ludis86). */
|
||||
#undef HAVE_LIBUDIS86
|
||||
|
||||
|
||||
@@ -217,6 +217,9 @@
|
||||
/* Define to 1 if you have the `pthread' library (-lpthread). */
|
||||
#undef HAVE_LIBPTHREAD
|
||||
|
||||
/* Define to 1 if you have the `shell32' library (-lshell32). */
|
||||
#undef HAVE_LIBSHELL32
|
||||
|
||||
/* Define to 1 if you have the `udis86' library (-ludis86). */
|
||||
#undef HAVE_LIBUDIS86
|
||||
|
||||
|
||||
@@ -25,8 +25,11 @@
|
||||
#ifndef LLVM_SUPPORT_PROCESS_H
|
||||
#define LLVM_SUPPORT_PROCESS_H
|
||||
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/Config/llvm-config.h"
|
||||
#include "llvm/Support/Allocator.h"
|
||||
#include "llvm/Support/system_error.h"
|
||||
#include "llvm/Support/DataTypes.h"
|
||||
#include "llvm/Support/TimeValue.h"
|
||||
|
||||
@@ -168,6 +171,14 @@ public:
|
||||
// string. \arg Name is assumed to be in UTF-8 encoding too.
|
||||
static Optional<std::string> GetEnv(StringRef name);
|
||||
|
||||
/// This function returns a SmallVector containing the arguments passed from
|
||||
/// the operating system to the program. This function expects to be handed
|
||||
/// the vector passed in from main.
|
||||
static error_code
|
||||
GetArgumentVector(SmallVectorImpl<const char *> &Args,
|
||||
ArrayRef<const char *> ArgsFromMain,
|
||||
SpecificBumpPtrAllocator<char> &ArgAllocator);
|
||||
|
||||
/// This function determines if the standard input is connected directly
|
||||
/// to a user's input (keyboard probably), rather than coming from a file
|
||||
/// or pipe.
|
||||
|
||||
Reference in New Issue
Block a user