Welcome to mirror list, hosted at ThFree Co, Russian Federation.

codeViewTypeBuilder.h « codeView « debugInfo « ObjWriter « Native « src - github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5534cc7d37c8e553d00e3f1adeb8a5731171191d (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
//===---- codeViewTypeBuilder.h ---------------------------------*- C++ -*-===//
//
// type builder is used to convert .Net types into CodeView descriptors.
//
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
//
//===----------------------------------------------------------------------===//

#pragma once

#include "debugInfo/typeBuilder.h"
#include "llvm/DebugInfo/CodeView/TypeTableBuilder.h"

#include <vector>

using namespace llvm::codeview;

class ArrayDimensionsDescriptor {
public:
  const char *GetLengthName(unsigned index);
  const char *GetBoundsName(unsigned index);

private:
  void Resize(unsigned NewSize);

  std::vector<std::string> Lengths;
  std::vector<std::string> Bounds;
};

class UserDefinedCodeViewTypesBuilder : public UserDefinedTypesBuilder {
public:
  UserDefinedCodeViewTypesBuilder();
  void EmitTypeInformation(MCSection *TypeSection, MCSection *StrSection = nullptr) override;

  unsigned GetEnumTypeIndex(const EnumTypeDescriptor &TypeDescriptor,
                            const EnumRecordTypeDescriptor *TypeRecords) override;
  unsigned GetClassTypeIndex(const ClassTypeDescriptor &ClassDescriptor) override;
  unsigned GetCompleteClassTypeIndex(
      const ClassTypeDescriptor &ClassDescriptor,
      const ClassFieldsTypeDescriptior &ClassFieldsDescriptor,
      const DataFieldDescriptor *FieldsDescriptors,
      const StaticDataFieldDescriptor *StaticsDescriptors) override;

  unsigned GetArrayTypeIndex(const ClassTypeDescriptor &ClassDescriptor,
                             const ArrayTypeDescriptor &ArrayDescriptor) override;

  unsigned GetPointerTypeIndex(const PointerTypeDescriptor& PointerDescriptor) override;

  unsigned GetMemberFunctionTypeIndex(const MemberFunctionTypeDescriptor& MemberDescriptor,
      uint32_t const *const ArgumentTypes) override;

  unsigned GetMemberFunctionId(const MemberFunctionIdTypeDescriptor& MemberIdDescriptor) override;

  unsigned GetPrimitiveTypeIndex(PrimitiveTypeFlags Type) override;

private:
  void EmitCodeViewMagicVersion();
  ClassOptions GetCommonClassOptions();

  unsigned GetEnumFieldListType(uint64 Count,
                                const EnumRecordTypeDescriptor *TypeRecords);

  void AddBaseClass(FieldListRecordBuilder &FLBR, unsigned BaseClassId);
  void AddClassVTShape(FieldListRecordBuilder &FLBR);

  BumpPtrAllocator Allocator;
  TypeTableBuilder TypeTable;

  ArrayDimensionsDescriptor ArrayDimentions;
  TypeIndex ClassVTableTypeIndex;
};