llvm.org GIT mirror llvm / 6c7fd1f
Move FunctionArgument out of iOther.h into Argument.h and rename class to be 'Argument' instead of FunctionArgument. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2210 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 18 years ago
2 changed file(s) with 40 addition(s) and 32 deletion(s). Raw diff Collapse all Expand all
0 //===-- llvm/Argument.h - Definition of the Argument class -------*- C++ -*--=//
1 //
2 // This file defines the Argument class, which represents and incoming formal
3 // argument to a function.
4 //
5 //===----------------------------------------------------------------------===//
6
7 #ifndef LLVM_ARGUMENT_H
8 #define LLVM_ARGUMENT_H
9
10 #include "llvm/Value.h"
11
12 class Argument : public Value { // Defined in the InstrType.cpp file
13 Function *Parent;
14
15 friend class ValueHolder;
16 inline void setParent(Function *parent) { Parent = parent; }
17
18 public:
19 Argument(const Type *Ty, const std::string &Name = "")
20 : Value(Ty, Value::ArgumentVal, Name) {
21 Parent = 0;
22 }
23
24 // Specialize setName to handle symbol table majik...
25 virtual void setName(const std::string &name, SymbolTable *ST = 0);
26
27 inline const Function *getParent() const { return Parent; }
28 inline Function *getParent() { return Parent; }
29
30 virtual void print(std::ostream &OS) const;
31
32 // Methods for support type inquiry through isa, cast, and dyn_cast:
33 static inline bool classof(const Argument *) { return true; }
34 static inline bool classof(const Value *V) {
35 return V->getValueType() == ArgumentVal;
36 }
37 };
38
39 #endif
3838 }
3939 static inline bool classof(const Value *V) {
4040 return isa(V) && classof(cast(V));
41 }
42 };
43
44
45 //===----------------------------------------------------------------------===//
46 // FunctionArgument Class
47 //===----------------------------------------------------------------------===//
48
49 class FunctionArgument : public Value { // Defined in the InstrType.cpp file
50 Function *Parent;
51
52 friend class ValueHolder;
53 inline void setParent(Function *parent) { Parent = parent; }
54
55 public:
56 FunctionArgument(const Type *Ty, const std::string &Name = "")
57 : Value(Ty, Value::FunctionArgumentVal, Name) {
58 Parent = 0;
59 }
60
61 // Specialize setName to handle symbol table majik...
62 virtual void setName(const std::string &name, SymbolTable *ST = 0);
63
64 inline const Function *getParent() const { return Parent; }
65 inline Function *getParent() { return Parent; }
66
67 virtual void print(std::ostream &OS) const;
68
69 // Methods for support type inquiry through isa, cast, and dyn_cast:
70 static inline bool classof(const FunctionArgument *) { return true; }
71 static inline bool classof(const Value *V) {
72 return V->getValueType() == FunctionArgumentVal;
7341 }
7442 };
7543