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 <stdint.h>
13 
14 #include <functional>
15 #include <initializer_list>
16 #include <map>
17 #include <memory>
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/Basic/TargetInfo.h"
27 #include "llvm/ADT/APSInt.h"
28 #include "llvm/ADT/SmallVector.h"
29 
33 #include "lldb/Symbol/TypeSystem.h"
34 #include "lldb/Target/Target.h"
36 #include "lldb/Utility/Flags.h"
37 #include "lldb/Utility/Log.h"
38 #include "lldb/Utility/Logging.h"
39 #include "lldb/lldb-enumerations.h"
40 
42 class PDBASTParser;
43 
44 namespace clang {
45 class FileManager;
46 class HeaderSearch;
47 class ModuleMap;
48 } // namespace clang
49 
50 namespace lldb_private {
51 
52 class ClangASTMetadata;
53 class ClangASTSource;
54 class Declaration;
55 
56 /// A Clang module ID.
58  unsigned m_id = 0;
59 
60 public:
61  OptionalClangModuleID() = default;
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 
76 public:
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).
106 class TypeSystemClang : public TypeSystem {
107  // LLVM RTTI support
108  static char ID;
109 
110 public:
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  ConstString GetPluginName() override;
142 
143  uint32_t GetPluginVersion() override;
144 
146 
147  static lldb::TypeSystemSP CreateInstance(lldb::LanguageType language,
148  Module *module, Target *target);
149 
152 
153  static void Initialize();
154 
155  static void Terminate();
156 
157  static TypeSystemClang *GetASTContext(clang::ASTContext *ast_ctx);
158 
159  /// Returns the display name of this TypeSystemClang that indicates what
160  /// purpose it serves in LLDB. Used for example in logs.
161  llvm::StringRef getDisplayName() const { return m_display_name; }
162 
163  /// Returns the clang::ASTContext instance managed by this TypeSystemClang.
164  clang::ASTContext &getASTContext();
165 
166  clang::MangleContext *getMangleContext();
167 
168  std::shared_ptr<clang::TargetOptions> &getTargetOptions();
169 
170  clang::TargetInfo *getTargetInfo();
171 
172  void setSema(clang::Sema *s);
173  clang::Sema *getSema() { return m_sema; }
174 
175  const char *GetTargetTriple();
176 
177  void SetExternalSource(
178  llvm::IntrusiveRefCntPtr<clang::ExternalASTSource> &ast_source_up);
179 
180  bool GetCompleteDecl(clang::Decl *decl) {
182  }
183 
184  static void DumpDeclHiearchy(clang::Decl *decl);
185 
186  static void DumpDeclContextHiearchy(clang::DeclContext *decl_ctx);
187 
188  static bool DeclsAreEquivalent(clang::Decl *lhs_decl, clang::Decl *rhs_decl);
189 
190  static bool GetCompleteDecl(clang::ASTContext *ast, clang::Decl *decl);
191 
192  void SetMetadataAsUserID(const clang::Decl *decl, lldb::user_id_t user_id);
193  void SetMetadataAsUserID(const clang::Type *type, lldb::user_id_t user_id);
194 
195  void SetMetadata(const clang::Decl *object, ClangASTMetadata &meta_data);
196 
197  void SetMetadata(const clang::Type *object, ClangASTMetadata &meta_data);
198  ClangASTMetadata *GetMetadata(const clang::Decl *object);
199  ClangASTMetadata *GetMetadata(const clang::Type *object);
200 
201  // Basic Types
203  size_t bit_size) override;
204 
206 
208 
210  GetBuiltinTypeForDWARFEncodingAndBitSize(llvm::StringRef type_name,
211  uint32_t dw_ate, uint32_t bit_size);
212 
213  CompilerType GetCStringType(bool is_const);
214 
215  static clang::DeclContext *GetDeclContextForType(clang::QualType type);
216 
217  static clang::DeclContext *GetDeclContextForType(const CompilerType &type);
218 
219  uint32_t GetPointerByteSize() override;
220 
221  clang::TranslationUnitDecl *GetTranslationUnitDecl() {
222  return getASTContext().getTranslationUnitDecl();
223  }
224 
225  static bool AreTypesSame(CompilerType type1, CompilerType type2,
226  bool ignore_qualifiers = false);
227 
228  /// Creates a CompilerType form the given QualType with the current
229  /// TypeSystemClang instance as the CompilerType's typesystem.
230  /// \param qt The QualType for a type that belongs to the ASTContext of this
231  /// TypeSystemClang.
232  /// \return The CompilerType representing the given QualType. If the
233  /// QualType's type pointer is a nullptr then the function returns an
234  /// invalid CompilerType.
235  CompilerType GetType(clang::QualType qt) {
236  if (qt.getTypePtrOrNull() == nullptr)
237  return CompilerType();
238  // Check that the type actually belongs to this TypeSystemClang.
239  assert(qt->getAsTagDecl() == nullptr ||
240  &qt->getAsTagDecl()->getASTContext() == &getASTContext());
241  return CompilerType(this, qt.getAsOpaquePtr());
242  }
243 
244  CompilerType GetTypeForDecl(clang::NamedDecl *decl);
245 
246  CompilerType GetTypeForDecl(clang::TagDecl *decl);
247 
248  CompilerType GetTypeForDecl(clang::ObjCInterfaceDecl *objc_decl);
249 
250  template <typename RecordDeclType>
253  clang::DeclContext *decl_context = nullptr) {
254  CompilerType compiler_type;
255 
256  if (type_name.GetLength()) {
257  clang::ASTContext &ast = getASTContext();
258  if (!decl_context)
259  decl_context = ast.getTranslationUnitDecl();
260 
261  clang::IdentifierInfo &myIdent = ast.Idents.get(type_name.GetCString());
262  clang::DeclarationName myName =
263  ast.DeclarationNames.getIdentifier(&myIdent);
264 
265  clang::DeclContext::lookup_result result = decl_context->lookup(myName);
266 
267  if (!result.empty()) {
268  clang::NamedDecl *named_decl = result[0];
269  if (const RecordDeclType *record_decl =
270  llvm::dyn_cast<RecordDeclType>(named_decl))
271  compiler_type.SetCompilerType(
272  this, clang::QualType(record_decl->getTypeForDecl(), 0)
273  .getAsOpaquePtr());
274  }
275  }
276 
277  return compiler_type;
278  }
279 
281  ConstString type_name,
282  const std::initializer_list<std::pair<const char *, CompilerType>>
283  &type_fields,
284  bool packed = false);
285 
287  ConstString type_name,
288  const std::initializer_list<std::pair<const char *, CompilerType>>
289  &type_fields,
290  bool packed = false);
291 
292  static bool IsOperator(llvm::StringRef name,
293  clang::OverloadedOperatorKind &op_kind);
294 
295  // Structure, Unions, Classes
296 
297  static clang::AccessSpecifier
299 
300  static clang::AccessSpecifier
301  UnifyAccessSpecifiers(clang::AccessSpecifier lhs, clang::AccessSpecifier rhs);
302 
303  static uint32_t GetNumBaseClasses(const clang::CXXRecordDecl *cxx_record_decl,
304  bool omit_empty_base_classes);
305 
306  /// Synthesize a clang::Module and return its ID or a default-constructed ID.
307  OptionalClangModuleID GetOrCreateClangModule(llvm::StringRef name,
308  OptionalClangModuleID parent,
309  bool is_framework = false,
310  bool is_explicit = false);
311 
312  CompilerType CreateRecordType(clang::DeclContext *decl_ctx,
313  OptionalClangModuleID owning_module,
314  lldb::AccessType access_type,
315  llvm::StringRef name, int kind,
316  lldb::LanguageType language,
317  ClangASTMetadata *metadata = nullptr,
318  bool exports_symbols = false);
319 
321  public:
322  bool IsValid() const {
323  // Having a pack name but no packed args doesn't make sense, so mark
324  // these template parameters as invalid.
325  if (pack_name && !packed_args)
326  return false;
327  return args.size() == names.size() &&
328  (!packed_args || !packed_args->packed_args);
329  }
330 
331  llvm::SmallVector<const char *, 2> names;
332  llvm::SmallVector<clang::TemplateArgument, 2> args;
333 
334  const char * pack_name = nullptr;
335  std::unique_ptr<TemplateParameterInfos> packed_args;
336  };
337 
338  clang::FunctionTemplateDecl *CreateFunctionTemplateDecl(
339  clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module,
340  clang::FunctionDecl *func_decl, const TemplateParameterInfos &infos);
341 
343  clang::FunctionDecl *func_decl, clang::FunctionTemplateDecl *Template,
344  const TemplateParameterInfos &infos);
345 
346  clang::ClassTemplateDecl *
347  CreateClassTemplateDecl(clang::DeclContext *decl_ctx,
348  OptionalClangModuleID owning_module,
349  lldb::AccessType access_type, const char *class_name,
350  int kind, const TemplateParameterInfos &infos);
351 
352  clang::TemplateTemplateParmDecl *
353  CreateTemplateTemplateParmDecl(const char *template_name);
354 
355  clang::ClassTemplateSpecializationDecl *CreateClassTemplateSpecializationDecl(
356  clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module,
357  clang::ClassTemplateDecl *class_template_decl, int kind,
358  const TemplateParameterInfos &infos);
359 
361  CreateClassTemplateSpecializationType(clang::ClassTemplateSpecializationDecl *
362  class_template_specialization_decl);
363 
364  static clang::DeclContext *
365  GetAsDeclContext(clang::FunctionDecl *function_decl);
366 
368  bool is_method, clang::OverloadedOperatorKind op_kind,
369  uint32_t num_params);
370 
371  bool FieldIsBitfield(clang::FieldDecl *field, uint32_t &bitfield_bit_size);
372 
373  static bool RecordHasFields(const clang::RecordDecl *record_decl);
374 
375  CompilerType CreateObjCClass(llvm::StringRef name,
376  clang::DeclContext *decl_ctx,
377  OptionalClangModuleID owning_module,
378  bool isForwardDecl, bool isInternal,
379  ClangASTMetadata *metadata = nullptr);
380 
381  bool SetTagTypeKind(clang::QualType type, int kind) const;
382 
383  bool SetDefaultAccessForRecordFields(clang::RecordDecl *record_decl,
384  int default_accessibility,
385  int *assigned_accessibilities,
386  size_t num_assigned_accessibilities);
387 
388  // Returns a mask containing bits from the TypeSystemClang::eTypeXXX
389  // enumerations
390 
391  // Namespace Declarations
392 
393  clang::NamespaceDecl *
394  GetUniqueNamespaceDeclaration(const char *name, clang::DeclContext *decl_ctx,
395  OptionalClangModuleID owning_module,
396  bool is_inline = false);
397 
398  // Function Types
399 
400  clang::FunctionDecl *CreateFunctionDeclaration(
401  clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module,
402  llvm::StringRef name, const CompilerType &function_Type,
403  clang::StorageClass storage, bool is_inline);
404 
405  CompilerType CreateFunctionType(const CompilerType &result_type,
406  const CompilerType *args, unsigned num_args,
407  bool is_variadic, unsigned type_quals,
408  clang::CallingConv cc);
409 
411  const CompilerType *args, unsigned num_args,
412  bool is_variadic, unsigned type_quals) {
413  return CreateFunctionType(result_type, args, num_args, is_variadic,
414  type_quals, clang::CC_C);
415  }
416 
417  clang::ParmVarDecl *
418  CreateParameterDeclaration(clang::DeclContext *decl_ctx,
419  OptionalClangModuleID owning_module,
420  const char *name, const CompilerType &param_type,
421  int storage, bool add_decl = false);
422 
423  void SetFunctionParameters(clang::FunctionDecl *function_decl,
424  clang::ParmVarDecl **params, unsigned num_params);
425 
426  CompilerType CreateBlockPointerType(const CompilerType &function_type);
427 
428  // Array Types
429 
430  CompilerType CreateArrayType(const CompilerType &element_type,
431  size_t element_count, bool is_vector);
432 
433  // Enumeration Types
434  CompilerType CreateEnumerationType(const char *name,
435  clang::DeclContext *decl_ctx,
436  OptionalClangModuleID owning_module,
437  const Declaration &decl,
438  const CompilerType &integer_qual_type,
439  bool is_scoped);
440 
441  // Integer type functions
442 
443  CompilerType GetIntTypeFromBitSize(size_t bit_size, bool is_signed);
444 
445  CompilerType GetPointerSizedIntType(bool is_signed);
446 
447  // Floating point functions
448 
449  static CompilerType GetFloatTypeFromBitSize(clang::ASTContext *ast,
450  size_t bit_size);
451 
452  // TypeSystem methods
453  DWARFASTParser *GetDWARFParser() override;
454  PDBASTParser *GetPDBParser() override;
455 
456  // TypeSystemClang callbacks for external source lookups.
457  void CompleteTagDecl(clang::TagDecl *);
458 
459  void CompleteObjCInterfaceDecl(clang::ObjCInterfaceDecl *);
460 
461  bool LayoutRecordType(
462  const clang::RecordDecl *record_decl, uint64_t &size, uint64_t &alignment,
463  llvm::DenseMap<const clang::FieldDecl *, uint64_t> &field_offsets,
464  llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits>
465  &base_offsets,
466  llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits>
467  &vbase_offsets);
468 
469  /// Creates a CompilerDecl from the given Decl with the current
470  /// TypeSystemClang instance as its typesystem.
471  /// The Decl has to come from the ASTContext of this
472  /// TypeSystemClang.
473  CompilerDecl GetCompilerDecl(clang::Decl *decl) {
474  assert(&decl->getASTContext() == &getASTContext() &&
475  "CreateCompilerDecl for Decl from wrong ASTContext?");
476  return CompilerDecl(this, decl);
477  }
478 
479  // CompilerDecl override functions
480  ConstString DeclGetName(void *opaque_decl) override;
481 
482  ConstString DeclGetMangledName(void *opaque_decl) override;
483 
484  CompilerDeclContext DeclGetDeclContext(void *opaque_decl) override;
485 
486  CompilerType DeclGetFunctionReturnType(void *opaque_decl) override;
487 
488  size_t DeclGetFunctionNumArguments(void *opaque_decl) override;
489 
490  CompilerType DeclGetFunctionArgumentType(void *opaque_decl,
491  size_t arg_idx) override;
492 
493  CompilerType GetTypeForDecl(void *opaque_decl) override;
494 
495  // CompilerDeclContext override functions
496 
497  /// Creates a CompilerDeclContext from the given DeclContext
498  /// with the current TypeSystemClang instance as its typesystem.
499  /// The DeclContext has to come from the ASTContext of this
500  /// TypeSystemClang.
501  CompilerDeclContext CreateDeclContext(clang::DeclContext *ctx);
502 
503  /// Set the owning module for \p decl.
504  static void SetOwningModule(clang::Decl *decl,
505  OptionalClangModuleID owning_module);
506 
507  std::vector<CompilerDecl>
508  DeclContextFindDeclByName(void *opaque_decl_ctx, ConstString name,
509  const bool ignore_using_decls) override;
510 
511  ConstString DeclContextGetName(void *opaque_decl_ctx) override;
512 
513  ConstString DeclContextGetScopeQualifiedName(void *opaque_decl_ctx) override;
514 
515  bool DeclContextIsClassMethod(void *opaque_decl_ctx,
516  lldb::LanguageType *language_ptr,
517  bool *is_instance_method_ptr,
518  ConstString *language_object_name_ptr) override;
519 
520  bool DeclContextIsContainedInLookup(void *opaque_decl_ctx,
521  void *other_opaque_decl_ctx) override;
522 
523  // Clang specific clang::DeclContext functions
524 
525  static clang::DeclContext *
527 
528  static clang::ObjCMethodDecl *
530 
531  static clang::CXXMethodDecl *
533 
534  static clang::FunctionDecl *
536 
537  static clang::NamespaceDecl *
539 
541  const clang::Decl *object);
542 
543  static clang::ASTContext *
545 
546  // Tests
547 
548 #ifndef NDEBUG
549  bool Verify(lldb::opaque_compiler_type_t type) override;
550 #endif
551 
553  CompilerType *element_type, uint64_t *size,
554  bool *is_incomplete) override;
555 
557  CompilerType *element_type, uint64_t *size) override;
558 
559  bool IsAggregateType(lldb::opaque_compiler_type_t type) override;
560 
561  bool IsAnonymousType(lldb::opaque_compiler_type_t type) override;
562 
563  bool IsBeingDefined(lldb::opaque_compiler_type_t type) override;
564 
565  bool IsCharType(lldb::opaque_compiler_type_t type) override;
566 
567  bool IsCompleteType(lldb::opaque_compiler_type_t type) override;
568 
569  bool IsConst(lldb::opaque_compiler_type_t type) override;
570 
572  uint32_t &length) override;
573 
574  static bool IsCXXClassType(const CompilerType &type);
575 
576  bool IsDefined(lldb::opaque_compiler_type_t type) override;
577 
579  bool &is_complex) override;
580 
581  bool IsFunctionType(lldb::opaque_compiler_type_t type) override;
582 
584  CompilerType *base_type_ptr) override;
585 
586  size_t
588 
590  const size_t index) override;
591 
593 
595  CompilerType *function_pointer_type_ptr) override;
596 
598  bool &is_signed) override;
599 
601  bool &is_signed) override;
602 
604 
605  static bool IsObjCClassType(const CompilerType &type);
606 
607  static bool IsObjCClassTypeAndHasIVars(const CompilerType &type,
608  bool check_superclass);
609 
610  static bool IsObjCObjectOrInterfaceType(const CompilerType &type);
611 
612  static bool IsObjCObjectPointerType(const CompilerType &type,
613  CompilerType *target_type = nullptr);
614 
616 
617  static bool IsClassType(lldb::opaque_compiler_type_t type);
618 
619  static bool IsEnumType(lldb::opaque_compiler_type_t type);
620 
622  CompilerType *target_type, // Can pass nullptr
623  bool check_cplusplus, bool check_objc) override;
624 
626 
628  CompilerType *pointee_type) override;
629 
631  CompilerType *pointee_type) override;
632 
634  CompilerType *pointee_type, bool *is_rvalue) override;
635 
636  bool IsScalarType(lldb::opaque_compiler_type_t type) override;
637 
638  bool IsTypedefType(lldb::opaque_compiler_type_t type) override;
639 
640  bool IsVoidType(lldb::opaque_compiler_type_t type) override;
641 
642  bool CanPassInRegisters(const CompilerType &type) override;
643 
644  bool SupportsLanguage(lldb::LanguageType language) override;
645 
646  static llvm::Optional<std::string> GetCXXClassName(const CompilerType &type);
647 
648  // Type Completion
649 
650  bool GetCompleteType(lldb::opaque_compiler_type_t type) override;
651 
652  // Accessors
653 
655 
657 
659  CompilerType *pointee_or_element_compiler_type) override;
660 
663 
664  lldb::TypeClass GetTypeClass(lldb::opaque_compiler_type_t type) override;
665 
666  unsigned GetTypeQualifiers(lldb::opaque_compiler_type_t type) override;
667 
668  // Creating related types
669 
671  ExecutionContextScope *exe_scope) override;
672 
674  uint64_t size) override;
675 
677 
680 
683 
684  // Returns -1 if this isn't a function of if the function doesn't have a
685  // prototype Returns a value >= 0 if there is a prototype.
687 
689  size_t idx) override;
690 
693 
695 
698  size_t idx) override;
699 
701 
703 
705 
708 
711 
713 
715 
717 
719 
720  /// Using the current type, create a new typedef to that type using
721  /// "typedef_name" as the name and "decl_ctx" as the decl context.
722  /// \param opaque_payload is an opaque TypePayloadClang.
724  const char *name,
725  const CompilerDeclContext &decl_ctx,
726  uint32_t opaque_payload) override;
727 
728  // If the current object represents a typedef type, get the underlying type
730 
731  // Create related types using the current type's AST
732  CompilerType GetBasicTypeFromAST(lldb::BasicType basic_type) override;
733 
734  // Exploring the type
735 
736  const llvm::fltSemantics &GetFloatTypeSemantics(size_t byte_size) override;
737 
738  llvm::Optional<uint64_t> GetByteSize(lldb::opaque_compiler_type_t type,
739  ExecutionContextScope *exe_scope) {
740  if (llvm::Optional<uint64_t> bit_size = GetBitSize(type, exe_scope))
741  return (*bit_size + 7) / 8;
742  return llvm::None;
743  }
744 
745  llvm::Optional<uint64_t>
747  ExecutionContextScope *exe_scope) override;
748 
750  uint64_t &count) override;
751 
753 
754  llvm::Optional<size_t>
756  ExecutionContextScope *exe_scope) override;
757 
759  bool omit_empty_base_classes,
760  const ExecutionContext *exe_ctx) override;
761 
763 
766 
767  static lldb::BasicType
769  ConstString name);
770 
771  void ForEachEnumerator(
773  std::function<bool(const CompilerType &integer_type,
774  ConstString name,
775  const llvm::APSInt &value)> const &callback) override;
776 
778 
780  std::string &name, uint64_t *bit_offset_ptr,
781  uint32_t *bitfield_bit_size_ptr,
782  bool *is_bitfield_ptr) override;
783 
785 
787 
789  size_t idx,
790  uint32_t *bit_offset_ptr) override;
791 
793  size_t idx,
794  uint32_t *bit_offset_ptr) override;
795 
796  static uint32_t GetNumPointeeChildren(clang::QualType type);
797 
799  lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx, size_t idx,
800  bool transparent_pointers, bool omit_empty_base_classes,
801  bool ignore_array_bounds, std::string &child_name,
802  uint32_t &child_byte_size, int32_t &child_byte_offset,
803  uint32_t &child_bitfield_bit_size, uint32_t &child_bitfield_bit_offset,
804  bool &child_is_base_class, bool &child_is_deref_of_parent,
805  ValueObject *valobj, uint64_t &language_flags) override;
806 
807  // Lookup a child given a name. This function will match base class names and
808  // member member names in "clang_type" only, not descendants.
810  const char *name,
811  bool omit_empty_base_classes) override;
812 
813  // Lookup a child member given a name. This function will match member names
814  // only and will descend into "clang_type" children in search for the first
815  // member in this class, or any base class that matches "name".
816  // TODO: Return all matches for a given name by returning a
817  // vector<vector<uint32_t>>
818  // so we catch all names that match a given child name, not just the first.
819  size_t
821  const char *name, bool omit_empty_base_classes,
822  std::vector<uint32_t> &child_indexes) override;
823 
825 
828  size_t idx) override;
830  size_t idx) override;
831  llvm::Optional<CompilerType::IntegralTemplateArgument>
833  size_t idx) override;
834 
835  CompilerType GetTypeForFormatters(void *type) override;
836 
837 #define LLDB_INVALID_DECL_LEVEL UINT32_MAX
838  // LLDB_INVALID_DECL_LEVEL is returned by CountDeclLevels if child_decl_ctx
839  // could not be found in decl_ctx.
840  uint32_t CountDeclLevels(clang::DeclContext *frame_decl_ctx,
841  clang::DeclContext *child_decl_ctx,
842  ConstString *child_name = nullptr,
843  CompilerType *child_type = nullptr);
844 
845  // Modifying RecordType
846  static clang::FieldDecl *AddFieldToRecordType(const CompilerType &type,
847  llvm::StringRef name,
848  const CompilerType &field_type,
849  lldb::AccessType access,
850  uint32_t bitfield_bit_size);
851 
852  static void BuildIndirectFields(const CompilerType &type);
853 
854  static void SetIsPacked(const CompilerType &type);
855 
856  static clang::VarDecl *AddVariableToRecordType(const CompilerType &type,
857  llvm::StringRef name,
858  const CompilerType &var_type,
859  lldb::AccessType access);
860 
861  /// Initializes a variable with an integer value.
862  /// \param var The variable to initialize. Must not already have an
863  /// initializer and must have an integer or enum type.
864  /// \param init_value The integer value that the variable should be
865  /// initialized to. Has to match the bit width of the
866  /// variable type.
867  static void SetIntegerInitializerForVariable(clang::VarDecl *var,
868  const llvm::APInt &init_value);
869 
870  /// Initializes a variable with a floating point value.
871  /// \param var The variable to initialize. Must not already have an
872  /// initializer and must have a floating point type.
873  /// \param init_value The float value that the variable should be
874  /// initialized to.
875  static void
876  SetFloatingInitializerForVariable(clang::VarDecl *var,
877  const llvm::APFloat &init_value);
878 
879  clang::CXXMethodDecl *AddMethodToCXXRecordType(
880  lldb::opaque_compiler_type_t type, llvm::StringRef name,
881  const char *mangled_name, const CompilerType &method_type,
882  lldb::AccessType access, bool is_virtual, bool is_static, bool is_inline,
883  bool is_explicit, bool is_attr_used, bool is_artificial);
884 
886 
887  // C++ Base Classes
888  std::unique_ptr<clang::CXXBaseSpecifier>
890  lldb::AccessType access, bool is_virtual,
891  bool base_of_class);
892 
893  bool TransferBaseClasses(
895  std::vector<std::unique_ptr<clang::CXXBaseSpecifier>> bases);
896 
897  static bool SetObjCSuperClass(const CompilerType &type,
898  const CompilerType &superclass_compiler_type);
899 
900  static bool AddObjCClassProperty(const CompilerType &type,
901  const char *property_name,
902  const CompilerType &property_compiler_type,
903  clang::ObjCIvarDecl *ivar_decl,
904  const char *property_setter_name,
905  const char *property_getter_name,
906  uint32_t property_attributes,
907  ClangASTMetadata *metadata);
908 
909  static clang::ObjCMethodDecl *AddMethodToObjCObjectType(
910  const CompilerType &type,
911  const char *name, // the full symbol name as seen in the symbol table
912  // (lldb::opaque_compiler_type_t type, "-[NString
913  // stringWithCString:]")
914  const CompilerType &method_compiler_type, lldb::AccessType access,
915  bool is_artificial, bool is_variadic, bool is_objc_direct_call);
916 
918  bool has_extern);
919 
920  // Tag Declarations
921  static bool StartTagDeclarationDefinition(const CompilerType &type);
922 
923  static bool CompleteTagDeclarationDefinition(const CompilerType &type);
924 
925  // Modifying Enumeration types
926  clang::EnumConstantDecl *AddEnumerationValueToEnumerationType(
927  const CompilerType &enum_type, const Declaration &decl, const char *name,
928  int64_t enum_value, uint32_t enum_value_bit_size);
929  clang::EnumConstantDecl *AddEnumerationValueToEnumerationType(
930  const CompilerType &enum_type, const Declaration &decl, const char *name,
931  const llvm::APSInt &value);
932 
933  /// Returns the underlying integer type for an enum type. If the given type
934  /// is invalid or not an enum-type, the function returns an invalid
935  /// CompilerType.
936  CompilerType GetEnumerationIntegerType(CompilerType type);
937 
938  // Pointers & References
939 
940  // Call this function using the class type when you want to make a member
941  // pointer type to pointee_type.
942  static CompilerType CreateMemberPointerType(const CompilerType &type,
943  const CompilerType &pointee_type);
944 
945  // Dumping types
946 #ifndef NDEBUG
947  /// Convenience LLVM-style dump method for use in the debugger only.
948  /// In contrast to the other \p Dump() methods this directly invokes
949  /// \p clang::QualType::dump().
950  LLVM_DUMP_METHOD void dump(lldb::opaque_compiler_type_t type) const override;
951 #endif
952 
953  void Dump(Stream &s);
954 
955  /// Dump clang AST types from the symbol file.
956  ///
957  /// \param[in] s
958  /// A stream to send the dumped AST node(s) to
959  /// \param[in] symbol_name
960  /// The name of the symbol to dump, if it is empty dump all the symbols
961  void DumpFromSymbolFile(Stream &s, llvm::StringRef symbol_name);
962 
963  void DumpValue(lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx,
964  Stream *s, lldb::Format format, const DataExtractor &data,
965  lldb::offset_t data_offset, size_t data_byte_size,
966  uint32_t bitfield_bit_size, uint32_t bitfield_bit_offset,
967  bool show_types, bool show_summary, bool verbose,
968  uint32_t depth) override;
969 
970  bool DumpTypeValue(lldb::opaque_compiler_type_t type, Stream *s,
971  lldb::Format format, const DataExtractor &data,
972  lldb::offset_t data_offset, size_t data_byte_size,
973  uint32_t bitfield_bit_size, uint32_t bitfield_bit_offset,
974  ExecutionContextScope *exe_scope) override;
975 
976  void DumpSummary(lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx,
977  Stream *s, const DataExtractor &data,
978  lldb::offset_t data_offset, size_t data_byte_size) override;
979 
980  void DumpTypeDescription(
983 
984  void DumpTypeDescription(
985  lldb::opaque_compiler_type_t type, Stream *s,
987 
988  static void DumpTypeName(const CompilerType &type);
989 
990  static clang::EnumDecl *GetAsEnumDecl(const CompilerType &type);
991 
992  static clang::RecordDecl *GetAsRecordDecl(const CompilerType &type);
993 
994  static clang::TagDecl *GetAsTagDecl(const CompilerType &type);
995 
996  static clang::TypedefNameDecl *GetAsTypedefDecl(const CompilerType &type);
997 
998  static clang::CXXRecordDecl *
1000 
1001  static clang::ObjCInterfaceDecl *
1002  GetAsObjCInterfaceDecl(const CompilerType &type);
1003 
1004  clang::ClassTemplateDecl *ParseClassTemplateDecl(
1005  clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module,
1006  lldb::AccessType access_type, const char *parent_name, int tag_decl_kind,
1007  const TypeSystemClang::TemplateParameterInfos &template_param_infos);
1008 
1009  clang::BlockDecl *CreateBlockDeclaration(clang::DeclContext *ctx,
1010  OptionalClangModuleID owning_module);
1011 
1012  clang::UsingDirectiveDecl *
1013  CreateUsingDirectiveDeclaration(clang::DeclContext *decl_ctx,
1014  OptionalClangModuleID owning_module,
1015  clang::NamespaceDecl *ns_decl);
1016 
1017  clang::UsingDecl *CreateUsingDeclaration(clang::DeclContext *current_decl_ctx,
1018  OptionalClangModuleID owning_module,
1019  clang::NamedDecl *target);
1020 
1021  clang::VarDecl *CreateVariableDeclaration(clang::DeclContext *decl_context,
1022  OptionalClangModuleID owning_module,
1023  const char *name,
1024  clang::QualType type);
1025 
1027  GetOpaqueCompilerType(clang::ASTContext *ast, lldb::BasicType basic_type);
1028 
1029  static clang::QualType GetQualType(lldb::opaque_compiler_type_t type) {
1030  if (type)
1031  return clang::QualType::getFromOpaquePtr(type);
1032  return clang::QualType();
1033  }
1034 
1035  static clang::QualType
1037  if (type)
1038  return clang::QualType::getFromOpaquePtr(type).getCanonicalType();
1039  return clang::QualType();
1040  }
1041 
1042  clang::DeclarationName
1043  GetDeclarationName(llvm::StringRef name,
1044  const CompilerType &function_clang_type);
1045 
1046  clang::LangOptions *GetLangOpts() const {
1047  return m_language_options_up.get();
1048  }
1049  clang::SourceManager *GetSourceMgr() const {
1050  return m_source_manager_up.get();
1051  }
1052 
1053 private:
1054  /// Returns the PrintingPolicy used when generating the internal type names.
1055  /// These type names are mostly used for the formatter selection.
1056  clang::PrintingPolicy GetTypePrintingPolicy();
1057  /// Returns the internal type name for the given NamedDecl using the
1058  /// type printing policy.
1059  std::string GetTypeNameForDecl(const clang::NamedDecl *named_decl);
1060 
1061  const clang::ClassTemplateSpecializationDecl *
1063 
1064  // Classes that inherit from TypeSystemClang can see and modify these
1065  std::string m_target_triple;
1066  std::unique_ptr<clang::ASTContext> m_ast_up;
1067  std::unique_ptr<clang::LangOptions> m_language_options_up;
1068  std::unique_ptr<clang::FileManager> m_file_manager_up;
1069  std::unique_ptr<clang::SourceManager> m_source_manager_up;
1070  std::unique_ptr<clang::DiagnosticsEngine> m_diagnostics_engine_up;
1071  std::unique_ptr<clang::DiagnosticConsumer> m_diagnostic_consumer_up;
1072  std::shared_ptr<clang::TargetOptions> m_target_options_rp;
1073  std::unique_ptr<clang::TargetInfo> m_target_info_up;
1074  std::unique_ptr<clang::IdentifierTable> m_identifier_table_up;
1075  std::unique_ptr<clang::SelectorTable> m_selector_table_up;
1076  std::unique_ptr<clang::Builtin::Context> m_builtins_up;
1077  std::unique_ptr<clang::HeaderSearch> m_header_search_up;
1078  std::unique_ptr<clang::ModuleMap> m_module_map_up;
1079  std::unique_ptr<DWARFASTParserClang> m_dwarf_ast_parser_up;
1080  std::unique_ptr<PDBASTParser> m_pdb_ast_parser_up;
1081  std::unique_ptr<clang::MangleContext> m_mangle_ctx_up;
1083  bool m_ast_owned = false;
1084  /// A string describing what this TypeSystemClang represents (e.g.,
1085  /// AST for debug information, an expression, some other utility ClangAST).
1086  /// Useful for logging and debugging.
1087  std::string m_display_name;
1088 
1089  typedef llvm::DenseMap<const clang::Decl *, ClangASTMetadata> DeclMetadataMap;
1090  /// Maps Decls to their associated ClangASTMetadata.
1092 
1093  typedef llvm::DenseMap<const clang::Type *, ClangASTMetadata> TypeMetadataMap;
1094  /// Maps Types to their associated ClangASTMetadata.
1096 
1097  /// The sema associated that is currently used to build this ASTContext.
1098  /// May be null if we are already done parsing this ASTContext or the
1099  /// ASTContext wasn't created by parsing source code.
1100  clang::Sema *m_sema = nullptr;
1101 
1102  // For TypeSystemClang only
1105  /// Creates the internal ASTContext.
1106  void CreateASTContext();
1107  void SetTargetTriple(llvm::StringRef target_triple);
1108 };
1109 
1110 /// The TypeSystemClang instance used for the scratch ASTContext in a
1111 /// lldb::Target.
1113  /// LLVM RTTI support
1114  static char ID;
1115 
1116 public:
1117  ScratchTypeSystemClang(Target &target, llvm::Triple triple);
1118 
1119  ~ScratchTypeSystemClang() override = default;
1120 
1121  void Finalize() override;
1122 
1123  /// The different kinds of isolated ASTs within the scratch TypeSystem.
1124  ///
1125  /// These ASTs are isolated from the main scratch AST and are each
1126  /// dedicated to a special language option/feature that makes the contained
1127  /// AST nodes incompatible with other AST nodes.
1128  enum class IsolatedASTKind {
1129  /// The isolated AST for declarations/types from expressions that imported
1130  /// type information from a C++ module. The templates from a C++ module
1131  /// often conflict with the templates we generate from debug information,
1132  /// so we put these types in their own AST.
1133  CppModules
1134  };
1135 
1136  /// Alias for requesting the default scratch TypeSystemClang in GetForTarget.
1137  // This isn't constexpr as gtest/llvm::Optional comparison logic is trying
1138  // to get the address of this for pretty-printing.
1139  static const llvm::NoneType DefaultAST;
1140 
1141  /// Infers the appropriate sub-AST from Clang's LangOptions.
1142  static llvm::Optional<IsolatedASTKind>
1143  InferIsolatedASTKindFromLangOpts(const clang::LangOptions &l) {
1144  // If modules are activated we want the dedicated C++ module AST.
1145  // See IsolatedASTKind::CppModules for more info.
1146  if (l.Modules)
1148  return DefaultAST;
1149  }
1150 
1151  /// Returns the scratch TypeSystemClang for the given target.
1152  /// \param target The Target which scratch TypeSystemClang should be returned.
1153  /// \param ast_kind Allows requesting a specific sub-AST instead of the
1154  /// default scratch AST. See also `IsolatedASTKind`.
1155  /// \param create_on_demand If the scratch TypeSystemClang instance can be
1156  /// created by this call if it doesn't exist yet. If it doesn't exist yet and
1157  /// this parameter is false, this function returns a nullptr.
1158  /// \return The scratch type system of the target or a nullptr in case an
1159  /// error occurred.
1160  static TypeSystemClang *
1161  GetForTarget(Target &target,
1162  llvm::Optional<IsolatedASTKind> ast_kind = DefaultAST,
1163  bool create_on_demand = true);
1164 
1165  /// Returns the scratch TypeSystemClang for the given target. The returned
1166  /// TypeSystemClang will be the scratch AST or a sub-AST, depending on which
1167  /// fits best to the passed LangOptions.
1168  /// \param target The Target which scratch TypeSystemClang should be returned.
1169  /// \param lang_opts The LangOptions of a clang ASTContext that the caller
1170  /// wants to export type information from. This is used to
1171  /// find the best matching sub-AST that will be returned.
1173  const clang::LangOptions &lang_opts) {
1174  return GetForTarget(target, InferIsolatedASTKindFromLangOpts(lang_opts));
1175  }
1176 
1177  UserExpression *
1178  GetUserExpression(llvm::StringRef expr, llvm::StringRef prefix,
1179  lldb::LanguageType language,
1180  Expression::ResultType desired_type,
1181  const EvaluateExpressionOptions &options,
1182  ValueObject *ctx_obj) override;
1183 
1184  FunctionCaller *GetFunctionCaller(const CompilerType &return_type,
1185  const Address &function_address,
1186  const ValueList &arg_value_list,
1187  const char *name) override;
1188 
1189  std::unique_ptr<UtilityFunction>
1190  CreateUtilityFunction(std::string text, std::string name) override;
1191 
1193 
1194  /// Unregisters the given ASTContext as a source from the scratch AST (and
1195  /// all sub-ASTs).
1196  /// \see ClangASTImporter::ForgetSource
1197  void ForgetSource(clang::ASTContext *src_ctx, ClangASTImporter &importer);
1198 
1199  // llvm casting support
1200  bool isA(const void *ClassID) const override {
1201  return ClassID == &ID || TypeSystemClang::isA(ClassID);
1202  }
1203  static bool classof(const TypeSystem *ts) { return ts->isA(&ID); }
1204 
1205 private:
1206  std::unique_ptr<ClangASTSource> CreateASTSource();
1207  /// Returns the requested sub-AST.
1208  /// Will lazily create the sub-AST if it hasn't been created before.
1210 
1211  /// The target triple.
1212  /// This was potentially adjusted and might not be identical to the triple
1213  /// of `m_target_wp`.
1214  llvm::Triple m_triple;
1215  lldb::TargetWP m_target_wp;
1216  /// The persistent variables associated with this process for the expression
1217  /// parser.
1218  std::unique_ptr<ClangPersistentVariables> m_persistent_variables;
1219  /// The ExternalASTSource that performs lookups and completes minimally
1220  /// imported types.
1221  std::unique_ptr<ClangASTSource> m_scratch_ast_source_up;
1222 
1223  /// Map from IsolatedASTKind to their actual TypeSystemClang instance.
1224  /// This map is lazily filled with sub-ASTs and should be accessed via
1225  /// `GetSubAST` (which lazily fills this map).
1226  std::unordered_map<IsolatedASTKind, std::unique_ptr<TypeSystemClang>>
1228 };
1229 
1230 } // namespace lldb_private
1231 
1232 #endif // LLDB_SOURCE_PLUGINS_TYPESYSTEM_CLANG_TYPESYSTEMCLANG_H
A section + offset based address class.
Definition: Address.h:59
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:33
void SetCompilerType(TypeSystem *type_system, lldb::opaque_compiler_type_t type)
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:216
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:76
The TypeSystemClang instance used for the scratch ASTContext in a lldb::Target.
static const llvm::NoneType DefaultAST
Alias for requesting the default scratch TypeSystemClang in GetForTarget.
UserExpression * GetUserExpression(llvm::StringRef expr, llvm::StringRef prefix, lldb::LanguageType language, Expression::ResultType desired_type, const EvaluateExpressionOptions &options, ValueObject *ctx_obj) override
static TypeSystemClang * GetForTarget(Target &target, llvm::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.
static TypeSystemClang * GetForTarget(Target &target, const clang::LangOptions &lang_opts)
Returns the scratch TypeSystemClang for the given target.
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.
std::unordered_map< IsolatedASTKind, std::unique_ptr< TypeSystemClang > > m_isolated_asts
Map from IsolatedASTKind to their actual TypeSystemClang instance.
PersistentExpressionState * GetPersistentExpressionState() override
~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
static llvm::Optional< IsolatedASTKind > InferIsolatedASTKindFromLangOpts(const clang::LangOptions &l)
Infers the appropriate sub-AST from Clang's LangOptions.
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)
ScratchTypeSystemClang(Target &target, llvm::Triple triple)
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
std::unique_ptr< TemplateParameterInfos > packed_args
llvm::SmallVector< clang::TemplateArgument, 2 > args
llvm::SmallVector< const char *, 2 > names
A TypeSystem implementation based on Clang.
static clang::DeclContext * GetAsDeclContext(clang::FunctionDecl *function_decl)
llvm::Optional< uint64_t > GetBitSize(lldb::opaque_compiler_type_t type, ExecutionContextScope *exe_scope) override
static clang::TypedefNameDecl * GetAsTypedefDecl(const CompilerType &type)
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
CompilerType GetOrCreateStructForIdentifier(ConstString type_name, const std::initializer_list< std::pair< const char *, CompilerType >> &type_fields, bool packed=false)
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::string GetTypeNameForDecl(const clang::NamedDecl *named_decl)
Returns the internal type name for the given NamedDecl using the type printing policy.
std::unique_ptr< clang::LangOptions > m_language_options_up
static uint32_t GetNumPointeeChildren(clang::QualType type)
ConstString DeclGetMangledName(void *opaque_decl) override
CompilerType GetBasicType(lldb::BasicType type)
void SetExternalSource(llvm::IntrusiveRefCntPtr< clang::ExternalASTSource > &ast_source_up)
CompilerType GetTypeTemplateArgument(lldb::opaque_compiler_type_t type, size_t idx) override
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
bool TransferBaseClasses(lldb::opaque_compiler_type_t type, std::vector< std::unique_ptr< clang::CXXBaseSpecifier >> bases)
bool SupportsLanguage(lldb::LanguageType language) override
uint32_t GetNumDirectBaseClasses(lldb::opaque_compiler_type_t type) override
llvm::Optional< CompilerType::IntegralTemplateArgument > GetIntegralTemplateArgument(lldb::opaque_compiler_type_t type, size_t idx) 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(llvm::StringRef name, llvm::Triple triple)
Constructs a TypeSystemClang with an ASTContext using the given triple.
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)
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
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
const TypeSystemClang & operator=(const TypeSystemClang &)
static bool IsCXXClassType(const CompilerType &type)
bool IsIntegerType(lldb::opaque_compiler_type_t type, bool &is_signed) override
llvm::Optional< size_t > GetTypeBitAlign(lldb::opaque_compiler_type_t type, ExecutionContextScope *exe_scope) override
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 form 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 IsBeingDefined(lldb::opaque_compiler_type_t type) override
ConstString DeclContextGetScopeQualifiedName(void *opaque_decl_ctx) override
std::unique_ptr< clang::IdentifierTable > m_identifier_table_up
CompilerType CreateStructForIdentifier(ConstString type_name, const std::initializer_list< std::pair< const char *, CompilerType >> &type_fields, bool packed=false)
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)
uint32_t GetIndexOfChildWithName(lldb::opaque_compiler_type_t type, const char *name, bool omit_empty_base_classes) override
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
CompilerType CreateClassTemplateSpecializationType(clang::ClassTemplateSpecializationDecl *class_template_specialization_decl)
static bool classof(const TypeSystem *ts)
size_t GetNumTemplateArguments(lldb::opaque_compiler_type_t type) override
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
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
lldb::TemplateArgumentKind GetTemplateArgumentKind(lldb::opaque_compiler_type_t type, size_t idx) 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)
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
static LanguageSet GetSupportedLanguagesForExpressions()
CompilerType GetTypedefedType(lldb::opaque_compiler_type_t type) override
std::unique_ptr< clang::SelectorTable > m_selector_table_up
PDBASTParser * GetPDBParser() override
bool DeclContextIsClassMethod(void *opaque_decl_ctx, lldb::LanguageType *language_ptr, bool *is_instance_method_ptr, ConstString *language_object_name_ptr) 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
llvm::Optional< uint64_t > GetByteSize(lldb::opaque_compiler_type_t type, ExecutionContextScope *exe_scope)
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)
ConstString GetTypeName(lldb::opaque_compiler_type_t type) override
clang::FunctionDecl * CreateFunctionDeclaration(clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, llvm::StringRef name, const CompilerType &function_Type, clang::StorageClass storage, bool is_inline)
static uint32_t GetNumBaseClasses(const clang::CXXRecordDecl *cxx_record_decl, bool omit_empty_base_classes)
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
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)
std::unique_ptr< clang::HeaderSearch > m_header_search_up
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)
bool SetDefaultAccessForRecordFields(clang::RecordDecl *record_decl, int default_accessibility, int *assigned_accessibilities, size_t num_assigned_accessibilities)
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.
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
CompilerType CreateFunctionType(const CompilerType &result_type, const CompilerType *args, unsigned num_args, bool is_variadic, unsigned type_quals, clang::CallingConv cc)
static bool IsEnumType(lldb::opaque_compiler_type_t type)
static llvm::Optional< std::string > GetCXXClassName(const CompilerType &type)
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)
uint32_t GetPluginVersion() override
bool IsScalarType(lldb::opaque_compiler_type_t type) override
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
static 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
CompilerType CreateFunctionType(const CompilerType &result_type, const CompilerType *args, unsigned num_args, bool is_variadic, unsigned type_quals)
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
void SetFunctionParameters(clang::FunctionDecl *function_decl, clang::ParmVarDecl **params, unsigned num_params)
static bool SetHasExternalStorage(lldb::opaque_compiler_type_t type, bool has_extern)
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)
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
bool SetTagTypeKind(clang::QualType type, int kind) const
clang::ClassTemplateDecl * CreateClassTemplateDecl(clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, lldb::AccessType access_type, const char *class_name, int kind, const TemplateParameterInfos &infos)
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::unique_ptr< clang::Builtin::Context > m_builtins_up
CompilerType GetBuiltinTypeByName(ConstString name) override
ConstString GetPluginName() override
bool GetCompleteDecl(clang::Decl *decl)
static bool StartTagDeclarationDefinition(const CompilerType &type)
CompilerType CreateEnumerationType(const char *name, clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, const Declaration &decl, const CompilerType &integer_qual_type, bool is_scoped)
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)
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
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
clang::SourceManager * GetSourceMgr() const
size_t DeclGetFunctionNumArguments(void *opaque_decl) override
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 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)
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)
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
clang::TranslationUnitDecl * GetTranslationUnitDecl()
CompilerType AddRestrictModifier(lldb::opaque_compiler_type_t type) override
clang::TemplateTemplateParmDecl * CreateTemplateTemplateParmDecl(const char *template_name)
static ConstString GetPluginNameStatic()
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
size_t GetIndexOfChildMemberWithName(lldb::opaque_compiler_type_t type, const char *name, bool omit_empty_base_classes, std::vector< uint32_t > &child_indexes) 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
clang::LangOptions * GetLangOpts() const
ConstString DeclContextGetName(void *opaque_decl_ctx) override
ConstString DeclGetName(void *opaque_decl) override
Interface for representing a type system.
Definition: TypeSystem.h:71
virtual bool isA(const void *ClassID) const =0
uint32_t Payload
Definition: Type.h:208
Encapsulates a one-time expression for use in lldb.
A class that represents a running process on the host machine.
void * opaque_compiler_type_t
Definition: lldb-types.h:90
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:87
LanguageType
Programming language type.
Encoding
Register encoding definitions.
uint64_t user_id_t
Definition: lldb-types.h:84
A SmallBitVector that represents a set of source languages (lldb::LanguageType).
Definition: TypeSystem.h:40