1//===- TypeIndexDiscovery.h -------------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_DEBUGINFO_CODEVIEW_TYPEINDEXDISCOVERY_H
10#define LLVM_DEBUGINFO_CODEVIEW_TYPEINDEXDISCOVERY_H
11
12#include "llvm/ADT/ArrayRef.h"
13#include "llvm/DebugInfo/CodeView/CVRecord.h"
14
15namespace llvm {
16template <typename T> class SmallVectorImpl;
17namespace codeview {
18class TypeIndex;
19enum class TiRefKind { TypeRef, IndexRef };
20struct TiReference {
21  TiRefKind Kind;
22  uint32_t Offset;
23  uint32_t Count;
24};
25
26void discoverTypeIndices(ArrayRef<uint8_t> RecordData,
27                         SmallVectorImpl<TiReference> &Refs);
28void discoverTypeIndices(const CVType &Type,
29                         SmallVectorImpl<TiReference> &Refs);
30void discoverTypeIndices(const CVType &Type,
31                         SmallVectorImpl<TypeIndex> &Indices);
32void discoverTypeIndices(ArrayRef<uint8_t> RecordData,
33                         SmallVectorImpl<TypeIndex> &Indices);
34
35/// Discover type indices in symbol records. Returns false if this is an unknown
36/// record.
37bool discoverTypeIndicesInSymbol(const CVSymbol &Symbol,
38                                 SmallVectorImpl<TiReference> &Refs);
39bool discoverTypeIndicesInSymbol(ArrayRef<uint8_t> RecordData,
40                                 SmallVectorImpl<TiReference> &Refs);
41bool discoverTypeIndicesInSymbol(ArrayRef<uint8_t> RecordData,
42                                 SmallVectorImpl<TypeIndex> &Indices);
43}
44}
45
46#endif
47