1 //===-- llvm/SymTabDef.h - Implement SymbolTable Defs ------------*- C++ -*--=//
3 // This subclass of Def implements a def that has a symbol table for keeping
4 // track of children. This is used by the DefHolder template class...
6 //===----------------------------------------------------------------------===//
8 #ifndef LLVM_SYMTABDEF_H
9 #define LLVM_SYMTABDEF_H
11 #include "llvm/Value.h" // Get the definition of Value
12 #include "llvm/ConstantPool.h"
17 class SymTabValue : public Value {
19 typedef ConstantPool ConstantPoolType;
21 SymbolTable *SymTab, *ParentSymTab;
22 ConstantPool ConstPool; // The constant pool
25 void setParentSymTab(SymbolTable *ST);
27 SymTabValue(const Type *Ty, ValueTy dty, const string &name = "");
28 ~SymTabValue(); // Implemented in Def.cpp
30 // hasSymbolTable() - Returns true if there is a symbol table allocated to
31 // this object AND if there is at least one name in it!
33 bool hasSymbolTable() const;
35 // CAUTION: The current symbol table may be null if there are no names (ie,
36 // the symbol table is empty)
38 inline SymbolTable *getSymbolTable() { return SymTab; }
39 inline const SymbolTable *getSymbolTable() const { return SymTab; }
41 inline const ConstantPool &getConstantPool() const{ return ConstPool; }
42 inline ConstantPool &getConstantPool() { return ConstPool; }
44 // getSymbolTableSure is guaranteed to not return a null pointer, because if
45 // the method does not already have a symtab, one is created. Use this if
46 // you intend to put something into the symbol table for the method.
48 SymbolTable *getSymbolTableSure(); // Implemented in Def.cpp