Use a StringSet in Internalize, and allow to create the pass from an existing one (NFC)

There is not reason to pass an array of "char *" to rebuild a set if
the client already has one.

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 260462
diff --git a/llvm/lib/Transforms/IPO/Internalize.cpp b/llvm/lib/Transforms/IPO/Internalize.cpp
index 21bb5d0..a57176f 100644
--- a/llvm/lib/Transforms/IPO/Internalize.cpp
+++ b/llvm/lib/Transforms/IPO/Internalize.cpp
@@ -22,6 +22,7 @@
 #include "llvm/Transforms/IPO.h"
 #include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/ADT/Statistic.h"
+#include "llvm/ADT/StringSet.h"
 #include "llvm/Analysis/CallGraph.h"
 #include "llvm/IR/Module.h"
 #include "llvm/Pass.h"
@@ -54,11 +55,13 @@
 
 namespace {
   class InternalizePass : public ModulePass {
-    std::set<std::string> ExternalNames;
+    StringSet<> ExternalNames;
+
   public:
     static char ID; // Pass identification, replacement for typeid
     explicit InternalizePass();
     explicit InternalizePass(ArrayRef<const char *> ExportList);
+    explicit InternalizePass(StringSet<> ExportList);
     void LoadFile(const char *Filename);
     bool maybeInternalize(GlobalValue &GV,
                           const std::set<const Comdat *> &ExternalComdats);
@@ -93,6 +96,9 @@
   }
 }
 
+InternalizePass::InternalizePass(StringSet<> ExportList)
+    : ModulePass(ID), ExternalNames(std::move(ExportList)) {}
+
 void InternalizePass::LoadFile(const char *Filename) {
   // Load the APIFile...
   std::ifstream In(Filename);
@@ -110,7 +116,7 @@
 }
 
 static bool isExternallyVisible(const GlobalValue &GV,
-                                const std::set<std::string> &ExternalNames) {
+                                const StringSet<> &ExternalNames) {
   // Function must be defined here
   if (GV.isDeclaration())
     return true;
@@ -267,3 +273,7 @@
 ModulePass *llvm::createInternalizePass(ArrayRef<const char *> ExportList) {
   return new InternalizePass(ExportList);
 }
+
+ModulePass *llvm::createInternalizePass(StringSet<> ExportList) {
+  return new InternalizePass(std::move(ExportList));
+}