--- a/components/llvm/patches/002-solaris-LLVM-libLLVMSupport.patch Mon Sep 26 16:18:41 2016 -0500
+++ b/components/llvm/patches/002-solaris-LLVM-libLLVMSupport.patch Fri Sep 23 11:19:39 2016 -0700
@@ -16,16 +16,6 @@
###
--- lib/Support/raw_ostream.cpp 2016-01-11 15:33:03.000000000 -0800
+++ lib/Support/raw_ostream.cpp 2016-05-25 20:32:16.532306707 -0700
-@@ -20,7 +20,9 @@
- #include "llvm/Support/ErrorHandling.h"
- #include "llvm/Support/FileSystem.h"
- #include "llvm/Support/Format.h"
-+#include "llvm/Support/ManagedStatic.h"
- #include "llvm/Support/MathExtras.h"
-+#include "llvm/Support/Mutex.h"
- #include "llvm/Support/Process.h"
- #include "llvm/Support/Program.h"
- #include <cctype>
@@ -496,7 +498,7 @@
// Handle "-" as stdout. Note that when we do this, we consider ourself
// the owner of stdout. This means that we can do things like close the
@@ -35,177 +25,7 @@
EC = std::error_code();
// If user requested binary then put stdout into binary mode if
// possible.
-@@ -515,38 +517,61 @@
-
- raw_fd_ostream::raw_fd_ostream(StringRef Filename, std::error_code &EC,
- sys::fs::OpenFlags Flags)
-- : raw_fd_ostream(getFD(Filename, EC, Flags), true) {}
-+ : raw_pwrite_stream(true), FD(-1), ShouldClose(false),
-+ Error(false), pos(static_cast<uint64_t>(-1)), SupportsSeeking(false) {
-+ this->FD = getFD(Filename, EC, Flags);
-+ if (this->FD < 0 ) {
-+ ShouldClose = false;
-+ return;
-+ }
-+
-+ // Get the starting position.
-+ off_t loc = ::lseek(this->FD, 0, SEEK_CUR);
-+#ifdef LLVM_ON_WIN32
-+ // MSVCRT's _lseek(SEEK_CUR) doesn't return -1 for pipes.
-+ sys::fs::file_status Status;
-+ std::error_code EC = status(FD, Status);
-+ SupportsSeeking = !EC && Status.type() == sys::fs::file_type::regular_file;
-+#else
-+ SupportsSeeking = loc != static_cast<off_t>(-1);
-+#endif
-+ if (!SupportsSeeking)
-+ pos = 0ULL;
-+ else
-+ pos = static_cast<uint64_t>(loc);
-+}
-
- /// FD is the file descriptor that this writes to. If ShouldClose is true, this
- /// closes the file when the stream is destroyed.
- raw_fd_ostream::raw_fd_ostream(int fd, bool shouldClose, bool unbuffered)
- : raw_pwrite_stream(unbuffered), FD(fd), ShouldClose(shouldClose),
-- Error(false) {
-- if (FD < 0 ) {
-+ Error(false), pos(static_cast<uint64_t>(-1)), SupportsSeeking(false) {
-+ if (this->FD < 0 ) {
- ShouldClose = false;
- return;
- }
-
- // Get the starting position.
-- off_t loc = ::lseek(FD, 0, SEEK_CUR);
-+ off_t loc = ::lseek(this->FD, 0, SEEK_CUR);
- #ifdef LLVM_ON_WIN32
- // MSVCRT's _lseek(SEEK_CUR) doesn't return -1 for pipes.
- sys::fs::file_status Status;
- std::error_code EC = status(FD, Status);
- SupportsSeeking = !EC && Status.type() == sys::fs::file_type::regular_file;
- #else
-- SupportsSeeking = loc != (off_t)-1;
-+ SupportsSeeking = loc != static_cast<off_t>(-1);
- #endif
- if (!SupportsSeeking)
-- pos = 0;
-+ pos = 0ULL;
- else
- pos = static_cast<uint64_t>(loc);
- }
-
- raw_fd_ostream::~raw_fd_ostream() {
-- if (FD >= 0) {
-+ if (this->FD >= 0) {
- flush();
-- if (ShouldClose && sys::Process::SafelyCloseFileDescriptor(FD))
-+
-+ if (ShouldClose && sys::Process::SafelyCloseFileDescriptor(this->FD))
- error_detected();
- }
-
-@@ -585,7 +610,7 @@
- if (ChunkSize > 32767 && ShouldWriteInChunks)
- ChunkSize = 32767;
-
-- ssize_t ret = ::write(FD, Ptr, ChunkSize);
-+ ssize_t ret = ::write(this->FD, Ptr, ChunkSize);
-
- if (ret < 0) {
- // If it's a recoverable error, swallow it and retry the write.
-@@ -617,11 +642,14 @@
- }
-
- void raw_fd_ostream::close() {
-- assert(ShouldClose);
-+ if (FD == -1) {
-+ ShouldClose = false;
-+ return;
-+ }
-+
- ShouldClose = false;
- flush();
-- if (sys::Process::SafelyCloseFileDescriptor(FD))
-- error_detected();
-+ (void) sys::Process::SafelyCloseFileDescriptor(FD);
- FD = -1;
- }
-
-@@ -715,30 +743,64 @@
- // outs(), errs(), nulls()
- //===----------------------------------------------------------------------===//
-
-+static raw_fd_ostream *SOUT = nullptr;
-+static llvm::ManagedStatic<llvm::sys::SmartMutex<true> > SOutMutex;
-+
-+static raw_fd_ostream *SERR = nullptr;
-+static llvm::ManagedStatic<llvm::sys::SmartMutex<true> > SErrMutex;
-+
-+static raw_null_ostream *SNULL = nullptr;
-+static llvm::ManagedStatic<llvm::sys::SmartMutex<true> > SNullMutex;
-+
- /// outs() - This returns a reference to a raw_ostream for standard output.
- /// Use it like: outs() << "foo" << "bar";
-+__attribute__((noinline))
- raw_ostream &llvm::outs() {
- // Set buffer settings to model stdout behavior.
- // Delete the file descriptor when the program exits, forcing error
- // detection. If you don't want this behavior, don't use outs().
-- std::error_code EC;
-- static raw_fd_ostream S("-", EC, sys::fs::F_None);
-- assert(!EC);
-- return S;
-+ // This makes absolutely no sense whatsoever. getFD returns STDOUT_FILENO
-+ // anyway.
-+
-+ if (!SOUT) {
-+ llvm::sys::SmartScopedLock<true> Lock(*SOutMutex);
-+ if (!SOUT) {
-+ SOUT = new raw_fd_ostream(STDOUT_FILENO, false, false);
-+ assert(SOUT);
-+ }
-+ }
-+
-+ return *SOUT;
- }
-
- /// errs() - This returns a reference to a raw_ostream for standard error.
- /// Use it like: errs() << "foo" << "bar";
-+__attribute__((noinline))
- raw_ostream &llvm::errs() {
- // Set standard error to be unbuffered by default.
-- static raw_fd_ostream S(STDERR_FILENO, false, true);
-- return S;
-+ if (!SERR) {
-+ llvm::sys::SmartScopedLock<true> Lock(*SErrMutex);
-+ if (!SERR) {
-+ SERR = new raw_fd_ostream(STDERR_FILENO, false, true);
-+ assert(SERR);
-+ }
-+ }
-+
-+ return *SERR;
- }
-
- /// nulls() - This returns a reference to a raw_ostream which discards output.
-+__attribute__((noinline))
- raw_ostream &llvm::nulls() {
-- static raw_null_ostream S;
-- return S;
-+ if (!SNULL) {
-+ llvm::sys::SmartScopedLock<true> Lock(*SNullMutex);
-+ if (!SNULL) {
-+ SNULL = new raw_null_ostream();
-+ assert(SNULL);
-+ }
-+ }
-+
-+ return *SNULL;
- }
-
-
-###
+
--- include/llvm/Support/CommandLine.h 2015-11-17 10:00:52.000000000 -0900
+++ include/llvm/Support/CommandLine.h 2016-07-05 20:30:35.333194355 -0800
@@ -25,11 +25,13 @@