1 //===-- llvm/Argument.h - Definition of the Argument class -------*- C++ -*--=//
3 // This file defines the Argument class, which represents and incoming formal
4 // argument to a Function.
6 //===----------------------------------------------------------------------===//
8 #ifndef LLVM_ARGUMENT_H
9 #define LLVM_ARGUMENT_H
11 #include "llvm/Value.h"
13 class Argument : public Value { // Defined in the Function.cpp file
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 void setParent(Function *parent);
23 /// Argument ctor - If Function argument is specified, this argument is
24 /// inserted at the end of the argument list for the function.
26 Argument(const Type *Ty, const std::string &Name = "", Function *F = 0);
28 /// setName - Specialize setName to handle symbol table majik...
29 virtual void setName(const std::string &name, SymbolTable *ST = 0);
31 inline const Function *getParent() const { return Parent; }
32 inline Function *getParent() { return Parent; }
34 // getNext/Prev - Return the next or previous argument in the list.
35 Argument *getNext() { return Next; }
36 const Argument *getNext() const { return Next; }
37 Argument *getPrev() { return Prev; }
38 const Argument *getPrev() const { return Prev; }
40 virtual void print(std::ostream &OS) const;
42 /// classof - Methods for support type inquiry through isa, cast, and
45 static inline bool classof(const Argument *) { return true; }
46 static inline bool classof(const Value *V) {
47 return V->getValueType() == ArgumentVal;