aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGRecordLayout.h
blob: 7581cdbd8f17c09121bbb531bc29394ff20b97c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//===--- CGRecordLayout.h - LLVM Record Layout Information ------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef CLANG_CODEGEN_CGRECORDLAYOUT_H
#define CLANG_CODEGEN_CGRECORDLAYOUT_H

namespace llvm {
  class Type;
}

namespace clang {
namespace CodeGen {

/// CGRecordLayout - This class handles struct and union layout info while
/// lowering AST types to LLVM types.
class CGRecordLayout {
  CGRecordLayout(const CGRecordLayout&); // DO NOT IMPLEMENT
  void operator=(const CGRecordLayout&); // DO NOT IMPLEMENT

  /// The LLVMType corresponding to this record layout.
  const llvm::Type *LLVMType;

  /// Whether one of the fields in this record layout is a pointer to data
  /// member, or a struct that contains pointer to data member.
  bool ContainsPointerToDataMember;

public:
  CGRecordLayout(const llvm::Type *T, bool ContainsPointerToDataMember)
    : LLVMType(T), ContainsPointerToDataMember(ContainsPointerToDataMember) {}

  /// getLLVMType - Return llvm type associated with this record.
  const llvm::Type *getLLVMType() const {
    return LLVMType;
  }

  /// containsPointerToDataMember - Whether this struct contains pointers to
  /// data members.
  bool containsPointerToDataMember() const {
    return ContainsPointerToDataMember;
  }
};

}  // end namespace CodeGen
}  // end namespace clang

#endif