LLDB  mainline
ClangASTContext.h
Go to the documentation of this file.
1 //===-- ClangASTContext.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 liblldb_ClangASTContext_h_
10 #define liblldb_ClangASTContext_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/ExternalASTMerger.h"
25 #include "clang/AST/TemplateBase.h"
26 #include "llvm/ADT/APSInt.h"
27 #include "llvm/ADT/SmallVector.h"
28 
30 #include "lldb/Core/ClangForward.h"
32 #include "lldb/Symbol/TypeSystem.h"
34 #include "lldb/lldb-enumerations.h"
35 
37 class PDBASTParser;
38 
39 namespace lldb_private {
40 
41 class Declaration;
42 
43 class ClangASTContext : public TypeSystem {
44 public:
45  typedef void (*CompleteTagDeclCallback)(void *baton, clang::TagDecl *);
46  typedef void (*CompleteObjCInterfaceDeclCallback)(void *baton,
47  clang::ObjCInterfaceDecl *);
48 
49  // llvm casting support
50  static bool classof(const TypeSystem *ts) {
51  return ts->getKind() == TypeSystem::eKindClang;
52  }
53 
54  // Constructors and Destructors
55  ClangASTContext(const char *triple = nullptr);
56 
57  ~ClangASTContext() override;
58 
59  void Finalize() override;
60 
61  // PluginInterface functions
62  ConstString GetPluginName() override;
63 
64  uint32_t GetPluginVersion() override;
65 
67 
68  static lldb::TypeSystemSP CreateInstance(lldb::LanguageType language,
69  Module *module, Target *target);
70 
71  static void EnumerateSupportedLanguages(
72  std::set<lldb::LanguageType> &languages_for_types,
73  std::set<lldb::LanguageType> &languages_for_expressions);
74 
75  static void Initialize();
76 
77  static void Terminate();
78 
79  static ClangASTContext *GetASTContext(clang::ASTContext *ast_ctx);
80 
81  clang::ASTContext *getASTContext();
82 
83  void setASTContext(clang::ASTContext *ast_ctx);
84 
85  clang::Builtin::Context *getBuiltinContext();
86 
87  clang::IdentifierTable *getIdentifierTable();
88 
89  clang::LangOptions *getLanguageOptions();
90 
91  clang::SelectorTable *getSelectorTable();
92 
93  clang::FileManager *getFileManager();
94 
95  clang::SourceManager *getSourceManager();
96 
97  clang::DiagnosticsEngine *getDiagnosticsEngine();
98 
99  clang::DiagnosticConsumer *getDiagnosticConsumer();
100 
101  clang::MangleContext *getMangleContext();
102 
103  std::shared_ptr<clang::TargetOptions> &getTargetOptions();
104 
105  clang::TargetInfo *getTargetInfo();
106 
107  void setSema(clang::Sema *s);
108  clang::Sema *getSema() { return m_sema; }
109 
110  void Clear();
111 
112  const char *GetTargetTriple();
113 
114  void SetTargetTriple(const char *target_triple);
115 
116  void SetArchitecture(const ArchSpec &arch);
117 
118  bool HasExternalSource();
119 
120  void SetExternalSource(
121  llvm::IntrusiveRefCntPtr<clang::ExternalASTSource> &ast_source_up);
122 
123  void RemoveExternalSource();
124 
125  bool GetCompleteDecl(clang::Decl *decl) {
127  }
128 
129  static void DumpDeclHiearchy(clang::Decl *decl);
130 
131  static void DumpDeclContextHiearchy(clang::DeclContext *decl_ctx);
132 
133  static bool DeclsAreEquivalent(clang::Decl *lhs_decl, clang::Decl *rhs_decl);
134 
135  static bool GetCompleteDecl(clang::ASTContext *ast, clang::Decl *decl);
136 
137  void SetMetadataAsUserID(const void *object, lldb::user_id_t user_id);
138 
139  void SetMetadata(const void *object, ClangASTMetadata &meta_data) {
140  SetMetadata(getASTContext(), object, meta_data);
141  }
142 
143  static void SetMetadata(clang::ASTContext *ast, const void *object,
144  ClangASTMetadata &meta_data);
145 
146  ClangASTMetadata *GetMetadata(const void *object) {
147  return GetMetadata(getASTContext(), object);
148  }
149 
150  static ClangASTMetadata *GetMetadata(clang::ASTContext *ast,
151  const void *object);
152 
153  // Basic Types
155  size_t bit_size) override;
156 
158  clang::ASTContext *ast, lldb::Encoding encoding, uint32_t bit_size);
159 
161 
162  static CompilerType GetBasicType(clang::ASTContext *ast,
163  lldb::BasicType type);
164 
165  static CompilerType GetBasicType(clang::ASTContext *ast,
166  ConstString name);
167 
169 
171  uint32_t dw_ate,
172  uint32_t bit_size);
173 
174  CompilerType GetCStringType(bool is_const);
175 
176  static CompilerType GetUnknownAnyType(clang::ASTContext *ast);
177 
180  }
181 
182  static clang::DeclContext *GetDeclContextForType(clang::QualType type);
183 
184  static clang::DeclContext *GetDeclContextForType(const CompilerType &type);
185 
186  uint32_t GetPointerByteSize() override;
187 
188  static clang::DeclContext *GetTranslationUnitDecl(clang::ASTContext *ast);
189 
190  clang::DeclContext *GetTranslationUnitDecl() {
192  }
193 
194  static clang::Decl *CopyDecl(clang::ASTContext *dest_context,
195  clang::ASTContext *source_context,
196  clang::Decl *source_decl);
197 
198  static bool AreTypesSame(CompilerType type1, CompilerType type2,
199  bool ignore_qualifiers = false);
200 
201  static CompilerType GetTypeForDecl(clang::NamedDecl *decl);
202 
203  static CompilerType GetTypeForDecl(clang::TagDecl *decl);
204 
205  static CompilerType GetTypeForDecl(clang::ObjCInterfaceDecl *objc_decl);
206 
207  template <typename RecordDeclType>
210  clang::DeclContext *decl_context = nullptr) {
211  CompilerType compiler_type;
212 
213  if (type_name.GetLength()) {
214  clang::ASTContext *ast = getASTContext();
215  if (ast) {
216  if (!decl_context)
217  decl_context = ast->getTranslationUnitDecl();
218 
219  clang::IdentifierInfo &myIdent =
220  ast->Idents.get(type_name.GetCString());
221  clang::DeclarationName myName =
222  ast->DeclarationNames.getIdentifier(&myIdent);
223 
224  clang::DeclContext::lookup_result result =
225  decl_context->lookup(myName);
226 
227  if (!result.empty()) {
228  clang::NamedDecl *named_decl = result[0];
229  if (const RecordDeclType *record_decl =
230  llvm::dyn_cast<RecordDeclType>(named_decl))
231  compiler_type.SetCompilerType(
232  ast, clang::QualType(record_decl->getTypeForDecl(), 0));
233  }
234  }
235  }
236 
237  return compiler_type;
238  }
239 
241  ConstString type_name,
242  const std::initializer_list<std::pair<const char *, CompilerType>>
243  &type_fields,
244  bool packed = false);
245 
247  ConstString type_name,
248  const std::initializer_list<std::pair<const char *, CompilerType>>
249  &type_fields,
250  bool packed = false);
251 
252  static bool IsOperator(const char *name,
253  clang::OverloadedOperatorKind &op_kind);
254 
255  // Structure, Unions, Classes
256 
257  static clang::AccessSpecifier
259 
260  static clang::AccessSpecifier
261  UnifyAccessSpecifiers(clang::AccessSpecifier lhs, clang::AccessSpecifier rhs);
262 
263  static uint32_t GetNumBaseClasses(const clang::CXXRecordDecl *cxx_record_decl,
264  bool omit_empty_base_classes);
265 
266  CompilerType CreateRecordType(clang::DeclContext *decl_ctx,
267  lldb::AccessType access_type, const char *name,
268  int kind, lldb::LanguageType language,
269  ClangASTMetadata *metadata = nullptr);
270 
272  public:
273  bool IsValid() const {
274  if (args.empty())
275  return false;
276  return args.size() == names.size() &&
277  ((bool)pack_name == (bool)packed_args) &&
278  (!packed_args || !packed_args->packed_args);
279  }
280 
281  llvm::SmallVector<const char *, 2> names;
282  llvm::SmallVector<clang::TemplateArgument, 2> args;
283 
284  const char * pack_name = nullptr;
285  std::unique_ptr<TemplateParameterInfos> packed_args;
286  };
287 
288  clang::FunctionTemplateDecl *
289  CreateFunctionTemplateDecl(clang::DeclContext *decl_ctx,
290  clang::FunctionDecl *func_decl, const char *name,
291  const TemplateParameterInfos &infos);
292 
294  clang::FunctionDecl *func_decl, clang::FunctionTemplateDecl *Template,
295  const TemplateParameterInfos &infos);
296 
297  clang::ClassTemplateDecl *
298  CreateClassTemplateDecl(clang::DeclContext *decl_ctx,
299  lldb::AccessType access_type, const char *class_name,
300  int kind, const TemplateParameterInfos &infos);
301 
302  clang::TemplateTemplateParmDecl *
303  CreateTemplateTemplateParmDecl(const char *template_name);
304 
305  clang::ClassTemplateSpecializationDecl *CreateClassTemplateSpecializationDecl(
306  clang::DeclContext *decl_ctx,
307  clang::ClassTemplateDecl *class_template_decl, int kind,
308  const TemplateParameterInfos &infos);
309 
311  CreateClassTemplateSpecializationType(clang::ClassTemplateSpecializationDecl *
312  class_template_specialization_decl);
313 
314  static clang::DeclContext *
315  GetAsDeclContext(clang::CXXMethodDecl *cxx_method_decl);
316 
317  static clang::DeclContext *
318  GetAsDeclContext(clang::ObjCMethodDecl *objc_method_decl);
319 
321  bool is_method, clang::OverloadedOperatorKind op_kind,
322  uint32_t num_params);
323 
324  bool FieldIsBitfield(clang::FieldDecl *field, uint32_t &bitfield_bit_size);
325 
326  static bool FieldIsBitfield(clang::ASTContext *ast, clang::FieldDecl *field,
327  uint32_t &bitfield_bit_size);
328 
329  static bool RecordHasFields(const clang::RecordDecl *record_decl);
330 
331  CompilerType CreateObjCClass(const char *name, clang::DeclContext *decl_ctx,
332  bool isForwardDecl, bool isInternal,
333  ClangASTMetadata *metadata = nullptr);
334 
335  bool SetTagTypeKind(clang::QualType type, int kind) const;
336 
337  bool SetDefaultAccessForRecordFields(clang::RecordDecl *record_decl,
338  int default_accessibility,
339  int *assigned_accessibilities,
340  size_t num_assigned_accessibilities);
341 
342  // Returns a mask containing bits from the ClangASTContext::eTypeXXX
343  // enumerations
344 
345  // Namespace Declarations
346 
347  clang::NamespaceDecl *
348  GetUniqueNamespaceDeclaration(const char *name, clang::DeclContext *decl_ctx,
349  bool is_inline = false);
350 
351  static clang::NamespaceDecl *
352  GetUniqueNamespaceDeclaration(clang::ASTContext *ast, const char *name,
353  clang::DeclContext *decl_ctx,
354  bool is_inline = false);
355 
356  // Function Types
357 
358  clang::FunctionDecl *
359  CreateFunctionDeclaration(clang::DeclContext *decl_ctx, const char *name,
360  const CompilerType &function_Type, int storage,
361  bool is_inline);
362 
363  static CompilerType CreateFunctionType(clang::ASTContext *ast,
364  const CompilerType &result_type,
365  const CompilerType *args,
366  unsigned num_args, bool is_variadic,
367  unsigned type_quals,
368  clang::CallingConv cc);
369 
370  static CompilerType CreateFunctionType(clang::ASTContext *ast,
371  const CompilerType &result_type,
372  const CompilerType *args,
373  unsigned num_args, bool is_variadic,
374  unsigned type_quals) {
376  ast, result_type, args, num_args, is_variadic, type_quals, clang::CC_C);
377  }
378 
380  const CompilerType *args, unsigned num_args,
381  bool is_variadic, unsigned type_quals) {
383  getASTContext(), result_type, args, num_args, is_variadic, type_quals);
384  }
385 
387  const CompilerType *args, unsigned num_args,
388  bool is_variadic, unsigned type_quals,
389  clang::CallingConv cc) {
391  args, num_args, is_variadic,
392  type_quals, cc);
393  }
394 
395  clang::ParmVarDecl *CreateParameterDeclaration(clang::DeclContext *decl_ctx,
396  const char *name,
397  const CompilerType &param_type,
398  int storage);
399 
400  void SetFunctionParameters(clang::FunctionDecl *function_decl,
401  clang::ParmVarDecl **params, unsigned num_params);
402 
403  CompilerType CreateBlockPointerType(const CompilerType &function_type);
404 
405  // Array Types
406 
407  CompilerType CreateArrayType(const CompilerType &element_type,
408  size_t element_count, bool is_vector);
409 
410  // Enumeration Types
411  CompilerType CreateEnumerationType(const char *name,
412  clang::DeclContext *decl_ctx,
413  const Declaration &decl,
414  const CompilerType &integer_qual_type,
415  bool is_scoped);
416 
417  // Integer type functions
418 
419  static CompilerType GetIntTypeFromBitSize(clang::ASTContext *ast,
420  size_t bit_size, bool is_signed);
421 
423  return GetPointerSizedIntType(getASTContext(), is_signed);
424  }
425 
426  static CompilerType GetPointerSizedIntType(clang::ASTContext *ast,
427  bool is_signed);
428 
429  // Floating point functions
430 
431  static CompilerType GetFloatTypeFromBitSize(clang::ASTContext *ast,
432  size_t bit_size);
433 
434  // TypeSystem methods
435  DWARFASTParser *GetDWARFParser() override;
436  PDBASTParser *GetPDBParser() override;
437 
438  // ClangASTContext callbacks for external source lookups.
439  static void CompleteTagDecl(void *baton, clang::TagDecl *);
440 
441  static void CompleteObjCInterfaceDecl(void *baton,
442  clang::ObjCInterfaceDecl *);
443 
444  static bool LayoutRecordType(
445  void *baton, const clang::RecordDecl *record_decl, uint64_t &size,
446  uint64_t &alignment,
447  llvm::DenseMap<const clang::FieldDecl *, uint64_t> &field_offsets,
448  llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits>
449  &base_offsets,
450  llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits>
451  &vbase_offsets);
452 
453  // CompilerDecl override functions
454  ConstString DeclGetName(void *opaque_decl) override;
455 
456  ConstString DeclGetMangledName(void *opaque_decl) override;
457 
458  CompilerDeclContext DeclGetDeclContext(void *opaque_decl) override;
459 
460  CompilerType DeclGetFunctionReturnType(void *opaque_decl) override;
461 
462  size_t DeclGetFunctionNumArguments(void *opaque_decl) override;
463 
464  CompilerType DeclGetFunctionArgumentType(void *opaque_decl,
465  size_t arg_idx) override;
466 
467  // CompilerDeclContext override functions
468 
469  std::vector<CompilerDecl>
470  DeclContextFindDeclByName(void *opaque_decl_ctx, ConstString name,
471  const bool ignore_using_decls) override;
472 
473  bool DeclContextIsStructUnionOrClass(void *opaque_decl_ctx) override;
474 
475  ConstString DeclContextGetName(void *opaque_decl_ctx) override;
476 
477  ConstString DeclContextGetScopeQualifiedName(void *opaque_decl_ctx) override;
478 
479  bool DeclContextIsClassMethod(void *opaque_decl_ctx,
480  lldb::LanguageType *language_ptr,
481  bool *is_instance_method_ptr,
482  ConstString *language_object_name_ptr) override;
483 
484  bool DeclContextIsContainedInLookup(void *opaque_decl_ctx,
485  void *other_opaque_decl_ctx) override;
486 
487  // Clang specific clang::DeclContext functions
488 
489  static clang::DeclContext *
491 
492  static clang::ObjCMethodDecl *
494 
495  static clang::CXXMethodDecl *
497 
498  static clang::FunctionDecl *
500 
501  static clang::NamespaceDecl *
503 
505  const void *object);
506 
507  static clang::ASTContext *
509 
510  // Tests
511 
513  CompilerType *element_type, uint64_t *size,
514  bool *is_incomplete) override;
515 
517  CompilerType *element_type, uint64_t *size) override;
518 
519  bool IsAggregateType(lldb::opaque_compiler_type_t type) override;
520 
521  bool IsAnonymousType(lldb::opaque_compiler_type_t type) override;
522 
523  bool IsBeingDefined(lldb::opaque_compiler_type_t type) override;
524 
525  bool IsCharType(lldb::opaque_compiler_type_t type) override;
526 
527  bool IsCompleteType(lldb::opaque_compiler_type_t type) override;
528 
529  bool IsConst(lldb::opaque_compiler_type_t type) override;
530 
532  uint32_t &length) override;
533 
534  static bool IsCXXClassType(const CompilerType &type);
535 
536  bool IsDefined(lldb::opaque_compiler_type_t type) override;
537 
539  bool &is_complex) override;
540 
542  bool *is_variadic_ptr) override;
543 
545  CompilerType *base_type_ptr) override;
546 
547  size_t
549 
551  const size_t index) override;
552 
554 
556  CompilerType *function_pointer_type_ptr) override;
557 
559  bool &is_signed) override;
560 
562  bool &is_signed) override;
563 
564  static bool IsObjCClassType(const CompilerType &type);
565 
566  static bool IsObjCClassTypeAndHasIVars(const CompilerType &type,
567  bool check_superclass);
568 
569  static bool IsObjCObjectOrInterfaceType(const CompilerType &type);
570 
571  static bool IsObjCObjectPointerType(const CompilerType &type,
572  CompilerType *target_type = nullptr);
573 
575 
576  static bool IsClassType(lldb::opaque_compiler_type_t type);
577 
578  static bool IsEnumType(lldb::opaque_compiler_type_t type);
579 
581  CompilerType *target_type, // Can pass nullptr
582  bool check_cplusplus, bool check_objc) override;
583 
585 
587  CompilerType *pointee_type) override;
588 
590  CompilerType *pointee_type) override;
591 
593  CompilerType *pointee_type, bool *is_rvalue) override;
594 
595  bool IsScalarType(lldb::opaque_compiler_type_t type) override;
596 
597  bool IsTypedefType(lldb::opaque_compiler_type_t type) override;
598 
599  bool IsVoidType(lldb::opaque_compiler_type_t type) override;
600 
601  bool SupportsLanguage(lldb::LanguageType language) override;
602 
603  static bool GetCXXClassName(const CompilerType &type,
604  std::string &class_name);
605 
606  static bool GetObjCClassName(const CompilerType &type,
607  std::string &class_name);
608 
609  // Type Completion
610 
611  bool GetCompleteType(lldb::opaque_compiler_type_t type) override;
612 
613  // Accessors
614 
616 
618  CompilerType *pointee_or_element_compiler_type) override;
619 
622 
623  lldb::TypeClass GetTypeClass(lldb::opaque_compiler_type_t type) override;
624 
625  unsigned GetTypeQualifiers(lldb::opaque_compiler_type_t type) override;
626 
627  // Creating related types
628 
629  // Using the current type, create a new typedef to that type using
630  // "typedef_name" as the name and "decl_ctx" as the decl context.
631  static CompilerType
632  CreateTypedefType(const CompilerType &type, const char *typedef_name,
633  const CompilerDeclContext &compiler_decl_ctx);
634 
636  uint64_t *stride) override;
637 
639  uint64_t size) override;
640 
642 
645 
646  // Returns -1 if this isn't a function of if the function doesn't have a
647  // prototype Returns a value >= 0 if there is a prototype.
649 
651  size_t idx) override;
652 
655 
657 
660  size_t idx) override;
661 
663 
665 
667 
670 
673 
675 
677 
679 
681  const char *name,
682  const CompilerDeclContext &decl_ctx) override;
683 
684  // If the current object represents a typedef type, get the underlying type
686 
687  // Create related types using the current type's AST
688  CompilerType GetBasicTypeFromAST(lldb::BasicType basic_type) override;
689 
690  // Exploring the type
691 
692  llvm::Optional<uint64_t> GetByteSize(lldb::opaque_compiler_type_t type,
693  ExecutionContextScope *exe_scope) {
694  if (llvm::Optional<uint64_t> bit_size = GetBitSize(type, exe_scope))
695  return (*bit_size + 7) / 8;
696  return llvm::None;
697  }
698 
699  llvm::Optional<uint64_t>
701  ExecutionContextScope *exe_scope) override;
702 
704  uint64_t &count) override;
705 
707 
708  size_t GetTypeBitAlign(lldb::opaque_compiler_type_t type) override;
709 
711  bool omit_empty_base_classes,
712  const ExecutionContext *exe_ctx) override;
713 
715 
718 
719  static lldb::BasicType
721  ConstString name);
722 
723  void ForEachEnumerator(
725  std::function<bool(const CompilerType &integer_type,
726  ConstString name,
727  const llvm::APSInt &value)> const &callback) override;
728 
730 
732  std::string &name, uint64_t *bit_offset_ptr,
733  uint32_t *bitfield_bit_size_ptr,
734  bool *is_bitfield_ptr) override;
735 
737 
739 
741  size_t idx,
742  uint32_t *bit_offset_ptr) override;
743 
745  size_t idx,
746  uint32_t *bit_offset_ptr) override;
747 
748  static uint32_t GetNumPointeeChildren(clang::QualType type);
749 
751  lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx, size_t idx,
752  bool transparent_pointers, bool omit_empty_base_classes,
753  bool ignore_array_bounds, std::string &child_name,
754  uint32_t &child_byte_size, int32_t &child_byte_offset,
755  uint32_t &child_bitfield_bit_size, uint32_t &child_bitfield_bit_offset,
756  bool &child_is_base_class, bool &child_is_deref_of_parent,
757  ValueObject *valobj, uint64_t &language_flags) override;
758 
759  // Lookup a child given a name. This function will match base class names and
760  // member member names in "clang_type" only, not descendants.
762  const char *name,
763  bool omit_empty_base_classes) override;
764 
765  // Lookup a child member given a name. This function will match member names
766  // only and will descend into "clang_type" children in search for the first
767  // member in this class, or any base class that matches "name".
768  // TODO: Return all matches for a given name by returning a
769  // vector<vector<uint32_t>>
770  // so we catch all names that match a given child name, not just the first.
771  size_t
773  const char *name, bool omit_empty_base_classes,
774  std::vector<uint32_t> &child_indexes) override;
775 
777 
780  size_t idx) override;
782  size_t idx) override;
783  llvm::Optional<CompilerType::IntegralTemplateArgument>
785  size_t idx) override;
786 
787  CompilerType GetTypeForFormatters(void *type) override;
788 
789 #define LLDB_INVALID_DECL_LEVEL UINT32_MAX
790  // LLDB_INVALID_DECL_LEVEL is returned by CountDeclLevels if child_decl_ctx
791  // could not be found in decl_ctx.
792  uint32_t CountDeclLevels(clang::DeclContext *frame_decl_ctx,
793  clang::DeclContext *child_decl_ctx,
794  ConstString *child_name = nullptr,
795  CompilerType *child_type = nullptr);
796 
797  // Modifying RecordType
798  static clang::FieldDecl *AddFieldToRecordType(const CompilerType &type,
799  llvm::StringRef name,
800  const CompilerType &field_type,
801  lldb::AccessType access,
802  uint32_t bitfield_bit_size);
803 
804  static void BuildIndirectFields(const CompilerType &type);
805 
806  static void SetIsPacked(const CompilerType &type);
807 
808  static clang::VarDecl *AddVariableToRecordType(const CompilerType &type,
809  llvm::StringRef name,
810  const CompilerType &var_type,
811  lldb::AccessType access);
812 
813  clang::CXXMethodDecl *
815  const char *mangled_name,
816  const CompilerType &method_type,
817  lldb::AccessType access, bool is_virtual,
818  bool is_static, bool is_inline, bool is_explicit,
819  bool is_attr_used, bool is_artificial);
820 
822 
823  // C++ Base Classes
824  std::unique_ptr<clang::CXXBaseSpecifier>
826  lldb::AccessType access, bool is_virtual,
827  bool base_of_class);
828 
829  bool TransferBaseClasses(
831  std::vector<std::unique_ptr<clang::CXXBaseSpecifier>> bases);
832 
833  static bool SetObjCSuperClass(const CompilerType &type,
834  const CompilerType &superclass_compiler_type);
835 
836  static bool AddObjCClassProperty(const CompilerType &type,
837  const char *property_name,
838  const CompilerType &property_compiler_type,
839  clang::ObjCIvarDecl *ivar_decl,
840  const char *property_setter_name,
841  const char *property_getter_name,
842  uint32_t property_attributes,
843  ClangASTMetadata *metadata);
844 
845  static clang::ObjCMethodDecl *AddMethodToObjCObjectType(
846  const CompilerType &type,
847  const char *name, // the full symbol name as seen in the symbol table
848  // (lldb::opaque_compiler_type_t type, "-[NString
849  // stringWithCString:]")
850  const CompilerType &method_compiler_type, lldb::AccessType access,
851  bool is_artificial, bool is_variadic);
852 
854  bool has_extern);
855 
856  static bool GetHasExternalStorage(const CompilerType &type);
857  // Tag Declarations
858  static bool StartTagDeclarationDefinition(const CompilerType &type);
859 
860  static bool CompleteTagDeclarationDefinition(const CompilerType &type);
861 
862  // Modifying Enumeration types
863  clang::EnumConstantDecl *AddEnumerationValueToEnumerationType(
864  const CompilerType &enum_type, const Declaration &decl, const char *name,
865  int64_t enum_value, uint32_t enum_value_bit_size);
866  clang::EnumConstantDecl *AddEnumerationValueToEnumerationType(
867  const CompilerType &enum_type, const Declaration &decl, const char *name,
868  const llvm::APSInt &value);
869 
871 
872  // Pointers & References
873 
874  // Call this function using the class type when you want to make a member
875  // pointer type to pointee_type.
876  static CompilerType CreateMemberPointerType(const CompilerType &type,
877  const CompilerType &pointee_type);
878 
879  // Converts "s" to a floating point value and place resulting floating point
880  // bytes in the "dst" buffer.
882  const char *s, uint8_t *dst,
883  size_t dst_size) override;
884 
885  // Dumping types
886 #ifndef NDEBUG
887  /// Convenience LLVM-style dump method for use in the debugger only.
888  /// In contrast to the other \p Dump() methods this directly invokes
889  /// \p clang::QualType::dump().
890  LLVM_DUMP_METHOD void dump(lldb::opaque_compiler_type_t type) const override;
891 #endif
892 
893  void Dump(Stream &s);
894 
895  void DumpValue(lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx,
896  Stream *s, lldb::Format format, const DataExtractor &data,
897  lldb::offset_t data_offset, size_t data_byte_size,
898  uint32_t bitfield_bit_size, uint32_t bitfield_bit_offset,
899  bool show_types, bool show_summary, bool verbose,
900  uint32_t depth) override;
901 
902  bool DumpTypeValue(lldb::opaque_compiler_type_t type, Stream *s,
903  lldb::Format format, const DataExtractor &data,
904  lldb::offset_t data_offset, size_t data_byte_size,
905  uint32_t bitfield_bit_size, uint32_t bitfield_bit_offset,
906  ExecutionContextScope *exe_scope) override;
907 
908  void DumpSummary(lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx,
909  Stream *s, const DataExtractor &data,
910  lldb::offset_t data_offset, size_t data_byte_size) override;
911 
912  void DumpTypeDescription(
913  lldb::opaque_compiler_type_t type) override; // Dump to stdout
914 
916  Stream *s) override;
917 
918  static void DumpTypeName(const CompilerType &type);
919 
920  static clang::EnumDecl *GetAsEnumDecl(const CompilerType &type);
921 
922  static clang::RecordDecl *GetAsRecordDecl(const CompilerType &type);
923 
924  static clang::TagDecl *GetAsTagDecl(const CompilerType &type);
925 
926  static clang::TypedefNameDecl *GetAsTypedefDecl(const CompilerType &type);
927 
928  clang::CXXRecordDecl *GetAsCXXRecordDecl(lldb::opaque_compiler_type_t type);
929 
930  static clang::ObjCInterfaceDecl *
931  GetAsObjCInterfaceDecl(const CompilerType &type);
932 
933  clang::ClassTemplateDecl *ParseClassTemplateDecl(
934  clang::DeclContext *decl_ctx, lldb::AccessType access_type,
935  const char *parent_name, int tag_decl_kind,
936  const ClangASTContext::TemplateParameterInfos &template_param_infos);
937 
938  clang::BlockDecl *CreateBlockDeclaration(clang::DeclContext *ctx);
939 
940  clang::UsingDirectiveDecl *
941  CreateUsingDirectiveDeclaration(clang::DeclContext *decl_ctx,
942  clang::NamespaceDecl *ns_decl);
943 
944  clang::UsingDecl *CreateUsingDeclaration(clang::DeclContext *current_decl_ctx,
945  clang::NamedDecl *target);
946 
947  clang::VarDecl *CreateVariableDeclaration(clang::DeclContext *decl_context,
948  const char *name,
949  clang::QualType type);
950 
952  GetOpaqueCompilerType(clang::ASTContext *ast, lldb::BasicType basic_type);
953 
954  static clang::QualType GetQualType(lldb::opaque_compiler_type_t type) {
955  if (type)
956  return clang::QualType::getFromOpaquePtr(type);
957  return clang::QualType();
958  }
959 
960  static clang::QualType
962  if (type)
963  return clang::QualType::getFromOpaquePtr(type).getCanonicalType();
964  return clang::QualType();
965  }
966 
967  clang::DeclarationName
968  GetDeclarationName(const char *name, const CompilerType &function_clang_type);
969 
970  virtual const clang::ExternalASTMerger::OriginMap &GetOriginMap() {
971  return m_origins;
972  }
973 protected:
974  const clang::ClassTemplateSpecializationDecl *
976 
977  // Classes that inherit from ClangASTContext can see and modify these
978  // clang-format off
979  std::string m_target_triple;
980  std::unique_ptr<clang::ASTContext> m_ast_up;
981  std::unique_ptr<clang::LangOptions> m_language_options_up;
982  std::unique_ptr<clang::FileManager> m_file_manager_up;
983  std::unique_ptr<clang::FileSystemOptions> m_file_system_options_up;
984  std::unique_ptr<clang::SourceManager> m_source_manager_up;
985  std::unique_ptr<clang::DiagnosticsEngine> m_diagnostics_engine_up;
986  std::unique_ptr<clang::DiagnosticConsumer> m_diagnostic_consumer_up;
987  std::shared_ptr<clang::TargetOptions> m_target_options_rp;
988  std::unique_ptr<clang::TargetInfo> m_target_info_up;
989  std::unique_ptr<clang::IdentifierTable> m_identifier_table_up;
990  std::unique_ptr<clang::SelectorTable> m_selector_table_up;
991  std::unique_ptr<clang::Builtin::Context> m_builtins_up;
992  std::unique_ptr<DWARFASTParserClang> m_dwarf_ast_parser_up;
993  std::unique_ptr<PDBASTParser> m_pdb_ast_parser_up;
994  std::unique_ptr<ClangASTSource> m_scratch_ast_source_up;
995  std::unique_ptr<clang::MangleContext> m_mangle_ctx_up;
999  clang::ExternalASTMerger::OriginMap m_origins;
1003  /// The sema associated that is currently used to build this ASTContext.
1004  /// May be null if we are already done parsing this ASTContext or the
1005  /// ASTContext wasn't created by parsing source code.
1006  clang::Sema * m_sema = nullptr;
1007  // clang-format on
1008 private:
1009  // For ClangASTContext only
1011  const ClangASTContext &operator=(const ClangASTContext &);
1012 };
1013 
1015 public:
1017 
1018  ~ClangASTContextForExpressions() override = default;
1019 
1020  UserExpression *
1021  GetUserExpression(llvm::StringRef expr, llvm::StringRef prefix,
1022  lldb::LanguageType language,
1023  Expression::ResultType desired_type,
1024  const EvaluateExpressionOptions &options,
1025  ValueObject *ctx_obj) override;
1026 
1027  FunctionCaller *GetFunctionCaller(const CompilerType &return_type,
1028  const Address &function_address,
1029  const ValueList &arg_value_list,
1030  const char *name) override;
1031 
1032  UtilityFunction *GetUtilityFunction(const char *text,
1033  const char *name) override;
1034 
1036 
1037  clang::ExternalASTMerger &GetMergerUnchecked();
1038 
1039  const clang::ExternalASTMerger::OriginMap &GetOriginMap() override {
1040  return GetMergerUnchecked().GetOrigins();
1041  }
1042 private:
1043  lldb::TargetWP m_target_wp;
1044  lldb::ClangPersistentVariablesUP m_persistent_variables; ///< These are the
1045  ///persistent
1046  ///variables
1047  ///associated with
1048  ///this process for
1049  ///the expression
1050  ///parser.
1051 };
1052 
1053 } // namespace lldb_private
1054 
1055 #endif // liblldb_ClangASTContext_h_
static bool CompleteTagDeclarationDefinition(const CompilerType &type)
llvm::Optional< uint64_t > GetBitSize(lldb::opaque_compiler_type_t type, ExecutionContextScope *exe_scope) override
bool DeclContextIsStructUnionOrClass(void *opaque_decl_ctx) override
virtual UtilityFunction * GetUtilityFunction(const char *text, const char *name)
Definition: TypeSystem.h:447
clang::MangleContext * getMangleContext()
static clang::ASTContext * DeclContextGetClangASTContext(const CompilerDeclContext &dc)
ConstString DeclGetMangledName(void *opaque_decl) override
static void DumpDeclContextHiearchy(clang::DeclContext *decl_ctx)
CompilerType CreateArrayType(const CompilerType &element_type, size_t element_count, bool is_vector)
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 CountDeclLevels(clang::DeclContext *frame_decl_ctx, clang::DeclContext *child_decl_ctx, ConstString *child_name=nullptr, CompilerType *child_type=nullptr)
CompilerType CreateObjCClass(const char *name, clang::DeclContext *decl_ctx, bool isForwardDecl, bool isInternal, ClangASTMetadata *metadata=nullptr)
uint32_t GetTypeInfo(lldb::opaque_compiler_type_t type, CompilerType *pointee_or_element_compiler_type) override
CompilerType GetNonReferenceType(lldb::opaque_compiler_type_t type) override
std::unique_ptr< clang::CXXBaseSpecifier > CreateBaseClassSpecifier(lldb::opaque_compiler_type_t type, lldb::AccessType access, bool is_virtual, bool base_of_class)
CompilerType GetFunctionArgumentTypeAtIndex(lldb::opaque_compiler_type_t type, size_t idx) override
Enumerations for broadcasting.
Definition: SBLaunchInfo.h:14
static bool IsEnumType(lldb::opaque_compiler_type_t type)
std::unique_ptr< clang::DiagnosticsEngine > m_diagnostics_engine_up
clang::NamespaceDecl * GetUniqueNamespaceDeclaration(const char *name, clang::DeclContext *decl_ctx, bool is_inline=false)
clang::DiagnosticConsumer * getDiagnosticConsumer()
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
clang::UsingDecl * CreateUsingDeclaration(clang::DeclContext *current_decl_ctx, clang::NamedDecl *target)
clang::UsingDirectiveDecl * CreateUsingDirectiveDeclaration(clang::DeclContext *decl_ctx, clang::NamespaceDecl *ns_decl)
clang::FunctionDecl * CreateFunctionDeclaration(clang::DeclContext *decl_ctx, const char *name, const CompilerType &function_Type, int storage, bool is_inline)
std::shared_ptr< clang::TargetOptions > m_target_options_rp
static CompilerType GetFloatTypeFromBitSize(clang::ASTContext *ast, size_t bit_size)
bool SetDefaultAccessForRecordFields(clang::RecordDecl *record_decl, int default_accessibility, int *assigned_accessibilities, size_t num_assigned_accessibilities)
clang::ASTContext * getASTContext()
static bool IsObjCClassTypeAndHasIVars(const CompilerType &type, bool check_superclass)
lldb::Format GetFormat(lldb::opaque_compiler_type_t type) override
CompilerType GetBuiltinTypeForEncodingAndBitSize(lldb::Encoding encoding, size_t bit_size) override
bool IsVectorType(lldb::opaque_compiler_type_t type, CompilerType *element_type, uint64_t *size) override
static clang::TagDecl * GetAsTagDecl(const CompilerType &type)
CompilerType GetCanonicalType(lldb::opaque_compiler_type_t type) override
CompleteObjCInterfaceDeclCallback m_callback_objc_decl
DWARFASTParser * GetDWARFParser() override
static clang::FunctionDecl * DeclContextGetAsFunctionDecl(const CompilerDeclContext &dc)
bool IsIntegerType(lldb::opaque_compiler_type_t type, bool &is_signed) override
uint32_t GetNumChildren(lldb::opaque_compiler_type_t type, bool omit_empty_base_classes, const ExecutionContext *exe_ctx) override
bool IsConst(lldb::opaque_compiler_type_t type) override
static clang::TypedefNameDecl * GetAsTypedefDecl(const CompilerType &type)
clang::SelectorTable * getSelectorTable()
std::unique_ptr< clang::TargetInfo > m_target_info_up
size_t GetNumMemberFunctions(lldb::opaque_compiler_type_t type) override
CompilerType GetLValueReferenceType(lldb::opaque_compiler_type_t type) override
static clang::RecordDecl * GetAsRecordDecl(const CompilerType &type)
static void CompleteTagDecl(void *baton, clang::TagDecl *)
clang::ParmVarDecl * CreateParameterDeclaration(clang::DeclContext *decl_ctx, const char *name, const CompilerType &param_type, int storage)
virtual UserExpression * GetUserExpression(llvm::StringRef expr, llvm::StringRef prefix, lldb::LanguageType language, Expression::ResultType desired_type, const EvaluateExpressionOptions &options, ValueObject *ctx_obj)
Definition: TypeSystem.h:432
clang::BlockDecl * CreateBlockDeclaration(clang::DeclContext *ctx)
uint32_t GetNumVirtualBaseClasses(lldb::opaque_compiler_type_t type) override
Encapsulates a one-time expression for use in lldb.
std::unique_ptr< clang::SourceManager > m_source_manager_up
void * opaque_compiler_type_t
Definition: lldb-types.h:90
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
unsigned GetTypeQualifiers(lldb::opaque_compiler_type_t type) override
An architecture specification class.
Definition: ArchSpec.h:32
clang::DeclarationName GetDeclarationName(const char *name, const CompilerType &function_clang_type)
std::unique_ptr< clang::FileSystemOptions > m_file_system_options_up
CompilerType GetBuiltinTypeForDWARFEncodingAndBitSize(const char *type_name, uint32_t dw_ate, uint32_t bit_size)
static clang::ObjCMethodDecl * AddMethodToObjCObjectType(const CompilerType &type, const char *name, const CompilerType &method_compiler_type, lldb::AccessType access, bool is_artificial, bool is_variadic)
clang::SourceManager * getSourceManager()
clang::DiagnosticsEngine * getDiagnosticsEngine()
void SetMetadata(const void *object, ClangASTMetadata &meta_data)
static bool SetObjCSuperClass(const CompilerType &type, const CompilerType &superclass_compiler_type)
ConstString GetTypeName(lldb::opaque_compiler_type_t type) override
CompilerType CreateClassTemplateSpecializationType(clang::ClassTemplateSpecializationDecl *class_template_specialization_decl)
bool GetCompleteDecl(clang::Decl *decl)
static bool LayoutRecordType(void *baton, 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)
std::unique_ptr< clang::MangleContext > m_mangle_ctx_up
bool IsPointerOrReferenceType(lldb::opaque_compiler_type_t type, CompilerType *pointee_type) override
CompilerType GetTypedefedType(lldb::opaque_compiler_type_t type) override
static CompilerType GetTypeForDecl(clang::NamedDecl *decl)
CompilerType GetEnumerationIntegerType(lldb::opaque_compiler_type_t type)
virtual const clang::ExternalASTMerger::OriginMap & GetOriginMap()
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
void ForEachEnumerator(lldb::opaque_compiler_type_t type, std::function< bool(const CompilerType &integer_type, ConstString name, const llvm::APSInt &value)> const &callback) override
LLVMCastKind getKind() const
Definition: TypeSystem.h:76
std::vector< CompilerDecl > DeclContextFindDeclByName(void *opaque_decl_ctx, ConstString name, const bool ignore_using_decls) override
static clang::AccessSpecifier UnifyAccessSpecifiers(clang::AccessSpecifier lhs, clang::AccessSpecifier rhs)
static bool IsObjCObjectOrInterfaceType(const CompilerType &type)
clang::DeclContext * GetTranslationUnitDecl()
static void DumpTypeName(const CompilerType &type)
static lldb::opaque_compiler_type_t GetOpaqueCompilerType(clang::ASTContext *ast, lldb::BasicType basic_type)
clang::EnumConstantDecl * AddEnumerationValueToEnumerationType(const CompilerType &enum_type, const Declaration &decl, const char *name, int64_t enum_value, uint32_t enum_value_bit_size)
bool GetCompleteType(lldb::opaque_compiler_type_t type) override
static ClangASTContext * GetASTContext(clang::ASTContext *ast_ctx)
CompilerType GetVirtualBaseClassAtIndex(lldb::opaque_compiler_type_t type, size_t idx, uint32_t *bit_offset_ptr) override
ClangASTContext(const char *triple=nullptr)
static clang::DeclContext * GetAsDeclContext(clang::CXXMethodDecl *cxx_method_decl)
void CreateFunctionTemplateSpecializationInfo(clang::FunctionDecl *func_decl, clang::FunctionTemplateDecl *Template, const TemplateParameterInfos &infos)
static clang::VarDecl * AddVariableToRecordType(const CompilerType &type, llvm::StringRef name, const CompilerType &var_type, lldb::AccessType access)
bool TransferBaseClasses(lldb::opaque_compiler_type_t type, std::vector< std::unique_ptr< clang::CXXBaseSpecifier >> bases)
CompilerType GetDirectBaseClassAtIndex(lldb::opaque_compiler_type_t type, size_t idx, uint32_t *bit_offset_ptr) override
CompilerType GetRValueReferenceType(lldb::opaque_compiler_type_t type) override
CompilerType CreateRecordType(clang::DeclContext *decl_ctx, lldb::AccessType access_type, const char *name, int kind, lldb::LanguageType language, ClangASTMetadata *metadata=nullptr)
lldb::LanguageType GetMinimumLanguage(lldb::opaque_compiler_type_t type) override
uint32_t GetNumDirectBaseClasses(lldb::opaque_compiler_type_t type) override
CompilerType GetTypeTemplateArgument(lldb::opaque_compiler_type_t type, size_t idx) override
CompilerDeclContext DeclGetDeclContext(void *opaque_decl) override
static clang::DeclContext * DeclContextGetAsDeclContext(const CompilerDeclContext &dc)
CompilerType AddConstModifier(lldb::opaque_compiler_type_t type) override
CompilerType CreateStructForIdentifier(ConstString type_name, const std::initializer_list< std::pair< const char *, CompilerType >> &type_fields, bool packed=false)
static bool IsObjCClassType(const CompilerType &type)
ConstString DeclContextGetName(void *opaque_decl_ctx) override
clang::ExternalASTMerger::OriginMap m_origins
std::unique_ptr< clang::IdentifierTable > m_identifier_table_up
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 clang::EnumDecl * GetAsEnumDecl(const CompilerType &type)
CompilerType GetBuiltinTypeByName(ConstString name) override
static CompilerType CreateMemberPointerType(const CompilerType &type, const CompilerType &pointee_type)
static ConstString GetPluginNameStatic()
std::unique_ptr< DWARFASTParserClang > m_dwarf_ast_parser_up
void SetTargetTriple(const char *target_triple)
llvm::Optional< CompilerType::IntegralTemplateArgument > GetIntegralTemplateArgument(lldb::opaque_compiler_type_t type, size_t idx) 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
lldb::TemplateArgumentKind GetTemplateArgumentKind(lldb::opaque_compiler_type_t type, size_t idx) override
CompilerType GetPointeeType(lldb::opaque_compiler_type_t type) override
CompilerType GetTypeForFormatters(void *type) override
uint64_t user_id_t
Definition: lldb-types.h:84
clang::IdentifierTable * getIdentifierTable()
LanguageType
Programming language type.
std::shared_ptr< clang::TargetOptions > & getTargetOptions()
size_t ConvertStringToFloatValue(lldb::opaque_compiler_type_t type, const char *s, uint8_t *dst, size_t dst_size) override
bool IsFunctionPointerType(lldb::opaque_compiler_type_t type) override
uint32_t GetPluginVersion() override
CompilerType GetPointerSizedIntType(bool is_signed)
CompilerType DeclGetFunctionArgumentType(void *opaque_decl, size_t arg_idx) override
bool IsTypedefType(lldb::opaque_compiler_type_t type) override
CompilerType GetBasicTypeFromAST(lldb::BasicType basic_type) override
uint64_t offset_t
Definition: lldb-types.h:87
CompilerType AddRestrictModifier(lldb::opaque_compiler_type_t type) override
bool IsCompleteType(lldb::opaque_compiler_type_t type) override
bool IsReferenceType(lldb::opaque_compiler_type_t type, CompilerType *pointee_type, bool *is_rvalue) override
size_t GetLength() const
Get the length in bytes of string value.
static bool StartTagDeclarationDefinition(const CompilerType &type)
size_t GetTypeBitAlign(lldb::opaque_compiler_type_t type) override
CompilerType GetArrayType(lldb::opaque_compiler_type_t type, uint64_t size) override
static lldb::BasicType GetBasicTypeEnumeration(ConstString name)
clang::VarDecl * CreateVariableDeclaration(clang::DeclContext *decl_context, const char *name, clang::QualType type)
A class that describes an executable image and its associated object and symbol files.
Definition: Module.h:109
static bool IsOperator(const char *name, clang::OverloadedOperatorKind &op_kind)
static bool SetHasExternalStorage(lldb::opaque_compiler_type_t type, bool has_extern)
bool FieldIsBitfield(clang::FieldDecl *field, uint32_t &bitfield_bit_size)
clang::CXXRecordDecl * GetAsCXXRecordDecl(lldb::opaque_compiler_type_t type)
static void DumpDeclHiearchy(clang::Decl *decl)
CompilerType GetOrCreateStructForIdentifier(ConstString type_name, const std::initializer_list< std::pair< const char *, CompilerType >> &type_fields, bool packed=false)
void SetCompilerType(TypeSystem *type_system, lldb::opaque_compiler_type_t type)
void DumpTypeDescription(lldb::opaque_compiler_type_t type) override
static bool GetObjCClassName(const CompilerType &type, std::string &class_name)
size_t GetNumberOfFunctionArguments(lldb::opaque_compiler_type_t type) override
static CompilerType CreateTypedefType(const CompilerType &type, const char *typedef_name, const CompilerDeclContext &compiler_decl_ctx)
static bool IsObjCObjectPointerType(const CompilerType &type, CompilerType *target_type=nullptr)
bool IsAnonymousType(lldb::opaque_compiler_type_t type) override
Encapsulates a function that can be called.
clang::TemplateTemplateParmDecl * CreateTemplateTemplateParmDecl(const char *template_name)
bool IsPolymorphicClass(lldb::opaque_compiler_type_t type) override
bool IsArrayType(lldb::opaque_compiler_type_t type, CompilerType *element_type, uint64_t *size, bool *is_incomplete) override
void(* CompleteTagDeclCallback)(void *baton, clang::TagDecl *)
llvm::Optional< uint64_t > GetByteSize(lldb::opaque_compiler_type_t type, ExecutionContextScope *exe_scope)
bool IsBlockPointerType(lldb::opaque_compiler_type_t type, CompilerType *function_pointer_type_ptr) override
static bool CheckOverloadedOperatorKindParameterCount(bool is_method, clang::OverloadedOperatorKind op_kind, uint32_t num_params)
std::unique_ptr< PDBASTParser > m_pdb_ast_parser_up
PDBASTParser * GetPDBParser() override
bool IsVoidType(lldb::opaque_compiler_type_t type) override
llvm::SmallVector< const char *, 2 > names
"lldb/Target/ExecutionContextScope.h" Inherit from this if your object can reconstruct its execution ...
static clang::Decl * CopyDecl(clang::ASTContext *dest_context, clang::ASTContext *source_context, clang::Decl *source_decl)
std::unique_ptr< clang::FileManager > m_file_manager_up
void setASTContext(clang::ASTContext *ast_ctx)
CompilerType CreateFunctionType(const CompilerType &result_type, const CompilerType *args, unsigned num_args, bool is_variadic, unsigned type_quals, clang::CallingConv cc)
bool IsPointerType(lldb::opaque_compiler_type_t type, CompilerType *pointee_type) override
A section + offset based address class.
Definition: Address.h:80
static clang::NamespaceDecl * DeclContextGetAsNamespaceDecl(const CompilerDeclContext &dc)
clang::ClassTemplateSpecializationDecl * CreateClassTemplateSpecializationDecl(clang::DeclContext *decl_ctx, clang::ClassTemplateDecl *class_template_decl, int kind, const TemplateParameterInfos &infos)
static clang::FieldDecl * AddFieldToRecordType(const CompilerType &type, llvm::StringRef name, const CompilerType &field_type, lldb::AccessType access, uint32_t bitfield_bit_size)
static uint32_t GetNumBaseClasses(const clang::CXXRecordDecl *cxx_record_decl, bool omit_empty_base_classes)
static bool GetCXXClassName(const CompilerType &type, std::string &class_name)
void SetMetadataAsUserID(const void *object, lldb::user_id_t user_id)
ConstString DeclGetName(void *opaque_decl) override
clang::ClassTemplateDecl * CreateClassTemplateDecl(clang::DeclContext *decl_ctx, lldb::AccessType access_type, const char *class_name, int kind, const TemplateParameterInfos &infos)
virtual PersistentExpressionState * GetPersistentExpressionState()
Definition: TypeSystem.h:452
void AddMethodOverridesForCXXRecordType(lldb::opaque_compiler_type_t type)
bool IsFunctionType(lldb::opaque_compiler_type_t type, bool *is_variadic_ptr) override
CompilerType AddVolatileModifier(lldb::opaque_compiler_type_t type) override
static ClangASTMetadata * DeclContextGetMetaData(const CompilerDeclContext &dc, const void *object)
bool SetTagTypeKind(clang::QualType type, int kind) const
bool IsEnumerationType(lldb::opaque_compiler_type_t type, bool &is_signed) override
static clang::AccessSpecifier ConvertAccessTypeToAccessSpecifier(lldb::AccessType access)
bool DeclContextIsContainedInLookup(void *opaque_decl_ctx, void *other_opaque_decl_ctx) override
std::unique_ptr< clang::SelectorTable > m_selector_table_up
static bool AreTypesSame(CompilerType type1, CompilerType type2, bool ignore_qualifiers=false)
static clang::QualType GetQualType(lldb::opaque_compiler_type_t type)
uint32_t GetNumFields(lldb::opaque_compiler_type_t type) override
bool IsDefined(lldb::opaque_compiler_type_t type) override
static void BuildIndirectFields(const CompilerType &type)
CompilerType CreateFunctionType(const CompilerType &result_type, const CompilerType *args, unsigned num_args, bool is_variadic, unsigned type_quals)
static clang::ObjCInterfaceDecl * GetAsObjCInterfaceDecl(const CompilerType &type)
bool IsRuntimeGeneratedType(lldb::opaque_compiler_type_t type) override
virtual FunctionCaller * GetFunctionCaller(const CompilerType &return_type, const Address &function_address, const ValueList &arg_value_list, const char *name)
Definition: TypeSystem.h:440
static bool RecordHasFields(const clang::RecordDecl *record_decl)
size_t DeclGetFunctionNumArguments(void *opaque_decl) override
clang::ClassTemplateDecl * ParseClassTemplateDecl(clang::DeclContext *decl_ctx, lldb::AccessType access_type, const char *parent_name, int tag_decl_kind, const ClangASTContext::TemplateParameterInfos &template_param_infos)
const clang::ExternalASTMerger::OriginMap & GetOriginMap() 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
static lldb::TypeSystemSP CreateInstance(lldb::LanguageType language, Module *module, Target *target)
uint32_t GetIndexOfChildWithName(lldb::opaque_compiler_type_t type, const char *name, bool omit_empty_base_classes) override
static CompilerType CreateFunctionType(clang::ASTContext *ast, const CompilerType &result_type, const CompilerType *args, unsigned num_args, bool is_variadic, unsigned type_quals, clang::CallingConv cc)
clang::LangOptions * getLanguageOptions()
static bool DeclsAreEquivalent(clang::Decl *lhs_decl, clang::Decl *rhs_decl)
CompilerType GetPointerType(lldb::opaque_compiler_type_t type) override
A uniqued constant string class.
Definition: ConstString.h:38
ClangASTMetadata * GetMetadata(const void *object)
bool IsAggregateType(lldb::opaque_compiler_type_t type) override
const char * GetCString() const
Get the string value as a C string.
Definition: ConstString.h:247
static uint32_t GetNumPointeeChildren(clang::QualType type)
CompilerType DeclGetFunctionReturnType(void *opaque_decl) override
bool SupportsLanguage(lldb::LanguageType language) override
size_t GetNumTemplateArguments(lldb::opaque_compiler_type_t type) override
clang::FileManager * getFileManager()
const clang::ClassTemplateSpecializationDecl * GetAsTemplateSpecialization(lldb::opaque_compiler_type_t type)
CompilerType GetArrayElementType(lldb::opaque_compiler_type_t type, uint64_t *stride) override
CompleteTagDeclCallback m_callback_tag_decl
static bool IsCXXClassType(const CompilerType &type)
uint32_t IsHomogeneousAggregate(lldb::opaque_compiler_type_t type, CompilerType *base_type_ptr) override
bool IsCStringType(lldb::opaque_compiler_type_t type, uint32_t &length) override
CompilerType GetFunctionArgumentAtIndex(lldb::opaque_compiler_type_t type, const size_t index) override
static void CompleteObjCInterfaceDecl(void *baton, clang::ObjCInterfaceDecl *)
CompilerType CreateEnumerationType(const char *name, clang::DeclContext *decl_ctx, const Declaration &decl, const CompilerType &integer_qual_type, bool is_scoped)
TypeMemberFunctionImpl GetMemberFunctionAtIndex(lldb::opaque_compiler_type_t type, size_t idx) override
bool DeclContextIsClassMethod(void *opaque_decl_ctx, lldb::LanguageType *language_ptr, bool *is_instance_method_ptr, ConstString *language_object_name_ptr) override
CompilerType GetTypeForIdentifier(ConstString type_name, clang::DeclContext *decl_context=nullptr)
static bool GetHasExternalStorage(const CompilerType &type)
static CompilerType GetIntTypeFromBitSize(clang::ASTContext *ast, size_t bit_size, bool is_signed)
static void SetIsPacked(const CompilerType &type)
bool IsFloatingPointType(lldb::opaque_compiler_type_t type, uint32_t &count, bool &is_complex) override
CompilerType CreateBlockPointerType(const CompilerType &function_type)
static clang::ObjCMethodDecl * DeclContextGetAsObjCMethodDecl(const CompilerDeclContext &dc)
std::unique_ptr< clang::DiagnosticConsumer > m_diagnostic_consumer_up
bool IsBeingDefined(lldb::opaque_compiler_type_t type) override
std::unique_ptr< clang::LangOptions > m_language_options_up
CompilerType GetCStringType(bool is_const)
bool IsScalarType(lldb::opaque_compiler_type_t type) override
CompilerType GetFullyUnqualifiedType(lldb::opaque_compiler_type_t type) override
"lldb/Expression/UtilityFunction.h" Encapsulates a bit of source code that provides a function that i...
lldb::TypeClass GetTypeClass(lldb::opaque_compiler_type_t type) override
void SetExternalSource(llvm::IntrusiveRefCntPtr< clang::ExternalASTSource > &ast_source_up)
bool IsCharType(lldb::opaque_compiler_type_t type) override
bool IsPossibleDynamicType(lldb::opaque_compiler_type_t type, CompilerType *target_type, bool check_cplusplus, bool check_objc) override
lldb::Encoding GetEncoding(lldb::opaque_compiler_type_t type, uint64_t &count) override
A class that describes the declaration location of a lldb object.
Definition: Declaration.h:24
int GetFunctionArgumentCount(lldb::opaque_compiler_type_t type) override
std::unique_ptr< TemplateParameterInfos > packed_args
clang::FunctionTemplateDecl * CreateFunctionTemplateDecl(clang::DeclContext *decl_ctx, clang::FunctionDecl *func_decl, const char *name, const TemplateParameterInfos &infos)
CompilerType GetBasicType(lldb::BasicType type)
static bool classof(const TypeSystem *ts)
std::unique_ptr< ClangASTSource > m_scratch_ast_source_up
std::unique_ptr< clang::Builtin::Context > m_builtins_up
static clang::QualType GetCanonicalQualType(lldb::opaque_compiler_type_t type)
static void EnumerateSupportedLanguages(std::set< lldb::LanguageType > &languages_for_types, std::set< lldb::LanguageType > &languages_for_expressions)
clang::Builtin::Context * getBuiltinContext()
CompilerType GetFunctionReturnType(lldb::opaque_compiler_type_t type) override
static bool IsClassType(lldb::opaque_compiler_type_t type)
void(* CompleteObjCInterfaceDeclCallback)(void *baton, clang::ObjCInterfaceDecl *)
ConstString DeclContextGetScopeQualifiedName(void *opaque_decl_ctx) override
clang::Sema * m_sema
The sema associated that is currently used to build this ASTContext.
llvm::SmallVector< clang::TemplateArgument, 2 > args
ConstString GetPluginName() 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
std::unique_ptr< clang::ASTContext > m_ast_up
void SetArchitecture(const ArchSpec &arch)
uint32_t GetPointerByteSize() override
static CompilerType CreateFunctionType(clang::ASTContext *ast, const CompilerType &result_type, const CompilerType *args, unsigned num_args, bool is_variadic, unsigned type_quals)
static clang::CXXMethodDecl * DeclContextGetAsCXXMethodDecl(const CompilerDeclContext &dc)
clang::TargetInfo * getTargetInfo()
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
void SetFunctionParameters(clang::FunctionDecl *function_decl, clang::ParmVarDecl **params, unsigned num_params)
static clang::DeclContext * GetDeclContextForType(clang::QualType type)
clang::CXXMethodDecl * AddMethodToCXXRecordType(lldb::opaque_compiler_type_t type, const char *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)
CompilerType CreateTypedef(lldb::opaque_compiler_type_t type, const char *name, const CompilerDeclContext &decl_ctx) override