From: Iain Sandoe <iain@sandoe.co.uk>
Date: Sun, 2 Sep 2018 16:30:49 +0100
Subject: [PATCH] [tapi, llvm] VersionTuple from Support.

---
 include/tapi/Core/ArchitectureSupport.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git tapi/include/tapi/Core/ArchitectureSupport.h tapi/include/tapi/Core/ArchitectureSupport.h
index 148c5ca..56f2d91 100644
--- tapi/include/tapi/Core/ArchitectureSupport.h
+++ tapi/include/tapi/Core/ArchitectureSupport.h
@@ -21,9 +21,9 @@
 #include "tapi/LinkerInterfaceFile.h"
 #include "tapi/PackedVersion32.h"
 #include "tapi/tapi.h"
-#include "clang/Basic/VersionTuple.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/raw_ostream.h"
+#include "llvm/Support/VersionTuple.h"
 #include <utility>
 
 TAPI_NAMESPACE_INTERNAL_BEGIN
@@ -35,7 +35,7 @@ struct PackedVersion {
   constexpr PackedVersion(uint32_t version) : _version(version) {}
   PackedVersion(unsigned major, unsigned minor, unsigned subminor)
       : _version((major << 16) | ((minor & 0xff) << 8) | (subminor & 0xff)) {}
-  PackedVersion(clang::VersionTuple version) {
+  PackedVersion(llvm::VersionTuple version) {
     _version = version.getMajor() << 16;
     if (auto minor = version.getMinor())
       _version |= (*minor & 0xff) << 8;



From: Iain Sandoe <iain@sandoe.co.uk>
Date: Fri, 5 Jul 2019 13:09:53 +0100
Subject: [PATCH] [tapi] Add a missed <vector> header.

---
 include/tapi/Core/HeaderFile.h | 1 +
 1 file changed, 1 insertion(+)

diff --git tapi/include/tapi/Core/HeaderFile.h tapi/include/tapi/Core/HeaderFile.h
index eaf5f77..baeb610 100644
--- tapi/include/tapi/Core/HeaderFile.h
+++ tapi/include/tapi/Core/HeaderFile.h
@@ -19,6 +19,7 @@
 #include "tapi/Defines.h"
 #include "llvm/ADT/StringRef.h"
 #include <string>
+#include <vector>
 
 TAPI_NAMESPACE_INTERNAL_BEGIN



From: Iain Sandoe <iain@sandoe.co.uk>
Date: Sun, 2 Sep 2018 16:48:58 +0100
Subject: [PATCH] [tapi] API changes for ExecuteAndWait().

---
 lib/Driver/InstallAPIDriver.cpp | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git tapi/lib/Driver/InstallAPIDriver.cpp tapi/lib/Driver/InstallAPIDriver.cpp
index 8f5a3be..ddb9454 100644
--- tapi/lib/Driver/InstallAPIDriver.cpp
+++ tapi/lib/Driver/InstallAPIDriver.cpp
@@ -331,7 +331,8 @@ getCodeCoverageSymbols(DiagnosticsEngine &diag,
   std::string installDir = toolchainBinDir;
   std::vector<std::unique_ptr<ExtendedInterfaceFile>> files;
   for (const auto &target : targets) {
-    const char *clangArgs[] = {"clang",
+    SmallVector<const char*, 128> ClangArgv =
+			      {"clang",
                                "-target",
                                target.str().c_str(),
                                "-dynamiclib",
@@ -353,12 +354,16 @@ getCodeCoverageSymbols(DiagnosticsEngine &diag,
                                      ec);
     FileRemover removeStderrFile(stderrFile);
 
-    const Optional<StringRef> redirects[] = {/*STDIN=*/llvm::None,
-                                             /*STDOUT=*/llvm::None,
-                                             /*STDERR=*/StringRef(stderrFile)};
-
-    bool failed = sys::ExecuteAndWait(clangBinary.get(), clangArgs,
-                                      /*env=*/nullptr, redirects);
+    StringRef stderrFileStr(stderrFile);
+    SmallVector<llvm::Optional<StringRef>, 3> Rd =
+      {/*STDIN=*/ llvm::None,
+       /*STDOUT=*/llvm::None,
+       /*STDERR=*/StringRef(stderrFile)};
+    ArrayRef<Optional<StringRef>> Redirects(Rd);
+    Optional<ArrayRef<StringRef>> Env;
+    auto Args = llvm::toStringRefArray(ClangArgv.data());
+    bool failed = sys::ExecuteAndWait(clangBinary.get(), Args,
+                                      Env, Redirects);
 
     if (failed) {
       auto bufferOr = MemoryBuffer::getFile(stderrFile);
@@ -366,8 +371,8 @@ getCodeCoverageSymbols(DiagnosticsEngine &diag,
         return make_error<StringError>("unable to read file", ec);
 
       std::string message = "'clang' invocation failed:\n";
-      for (auto *arg : clangArgs) {
-        if (arg == nullptr)
+      for (auto arg : Args) {
+        if (arg == "")
           continue;
         message.append(arg).append(1, ' ');
       }

From 36b039df99f82c5cb1b2eb112b0d1eedfeadea81 Mon Sep 17 00:00:00 2001
From: Iain Sandoe <iain@sandoe.co.uk>
Date: Sun, 2 Sep 2018 16:40:25 +0100
Subject: [PATCH] [tapi] Diagnostics generation needs declaration of
 TextSubstitution class.

---
 include/tapi/Diagnostics/DiagnosticTAPIKinds.td | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git tapi/include/tapi/Diagnostics/DiagnosticTAPIKinds.td tapi/include/tapi/Diagnostics/DiagnosticTAPIKinds.td
index 76eb025..0029221 100644
--- tapi/include/tapi/Diagnostics/DiagnosticTAPIKinds.td
+++ tapi/include/tapi/Diagnostics/DiagnosticTAPIKinds.td
@@ -7,6 +7,15 @@
 //
 //===----------------------------------------------------------------------===//
 
+// Textual substitutions which may be performed on the text of diagnostics
+class TextSubstitution<string Text> {
+  string Substitution = Text;
+  // TODO: These are only here to allow substitutions to be declared inline with
+  // diagnostics
+  string Component = "";
+  string CategoryName = "";
+}
+
 // Define the diagnostic severities.
 class Severity<string N> {
   string Name = N;
