Line data Source code
1 : //===- NativeTypeArray.cpp - info about arrays ------------------*- 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 : #include "llvm/DebugInfo/PDB/Native/NativeTypeArray.h"
11 :
12 : #include "llvm/DebugInfo/CodeView/SymbolRecord.h"
13 : #include "llvm/DebugInfo/PDB/Native/NativeTypeBuiltin.h"
14 : #include "llvm/DebugInfo/PDB/Native/NativeTypeEnum.h"
15 :
16 : using namespace llvm;
17 : using namespace llvm::codeview;
18 : using namespace llvm::pdb;
19 :
20 2 : NativeTypeArray::NativeTypeArray(NativeSession &Session, SymIndexId Id,
21 : codeview::TypeIndex TI,
22 2 : codeview::ArrayRecord Record)
23 : : NativeRawSymbol(Session, PDB_SymType::ArrayType, Id), Record(Record),
24 2 : Index(TI) {}
25 4 : NativeTypeArray::~NativeTypeArray() {}
26 :
27 0 : void NativeTypeArray::dump(raw_ostream &OS, int Indent,
28 : PdbSymbolIdField ShowIdFields,
29 : PdbSymbolIdField RecurseIdFields) const {
30 0 : NativeRawSymbol::dump(OS, Indent, ShowIdFields, RecurseIdFields);
31 :
32 0 : dumpSymbolField(OS, "arrayIndexTypeId", getArrayIndexTypeId(), Indent);
33 0 : dumpSymbolIdField(OS, "elementTypeId", getTypeId(), Indent, Session,
34 : PdbSymbolIdField::Type, ShowIdFields, RecurseIdFields);
35 :
36 0 : dumpSymbolIdField(OS, "lexicalParentId", 0, Indent, Session,
37 : PdbSymbolIdField::LexicalParent, ShowIdFields,
38 : RecurseIdFields);
39 0 : dumpSymbolField(OS, "length", getLength(), Indent);
40 0 : dumpSymbolField(OS, "count", getCount(), Indent);
41 0 : dumpSymbolField(OS, "constType", isConstType(), Indent);
42 0 : dumpSymbolField(OS, "unalignedType", isUnalignedType(), Indent);
43 0 : dumpSymbolField(OS, "volatileType", isVolatileType(), Indent);
44 0 : }
45 :
46 0 : SymIndexId NativeTypeArray::getArrayIndexTypeId() const {
47 0 : return Session.getSymbolCache().findSymbolByTypeIndex(Record.getIndexType());
48 : }
49 :
50 0 : bool NativeTypeArray::isConstType() const { return false; }
51 :
52 0 : bool NativeTypeArray::isUnalignedType() const { return false; }
53 :
54 0 : bool NativeTypeArray::isVolatileType() const { return false; }
55 :
56 1 : uint32_t NativeTypeArray::getCount() const {
57 : NativeRawSymbol &Element =
58 2 : Session.getSymbolCache().getNativeSymbolById(getTypeId());
59 1 : return getLength() / Element.getLength();
60 : }
61 :
62 2 : SymIndexId NativeTypeArray::getTypeId() const {
63 4 : return Session.getSymbolCache().findSymbolByTypeIndex(
64 2 : Record.getElementType());
65 : }
66 :
67 1 : uint64_t NativeTypeArray::getLength() const { return Record.Size; }
|