1 //===- CVTypeVisitor.h ------------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLVM_DEBUGINFO_CODEVIEW_CVTYPEVISITOR_H
11 #define LLVM_DEBUGINFO_CODEVIEW_CVTYPEVISITOR_H
13 #include "llvm/ADT/TinyPtrVector.h"
14 #include "llvm/DebugInfo/CodeView/CVRecord.h"
15 #include "llvm/DebugInfo/CodeView/TypeRecord.h"
16 #include "llvm/DebugInfo/CodeView/TypeServerHandler.h"
17 #include "llvm/DebugInfo/CodeView/TypeVisitorCallbacks.h"
18 #include "llvm/Support/Error.h"
25 explicit CVTypeVisitor(TypeVisitorCallbacks &Callbacks);
27 void addTypeServerHandler(TypeServerHandler &Handler);
29 Error visitTypeRecord(CVType &Record, TypeIndex Index);
30 Error visitTypeRecord(CVType &Record);
31 Error visitMemberRecord(CVMemberRecord Record);
33 /// Visits the type records in Data. Sets the error flag on parse failures.
34 Error visitTypeStream(const CVTypeArray &Types);
35 Error visitTypeStream(CVTypeRange Types);
37 Error visitFieldListMemberStream(ArrayRef<uint8_t> FieldList);
38 Error visitFieldListMemberStream(BinaryStreamReader Reader);
41 Expected<bool> handleTypeServer(CVType &Record);
42 Error finishVisitation(CVType &Record);
44 /// The interface to the class that gets notified of each visitation.
45 TypeVisitorCallbacks &Callbacks;
47 TinyPtrVector<TypeServerHandler *> Handlers;
50 enum VisitorDataSource {
51 VDS_BytesPresent, // The record bytes are passed into the the visitation
52 // function. The algorithm should first deserialize them
53 // before passing them on through the pipeline.
54 VDS_BytesExternal // The record bytes are not present, and it is the
55 // responsibility of the visitor callback interface to
59 Error visitTypeRecord(CVType &Record, TypeIndex Index,
60 TypeVisitorCallbacks &Callbacks,
61 VisitorDataSource Source = VDS_BytesPresent,
62 TypeServerHandler *TS = nullptr);
63 Error visitTypeRecord(CVType &Record, TypeVisitorCallbacks &Callbacks,
64 VisitorDataSource Source = VDS_BytesPresent,
65 TypeServerHandler *TS = nullptr);
67 Error visitMemberRecord(CVMemberRecord Record, TypeVisitorCallbacks &Callbacks,
68 VisitorDataSource Source = VDS_BytesPresent);
69 Error visitMemberRecord(TypeLeafKind Kind, ArrayRef<uint8_t> Record,
70 TypeVisitorCallbacks &Callbacks);
72 Error visitMemberRecordStream(ArrayRef<uint8_t> FieldList,
73 TypeVisitorCallbacks &Callbacks);
75 Error visitTypeStream(const CVTypeArray &Types, TypeVisitorCallbacks &Callbacks,
76 TypeServerHandler *TS = nullptr);
77 Error visitTypeStream(CVTypeRange Types, TypeVisitorCallbacks &Callbacks,
78 TypeServerHandler *TS = nullptr);
80 } // end namespace codeview
81 } // end namespace llvm
83 #endif // LLVM_DEBUGINFO_CODEVIEW_CVTYPEVISITOR_H