Fix a missing this-> that clang++ notices.
[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 is distributed under the University of Illinois Open Source
6 // 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 #include "llvm/Attributes.h"
19 #include "llvm/ADT/ilist_node.h"
20
21 namespace llvm {
22
23 template<typename ValueSubClass, typename ItemParentClass>
24   class SymbolTableListTraits;
25
26 /// A class to represent an incoming formal argument to a Function. An argument
27 /// is a very simple Value. It is essentially a named (optional) type. When used
28 /// in the body of a function, it represents the value of the actual argument
29 /// the function was called with.
30 /// @brief LLVM Argument representation  
31 class Argument : public Value, public ilist_node<Argument> {
32   Function *Parent;
33
34   friend class SymbolTableListTraits<Argument, Function>;
35   void setParent(Function *parent);
36
37 public:
38   /// Argument ctor - If Function argument is specified, this argument is
39   /// inserted at the end of the argument list for the function.
40   ///
41   explicit Argument(const Type *Ty, const Twine &Name = "", Function *F = 0);
42
43   inline const Function *getParent() const { return Parent; }
44   inline       Function *getParent()       { return Parent; }
45
46   /// getArgNo - Return the index of this formal argument in its containing
47   /// function.  For example in "void foo(int a, float b)" a is 0 and b is 1. 
48   unsigned getArgNo() const;
49   
50   /// hasByValAttr - Return true if this argument has the byval attribute on it
51   /// in its containing function.
52   bool hasByValAttr() const;
53
54   /// hasNestAttr - Return true if this argument has the nest attribute on
55   /// it in its containing function.
56   bool hasNestAttr() const;
57
58   /// hasNoAliasAttr - Return true if this argument has the noalias attribute on
59   /// it in its containing function.
60   bool hasNoAliasAttr() const;
61   
62   /// hasNoCaptureAttr - Return true if this argument has the nocapture
63   /// attribute on it in its containing function.
64   bool hasNoCaptureAttr() const;
65   
66   /// hasSRetAttr - Return true if this argument has the sret attribute on it in
67   /// its containing function.
68   bool hasStructRetAttr() const;
69
70   /// addAttr - Add a Attribute to an argument
71   void addAttr(Attributes);
72   
73   /// removeAttr - Remove a Attribute from an argument
74   void removeAttr(Attributes);
75
76   /// classof - Methods for support type inquiry through isa, cast, and
77   /// dyn_cast:
78   ///
79   static inline bool classof(const Argument *) { return true; }
80   static inline bool classof(const Value *V) {
81     return V->getValueID() == ArgumentVal;
82   }
83 };
84
85 } // End llvm namespace
86
87 #endif