10b57cec5SDimitry Andric //===- RecordLayout.h - Layout information for a struct/union ---*- C++ -*-===// 20b57cec5SDimitry Andric // 30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 60b57cec5SDimitry Andric // 70b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 80b57cec5SDimitry Andric // 90b57cec5SDimitry Andric // This file defines the RecordLayout interface. 100b57cec5SDimitry Andric // 110b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 120b57cec5SDimitry Andric 130b57cec5SDimitry Andric #ifndef LLVM_CLANG_AST_RECORDLAYOUT_H 140b57cec5SDimitry Andric #define LLVM_CLANG_AST_RECORDLAYOUT_H 150b57cec5SDimitry Andric 160b57cec5SDimitry Andric #include "clang/AST/ASTVector.h" 170b57cec5SDimitry Andric #include "clang/AST/CharUnits.h" 180b57cec5SDimitry Andric #include "clang/AST/DeclCXX.h" 190b57cec5SDimitry Andric #include "clang/Basic/LLVM.h" 200b57cec5SDimitry Andric #include "llvm/ADT/ArrayRef.h" 210b57cec5SDimitry Andric #include "llvm/ADT/DenseMap.h" 220b57cec5SDimitry Andric #include "llvm/ADT/PointerIntPair.h" 230b57cec5SDimitry Andric #include <cassert> 240b57cec5SDimitry Andric #include <cstdint> 250b57cec5SDimitry Andric 260b57cec5SDimitry Andric namespace clang { 270b57cec5SDimitry Andric 280b57cec5SDimitry Andric class ASTContext; 290b57cec5SDimitry Andric class CXXRecordDecl; 300b57cec5SDimitry Andric 310b57cec5SDimitry Andric /// ASTRecordLayout - 320b57cec5SDimitry Andric /// This class contains layout information for one RecordDecl, 330b57cec5SDimitry Andric /// which is a struct/union/class. The decl represented must be a definition, 340b57cec5SDimitry Andric /// not a forward declaration. 350b57cec5SDimitry Andric /// This class is also used to contain layout information for one 360b57cec5SDimitry Andric /// ObjCInterfaceDecl. FIXME - Find appropriate name. 370b57cec5SDimitry Andric /// These objects are managed by ASTContext. 380b57cec5SDimitry Andric class ASTRecordLayout { 390b57cec5SDimitry Andric public: 400b57cec5SDimitry Andric struct VBaseInfo { 410b57cec5SDimitry Andric /// The offset to this virtual base in the complete-object layout 420b57cec5SDimitry Andric /// of this class. 430b57cec5SDimitry Andric CharUnits VBaseOffset; 440b57cec5SDimitry Andric 450b57cec5SDimitry Andric private: 460b57cec5SDimitry Andric /// Whether this virtual base requires a vtordisp field in the 470b57cec5SDimitry Andric /// Microsoft ABI. These fields are required for certain operations 480b57cec5SDimitry Andric /// in constructors and destructors. 490b57cec5SDimitry Andric bool HasVtorDisp = false; 500b57cec5SDimitry Andric 510b57cec5SDimitry Andric public: 520b57cec5SDimitry Andric VBaseInfo() = default; VBaseInfoVBaseInfo530b57cec5SDimitry Andric VBaseInfo(CharUnits VBaseOffset, bool hasVtorDisp) 540b57cec5SDimitry Andric : VBaseOffset(VBaseOffset), HasVtorDisp(hasVtorDisp) {} 550b57cec5SDimitry Andric hasVtorDispVBaseInfo560b57cec5SDimitry Andric bool hasVtorDisp() const { return HasVtorDisp; } 570b57cec5SDimitry Andric }; 580b57cec5SDimitry Andric 590b57cec5SDimitry Andric using VBaseOffsetsMapTy = llvm::DenseMap<const CXXRecordDecl *, VBaseInfo>; 600b57cec5SDimitry Andric 610b57cec5SDimitry Andric private: 620b57cec5SDimitry Andric friend class ASTContext; 630b57cec5SDimitry Andric 640b57cec5SDimitry Andric /// Size - Size of record in characters. 650b57cec5SDimitry Andric CharUnits Size; 660b57cec5SDimitry Andric 670b57cec5SDimitry Andric /// DataSize - Size of record in characters without tail padding. 680b57cec5SDimitry Andric CharUnits DataSize; 690b57cec5SDimitry Andric 700b57cec5SDimitry Andric // Alignment - Alignment of record in characters. 710b57cec5SDimitry Andric CharUnits Alignment; 720b57cec5SDimitry Andric 730b57cec5SDimitry Andric // PreferredAlignment - Preferred alignment of record in characters. This 740b57cec5SDimitry Andric // can be different than Alignment in cases where it is beneficial for 750b57cec5SDimitry Andric // performance or backwards compatibility preserving (e.g. AIX-ABI). 760b57cec5SDimitry Andric CharUnits PreferredAlignment; 770b57cec5SDimitry Andric 780b57cec5SDimitry Andric // UnadjustedAlignment - Maximum of the alignments of the record members in 790b57cec5SDimitry Andric // characters. 800b57cec5SDimitry Andric CharUnits UnadjustedAlignment; 810b57cec5SDimitry Andric 820b57cec5SDimitry Andric /// RequiredAlignment - The required alignment of the object. In the MS-ABI 830b57cec5SDimitry Andric /// the __declspec(align()) trumps #pramga pack and must always be obeyed. 840b57cec5SDimitry Andric CharUnits RequiredAlignment; 850b57cec5SDimitry Andric 860b57cec5SDimitry Andric /// FieldOffsets - Array of field offsets in bits. 870b57cec5SDimitry Andric ASTVector<uint64_t> FieldOffsets; 880b57cec5SDimitry Andric 890b57cec5SDimitry Andric /// CXXRecordLayoutInfo - Contains C++ specific layout information. 900b57cec5SDimitry Andric struct CXXRecordLayoutInfo { 910b57cec5SDimitry Andric /// NonVirtualSize - The non-virtual size (in chars) of an object, which is 920b57cec5SDimitry Andric /// the size of the object without virtual bases. 930b57cec5SDimitry Andric CharUnits NonVirtualSize; 940b57cec5SDimitry Andric 950b57cec5SDimitry Andric /// NonVirtualAlignment - The non-virtual alignment (in chars) of an object, 960b57cec5SDimitry Andric /// which is the alignment of the object without virtual bases. 970b57cec5SDimitry Andric CharUnits NonVirtualAlignment; 980b57cec5SDimitry Andric 990b57cec5SDimitry Andric /// PreferredNVAlignment - The preferred non-virtual alignment (in chars) of 1000b57cec5SDimitry Andric /// an object, which is the preferred alignment of the object without 1010b57cec5SDimitry Andric /// virtual bases. 1020b57cec5SDimitry Andric CharUnits PreferredNVAlignment; 1030b57cec5SDimitry Andric 1040b57cec5SDimitry Andric /// SizeOfLargestEmptySubobject - The size of the largest empty subobject 1050b57cec5SDimitry Andric /// (either a base or a member). Will be zero if the class doesn't contain 1060b57cec5SDimitry Andric /// any empty subobjects. 1070b57cec5SDimitry Andric CharUnits SizeOfLargestEmptySubobject; 1080b57cec5SDimitry Andric 1090b57cec5SDimitry Andric /// VBPtrOffset - Virtual base table offset (Microsoft-only). 1100b57cec5SDimitry Andric CharUnits VBPtrOffset; 1110b57cec5SDimitry Andric 1120b57cec5SDimitry Andric /// HasOwnVFPtr - Does this class provide a virtual function table 1130b57cec5SDimitry Andric /// (vtable in Itanium, vftbl in Microsoft) that is independent from 1140b57cec5SDimitry Andric /// its base classes? 1150b57cec5SDimitry Andric bool HasOwnVFPtr : 1; 1160b57cec5SDimitry Andric 1170b57cec5SDimitry Andric /// HasVFPtr - Does this class have a vftable that could be extended by 1180b57cec5SDimitry Andric /// a derived class. The class may have inherited this pointer from 1190b57cec5SDimitry Andric /// a primary base class. 1200b57cec5SDimitry Andric bool HasExtendableVFPtr : 1; 1210b57cec5SDimitry Andric 1220b57cec5SDimitry Andric /// EndsWithZeroSizedObject - True if this class contains a zero sized 1230b57cec5SDimitry Andric /// member or base or a base with a zero sized member or base. 1240b57cec5SDimitry Andric /// Only used for MS-ABI. 1250b57cec5SDimitry Andric bool EndsWithZeroSizedObject : 1; 1260b57cec5SDimitry Andric 1270b57cec5SDimitry Andric /// True if this class is zero sized or first base is zero sized or 1280b57cec5SDimitry Andric /// has this property. Only used for MS-ABI. 1290b57cec5SDimitry Andric bool LeadsWithZeroSizedBase : 1; 1300b57cec5SDimitry Andric 1310b57cec5SDimitry Andric /// PrimaryBase - The primary base info for this record. 1320b57cec5SDimitry Andric llvm::PointerIntPair<const CXXRecordDecl *, 1, bool> PrimaryBase; 1330b57cec5SDimitry Andric 1340b57cec5SDimitry Andric /// BaseSharingVBPtr - The base we share vbptr with. 1350b57cec5SDimitry Andric const CXXRecordDecl *BaseSharingVBPtr; 1360b57cec5SDimitry Andric 1370b57cec5SDimitry Andric /// FIXME: This should really use a SmallPtrMap, once we have one in LLVM :) 1380b57cec5SDimitry Andric using BaseOffsetsMapTy = llvm::DenseMap<const CXXRecordDecl *, CharUnits>; 1390b57cec5SDimitry Andric 1400b57cec5SDimitry Andric /// BaseOffsets - Contains a map from base classes to their offset. 1410b57cec5SDimitry Andric BaseOffsetsMapTy BaseOffsets; 1420b57cec5SDimitry Andric 1430b57cec5SDimitry Andric /// VBaseOffsets - Contains a map from vbase classes to their offset. 1440b57cec5SDimitry Andric VBaseOffsetsMapTy VBaseOffsets; 1450b57cec5SDimitry Andric }; 1460b57cec5SDimitry Andric 1470b57cec5SDimitry Andric /// CXXInfo - If the record layout is for a C++ record, this will have 1480b57cec5SDimitry Andric /// C++ specific information about the record. 1490b57cec5SDimitry Andric CXXRecordLayoutInfo *CXXInfo = nullptr; 1500b57cec5SDimitry Andric 1510b57cec5SDimitry Andric ASTRecordLayout(const ASTContext &Ctx, CharUnits size, CharUnits alignment, 1520b57cec5SDimitry Andric CharUnits preferredAlignment, CharUnits unadjustedAlignment, 1530b57cec5SDimitry Andric CharUnits requiredAlignment, CharUnits datasize, 1540b57cec5SDimitry Andric ArrayRef<uint64_t> fieldoffsets); 1550b57cec5SDimitry Andric 1560b57cec5SDimitry Andric using BaseOffsetsMapTy = CXXRecordLayoutInfo::BaseOffsetsMapTy; 1570b57cec5SDimitry Andric 1580b57cec5SDimitry Andric // Constructor for C++ records. 1590b57cec5SDimitry Andric ASTRecordLayout(const ASTContext &Ctx, CharUnits size, CharUnits alignment, 1600b57cec5SDimitry Andric CharUnits preferredAlignment, CharUnits unadjustedAlignment, 1610b57cec5SDimitry Andric CharUnits requiredAlignment, bool hasOwnVFPtr, 1620b57cec5SDimitry Andric bool hasExtendableVFPtr, CharUnits vbptroffset, 1630b57cec5SDimitry Andric CharUnits datasize, ArrayRef<uint64_t> fieldoffsets, 1640b57cec5SDimitry Andric CharUnits nonvirtualsize, CharUnits nonvirtualalignment, 1650b57cec5SDimitry Andric CharUnits preferrednvalignment, 1660b57cec5SDimitry Andric CharUnits SizeOfLargestEmptySubobject, 1670b57cec5SDimitry Andric const CXXRecordDecl *PrimaryBase, bool IsPrimaryBaseVirtual, 1680b57cec5SDimitry Andric const CXXRecordDecl *BaseSharingVBPtr, 1690b57cec5SDimitry Andric bool EndsWithZeroSizedObject, bool LeadsWithZeroSizedBase, 1700b57cec5SDimitry Andric const BaseOffsetsMapTy &BaseOffsets, 1710b57cec5SDimitry Andric const VBaseOffsetsMapTy &VBaseOffsets); 1720b57cec5SDimitry Andric 1730b57cec5SDimitry Andric ~ASTRecordLayout() = default; 1740b57cec5SDimitry Andric 1750b57cec5SDimitry Andric void Destroy(ASTContext &Ctx); 1760b57cec5SDimitry Andric 1770b57cec5SDimitry Andric public: 1780b57cec5SDimitry Andric ASTRecordLayout(const ASTRecordLayout &) = delete; 1790b57cec5SDimitry Andric ASTRecordLayout &operator=(const ASTRecordLayout &) = delete; 1800b57cec5SDimitry Andric 1810b57cec5SDimitry Andric /// getAlignment - Get the record alignment in characters. getAlignment()1820b57cec5SDimitry Andric CharUnits getAlignment() const { return Alignment; } 1830b57cec5SDimitry Andric 1840b57cec5SDimitry Andric /// getPreferredFieldAlignment - Get the record preferred alignment in 1850b57cec5SDimitry Andric /// characters. getPreferredAlignment()1860b57cec5SDimitry Andric CharUnits getPreferredAlignment() const { return PreferredAlignment; } 1870b57cec5SDimitry Andric 1880b57cec5SDimitry Andric /// getUnadjustedAlignment - Get the record alignment in characters, before 1890b57cec5SDimitry Andric /// alignment adjustement. getUnadjustedAlignment()1900b57cec5SDimitry Andric CharUnits getUnadjustedAlignment() const { return UnadjustedAlignment; } 1910b57cec5SDimitry Andric 1920b57cec5SDimitry Andric /// getSize - Get the record size in characters. getSize()1930b57cec5SDimitry Andric CharUnits getSize() const { return Size; } 1940b57cec5SDimitry Andric 1950b57cec5SDimitry Andric /// getFieldCount - Get the number of fields in the layout. getFieldCount()1960b57cec5SDimitry Andric unsigned getFieldCount() const { return FieldOffsets.size(); } 1970b57cec5SDimitry Andric 1980b57cec5SDimitry Andric /// getFieldOffset - Get the offset of the given field index, in 1990b57cec5SDimitry Andric /// bits. getFieldOffset(unsigned FieldNo)2000b57cec5SDimitry Andric uint64_t getFieldOffset(unsigned FieldNo) const { 2010b57cec5SDimitry Andric return FieldOffsets[FieldNo]; 2020b57cec5SDimitry Andric } 2030b57cec5SDimitry Andric 2040b57cec5SDimitry Andric /// getDataSize() - Get the record data size, which is the record size 2050b57cec5SDimitry Andric /// without tail padding, in characters. getDataSize()2060b57cec5SDimitry Andric CharUnits getDataSize() const { return DataSize; } 2070b57cec5SDimitry Andric 2080b57cec5SDimitry Andric /// getNonVirtualSize - Get the non-virtual size (in chars) of an object, 2090b57cec5SDimitry Andric /// which is the size of the object without virtual bases. getNonVirtualSize()2100b57cec5SDimitry Andric CharUnits getNonVirtualSize() const { 2110b57cec5SDimitry Andric assert(CXXInfo && "Record layout does not have C++ specific info!"); 2120b57cec5SDimitry Andric 2130b57cec5SDimitry Andric return CXXInfo->NonVirtualSize; 2140b57cec5SDimitry Andric } 2150b57cec5SDimitry Andric 2160b57cec5SDimitry Andric /// getNonVirtualAlignment - Get the non-virtual alignment (in chars) of an 2170b57cec5SDimitry Andric /// object, which is the alignment of the object without virtual bases. getNonVirtualAlignment()2180b57cec5SDimitry Andric CharUnits getNonVirtualAlignment() const { 2190b57cec5SDimitry Andric assert(CXXInfo && "Record layout does not have C++ specific info!"); 2200b57cec5SDimitry Andric 2210b57cec5SDimitry Andric return CXXInfo->NonVirtualAlignment; 2220b57cec5SDimitry Andric } 2230b57cec5SDimitry Andric 2240b57cec5SDimitry Andric /// getPreferredNVAlignment - Get the preferred non-virtual alignment (in 2250b57cec5SDimitry Andric /// chars) of an object, which is the preferred alignment of the object 2260b57cec5SDimitry Andric /// without virtual bases. getPreferredNVAlignment()2270b57cec5SDimitry Andric CharUnits getPreferredNVAlignment() const { 2280b57cec5SDimitry Andric assert(CXXInfo && "Record layout does not have C++ specific info!"); 2290b57cec5SDimitry Andric 2300b57cec5SDimitry Andric return CXXInfo->PreferredNVAlignment; 2310b57cec5SDimitry Andric } 2320b57cec5SDimitry Andric 2330b57cec5SDimitry Andric /// getPrimaryBase - Get the primary base for this record. getPrimaryBase()2340b57cec5SDimitry Andric const CXXRecordDecl *getPrimaryBase() const { 2350b57cec5SDimitry Andric assert(CXXInfo && "Record layout does not have C++ specific info!"); 2360b57cec5SDimitry Andric 2370b57cec5SDimitry Andric return CXXInfo->PrimaryBase.getPointer(); 2380b57cec5SDimitry Andric } 2390b57cec5SDimitry Andric 2400b57cec5SDimitry Andric /// isPrimaryBaseVirtual - Get whether the primary base for this record 2410b57cec5SDimitry Andric /// is virtual or not. isPrimaryBaseVirtual()2420b57cec5SDimitry Andric bool isPrimaryBaseVirtual() const { 2430b57cec5SDimitry Andric assert(CXXInfo && "Record layout does not have C++ specific info!"); 2440b57cec5SDimitry Andric 2450b57cec5SDimitry Andric return CXXInfo->PrimaryBase.getInt(); 2460b57cec5SDimitry Andric } 2470b57cec5SDimitry Andric 2480b57cec5SDimitry Andric /// getBaseClassOffset - Get the offset, in chars, for the given base class. getBaseClassOffset(const CXXRecordDecl * Base)2490b57cec5SDimitry Andric CharUnits getBaseClassOffset(const CXXRecordDecl *Base) const { 2500b57cec5SDimitry Andric assert(CXXInfo && "Record layout does not have C++ specific info!"); 2510b57cec5SDimitry Andric 2520b57cec5SDimitry Andric Base = Base->getDefinition(); 2530b57cec5SDimitry Andric assert(CXXInfo->BaseOffsets.count(Base) && "Did not find base!"); 2540b57cec5SDimitry Andric 2550b57cec5SDimitry Andric return CXXInfo->BaseOffsets[Base]; 2560b57cec5SDimitry Andric } 2570b57cec5SDimitry Andric 2580b57cec5SDimitry Andric /// getVBaseClassOffset - Get the offset, in chars, for the given base class. getVBaseClassOffset(const CXXRecordDecl * VBase)2590b57cec5SDimitry Andric CharUnits getVBaseClassOffset(const CXXRecordDecl *VBase) const { 2600b57cec5SDimitry Andric assert(CXXInfo && "Record layout does not have C++ specific info!"); 2610b57cec5SDimitry Andric 2620b57cec5SDimitry Andric VBase = VBase->getDefinition(); 2630b57cec5SDimitry Andric assert(CXXInfo->VBaseOffsets.count(VBase) && "Did not find base!"); 2640b57cec5SDimitry Andric 2650b57cec5SDimitry Andric return CXXInfo->VBaseOffsets[VBase].VBaseOffset; 2660b57cec5SDimitry Andric } 2670b57cec5SDimitry Andric getSizeOfLargestEmptySubobject()2680b57cec5SDimitry Andric CharUnits getSizeOfLargestEmptySubobject() const { 2690b57cec5SDimitry Andric assert(CXXInfo && "Record layout does not have C++ specific info!"); 2700b57cec5SDimitry Andric return CXXInfo->SizeOfLargestEmptySubobject; 2710b57cec5SDimitry Andric } 2720b57cec5SDimitry Andric 2730b57cec5SDimitry Andric /// hasOwnVFPtr - Does this class provide its own virtual-function 2740b57cec5SDimitry Andric /// table pointer, rather than inheriting one from a primary base 2750b57cec5SDimitry Andric /// class? If so, it is at offset zero. 2760b57cec5SDimitry Andric /// 2770b57cec5SDimitry Andric /// This implies that the ABI has no primary base class, meaning 2780b57cec5SDimitry Andric /// that it has no base classes that are suitable under the conditions 2790b57cec5SDimitry Andric /// of the ABI. hasOwnVFPtr()2800b57cec5SDimitry Andric bool hasOwnVFPtr() const { 2810b57cec5SDimitry Andric assert(CXXInfo && "Record layout does not have C++ specific info!"); 2820b57cec5SDimitry Andric return CXXInfo->HasOwnVFPtr; 2830b57cec5SDimitry Andric } 2840b57cec5SDimitry Andric 2850b57cec5SDimitry Andric /// hasVFPtr - Does this class have a virtual function table pointer 2860b57cec5SDimitry Andric /// that can be extended by a derived class? This is synonymous with 2870b57cec5SDimitry Andric /// this class having a VFPtr at offset zero. hasExtendableVFPtr()2880b57cec5SDimitry Andric bool hasExtendableVFPtr() const { 2890b57cec5SDimitry Andric assert(CXXInfo && "Record layout does not have C++ specific info!"); 2900b57cec5SDimitry Andric return CXXInfo->HasExtendableVFPtr; 2910b57cec5SDimitry Andric } 2920b57cec5SDimitry Andric 2930b57cec5SDimitry Andric /// hasOwnVBPtr - Does this class provide its own virtual-base 2940b57cec5SDimitry Andric /// table pointer, rather than inheriting one from a primary base 2950b57cec5SDimitry Andric /// class? 2960b57cec5SDimitry Andric /// 2970b57cec5SDimitry Andric /// This implies that the ABI has no primary base class, meaning 2980b57cec5SDimitry Andric /// that it has no base classes that are suitable under the conditions 2990b57cec5SDimitry Andric /// of the ABI. hasOwnVBPtr()3000b57cec5SDimitry Andric bool hasOwnVBPtr() const { 3010b57cec5SDimitry Andric assert(CXXInfo && "Record layout does not have C++ specific info!"); 3020b57cec5SDimitry Andric return hasVBPtr() && !CXXInfo->BaseSharingVBPtr; 3030b57cec5SDimitry Andric } 3040b57cec5SDimitry Andric 3050b57cec5SDimitry Andric /// hasVBPtr - Does this class have a virtual function table pointer. hasVBPtr()3060b57cec5SDimitry Andric bool hasVBPtr() const { 3070b57cec5SDimitry Andric assert(CXXInfo && "Record layout does not have C++ specific info!"); 3080b57cec5SDimitry Andric return !CXXInfo->VBPtrOffset.isNegative(); 3090b57cec5SDimitry Andric } 3100b57cec5SDimitry Andric getRequiredAlignment()3110b57cec5SDimitry Andric CharUnits getRequiredAlignment() const { return RequiredAlignment; } 3120b57cec5SDimitry Andric endsWithZeroSizedObject()3130b57cec5SDimitry Andric bool endsWithZeroSizedObject() const { 3140b57cec5SDimitry Andric return CXXInfo && CXXInfo->EndsWithZeroSizedObject; 3150b57cec5SDimitry Andric } 3160b57cec5SDimitry Andric leadsWithZeroSizedBase()3170b57cec5SDimitry Andric bool leadsWithZeroSizedBase() const { 3180b57cec5SDimitry Andric assert(CXXInfo && "Record layout does not have C++ specific info!"); 3190b57cec5SDimitry Andric return CXXInfo->LeadsWithZeroSizedBase; 3200b57cec5SDimitry Andric } 3210b57cec5SDimitry Andric 3220b57cec5SDimitry Andric /// getVBPtrOffset - Get the offset for virtual base table pointer. 3230b57cec5SDimitry Andric /// This is only meaningful with the Microsoft ABI. getVBPtrOffset()324 CharUnits getVBPtrOffset() const { 325 assert(CXXInfo && "Record layout does not have C++ specific info!"); 326 return CXXInfo->VBPtrOffset; 327 } 328 getBaseSharingVBPtr()329 const CXXRecordDecl *getBaseSharingVBPtr() const { 330 assert(CXXInfo && "Record layout does not have C++ specific info!"); 331 return CXXInfo->BaseSharingVBPtr; 332 } 333 getVBaseOffsetsMap()334 const VBaseOffsetsMapTy &getVBaseOffsetsMap() const { 335 assert(CXXInfo && "Record layout does not have C++ specific info!"); 336 return CXXInfo->VBaseOffsets; 337 } 338 }; 339 340 } // namespace clang 341 342 #endif // LLVM_CLANG_AST_RECORDLAYOUT_H 343