llvm.org GIT mirror llvm / 7bc428f
Add missed file git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36439 91177308-0d34-0410-b5e6-96231b3b80d8 Anton Korobeynikov 12 years ago
1 changed file(s) with 83 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 //===______-- llvm/GlobalAlias.h - GlobalAlias class ------------*- C++ -*-===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file was developed by Anton Korobeynikov and is distributed under
5 // the University of Illinois Open Source License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file contains the declaration of the GlobalAlias class, which
10 // represents a single function or variable alias in the VM.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef LLVM_GLOBAL_ALIAS_H
15 #define LLVM_GLOBAL_ALIAS_H
16
17 #include "llvm/GlobalValue.h"
18
19 namespace llvm {
20
21 class Module;
22 class Constant;
23 class PointerType;
24 template
25 class SymbolTableListTraits;
26
27 class GlobalAlias : public GlobalValue {
28 friend class SymbolTableListTraits;
29 void operator=(const GlobalAlias &); // Do not implement
30 GlobalAlias(const GlobalAlias &); // Do not implement
31
32 void setParent(Module *parent);
33
34 GlobalAlias *Prev, *Next;
35 void setNext(GlobalAlias *N) { Next = N; }
36 void setPrev(GlobalAlias *N) { Prev = N; }
37
38 const GlobalValue* Aliasee;
39 std::string Target;
40 public:
41 /// GlobalAlias ctor - If a parent module is specified, the alias is
42 /// automatically inserted into the end of the specified modules alias list.
43 GlobalAlias(const Type *Ty, LinkageTypes Linkage, const std::string &Name = "",
44 const GlobalValue* Aliasee = 0, Module *Parent = 0);
45
46 /// isDeclaration - Is this global variable lacking an initializer? If so,
47 /// the global variable is defined in some other translation unit, and is thus
48 /// only a declaration here.
49 virtual bool isDeclaration() const;
50
51 /// removeFromParent - This method unlinks 'this' from the containing module,
52 /// but does not delete it.
53 ///
54 virtual void removeFromParent();
55
56 /// eraseFromParent - This method unlinks 'this' from the containing module
57 /// and deletes it.
58 ///
59 virtual void eraseFromParent();
60
61 virtual void print(std::ostream &OS) const;
62 void print(std::ostream *OS) const { if (OS) print(*OS); }
63
64 void setAliasee(const GlobalValue* GV);
65 const GlobalValue* getAliasee() const { return Aliasee; }
66
67 // Methods for support type inquiry through isa, cast, and dyn_cast:
68 static inline bool classof(const GlobalAlias *) { return true; }
69 static inline bool classof(const Value *V) {
70 return V->getValueID() == Value::GlobalAliasVal;
71 }
72 private:
73 // getNext/Prev - Return the next or previous alias in the list.
74 GlobalAlias *getNext() { return Next; }
75 const GlobalAlias *getNext() const { return Next; }
76 GlobalAlias *getPrev() { return Prev; }
77 const GlobalAlias *getPrev() const { return Prev; }
78 };
79
80 } // End llvm namespace
81
82 #endif