1 //===-- llvm/Argument.h - Definition of the Argument class ------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
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.
8 //===----------------------------------------------------------------------===//
10 // This file defines the Argument class, which represents an incoming formal
11 // argument to a Function.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_ARGUMENT_H
16 #define LLVM_ARGUMENT_H
18 #include "llvm/Value.h"
22 class Argument : public Value { // Defined in the Function.cpp file
25 Argument *Prev, *Next; // Next and Prev links for our intrusive linked list
26 void setNext(Argument *N) { Next = N; }
27 void setPrev(Argument *N) { Prev = N; }
28 friend class SymbolTableListTraits<Argument, Function, Function,
29 ilist_traits<Argument> >;
30 void setParent(Function *parent);
33 /// Argument ctor - If Function argument is specified, this argument is
34 /// inserted at the end of the argument list for the function.
36 Argument(const Type *Ty, const std::string &Name = "", Function *F = 0);
38 /// setName - Specialize setName to handle symbol table majik...
39 virtual void setName(const std::string &name, SymbolTable *ST = 0);
41 inline const Function *getParent() const { return Parent; }
42 inline Function *getParent() { return Parent; }
44 // getNext/Prev - Return the next or previous argument in the list.
45 Argument *getNext() { return Next; }
46 const Argument *getNext() const { return Next; }
47 Argument *getPrev() { return Prev; }
48 const Argument *getPrev() const { return Prev; }
50 virtual void print(std::ostream &OS) const;
52 /// classof - Methods for support type inquiry through isa, cast, and
55 static inline bool classof(const Argument *) { return true; }
56 static inline bool classof(const Value *V) {
57 return V->getValueType() == ArgumentVal;
61 } // End llvm namespace