Daniel Dunbar | 2924ade | 2010-03-30 22:26:10 +0000 | [diff] [blame] | 1 | //===--- CGRecordLayout.h - LLVM Record Layout Information ------*- 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 | #ifndef CLANG_CODEGEN_CGRECORDLAYOUT_H |
| 11 | #define CLANG_CODEGEN_CGRECORDLAYOUT_H |
| 12 | |
Daniel Dunbar | 270e203 | 2010-03-31 00:11:27 +0000 | [diff] [blame^] | 13 | namespace llvm { |
| 14 | class Type; |
| 15 | } |
| 16 | |
Daniel Dunbar | 2924ade | 2010-03-30 22:26:10 +0000 | [diff] [blame] | 17 | namespace clang { |
| 18 | namespace CodeGen { |
| 19 | |
| 20 | /// CGRecordLayout - This class handles struct and union layout info while |
| 21 | /// lowering AST types to LLVM types. |
| 22 | class CGRecordLayout { |
| 23 | CGRecordLayout(const CGRecordLayout&); // DO NOT IMPLEMENT |
| 24 | void operator=(const CGRecordLayout&); // DO NOT IMPLEMENT |
| 25 | |
| 26 | /// The LLVMType corresponding to this record layout. |
| 27 | const llvm::Type *LLVMType; |
| 28 | |
| 29 | /// Whether one of the fields in this record layout is a pointer to data |
| 30 | /// member, or a struct that contains pointer to data member. |
| 31 | bool ContainsPointerToDataMember; |
| 32 | |
| 33 | public: |
| 34 | CGRecordLayout(const llvm::Type *T, bool ContainsPointerToDataMember) |
| 35 | : LLVMType(T), ContainsPointerToDataMember(ContainsPointerToDataMember) {} |
| 36 | |
| 37 | /// getLLVMType - Return llvm type associated with this record. |
| 38 | const llvm::Type *getLLVMType() const { |
| 39 | return LLVMType; |
| 40 | } |
| 41 | |
| 42 | /// containsPointerToDataMember - Whether this struct contains pointers to |
| 43 | /// data members. |
| 44 | bool containsPointerToDataMember() const { |
| 45 | return ContainsPointerToDataMember; |
| 46 | } |
| 47 | }; |
| 48 | |
| 49 | } // end namespace CodeGen |
| 50 | } // end namespace clang |
| 51 | |
| 52 | #endif |