mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-03-12 01:41:37 +00:00
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@878 91177308-0d34-0410-b5e6-96231b3b80d8
36 lines
1019 B
C++
36 lines
1019 B
C++
//===- llvm/Transforms/PrintModulePass.h - Printing Pass ---------*- C++ -*--=//
|
|
//
|
|
// This file defines a simple pass to print out methods of a module as they are
|
|
// processed.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef LLVM_TRANSFORMS_PRINTMODULE_H
|
|
#define LLVM_TRANSFORMS_PRINTMODULE_H
|
|
|
|
#include "llvm/Transforms/Pass.h"
|
|
#include "llvm/Assembly/Writer.h"
|
|
|
|
class PrintModulePass : public Pass {
|
|
string Banner; // String to print before each method
|
|
ostream *Out; // ostream to print on
|
|
bool DeleteStream; // Delete the ostream in our dtor?
|
|
public:
|
|
inline PrintModulePass(const string &B, ostream *o = &cout, bool DS = false)
|
|
: Banner(B), Out(o), DeleteStream(DS) {}
|
|
|
|
~PrintModulePass() {
|
|
if (DeleteStream) delete Out;
|
|
}
|
|
|
|
// doPerMethodWork - This pass just prints a banner followed by the method as
|
|
// it's processed.
|
|
//
|
|
bool doPerMethodWork(Method *M) {
|
|
(*Out) << Banner << M;
|
|
return false;
|
|
}
|
|
};
|
|
|
|
#endif
|