LLDB  mainline
UdtRecordCompleter.h
Go to the documentation of this file.
1 //===-- UdtRecordCompleter.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 LLDB_SOURCE_PLUGINS_SYMBOLFILE_NATIVEPDB_UDTRECORDCOMPLETER_H
10 #define LLDB_SOURCE_PLUGINS_SYMBOLFILE_NATIVEPDB_UDTRECORDCOMPLETER_H
11 
13 #include "llvm/DebugInfo/CodeView/CVRecord.h"
14 #include "llvm/DebugInfo/CodeView/TypeRecord.h"
15 #include "llvm/DebugInfo/CodeView/TypeVisitorCallbacks.h"
16 
17 #include "PdbSymUid.h"
18 
19 namespace clang {
20 class CXXBaseSpecifier;
21 class QualType;
22 class TagDecl;
23 } // namespace clang
24 
25 namespace llvm {
26 namespace pdb {
27 class TpiStream;
28 class GlobalsStream;
29 }
30 } // namespace llvm
31 
32 namespace lldb_private {
33 class Type;
34 class CompilerType;
35 namespace npdb {
36 class PdbAstBuilder;
37 class PdbIndex;
38 
40  using IndexedBase =
41  std::pair<uint64_t, std::unique_ptr<clang::CXXBaseSpecifier>>;
42 
43  union UdtTagRecord {
45  llvm::codeview::UnionRecord ur;
46  llvm::codeview::ClassRecord cr;
47  llvm::codeview::EnumRecord er;
48  } m_cvr;
49 
52  clang::TagDecl &m_tag_decl;
55  std::vector<IndexedBase> m_bases;
57  llvm::DenseMap<lldb::opaque_compiler_type_t,
58  llvm::SmallSet<std::pair<llvm::StringRef, CompilerType>, 8>>
60 
61 public:
63  PdbTypeSymId id, CompilerType &derived_ct, clang::TagDecl &tag_decl,
64  PdbAstBuilder &ast_builder, PdbIndex &index,
65  llvm::DenseMap<lldb::opaque_compiler_type_t,
66  llvm::SmallSet<std::pair<llvm::StringRef, CompilerType>,
67  8>> &cxx_record_map);
68 
69 #define MEMBER_RECORD(EnumName, EnumVal, Name) \
70  llvm::Error visitKnownMember(llvm::codeview::CVMemberRecord &CVR, \
71  llvm::codeview::Name##Record &Record) override;
72 #define MEMBER_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
73 #include "llvm/DebugInfo/CodeView/CodeViewTypes.def"
74 
75  void complete();
76 
77 private:
78  clang::QualType AddBaseClassForTypeIndex(
79  llvm::codeview::TypeIndex ti, llvm::codeview::MemberAccess access,
80  llvm::Optional<uint64_t> vtable_idx = llvm::Optional<uint64_t>());
81  void AddMethod(llvm::StringRef name, llvm::codeview::TypeIndex type_idx,
82  llvm::codeview::MemberAccess access,
83  llvm::codeview::MethodOptions options,
84  llvm::codeview::MemberAttributes attrs);
85 };
86 
87 } // namespace npdb
88 } // namespace lldb_private
89 
90 #endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_NATIVEPDB_UDTRECORDCOMPLETER_H
lldb_private::npdb::PdbSymUidKind::Type
@ Type
lldb_private::npdb::UdtRecordCompleter::UdtTagRecord::er
llvm::codeview::EnumRecord er
Definition: UdtRecordCompleter.h:47
llvm
Definition: Debugger.h:50
TypeVisitorCallbacks
lldb_private::npdb::PdbIndex
PdbIndex - Lazy access to the important parts of a PDB file.
Definition: PdbIndex.h:47
lldb_private::npdb::UdtRecordCompleter::UdtTagRecord::cr
llvm::codeview::ClassRecord cr
Definition: UdtRecordCompleter.h:46
lldb_private::npdb::UdtRecordCompleter::AddBaseClassForTypeIndex
clang::QualType AddBaseClassForTypeIndex(llvm::codeview::TypeIndex ti, llvm::codeview::MemberAccess access, llvm::Optional< uint64_t > vtable_idx=llvm::Optional< uint64_t >())
Definition: UdtRecordCompleter.cpp:58
lldb_private::ClangASTImporter::LayoutInfo
Definition: ClangASTImporter.h:66
lldb_private::npdb::UdtRecordCompleter::IndexedBase
std::pair< uint64_t, std::unique_ptr< clang::CXXBaseSpecifier > > IndexedBase
Definition: UdtRecordCompleter.h:41
lldb_private::npdb::UdtRecordCompleter::UdtTagRecord::UdtTagRecord
UdtTagRecord()
Definition: UdtRecordCompleter.h:44
lldb_private::npdb::UdtRecordCompleter::complete
void complete()
Definition: UdtRecordCompleter.cpp:289
lldb_private::npdb::UdtRecordCompleter::m_ast_builder
PdbAstBuilder & m_ast_builder
Definition: UdtRecordCompleter.h:53
lldb_private::npdb::PdbTypeSymId
Definition: PdbSymUid.h:70
lldb_private::npdb::UdtRecordCompleter::UdtTagRecord
Definition: UdtRecordCompleter.h:43
lldb_private::npdb::UdtRecordCompleter::UdtRecordCompleter
UdtRecordCompleter(PdbTypeSymId id, CompilerType &derived_ct, clang::TagDecl &tag_decl, PdbAstBuilder &ast_builder, PdbIndex &index, llvm::DenseMap< lldb::opaque_compiler_type_t, llvm::SmallSet< std::pair< llvm::StringRef, CompilerType >, 8 >> &cxx_record_map)
Definition: UdtRecordCompleter.cpp:32
lldb_private::npdb::UdtRecordCompleter::m_cvr
union lldb_private::npdb::UdtRecordCompleter::UdtTagRecord m_cvr
PdbSymUid.h
lldb_private::npdb::UdtRecordCompleter
Definition: UdtRecordCompleter.h:39
lldb_private::npdb::UdtRecordCompleter::m_cxx_record_map
llvm::DenseMap< lldb::opaque_compiler_type_t, llvm::SmallSet< std::pair< llvm::StringRef, CompilerType >, 8 > > & m_cxx_record_map
Definition: UdtRecordCompleter.h:59
clang
Definition: ASTResultSynthesizer.h:15
lldb_private::npdb::UdtRecordCompleter::m_derived_ct
CompilerType & m_derived_ct
Definition: UdtRecordCompleter.h:51
lldb_private::CompilerType
Generic representation of a type in a programming language.
Definition: CompilerType.h:33
lldb_private::npdb::UdtRecordCompleter::m_id
PdbTypeSymId m_id
Definition: UdtRecordCompleter.h:50
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::npdb::UdtRecordCompleter::m_tag_decl
clang::TagDecl & m_tag_decl
Definition: UdtRecordCompleter.h:52
ClangASTImporter.h
lldb_private::npdb::UdtRecordCompleter::m_layout
ClangASTImporter::LayoutInfo m_layout
Definition: UdtRecordCompleter.h:56
lldb_private::npdb::UdtRecordCompleter::UdtTagRecord::ur
llvm::codeview::UnionRecord ur
Definition: UdtRecordCompleter.h:45
lldb::opaque_compiler_type_t
void * opaque_compiler_type_t
Definition: lldb-types.h:90
lldb_private::npdb::UdtRecordCompleter::AddMethod
void AddMethod(llvm::StringRef name, llvm::codeview::TypeIndex type_idx, llvm::codeview::MemberAccess access, llvm::codeview::MethodOptions options, llvm::codeview::MemberAttributes attrs)
Definition: UdtRecordCompleter.cpp:78
lldb_private::npdb::PdbAstBuilder
Definition: PdbAstBuilder.h:51
lldb_private::npdb::UdtRecordCompleter::m_index
PdbIndex & m_index
Definition: UdtRecordCompleter.h:54
lldb_private::npdb::UdtRecordCompleter::m_bases
std::vector< IndexedBase > m_bases
Definition: UdtRecordCompleter.h:55