9#ifndef LLDB_SOURCE_PLUGINS_TYPESYSTEM_CLANG_TYPESYSTEMCLANG_H
10#define LLDB_SOURCE_PLUGINS_TYPESYSTEM_CLANG_TYPESYSTEMCLANG_H
15#include <initializer_list>
23#include "clang/AST/ASTContext.h"
24#include "clang/AST/ASTFwd.h"
25#include "clang/AST/TemplateBase.h"
26#include "clang/AST/Type.h"
27#include "clang/Basic/TargetInfo.h"
28#include "llvm/ADT/APSInt.h"
29#include "llvm/ADT/SmallVector.h"
52class ClangASTMetadata;
79 bool is_complete_objc_class =
false);
113 clang::ObjCInterfaceDecl *);
116 bool isA(
const void *ClassID)
const override {
return ClassID == &
ID; }
134 clang::ASTContext &existing_ctxt);
176 llvm::IntrusiveRefCntPtr<clang::ExternalASTSource> &ast_source_up);
188 static bool GetCompleteDecl(clang::ASTContext *ast, clang::Decl *decl);
200 clang::AccessSpecifier access);
201 clang::AccessSpecifier
206 size_t bit_size)
override;
229 bool ignore_qualifiers =
false);
239 if (qt.getTypePtrOrNull() ==
nullptr)
242 assert(qt->getAsTagDecl() ==
nullptr ||
244 return CompilerType(weak_from_this(), qt.getAsOpaquePtr());
253 template <
typename RecordDeclType>
256 clang::DeclContext *decl_context =
nullptr) {
262 decl_context = ast.getTranslationUnitDecl();
264 clang::IdentifierInfo &myIdent = ast.Idents.get(type_name.
GetCString());
265 clang::DeclarationName myName =
266 ast.DeclarationNames.getIdentifier(&myIdent);
268 clang::DeclContext::lookup_result result = decl_context->lookup(myName);
270 if (!result.empty()) {
271 clang::NamedDecl *named_decl = *result.begin();
272 if (
const RecordDeclType *record_decl =
273 llvm::dyn_cast<RecordDeclType>(named_decl))
276 clang::QualType(record_decl->getTypeForDecl(), 0)
281 return compiler_type;
286 const std::initializer_list<std::pair<const char *, CompilerType>>
288 bool packed =
false);
292 const std::initializer_list<std::pair<const char *, CompilerType>>
294 bool packed =
false);
297 clang::OverloadedOperatorKind &op_kind);
301 static clang::AccessSpecifier
304 static clang::AccessSpecifier
308 bool omit_empty_base_classes);
311 clang::NamedDecl *canonical_decl,
312 bool omit_empty_base_classes);
315 const clang::CXXBaseSpecifier *base_spec,
316 bool omit_empty_base_classes);
321 bool is_framework =
false,
322 bool is_explicit =
false);
327 llvm::StringRef name,
int kind,
330 bool exports_symbols =
false);
336 llvm::ArrayRef<clang::TemplateArgument> args_in)
338 assert(
names.size() == args_in.size());
361 llvm::ArrayRef<clang::TemplateArgument>
GetArgs()
const {
return args; }
364 clang::TemplateArgument
const &
Front()
const {
365 assert(!
args.empty());
369 void InsertArg(
char const *name, clang::TemplateArgument arg) {
370 args.emplace_back(std::move(arg));
371 names.push_back(name);
409 llvm::SmallVector<const char *, 2>
names;
410 llvm::SmallVector<clang::TemplateArgument, 2>
args;
421 clang::FunctionDecl *func_decl, clang::FunctionTemplateDecl *Template,
429 clang::TemplateTemplateParmDecl *
434 clang::ClassTemplateDecl *class_template_decl,
int kind,
439 class_template_specialization_decl);
441 static clang::DeclContext *
445 bool is_method, clang::OverloadedOperatorKind op_kind,
455 clang::DeclContext *decl_ctx,
457 bool isForwardDecl,
bool isInternal,
465 clang::NamespaceDecl *
468 bool is_inline =
false);
474 llvm::StringRef name,
const CompilerType &function_Type,
475 clang::StorageClass storage,
bool is_inline);
479 unsigned num_args,
bool is_variadic,
unsigned type_quals,
480 clang::CallingConv cc = clang::CC_C,
481 clang::RefQualifierKind ref_qual = clang::RQ_None);
487 int storage,
bool add_decl =
false);
490 llvm::ArrayRef<clang::ParmVarDecl *> params);
497 size_t element_count,
bool is_vector);
501 clang::DeclContext *decl_ctx,
529 const clang::RecordDecl *record_decl, uint64_t &size, uint64_t &alignment,
530 llvm::DenseMap<const clang::FieldDecl *, uint64_t> &field_offsets,
531 llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits>
533 llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits>
542 "CreateCompilerDecl for Decl from wrong ASTContext?");
558 size_t arg_idx)
override;
574 std::vector<CompilerDecl>
576 const bool ignore_using_decls)
override;
585 void *other_opaque_decl_ctx)
override;
591 static clang::DeclContext *
594 static clang::ObjCMethodDecl *
597 static clang::CXXMethodDecl *
600 static clang::FunctionDecl *
603 static clang::NamespaceDecl *
607 const clang::Decl *
object);
609 static clang::ASTContext *
620 bool *is_incomplete)
override;
645 bool &is_complex)
override;
656 const size_t index)
override;
666 bool &is_signed)
override;
669 bool &is_signed)
override;
676 bool check_superclass);
691 bool check_cplusplus,
bool check_objc)
override;
725 bool base_only)
override;
730 CompilerType *pointee_or_element_compiler_type)
override;
745 uint64_t size)
override;
760 size_t idx)
override;
769 size_t idx)
override;
811 if (std::optional<uint64_t> bit_size =
GetBitSize(type, exe_scope))
812 return (*bit_size + 7) / 8;
820 uint64_t &count)
override;
824 std::optional<size_t>
829 bool omit_empty_base_classes,
845 const llvm::APSInt &value)>
const &callback)
override;
850 std::string &name, uint64_t *bit_offset_ptr,
852 bool *is_bitfield_ptr)
override;
870 bool transparent_pointers,
bool omit_empty_base_classes,
871 bool ignore_array_bounds, std::string &child_name,
872 uint32_t &child_byte_size, int32_t &child_byte_offset,
874 bool &child_is_base_class,
bool &child_is_deref_of_parent,
875 ValueObject *valobj, uint64_t &language_flags)
override;
880 llvm::StringRef name,
881 bool omit_empty_base_classes)
override;
891 llvm::StringRef name,
892 bool omit_empty_base_classes,
893 std::vector<uint32_t> &child_indexes)
override;
898 bool expand_pack)
override;
902 bool expand_pack)
override;
904 size_t idx,
bool expand_pack)
override;
905 std::optional<CompilerType::IntegralTemplateArgument>
907 bool expand_pack)
override;
911#define LLDB_INVALID_DECL_LEVEL UINT32_MAX
915 clang::DeclContext *child_decl_ctx,
916 ConstString *child_name =
nullptr,
917 CompilerType *child_type =
nullptr);
921 llvm::StringRef name,
922 const CompilerType &field_type,
931 llvm::StringRef name,
932 const CompilerType &var_type,
942 const llvm::APInt &init_value);
951 const llvm::APFloat &init_value);
955 const char *mangled_name,
const CompilerType &method_type,
957 bool is_explicit,
bool is_attr_used,
bool is_artificial);
962 std::unique_ptr<clang::CXXBaseSpecifier>
969 std::vector<std::unique_ptr<clang::CXXBaseSpecifier>> bases);
972 const CompilerType &superclass_compiler_type);
975 const char *property_name,
976 const CompilerType &property_compiler_type,
977 clang::ObjCIvarDecl *ivar_decl,
978 const char *property_setter_name,
979 const char *property_getter_name,
981 ClangASTMetadata *metadata);
984 const CompilerType &type,
989 bool is_artificial,
bool is_variadic,
bool is_objc_direct_call);
1001 const CompilerType &enum_type,
const Declaration &decl,
const char *name,
1002 int64_t enum_value,
uint32_t enum_value_bit_size);
1004 const CompilerType &enum_type,
const Declaration &decl,
const char *name,
1005 const llvm::APSInt &value);
1017 const CompilerType &pointee_type);
1028 void Dump(llvm::raw_ostream &output)
override;
1039 Stream *s,
lldb::Format format,
const DataExtractor &data,
1042 bool show_types,
bool show_summary,
bool verbose,
1049 ExecutionContextScope *exe_scope)
override;
1052 Stream *s,
const DataExtractor &data,
1065 static clang::EnumDecl *
GetAsEnumDecl(
const CompilerType &type);
1069 static clang::TagDecl *
GetAsTagDecl(
const CompilerType &type);
1073 static clang::CXXRecordDecl *
1076 static clang::ObjCInterfaceDecl *
1080 clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module,
1082 const TypeSystemClang::TemplateParameterInfos &template_param_infos);
1085 OptionalClangModuleID owning_module);
1087 clang::UsingDirectiveDecl *
1089 OptionalClangModuleID owning_module,
1090 clang::NamespaceDecl *ns_decl);
1093 OptionalClangModuleID owning_module,
1094 clang::NamedDecl *target);
1097 OptionalClangModuleID owning_module,
1099 clang::QualType type);
1106 return clang::QualType::getFromOpaquePtr(type);
1107 return clang::QualType();
1110 static clang::QualType
1113 return clang::QualType::getFromOpaquePtr(type).getCanonicalType();
1114 return clang::QualType();
1117 clang::DeclarationName
1147 bool qualified =
true);
1149 const clang::ClassTemplateSpecializationDecl *
1153 llvm::function_ref<
bool(clang::QualType)> predicate)
const;
1189 typedef llvm::DenseMap<const clang::CXXRecordDecl *, clang::AccessSpecifier>
1240 static std::optional<IsolatedASTKind>
1258 static lldb::TypeSystemClangSP
1260 std::optional<IsolatedASTKind> ast_kind =
DefaultAST,
1261 bool create_on_demand =
true);
1270 static lldb::TypeSystemClangSP
1276 void Dump(llvm::raw_ostream &output)
override;
1286 const Address &function_address,
1288 const char *name)
override;
1290 std::unique_ptr<UtilityFunction>
1301 bool isA(
const void *ClassID)
const override {
1330 llvm::DenseMap<IsolatedASTKey, std::shared_ptr<TypeSystemClang>>
A section + offset based address class.
Manages and observes all Clang AST node importing in LLDB.
Represents a generic declaration context in a program.
Represents a generic declaration such as a function declaration.
Generic representation of a type in a programming language.
A uniqued constant string class.
size_t GetLength() const
Get the length in bytes of string value.
const char * GetCString() const
Get the string value as a C string.
A class that describes the declaration location of a lldb object.
"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.
ValueType Clear(ValueType mask=~static_cast< ValueType >(0))
Clear one or more flags.
bool Test(ValueType bit) const
Test a single flag bit.
ValueType Set(ValueType mask)
Set one or more flags by logical OR'ing mask with the current flags.
Encapsulates a function that can be called.
A class that describes an executable image and its associated object and symbol files.
OptionalClangModuleID()=default
OptionalClangModuleID(unsigned id)
unsigned GetValue() const
The TypeSystemClang instance used for the scratch ASTContext in a lldb::Target.
static std::optional< IsolatedASTKind > InferIsolatedASTKindFromLangOpts(const clang::LangOptions &l)
Infers the appropriate sub-AST from Clang's LangOptions.
void Finalize() override
Free up any resources associated with this TypeSystem.
UserExpression * GetUserExpression(llvm::StringRef expr, llvm::StringRef prefix, lldb::LanguageType language, Expression::ResultType desired_type, const EvaluateExpressionOptions &options, ValueObject *ctx_obj) override
static lldb::TypeSystemClangSP GetForTarget(Target &target, std::optional< IsolatedASTKind > ast_kind=DefaultAST, bool create_on_demand=true)
Returns the scratch TypeSystemClang for the given target.
llvm::Triple m_triple
The target triple.
std::unique_ptr< ClangASTSource > CreateASTSource()
lldb::TargetWP m_target_wp
TypeSystemClang & GetIsolatedAST(IsolatedASTKind feature)
Returns the requested sub-AST.
std::unique_ptr< ClangASTSource > m_scratch_ast_source_up
The ExternalASTSource that performs lookups and completes minimally imported types.
IsolatedASTKind
The different kinds of isolated ASTs within the scratch TypeSystem.
@ CppModules
The isolated AST for declarations/types from expressions that imported type information from a C++ mo...
std::unique_ptr< ClangPersistentVariables > m_persistent_variables
The persistent variables associated with this process for the expression parser.
bool isA(const void *ClassID) const override
static char ID
LLVM RTTI support.
PersistentExpressionState * GetPersistentExpressionState() override
static lldb::TypeSystemClangSP GetForTarget(Target &target, const clang::LangOptions &lang_opts)
Returns the scratch TypeSystemClang for the given target.
~ScratchTypeSystemClang() override=default
FunctionCaller * GetFunctionCaller(const CompilerType &return_type, const Address &function_address, const ValueList &arg_value_list, const char *name) override
std::unique_ptr< UtilityFunction > CreateUtilityFunction(std::string text, std::string name) override
void ForgetSource(clang::ASTContext *src_ctx, ClangASTImporter &importer)
Unregisters the given ASTContext as a source from the scratch AST (and all sub-ASTs).
static bool classof(const TypeSystem *ts)
void Dump(llvm::raw_ostream &output) override
static const std::nullopt_t DefaultAST
Alias for requesting the default scratch TypeSystemClang in GetForTarget.
llvm::DenseMap< IsolatedASTKey, std::shared_ptr< TypeSystemClang > > m_isolated_asts
Map from IsolatedASTKind to their actual TypeSystemClang instance.
The implementation of lldb::Type's m_payload field for TypeSystemClang.
void SetIsCompleteObjCClass(bool is_complete_objc_class)
TypePayloadClang(uint32_t opaque_payload)
OptionalClangModuleID GetOwningModule()
bool IsCompleteObjCClass()
Type::Payload m_payload
The Layout is as follows:
TypePayloadClang()=default
void SetOwningModule(OptionalClangModuleID id)
static constexpr unsigned ObjCClassBit
void SetPackName(char const *name)
llvm::ArrayRef< clang::TemplateArgument > GetParameterPackArgs() const
TemplateParameterInfos & operator=(TemplateParameterInfos &&)=delete
TemplateParameterInfos()=default
void SetParameterPack(std::unique_ptr< TemplateParameterInfos > args)
std::unique_ptr< TemplateParameterInfos > packed_args
clang::TemplateArgument const & Front() const
TemplateParameterInfos & GetParameterPack()
TemplateParameterInfos(TemplateParameterInfos &&)=delete
void InsertArg(char const *name, clang::TemplateArgument arg)
llvm::StringRef GetPackName() const
TemplateParameterInfos & operator=(TemplateParameterInfos const &)=delete
TemplateParameterInfos(TemplateParameterInfos const &)=delete
bool hasParameterPack() const
TemplateParameterInfos(llvm::ArrayRef< const char * > names_in, llvm::ArrayRef< clang::TemplateArgument > args_in)
llvm::SmallVector< clang::TemplateArgument, 2 > args
llvm::SmallVector< const char *, 2 > names
Element 'names[i]' holds the template argument name of 'args[i]'.
TemplateParameterInfos const & GetParameterPack() const
llvm::ArrayRef< const char * > GetNames() const
~TemplateParameterInfos()=default
llvm::ArrayRef< clang::TemplateArgument > GetArgs() const
A TypeSystem implementation based on Clang.
bool IsMemberFunctionPointerType(lldb::opaque_compiler_type_t type) override
clang::TranslationUnitDecl * GetTranslationUnitDecl()
size_t GetIndexOfChildMemberWithName(lldb::opaque_compiler_type_t type, llvm::StringRef name, bool omit_empty_base_classes, std::vector< uint32_t > &child_indexes) override
static clang::TypedefNameDecl * GetAsTypedefDecl(const CompilerType &type)
std::string GetTypeNameForDecl(const clang::NamedDecl *named_decl, bool qualified=true)
Returns the internal type name for the given NamedDecl using the type printing policy.
static clang::ObjCInterfaceDecl * GetAsObjCInterfaceDecl(const CompilerType &type)
uint32_t m_pointer_byte_size
std::string m_display_name
A string describing what this TypeSystemClang represents (e.g., AST for debug information,...
void SetMetadata(const clang::Decl *object, ClangASTMetadata &meta_data)
uint32_t GetNumChildren(lldb::opaque_compiler_type_t type, bool omit_empty_base_classes, const ExecutionContext *exe_ctx) override
CompilerType GetChildCompilerTypeAtIndex(lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx, size_t idx, bool transparent_pointers, bool omit_empty_base_classes, bool ignore_array_bounds, std::string &child_name, uint32_t &child_byte_size, int32_t &child_byte_offset, uint32_t &child_bitfield_bit_size, uint32_t &child_bitfield_bit_offset, bool &child_is_base_class, bool &child_is_deref_of_parent, ValueObject *valobj, uint64_t &language_flags) override
ConstString GetTypeName(lldb::opaque_compiler_type_t type, bool base_only) override
static void SetOwningModule(clang::Decl *decl, OptionalClangModuleID owning_module)
Set the owning module for decl.
std::unique_ptr< clang::TargetInfo > m_target_info_up
std::unique_ptr< clang::LangOptions > m_language_options_up
static clang::DeclContext * GetAsDeclContext(clang::FunctionDecl *function_decl)
bool BaseSpecifierIsEmpty(const clang::CXXBaseSpecifier *b)
static uint32_t GetNumPointeeChildren(clang::QualType type)
ConstString DeclGetMangledName(void *opaque_decl) override
CompilerType GetBasicType(lldb::BasicType type)
clang::ClassTemplateDecl * CreateClassTemplateDecl(clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, lldb::AccessType access_type, llvm::StringRef class_name, int kind, const TemplateParameterInfos &infos)
void SetExternalSource(llvm::IntrusiveRefCntPtr< clang::ExternalASTSource > &ast_source_up)
clang::UsingDecl * CreateUsingDeclaration(clang::DeclContext *current_decl_ctx, OptionalClangModuleID owning_module, clang::NamedDecl *target)
static clang::AccessSpecifier ConvertAccessTypeToAccessSpecifier(lldb::AccessType access)
CompilerType GetNonReferenceType(lldb::opaque_compiler_type_t type) override
std::optional< uint64_t > GetByteSize(lldb::opaque_compiler_type_t type, ExecutionContextScope *exe_scope)
bool IsForcefullyCompleted(lldb::opaque_compiler_type_t type) override
bool SupportsLanguage(lldb::LanguageType language) override
uint32_t GetNumDirectBaseClasses(lldb::opaque_compiler_type_t type) override
OptionalClangModuleID GetOrCreateClangModule(llvm::StringRef name, OptionalClangModuleID parent, bool is_framework=false, bool is_explicit=false)
Synthesize a clang::Module and return its ID or a default-constructed ID.
void CompleteTagDecl(clang::TagDecl *)
static clang::FieldDecl * AddFieldToRecordType(const CompilerType &type, llvm::StringRef name, const CompilerType &field_type, lldb::AccessType access, uint32_t bitfield_bit_size)
std::shared_ptr< clang::TargetOptions > & getTargetOptions()
static TypeSystemClang * GetASTContext(clang::ASTContext *ast_ctx)
bool IsReferenceType(lldb::opaque_compiler_type_t type, CompilerType *pointee_type, bool *is_rvalue) override
CompilerType GetBuiltinTypeForEncodingAndBitSize(lldb::Encoding encoding, size_t bit_size) override
const char * GetTargetTriple()
TypeSystemClang(const TypeSystemClang &)
static lldb::TypeSystemSP CreateInstance(lldb::LanguageType language, Module *module, Target *target)
clang::TargetInfo * getTargetInfo()
clang::FunctionTemplateDecl * CreateFunctionTemplateDecl(clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, clang::FunctionDecl *func_decl, const TemplateParameterInfos &infos)
static bool AreTypesSame(CompilerType type1, CompilerType type2, bool ignore_qualifiers=false)
std::optional< uint64_t > GetBitSize(lldb::opaque_compiler_type_t type, ExecutionContextScope *exe_scope) override
void DumpSummary(lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx, Stream *s, const DataExtractor &data, lldb::offset_t data_offset, size_t data_byte_size) override
CompilerType GetArrayType(lldb::opaque_compiler_type_t type, uint64_t size) override
bool IsFunctionType(lldb::opaque_compiler_type_t type) override
CompilerType GetFunctionReturnType(lldb::opaque_compiler_type_t type) override
static bool IsObjCClassTypeAndHasIVars(const CompilerType &type, bool check_superclass)
CompilerType GetLValueReferenceType(lldb::opaque_compiler_type_t type) override
bool SetDeclIsForcefullyCompleted(const clang::TagDecl *td)
lldb::Format GetFormat(lldb::opaque_compiler_type_t type) override
bool IsCStringType(lldb::opaque_compiler_type_t type, uint32_t &length) override
bool CanPassInRegisters(const CompilerType &type) override
static clang::DeclContext * GetDeclContextForType(clang::QualType type)
bool IsFloatingPointType(lldb::opaque_compiler_type_t type, uint32_t &count, bool &is_complex) override
bool IsEnumerationType(lldb::opaque_compiler_type_t type, bool &is_signed) override
bool IsTemplateType(lldb::opaque_compiler_type_t type) override
CompilerType GetTypeTemplateArgument(lldb::opaque_compiler_type_t type, size_t idx, bool expand_pack) override
llvm::DenseMap< const clang::CXXRecordDecl *, clang::AccessSpecifier > CXXRecordDeclAccessMap
static bool IsCXXClassType(const CompilerType &type)
bool IsIntegerType(lldb::opaque_compiler_type_t type, bool &is_signed) override
void SetCXXRecordDeclAccess(const clang::CXXRecordDecl *object, clang::AccessSpecifier access)
static bool AddObjCClassProperty(const CompilerType &type, const char *property_name, const CompilerType &property_compiler_type, clang::ObjCIvarDecl *ivar_decl, const char *property_setter_name, const char *property_getter_name, uint32_t property_attributes, ClangASTMetadata *metadata)
uint32_t GetNumFields(lldb::opaque_compiler_type_t type) override
static bool IsOperator(llvm::StringRef name, clang::OverloadedOperatorKind &op_kind)
bool IsCharType(lldb::opaque_compiler_type_t type) override
static void SetFloatingInitializerForVariable(clang::VarDecl *var, const llvm::APFloat &init_value)
Initializes a variable with a floating point value.
uint32_t GetTypeInfo(lldb::opaque_compiler_type_t type, CompilerType *pointee_or_element_compiler_type) override
CompilerType GetType(clang::QualType qt)
Creates a CompilerType from the given QualType with the current TypeSystemClang instance as the Compi...
static clang::TagDecl * GetAsTagDecl(const CompilerType &type)
ConstString GetDisplayTypeName(lldb::opaque_compiler_type_t type) override
std::string m_target_triple
bool TransferBaseClasses(lldb::opaque_compiler_type_t type, std::vector< std::unique_ptr< clang::CXXBaseSpecifier > > bases)
bool IsBeingDefined(lldb::opaque_compiler_type_t type) override
ConstString DeclContextGetScopeQualifiedName(void *opaque_decl_ctx) override
std::unique_ptr< clang::IdentifierTable > m_identifier_table_up
static void SetIntegerInitializerForVariable(clang::VarDecl *var, const llvm::APInt &init_value)
Initializes a variable with an integer value.
bool IsPolymorphicClass(lldb::opaque_compiler_type_t type) override
CompilerType GetFieldAtIndex(lldb::opaque_compiler_type_t type, size_t idx, std::string &name, uint64_t *bit_offset_ptr, uint32_t *bitfield_bit_size_ptr, bool *is_bitfield_ptr) override
bool LayoutRecordType(const clang::RecordDecl *record_decl, uint64_t &size, uint64_t &alignment, llvm::DenseMap< const clang::FieldDecl *, uint64_t > &field_offsets, llvm::DenseMap< const clang::CXXRecordDecl *, clang::CharUnits > &base_offsets, llvm::DenseMap< const clang::CXXRecordDecl *, clang::CharUnits > &vbase_offsets)
bool IsScopedEnumerationType(lldb::opaque_compiler_type_t type) override
std::unique_ptr< clang::SourceManager > m_source_manager_up
bool IsVoidType(lldb::opaque_compiler_type_t type) override
static void SetIsPacked(const CompilerType &type)
void ForEachEnumerator(lldb::opaque_compiler_type_t type, std::function< bool(const CompilerType &integer_type, ConstString name, const llvm::APSInt &value)> const &callback) override
clang::AccessSpecifier GetCXXRecordDeclAccess(const clang::CXXRecordDecl *object)
CompilerType CreateClassTemplateSpecializationType(clang::ClassTemplateSpecializationDecl *class_template_specialization_decl)
static bool classof(const TypeSystem *ts)
bool IsPointerType(lldb::opaque_compiler_type_t type, CompilerType *pointee_type) override
void DumpValue(lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx, Stream *s, lldb::Format format, const DataExtractor &data, lldb::offset_t data_offset, size_t data_byte_size, uint32_t bitfield_bit_size, uint32_t bitfield_bit_offset, bool show_types, bool show_summary, bool verbose, uint32_t depth) override
void CreateFunctionTemplateSpecializationInfo(clang::FunctionDecl *func_decl, clang::FunctionTemplateDecl *Template, const TemplateParameterInfos &infos)
void(* CompleteObjCInterfaceDeclCallback)(void *baton, clang::ObjCInterfaceDecl *)
llvm::StringRef getDisplayName() const
Returns the display name of this TypeSystemClang that indicates what purpose it serves in LLDB.
CompilerType GetRValueReferenceType(lldb::opaque_compiler_type_t type) override
llvm::StringRef GetPluginName() override
CompilerDecl GetCompilerDecl(clang::Decl *decl)
Creates a CompilerDecl from the given Decl with the current TypeSystemClang instance as its typesyste...
CompilerType GetPointeeType(lldb::opaque_compiler_type_t type) override
bool GetCompleteType(lldb::opaque_compiler_type_t type) override
bool IsBlockPointerType(lldb::opaque_compiler_type_t type, CompilerType *function_pointer_type_ptr) override
bool IsConst(lldb::opaque_compiler_type_t type) override
static clang::AccessSpecifier UnifyAccessSpecifiers(clang::AccessSpecifier lhs, clang::AccessSpecifier rhs)
std::unique_ptr< clang::CXXBaseSpecifier > CreateBaseClassSpecifier(lldb::opaque_compiler_type_t type, lldb::AccessType access, bool is_virtual, bool base_of_class)
CompilerType GetEnumerationIntegerType(lldb::opaque_compiler_type_t type) override
std::vector< CompilerDecl > DeclContextFindDeclByName(void *opaque_decl_ctx, ConstString name, const bool ignore_using_decls) override
void setSema(clang::Sema *s)
uint32_t GetPointerByteSize() override
bool IsCompleteType(lldb::opaque_compiler_type_t type) override
bool isA(const void *ClassID) const override
void Dump(llvm::raw_ostream &output) override
CompilerType GetIntTypeFromBitSize(size_t bit_size, bool is_signed)
clang::MangleContext * getMangleContext()
void CompleteObjCInterfaceDecl(clang::ObjCInterfaceDecl *)
CompilerType GetTypeForIdentifier(ConstString type_name, clang::DeclContext *decl_context=nullptr)
std::string PrintTemplateParams(const TemplateParameterInfos &template_param_infos)
Return the template parameters (including surrounding <>) in string form.
static void DumpDeclContextHiearchy(clang::DeclContext *decl_ctx)
TypeSystemClang(llvm::StringRef name, clang::ASTContext &existing_ctxt)
Constructs a TypeSystemClang that uses an existing ASTContext internally.
CompilerDeclContext CreateDeclContext(clang::DeclContext *ctx)
Creates a CompilerDeclContext from the given DeclContext with the current TypeSystemClang instance as...
CompilerType GetTypeForFormatters(void *type) override
void SetMetadataAsUserID(const clang::Decl *decl, lldb::user_id_t user_id)
bool IsRuntimeGeneratedType(lldb::opaque_compiler_type_t type) override
const TypeSystemClang & operator=(const TypeSystemClang &)
static LanguageSet GetSupportedLanguagesForExpressions()
CompilerType GetTypedefedType(lldb::opaque_compiler_type_t type) override
std::unique_ptr< clang::SelectorTable > m_selector_table_up
PDBASTParser * GetPDBParser() override
std::optional< CompilerType::IntegralTemplateArgument > GetIntegralTemplateArgument(lldb::opaque_compiler_type_t type, size_t idx, bool expand_pack) override
bool DeclContextIsClassMethod(void *opaque_decl_ctx) override
CompilerType GetTypeForDecl(clang::ObjCInterfaceDecl *objc_decl)
void SetTargetTriple(llvm::StringRef target_triple)
CompilerType GetVirtualBaseClassAtIndex(lldb::opaque_compiler_type_t type, size_t idx, uint32_t *bit_offset_ptr) override
static bool CheckOverloadedOperatorKindParameterCount(bool is_method, clang::OverloadedOperatorKind op_kind, uint32_t num_params)
clang::DeclarationName GetDeclarationName(llvm::StringRef name, const CompilerType &function_clang_type)
DeclMetadataMap m_decl_metadata
Maps Decls to their associated ClangASTMetadata.
static clang::CXXMethodDecl * DeclContextGetAsCXXMethodDecl(const CompilerDeclContext &dc)
CompilerType GetFullyUnqualifiedType(lldb::opaque_compiler_type_t type) override
uint32_t CountDeclLevels(clang::DeclContext *frame_decl_ctx, clang::DeclContext *child_decl_ctx, ConstString *child_name=nullptr, CompilerType *child_type=nullptr)
static clang::QualType GetQualType(lldb::opaque_compiler_type_t type)
clang::PrintingPolicy GetTypePrintingPolicy()
Returns the PrintingPolicy used when generating the internal type names.
uint32_t GetNumVirtualBaseClasses(lldb::opaque_compiler_type_t type) override
static clang::RecordDecl * GetAsRecordDecl(const CompilerType &type)
CompilerType GetPointerSizedIntType(bool is_signed)
clang::FunctionDecl * CreateFunctionDeclaration(clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, llvm::StringRef name, const CompilerType &function_Type, clang::StorageClass storage, bool is_inline)
uint32_t GetNumBaseClasses(const clang::CXXRecordDecl *cxx_record_decl, bool omit_empty_base_classes)
lldb::LanguageType DeclContextGetLanguage(void *opaque_decl_ctx) override
std::unique_ptr< DWARFASTParserClang > m_dwarf_ast_parser_up
CompilerType GetBuiltinTypeForDWARFEncodingAndBitSize(llvm::StringRef type_name, uint32_t dw_ate, uint32_t bit_size)
bool IsFunctionPointerType(lldb::opaque_compiler_type_t type) override
int GetFunctionArgumentCount(lldb::opaque_compiler_type_t type) override
static void BuildIndirectFields(const CompilerType &type)
std::unique_ptr< clang::FileManager > m_file_manager_up
uint32_t GetIndexForRecordBase(const clang::RecordDecl *record_decl, const clang::CXXBaseSpecifier *base_spec, bool omit_empty_base_classes)
bool IsAnonymousType(lldb::opaque_compiler_type_t type) override
bool Verify(lldb::opaque_compiler_type_t type) override
Verify the integrity of the type to catch CompilerTypes that mix and match invalid TypeSystem/Opaque ...
void(* CompleteTagDeclCallback)(void *baton, clang::TagDecl *)
size_t GetNumberOfFunctionArguments(lldb::opaque_compiler_type_t type) override
void AddMethodOverridesForCXXRecordType(lldb::opaque_compiler_type_t type)
CompilerType CreateBlockPointerType(const CompilerType &function_type)
lldb::LanguageType GetMinimumLanguage(lldb::opaque_compiler_type_t type) override
bool FieldIsBitfield(clang::FieldDecl *field, uint32_t &bitfield_bit_size)
clang::ClassTemplateSpecializationDecl * CreateClassTemplateSpecializationDecl(clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, clang::ClassTemplateDecl *class_template_decl, int kind, const TemplateParameterInfos &infos)
clang::SourceManager * GetSourceMgr() const
std::unique_ptr< clang::HeaderSearch > m_header_search_up
void Finalize() override
Free up any resources associated with this TypeSystem.
static lldb::BasicType GetBasicTypeEnumeration(ConstString name)
clang::CXXMethodDecl * AddMethodToCXXRecordType(lldb::opaque_compiler_type_t type, llvm::StringRef name, const char *mangled_name, const CompilerType &method_type, lldb::AccessType access, bool is_virtual, bool is_static, bool is_inline, bool is_explicit, bool is_attr_used, bool is_artificial)
static clang::ASTContext * DeclContextGetTypeSystemClang(const CompilerDeclContext &dc)
uint32_t IsHomogeneousAggregate(lldb::opaque_compiler_type_t type, CompilerType *base_type_ptr) override
clang::EnumConstantDecl * AddEnumerationValueToEnumerationType(const CompilerType &enum_type, const Declaration &decl, const char *name, int64_t enum_value, uint32_t enum_value_bit_size)
LLVM_DUMP_METHOD void dump(lldb::opaque_compiler_type_t type) const override
Convenience LLVM-style dump method for use in the debugger only.
CXXRecordDeclAccessMap m_cxx_record_decl_access
Maps CXXRecordDecl to their most recent added method/field's AccessSpecifier.
static CompilerType GetFloatTypeFromBitSize(clang::ASTContext *ast, size_t bit_size)
clang::NamespaceDecl * GetUniqueNamespaceDeclaration(const char *name, clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, bool is_inline=false)
std::unique_ptr< clang::ASTContext > m_ast_up
static clang::QualType GetCanonicalQualType(lldb::opaque_compiler_type_t type)
CompilerType DeclGetFunctionReturnType(void *opaque_decl) override
static bool IsEnumType(lldb::opaque_compiler_type_t type)
std::unique_ptr< npdb::PdbAstBuilder > m_native_pdb_ast_parser_up
static clang::CXXRecordDecl * GetAsCXXRecordDecl(lldb::opaque_compiler_type_t type)
static bool SetObjCSuperClass(const CompilerType &type, const CompilerType &superclass_compiler_type)
clang::UsingDirectiveDecl * CreateUsingDirectiveDeclaration(clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, clang::NamespaceDecl *ns_decl)
static lldb::opaque_compiler_type_t GetOpaqueCompilerType(clang::ASTContext *ast, lldb::BasicType basic_type)
bool IsArrayType(lldb::opaque_compiler_type_t type, CompilerType *element_type, uint64_t *size, bool *is_incomplete) override
void DumpFromSymbolFile(Stream &s, llvm::StringRef symbol_name)
Dump clang AST types from the symbol file.
CompilerType AddConstModifier(lldb::opaque_compiler_type_t type) override
static void DumpDeclHiearchy(clang::Decl *decl)
static clang::ObjCMethodDecl * DeclContextGetAsObjCMethodDecl(const CompilerDeclContext &dc)
static clang::FunctionDecl * DeclContextGetAsFunctionDecl(const CompilerDeclContext &dc)
bool IsScalarType(lldb::opaque_compiler_type_t type) override
CompilerType GetOrCreateStructForIdentifier(ConstString type_name, const std::initializer_list< std::pair< const char *, CompilerType > > &type_fields, bool packed=false)
std::shared_ptr< clang::TargetOptions > m_target_options_rp
lldb::TypeClass GetTypeClass(lldb::opaque_compiler_type_t type) override
static bool IsClassType(lldb::opaque_compiler_type_t type)
bool IsDefined(lldb::opaque_compiler_type_t type) override
static bool IsObjCClassType(const CompilerType &type)
TypeMetadataMap m_type_metadata
Maps Types to their associated ClangASTMetadata.
clang::ASTContext & getASTContext()
Returns the clang::ASTContext instance managed by this TypeSystemClang.
const llvm::fltSemantics & GetFloatTypeSemantics(size_t byte_size) override
CompilerType GetCanonicalType(lldb::opaque_compiler_type_t type) override
bool RecordHasFields(const clang::RecordDecl *record_decl)
static clang::ObjCMethodDecl * AddMethodToObjCObjectType(const CompilerType &type, const char *name, const CompilerType &method_compiler_type, lldb::AccessType access, bool is_artificial, bool is_variadic, bool is_objc_direct_call)
CompilerType GetFunctionArgumentAtIndex(lldb::opaque_compiler_type_t type, const size_t index) override
static bool CompleteTagDeclarationDefinition(const CompilerType &type)
unsigned GetTypeQualifiers(lldb::opaque_compiler_type_t type) override
bool DumpTypeValue(lldb::opaque_compiler_type_t type, Stream *s, lldb::Format format, const DataExtractor &data, lldb::offset_t data_offset, size_t data_byte_size, uint32_t bitfield_bit_size, uint32_t bitfield_bit_offset, ExecutionContextScope *exe_scope) override
~TypeSystemClang() override
CompilerDeclContext DeclGetDeclContext(void *opaque_decl) override
bool DeclContextIsContainedInLookup(void *opaque_decl_ctx, void *other_opaque_decl_ctx) override
static bool SetHasExternalStorage(lldb::opaque_compiler_type_t type, bool has_extern)
CompilerType CreateEnumerationType(llvm::StringRef name, clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, const Declaration &decl, const CompilerType &integer_qual_type, bool is_scoped)
clang::ParmVarDecl * CreateParameterDeclaration(clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, const char *name, const CompilerType ¶m_type, int storage, bool add_decl=false)
void DumpTypeDescription(lldb::opaque_compiler_type_t type, lldb::DescriptionLevel level=lldb::eDescriptionLevelFull) override
Dump the type to stdout.
CompilerType GetFunctionArgumentTypeAtIndex(lldb::opaque_compiler_type_t type, size_t idx) override
static clang::NamespaceDecl * DeclContextGetAsNamespaceDecl(const CompilerDeclContext &dc)
npdb::PdbAstBuilder * GetNativePDBParser() override
std::unique_ptr< clang::DiagnosticConsumer > m_diagnostic_consumer_up
CompilerType GetTypeForDecl(clang::TagDecl *decl)
CompilerType CreateArrayType(const CompilerType &element_type, size_t element_count, bool is_vector)
CompilerType GetTypeForDecl(clang::NamedDecl *decl)
CompilerType GetDirectBaseClassAtIndex(lldb::opaque_compiler_type_t type, size_t idx, uint32_t *bit_offset_ptr) override
ClangASTMetadata * GetMetadata(const clang::Decl *object)
CompilerType GetArrayElementType(lldb::opaque_compiler_type_t type, ExecutionContextScope *exe_scope) override
static clang::DeclContext * DeclContextGetAsDeclContext(const CompilerDeclContext &dc)
lldb::Encoding GetEncoding(lldb::opaque_compiler_type_t type, uint64_t &count) override
bool IsTypedefType(lldb::opaque_compiler_type_t type) override
CompilerType GetPointerType(lldb::opaque_compiler_type_t type) override
std::optional< size_t > GetTypeBitAlign(lldb::opaque_compiler_type_t type, ExecutionContextScope *exe_scope) override
CompilerType CreateStructForIdentifier(ConstString type_name, const std::initializer_list< std::pair< const char *, CompilerType > > &type_fields, bool packed=false)
std::unique_ptr< clang::Builtin::Context > m_builtins_up
CompilerType GetBuiltinTypeByName(ConstString name) override
bool GetCompleteDecl(clang::Decl *decl)
static bool StartTagDeclarationDefinition(const CompilerType &type)
uint32_t GetIndexForRecordChild(const clang::RecordDecl *record_decl, clang::NamedDecl *canonical_decl, bool omit_empty_base_classes)
bool IsPossibleDynamicType(lldb::opaque_compiler_type_t type, CompilerType *target_type, bool check_cplusplus, bool check_objc) override
static ClangASTMetadata * DeclContextGetMetaData(const CompilerDeclContext &dc, const clang::Decl *object)
static llvm::StringRef GetPluginNameStatic()
clang::Sema * m_sema
The sema associated that is currently used to build this ASTContext.
size_t GetNumMemberFunctions(lldb::opaque_compiler_type_t type) override
clang::LangOptions * GetLangOpts() const
static clang::VarDecl * AddVariableToRecordType(const CompilerType &type, llvm::StringRef name, const CompilerType &var_type, lldb::AccessType access)
CompilerType GetBasicTypeFromAST(lldb::BasicType basic_type) override
const clang::ClassTemplateSpecializationDecl * GetAsTemplateSpecialization(lldb::opaque_compiler_type_t type)
std::unique_ptr< clang::MangleContext > m_mangle_ctx_up
TypeMemberFunctionImpl GetMemberFunctionAtIndex(lldb::opaque_compiler_type_t type, size_t idx) override
bool IsTypeImpl(lldb::opaque_compiler_type_t type, llvm::function_ref< bool(clang::QualType)> predicate) const
size_t DeclGetFunctionNumArguments(void *opaque_decl) override
CompilerType CreateFunctionType(const CompilerType &result_type, const CompilerType *args, unsigned num_args, bool is_variadic, unsigned type_quals, clang::CallingConv cc=clang::CC_C, clang::RefQualifierKind ref_qual=clang::RQ_None)
CompilerType GetAtomicType(lldb::opaque_compiler_type_t type) override
std::unique_ptr< PDBASTParser > m_pdb_ast_parser_up
std::unique_ptr< clang::DiagnosticsEngine > m_diagnostics_engine_up
static std::optional< std::string > GetCXXClassName(const CompilerType &type)
static void DumpTypeName(const CompilerType &type)
DWARFASTParser * GetDWARFParser() override
CompilerType DeclGetFunctionArgumentType(void *opaque_decl, size_t arg_idx) override
bool IsPointerOrReferenceType(lldb::opaque_compiler_type_t type, CompilerType *pointee_type) override
static clang::EnumDecl * GetAsEnumDecl(const CompilerType &type)
CompilerType AddVolatileModifier(lldb::opaque_compiler_type_t type) override
std::unique_ptr< clang::ModuleMap > m_module_map_up
CompilerType CreateObjCClass(llvm::StringRef name, clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, bool isForwardDecl, bool isInternal, ClangASTMetadata *metadata=nullptr)
void SetFunctionParameters(clang::FunctionDecl *function_decl, llvm::ArrayRef< clang::ParmVarDecl * > params)
static bool IsObjCObjectOrInterfaceType(const CompilerType &type)
CompilerType CreateRecordType(clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, lldb::AccessType access_type, llvm::StringRef name, int kind, lldb::LanguageType language, ClangASTMetadata *metadata=nullptr, bool exports_symbols=false)
static void RequireCompleteType(CompilerType type)
Complete a type from debug info, or mark it as forcefully completed if there is no definition of the ...
CompilerType CreateTypedef(lldb::opaque_compiler_type_t type, const char *name, const CompilerDeclContext &decl_ctx, uint32_t opaque_payload) override
Using the current type, create a new typedef to that type using "typedef_name" as the name and "decl_...
llvm::DenseMap< const clang::Type *, ClangASTMetadata > TypeMetadataMap
CompilerType AddRestrictModifier(lldb::opaque_compiler_type_t type) override
clang::TemplateTemplateParmDecl * CreateTemplateTemplateParmDecl(const char *template_name)
lldb::TemplateArgumentKind GetTemplateArgumentKind(lldb::opaque_compiler_type_t type, size_t idx, bool expand_pack) override
clang::ClassTemplateDecl * ParseClassTemplateDecl(clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, lldb::AccessType access_type, const char *parent_name, int tag_decl_kind, const TypeSystemClang::TemplateParameterInfos &template_param_infos)
static CompilerType CreateMemberPointerType(const CompilerType &type, const CompilerType &pointee_type)
void CreateASTContext()
Creates the internal ASTContext.
CompilerType GetCStringType(bool is_const)
bool IsAggregateType(lldb::opaque_compiler_type_t type) override
uint32_t GetIndexOfChildWithName(lldb::opaque_compiler_type_t type, llvm::StringRef name, bool omit_empty_base_classes) override
static bool IsObjCObjectPointerType(const CompilerType &type, CompilerType *target_type=nullptr)
bool IsVectorType(lldb::opaque_compiler_type_t type, CompilerType *element_type, uint64_t *size) override
static bool DeclsAreEquivalent(clang::Decl *lhs_decl, clang::Decl *rhs_decl)
static lldb::BasicType GetBasicTypeEnumeration(lldb::opaque_compiler_type_t type, ConstString name)
static LanguageSet GetSupportedLanguagesForTypes()
clang::VarDecl * CreateVariableDeclaration(clang::DeclContext *decl_context, OptionalClangModuleID owning_module, const char *name, clang::QualType type)
clang::BlockDecl * CreateBlockDeclaration(clang::DeclContext *ctx, OptionalClangModuleID owning_module)
llvm::DenseMap< const clang::Decl *, ClangASTMetadata > DeclMetadataMap
ConstString DeclContextGetName(void *opaque_decl_ctx) override
size_t GetNumTemplateArguments(lldb::opaque_compiler_type_t type, bool expand_pack) override
ConstString DeclGetName(void *opaque_decl) override
Interface for representing a type system.
virtual bool isA(const void *ClassID) const =0
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
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
BasicType
Basic types enumeration for the public API SBType::GetBasicType().
Format
Display format definitions.
LanguageType
Programming language type.
Encoding
Register encoding definitions.
A SmallBitVector that represents a set of source languages (lldb::LanguageType).