aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/Function.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-04-28 04:44:40 +0000
committerChris Lattner <sabre@nondot.org>2002-04-28 04:44:40 +0000
commit8c310c75489a94c6e02b779ae0f611dfd3d63619 (patch)
treefaf2b14be9de35582156d0008c7d0951e33a124b /include/llvm/Function.h
parent89bf0056463d3c302976e6a0af94d09b301d705a (diff)
downloadexternal_llvm-8c310c75489a94c6e02b779ae0f611dfd3d63619.zip
external_llvm-8c310c75489a94c6e02b779ae0f611dfd3d63619.tar.gz
external_llvm-8c310c75489a94c6e02b779ae0f611dfd3d63619.tar.bz2
* Incorporate the functionality of SymTabValue into Function
* s/Method/Function git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2343 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Function.h')
-rw-r--r--include/llvm/Function.h39
1 files changed, 31 insertions, 8 deletions
diff --git a/include/llvm/Function.h b/include/llvm/Function.h
index 91df9a7..5bba530 100644
--- a/include/llvm/Function.h
+++ b/include/llvm/Function.h
@@ -3,21 +3,21 @@
// 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
-#include "llvm/SymTabValue.h"
#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;
@@ -30,9 +30,11 @@ public:
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
+
+ SymbolTable *SymTab, *ParentSymTab;
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
- // 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
- // 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; }
@@ -62,6 +64,27 @@ public:
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