xref: /freebsd/contrib/llvm-project/llvm/include/llvm/DebugInfo/CodeView/TypeIndexDiscovery.h (revision 700637cbb5e582861067a11aaca4d053546871d2)
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 #include "llvm/Support/Compiler.h"
15 
16 namespace llvm {
17 template <typename T> class SmallVectorImpl;
18 namespace codeview {
19 class TypeIndex;
20 enum class TiRefKind { TypeRef, IndexRef };
21 struct TiReference {
22   TiRefKind Kind;
23   uint32_t Offset;
24   uint32_t Count;
25 };
26 
27 LLVM_ABI void discoverTypeIndices(ArrayRef<uint8_t> RecordData,
28                                   SmallVectorImpl<TiReference> &Refs);
29 LLVM_ABI void discoverTypeIndices(const CVType &Type,
30                                   SmallVectorImpl<TiReference> &Refs);
31 LLVM_ABI void discoverTypeIndices(const CVType &Type,
32                                   SmallVectorImpl<TypeIndex> &Indices);
33 LLVM_ABI void discoverTypeIndices(ArrayRef<uint8_t> RecordData,
34                                   SmallVectorImpl<TypeIndex> &Indices);
35 
36 /// Discover type indices in symbol records. Returns false if this is an unknown
37 /// record.
38 LLVM_ABI bool discoverTypeIndicesInSymbol(const CVSymbol &Symbol,
39                                           SmallVectorImpl<TiReference> &Refs);
40 LLVM_ABI bool discoverTypeIndicesInSymbol(ArrayRef<uint8_t> RecordData,
41                                           SmallVectorImpl<TiReference> &Refs);
42 LLVM_ABI bool discoverTypeIndicesInSymbol(ArrayRef<uint8_t> RecordData,
43                                           SmallVectorImpl<TypeIndex> &Indices);
44 }
45 }
46 
47 #endif
48