ca2c567b897e9b21653d71122b93ec2e133809e0
[oota-llvm.git] / include / llvm / Argument.h
1 //===-- llvm/Argument.h - Definition of the Argument class ------*- C++ -*-===//
2 //
3 // This file defines the Argument class, which represents an incoming formal
4 // argument to a Function.
5 //
6 //===----------------------------------------------------------------------===//
7
8 #ifndef LLVM_ARGUMENT_H
9 #define LLVM_ARGUMENT_H
10
11 #include "llvm/Value.h"
12
13 class Argument : public Value {  // Defined in the Function.cpp file
14   Function *Parent;
15
16   Argument *Prev, *Next; // Next and Prev links for our intrusive linked list
17   void setNext(Argument *N) { Next = N; }
18   void setPrev(Argument *N) { Prev = N; }
19   friend class SymbolTableListTraits<Argument, Function, Function,
20                                      ilist_traits<Argument> >;
21   void setParent(Function *parent);
22
23 public:
24   /// Argument ctor - If Function argument is specified, this argument is
25   /// inserted at the end of the argument list for the function.
26   ///
27   Argument(const Type *Ty, const std::string &Name = "", Function *F = 0);
28
29   /// setName - Specialize setName to handle symbol table majik...
30   virtual void setName(const std::string &name, SymbolTable *ST = 0);
31
32   inline const Function *getParent() const { return Parent; }
33   inline       Function *getParent()       { return Parent; }
34  
35   // getNext/Prev - Return the next or previous argument in the list.
36         Argument *getNext()       { return Next; }
37   const Argument *getNext() const { return Next; }
38         Argument *getPrev()       { return Prev; }
39   const Argument *getPrev() const { return Prev; }
40
41   virtual void print(std::ostream &OS) const;
42
43   /// classof - Methods for support type inquiry through isa, cast, and
44   /// dyn_cast:
45   ///
46   static inline bool classof(const Argument *) { return true; }
47   static inline bool classof(const Value *V) {
48     return V->getValueType() == ArgumentVal;
49   }
50 };
51
52 #endif