class LexicalScopes {
public:
LexicalScopes() : MF(NULL), CurrentFnLexicalScope(NULL) {}
- virtual ~LexicalScopes();
+ ~LexicalScopes();
- /// initialize - Scan machine function and constuct lexical scope nest.
- virtual void initialize(const MachineFunction &);
+ /// initialize - Scan machine function and constuct lexical scope nest, resets
+ /// the instance if necessary.
+ void initialize(const MachineFunction &);
/// releaseMemory - release memory.
- virtual void releaseMemory();
+ void reset();
/// empty - Return true if there is any lexical scope information available.
bool empty() { return CurrentFnLexicalScope == NULL; }
/// LexicalScope - This class is used to track scope information.
///
class LexicalScope {
- virtual void anchor();
public:
LexicalScope(LexicalScope *P, const MDNode *D, const MDNode *I, bool A)
Parent->addChild(this);
}
- virtual ~LexicalScope() {}
-
// Accessors.
LexicalScope *getParent() const { return Parent; }
const MDNode *getDesc() const { return Desc; }
#include "llvm/Support/FormattedStream.h"
using namespace llvm;
-LexicalScopes::~LexicalScopes() { releaseMemory(); }
+/// ~LexicalScopes - final cleanup after ourselves.
+LexicalScopes::~LexicalScopes() { reset(); }
-/// releaseMemory - release memory.
-void LexicalScopes::releaseMemory() {
+/// reset - Reset the instance so that it's prepared for another function.
+void LexicalScopes::reset() {
MF = NULL;
CurrentFnLexicalScope = NULL;
DeleteContainerSeconds(LexicalScopeMap);
/// initialize - Scan machine function and constuct lexical scope nest.
void LexicalScopes::initialize(const MachineFunction &Fn) {
- releaseMemory();
+ reset();
MF = &Fn;
SmallVector<InsnRange, 4> MIRanges;
DenseMap<const MachineInstr *, LexicalScope *> MI2ScopeMap;
return Result;
}
-void LexicalScope::anchor() {}
-
/// dump - Print data structures.
void LexicalScope::dump(unsigned Indent) const {
#ifndef NDEBUG