Rename Value::getValueType to getValueID, to avoid confusion with
[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 declares the Argument class. 
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef LLVM_ARGUMENT_H
15 #define LLVM_ARGUMENT_H
16
17 #include "llvm/Value.h"
18
19 namespace llvm {
20
21 template<typename SC> struct ilist_traits;
22 template<typename ValueSubClass, typename ItemParentClass, typename SymTabClass,
23          typename SubClass> class SymbolTableListTraits;
24
25 /// A class to represent an incoming formal argument to a Function. An argument
26 /// is a very simple Value. It is essentially a named (optional) type. When used
27 /// in the body of a function, it represents the value of the actual argument
28 /// the function was called with.
29 /// @brief LLVM Argument representation  
30 class Argument : public Value {  // Defined in the Function.cpp file
31   Function *Parent;
32
33   Argument *Prev, *Next; // Next and Prev links for our intrusive linked list
34   void setNext(Argument *N) { Next = N; }
35   void setPrev(Argument *N) { Prev = N; }
36   friend class SymbolTableListTraits<Argument, Function, Function,
37                                      ilist_traits<Argument> >;
38   void setParent(Function *parent);
39
40 public:
41   /// Argument ctor - If Function argument is specified, this argument is
42   /// inserted at the end of the argument list for the function.
43   ///
44   explicit Argument(const Type *Ty,
45                     const std::string &Name = "",
46                     Function *F = 0);
47
48   inline const Function *getParent() const { return Parent; }
49   inline       Function *getParent()       { return Parent; }
50
51   // getNext/Prev - Return the next or previous argument in the list.
52         Argument *getNext()       { return Next; }
53   const Argument *getNext() const { return Next; }
54         Argument *getPrev()       { return Prev; }
55   const Argument *getPrev() const { return Prev; }
56
57   virtual void print(std::ostream &OS) const;
58   void print(std::ostream *OS) const {
59     if (OS) print(*OS);
60   }
61
62   /// classof - Methods for support type inquiry through isa, cast, and
63   /// dyn_cast:
64   ///
65   static inline bool classof(const Argument *) { return true; }
66   static inline bool classof(const Value *V) {
67     return V->getValueID() == ArgumentVal;
68   }
69 };
70
71 } // End llvm namespace
72
73 #endif