Update prebuilt Clang to r365631c1 from Android.

The version we had was segfaulting.

Bug: 132420445
Change-Id: Icb45a6fe0b4e2166f7895e669df1157cec9fb4e0
diff --git a/linux-x64/clang/include/lld/Common/Args.h b/linux-x64/clang/include/lld/Common/Args.h
index d943646..b3c8686 100644
--- a/linux-x64/clang/include/lld/Common/Args.h
+++ b/linux-x64/clang/include/lld/Common/Args.h
@@ -23,18 +23,19 @@
 namespace lld {
 namespace args {
 
-llvm::CodeGenOpt::Level getCGOptLevel(int OptLevelLTO);
+llvm::CodeGenOpt::Level getCGOptLevel(int optLevelLTO);
 
-int getInteger(llvm::opt::InputArgList &Args, unsigned Key, int Default);
+int64_t getInteger(llvm::opt::InputArgList &args, unsigned key,
+                   int64_t Default);
 
-std::vector<StringRef> getStrings(llvm::opt::InputArgList &Args, int Id);
+std::vector<StringRef> getStrings(llvm::opt::InputArgList &args, int id);
 
-uint64_t getZOptionValue(llvm::opt::InputArgList &Args, int Id, StringRef Key,
+uint64_t getZOptionValue(llvm::opt::InputArgList &args, int id, StringRef key,
                          uint64_t Default);
 
-std::vector<StringRef> getLines(MemoryBufferRef MB);
+std::vector<StringRef> getLines(MemoryBufferRef mb);
 
-StringRef getFilenameWithoutExe(StringRef Path);
+StringRef getFilenameWithoutExe(StringRef path);
 
 } // namespace args
 } // namespace lld
diff --git a/linux-x64/clang/include/lld/Common/Driver.h b/linux-x64/clang/include/lld/Common/Driver.h
index 745ef72..e559595 100644
--- a/linux-x64/clang/include/lld/Common/Driver.h
+++ b/linux-x64/clang/include/lld/Common/Driver.h
@@ -14,28 +14,28 @@
 
 namespace lld {
 namespace coff {
-bool link(llvm::ArrayRef<const char *> Args, bool CanExitEarly,
-          llvm::raw_ostream &Diag = llvm::errs());
+bool link(llvm::ArrayRef<const char *> args, bool canExitEarly,
+          llvm::raw_ostream &diag = llvm::errs());
 }
 
 namespace mingw {
-bool link(llvm::ArrayRef<const char *> Args,
-          llvm::raw_ostream &Diag = llvm::errs());
+bool link(llvm::ArrayRef<const char *> args,
+          llvm::raw_ostream &diag = llvm::errs());
 }
 
 namespace elf {
-bool link(llvm::ArrayRef<const char *> Args, bool CanExitEarly,
-          llvm::raw_ostream &Diag = llvm::errs());
+bool link(llvm::ArrayRef<const char *> args, bool canExitEarly,
+          llvm::raw_ostream &diag = llvm::errs());
 }
 
 namespace mach_o {
-bool link(llvm::ArrayRef<const char *> Args, bool CanExitEarly,
-          llvm::raw_ostream &Diag = llvm::errs());
+bool link(llvm::ArrayRef<const char *> args, bool canExitEarly,
+          llvm::raw_ostream &diag = llvm::errs());
 }
 
 namespace wasm {
-bool link(llvm::ArrayRef<const char *> Args, bool CanExitEarly,
-          llvm::raw_ostream &Diag = llvm::errs());
+bool link(llvm::ArrayRef<const char *> args, bool canExitEarly,
+          llvm::raw_ostream &diag = llvm::errs());
 }
 }
 
diff --git a/linux-x64/clang/include/lld/Common/ErrorHandler.h b/linux-x64/clang/include/lld/Common/ErrorHandler.h
index bd9c257..3467fdc 100644
--- a/linux-x64/clang/include/lld/Common/ErrorHandler.h
+++ b/linux-x64/clang/include/lld/Common/ErrorHandler.h
@@ -82,74 +82,74 @@
 
 class ErrorHandler {
 public:
-  uint64_t ErrorCount = 0;
-  uint64_t ErrorLimit = 20;
-  StringRef ErrorLimitExceededMsg = "too many errors emitted, stopping now";
-  StringRef LogName = "lld";
-  llvm::raw_ostream *ErrorOS = &llvm::errs();
-  bool ColorDiagnostics = llvm::errs().has_colors();
-  bool ExitEarly = true;
-  bool FatalWarnings = false;
-  bool Verbose = false;
+  uint64_t errorCount = 0;
+  uint64_t errorLimit = 20;
+  StringRef errorLimitExceededMsg = "too many errors emitted, stopping now";
+  StringRef logName = "lld";
+  llvm::raw_ostream *errorOS = &llvm::errs();
+  bool colorDiagnostics = llvm::errs().has_colors();
+  bool exitEarly = true;
+  bool fatalWarnings = false;
+  bool verbose = false;
 
-  void error(const Twine &Msg);
-  LLVM_ATTRIBUTE_NORETURN void fatal(const Twine &Msg);
-  void log(const Twine &Msg);
-  void message(const Twine &Msg);
-  void warn(const Twine &Msg);
+  void error(const Twine &msg);
+  LLVM_ATTRIBUTE_NORETURN void fatal(const Twine &msg);
+  void log(const Twine &msg);
+  void message(const Twine &msg);
+  void warn(const Twine &msg);
 
-  std::unique_ptr<llvm::FileOutputBuffer> OutputBuffer;
+  std::unique_ptr<llvm::FileOutputBuffer> outputBuffer;
 
 private:
-  void print(StringRef S, raw_ostream::Colors C);
+  void print(StringRef s, raw_ostream::Colors c);
 };
 
 /// Returns the default error handler.
 ErrorHandler &errorHandler();
 
-inline void error(const Twine &Msg) { errorHandler().error(Msg); }
-inline LLVM_ATTRIBUTE_NORETURN void fatal(const Twine &Msg) {
-  errorHandler().fatal(Msg);
+inline void error(const Twine &msg) { errorHandler().error(msg); }
+inline LLVM_ATTRIBUTE_NORETURN void fatal(const Twine &msg) {
+  errorHandler().fatal(msg);
 }
-inline void log(const Twine &Msg) { errorHandler().log(Msg); }
-inline void message(const Twine &Msg) { errorHandler().message(Msg); }
-inline void warn(const Twine &Msg) { errorHandler().warn(Msg); }
-inline uint64_t errorCount() { return errorHandler().ErrorCount; }
+inline void log(const Twine &msg) { errorHandler().log(msg); }
+inline void message(const Twine &msg) { errorHandler().message(msg); }
+inline void warn(const Twine &msg) { errorHandler().warn(msg); }
+inline uint64_t errorCount() { return errorHandler().errorCount; }
 
-LLVM_ATTRIBUTE_NORETURN void exitLld(int Val);
+LLVM_ATTRIBUTE_NORETURN void exitLld(int val);
 
-void diagnosticHandler(const llvm::DiagnosticInfo &DI);
-void checkError(Error E);
+void diagnosticHandler(const llvm::DiagnosticInfo &di);
+void checkError(Error e);
 
 // check functions are convenient functions to strip errors
 // from error-or-value objects.
-template <class T> T check(ErrorOr<T> E) {
-  if (auto EC = E.getError())
-    fatal(EC.message());
-  return std::move(*E);
+template <class T> T check(ErrorOr<T> e) {
+  if (auto ec = e.getError())
+    fatal(ec.message());
+  return std::move(*e);
 }
 
-template <class T> T check(Expected<T> E) {
-  if (!E)
-    fatal(llvm::toString(E.takeError()));
-  return std::move(*E);
+template <class T> T check(Expected<T> e) {
+  if (!e)
+    fatal(llvm::toString(e.takeError()));
+  return std::move(*e);
 }
 
 template <class T>
-T check2(ErrorOr<T> E, llvm::function_ref<std::string()> Prefix) {
-  if (auto EC = E.getError())
-    fatal(Prefix() + ": " + EC.message());
-  return std::move(*E);
+T check2(ErrorOr<T> e, llvm::function_ref<std::string()> prefix) {
+  if (auto ec = e.getError())
+    fatal(prefix() + ": " + ec.message());
+  return std::move(*e);
 }
 
 template <class T>
-T check2(Expected<T> E, llvm::function_ref<std::string()> Prefix) {
-  if (!E)
-    fatal(Prefix() + ": " + toString(E.takeError()));
-  return std::move(*E);
+T check2(Expected<T> e, llvm::function_ref<std::string()> prefix) {
+  if (!e)
+    fatal(prefix() + ": " + toString(e.takeError()));
+  return std::move(*e);
 }
 
-inline std::string toString(const Twine &S) { return S.str(); }
+inline std::string toString(const Twine &s) { return s.str(); }
 
 // To evaluate the second argument lazily, we use C macro.
 #define CHECK(E, S) check2((E), [&] { return toString(S); })
diff --git a/linux-x64/clang/include/lld/Common/Filesystem.h b/linux-x64/clang/include/lld/Common/Filesystem.h
new file mode 100644
index 0000000..63a0f55
--- /dev/null
+++ b/linux-x64/clang/include/lld/Common/Filesystem.h
@@ -0,0 +1,20 @@
+//===- Filesystem.h ---------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLD_FILESYSTEM_H
+#define LLD_FILESYSTEM_H
+
+#include "lld/Common/LLVM.h"
+#include <system_error>
+
+namespace lld {
+void unlinkAsync(StringRef path);
+std::error_code tryCreateFile(StringRef path);
+} // namespace lld
+
+#endif
diff --git a/linux-x64/clang/include/lld/Common/LLVM.h b/linux-x64/clang/include/lld/Common/LLVM.h
index 944bb41..f7ed1d7 100644
--- a/linux-x64/clang/include/lld/Common/LLVM.h
+++ b/linux-x64/clang/include/lld/Common/LLVM.h
@@ -29,6 +29,7 @@
 class MemoryBuffer;
 class MemoryBufferRef;
 template <typename T> class ArrayRef;
+template <typename T> class MutableArrayRef;
 template <unsigned InternalLen> class SmallString;
 template <typename T, unsigned N> class SmallVector;
 template <typename T> class ErrorOr;
@@ -62,6 +63,7 @@
 
 // ADT's.
 using llvm::ArrayRef;
+using llvm::MutableArrayRef;
 using llvm::Error;
 using llvm::ErrorOr;
 using llvm::Expected;
diff --git a/linux-x64/clang/include/lld/Common/Memory.h b/linux-x64/clang/include/lld/Common/Memory.h
index 78f6e24..41d8f15 100644
--- a/linux-x64/clang/include/lld/Common/Memory.h
+++ b/linux-x64/clang/include/lld/Common/Memory.h
@@ -28,30 +28,30 @@
 namespace lld {
 
 // Use this arena if your object doesn't have a destructor.
-extern llvm::BumpPtrAllocator BAlloc;
-extern llvm::StringSaver Saver;
+extern llvm::BumpPtrAllocator bAlloc;
+extern llvm::StringSaver saver;
 
 void freeArena();
 
 // These two classes are hack to keep track of all
 // SpecificBumpPtrAllocator instances.
 struct SpecificAllocBase {
-  SpecificAllocBase() { Instances.push_back(this); }
+  SpecificAllocBase() { instances.push_back(this); }
   virtual ~SpecificAllocBase() = default;
   virtual void reset() = 0;
-  static std::vector<SpecificAllocBase *> Instances;
+  static std::vector<SpecificAllocBase *> instances;
 };
 
 template <class T> struct SpecificAlloc : public SpecificAllocBase {
-  void reset() override { Alloc.DestroyAll(); }
-  llvm::SpecificBumpPtrAllocator<T> Alloc;
+  void reset() override { alloc.DestroyAll(); }
+  llvm::SpecificBumpPtrAllocator<T> alloc;
 };
 
 // Use this arena if your object has a destructor.
 // Your destructor will be invoked from freeArena().
-template <typename T, typename... U> T *make(U &&... Args) {
-  static SpecificAlloc<T> Alloc;
-  return new (Alloc.Alloc.Allocate()) T(std::forward<U>(Args)...);
+template <typename T, typename... U> T *make(U &&... args) {
+  static SpecificAlloc<T> alloc;
+  return new (alloc.alloc.Allocate()) T(std::forward<U>(args)...);
 }
 
 } // namespace lld
diff --git a/linux-x64/clang/include/lld/Common/Reproduce.h b/linux-x64/clang/include/lld/Common/Reproduce.h
index ac7a822..734d9e4 100644
--- a/linux-x64/clang/include/lld/Common/Reproduce.h
+++ b/linux-x64/clang/include/lld/Common/Reproduce.h
@@ -22,17 +22,13 @@
 // Makes a given pathname an absolute path first, and then remove
 // beginning /. For example, "../foo.o" is converted to "home/john/foo.o",
 // assuming that the current directory is "/home/john/bar".
-std::string relativeToRoot(StringRef Path);
+std::string relativeToRoot(StringRef path);
 
 // Quote a given string if it contains a space character.
-std::string quote(StringRef S);
-
-// Rewrite the given path if a file exists with that pathname, otherwise
-// returns the original path.
-std::string rewritePath(StringRef S);
+std::string quote(StringRef s);
 
 // Returns the string form of the given argument.
-std::string toString(const llvm::opt::Arg &Arg);
+std::string toString(const llvm::opt::Arg &arg);
 }
 
 #endif
diff --git a/linux-x64/clang/include/lld/Common/Strings.h b/linux-x64/clang/include/lld/Common/Strings.h
index efc9245..ded22dd 100644
--- a/linux-x64/clang/include/lld/Common/Strings.h
+++ b/linux-x64/clang/include/lld/Common/Strings.h
@@ -19,25 +19,25 @@
 namespace lld {
 // Returns a demangled C++ symbol name. If Name is not a mangled
 // name, it returns Optional::None.
-llvm::Optional<std::string> demangleItanium(llvm::StringRef Name);
-llvm::Optional<std::string> demangleMSVC(llvm::StringRef S);
+llvm::Optional<std::string> demangleItanium(llvm::StringRef name);
+llvm::Optional<std::string> demangleMSVC(llvm::StringRef s);
 
-std::vector<uint8_t> parseHex(llvm::StringRef S);
-bool isValidCIdentifier(llvm::StringRef S);
+std::vector<uint8_t> parseHex(llvm::StringRef s);
+bool isValidCIdentifier(llvm::StringRef s);
 
 // Write the contents of the a buffer to a file
-void saveBuffer(llvm::StringRef Buffer, const llvm::Twine &Path);
+void saveBuffer(llvm::StringRef buffer, const llvm::Twine &path);
 
 // This class represents multiple glob patterns.
 class StringMatcher {
 public:
   StringMatcher() = default;
-  explicit StringMatcher(llvm::ArrayRef<llvm::StringRef> Pat);
+  explicit StringMatcher(llvm::ArrayRef<llvm::StringRef> pat);
 
-  bool match(llvm::StringRef S) const;
+  bool match(llvm::StringRef s) const;
 
 private:
-  std::vector<llvm::GlobPattern> Patterns;
+  std::vector<llvm::GlobPattern> patterns;
 };
 
 } // namespace lld
diff --git a/linux-x64/clang/include/lld/Common/Threads.h b/linux-x64/clang/include/lld/Common/Threads.h
index e356fcd..7834130 100644
--- a/linux-x64/clang/include/lld/Common/Threads.h
+++ b/linux-x64/clang/include/lld/Common/Threads.h
@@ -63,21 +63,28 @@
 
 namespace lld {
 
-extern bool ThreadsEnabled;
+extern bool threadsEnabled;
 
-template <typename R, class FuncTy> void parallelForEach(R &&Range, FuncTy Fn) {
-  if (ThreadsEnabled)
-    for_each(llvm::parallel::par, std::begin(Range), std::end(Range), Fn);
+template <typename R, class FuncTy> void parallelForEach(R &&range, FuncTy fn) {
+  if (threadsEnabled)
+    for_each(llvm::parallel::par, std::begin(range), std::end(range), fn);
   else
-    for_each(llvm::parallel::seq, std::begin(Range), std::end(Range), Fn);
+    for_each(llvm::parallel::seq, std::begin(range), std::end(range), fn);
 }
 
-inline void parallelForEachN(size_t Begin, size_t End,
-                             llvm::function_ref<void(size_t)> Fn) {
-  if (ThreadsEnabled)
-    for_each_n(llvm::parallel::par, Begin, End, Fn);
+inline void parallelForEachN(size_t begin, size_t end,
+                             llvm::function_ref<void(size_t)> fn) {
+  if (threadsEnabled)
+    for_each_n(llvm::parallel::par, begin, end, fn);
   else
-    for_each_n(llvm::parallel::seq, Begin, End, Fn);
+    for_each_n(llvm::parallel::seq, begin, end, fn);
+}
+
+template <typename R, class FuncTy> void parallelSort(R &&range, FuncTy fn) {
+  if (threadsEnabled)
+    sort(llvm::parallel::par, std::begin(range), std::end(range), fn);
+  else
+    sort(llvm::parallel::seq, std::begin(range), std::end(range), fn);
 }
 
 } // namespace lld
diff --git a/linux-x64/clang/include/lld/Common/Timer.h b/linux-x64/clang/include/lld/Common/Timer.h
index e2b6951..4a298b0 100644
--- a/linux-x64/clang/include/lld/Common/Timer.h
+++ b/linux-x64/clang/include/lld/Common/Timer.h
@@ -21,18 +21,18 @@
 class Timer;
 
 struct ScopedTimer {
-  explicit ScopedTimer(Timer &T);
+  explicit ScopedTimer(Timer &t);
 
   ~ScopedTimer();
 
   void stop();
 
-  Timer *T = nullptr;
+  Timer *t = nullptr;
 };
 
 class Timer {
 public:
-  Timer(llvm::StringRef Name, Timer &Parent);
+  Timer(llvm::StringRef name, Timer &parent);
 
   static Timer &root();
 
@@ -43,14 +43,14 @@
   double millis() const;
 
 private:
-  explicit Timer(llvm::StringRef Name);
-  void print(int Depth, double TotalDuration, bool Recurse = true) const;
+  explicit Timer(llvm::StringRef name);
+  void print(int depth, double totalDuration, bool recurse = true) const;
 
-  std::chrono::time_point<std::chrono::high_resolution_clock> StartTime;
-  std::chrono::nanoseconds Total;
-  std::vector<Timer *> Children;
-  std::string Name;
-  Timer *Parent;
+  std::chrono::time_point<std::chrono::high_resolution_clock> startTime;
+  std::chrono::nanoseconds total;
+  std::vector<Timer *> children;
+  std::string name;
+  Timer *parent;
 };
 
 } // namespace lld