LLDB mainline
TypeSystem.h
Go to the documentation of this file.
1//===-- TypeSystem.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_SYMBOL_TYPESYSTEM_H
10#define LLDB_SYMBOL_TYPESYSTEM_H
11
12#include <atomic>
13#include <cassert>
14#include <functional>
15#include <mutex>
16#include <optional>
17#include <string>
18
19#include "llvm/ADT/APFloat.h"
20#include "llvm/ADT/APSInt.h"
21#include "llvm/ADT/DenseMap.h"
22#include "llvm/ADT/SmallBitVector.h"
23#include "llvm/Support/Casting.h"
24#include "llvm/Support/Error.h"
25#include "llvm/Support/JSON.h"
26
31#include "lldb/Symbol/Type.h"
32#include "lldb/Utility/Scalar.h"
33#include "lldb/lldb-forward.h"
34#include "lldb/lldb-private.h"
35#include "lldb/lldb-types.h"
36
37class PDBASTParser;
38
39namespace lldb_private {
40
41namespace plugin {
42namespace dwarf {
43class DWARFDIE;
44class DWARFASTParser;
45} // namespace dwarf
46} // namespace plugin
47
48namespace npdb {
49 class PdbAstBuilder;
50} // namespace npdb
51
52/// Interface for representing a type system.
53///
54/// Implemented by language plugins to define the type system for a given
55/// language.
56///
57/// This interface extensively used opaque pointers to prevent that generic
58/// LLDB code has dependencies on language plugins. The type and semantics of
59/// these opaque pointers are defined by the TypeSystem implementation inside
60/// the respective language plugin. Opaque pointers from one TypeSystem
61/// instance should never be passed to a different TypeSystem instance (even
62/// when the language plugin for both TypeSystem instances is the same).
63///
64/// Most of the functions in this class should not be called directly but only
65/// called by their respective counterparts in CompilerType, CompilerDecl and
66/// CompilerDeclContext.
67///
68/// \see lldb_private::CompilerType
69/// \see lldb_private::CompilerDecl
70/// \see lldb_private::CompilerDeclContext
72 public std::enable_shared_from_this<TypeSystem> {
73public:
74 // Constructors and Destructors
76 ~TypeSystem() override;
77
78 // LLVM RTTI support
79 virtual bool isA(const void *ClassID) const = 0;
80
82 Module *module);
83
85 Target *target);
86
87 /// Free up any resources associated with this TypeSystem. Done before
88 /// removing all the TypeSystems from the TypeSystemMap.
89 virtual void Finalize() {}
90
91 /// Called on a target's scratch type systems when the target loads the
92 /// modules in \p module_list.
93 virtual void ModulesDidLoad(ModuleList &module_list) {}
94
95 virtual plugin::dwarf::DWARFASTParser *GetDWARFParser() { return nullptr; }
96
97 virtual PDBASTParser *GetPDBParser() { return nullptr; }
98 virtual npdb::PdbAstBuilder *GetNativePDBParser() { return nullptr; }
99
100 // CompilerDecl functions
101 virtual ConstString DeclGetName(void *opaque_decl) = 0;
102
103 virtual ConstString DeclGetMangledName(void *opaque_decl);
104
105 virtual CompilerDeclContext DeclGetDeclContext(void *opaque_decl);
106
107 virtual CompilerType DeclGetFunctionReturnType(void *opaque_decl);
108
109 virtual size_t DeclGetFunctionNumArguments(void *opaque_decl);
110
111 virtual CompilerType DeclGetFunctionArgumentType(void *opaque_decl,
112 size_t arg_idx);
113
114 virtual std::vector<lldb_private::CompilerContext>
115 DeclGetCompilerContext(void *opaque_decl);
116
117 virtual Scalar DeclGetConstantValue(void *opaque_decl) { return Scalar(); }
118
119 virtual CompilerType GetTypeForDecl(void *opaque_decl) = 0;
120
121 // CompilerDeclContext functions
122
123 virtual std::vector<CompilerDecl>
124 DeclContextFindDeclByName(void *opaque_decl_ctx, ConstString name,
125 const bool ignore_imported_decls);
126
127 virtual ConstString DeclContextGetName(void *opaque_decl_ctx) = 0;
128
129 virtual ConstString
130 DeclContextGetScopeQualifiedName(void *opaque_decl_ctx) = 0;
131
132 virtual bool DeclContextIsClassMethod(void *opaque_decl_ctx) = 0;
133
134 virtual bool DeclContextIsContainedInLookup(void *opaque_decl_ctx,
135 void *other_opaque_decl_ctx) = 0;
136
137 virtual lldb::LanguageType DeclContextGetLanguage(void *opaque_decl_ctx) = 0;
138
139 /// Returns the direct parent context of specified type
140 virtual CompilerDeclContext
142
143 virtual std::vector<lldb_private::CompilerContext>
144 DeclContextGetCompilerContext(void *opaque_decl_ctx);
145
146 // Tests
147#ifndef NDEBUG
148 /// Verify the integrity of the type to catch CompilerTypes that mix
149 /// and match invalid TypeSystem/Opaque type pairs.
150 virtual bool Verify(lldb::opaque_compiler_type_t type) = 0;
151#endif
152
154 CompilerType *element_type, uint64_t *size,
155 bool *is_incomplete) = 0;
156
158
160
162
164
166
168
170
171 virtual size_t
173
174 virtual CompilerType
176 const size_t index) = 0;
177
179
180 virtual bool
182
184
186 CompilerType *function_pointer_type_ptr) = 0;
187
189 bool &is_signed) = 0;
190
192 bool &is_signed) {
193 is_signed = false;
194 return false;
195 }
196
198
200 CompilerType *target_type, // Can pass NULL
201 bool check_cplusplus, bool check_objc) = 0;
202
204 CompilerType *pointee_type) = 0;
205
207
209
211 return false;
212 }
213
214 /// Returns the target address space of \p type,
215 /// or std::nullopt if it lives in the default address space.
216 virtual std::optional<uint32_t>
218 return std::nullopt;
219 }
220
221 virtual bool CanPassInRegisters(const CompilerType &type) = 0;
222
223 // TypeSystems can support more than one language
224 virtual bool SupportsLanguage(lldb::LanguageType language) = 0;
225
226 static bool SupportsLanguageStatic(lldb::LanguageType language);
227 // Type Completion
228
230
232 return false;
233 }
234
235 // AST related queries
236
237 virtual uint32_t GetPointerByteSize() = 0;
238
239 virtual CompilerType GetPointerDiffType(bool is_signed) = 0;
240
242
243 virtual unsigned GetPtrAuthKey(lldb::opaque_compiler_type_t type) = 0;
244
245 virtual unsigned
247
248 virtual bool
250
251 // Accessors
252
254 bool BaseOnly) = 0;
255
257
258 /// Defaults to GetTypeName(type). Override if your language desires
259 /// specialized behavior.
261
262 virtual uint32_t
264 CompilerType *pointee_or_element_compiler_type) = 0;
265
266 virtual lldb::LanguageType
268
269 virtual lldb::TypeClass GetTypeClass(lldb::opaque_compiler_type_t type) = 0;
270
271 // Creating related types
272
273 virtual CompilerType
275 ExecutionContextScope *exe_scope) = 0;
276
278 uint64_t size);
279
281
282 virtual CompilerType
284
285 // Returns -1 if this isn't a function of if the function doesn't have a
286 // prototype Returns a value >= 0 if there is a prototype.
288
289 virtual CompilerType
291 size_t idx) = 0;
292
293 virtual CompilerType
295
297
300
302
304
305 virtual CompilerType
307
308 virtual CompilerType
310
312
314
316
318
320 uint32_t payload);
321
322 virtual CompilerType
324 uint32_t address_space);
325
326 /// \param opaque_payload The m_payload field of Type, which may
327 /// carry TypeSystem-specific extra information.
329 const char *name,
330 const CompilerDeclContext &decl_ctx,
331 uint32_t opaque_payload);
332
333 // Exploring the type
334
335 virtual const llvm::fltSemantics &
336 GetFloatTypeSemantics(size_t byte_size, lldb::Format format) = 0;
337
338 virtual llvm::Expected<uint64_t>
340 ExecutionContextScope *exe_scope) = 0;
341
343
345
346 virtual llvm::Expected<uint32_t>
348 bool omit_empty_base_classes,
349 const ExecutionContext *exe_ctx) = 0;
350
352
353 virtual lldb::BasicType
355
356 virtual void ForEachEnumerator(
358 std::function<bool(const CompilerType &integer_type,
359 ConstString name,
360 const llvm::APSInt &value)> const &callback) {}
361
362 virtual uint32_t GetNumFields(lldb::opaque_compiler_type_t type) = 0;
363
365 size_t idx, std::string &name,
366 uint64_t *bit_offset_ptr,
367 uint32_t *bitfield_bit_size_ptr,
368 bool *is_bitfield_ptr) = 0;
369
370 virtual uint32_t
372
373 virtual uint32_t
375
376 virtual CompilerType
378 uint32_t *bit_offset_ptr) = 0;
379
380 virtual CompilerType
382 uint32_t *bit_offset_ptr) = 0;
383
385 llvm::StringRef name) {
386 return CompilerDecl();
387 }
388
389 virtual llvm::Expected<CompilerType>
391 ExecutionContext *exe_ctx, std::string &deref_name,
392 uint32_t &deref_byte_size, int32_t &deref_byte_offset,
393 ValueObject *valobj, uint64_t &language_flags) = 0;
394
395 virtual llvm::Expected<CompilerType> GetChildCompilerTypeAtIndex(
396 lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx, size_t idx,
397 bool transparent_pointers, bool omit_empty_base_classes,
398 bool ignore_array_bounds, std::string &child_name,
399 uint32_t &child_byte_size, int32_t &child_byte_offset,
400 uint32_t &child_bitfield_bit_size, uint32_t &child_bitfield_bit_offset,
401 bool &child_is_base_class, bool &child_is_deref_of_parent,
402 ValueObject *valobj, uint64_t &language_flags) = 0;
403
404 // Lookup a child given a name. This function will match base class names and
405 // member member names in "clang_type" only, not descendants.
406 virtual llvm::Expected<uint32_t>
408 llvm::StringRef name,
409 bool omit_empty_base_classes) = 0;
410
412 lldb::opaque_compiler_type_t type, llvm::StringRef name,
413 bool omit_empty_base_classes, std::vector<uint32_t> &child_indexes) = 0;
414
415 virtual CompilerType
417 llvm::StringRef name) {
418 return CompilerType();
419 }
420
422
424 bool expand_pack);
425
428 bool expand_pack);
429 virtual CompilerType
431 bool expand_pack);
432 virtual std::optional<CompilerType::IntegralTemplateArgument>
434 bool expand_pack);
435
437
438 virtual CompilerType
440
441 // Dumping types
442
443#ifndef NDEBUG
444 /// Convenience LLVM-style dump method for use in the debugger only.
445 LLVM_DUMP_METHOD virtual void
447#endif
448
450 lldb::Format format, const DataExtractor &data,
451 lldb::offset_t data_offset, size_t data_byte_size,
452 uint32_t bitfield_bit_size,
453 uint32_t bitfield_bit_offset,
454 ExecutionContextScope *exe_scope) = 0;
455
456 /// Dump the type to stdout.
460
461 /// Print a description of the type to a stream. The exact implementation
462 /// varies, but the expectation is that eDescriptionLevelFull returns a
463 /// source-like representation of the type, whereas eDescriptionLevelVerbose
464 /// does a dump of the underlying AST if applicable.
468
469 /// Dump a textual representation of the internal TypeSystem state to the
470 /// given stream.
471 ///
472 /// This should not modify the state of the TypeSystem if possible.
473 ///
474 /// \param[out] output Stream to dup the AST into.
475 /// \param[in] filter If empty, dump whole AST. If non-empty, will only
476 /// dump decls whose names contain \c filter.
477 /// \param[in] show_color If true, prints the AST color-highlighted.
478 virtual void Dump(llvm::raw_ostream &output, llvm::StringRef filter,
479 bool show_color) = 0;
480
481 /// This is used by swift.
483
484 // TODO: Determine if these methods should move to TypeSystemClang.
485
487 CompilerType *pointee_type) = 0;
488
490
491 virtual std::optional<size_t>
493 ExecutionContextScope *exe_scope) = 0;
494
496
500
501 virtual CompilerType
503 size_t bit_size) = 0;
504
506
507 virtual bool IsConst(lldb::opaque_compiler_type_t type) = 0;
508
510 CompilerType *base_type_ptr) = 0;
511
513
515
516 // If the current object represents a typedef type, get the underlying type
518
520 CompilerType *element_type, uint64_t *size) = 0;
521
522 virtual CompilerType
524
525 virtual CompilerType
527
529 CompilerType *pointee_type, bool *is_rvalue) = 0;
530
531 virtual bool
535
537 llvm::StringRef expr, llvm::StringRef prefix, SourceLanguage language,
538 Expression::ResultType desired_type,
539 const EvaluateExpressionOptions &options, ValueObject *ctx_obj) {
540 return nullptr;
541 }
542
543 virtual FunctionCaller *GetFunctionCaller(const CompilerType &return_type,
544 const Address &function_address,
545 const ValueList &arg_value_list,
546 const char *name) {
547 return nullptr;
548 }
549
550 virtual std::unique_ptr<UtilityFunction>
551 CreateUtilityFunction(std::string text, std::string name);
552
554 return nullptr;
555 }
556
557 virtual CompilerType GetTypeForFormatters(void *type);
558
559 virtual LazyBool ShouldPrintAsOneLiner(void *type, ValueObject *valobj);
560
561 // Type systems can have types that are placeholder types, which are meant to
562 // indicate the presence of a type, but offer no actual information about
563 // said types, and leave the burden of actually figuring type information out
564 // to dynamic type resolution. For instance a language with a generics
565 // system, can use placeholder types to indicate "type argument goes here",
566 // without promising uniqueness of the placeholder, nor attaching any
567 // actually idenfiable information to said placeholder. This API allows type
568 // systems to tell LLDB when such a type has been encountered In response,
569 // the debugger can react by not using this type as a cache entry in any
570 // type-specific way For instance, LLDB will currently not cache any
571 // formatters that are discovered on such a type as attributable to the
572 // meaningless type itself, instead preferring to use the dynamic type
573 virtual bool IsMeaninglessWithoutDynamicResolution(void *type);
574
575 virtual std::optional<llvm::json::Value> ReportStatistics();
576
577 SymbolFile *GetSymbolFile() const { return m_sym_file.load(); }
578
579 /// Bind this TypeSystem to its owning SymbolFile.
580 ///
581 /// A TypeSystem is created by its Module's TypeSystemMap before that
582 /// Module has an associated SymbolFile. The SymbolFile installs this
583 /// back-pointer when it first hands out the TypeSystem so that lazy
584 /// type-completion callbacks can route through it.
585 ///
586 /// Each Module owns at most one SymbolFile and one (Module-)TypeSystem per
587 /// language, so the binding is expected to be established exactly once.
588 /// Repeated calls with the same pointer are no-ops. Rebinding to a different
589 /// non-null SymbolFile is a programming error.
590 void SetSymbolFile(SymbolFile *sym_file) {
591 SymbolFile *expected = nullptr;
592 if (m_sym_file.compare_exchange_strong(expected, sym_file))
593 return;
594 assert(expected == sym_file &&
595 "TypeSystem rebound to a different SymbolFile");
596 }
597
601
602protected:
603 /// Used for reporting statistics.
605
606private:
607 std::atomic<SymbolFile *> m_sym_file = nullptr;
608};
609
611public:
614
615 // Clear calls Finalize on all the TypeSystems managed by this map, and then
616 // empties the map.
617 void Clear();
618
619 // Iterate through all of the type systems that are created. Return true from
620 // callback to keep iterating, false to stop iterating.
621 void ForEach(std::function<bool(lldb::TypeSystemSP)> const &callback);
622
623 llvm::Expected<lldb::TypeSystemSP>
625 bool can_create);
626
627 llvm::Expected<lldb::TypeSystemSP>
629 bool can_create);
630
631 /// Check all type systems in the map to see if any have forcefully completed
632 /// types;
634protected:
635 typedef llvm::DenseMap<uint16_t, lldb::TypeSystemSP> collection;
636 mutable std::mutex m_mutex; ///< A mutex to keep this object happy in
637 /// multi-threaded environments.
640
641private:
642 typedef llvm::function_ref<lldb::TypeSystemSP()> CreateCallback;
643 /// Finds the type system for the given language. If no type system could be
644 /// found for a language and a CreateCallback was provided, the value
645 /// returned by the callback will be treated as the TypeSystem for the
646 /// language.
647 ///
648 /// \param language The language for which the type system should be found.
649 /// \param create_callback A callback that will be called if no previously
650 /// created TypeSystem that fits the given language
651 /// could found. Can be omitted if a non-existent
652 /// type system should be treated as an error
653 /// instead.
654 /// \return The found type system or an error.
655 llvm::Expected<lldb::TypeSystemSP> GetTypeSystemForLanguage(
656 lldb::LanguageType language,
657 std::optional<CreateCallback> create_callback = std::nullopt);
658 };
659
660 } // namespace lldb_private
661
662#endif // LLDB_SYMBOL_TYPESYSTEM_H
A section + offset based address class.
Definition Address.h:62
Represents a generic declaration context in a program.
Represents a generic declaration such as a function declaration.
Generic representation of a type in a programming language.
A uniqued constant string class.
Definition ConstString.h:40
An data extractor class.
"lldb/Target/ExecutionContextScope.h" Inherit from this if your object can reconstruct its execution ...
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
Encapsulates a function that can be called.
A collection class for Module objects.
Definition ModuleList.h:127
A class that describes an executable image and its associated object and symbol files.
Definition Module.h:92
A stream class that can stream formatted output to a file.
Definition Stream.h:28
Provides public interface for all SymbolFiles.
Definition SymbolFile.h:51
llvm::DenseMap< uint16_t, lldb::TypeSystemSP > collection
Definition TypeSystem.h:635
std::mutex m_mutex
A mutex to keep this object happy in multi-threaded environments.
Definition TypeSystem.h:636
bool GetHasForcefullyCompletedTypes() const
Check all type systems in the map to see if any have forcefully completed types;.
llvm::function_ref< lldb::TypeSystemSP()> CreateCallback
Definition TypeSystem.h:642
llvm::Expected< lldb::TypeSystemSP > GetTypeSystemForLanguage(lldb::LanguageType language, Module *module, bool can_create)
void ForEach(std::function< bool(lldb::TypeSystemSP)> const &callback)
std::atomic< SymbolFile * > m_sym_file
Definition TypeSystem.h:607
virtual CompilerType GetFullyUnqualifiedType(lldb::opaque_compiler_type_t type)=0
virtual PersistentExpressionState * GetPersistentExpressionState()
Definition TypeSystem.h:553
virtual CompilerType GetFunctionReturnType(lldb::opaque_compiler_type_t type)=0
virtual std::unique_ptr< UtilityFunction > CreateUtilityFunction(std::string text, std::string name)
virtual void Finalize()
Free up any resources associated with this TypeSystem.
Definition TypeSystem.h:89
virtual bool IsMeaninglessWithoutDynamicResolution(void *type)
virtual size_t GetNumTemplateArguments(lldb::opaque_compiler_type_t type, bool expand_pack)
virtual bool IsEnumerationType(lldb::opaque_compiler_type_t type, bool &is_signed)
Definition TypeSystem.h:191
virtual bool GetPtrAuthAddressDiversity(lldb::opaque_compiler_type_t type)=0
virtual PDBASTParser * GetPDBParser()
Definition TypeSystem.h:97
virtual CompilerType GetBuiltinTypeByName(ConstString name)
virtual bool GetCompleteType(lldb::opaque_compiler_type_t type)=0
virtual bool IsBeingDefined(lldb::opaque_compiler_type_t type)=0
virtual CompilerType GetTypeTemplateArgument(lldb::opaque_compiler_type_t type, size_t idx, bool expand_pack)
SymbolFile * GetSymbolFile() const
Definition TypeSystem.h:577
virtual CompilerType GetTypeForFormatters(void *type)
virtual unsigned GetPtrAuthDiscriminator(lldb::opaque_compiler_type_t type)=0
virtual bool IsVectorType(lldb::opaque_compiler_type_t type, CompilerType *element_type, uint64_t *size)=0
virtual CompilerType AddRestrictModifier(lldb::opaque_compiler_type_t type)
virtual CompilerType GetAtomicType(lldb::opaque_compiler_type_t type)
virtual lldb::Format GetFormat(lldb::opaque_compiler_type_t type)=0
virtual bool IsMemberDataPointerType(lldb::opaque_compiler_type_t type)=0
virtual ConstString GetMangledTypeName(lldb::opaque_compiler_type_t type)
Defaults to GetTypeName(type).
virtual CompilerType GetLValueReferenceType(lldb::opaque_compiler_type_t type)
virtual std::vector< CompilerDecl > DeclContextFindDeclByName(void *opaque_decl_ctx, ConstString name, const bool ignore_imported_decls)
virtual void ForEachEnumerator(lldb::opaque_compiler_type_t type, std::function< bool(const CompilerType &integer_type, ConstString name, const llvm::APSInt &value)> const &callback)
Definition TypeSystem.h:356
virtual unsigned GetPtrAuthKey(lldb::opaque_compiler_type_t type)=0
virtual uint32_t GetPointerByteSize()=0
virtual ConstString DeclGetName(void *opaque_decl)=0
virtual llvm::Expected< uint64_t > GetBitSize(lldb::opaque_compiler_type_t type, ExecutionContextScope *exe_scope)=0
virtual bool IsAggregateType(lldb::opaque_compiler_type_t type)=0
virtual bool IsDefined(lldb::opaque_compiler_type_t type)=0
virtual std::optional< size_t > GetTypeBitAlign(lldb::opaque_compiler_type_t type, ExecutionContextScope *exe_scope)=0
virtual ConstString GetTypeName(lldb::opaque_compiler_type_t type, bool BaseOnly)=0
virtual bool DeclContextIsClassMethod(void *opaque_decl_ctx)=0
virtual bool IsPromotableIntegerType(lldb::opaque_compiler_type_t type)
virtual std::optional< llvm::json::Value > ReportStatistics()
virtual CompilerType AddAddressSpaceModifier(lldb::opaque_compiler_type_t type, uint32_t address_space)
virtual CompilerType CreateTypedef(lldb::opaque_compiler_type_t type, const char *name, const CompilerDeclContext &decl_ctx, uint32_t opaque_payload)
virtual void DumpTypeDescription(lldb::opaque_compiler_type_t type, Stream &s, lldb::DescriptionLevel level=lldb::eDescriptionLevelFull)=0
Print a description of the type to a stream.
virtual bool IsCompleteType(lldb::opaque_compiler_type_t type)=0
virtual CompilerType GetPointerDiffType(bool is_signed)=0
virtual Scalar DeclGetConstantValue(void *opaque_decl)
Definition TypeSystem.h:117
virtual bool IsFunctionType(lldb::opaque_compiler_type_t type)=0
virtual CompilerType GetFunctionArgumentAtIndex(lldb::opaque_compiler_type_t type, const size_t index)=0
virtual CompilerType GetNonReferenceType(lldb::opaque_compiler_type_t type)=0
virtual FunctionCaller * GetFunctionCaller(const CompilerType &return_type, const Address &function_address, const ValueList &arg_value_list, const char *name)
Definition TypeSystem.h:543
virtual LazyBool ShouldPrintAsOneLiner(void *type, ValueObject *valobj)
virtual size_t GetIndexOfChildMemberWithName(lldb::opaque_compiler_type_t type, llvm::StringRef name, bool omit_empty_base_classes, std::vector< uint32_t > &child_indexes)=0
virtual bool IsTypedefType(lldb::opaque_compiler_type_t type)=0
virtual bool IsBlockPointerType(lldb::opaque_compiler_type_t type, CompilerType *function_pointer_type_ptr)=0
virtual bool IsIntegerType(lldb::opaque_compiler_type_t type, bool &is_signed)=0
virtual lldb::LanguageType GetMinimumLanguage(lldb::opaque_compiler_type_t type)=0
virtual CompilerType AddConstModifier(lldb::opaque_compiler_type_t type)
bool m_has_forcefully_completed_types
Used for reporting statistics.
Definition TypeSystem.h:604
virtual lldb::Encoding GetEncoding(lldb::opaque_compiler_type_t type)=0
virtual npdb::PdbAstBuilder * GetNativePDBParser()
Definition TypeSystem.h:98
void SetSymbolFile(SymbolFile *sym_file)
Bind this TypeSystem to its owning SymbolFile.
Definition TypeSystem.h:590
virtual CompilerType GetTypedefedType(lldb::opaque_compiler_type_t type)=0
virtual const llvm::fltSemantics & GetFloatTypeSemantics(size_t byte_size, lldb::Format format)=0
virtual uint32_t GetTypeInfo(lldb::opaque_compiler_type_t type, CompilerType *pointee_or_element_compiler_type)=0
virtual bool IsPointerOrReferenceType(lldb::opaque_compiler_type_t type, CompilerType *pointee_type)=0
virtual void ModulesDidLoad(ModuleList &module_list)
Called on a target's scratch type systems when the target loads the modules in module_list.
Definition TypeSystem.h:93
virtual CompilerType AddPtrAuthModifier(lldb::opaque_compiler_type_t type, uint32_t payload)
virtual uint32_t GetNumVirtualBaseClasses(lldb::opaque_compiler_type_t type)=0
virtual CompilerDecl GetStaticFieldWithName(lldb::opaque_compiler_type_t type, llvm::StringRef name)
Definition TypeSystem.h:384
virtual CompilerType DeclGetFunctionReturnType(void *opaque_decl)
virtual CompilerType GetDirectNestedTypeWithName(lldb::opaque_compiler_type_t type, llvm::StringRef name)
Definition TypeSystem.h:416
virtual lldb::TypeClass GetTypeClass(lldb::opaque_compiler_type_t type)=0
virtual bool DeclContextIsContainedInLookup(void *opaque_decl_ctx, void *other_opaque_decl_ctx)=0
virtual bool HasPointerAuthQualifier(lldb::opaque_compiler_type_t type)
Definition TypeSystem.h:210
virtual LLVM_DUMP_METHOD void dump(lldb::opaque_compiler_type_t type) const =0
Convenience LLVM-style dump method for use in the debugger only.
virtual bool IsFunctionPointerType(lldb::opaque_compiler_type_t type)=0
virtual bool IsCharType(lldb::opaque_compiler_type_t type)=0
virtual CompilerType GetTypeForDecl(void *opaque_decl)=0
virtual CompilerType DeclGetFunctionArgumentType(void *opaque_decl, size_t arg_idx)
virtual bool IsMemberFunctionPointerType(lldb::opaque_compiler_type_t type)=0
virtual CompilerType GetRValueReferenceType(lldb::opaque_compiler_type_t type)
virtual std::vector< lldb_private::CompilerContext > DeclGetCompilerContext(void *opaque_decl)
virtual bool IsReferenceType(lldb::opaque_compiler_type_t type, CompilerType *pointee_type, bool *is_rvalue)=0
virtual UserExpression * GetUserExpression(llvm::StringRef expr, llvm::StringRef prefix, SourceLanguage language, Expression::ResultType desired_type, const EvaluateExpressionOptions &options, ValueObject *ctx_obj)
Definition TypeSystem.h:536
virtual std::vector< lldb_private::CompilerContext > DeclContextGetCompilerContext(void *opaque_decl_ctx)
virtual lldb::LanguageType DeclContextGetLanguage(void *opaque_decl_ctx)=0
virtual bool IsScopedEnumerationType(lldb::opaque_compiler_type_t type)=0
virtual std::optional< uint32_t > GetTargetAddressSpace(lldb::opaque_compiler_type_t type) const
Returns the target address space of type, or std::nullopt if it lives in the default address space.
Definition TypeSystem.h:217
bool GetHasForcefullyCompletedTypes() const
Definition TypeSystem.h:598
virtual bool IsAnonymousType(lldb::opaque_compiler_type_t type)
virtual bool IsPointerType(lldb::opaque_compiler_type_t type, CompilerType *pointee_type)=0
virtual ConstString DeclContextGetName(void *opaque_decl_ctx)=0
virtual ConstString DeclGetMangledName(void *opaque_decl)
virtual bool IsVoidType(lldb::opaque_compiler_type_t type)=0
virtual CompilerType GetArrayType(lldb::opaque_compiler_type_t type, uint64_t size)
virtual bool IsConst(lldb::opaque_compiler_type_t type)=0
virtual llvm::Expected< CompilerType > GetChildCompilerTypeAtIndex(lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx, size_t idx, bool transparent_pointers, bool omit_empty_base_classes, bool ignore_array_bounds, std::string &child_name, uint32_t &child_byte_size, int32_t &child_byte_offset, uint32_t &child_bitfield_bit_size, uint32_t &child_bitfield_bit_offset, bool &child_is_base_class, bool &child_is_deref_of_parent, ValueObject *valobj, uint64_t &language_flags)=0
virtual void Dump(llvm::raw_ostream &output, llvm::StringRef filter, bool show_color)=0
Dump a textual representation of the internal TypeSystem state to the given stream.
virtual void DumpTypeDescription(lldb::opaque_compiler_type_t type, lldb::DescriptionLevel level=lldb::eDescriptionLevelFull)=0
Dump the type to stdout.
static bool SupportsLanguageStatic(lldb::LanguageType language)
virtual CompilerDeclContext GetCompilerDeclContextForType(const CompilerType &type)
Returns the direct parent context of specified type.
virtual ConstString DeclContextGetScopeQualifiedName(void *opaque_decl_ctx)=0
virtual CompilerType GetFieldAtIndex(lldb::opaque_compiler_type_t type, size_t idx, std::string &name, uint64_t *bit_offset_ptr, uint32_t *bitfield_bit_size_ptr, bool *is_bitfield_ptr)=0
virtual CompilerType CreateGenericFunctionPrototype()
Definition TypeSystem.h:497
virtual CompilerType GetDirectBaseClassAtIndex(lldb::opaque_compiler_type_t type, size_t idx, uint32_t *bit_offset_ptr)=0
virtual llvm::Expected< CompilerType > GetDereferencedType(lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx, std::string &deref_name, uint32_t &deref_byte_size, int32_t &deref_byte_offset, ValueObject *valobj, uint64_t &language_flags)=0
virtual CompilerType GetPromotedIntegerType(lldb::opaque_compiler_type_t type)
virtual bool CanPassInRegisters(const CompilerType &type)=0
virtual CompilerType GetPointeeType(lldb::opaque_compiler_type_t type)=0
virtual CompilerType GetVirtualBaseClassAtIndex(lldb::opaque_compiler_type_t type, size_t idx, uint32_t *bit_offset_ptr)=0
virtual size_t GetNumberOfFunctionArguments(lldb::opaque_compiler_type_t type)=0
virtual bool SupportsLanguage(lldb::LanguageType language)=0
virtual CompilerType GetArrayElementType(lldb::opaque_compiler_type_t type, ExecutionContextScope *exe_scope)=0
virtual bool IsPolymorphicClass(lldb::opaque_compiler_type_t type)=0
virtual uint32_t IsHomogeneousAggregate(lldb::opaque_compiler_type_t type, CompilerType *base_type_ptr)=0
virtual std::optional< CompilerType::IntegralTemplateArgument > GetIntegralTemplateArgument(lldb::opaque_compiler_type_t type, size_t idx, bool expand_pack)
virtual bool Verify(lldb::opaque_compiler_type_t type)=0
Verify the integrity of the type to catch CompilerTypes that mix and match invalid TypeSystem/Opaque ...
virtual unsigned GetTypeQualifiers(lldb::opaque_compiler_type_t type)=0
virtual llvm::Expected< uint32_t > GetNumChildren(lldb::opaque_compiler_type_t type, bool omit_empty_base_classes, const ExecutionContext *exe_ctx)=0
virtual llvm::Expected< uint32_t > GetIndexOfChildWithName(lldb::opaque_compiler_type_t type, llvm::StringRef name, bool omit_empty_base_classes)=0
virtual lldb::BasicType GetBasicTypeEnumeration(lldb::opaque_compiler_type_t type)=0
virtual plugin::dwarf::DWARFASTParser * GetDWARFParser()
Definition TypeSystem.h:95
virtual CompilerType GetCanonicalType(lldb::opaque_compiler_type_t type)=0
virtual ConstString GetDisplayTypeName(lldb::opaque_compiler_type_t type)=0
virtual int GetFunctionArgumentCount(lldb::opaque_compiler_type_t type)=0
virtual lldb::TemplateArgumentKind GetTemplateArgumentKind(lldb::opaque_compiler_type_t type, size_t idx, bool expand_pack)
virtual bool IsRuntimeGeneratedType(lldb::opaque_compiler_type_t type)=0
This is used by swift.
virtual CompilerType GetBuiltinTypeForEncodingAndBitSize(lldb::Encoding encoding, size_t bit_size)=0
virtual bool ShouldTreatScalarValueAsAddress(lldb::opaque_compiler_type_t type)
Definition TypeSystem.h:532
virtual bool IsFloatingPointType(lldb::opaque_compiler_type_t type)=0
virtual bool DumpTypeValue(lldb::opaque_compiler_type_t type, Stream &s, lldb::Format format, const DataExtractor &data, lldb::offset_t data_offset, size_t data_byte_size, uint32_t bitfield_bit_size, uint32_t bitfield_bit_offset, ExecutionContextScope *exe_scope)=0
static lldb::TypeSystemSP CreateInstance(lldb::LanguageType language, Module *module)
virtual uint32_t GetNumFields(lldb::opaque_compiler_type_t type)=0
virtual bool IsTemplateType(lldb::opaque_compiler_type_t type)
virtual bool isA(const void *ClassID) const =0
virtual size_t DeclGetFunctionNumArguments(void *opaque_decl)
virtual bool IsForcefullyCompleted(lldb::opaque_compiler_type_t type)
Definition TypeSystem.h:231
virtual CompilerType GetPointerType(lldb::opaque_compiler_type_t type)=0
virtual bool IsPossibleDynamicType(lldb::opaque_compiler_type_t type, CompilerType *target_type, bool check_cplusplus, bool check_objc)=0
virtual CompilerDeclContext DeclGetDeclContext(void *opaque_decl)
virtual size_t GetNumMemberFunctions(lldb::opaque_compiler_type_t type)=0
virtual CompilerType GetBasicTypeFromAST(lldb::BasicType basic_type)=0
virtual uint32_t GetNumDirectBaseClasses(lldb::opaque_compiler_type_t type)=0
virtual CompilerType AddVolatileModifier(lldb::opaque_compiler_type_t type)
virtual bool IsScalarType(lldb::opaque_compiler_type_t type)=0
virtual CompilerType GetEnumerationIntegerType(lldb::opaque_compiler_type_t type)=0
virtual bool IsArrayType(lldb::opaque_compiler_type_t type, CompilerType *element_type, uint64_t *size, bool *is_incomplete)=0
virtual TypeMemberFunctionImpl GetMemberFunctionAtIndex(lldb::opaque_compiler_type_t type, size_t idx)=0
virtual CompilerType GetSizeType()=0
virtual CompilerType GetFunctionArgumentTypeAtIndex(lldb::opaque_compiler_type_t type, size_t idx)=0
Encapsulates a one-time expression for use in lldb.
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::TypeSystem > TypeSystemSP
void * opaque_compiler_type_t
Definition lldb-types.h:91
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
@ eDescriptionLevelFull
BasicType
Basic types enumeration for the public API SBType::GetBasicType().
Format
Display format definitions.
uint64_t offset_t
Definition lldb-types.h:86
LanguageType
Programming language type.
Encoding
Register encoding definitions.
A type-erased pair of llvm::dwarf::SourceLanguageName and version.