* Incorporate the functionality of SymTabValue into Function
authorChris Lattner <sabre@nondot.org>
Sun, 28 Apr 2002 04:44:40 +0000 (04:44 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 28 Apr 2002 04:44:40 +0000 (04:44 +0000)
* s/Method/Function

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2343 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Function.h

index 91df9a70cfa34f5cb8dad9ffb82e9c5de097bfbb..5bba530ed064fc3d5d412ac94fa0917aca7a55ca 100644 (file)
@@ -3,21 +3,21 @@
 // This file contains the declaration of the Function class, which represents a 
 // single function/procedure in the VM.
 //
 // This file contains the declaration of the Function class, which represents a 
 // single function/procedure in the VM.
 //
-// Note that basic blocks in the method are value's, because they are referenced
-// by instructions like calls and can go into virtual function tables and stuff.
+// Note that BasicBlock's in the Function are Value's, because they are
+// referenced by instructions like calls and can go into virtual function tables
+// and stuff.
 //
 //===----------------------------------------------------------------------===//
 
 #ifndef LLVM_FUNCTION_H
 #define LLVM_FUNCTION_H
 
 //
 //===----------------------------------------------------------------------===//
 
 #ifndef LLVM_FUNCTION_H
 #define LLVM_FUNCTION_H
 
-#include "llvm/SymTabValue.h"
 #include "llvm/GlobalValue.h"
 #include "llvm/ValueHolder.h"
 
 class FunctionType;
 
 #include "llvm/GlobalValue.h"
 #include "llvm/ValueHolder.h"
 
 class FunctionType;
 
-class Function : public GlobalValue, public SymTabValue {
+class Function : public GlobalValue {
 public:
   typedef ValueHolder<Argument  , Function, Function> ArgumentListType;
   typedef ValueHolder<BasicBlock, Function, Function> BasicBlocksType;
 public:
   typedef ValueHolder<Argument  , Function, Function> ArgumentListType;
   typedef ValueHolder<BasicBlock, Function, Function> BasicBlocksType;
@@ -30,9 +30,11 @@ public:
 
 private:
 
 
 private:
 
-  // Important things that make up a method!
+  // Important things that make up a function!
   BasicBlocksType  BasicBlocks;         // The basic blocks
   ArgumentListType ArgumentList;        // The formal arguments
   BasicBlocksType  BasicBlocks;         // The basic blocks
   ArgumentListType ArgumentList;        // The formal arguments
+
+  SymbolTable *SymTab, *ParentSymTab;
   
   friend class ValueHolder<Function, Module, Module>;
   void setParent(Module *parent);
   
   friend class ValueHolder<Function, Module, Module>;
   void setParent(Module *parent);
@@ -47,12 +49,12 @@ public:
   const Type *getReturnType() const;           // Return the type of the ret val
   const FunctionType *getFunctionType() const; // Return the FunctionType for me
 
   const Type *getReturnType() const;           // Return the type of the ret val
   const FunctionType *getFunctionType() const; // Return the FunctionType for me
 
-  // Is the body of this method unknown? (the basic block list is empty if so)
-  // this is true for external methods, defined as forward "declare"ations
+  // Is the body of this function unknown? (the basic block list is empty if so)
+  // this is true for external functions, defined as forward "declare"ations
   bool isExternal() const { return BasicBlocks.empty(); }
 
   // Get the underlying elements of the Function... both the argument list and
   bool isExternal() const { return BasicBlocks.empty(); }
 
   // Get the underlying elements of the Function... both the argument list and
-  // basic block list are empty for external methods.
+  // basic block list are empty for external functions.
   //
   inline const ArgumentListType &getArgumentList() const{ return ArgumentList; }
   inline       ArgumentListType &getArgumentList()      { return ArgumentList; }
   //
   inline const ArgumentListType &getArgumentList() const{ return ArgumentList; }
   inline       ArgumentListType &getArgumentList()      { return ArgumentList; }
@@ -62,6 +64,27 @@ public:
 
   inline const BasicBlock       *getEntryNode() const   { return front(); }
   inline       BasicBlock       *getEntryNode()         { return front(); }
 
   inline const BasicBlock       *getEntryNode() const   { return front(); }
   inline       BasicBlock       *getEntryNode()         { return front(); }
+
+  //===--------------------------------------------------------------------===//
+  // Symbol Table Accessing functions...
+
+  // 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; }
+
+  // getSymbolTableSure is guaranteed to not return a null pointer, because if
+  // the function does not already have a symtab, one is created.  Use this if
+  // you intend to put something into the symbol table for the function.
+  //
+  SymbolTable *getSymbolTableSure();  // Implemented in Value.cpp
+
   
   //===--------------------------------------------------------------------===//
   // BasicBlock iterator forwarding functions
   
   //===--------------------------------------------------------------------===//
   // BasicBlock iterator forwarding functions