LLDB mainline
TypeSystemClang.h
Go to the documentation of this file.
1//===-- TypeSystemClang.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_TYPESYSTEM_CLANG_TYPESYSTEMCLANG_H
10#define LLDB_SOURCE_PLUGINS_TYPESYSTEM_CLANG_TYPESYSTEMCLANG_H
11
12#include <cstdint>
13
14#include <functional>
15#include <initializer_list>
16#include <memory>
17#include <optional>
18#include <set>
19#include <string>
20#include <utility>
21#include <vector>
22
23#include "clang/AST/ASTContext.h"
24#include "clang/AST/ASTFwd.h"
25#include "clang/AST/TemplateBase.h"
26#include "clang/AST/Type.h"
27#include "clang/Basic/TargetInfo.h"
28#include "llvm/ADT/APSInt.h"
29#include "llvm/ADT/SmallVector.h"
30
35#include "lldb/Target/Target.h"
37#include "lldb/Utility/Flags.h"
38#include "lldb/Utility/Log.h"
40
42class PDBASTParser;
43
44namespace clang {
45class FileManager;
46class HeaderSearch;
47class ModuleMap;
48} // namespace clang
49
50namespace lldb_private {
51
52class ClangASTMetadata;
53class ClangASTSource;
54class Declaration;
55
56/// A Clang module ID.
58 unsigned m_id = 0;
59
60public:
62 explicit OptionalClangModuleID(unsigned id) : m_id(id) {}
63 bool HasValue() const { return m_id != 0; }
64 unsigned GetValue() const { return m_id; }
65};
66
67/// The implementation of lldb::Type's m_payload field for TypeSystemClang.
69 /// The Layout is as follows:
70 /// \verbatim
71 /// bit 0..30 ... Owning Module ID.
72 /// bit 31 ...... IsCompleteObjCClass.
73 /// \endverbatim
75
76public:
77 TypePayloadClang() = default;
78 explicit TypePayloadClang(OptionalClangModuleID owning_module,
79 bool is_complete_objc_class = false);
80 explicit TypePayloadClang(uint32_t opaque_payload) : m_payload(opaque_payload) {}
81 operator Type::Payload() { return m_payload; }
82
83 static constexpr unsigned ObjCClassBit = 1 << 31;
85 void SetIsCompleteObjCClass(bool is_complete_objc_class) {
86 m_payload = is_complete_objc_class ? Flags(m_payload).Set(ObjCClassBit)
88 }
91 }
93 /// \}
94};
95
96/// A TypeSystem implementation based on Clang.
97///
98/// This class uses a single clang::ASTContext as the backend for storing
99/// its types and declarations. Every clang::ASTContext should also just have
100/// a single associated TypeSystemClang instance that manages it.
101///
102/// The clang::ASTContext instance can either be created by TypeSystemClang
103/// itself or it can adopt an existing clang::ASTContext (for example, when
104/// it is necessary to provide a TypeSystem interface for an existing
105/// clang::ASTContext that was created by clang::CompilerInstance).
107 // LLVM RTTI support
108 static char ID;
109
110public:
111 typedef void (*CompleteTagDeclCallback)(void *baton, clang::TagDecl *);
112 typedef void (*CompleteObjCInterfaceDeclCallback)(void *baton,
113 clang::ObjCInterfaceDecl *);
114
115 // llvm casting support
116 bool isA(const void *ClassID) const override { return ClassID == &ID; }
117 static bool classof(const TypeSystem *ts) { return ts->isA(&ID); }
118
119 /// Constructs a TypeSystemClang with an ASTContext using the given triple.
120 ///
121 /// \param name The name for the TypeSystemClang (for logging purposes)
122 /// \param triple The llvm::Triple used for the ASTContext. The triple defines
123 /// certain characteristics of the ASTContext and its types
124 /// (e.g., whether certain primitive types exist or what their
125 /// signedness is).
126 explicit TypeSystemClang(llvm::StringRef name, llvm::Triple triple);
127
128 /// Constructs a TypeSystemClang that uses an existing ASTContext internally.
129 /// Useful when having an existing ASTContext created by Clang.
130 ///
131 /// \param name The name for the TypeSystemClang (for logging purposes)
132 /// \param existing_ctxt An existing ASTContext.
133 explicit TypeSystemClang(llvm::StringRef name,
134 clang::ASTContext &existing_ctxt);
135
136 ~TypeSystemClang() override;
137
138 void Finalize() override;
139
140 // PluginInterface functions
141 llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
142
143 static llvm::StringRef GetPluginNameStatic() { return "clang"; }
144
145 static lldb::TypeSystemSP CreateInstance(lldb::LanguageType language,
146 Module *module, Target *target);
147
150
151 static void Initialize();
152
153 static void Terminate();
154
155 static TypeSystemClang *GetASTContext(clang::ASTContext *ast_ctx);
156
157 /// Returns the display name of this TypeSystemClang that indicates what
158 /// purpose it serves in LLDB. Used for example in logs.
159 llvm::StringRef getDisplayName() const { return m_display_name; }
160
161 /// Returns the clang::ASTContext instance managed by this TypeSystemClang.
162 clang::ASTContext &getASTContext();
163
164 clang::MangleContext *getMangleContext();
165
166 std::shared_ptr<clang::TargetOptions> &getTargetOptions();
167
168 clang::TargetInfo *getTargetInfo();
169
170 void setSema(clang::Sema *s);
171 clang::Sema *getSema() { return m_sema; }
172
173 const char *GetTargetTriple();
174
176 llvm::IntrusiveRefCntPtr<clang::ExternalASTSource> &ast_source_up);
177
178 bool GetCompleteDecl(clang::Decl *decl) {
180 }
181
182 static void DumpDeclHiearchy(clang::Decl *decl);
183
184 static void DumpDeclContextHiearchy(clang::DeclContext *decl_ctx);
185
186 static bool DeclsAreEquivalent(clang::Decl *lhs_decl, clang::Decl *rhs_decl);
187
188 static bool GetCompleteDecl(clang::ASTContext *ast, clang::Decl *decl);
189
190 void SetMetadataAsUserID(const clang::Decl *decl, lldb::user_id_t user_id);
191 void SetMetadataAsUserID(const clang::Type *type, lldb::user_id_t user_id);
192
193 void SetMetadata(const clang::Decl *object, ClangASTMetadata &meta_data);
194
195 void SetMetadata(const clang::Type *object, ClangASTMetadata &meta_data);
196 ClangASTMetadata *GetMetadata(const clang::Decl *object);
197 ClangASTMetadata *GetMetadata(const clang::Type *object);
198
199 void SetCXXRecordDeclAccess(const clang::CXXRecordDecl *object,
200 clang::AccessSpecifier access);
201 clang::AccessSpecifier
202 GetCXXRecordDeclAccess(const clang::CXXRecordDecl *object);
203
204 // Basic Types
206 size_t bit_size) override;
207
209
211
213 GetBuiltinTypeForDWARFEncodingAndBitSize(llvm::StringRef type_name,
214 uint32_t dw_ate, uint32_t bit_size);
215
216 CompilerType GetCStringType(bool is_const);
217
218 static clang::DeclContext *GetDeclContextForType(clang::QualType type);
219
220 static clang::DeclContext *GetDeclContextForType(const CompilerType &type);
221
222 uint32_t GetPointerByteSize() override;
223
224 clang::TranslationUnitDecl *GetTranslationUnitDecl() {
225 return getASTContext().getTranslationUnitDecl();
226 }
227
228 static bool AreTypesSame(CompilerType type1, CompilerType type2,
229 bool ignore_qualifiers = false);
230
231 /// Creates a CompilerType from the given QualType with the current
232 /// TypeSystemClang instance as the CompilerType's typesystem.
233 /// \param qt The QualType for a type that belongs to the ASTContext of this
234 /// TypeSystemClang.
235 /// \return The CompilerType representing the given QualType. If the
236 /// QualType's type pointer is a nullptr then the function returns an
237 /// invalid CompilerType.
238 CompilerType GetType(clang::QualType qt) {
239 if (qt.getTypePtrOrNull() == nullptr)
240 return CompilerType();
241 // Check that the type actually belongs to this TypeSystemClang.
242 assert(qt->getAsTagDecl() == nullptr ||
243 &qt->getAsTagDecl()->getASTContext() == &getASTContext());
244 return CompilerType(weak_from_this(), qt.getAsOpaquePtr());
245 }
246
247 CompilerType GetTypeForDecl(clang::NamedDecl *decl);
248
249 CompilerType GetTypeForDecl(clang::TagDecl *decl);
250
251 CompilerType GetTypeForDecl(clang::ObjCInterfaceDecl *objc_decl);
252
253 template <typename RecordDeclType>
256 clang::DeclContext *decl_context = nullptr) {
257 CompilerType compiler_type;
258
259 if (type_name.GetLength()) {
260 clang::ASTContext &ast = getASTContext();
261 if (!decl_context)
262 decl_context = ast.getTranslationUnitDecl();
263
264 clang::IdentifierInfo &myIdent = ast.Idents.get(type_name.GetCString());
265 clang::DeclarationName myName =
266 ast.DeclarationNames.getIdentifier(&myIdent);
267
268 clang::DeclContext::lookup_result result = decl_context->lookup(myName);
269
270 if (!result.empty()) {
271 clang::NamedDecl *named_decl = *result.begin();
272 if (const RecordDeclType *record_decl =
273 llvm::dyn_cast<RecordDeclType>(named_decl))
274 compiler_type =
275 CompilerType(weak_from_this(),
276 clang::QualType(record_decl->getTypeForDecl(), 0)
277 .getAsOpaquePtr());
278 }
279 }
280
281 return compiler_type;
282 }
283
285 ConstString type_name,
286 const std::initializer_list<std::pair<const char *, CompilerType>>
287 &type_fields,
288 bool packed = false);
289
291 ConstString type_name,
292 const std::initializer_list<std::pair<const char *, CompilerType>>
293 &type_fields,
294 bool packed = false);
295
296 static bool IsOperator(llvm::StringRef name,
297 clang::OverloadedOperatorKind &op_kind);
298
299 // Structure, Unions, Classes
300
301 static clang::AccessSpecifier
303
304 static clang::AccessSpecifier
305 UnifyAccessSpecifiers(clang::AccessSpecifier lhs, clang::AccessSpecifier rhs);
306
307 uint32_t GetNumBaseClasses(const clang::CXXRecordDecl *cxx_record_decl,
308 bool omit_empty_base_classes);
309
310 uint32_t GetIndexForRecordChild(const clang::RecordDecl *record_decl,
311 clang::NamedDecl *canonical_decl,
312 bool omit_empty_base_classes);
313
314 uint32_t GetIndexForRecordBase(const clang::RecordDecl *record_decl,
315 const clang::CXXBaseSpecifier *base_spec,
316 bool omit_empty_base_classes);
317
318 /// Synthesize a clang::Module and return its ID or a default-constructed ID.
321 bool is_framework = false,
322 bool is_explicit = false);
323
324 CompilerType CreateRecordType(clang::DeclContext *decl_ctx,
325 OptionalClangModuleID owning_module,
326 lldb::AccessType access_type,
327 llvm::StringRef name, int kind,
328 lldb::LanguageType language,
329 ClangASTMetadata *metadata = nullptr,
330 bool exports_symbols = false);
331
333 public:
335 TemplateParameterInfos(llvm::ArrayRef<const char *> names_in,
336 llvm::ArrayRef<clang::TemplateArgument> args_in)
337 : names(names_in), args(args_in) {
338 assert(names.size() == args_in.size());
339 }
340
343
346
348
349 bool IsValid() const {
350 // Having a pack name but no packed args doesn't make sense, so mark
351 // these template parameters as invalid.
352 if (pack_name && !packed_args)
353 return false;
354 return args.size() == names.size() &&
355 (!packed_args || !packed_args->packed_args);
356 }
357
358 bool IsEmpty() const { return args.empty(); }
359 size_t Size() const { return args.size(); }
360
361 llvm::ArrayRef<clang::TemplateArgument> GetArgs() const { return args; }
362 llvm::ArrayRef<const char *> GetNames() const { return names; }
363
364 clang::TemplateArgument const &Front() const {
365 assert(!args.empty());
366 return args.front();
367 }
368
369 void InsertArg(char const *name, clang::TemplateArgument arg) {
370 args.emplace_back(std::move(arg));
371 names.push_back(name);
372 }
373
374 // Parameter pack related
375
376 bool hasParameterPack() const { return static_cast<bool>(packed_args); }
377
379 assert(packed_args != nullptr);
380 return *packed_args;
381 }
382
384 assert(packed_args != nullptr);
385 return *packed_args;
386 }
387
388 llvm::ArrayRef<clang::TemplateArgument> GetParameterPackArgs() const {
389 assert(packed_args != nullptr);
390 return packed_args->GetArgs();
391 }
392
393 bool HasPackName() const { return pack_name && pack_name[0]; }
394
395 llvm::StringRef GetPackName() const {
396 assert(HasPackName());
397 return pack_name;
398 }
399
400 void SetPackName(char const *name) { pack_name = name; }
401
402 void SetParameterPack(std::unique_ptr<TemplateParameterInfos> args) {
403 packed_args = std::move(args);
404 }
405
406 private:
407 /// Element 'names[i]' holds the template argument name
408 /// of 'args[i]'
409 llvm::SmallVector<const char *, 2> names;
410 llvm::SmallVector<clang::TemplateArgument, 2> args;
411
412 const char * pack_name = nullptr;
413 std::unique_ptr<TemplateParameterInfos> packed_args;
414 };
415
416 clang::FunctionTemplateDecl *CreateFunctionTemplateDecl(
417 clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module,
418 clang::FunctionDecl *func_decl, const TemplateParameterInfos &infos);
419
421 clang::FunctionDecl *func_decl, clang::FunctionTemplateDecl *Template,
422 const TemplateParameterInfos &infos);
423
424 clang::ClassTemplateDecl *CreateClassTemplateDecl(
425 clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module,
426 lldb::AccessType access_type, llvm::StringRef class_name, int kind,
427 const TemplateParameterInfos &infos);
428
429 clang::TemplateTemplateParmDecl *
430 CreateTemplateTemplateParmDecl(const char *template_name);
431
432 clang::ClassTemplateSpecializationDecl *CreateClassTemplateSpecializationDecl(
433 clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module,
434 clang::ClassTemplateDecl *class_template_decl, int kind,
435 const TemplateParameterInfos &infos);
436
438 CreateClassTemplateSpecializationType(clang::ClassTemplateSpecializationDecl *
439 class_template_specialization_decl);
440
441 static clang::DeclContext *
442 GetAsDeclContext(clang::FunctionDecl *function_decl);
443
445 bool is_method, clang::OverloadedOperatorKind op_kind,
446 uint32_t num_params);
447
448 bool FieldIsBitfield(clang::FieldDecl *field, uint32_t &bitfield_bit_size);
449
450 bool RecordHasFields(const clang::RecordDecl *record_decl);
451
452 bool BaseSpecifierIsEmpty(const clang::CXXBaseSpecifier *b);
453
454 CompilerType CreateObjCClass(llvm::StringRef name,
455 clang::DeclContext *decl_ctx,
456 OptionalClangModuleID owning_module,
457 bool isForwardDecl, bool isInternal,
458 ClangASTMetadata *metadata = nullptr);
459
460 // Returns a mask containing bits from the TypeSystemClang::eTypeXXX
461 // enumerations
462
463 // Namespace Declarations
464
465 clang::NamespaceDecl *
466 GetUniqueNamespaceDeclaration(const char *name, clang::DeclContext *decl_ctx,
467 OptionalClangModuleID owning_module,
468 bool is_inline = false);
469
470 // Function Types
471
472 clang::FunctionDecl *CreateFunctionDeclaration(
473 clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module,
474 llvm::StringRef name, const CompilerType &function_Type,
475 clang::StorageClass storage, bool is_inline);
476
478 CreateFunctionType(const CompilerType &result_type, const CompilerType *args,
479 unsigned num_args, bool is_variadic, unsigned type_quals,
480 clang::CallingConv cc = clang::CC_C,
481 clang::RefQualifierKind ref_qual = clang::RQ_None);
482
483 clang::ParmVarDecl *
484 CreateParameterDeclaration(clang::DeclContext *decl_ctx,
485 OptionalClangModuleID owning_module,
486 const char *name, const CompilerType &param_type,
487 int storage, bool add_decl = false);
488
489 void SetFunctionParameters(clang::FunctionDecl *function_decl,
490 llvm::ArrayRef<clang::ParmVarDecl *> params);
491
493
494 // Array Types
495
496 CompilerType CreateArrayType(const CompilerType &element_type,
497 size_t element_count, bool is_vector);
498
499 // Enumeration Types
500 CompilerType CreateEnumerationType(llvm::StringRef name,
501 clang::DeclContext *decl_ctx,
502 OptionalClangModuleID owning_module,
503 const Declaration &decl,
504 const CompilerType &integer_qual_type,
505 bool is_scoped);
506
507 // Integer type functions
508
509 CompilerType GetIntTypeFromBitSize(size_t bit_size, bool is_signed);
510
511 CompilerType GetPointerSizedIntType(bool is_signed);
512
513 // Floating point functions
514
515 static CompilerType GetFloatTypeFromBitSize(clang::ASTContext *ast,
516 size_t bit_size);
517
518 // TypeSystem methods
519 DWARFASTParser *GetDWARFParser() override;
520 PDBASTParser *GetPDBParser() override;
522
523 // TypeSystemClang callbacks for external source lookups.
524 void CompleteTagDecl(clang::TagDecl *);
525
526 void CompleteObjCInterfaceDecl(clang::ObjCInterfaceDecl *);
527
528 bool LayoutRecordType(
529 const clang::RecordDecl *record_decl, uint64_t &size, uint64_t &alignment,
530 llvm::DenseMap<const clang::FieldDecl *, uint64_t> &field_offsets,
531 llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits>
532 &base_offsets,
533 llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits>
534 &vbase_offsets);
535
536 /// Creates a CompilerDecl from the given Decl with the current
537 /// TypeSystemClang instance as its typesystem.
538 /// The Decl has to come from the ASTContext of this
539 /// TypeSystemClang.
540 CompilerDecl GetCompilerDecl(clang::Decl *decl) {
541 assert(&decl->getASTContext() == &getASTContext() &&
542 "CreateCompilerDecl for Decl from wrong ASTContext?");
543 return CompilerDecl(this, decl);
544 }
545
546 // CompilerDecl override functions
547 ConstString DeclGetName(void *opaque_decl) override;
548
549 ConstString DeclGetMangledName(void *opaque_decl) override;
550
551 CompilerDeclContext DeclGetDeclContext(void *opaque_decl) override;
552
553 CompilerType DeclGetFunctionReturnType(void *opaque_decl) override;
554
555 size_t DeclGetFunctionNumArguments(void *opaque_decl) override;
556
558 size_t arg_idx) override;
559
560 CompilerType GetTypeForDecl(void *opaque_decl) override;
561
562 // CompilerDeclContext override functions
563
564 /// Creates a CompilerDeclContext from the given DeclContext
565 /// with the current TypeSystemClang instance as its typesystem.
566 /// The DeclContext has to come from the ASTContext of this
567 /// TypeSystemClang.
568 CompilerDeclContext CreateDeclContext(clang::DeclContext *ctx);
569
570 /// Set the owning module for \p decl.
571 static void SetOwningModule(clang::Decl *decl,
572 OptionalClangModuleID owning_module);
573
574 std::vector<CompilerDecl>
575 DeclContextFindDeclByName(void *opaque_decl_ctx, ConstString name,
576 const bool ignore_using_decls) override;
577
578 ConstString DeclContextGetName(void *opaque_decl_ctx) override;
579
580 ConstString DeclContextGetScopeQualifiedName(void *opaque_decl_ctx) override;
581
582 bool DeclContextIsClassMethod(void *opaque_decl_ctx) override;
583
584 bool DeclContextIsContainedInLookup(void *opaque_decl_ctx,
585 void *other_opaque_decl_ctx) override;
586
587 lldb::LanguageType DeclContextGetLanguage(void *opaque_decl_ctx) override;
588
589 // Clang specific clang::DeclContext functions
590
591 static clang::DeclContext *
593
594 static clang::ObjCMethodDecl *
596
597 static clang::CXXMethodDecl *
599
600 static clang::FunctionDecl *
602
603 static clang::NamespaceDecl *
605
607 const clang::Decl *object);
608
609 static clang::ASTContext *
611
612 // Tests
613
614#ifndef NDEBUG
615 bool Verify(lldb::opaque_compiler_type_t type) override;
616#endif
617
619 CompilerType *element_type, uint64_t *size,
620 bool *is_incomplete) override;
621
623 CompilerType *element_type, uint64_t *size) override;
624
626
628
630
631 bool IsCharType(lldb::opaque_compiler_type_t type) override;
632
634
635 bool IsConst(lldb::opaque_compiler_type_t type) override;
636
638 uint32_t &length) override;
639
640 static bool IsCXXClassType(const CompilerType &type);
641
642 bool IsDefined(lldb::opaque_compiler_type_t type) override;
643
645 bool &is_complex) override;
646
648
650 CompilerType *base_type_ptr) override;
651
652 size_t
654
656 const size_t index) override;
657
659
661
663 CompilerType *function_pointer_type_ptr) override;
664
666 bool &is_signed) override;
667
669 bool &is_signed) override;
670
672
673 static bool IsObjCClassType(const CompilerType &type);
674
675 static bool IsObjCClassTypeAndHasIVars(const CompilerType &type,
676 bool check_superclass);
677
678 static bool IsObjCObjectOrInterfaceType(const CompilerType &type);
679
680 static bool IsObjCObjectPointerType(const CompilerType &type,
681 CompilerType *target_type = nullptr);
682
684
686
688
690 CompilerType *target_type, // Can pass nullptr
691 bool check_cplusplus, bool check_objc) override;
692
694
696 CompilerType *pointee_type) override;
697
699 CompilerType *pointee_type) override;
700
702 CompilerType *pointee_type, bool *is_rvalue) override;
703
704 bool IsScalarType(lldb::opaque_compiler_type_t type) override;
705
707
708 bool IsVoidType(lldb::opaque_compiler_type_t type) override;
709
710 bool CanPassInRegisters(const CompilerType &type) override;
711
712 bool SupportsLanguage(lldb::LanguageType language) override;
713
714 static std::optional<std::string> GetCXXClassName(const CompilerType &type);
715
716 // Type Completion
717
719
721
722 // Accessors
723
725 bool base_only) override;
726
728
730 CompilerType *pointee_or_element_compiler_type) override;
731
734
735 lldb::TypeClass GetTypeClass(lldb::opaque_compiler_type_t type) override;
736
737 unsigned GetTypeQualifiers(lldb::opaque_compiler_type_t type) override;
738
739 // Creating related types
740
742 ExecutionContextScope *exe_scope) override;
743
745 uint64_t size) override;
746
748
751
754
755 // Returns -1 if this isn't a function of if the function doesn't have a
756 // prototype Returns a value >= 0 if there is a prototype.
758
760 size_t idx) override;
761
764
766
769 size_t idx) override;
770
772
774
776
779
782
784
786
788
790
791 /// Using the current type, create a new typedef to that type using
792 /// "typedef_name" as the name and "decl_ctx" as the decl context.
793 /// \param opaque_payload is an opaque TypePayloadClang.
795 const char *name,
796 const CompilerDeclContext &decl_ctx,
797 uint32_t opaque_payload) override;
798
799 // If the current object represents a typedef type, get the underlying type
801
802 // Create related types using the current type's AST
804
805 // Exploring the type
806
807 const llvm::fltSemantics &GetFloatTypeSemantics(size_t byte_size) override;
808
809 std::optional<uint64_t> GetByteSize(lldb::opaque_compiler_type_t type,
810 ExecutionContextScope *exe_scope) {
811 if (std::optional<uint64_t> bit_size = GetBitSize(type, exe_scope))
812 return (*bit_size + 7) / 8;
813 return std::nullopt;
814 }
815
816 std::optional<uint64_t> GetBitSize(lldb::opaque_compiler_type_t type,
817 ExecutionContextScope *exe_scope) override;
818
820 uint64_t &count) override;
821
823
824 std::optional<size_t>
826 ExecutionContextScope *exe_scope) override;
827
829 bool omit_empty_base_classes,
830 const ExecutionContext *exe_ctx) override;
831
833
836
837 static lldb::BasicType
839 ConstString name);
840
843 std::function<bool(const CompilerType &integer_type,
844 ConstString name,
845 const llvm::APSInt &value)> const &callback) override;
846
848
850 std::string &name, uint64_t *bit_offset_ptr,
851 uint32_t *bitfield_bit_size_ptr,
852 bool *is_bitfield_ptr) override;
853
855
857
859 size_t idx,
860 uint32_t *bit_offset_ptr) override;
861
863 size_t idx,
864 uint32_t *bit_offset_ptr) override;
865
866 static uint32_t GetNumPointeeChildren(clang::QualType type);
867
869 lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx, size_t idx,
870 bool transparent_pointers, bool omit_empty_base_classes,
871 bool ignore_array_bounds, std::string &child_name,
872 uint32_t &child_byte_size, int32_t &child_byte_offset,
873 uint32_t &child_bitfield_bit_size, uint32_t &child_bitfield_bit_offset,
874 bool &child_is_base_class, bool &child_is_deref_of_parent,
875 ValueObject *valobj, uint64_t &language_flags) override;
876
877 // Lookup a child given a name. This function will match base class names and
878 // member member names in "clang_type" only, not descendants.
880 llvm::StringRef name,
881 bool omit_empty_base_classes) override;
882
883 // Lookup a child member given a name. This function will match member names
884 // only and will descend into "clang_type" children in search for the first
885 // member in this class, or any base class that matches "name".
886 // TODO: Return all matches for a given name by returning a
887 // vector<vector<uint32_t>>
888 // so we catch all names that match a given child name, not just the first.
889 size_t
891 llvm::StringRef name,
892 bool omit_empty_base_classes,
893 std::vector<uint32_t> &child_indexes) override;
894
896
898 bool expand_pack) override;
899
902 bool expand_pack) override;
904 size_t idx, bool expand_pack) override;
905 std::optional<CompilerType::IntegralTemplateArgument>
907 bool expand_pack) override;
908
909 CompilerType GetTypeForFormatters(void *type) override;
910
911#define LLDB_INVALID_DECL_LEVEL UINT32_MAX
912 // LLDB_INVALID_DECL_LEVEL is returned by CountDeclLevels if child_decl_ctx
913 // could not be found in decl_ctx.
914 uint32_t CountDeclLevels(clang::DeclContext *frame_decl_ctx,
915 clang::DeclContext *child_decl_ctx,
916 ConstString *child_name = nullptr,
917 CompilerType *child_type = nullptr);
918
919 // Modifying RecordType
920 static clang::FieldDecl *AddFieldToRecordType(const CompilerType &type,
921 llvm::StringRef name,
922 const CompilerType &field_type,
923 lldb::AccessType access,
924 uint32_t bitfield_bit_size);
925
926 static void BuildIndirectFields(const CompilerType &type);
927
928 static void SetIsPacked(const CompilerType &type);
929
930 static clang::VarDecl *AddVariableToRecordType(const CompilerType &type,
931 llvm::StringRef name,
932 const CompilerType &var_type,
933 lldb::AccessType access);
934
935 /// Initializes a variable with an integer value.
936 /// \param var The variable to initialize. Must not already have an
937 /// initializer and must have an integer or enum type.
938 /// \param init_value The integer value that the variable should be
939 /// initialized to. Has to match the bit width of the
940 /// variable type.
941 static void SetIntegerInitializerForVariable(clang::VarDecl *var,
942 const llvm::APInt &init_value);
943
944 /// Initializes a variable with a floating point value.
945 /// \param var The variable to initialize. Must not already have an
946 /// initializer and must have a floating point type.
947 /// \param init_value The float value that the variable should be
948 /// initialized to.
949 static void
950 SetFloatingInitializerForVariable(clang::VarDecl *var,
951 const llvm::APFloat &init_value);
952
953 clang::CXXMethodDecl *AddMethodToCXXRecordType(
954 lldb::opaque_compiler_type_t type, llvm::StringRef name,
955 const char *mangled_name, const CompilerType &method_type,
956 lldb::AccessType access, bool is_virtual, bool is_static, bool is_inline,
957 bool is_explicit, bool is_attr_used, bool is_artificial);
958
960
961 // C++ Base Classes
962 std::unique_ptr<clang::CXXBaseSpecifier>
964 lldb::AccessType access, bool is_virtual,
965 bool base_of_class);
966
969 std::vector<std::unique_ptr<clang::CXXBaseSpecifier>> bases);
970
971 static bool SetObjCSuperClass(const CompilerType &type,
972 const CompilerType &superclass_compiler_type);
973
974 static bool AddObjCClassProperty(const CompilerType &type,
975 const char *property_name,
976 const CompilerType &property_compiler_type,
977 clang::ObjCIvarDecl *ivar_decl,
978 const char *property_setter_name,
979 const char *property_getter_name,
980 uint32_t property_attributes,
981 ClangASTMetadata *metadata);
982
983 static clang::ObjCMethodDecl *AddMethodToObjCObjectType(
984 const CompilerType &type,
985 const char *name, // the full symbol name as seen in the symbol table
986 // (lldb::opaque_compiler_type_t type, "-[NString
987 // stringWithCString:]")
988 const CompilerType &method_compiler_type, lldb::AccessType access,
989 bool is_artificial, bool is_variadic, bool is_objc_direct_call);
990
992 bool has_extern);
993
994 // Tag Declarations
995 static bool StartTagDeclarationDefinition(const CompilerType &type);
996
997 static bool CompleteTagDeclarationDefinition(const CompilerType &type);
998
999 // Modifying Enumeration types
1000 clang::EnumConstantDecl *AddEnumerationValueToEnumerationType(
1001 const CompilerType &enum_type, const Declaration &decl, const char *name,
1002 int64_t enum_value, uint32_t enum_value_bit_size);
1003 clang::EnumConstantDecl *AddEnumerationValueToEnumerationType(
1004 const CompilerType &enum_type, const Declaration &decl, const char *name,
1005 const llvm::APSInt &value);
1006
1007 /// Returns the underlying integer type for an enum type. If the given type
1008 /// is invalid or not an enum-type, the function returns an invalid
1009 /// CompilerType.
1010 CompilerType GetEnumerationIntegerType(CompilerType type);
1011
1012 // Pointers & References
1013
1014 // Call this function using the class type when you want to make a member
1015 // pointer type to pointee_type.
1016 static CompilerType CreateMemberPointerType(const CompilerType &type,
1017 const CompilerType &pointee_type);
1018
1019 // Dumping types
1020#ifndef NDEBUG
1021 /// Convenience LLVM-style dump method for use in the debugger only.
1022 /// In contrast to the other \p Dump() methods this directly invokes
1023 /// \p clang::QualType::dump().
1024 LLVM_DUMP_METHOD void dump(lldb::opaque_compiler_type_t type) const override;
1025#endif
1026
1027 /// \see lldb_private::TypeSystem::Dump
1028 void Dump(llvm::raw_ostream &output) override;
1029
1030 /// Dump clang AST types from the symbol file.
1031 ///
1032 /// \param[in] s
1033 /// A stream to send the dumped AST node(s) to
1034 /// \param[in] symbol_name
1035 /// The name of the symbol to dump, if it is empty dump all the symbols
1036 void DumpFromSymbolFile(Stream &s, llvm::StringRef symbol_name);
1037
1038 void DumpValue(lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx,
1039 Stream *s, lldb::Format format, const DataExtractor &data,
1040 lldb::offset_t data_offset, size_t data_byte_size,
1041 uint32_t bitfield_bit_size, uint32_t bitfield_bit_offset,
1042 bool show_types, bool show_summary, bool verbose,
1043 uint32_t depth) override;
1044
1045 bool DumpTypeValue(lldb::opaque_compiler_type_t type, Stream *s,
1046 lldb::Format format, const DataExtractor &data,
1047 lldb::offset_t data_offset, size_t data_byte_size,
1048 uint32_t bitfield_bit_size, uint32_t bitfield_bit_offset,
1049 ExecutionContextScope *exe_scope) override;
1050
1051 void DumpSummary(lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx,
1052 Stream *s, const DataExtractor &data,
1053 lldb::offset_t data_offset, size_t data_byte_size) override;
1054
1058
1060 lldb::opaque_compiler_type_t type, Stream *s,
1062
1063 static void DumpTypeName(const CompilerType &type);
1064
1065 static clang::EnumDecl *GetAsEnumDecl(const CompilerType &type);
1066
1067 static clang::RecordDecl *GetAsRecordDecl(const CompilerType &type);
1068
1069 static clang::TagDecl *GetAsTagDecl(const CompilerType &type);
1070
1071 static clang::TypedefNameDecl *GetAsTypedefDecl(const CompilerType &type);
1072
1073 static clang::CXXRecordDecl *
1075
1076 static clang::ObjCInterfaceDecl *
1077 GetAsObjCInterfaceDecl(const CompilerType &type);
1078
1079 clang::ClassTemplateDecl *ParseClassTemplateDecl(
1080 clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module,
1081 lldb::AccessType access_type, const char *parent_name, int tag_decl_kind,
1082 const TypeSystemClang::TemplateParameterInfos &template_param_infos);
1083
1084 clang::BlockDecl *CreateBlockDeclaration(clang::DeclContext *ctx,
1085 OptionalClangModuleID owning_module);
1086
1087 clang::UsingDirectiveDecl *
1088 CreateUsingDirectiveDeclaration(clang::DeclContext *decl_ctx,
1089 OptionalClangModuleID owning_module,
1090 clang::NamespaceDecl *ns_decl);
1091
1092 clang::UsingDecl *CreateUsingDeclaration(clang::DeclContext *current_decl_ctx,
1093 OptionalClangModuleID owning_module,
1094 clang::NamedDecl *target);
1095
1096 clang::VarDecl *CreateVariableDeclaration(clang::DeclContext *decl_context,
1097 OptionalClangModuleID owning_module,
1098 const char *name,
1099 clang::QualType type);
1100
1102 GetOpaqueCompilerType(clang::ASTContext *ast, lldb::BasicType basic_type);
1103
1104 static clang::QualType GetQualType(lldb::opaque_compiler_type_t type) {
1105 if (type)
1106 return clang::QualType::getFromOpaquePtr(type);
1107 return clang::QualType();
1108 }
1109
1110 static clang::QualType
1112 if (type)
1113 return clang::QualType::getFromOpaquePtr(type).getCanonicalType();
1114 return clang::QualType();
1115 }
1116
1117 clang::DeclarationName
1118 GetDeclarationName(llvm::StringRef name,
1119 const CompilerType &function_clang_type);
1120
1121 clang::LangOptions *GetLangOpts() const {
1122 return m_language_options_up.get();
1123 }
1124 clang::SourceManager *GetSourceMgr() const {
1125 return m_source_manager_up.get();
1126 }
1127
1128 /// Complete a type from debug info, or mark it as forcefully completed if
1129 /// there is no definition of the type in the current Module. Call this
1130 /// function in contexts where the usual C++ rules require a type to be
1131 /// complete (base class, member, etc.).
1132 static void RequireCompleteType(CompilerType type);
1133
1134 bool SetDeclIsForcefullyCompleted(const clang::TagDecl *td);
1135
1136 /// Return the template parameters (including surrounding <>) in string form.
1137 std::string
1138 PrintTemplateParams(const TemplateParameterInfos &template_param_infos);
1139
1140private:
1141 /// Returns the PrintingPolicy used when generating the internal type names.
1142 /// These type names are mostly used for the formatter selection.
1143 clang::PrintingPolicy GetTypePrintingPolicy();
1144 /// Returns the internal type name for the given NamedDecl using the
1145 /// type printing policy.
1146 std::string GetTypeNameForDecl(const clang::NamedDecl *named_decl,
1147 bool qualified = true);
1148
1149 const clang::ClassTemplateSpecializationDecl *
1151
1153 llvm::function_ref<bool(clang::QualType)> predicate) const;
1154
1155 // Classes that inherit from TypeSystemClang can see and modify these
1156 std::string m_target_triple;
1157 std::unique_ptr<clang::ASTContext> m_ast_up;
1158 std::unique_ptr<clang::LangOptions> m_language_options_up;
1159 std::unique_ptr<clang::FileManager> m_file_manager_up;
1160 std::unique_ptr<clang::SourceManager> m_source_manager_up;
1161 std::unique_ptr<clang::DiagnosticsEngine> m_diagnostics_engine_up;
1162 std::unique_ptr<clang::DiagnosticConsumer> m_diagnostic_consumer_up;
1163 std::shared_ptr<clang::TargetOptions> m_target_options_rp;
1164 std::unique_ptr<clang::TargetInfo> m_target_info_up;
1165 std::unique_ptr<clang::IdentifierTable> m_identifier_table_up;
1166 std::unique_ptr<clang::SelectorTable> m_selector_table_up;
1167 std::unique_ptr<clang::Builtin::Context> m_builtins_up;
1168 std::unique_ptr<clang::HeaderSearch> m_header_search_up;
1169 std::unique_ptr<clang::ModuleMap> m_module_map_up;
1170 std::unique_ptr<DWARFASTParserClang> m_dwarf_ast_parser_up;
1171 std::unique_ptr<PDBASTParser> m_pdb_ast_parser_up;
1172 std::unique_ptr<npdb::PdbAstBuilder> m_native_pdb_ast_parser_up;
1173 std::unique_ptr<clang::MangleContext> m_mangle_ctx_up;
1175 bool m_ast_owned = false;
1176 /// A string describing what this TypeSystemClang represents (e.g.,
1177 /// AST for debug information, an expression, some other utility ClangAST).
1178 /// Useful for logging and debugging.
1179 std::string m_display_name;
1180
1181 typedef llvm::DenseMap<const clang::Decl *, ClangASTMetadata> DeclMetadataMap;
1182 /// Maps Decls to their associated ClangASTMetadata.
1184
1185 typedef llvm::DenseMap<const clang::Type *, ClangASTMetadata> TypeMetadataMap;
1186 /// Maps Types to their associated ClangASTMetadata.
1188
1189 typedef llvm::DenseMap<const clang::CXXRecordDecl *, clang::AccessSpecifier>
1191 /// Maps CXXRecordDecl to their most recent added method/field's
1192 /// AccessSpecifier.
1194
1195 /// The sema associated that is currently used to build this ASTContext.
1196 /// May be null if we are already done parsing this ASTContext or the
1197 /// ASTContext wasn't created by parsing source code.
1198 clang::Sema *m_sema = nullptr;
1199
1200 // For TypeSystemClang only
1203 /// Creates the internal ASTContext.
1204 void CreateASTContext();
1205 void SetTargetTriple(llvm::StringRef target_triple);
1206};
1207
1208/// The TypeSystemClang instance used for the scratch ASTContext in a
1209/// lldb::Target.
1211 /// LLVM RTTI support
1212 static char ID;
1213
1214public:
1215 ScratchTypeSystemClang(Target &target, llvm::Triple triple);
1216
1217 ~ScratchTypeSystemClang() override = default;
1218
1219 void Finalize() override;
1220
1221 /// The different kinds of isolated ASTs within the scratch TypeSystem.
1222 ///
1223 /// These ASTs are isolated from the main scratch AST and are each
1224 /// dedicated to a special language option/feature that makes the contained
1225 /// AST nodes incompatible with other AST nodes.
1227 /// The isolated AST for declarations/types from expressions that imported
1228 /// type information from a C++ module. The templates from a C++ module
1229 /// often conflict with the templates we generate from debug information,
1230 /// so we put these types in their own AST.
1233
1234 /// Alias for requesting the default scratch TypeSystemClang in GetForTarget.
1235 // This isn't constexpr as gtest/std::optional comparison logic is trying
1236 // to get the address of this for pretty-printing.
1237 static const std::nullopt_t DefaultAST;
1238
1239 /// Infers the appropriate sub-AST from Clang's LangOptions.
1240 static std::optional<IsolatedASTKind>
1241 InferIsolatedASTKindFromLangOpts(const clang::LangOptions &l) {
1242 // If modules are activated we want the dedicated C++ module AST.
1243 // See IsolatedASTKind::CppModules for more info.
1244 if (l.Modules)
1246 return DefaultAST;
1247 }
1248
1249 /// Returns the scratch TypeSystemClang for the given target.
1250 /// \param target The Target which scratch TypeSystemClang should be returned.
1251 /// \param ast_kind Allows requesting a specific sub-AST instead of the
1252 /// default scratch AST. See also `IsolatedASTKind`.
1253 /// \param create_on_demand If the scratch TypeSystemClang instance can be
1254 /// created by this call if it doesn't exist yet. If it doesn't exist yet and
1255 /// this parameter is false, this function returns a nullptr.
1256 /// \return The scratch type system of the target or a nullptr in case an
1257 /// error occurred.
1258 static lldb::TypeSystemClangSP
1259 GetForTarget(Target &target,
1260 std::optional<IsolatedASTKind> ast_kind = DefaultAST,
1261 bool create_on_demand = true);
1262
1263 /// Returns the scratch TypeSystemClang for the given target. The returned
1264 /// TypeSystemClang will be the scratch AST or a sub-AST, depending on which
1265 /// fits best to the passed LangOptions.
1266 /// \param target The Target which scratch TypeSystemClang should be returned.
1267 /// \param lang_opts The LangOptions of a clang ASTContext that the caller
1268 /// wants to export type information from. This is used to
1269 /// find the best matching sub-AST that will be returned.
1270 static lldb::TypeSystemClangSP
1271 GetForTarget(Target &target, const clang::LangOptions &lang_opts) {
1272 return GetForTarget(target, InferIsolatedASTKindFromLangOpts(lang_opts));
1273 }
1274
1275 /// \see lldb_private::TypeSystem::Dump
1276 void Dump(llvm::raw_ostream &output) override;
1277
1279 GetUserExpression(llvm::StringRef expr, llvm::StringRef prefix,
1280 lldb::LanguageType language,
1281 Expression::ResultType desired_type,
1282 const EvaluateExpressionOptions &options,
1283 ValueObject *ctx_obj) override;
1284
1285 FunctionCaller *GetFunctionCaller(const CompilerType &return_type,
1286 const Address &function_address,
1287 const ValueList &arg_value_list,
1288 const char *name) override;
1289
1290 std::unique_ptr<UtilityFunction>
1291 CreateUtilityFunction(std::string text, std::string name) override;
1292
1294
1295 /// Unregisters the given ASTContext as a source from the scratch AST (and
1296 /// all sub-ASTs).
1297 /// \see ClangASTImporter::ForgetSource
1298 void ForgetSource(clang::ASTContext *src_ctx, ClangASTImporter &importer);
1299
1300 // llvm casting support
1301 bool isA(const void *ClassID) const override {
1302 return ClassID == &ID || TypeSystemClang::isA(ClassID);
1303 }
1304 static bool classof(const TypeSystem *ts) { return ts->isA(&ID); }
1305
1306private:
1307 std::unique_ptr<ClangASTSource> CreateASTSource();
1308 /// Returns the requested sub-AST.
1309 /// Will lazily create the sub-AST if it hasn't been created before.
1311
1312 /// The target triple.
1313 /// This was potentially adjusted and might not be identical to the triple
1314 /// of `m_target_wp`.
1315 llvm::Triple m_triple;
1316 lldb::TargetWP m_target_wp;
1317 /// The persistent variables associated with this process for the expression
1318 /// parser.
1319 std::unique_ptr<ClangPersistentVariables> m_persistent_variables;
1320 /// The ExternalASTSource that performs lookups and completes minimally
1321 /// imported types.
1322 std::unique_ptr<ClangASTSource> m_scratch_ast_source_up;
1323
1324 // FIXME: GCC 5.x doesn't support enum as map keys.
1325 typedef int IsolatedASTKey;
1326
1327 /// Map from IsolatedASTKind to their actual TypeSystemClang instance.
1328 /// This map is lazily filled with sub-ASTs and should be accessed via
1329 /// `GetSubAST` (which lazily fills this map).
1330 llvm::DenseMap<IsolatedASTKey, std::shared_ptr<TypeSystemClang>>
1332};
1333
1334} // namespace lldb_private
1335
1336#endif // LLDB_SOURCE_PLUGINS_TYPESYSTEM_CLANG_TYPESYSTEMCLANG_H
A section + offset based address class.
Definition: Address.h:59
Manages and observes all Clang AST node importing in LLDB.
Represents a generic declaration context in a program.
Represents a generic declaration such as a function declaration.
Definition: CompilerDecl.h:28
Generic representation of a type in a programming language.
Definition: CompilerType.h:36
A uniqued constant string class.
Definition: ConstString.h:40
size_t GetLength() const
Get the length in bytes of string value.
const char * GetCString() const
Get the string value as a C string.
Definition: ConstString.h:221
A class that describes the declaration location of a lldb object.
Definition: Declaration.h:24
"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.
A class to manage flags.
Definition: Flags.h:22
ValueType Clear(ValueType mask=~static_cast< ValueType >(0))
Clear one or more flags.
Definition: Flags.h:61
bool Test(ValueType bit) const
Test a single flag bit.
Definition: Flags.h:96
ValueType Set(ValueType mask)
Set one or more flags by logical OR'ing mask with the current flags.
Definition: Flags.h:73
Encapsulates a function that can be called.
A class that describes an executable image and its associated object and symbol files.
Definition: Module.h:88
The TypeSystemClang instance used for the scratch ASTContext in a lldb::Target.
static std::optional< IsolatedASTKind > InferIsolatedASTKindFromLangOpts(const clang::LangOptions &l)
Infers the appropriate sub-AST from Clang's LangOptions.
void Finalize() override
Free up any resources associated with this TypeSystem.
UserExpression * GetUserExpression(llvm::StringRef expr, llvm::StringRef prefix, lldb::LanguageType language, Expression::ResultType desired_type, const EvaluateExpressionOptions &options, ValueObject *ctx_obj) override
static lldb::TypeSystemClangSP GetForTarget(Target &target, std::optional< IsolatedASTKind > ast_kind=DefaultAST, bool create_on_demand=true)
Returns the scratch TypeSystemClang for the given target.
llvm::Triple m_triple
The target triple.
std::unique_ptr< ClangASTSource > CreateASTSource()
TypeSystemClang & GetIsolatedAST(IsolatedASTKind feature)
Returns the requested sub-AST.
std::unique_ptr< ClangASTSource > m_scratch_ast_source_up
The ExternalASTSource that performs lookups and completes minimally imported types.
IsolatedASTKind
The different kinds of isolated ASTs within the scratch TypeSystem.
@ CppModules
The isolated AST for declarations/types from expressions that imported type information from a C++ mo...
std::unique_ptr< ClangPersistentVariables > m_persistent_variables
The persistent variables associated with this process for the expression parser.
bool isA(const void *ClassID) const override
static char ID
LLVM RTTI support.
PersistentExpressionState * GetPersistentExpressionState() override
static lldb::TypeSystemClangSP GetForTarget(Target &target, const clang::LangOptions &lang_opts)
Returns the scratch TypeSystemClang for the given target.
~ScratchTypeSystemClang() override=default
FunctionCaller * GetFunctionCaller(const CompilerType &return_type, const Address &function_address, const ValueList &arg_value_list, const char *name) override
std::unique_ptr< UtilityFunction > CreateUtilityFunction(std::string text, std::string name) override
void ForgetSource(clang::ASTContext *src_ctx, ClangASTImporter &importer)
Unregisters the given ASTContext as a source from the scratch AST (and all sub-ASTs).
static bool classof(const TypeSystem *ts)
void Dump(llvm::raw_ostream &output) override
static const std::nullopt_t DefaultAST
Alias for requesting the default scratch TypeSystemClang in GetForTarget.
llvm::DenseMap< IsolatedASTKey, std::shared_ptr< TypeSystemClang > > m_isolated_asts
Map from IsolatedASTKind to their actual TypeSystemClang instance.
The implementation of lldb::Type's m_payload field for TypeSystemClang.
void SetIsCompleteObjCClass(bool is_complete_objc_class)
TypePayloadClang(uint32_t opaque_payload)
OptionalClangModuleID GetOwningModule()
Type::Payload m_payload
The Layout is as follows:
void SetOwningModule(OptionalClangModuleID id)
static constexpr unsigned ObjCClassBit
llvm::ArrayRef< clang::TemplateArgument > GetParameterPackArgs() const
TemplateParameterInfos & operator=(TemplateParameterInfos &&)=delete
void SetParameterPack(std::unique_ptr< TemplateParameterInfos > args)
std::unique_ptr< TemplateParameterInfos > packed_args
clang::TemplateArgument const & Front() const
TemplateParameterInfos(TemplateParameterInfos &&)=delete
void InsertArg(char const *name, clang::TemplateArgument arg)
TemplateParameterInfos & operator=(TemplateParameterInfos const &)=delete
TemplateParameterInfos(TemplateParameterInfos const &)=delete
TemplateParameterInfos(llvm::ArrayRef< const char * > names_in, llvm::ArrayRef< clang::TemplateArgument > args_in)
llvm::SmallVector< clang::TemplateArgument, 2 > args
llvm::SmallVector< const char *, 2 > names
Element 'names[i]' holds the template argument name of 'args[i]'.
TemplateParameterInfos const & GetParameterPack() const
llvm::ArrayRef< const char * > GetNames() const
llvm::ArrayRef< clang::TemplateArgument > GetArgs() const
A TypeSystem implementation based on Clang.
bool IsMemberFunctionPointerType(lldb::opaque_compiler_type_t type) override
clang::TranslationUnitDecl * GetTranslationUnitDecl()
size_t GetIndexOfChildMemberWithName(lldb::opaque_compiler_type_t type, llvm::StringRef name, bool omit_empty_base_classes, std::vector< uint32_t > &child_indexes) override
static clang::TypedefNameDecl * GetAsTypedefDecl(const CompilerType &type)
std::string GetTypeNameForDecl(const clang::NamedDecl *named_decl, bool qualified=true)
Returns the internal type name for the given NamedDecl using the type printing policy.
static clang::ObjCInterfaceDecl * GetAsObjCInterfaceDecl(const CompilerType &type)
std::string m_display_name
A string describing what this TypeSystemClang represents (e.g., AST for debug information,...
void SetMetadata(const clang::Decl *object, ClangASTMetadata &meta_data)
uint32_t GetNumChildren(lldb::opaque_compiler_type_t type, bool omit_empty_base_classes, const ExecutionContext *exe_ctx) override
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) override
ConstString GetTypeName(lldb::opaque_compiler_type_t type, bool base_only) override
static void SetOwningModule(clang::Decl *decl, OptionalClangModuleID owning_module)
Set the owning module for decl.
std::unique_ptr< clang::TargetInfo > m_target_info_up
std::unique_ptr< clang::LangOptions > m_language_options_up
static clang::DeclContext * GetAsDeclContext(clang::FunctionDecl *function_decl)
bool BaseSpecifierIsEmpty(const clang::CXXBaseSpecifier *b)
static uint32_t GetNumPointeeChildren(clang::QualType type)
ConstString DeclGetMangledName(void *opaque_decl) override
CompilerType GetBasicType(lldb::BasicType type)
clang::ClassTemplateDecl * CreateClassTemplateDecl(clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, lldb::AccessType access_type, llvm::StringRef class_name, int kind, const TemplateParameterInfos &infos)
void SetExternalSource(llvm::IntrusiveRefCntPtr< clang::ExternalASTSource > &ast_source_up)
clang::UsingDecl * CreateUsingDeclaration(clang::DeclContext *current_decl_ctx, OptionalClangModuleID owning_module, clang::NamedDecl *target)
static clang::AccessSpecifier ConvertAccessTypeToAccessSpecifier(lldb::AccessType access)
CompilerType GetNonReferenceType(lldb::opaque_compiler_type_t type) override
std::optional< uint64_t > GetByteSize(lldb::opaque_compiler_type_t type, ExecutionContextScope *exe_scope)
bool IsForcefullyCompleted(lldb::opaque_compiler_type_t type) override
bool SupportsLanguage(lldb::LanguageType language) override
uint32_t GetNumDirectBaseClasses(lldb::opaque_compiler_type_t type) override
OptionalClangModuleID GetOrCreateClangModule(llvm::StringRef name, OptionalClangModuleID parent, bool is_framework=false, bool is_explicit=false)
Synthesize a clang::Module and return its ID or a default-constructed ID.
void CompleteTagDecl(clang::TagDecl *)
static clang::FieldDecl * AddFieldToRecordType(const CompilerType &type, llvm::StringRef name, const CompilerType &field_type, lldb::AccessType access, uint32_t bitfield_bit_size)
std::shared_ptr< clang::TargetOptions > & getTargetOptions()
static TypeSystemClang * GetASTContext(clang::ASTContext *ast_ctx)
bool IsReferenceType(lldb::opaque_compiler_type_t type, CompilerType *pointee_type, bool *is_rvalue) override
CompilerType GetBuiltinTypeForEncodingAndBitSize(lldb::Encoding encoding, size_t bit_size) override
TypeSystemClang(const TypeSystemClang &)
static lldb::TypeSystemSP CreateInstance(lldb::LanguageType language, Module *module, Target *target)
clang::TargetInfo * getTargetInfo()
clang::FunctionTemplateDecl * CreateFunctionTemplateDecl(clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, clang::FunctionDecl *func_decl, const TemplateParameterInfos &infos)
static bool AreTypesSame(CompilerType type1, CompilerType type2, bool ignore_qualifiers=false)
std::optional< uint64_t > GetBitSize(lldb::opaque_compiler_type_t type, ExecutionContextScope *exe_scope) override
void DumpSummary(lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx, Stream *s, const DataExtractor &data, lldb::offset_t data_offset, size_t data_byte_size) override
CompilerType GetArrayType(lldb::opaque_compiler_type_t type, uint64_t size) override
bool IsFunctionType(lldb::opaque_compiler_type_t type) override
CompilerType GetFunctionReturnType(lldb::opaque_compiler_type_t type) override
static bool IsObjCClassTypeAndHasIVars(const CompilerType &type, bool check_superclass)
CompilerType GetLValueReferenceType(lldb::opaque_compiler_type_t type) override
bool SetDeclIsForcefullyCompleted(const clang::TagDecl *td)
lldb::Format GetFormat(lldb::opaque_compiler_type_t type) override
bool IsCStringType(lldb::opaque_compiler_type_t type, uint32_t &length) override
bool CanPassInRegisters(const CompilerType &type) override
static clang::DeclContext * GetDeclContextForType(clang::QualType type)
bool IsFloatingPointType(lldb::opaque_compiler_type_t type, uint32_t &count, bool &is_complex) override
bool IsEnumerationType(lldb::opaque_compiler_type_t type, bool &is_signed) override
bool IsTemplateType(lldb::opaque_compiler_type_t type) override
CompilerType GetTypeTemplateArgument(lldb::opaque_compiler_type_t type, size_t idx, bool expand_pack) override
llvm::DenseMap< const clang::CXXRecordDecl *, clang::AccessSpecifier > CXXRecordDeclAccessMap
static bool IsCXXClassType(const CompilerType &type)
bool IsIntegerType(lldb::opaque_compiler_type_t type, bool &is_signed) override
void SetCXXRecordDeclAccess(const clang::CXXRecordDecl *object, clang::AccessSpecifier access)
static bool AddObjCClassProperty(const CompilerType &type, const char *property_name, const CompilerType &property_compiler_type, clang::ObjCIvarDecl *ivar_decl, const char *property_setter_name, const char *property_getter_name, uint32_t property_attributes, ClangASTMetadata *metadata)
uint32_t GetNumFields(lldb::opaque_compiler_type_t type) override
static bool IsOperator(llvm::StringRef name, clang::OverloadedOperatorKind &op_kind)
bool IsCharType(lldb::opaque_compiler_type_t type) override
static void SetFloatingInitializerForVariable(clang::VarDecl *var, const llvm::APFloat &init_value)
Initializes a variable with a floating point value.
uint32_t GetTypeInfo(lldb::opaque_compiler_type_t type, CompilerType *pointee_or_element_compiler_type) override
CompilerType GetType(clang::QualType qt)
Creates a CompilerType from the given QualType with the current TypeSystemClang instance as the Compi...
static clang::TagDecl * GetAsTagDecl(const CompilerType &type)
ConstString GetDisplayTypeName(lldb::opaque_compiler_type_t type) override
bool TransferBaseClasses(lldb::opaque_compiler_type_t type, std::vector< std::unique_ptr< clang::CXXBaseSpecifier > > bases)
bool IsBeingDefined(lldb::opaque_compiler_type_t type) override
ConstString DeclContextGetScopeQualifiedName(void *opaque_decl_ctx) override
std::unique_ptr< clang::IdentifierTable > m_identifier_table_up
static void SetIntegerInitializerForVariable(clang::VarDecl *var, const llvm::APInt &init_value)
Initializes a variable with an integer value.
bool IsPolymorphicClass(lldb::opaque_compiler_type_t type) override
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) override
bool LayoutRecordType(const clang::RecordDecl *record_decl, uint64_t &size, uint64_t &alignment, llvm::DenseMap< const clang::FieldDecl *, uint64_t > &field_offsets, llvm::DenseMap< const clang::CXXRecordDecl *, clang::CharUnits > &base_offsets, llvm::DenseMap< const clang::CXXRecordDecl *, clang::CharUnits > &vbase_offsets)
bool IsScopedEnumerationType(lldb::opaque_compiler_type_t type) override
std::unique_ptr< clang::SourceManager > m_source_manager_up
bool IsVoidType(lldb::opaque_compiler_type_t type) override
static void SetIsPacked(const CompilerType &type)
void ForEachEnumerator(lldb::opaque_compiler_type_t type, std::function< bool(const CompilerType &integer_type, ConstString name, const llvm::APSInt &value)> const &callback) override
clang::AccessSpecifier GetCXXRecordDeclAccess(const clang::CXXRecordDecl *object)
CompilerType CreateClassTemplateSpecializationType(clang::ClassTemplateSpecializationDecl *class_template_specialization_decl)
static bool classof(const TypeSystem *ts)
bool IsPointerType(lldb::opaque_compiler_type_t type, CompilerType *pointee_type) override
void DumpValue(lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx, 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, bool show_types, bool show_summary, bool verbose, uint32_t depth) override
void CreateFunctionTemplateSpecializationInfo(clang::FunctionDecl *func_decl, clang::FunctionTemplateDecl *Template, const TemplateParameterInfos &infos)
void(* CompleteObjCInterfaceDeclCallback)(void *baton, clang::ObjCInterfaceDecl *)
llvm::StringRef getDisplayName() const
Returns the display name of this TypeSystemClang that indicates what purpose it serves in LLDB.
CompilerType GetRValueReferenceType(lldb::opaque_compiler_type_t type) override
llvm::StringRef GetPluginName() override
CompilerDecl GetCompilerDecl(clang::Decl *decl)
Creates a CompilerDecl from the given Decl with the current TypeSystemClang instance as its typesyste...
CompilerType GetPointeeType(lldb::opaque_compiler_type_t type) override
bool GetCompleteType(lldb::opaque_compiler_type_t type) override
bool IsBlockPointerType(lldb::opaque_compiler_type_t type, CompilerType *function_pointer_type_ptr) override
bool IsConst(lldb::opaque_compiler_type_t type) override
static clang::AccessSpecifier UnifyAccessSpecifiers(clang::AccessSpecifier lhs, clang::AccessSpecifier rhs)
std::unique_ptr< clang::CXXBaseSpecifier > CreateBaseClassSpecifier(lldb::opaque_compiler_type_t type, lldb::AccessType access, bool is_virtual, bool base_of_class)
CompilerType GetEnumerationIntegerType(lldb::opaque_compiler_type_t type) override
std::vector< CompilerDecl > DeclContextFindDeclByName(void *opaque_decl_ctx, ConstString name, const bool ignore_using_decls) override
uint32_t GetPointerByteSize() override
bool IsCompleteType(lldb::opaque_compiler_type_t type) override
bool isA(const void *ClassID) const override
void Dump(llvm::raw_ostream &output) override
CompilerType GetIntTypeFromBitSize(size_t bit_size, bool is_signed)
clang::MangleContext * getMangleContext()
void CompleteObjCInterfaceDecl(clang::ObjCInterfaceDecl *)
CompilerType GetTypeForIdentifier(ConstString type_name, clang::DeclContext *decl_context=nullptr)
std::string PrintTemplateParams(const TemplateParameterInfos &template_param_infos)
Return the template parameters (including surrounding <>) in string form.
static void DumpDeclContextHiearchy(clang::DeclContext *decl_ctx)
TypeSystemClang(llvm::StringRef name, clang::ASTContext &existing_ctxt)
Constructs a TypeSystemClang that uses an existing ASTContext internally.
CompilerDeclContext CreateDeclContext(clang::DeclContext *ctx)
Creates a CompilerDeclContext from the given DeclContext with the current TypeSystemClang instance as...
CompilerType GetTypeForFormatters(void *type) override
void SetMetadataAsUserID(const clang::Decl *decl, lldb::user_id_t user_id)
bool IsRuntimeGeneratedType(lldb::opaque_compiler_type_t type) override
const TypeSystemClang & operator=(const TypeSystemClang &)
static LanguageSet GetSupportedLanguagesForExpressions()
CompilerType GetTypedefedType(lldb::opaque_compiler_type_t type) override
std::unique_ptr< clang::SelectorTable > m_selector_table_up
PDBASTParser * GetPDBParser() override
std::optional< CompilerType::IntegralTemplateArgument > GetIntegralTemplateArgument(lldb::opaque_compiler_type_t type, size_t idx, bool expand_pack) override
bool DeclContextIsClassMethod(void *opaque_decl_ctx) override
CompilerType GetTypeForDecl(clang::ObjCInterfaceDecl *objc_decl)
void SetTargetTriple(llvm::StringRef target_triple)
CompilerType GetVirtualBaseClassAtIndex(lldb::opaque_compiler_type_t type, size_t idx, uint32_t *bit_offset_ptr) override
static bool CheckOverloadedOperatorKindParameterCount(bool is_method, clang::OverloadedOperatorKind op_kind, uint32_t num_params)
clang::DeclarationName GetDeclarationName(llvm::StringRef name, const CompilerType &function_clang_type)
DeclMetadataMap m_decl_metadata
Maps Decls to their associated ClangASTMetadata.
static clang::CXXMethodDecl * DeclContextGetAsCXXMethodDecl(const CompilerDeclContext &dc)
CompilerType GetFullyUnqualifiedType(lldb::opaque_compiler_type_t type) override
uint32_t CountDeclLevels(clang::DeclContext *frame_decl_ctx, clang::DeclContext *child_decl_ctx, ConstString *child_name=nullptr, CompilerType *child_type=nullptr)
static clang::QualType GetQualType(lldb::opaque_compiler_type_t type)
clang::PrintingPolicy GetTypePrintingPolicy()
Returns the PrintingPolicy used when generating the internal type names.
uint32_t GetNumVirtualBaseClasses(lldb::opaque_compiler_type_t type) override
static clang::RecordDecl * GetAsRecordDecl(const CompilerType &type)
CompilerType GetPointerSizedIntType(bool is_signed)
clang::FunctionDecl * CreateFunctionDeclaration(clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, llvm::StringRef name, const CompilerType &function_Type, clang::StorageClass storage, bool is_inline)
uint32_t GetNumBaseClasses(const clang::CXXRecordDecl *cxx_record_decl, bool omit_empty_base_classes)
lldb::LanguageType DeclContextGetLanguage(void *opaque_decl_ctx) override
std::unique_ptr< DWARFASTParserClang > m_dwarf_ast_parser_up
CompilerType GetBuiltinTypeForDWARFEncodingAndBitSize(llvm::StringRef type_name, uint32_t dw_ate, uint32_t bit_size)
bool IsFunctionPointerType(lldb::opaque_compiler_type_t type) override
int GetFunctionArgumentCount(lldb::opaque_compiler_type_t type) override
static void BuildIndirectFields(const CompilerType &type)
std::unique_ptr< clang::FileManager > m_file_manager_up
uint32_t GetIndexForRecordBase(const clang::RecordDecl *record_decl, const clang::CXXBaseSpecifier *base_spec, bool omit_empty_base_classes)
bool IsAnonymousType(lldb::opaque_compiler_type_t type) override
bool Verify(lldb::opaque_compiler_type_t type) override
Verify the integrity of the type to catch CompilerTypes that mix and match invalid TypeSystem/Opaque ...
void(* CompleteTagDeclCallback)(void *baton, clang::TagDecl *)
size_t GetNumberOfFunctionArguments(lldb::opaque_compiler_type_t type) override
void AddMethodOverridesForCXXRecordType(lldb::opaque_compiler_type_t type)
CompilerType CreateBlockPointerType(const CompilerType &function_type)
lldb::LanguageType GetMinimumLanguage(lldb::opaque_compiler_type_t type) override
bool FieldIsBitfield(clang::FieldDecl *field, uint32_t &bitfield_bit_size)
clang::ClassTemplateSpecializationDecl * CreateClassTemplateSpecializationDecl(clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, clang::ClassTemplateDecl *class_template_decl, int kind, const TemplateParameterInfos &infos)
clang::SourceManager * GetSourceMgr() const
std::unique_ptr< clang::HeaderSearch > m_header_search_up
void Finalize() override
Free up any resources associated with this TypeSystem.
static lldb::BasicType GetBasicTypeEnumeration(ConstString name)
clang::CXXMethodDecl * AddMethodToCXXRecordType(lldb::opaque_compiler_type_t type, llvm::StringRef name, const char *mangled_name, const CompilerType &method_type, lldb::AccessType access, bool is_virtual, bool is_static, bool is_inline, bool is_explicit, bool is_attr_used, bool is_artificial)
static clang::ASTContext * DeclContextGetTypeSystemClang(const CompilerDeclContext &dc)
uint32_t IsHomogeneousAggregate(lldb::opaque_compiler_type_t type, CompilerType *base_type_ptr) override
clang::EnumConstantDecl * AddEnumerationValueToEnumerationType(const CompilerType &enum_type, const Declaration &decl, const char *name, int64_t enum_value, uint32_t enum_value_bit_size)
LLVM_DUMP_METHOD void dump(lldb::opaque_compiler_type_t type) const override
Convenience LLVM-style dump method for use in the debugger only.
CXXRecordDeclAccessMap m_cxx_record_decl_access
Maps CXXRecordDecl to their most recent added method/field's AccessSpecifier.
static CompilerType GetFloatTypeFromBitSize(clang::ASTContext *ast, size_t bit_size)
clang::NamespaceDecl * GetUniqueNamespaceDeclaration(const char *name, clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, bool is_inline=false)
std::unique_ptr< clang::ASTContext > m_ast_up
static clang::QualType GetCanonicalQualType(lldb::opaque_compiler_type_t type)
CompilerType DeclGetFunctionReturnType(void *opaque_decl) override
static bool IsEnumType(lldb::opaque_compiler_type_t type)
std::unique_ptr< npdb::PdbAstBuilder > m_native_pdb_ast_parser_up
static clang::CXXRecordDecl * GetAsCXXRecordDecl(lldb::opaque_compiler_type_t type)
static bool SetObjCSuperClass(const CompilerType &type, const CompilerType &superclass_compiler_type)
clang::UsingDirectiveDecl * CreateUsingDirectiveDeclaration(clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, clang::NamespaceDecl *ns_decl)
static lldb::opaque_compiler_type_t GetOpaqueCompilerType(clang::ASTContext *ast, lldb::BasicType basic_type)
bool IsArrayType(lldb::opaque_compiler_type_t type, CompilerType *element_type, uint64_t *size, bool *is_incomplete) override
void DumpFromSymbolFile(Stream &s, llvm::StringRef symbol_name)
Dump clang AST types from the symbol file.
CompilerType AddConstModifier(lldb::opaque_compiler_type_t type) override
static void DumpDeclHiearchy(clang::Decl *decl)
static clang::ObjCMethodDecl * DeclContextGetAsObjCMethodDecl(const CompilerDeclContext &dc)
static clang::FunctionDecl * DeclContextGetAsFunctionDecl(const CompilerDeclContext &dc)
bool IsScalarType(lldb::opaque_compiler_type_t type) override
CompilerType GetOrCreateStructForIdentifier(ConstString type_name, const std::initializer_list< std::pair< const char *, CompilerType > > &type_fields, bool packed=false)
std::shared_ptr< clang::TargetOptions > m_target_options_rp
lldb::TypeClass GetTypeClass(lldb::opaque_compiler_type_t type) override
static bool IsClassType(lldb::opaque_compiler_type_t type)
bool IsDefined(lldb::opaque_compiler_type_t type) override
static bool IsObjCClassType(const CompilerType &type)
TypeMetadataMap m_type_metadata
Maps Types to their associated ClangASTMetadata.
clang::ASTContext & getASTContext()
Returns the clang::ASTContext instance managed by this TypeSystemClang.
const llvm::fltSemantics & GetFloatTypeSemantics(size_t byte_size) override
CompilerType GetCanonicalType(lldb::opaque_compiler_type_t type) override
bool RecordHasFields(const clang::RecordDecl *record_decl)
static clang::ObjCMethodDecl * AddMethodToObjCObjectType(const CompilerType &type, const char *name, const CompilerType &method_compiler_type, lldb::AccessType access, bool is_artificial, bool is_variadic, bool is_objc_direct_call)
CompilerType GetFunctionArgumentAtIndex(lldb::opaque_compiler_type_t type, const size_t index) override
static bool CompleteTagDeclarationDefinition(const CompilerType &type)
unsigned GetTypeQualifiers(lldb::opaque_compiler_type_t type) override
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) override
CompilerDeclContext DeclGetDeclContext(void *opaque_decl) override
bool DeclContextIsContainedInLookup(void *opaque_decl_ctx, void *other_opaque_decl_ctx) override
static bool SetHasExternalStorage(lldb::opaque_compiler_type_t type, bool has_extern)
CompilerType CreateEnumerationType(llvm::StringRef name, clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, const Declaration &decl, const CompilerType &integer_qual_type, bool is_scoped)
clang::ParmVarDecl * CreateParameterDeclaration(clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, const char *name, const CompilerType &param_type, int storage, bool add_decl=false)
void DumpTypeDescription(lldb::opaque_compiler_type_t type, lldb::DescriptionLevel level=lldb::eDescriptionLevelFull) override
Dump the type to stdout.
CompilerType GetFunctionArgumentTypeAtIndex(lldb::opaque_compiler_type_t type, size_t idx) override
static clang::NamespaceDecl * DeclContextGetAsNamespaceDecl(const CompilerDeclContext &dc)
npdb::PdbAstBuilder * GetNativePDBParser() override
std::unique_ptr< clang::DiagnosticConsumer > m_diagnostic_consumer_up
CompilerType GetTypeForDecl(clang::TagDecl *decl)
CompilerType CreateArrayType(const CompilerType &element_type, size_t element_count, bool is_vector)
CompilerType GetTypeForDecl(clang::NamedDecl *decl)
CompilerType GetDirectBaseClassAtIndex(lldb::opaque_compiler_type_t type, size_t idx, uint32_t *bit_offset_ptr) override
ClangASTMetadata * GetMetadata(const clang::Decl *object)
CompilerType GetArrayElementType(lldb::opaque_compiler_type_t type, ExecutionContextScope *exe_scope) override
static clang::DeclContext * DeclContextGetAsDeclContext(const CompilerDeclContext &dc)
lldb::Encoding GetEncoding(lldb::opaque_compiler_type_t type, uint64_t &count) override
bool IsTypedefType(lldb::opaque_compiler_type_t type) override
CompilerType GetPointerType(lldb::opaque_compiler_type_t type) override
std::optional< size_t > GetTypeBitAlign(lldb::opaque_compiler_type_t type, ExecutionContextScope *exe_scope) override
CompilerType CreateStructForIdentifier(ConstString type_name, const std::initializer_list< std::pair< const char *, CompilerType > > &type_fields, bool packed=false)
std::unique_ptr< clang::Builtin::Context > m_builtins_up
CompilerType GetBuiltinTypeByName(ConstString name) override
bool GetCompleteDecl(clang::Decl *decl)
static bool StartTagDeclarationDefinition(const CompilerType &type)
uint32_t GetIndexForRecordChild(const clang::RecordDecl *record_decl, clang::NamedDecl *canonical_decl, bool omit_empty_base_classes)
bool IsPossibleDynamicType(lldb::opaque_compiler_type_t type, CompilerType *target_type, bool check_cplusplus, bool check_objc) override
static ClangASTMetadata * DeclContextGetMetaData(const CompilerDeclContext &dc, const clang::Decl *object)
static llvm::StringRef GetPluginNameStatic()
clang::Sema * m_sema
The sema associated that is currently used to build this ASTContext.
size_t GetNumMemberFunctions(lldb::opaque_compiler_type_t type) override
clang::LangOptions * GetLangOpts() const
static clang::VarDecl * AddVariableToRecordType(const CompilerType &type, llvm::StringRef name, const CompilerType &var_type, lldb::AccessType access)
CompilerType GetBasicTypeFromAST(lldb::BasicType basic_type) override
const clang::ClassTemplateSpecializationDecl * GetAsTemplateSpecialization(lldb::opaque_compiler_type_t type)
std::unique_ptr< clang::MangleContext > m_mangle_ctx_up
TypeMemberFunctionImpl GetMemberFunctionAtIndex(lldb::opaque_compiler_type_t type, size_t idx) override
bool IsTypeImpl(lldb::opaque_compiler_type_t type, llvm::function_ref< bool(clang::QualType)> predicate) const
size_t DeclGetFunctionNumArguments(void *opaque_decl) override
CompilerType CreateFunctionType(const CompilerType &result_type, const CompilerType *args, unsigned num_args, bool is_variadic, unsigned type_quals, clang::CallingConv cc=clang::CC_C, clang::RefQualifierKind ref_qual=clang::RQ_None)
CompilerType GetAtomicType(lldb::opaque_compiler_type_t type) override
std::unique_ptr< PDBASTParser > m_pdb_ast_parser_up
std::unique_ptr< clang::DiagnosticsEngine > m_diagnostics_engine_up
static std::optional< std::string > GetCXXClassName(const CompilerType &type)
static void DumpTypeName(const CompilerType &type)
DWARFASTParser * GetDWARFParser() override
CompilerType DeclGetFunctionArgumentType(void *opaque_decl, size_t arg_idx) override
bool IsPointerOrReferenceType(lldb::opaque_compiler_type_t type, CompilerType *pointee_type) override
static clang::EnumDecl * GetAsEnumDecl(const CompilerType &type)
CompilerType AddVolatileModifier(lldb::opaque_compiler_type_t type) override
std::unique_ptr< clang::ModuleMap > m_module_map_up
CompilerType CreateObjCClass(llvm::StringRef name, clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, bool isForwardDecl, bool isInternal, ClangASTMetadata *metadata=nullptr)
void SetFunctionParameters(clang::FunctionDecl *function_decl, llvm::ArrayRef< clang::ParmVarDecl * > params)
static bool IsObjCObjectOrInterfaceType(const CompilerType &type)
CompilerType CreateRecordType(clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, lldb::AccessType access_type, llvm::StringRef name, int kind, lldb::LanguageType language, ClangASTMetadata *metadata=nullptr, bool exports_symbols=false)
static void RequireCompleteType(CompilerType type)
Complete a type from debug info, or mark it as forcefully completed if there is no definition of the ...
CompilerType CreateTypedef(lldb::opaque_compiler_type_t type, const char *name, const CompilerDeclContext &decl_ctx, uint32_t opaque_payload) override
Using the current type, create a new typedef to that type using "typedef_name" as the name and "decl_...
llvm::DenseMap< const clang::Type *, ClangASTMetadata > TypeMetadataMap
CompilerType AddRestrictModifier(lldb::opaque_compiler_type_t type) override
clang::TemplateTemplateParmDecl * CreateTemplateTemplateParmDecl(const char *template_name)
lldb::TemplateArgumentKind GetTemplateArgumentKind(lldb::opaque_compiler_type_t type, size_t idx, bool expand_pack) override
clang::ClassTemplateDecl * ParseClassTemplateDecl(clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, lldb::AccessType access_type, const char *parent_name, int tag_decl_kind, const TypeSystemClang::TemplateParameterInfos &template_param_infos)
static CompilerType CreateMemberPointerType(const CompilerType &type, const CompilerType &pointee_type)
void CreateASTContext()
Creates the internal ASTContext.
CompilerType GetCStringType(bool is_const)
bool IsAggregateType(lldb::opaque_compiler_type_t type) override
uint32_t GetIndexOfChildWithName(lldb::opaque_compiler_type_t type, llvm::StringRef name, bool omit_empty_base_classes) override
static bool IsObjCObjectPointerType(const CompilerType &type, CompilerType *target_type=nullptr)
bool IsVectorType(lldb::opaque_compiler_type_t type, CompilerType *element_type, uint64_t *size) override
static bool DeclsAreEquivalent(clang::Decl *lhs_decl, clang::Decl *rhs_decl)
static lldb::BasicType GetBasicTypeEnumeration(lldb::opaque_compiler_type_t type, ConstString name)
static LanguageSet GetSupportedLanguagesForTypes()
clang::VarDecl * CreateVariableDeclaration(clang::DeclContext *decl_context, OptionalClangModuleID owning_module, const char *name, clang::QualType type)
clang::BlockDecl * CreateBlockDeclaration(clang::DeclContext *ctx, OptionalClangModuleID owning_module)
llvm::DenseMap< const clang::Decl *, ClangASTMetadata > DeclMetadataMap
ConstString DeclContextGetName(void *opaque_decl_ctx) override
size_t GetNumTemplateArguments(lldb::opaque_compiler_type_t type, bool expand_pack) override
ConstString DeclGetName(void *opaque_decl) override
Interface for representing a type system.
Definition: TypeSystem.h:77
virtual bool isA(const void *ClassID) const =0
uint32_t Payload
Definition: Type.h:203
Encapsulates a one-time expression for use in lldb.
A class that represents a running process on the host machine.
Definition: SBAttachInfo.h:14
void * opaque_compiler_type_t
Definition: lldb-types.h:86
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:83
LanguageType
Programming language type.
Encoding
Register encoding definitions.
uint64_t user_id_t
Definition: lldb-types.h:80
A SmallBitVector that represents a set of source languages (lldb::LanguageType).
Definition: TypeSystem.h:45