#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/StringSet.h"
namespace llvm {
///
/// Note that commandline options that are used with the above function are not
/// used now!
+ModulePass *createInternalizePass(StringSet<> ExportList);
+
+/// Same as above, but with an exportList created for an array.
ModulePass *createInternalizePass(ArrayRef<const char *> ExportList);
+
/// createInternalizePass - Same as above, but with an empty exportList.
ModulePass *createInternalizePass();
#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"
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);
}
}
+InternalizePass::InternalizePass(StringSet<> ExportList)
+ : ModulePass(ID), ExternalNames(std::move(ExportList)) {}
+
void InternalizePass::LoadFile(const char *Filename) {
// Load the APIFile...
std::ifstream In(Filename);
}
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;
ModulePass *llvm::createInternalizePass(ArrayRef<const char *> ExportList) {
return new InternalizePass(ExportList);
}
+
+ModulePass *llvm::createInternalizePass(StringSet<> ExportList) {
+ return new InternalizePass(std::move(ExportList));
+}