aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/Scalar/SymbolStripping.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-02-26 21:46:54 +0000
committerChris Lattner <sabre@nondot.org>2002-02-26 21:46:54 +0000
commitbd0ef77cde9c9e82f2b4ad33e4982c46274d6540 (patch)
tree0903b61112c9e6d336c8b623e235ede2f937f13c /lib/Transforms/Scalar/SymbolStripping.cpp
parent3b2541424f771ae11c30675ce06da7b380780028 (diff)
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
Diffstat (limited to 'lib/Transforms/Scalar/SymbolStripping.cpp')
-rw-r--r--lib/Transforms/Scalar/SymbolStripping.cpp27
1 files changed, 25 insertions, 2 deletions
diff --git a/lib/Transforms/Scalar/SymbolStripping.cpp b/lib/Transforms/Scalar/SymbolStripping.cpp
index 12f8e918b3..8502082a15 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 @@ static bool StripSymbolTable(SymbolTable *SymTab) {
// 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();
+}