2001-07-14 06:07:58 +00:00
|
|
|
//===-- llvm/SymTabValue.h - Implement SymbolTable Values --------*- C++ -*--=//
|
2001-06-06 20:29:01 +00:00
|
|
|
//
|
2001-07-14 06:07:58 +00:00
|
|
|
// This subclass of Value implements a def that has a symbol table for keeping
|
|
|
|
// track of children. This is used by the ValueHolder template class...
|
2001-06-06 20:29:01 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2001-07-14 06:07:58 +00:00
|
|
|
#ifndef LLVM_SYMTAB_VALUE_H
|
|
|
|
#define LLVM_SYMTAB_VALUE_H
|
2001-06-06 20:29:01 +00:00
|
|
|
|
|
|
|
#include "llvm/ConstantPool.h"
|
|
|
|
|
|
|
|
class SymbolTable;
|
|
|
|
class ConstPoolVal;
|
2001-07-14 06:07:58 +00:00
|
|
|
class Value;
|
2001-06-06 20:29:01 +00:00
|
|
|
|
2001-07-14 06:07:58 +00:00
|
|
|
class SymTabValue {
|
2001-06-06 20:29:01 +00:00
|
|
|
public:
|
|
|
|
typedef ConstantPool ConstantPoolType;
|
|
|
|
private:
|
|
|
|
SymbolTable *SymTab, *ParentSymTab;
|
|
|
|
ConstantPool ConstPool; // The constant pool
|
2001-07-14 06:07:58 +00:00
|
|
|
Value *ValueParent;
|
2001-06-06 20:29:01 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
void setParentSymTab(SymbolTable *ST);
|
|
|
|
public:
|
2001-07-14 06:07:58 +00:00
|
|
|
SymTabValue(Value *Parent);
|
|
|
|
~SymTabValue(); // Implemented in Value.cpp
|
|
|
|
|
|
|
|
inline Value *getSTVParent() { return ValueParent; }
|
|
|
|
inline const Value *getSTVParent() const { return ValueParent; }
|
2001-06-06 20:29:01 +00:00
|
|
|
|
|
|
|
// hasSymbolTable() - Returns true if there is a symbol table allocated to
|
|
|
|
// this object AND if there is at least one name in it!
|
|
|
|
//
|
|
|
|
bool hasSymbolTable() const;
|
|
|
|
|
|
|
|
// CAUTION: The current symbol table may be null if there are no names (ie,
|
|
|
|
// the symbol table is empty)
|
|
|
|
//
|
|
|
|
inline SymbolTable *getSymbolTable() { return SymTab; }
|
|
|
|
inline const SymbolTable *getSymbolTable() const { return SymTab; }
|
|
|
|
|
|
|
|
inline const ConstantPool &getConstantPool() const{ return ConstPool; }
|
|
|
|
inline ConstantPool &getConstantPool() { return ConstPool; }
|
|
|
|
|
|
|
|
// getSymbolTableSure is guaranteed to not return a null pointer, because if
|
|
|
|
// the method does not already have a symtab, one is created. Use this if
|
|
|
|
// you intend to put something into the symbol table for the method.
|
|
|
|
//
|
2001-07-14 06:07:58 +00:00
|
|
|
SymbolTable *getSymbolTableSure(); // Implemented in Value.cpp
|
2001-06-06 20:29:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|