Anders Carlsson | 461e326 | 2010-04-08 16:30:25 +0000 | [diff] [blame] | 1 | //===--- CGVTables.h - Emit LLVM Code for C++ vtables ---------------------===// |
Anders Carlsson | dbd920c | 2009-10-11 22:13:54 +0000 | [diff] [blame] | 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 contains code dealing with C++ code generation of virtual tables. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #ifndef CLANG_CODEGEN_CGVTABLE_H |
| 15 | #define CLANG_CODEGEN_CGVTABLE_H |
| 16 | |
| 17 | #include "llvm/ADT/DenseMap.h" |
Anders Carlsson | 3527225 | 2009-12-06 00:23:49 +0000 | [diff] [blame] | 18 | #include "llvm/GlobalVariable.h" |
Peter Collingbourne | 1411047 | 2011-01-13 18:57:25 +0000 | [diff] [blame] | 19 | #include "clang/Basic/ABI.h" |
Ken Dyck | 4230d52 | 2011-03-24 01:21:01 +0000 | [diff] [blame] | 20 | #include "clang/AST/CharUnits.h" |
Anders Carlsson | a0fdd91 | 2009-11-13 17:08:56 +0000 | [diff] [blame] | 21 | #include "GlobalDecl.h" |
Anders Carlsson | dbd920c | 2009-10-11 22:13:54 +0000 | [diff] [blame] | 22 | |
| 23 | namespace clang { |
Anders Carlsson | dbd920c | 2009-10-11 22:13:54 +0000 | [diff] [blame] | 24 | class CXXRecordDecl; |
Benjamin Kramer | 39411b9 | 2009-11-26 13:09:03 +0000 | [diff] [blame] | 25 | |
Anders Carlsson | dbd920c | 2009-10-11 22:13:54 +0000 | [diff] [blame] | 26 | namespace CodeGen { |
| 27 | class CodeGenModule; |
Anders Carlsson | a94822e | 2009-11-26 02:32:05 +0000 | [diff] [blame] | 28 | |
Anders Carlsson | 6b4333d | 2010-01-13 20:11:15 +0000 | [diff] [blame] | 29 | // BaseSubobject - Uniquely identifies a direct or indirect base class. |
| 30 | // Stores both the base class decl and the offset from the most derived class to |
| 31 | // the base class. |
| 32 | class BaseSubobject { |
| 33 | /// Base - The base class declaration. |
| 34 | const CXXRecordDecl *Base; |
| 35 | |
| 36 | /// BaseOffset - The offset from the most derived class to the base class. |
Ken Dyck | 4230d52 | 2011-03-24 01:21:01 +0000 | [diff] [blame] | 37 | CharUnits BaseOffset; |
Anders Carlsson | 6b4333d | 2010-01-13 20:11:15 +0000 | [diff] [blame] | 38 | |
| 39 | public: |
Ken Dyck | 4230d52 | 2011-03-24 01:21:01 +0000 | [diff] [blame] | 40 | BaseSubobject(const CXXRecordDecl *Base, CharUnits BaseOffset) |
Anders Carlsson | 6b4333d | 2010-01-13 20:11:15 +0000 | [diff] [blame] | 41 | : Base(Base), BaseOffset(BaseOffset) { } |
| 42 | |
| 43 | /// getBase - Returns the base class declaration. |
| 44 | const CXXRecordDecl *getBase() const { return Base; } |
| 45 | |
| 46 | /// getBaseOffset - Returns the base class offset. |
Ken Dyck | 4230d52 | 2011-03-24 01:21:01 +0000 | [diff] [blame] | 47 | CharUnits getBaseOffset() const { return BaseOffset; } |
Anders Carlsson | 7e37a69 | 2010-01-14 01:39:42 +0000 | [diff] [blame] | 48 | |
Anders Carlsson | 6b4333d | 2010-01-13 20:11:15 +0000 | [diff] [blame] | 49 | friend bool operator==(const BaseSubobject &LHS, const BaseSubobject &RHS) { |
| 50 | return LHS.Base == RHS.Base && LHS.BaseOffset == RHS.BaseOffset; |
| 51 | } |
| 52 | }; |
Anders Carlsson | 7e37a69 | 2010-01-14 01:39:42 +0000 | [diff] [blame] | 53 | |
| 54 | } // end namespace CodeGen |
| 55 | } // end namespace clang |
| 56 | |
| 57 | namespace llvm { |
| 58 | |
| 59 | template<> struct DenseMapInfo<clang::CodeGen::BaseSubobject> { |
| 60 | static clang::CodeGen::BaseSubobject getEmptyKey() { |
| 61 | return clang::CodeGen::BaseSubobject( |
| 62 | DenseMapInfo<const clang::CXXRecordDecl *>::getEmptyKey(), |
Ken Dyck | 4230d52 | 2011-03-24 01:21:01 +0000 | [diff] [blame] | 63 | clang::CharUnits::fromQuantity(DenseMapInfo<int64_t>::getEmptyKey())); |
Anders Carlsson | 7e37a69 | 2010-01-14 01:39:42 +0000 | [diff] [blame] | 64 | } |
| 65 | |
| 66 | static clang::CodeGen::BaseSubobject getTombstoneKey() { |
| 67 | return clang::CodeGen::BaseSubobject( |
| 68 | DenseMapInfo<const clang::CXXRecordDecl *>::getTombstoneKey(), |
Ken Dyck | 4230d52 | 2011-03-24 01:21:01 +0000 | [diff] [blame] | 69 | clang::CharUnits::fromQuantity(DenseMapInfo<int64_t>::getTombstoneKey())); |
Anders Carlsson | 7e37a69 | 2010-01-14 01:39:42 +0000 | [diff] [blame] | 70 | } |
| 71 | |
| 72 | static unsigned getHashValue(const clang::CodeGen::BaseSubobject &Base) { |
| 73 | return |
| 74 | DenseMapInfo<const clang::CXXRecordDecl *>::getHashValue(Base.getBase()) ^ |
Ken Dyck | 4230d52 | 2011-03-24 01:21:01 +0000 | [diff] [blame] | 75 | DenseMapInfo<int64_t>::getHashValue(Base.getBaseOffset().getQuantity()); |
Anders Carlsson | 7e37a69 | 2010-01-14 01:39:42 +0000 | [diff] [blame] | 76 | } |
| 77 | |
| 78 | static bool isEqual(const clang::CodeGen::BaseSubobject &LHS, |
| 79 | const clang::CodeGen::BaseSubobject &RHS) { |
| 80 | return LHS == RHS; |
| 81 | } |
| 82 | }; |
| 83 | |
Anders Carlsson | 1bb6099 | 2010-01-14 02:29:07 +0000 | [diff] [blame] | 84 | // It's OK to treat BaseSubobject as a POD type. |
| 85 | template <> struct isPodLike<clang::CodeGen::BaseSubobject> { |
| 86 | static const bool value = true; |
| 87 | }; |
| 88 | |
Anders Carlsson | 7e37a69 | 2010-01-14 01:39:42 +0000 | [diff] [blame] | 89 | } |
| 90 | |
| 91 | namespace clang { |
| 92 | namespace CodeGen { |
| 93 | |
Anders Carlsson | af44035 | 2010-03-23 04:11:45 +0000 | [diff] [blame] | 94 | class CodeGenVTables { |
Anders Carlsson | dbd920c | 2009-10-11 22:13:54 +0000 | [diff] [blame] | 95 | CodeGenModule &CGM; |
Benjamin Kramer | 39411b9 | 2009-11-26 13:09:03 +0000 | [diff] [blame] | 96 | |
Anders Carlsson | 046c294 | 2010-04-17 20:15:18 +0000 | [diff] [blame] | 97 | /// MethodVTableIndices - Contains the index (relative to the vtable address |
Anders Carlsson | dbd920c | 2009-10-11 22:13:54 +0000 | [diff] [blame] | 98 | /// point) where the function pointer for a virtual function is stored. |
Anders Carlsson | 046c294 | 2010-04-17 20:15:18 +0000 | [diff] [blame] | 99 | typedef llvm::DenseMap<GlobalDecl, int64_t> MethodVTableIndicesTy; |
| 100 | MethodVTableIndicesTy MethodVTableIndices; |
Benjamin Kramer | 39411b9 | 2009-11-26 13:09:03 +0000 | [diff] [blame] | 101 | |
Anders Carlsson | dbd920c | 2009-10-11 22:13:54 +0000 | [diff] [blame] | 102 | typedef std::pair<const CXXRecordDecl *, |
| 103 | const CXXRecordDecl *> ClassPairTy; |
Benjamin Kramer | 39411b9 | 2009-11-26 13:09:03 +0000 | [diff] [blame] | 104 | |
Anders Carlsson | bba1607 | 2010-03-11 07:15:17 +0000 | [diff] [blame] | 105 | /// VirtualBaseClassOffsetOffsets - Contains the vtable offset (relative to |
| 106 | /// the address point) in bytes where the offsets for virtual bases of a class |
| 107 | /// are stored. |
| 108 | typedef llvm::DenseMap<ClassPairTy, int64_t> |
| 109 | VirtualBaseClassOffsetOffsetsMapTy; |
| 110 | VirtualBaseClassOffsetOffsetsMapTy VirtualBaseClassOffsetOffsets; |
Mike Stump | 380dd75 | 2009-11-10 07:44:33 +0000 | [diff] [blame] | 111 | |
Anders Carlsson | 046c294 | 2010-04-17 20:15:18 +0000 | [diff] [blame] | 112 | /// VTables - All the vtables which have been defined. |
| 113 | llvm::DenseMap<const CXXRecordDecl *, llvm::GlobalVariable *> VTables; |
Anders Carlsson | d6b07fb | 2009-11-27 20:47:55 +0000 | [diff] [blame] | 114 | |
| 115 | /// NumVirtualFunctionPointers - Contains the number of virtual function |
| 116 | /// pointers in the vtable for a given record decl. |
| 117 | llvm::DenseMap<const CXXRecordDecl *, uint64_t> NumVirtualFunctionPointers; |
| 118 | |
Anders Carlsson | fbf6ed4 | 2010-03-23 16:36:50 +0000 | [diff] [blame] | 119 | typedef llvm::SmallVector<ThunkInfo, 1> ThunkInfoVectorTy; |
| 120 | typedef llvm::DenseMap<const CXXMethodDecl *, ThunkInfoVectorTy> ThunksMapTy; |
| 121 | |
| 122 | /// Thunks - Contains all thunks that a given method decl will need. |
| 123 | ThunksMapTy Thunks; |
John McCall | e213235 | 2010-06-02 21:22:02 +0000 | [diff] [blame] | 124 | |
| 125 | // The layout entry and a bool indicating whether we've actually emitted |
| 126 | // the vtable. |
| 127 | typedef llvm::PointerIntPair<uint64_t *, 1, bool> VTableLayoutData; |
| 128 | typedef llvm::DenseMap<const CXXRecordDecl *, VTableLayoutData> |
| 129 | VTableLayoutMapTy; |
Anders Carlsson | ccd83d7 | 2010-03-24 16:42:11 +0000 | [diff] [blame] | 130 | |
| 131 | /// VTableLayoutMap - Stores the vtable layout for all record decls. |
| 132 | /// The layout is stored as an array of 64-bit integers, where the first |
| 133 | /// integer is the number of vtable entries in the layout, and the subsequent |
| 134 | /// integers are the vtable components. |
| 135 | VTableLayoutMapTy VTableLayoutMap; |
| 136 | |
Anders Carlsson | 3855a07 | 2010-05-03 00:55:11 +0000 | [diff] [blame] | 137 | typedef std::pair<const CXXRecordDecl *, BaseSubobject> BaseSubobjectPairTy; |
| 138 | typedef llvm::DenseMap<BaseSubobjectPairTy, uint64_t> AddressPointsMapTy; |
Anders Carlsson | 66d567d | 2010-03-25 00:51:13 +0000 | [diff] [blame] | 139 | |
Anders Carlsson | 2c822f1 | 2010-03-26 03:56:54 +0000 | [diff] [blame] | 140 | /// Address points - Address points for all vtables. |
Anders Carlsson | 66d567d | 2010-03-25 00:51:13 +0000 | [diff] [blame] | 141 | AddressPointsMapTy AddressPoints; |
Anders Carlsson | 2c822f1 | 2010-03-26 03:56:54 +0000 | [diff] [blame] | 142 | |
| 143 | /// VTableAddressPointsMapTy - Address points for a single vtable. |
| 144 | typedef llvm::DenseMap<BaseSubobject, uint64_t> VTableAddressPointsMapTy; |
| 145 | |
Anders Carlsson | 0d1407e | 2010-03-25 15:26:28 +0000 | [diff] [blame] | 146 | typedef llvm::SmallVector<std::pair<uint64_t, ThunkInfo>, 1> |
| 147 | VTableThunksTy; |
| 148 | |
| 149 | typedef llvm::DenseMap<const CXXRecordDecl *, VTableThunksTy> |
| 150 | VTableThunksMapTy; |
| 151 | |
| 152 | /// VTableThunksMap - Contains thunks needed by vtables. |
| 153 | VTableThunksMapTy VTableThunksMap; |
| 154 | |
Anders Carlsson | ccd83d7 | 2010-03-24 16:42:11 +0000 | [diff] [blame] | 155 | uint64_t getNumVTableComponents(const CXXRecordDecl *RD) const { |
| 156 | assert(VTableLayoutMap.count(RD) && "No vtable layout for this class!"); |
| 157 | |
John McCall | e213235 | 2010-06-02 21:22:02 +0000 | [diff] [blame] | 158 | return VTableLayoutMap.lookup(RD).getPointer()[0]; |
Anders Carlsson | ccd83d7 | 2010-03-24 16:42:11 +0000 | [diff] [blame] | 159 | } |
| 160 | |
Anders Carlsson | a7cde3b | 2010-03-29 03:38:52 +0000 | [diff] [blame] | 161 | const uint64_t *getVTableComponentsData(const CXXRecordDecl *RD) const { |
| 162 | assert(VTableLayoutMap.count(RD) && "No vtable layout for this class!"); |
| 163 | |
John McCall | e213235 | 2010-06-02 21:22:02 +0000 | [diff] [blame] | 164 | uint64_t *Components = VTableLayoutMap.lookup(RD).getPointer(); |
Anders Carlsson | a7cde3b | 2010-03-29 03:38:52 +0000 | [diff] [blame] | 165 | return &Components[1]; |
| 166 | } |
| 167 | |
Anders Carlsson | 3855a07 | 2010-05-03 00:55:11 +0000 | [diff] [blame] | 168 | typedef llvm::DenseMap<BaseSubobjectPairTy, uint64_t> SubVTTIndiciesMapTy; |
Anders Carlsson | e1dcc22 | 2010-03-26 04:23:58 +0000 | [diff] [blame] | 169 | |
| 170 | /// SubVTTIndicies - Contains indices into the various sub-VTTs. |
| 171 | SubVTTIndiciesMapTy SubVTTIndicies; |
| 172 | |
Anders Carlsson | 3855a07 | 2010-05-03 00:55:11 +0000 | [diff] [blame] | 173 | typedef llvm::DenseMap<BaseSubobjectPairTy, uint64_t> |
Anders Carlsson | e1dcc22 | 2010-03-26 04:23:58 +0000 | [diff] [blame] | 174 | SecondaryVirtualPointerIndicesMapTy; |
| 175 | |
| 176 | /// SecondaryVirtualPointerIndices - Contains the secondary virtual pointer |
| 177 | /// indices. |
| 178 | SecondaryVirtualPointerIndicesMapTy SecondaryVirtualPointerIndices; |
Anders Carlsson | c997d42 | 2010-01-02 01:01:18 +0000 | [diff] [blame] | 179 | |
Anders Carlsson | d6b07fb | 2009-11-27 20:47:55 +0000 | [diff] [blame] | 180 | /// getNumVirtualFunctionPointers - Return the number of virtual function |
| 181 | /// pointers in the vtable for a given record decl. |
| 182 | uint64_t getNumVirtualFunctionPointers(const CXXRecordDecl *RD); |
| 183 | |
Anders Carlsson | 046c294 | 2010-04-17 20:15:18 +0000 | [diff] [blame] | 184 | void ComputeMethodVTableIndices(const CXXRecordDecl *RD); |
Anders Carlsson | c3a46ef | 2009-12-06 01:09:21 +0000 | [diff] [blame] | 185 | |
Anders Carlsson | fbf6ed4 | 2010-03-23 16:36:50 +0000 | [diff] [blame] | 186 | /// EmitThunk - Emit a single thunk. |
Anders Carlsson | 14e82fd | 2011-02-06 18:31:40 +0000 | [diff] [blame] | 187 | void EmitThunk(GlobalDecl GD, const ThunkInfo &Thunk, |
| 188 | bool UseAvailableExternallyLinkage); |
| 189 | |
| 190 | /// MaybeEmitThunkAvailableExternally - Try to emit the given thunk with |
| 191 | /// available_externally linkage to allow for inlining of thunks. |
| 192 | /// This will be done iff optimizations are enabled and the member function |
| 193 | /// doesn't contain any incomplete types. |
| 194 | void MaybeEmitThunkAvailableExternally(GlobalDecl GD, const ThunkInfo &Thunk); |
| 195 | |
Anders Carlsson | ccd83d7 | 2010-03-24 16:42:11 +0000 | [diff] [blame] | 196 | /// ComputeVTableRelatedInformation - Compute and store all vtable related |
| 197 | /// information (vtable layout, vbase offset offsets, thunks etc) for the |
| 198 | /// given record decl. |
John McCall | e213235 | 2010-06-02 21:22:02 +0000 | [diff] [blame] | 199 | void ComputeVTableRelatedInformation(const CXXRecordDecl *RD, |
| 200 | bool VTableRequired); |
Anders Carlsson | ccd83d7 | 2010-03-24 16:42:11 +0000 | [diff] [blame] | 201 | |
Anders Carlsson | 0d1407e | 2010-03-25 15:26:28 +0000 | [diff] [blame] | 202 | /// CreateVTableInitializer - Create a vtable initializer for the given record |
| 203 | /// decl. |
| 204 | /// \param Components - The vtable components; this is really an array of |
| 205 | /// VTableComponents. |
| 206 | llvm::Constant *CreateVTableInitializer(const CXXRecordDecl *RD, |
| 207 | const uint64_t *Components, |
| 208 | unsigned NumComponents, |
| 209 | const VTableThunksTy &VTableThunks); |
Anders Carlsson | 2c822f1 | 2010-03-26 03:56:54 +0000 | [diff] [blame] | 210 | |
Anders Carlsson | dbd920c | 2009-10-11 22:13:54 +0000 | [diff] [blame] | 211 | public: |
Anders Carlsson | af44035 | 2010-03-23 04:11:45 +0000 | [diff] [blame] | 212 | CodeGenVTables(CodeGenModule &CGM) |
Anders Carlsson | dbd920c | 2009-10-11 22:13:54 +0000 | [diff] [blame] | 213 | : CGM(CGM) { } |
| 214 | |
Argyrios Kyrtzidis | d2c47bd | 2010-10-11 03:25:57 +0000 | [diff] [blame] | 215 | /// \brief True if the VTable of this record must be emitted in the |
| 216 | /// translation unit. |
| 217 | bool ShouldEmitVTableInThisTU(const CXXRecordDecl *RD); |
Rafael Espindola | b8cab18 | 2010-04-19 00:44:22 +0000 | [diff] [blame] | 218 | |
Anders Carlsson | c997d42 | 2010-01-02 01:01:18 +0000 | [diff] [blame] | 219 | /// needsVTTParameter - Return whether the given global decl needs a VTT |
| 220 | /// parameter, which it does if it's a base constructor or destructor with |
| 221 | /// virtual bases. |
| 222 | static bool needsVTTParameter(GlobalDecl GD); |
| 223 | |
| 224 | /// getSubVTTIndex - Return the index of the sub-VTT for the base class of the |
| 225 | /// given record decl. |
Anders Carlsson | c11bb21 | 2010-05-02 23:53:25 +0000 | [diff] [blame] | 226 | uint64_t getSubVTTIndex(const CXXRecordDecl *RD, BaseSubobject Base); |
Anders Carlsson | c997d42 | 2010-01-02 01:01:18 +0000 | [diff] [blame] | 227 | |
Anders Carlsson | e1dcc22 | 2010-03-26 04:23:58 +0000 | [diff] [blame] | 228 | /// getSecondaryVirtualPointerIndex - Return the index in the VTT where the |
| 229 | /// virtual pointer for the given subobject is located. |
| 230 | uint64_t getSecondaryVirtualPointerIndex(const CXXRecordDecl *RD, |
| 231 | BaseSubobject Base); |
| 232 | |
Anders Carlsson | 046c294 | 2010-04-17 20:15:18 +0000 | [diff] [blame] | 233 | /// getMethodVTableIndex - Return the index (relative to the vtable address |
Benjamin Kramer | 39411b9 | 2009-11-26 13:09:03 +0000 | [diff] [blame] | 234 | /// point) where the function pointer for the given virtual function is |
Anders Carlsson | dbd920c | 2009-10-11 22:13:54 +0000 | [diff] [blame] | 235 | /// stored. |
Anders Carlsson | 046c294 | 2010-04-17 20:15:18 +0000 | [diff] [blame] | 236 | uint64_t getMethodVTableIndex(GlobalDecl GD); |
Benjamin Kramer | 39411b9 | 2009-11-26 13:09:03 +0000 | [diff] [blame] | 237 | |
Anders Carlsson | bba1607 | 2010-03-11 07:15:17 +0000 | [diff] [blame] | 238 | /// getVirtualBaseOffsetOffset - Return the offset in bytes (relative to the |
| 239 | /// vtable address point) where the offset of the virtual base that contains |
| 240 | /// the given base is stored, otherwise, if no virtual base contains the given |
Mike Stump | ab28c13 | 2009-10-13 22:54:56 +0000 | [diff] [blame] | 241 | /// class, return 0. Base must be a virtual base class or an unambigious |
| 242 | /// base. |
Anders Carlsson | bba1607 | 2010-03-11 07:15:17 +0000 | [diff] [blame] | 243 | int64_t getVirtualBaseOffsetOffset(const CXXRecordDecl *RD, |
| 244 | const CXXRecordDecl *VBase); |
Mike Stump | 380dd75 | 2009-11-10 07:44:33 +0000 | [diff] [blame] | 245 | |
Anders Carlsson | 64c9eca | 2010-03-29 02:08:26 +0000 | [diff] [blame] | 246 | /// getAddressPoint - Get the address point of the given subobject in the |
| 247 | /// class decl. |
| 248 | uint64_t getAddressPoint(BaseSubobject Base, const CXXRecordDecl *RD); |
| 249 | |
Anders Carlsson | 5eea876 | 2010-03-24 05:32:05 +0000 | [diff] [blame] | 250 | /// GetAddrOfVTable - Get the address of the vtable for the given record decl. |
Anders Carlsson | 9dc338a | 2010-03-30 03:35:35 +0000 | [diff] [blame] | 251 | llvm::GlobalVariable *GetAddrOfVTable(const CXXRecordDecl *RD); |
Anders Carlsson | 5c6c1d9 | 2010-03-24 03:57:14 +0000 | [diff] [blame] | 252 | |
Anders Carlsson | a7cde3b | 2010-03-29 03:38:52 +0000 | [diff] [blame] | 253 | /// EmitVTableDefinition - Emit the definition of the given vtable. |
| 254 | void EmitVTableDefinition(llvm::GlobalVariable *VTable, |
| 255 | llvm::GlobalVariable::LinkageTypes Linkage, |
| 256 | const CXXRecordDecl *RD); |
| 257 | |
Anders Carlsson | ff143f8 | 2010-03-25 00:35:49 +0000 | [diff] [blame] | 258 | /// GenerateConstructionVTable - Generate a construction vtable for the given |
| 259 | /// base subobject. |
| 260 | llvm::GlobalVariable * |
| 261 | GenerateConstructionVTable(const CXXRecordDecl *RD, const BaseSubobject &Base, |
| 262 | bool BaseIsVirtual, |
Anders Carlsson | 2c822f1 | 2010-03-26 03:56:54 +0000 | [diff] [blame] | 263 | VTableAddressPointsMapTy& AddressPoints); |
Anders Carlsson | 1cbce12 | 2011-01-29 19:16:51 +0000 | [diff] [blame] | 264 | |
| 265 | |
| 266 | /// GetAddrOfVTable - Get the address of the VTT for the given record decl. |
| 267 | llvm::GlobalVariable *GetAddrOfVTT(const CXXRecordDecl *RD); |
| 268 | |
| 269 | /// EmitVTTDefinition - Emit the definition of the given vtable. |
| 270 | void EmitVTTDefinition(llvm::GlobalVariable *VTT, |
| 271 | llvm::GlobalVariable::LinkageTypes Linkage, |
| 272 | const CXXRecordDecl *RD); |
Rafael Espindola | bbf58bb | 2010-03-10 02:19:29 +0000 | [diff] [blame] | 273 | |
Douglas Gregor | 6fb745b | 2010-05-13 16:44:06 +0000 | [diff] [blame] | 274 | /// EmitThunks - Emit the associated thunks for the given global decl. |
| 275 | void EmitThunks(GlobalDecl GD); |
| 276 | |
Anders Carlsson | 7986ad5 | 2010-03-23 18:18:41 +0000 | [diff] [blame] | 277 | /// GenerateClassData - Generate all the class data required to be generated |
Rafael Espindola | bbf58bb | 2010-03-10 02:19:29 +0000 | [diff] [blame] | 278 | /// upon definition of a KeyFunction. This includes the vtable, the |
| 279 | /// rtti data structure and the VTT. |
| 280 | /// |
| 281 | /// \param Linkage - The desired linkage of the vtable, the RTTI and the VTT. |
| 282 | void GenerateClassData(llvm::GlobalVariable::LinkageTypes Linkage, |
| 283 | const CXXRecordDecl *RD); |
Anders Carlsson | dbd920c | 2009-10-11 22:13:54 +0000 | [diff] [blame] | 284 | }; |
Benjamin Kramer | 39411b9 | 2009-11-26 13:09:03 +0000 | [diff] [blame] | 285 | |
Anders Carlsson | 1bb6099 | 2010-01-14 02:29:07 +0000 | [diff] [blame] | 286 | } // end namespace CodeGen |
| 287 | } // end namespace clang |
Anders Carlsson | dbd920c | 2009-10-11 22:13:54 +0000 | [diff] [blame] | 288 | #endif |