Change over to use new style pass mechanism, now passes only expose small
creation functions in their public header file, unless they can help it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1816 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Transforms/Scalar/SymbolStripping.cpp b/lib/Transforms/Scalar/SymbolStripping.cpp
index 12f8e91..8502082 100644
--- a/lib/Transforms/Scalar/SymbolStripping.cpp
+++ b/lib/Transforms/Scalar/SymbolStripping.cpp
@@ -18,6 +18,7 @@
#include "llvm/Module.h"
#include "llvm/Method.h"
#include "llvm/SymbolTable.h"
+#include "llvm/Pass.h"
static bool StripSymbolTable(SymbolTable *SymTab) {
if (SymTab == 0) return false; // No symbol table? No problem.
@@ -44,16 +45,38 @@
// DoSymbolStripping - Remove all symbolic information from a method
//
-bool SymbolStripping::doSymbolStripping(Method *M) {
+static bool doSymbolStripping(Method *M) {
return StripSymbolTable(M->getSymbolTable());
}
// doStripGlobalSymbols - Remove all symbolic information from all methods
// in a module, and all module level symbols. (method names, etc...)
//
-bool FullSymbolStripping::doStripGlobalSymbols(Module *M) {
+static bool doStripGlobalSymbols(Module *M) {
// Remove all symbols from methods in this module... and then strip all of the
// symbols in this module...
//
return StripSymbolTable(M->getSymbolTable());
}
+
+namespace {
+ struct SymbolStripping : public MethodPass {
+ virtual bool runOnMethod(Method *M) {
+ return doSymbolStripping(M);
+ }
+ };
+
+ struct FullSymbolStripping : public SymbolStripping {
+ virtual bool doInitialization(Module *M) {
+ return doStripGlobalSymbols(M);
+ }
+ };
+}
+
+Pass *createSymbolStrippingPass() {
+ return new SymbolStripping();
+}
+
+Pass *createFullSymbolStrippingPass() {
+ return new FullSymbolStripping();
+}