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