From 170ebf4f19459ae51a9561d0e65c87ee4c9b2c97 Mon Sep 17 00:00:00 2001
From: Sean Silva <chisophugis@gmail.com>
Date: Fri, 15 Aug 2014 23:18:49 +0000
Subject: [PATCH] Update for LLVM change (StringSaver)

There is more cleanup to be done here. Once
llvm::sys::Process::GetArgumentVector is switched over to StringSaver,
we can simplify this code a fair amount.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@215785 91177308-0d34-0410-b5e6-96231b3b80d8
---
 tools/driver/driver.cpp | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/tools/driver/driver.cpp b/tools/driver/driver.cpp
index 2533401082a..02efeb0c288 100644
--- a/tools/driver/driver.cpp
+++ b/tools/driver/driver.cpp
@@ -41,6 +41,7 @@
 #include "llvm/Support/Program.h"
 #include "llvm/Support/Regex.h"
 #include "llvm/Support/Signals.h"
+#include "llvm/Support/StringSaver.h"
 #include "llvm/Support/TargetRegistry.h"
 #include "llvm/Support/TargetSelect.h"
 #include "llvm/Support/Timer.h"
@@ -281,18 +282,6 @@ static void ParseProgName(SmallVectorImpl<const char *> &ArgVector,
   }
 }
 
-namespace {
-  class StringSetSaver : public llvm::cl::StringSaver {
-  public:
-    StringSetSaver(std::set<std::string> &Storage) : Storage(Storage) {}
-    const char *SaveString(const char *Str) override {
-      return GetStableCStr(Storage, Str);
-    }
-  private:
-    std::set<std::string> &Storage;
-  };
-}
-
 static void SetBackdoorDriverOutputsFromEnvVars(Driver &TheDriver) {
   // Handle CC_PRINT_OPTIONS and CC_PRINT_OPTIONS_FILE.
   TheDriver.CCPrintOptions = !!::getenv("CC_PRINT_OPTIONS");
@@ -383,7 +372,7 @@ int main(int argc_, const char **argv_) {
   }
 
   std::set<std::string> SavedStrings;
-  StringSetSaver Saver(SavedStrings);
+  llvm::StringSaver Saver;
   llvm::cl::ExpandResponseFiles(Saver, llvm::cl::TokenizeGNUCommandLine, argv);
 
   // Handle -cc1 integrated tools.
-- 
GitLab