blob: 7581cdbd8f17c09121bbb531bc29394ff20b97c9 [file] [log] [blame]
Daniel Dunbar2924ade2010-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
Daniel Dunbar270e2032010-03-31 00:11:27 +000013namespace llvm {
14 class Type;
15}
16
Daniel Dunbar2924ade2010-03-30 22:26:10 +000017namespace clang {
18namespace CodeGen {
19
20/// CGRecordLayout - This class handles struct and union layout info while
21/// lowering AST types to LLVM types.
22class 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
33public:
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