Changes For Bug 352
[oota-llvm.git] / include / llvm / Argument.h
1 //===-- llvm/Argument.h - Definition of the Argument class ------*- C++ -*-===//
2 // 
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
7 // 
8 //===----------------------------------------------------------------------===//
9 //
10 // This file defines the Argument class, which represents an incoming formal
11 // argument to a Function.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #ifndef LLVM_ARGUMENT_H
16 #define LLVM_ARGUMENT_H
17
18 #include "llvm/Value.h"
19
20 namespace llvm {
21
22 template<typename SC> struct ilist_traits;
23 template<typename ValueSubClass, typename ItemParentClass, typename SymTabClass,
24          typename SubClass> class SymbolTableListTraits;
25
26 class Argument : public Value {  // Defined in the Function.cpp file
27   Function *Parent;
28
29   Argument *Prev, *Next; // Next and Prev links for our intrusive linked list
30   void setNext(Argument *N) { Next = N; }
31   void setPrev(Argument *N) { Prev = N; }
32   friend class SymbolTableListTraits<Argument, Function, Function,
33                                      ilist_traits<Argument> >;
34   void setParent(Function *parent);
35
36 public:
37   /// Argument ctor - If Function argument is specified, this argument is
38   /// inserted at the end of the argument list for the function.
39   ///
40   Argument(const Type *Ty, const std::string &Name = "", Function *F = 0);
41
42   /// setName - Specialize setName to handle symbol table majik...
43   virtual void setName(const std::string &name, SymbolTable *ST = 0);
44
45   inline const Function *getParent() const { return Parent; }
46   inline       Function *getParent()       { return Parent; }
47  
48   // getNext/Prev - Return the next or previous argument in the list.
49         Argument *getNext()       { return Next; }
50   const Argument *getNext() const { return Next; }
51         Argument *getPrev()       { return Prev; }
52   const Argument *getPrev() const { return Prev; }
53
54   virtual void print(std::ostream &OS) const;
55
56   /// classof - Methods for support type inquiry through isa, cast, and
57   /// dyn_cast:
58   ///
59   static inline bool classof(const Argument *) { return true; }
60   static inline bool classof(const Value *V) {
61     return V->getValueType() == ArgumentVal;
62   }
63 };
64
65 } // End llvm namespace
66
67 #endif