#include "TypeSystemClang.h"
#include "clang/AST/DeclBase.h"
#include "clang/AST/ExprCXX.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/FormatAdapters.h"
#include "llvm/Support/FormatVariadic.h"
#include <mutex>
#include <memory>
#include <string>
#include <vector>
#include "clang/AST/ASTContext.h"
#include "clang/AST/ASTImporter.h"
#include "clang/AST/Attr.h"
#include "clang/AST/CXXInheritance.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/DeclTemplate.h"
#include "clang/AST/Mangle.h"
#include "clang/AST/RecordLayout.h"
#include "clang/AST/Type.h"
#include "clang/AST/VTableBuilder.h"
#include "clang/Basic/Builtins.h"
#include "clang/Basic/Diagnostic.h"
#include "clang/Basic/FileManager.h"
#include "clang/Basic/FileSystemOptions.h"
#include "clang/Basic/LangStandard.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Basic/TargetOptions.h"
#include "clang/Frontend/FrontendOptions.h"
#include "clang/Lex/HeaderSearch.h"
#include "clang/Lex/HeaderSearchOptions.h"
#include "clang/Lex/ModuleMap.h"
#include "clang/Sema/Sema.h"
#include "llvm/Support/Signals.h"
#include "llvm/Support/Threading.h"
#include "Plugins/ExpressionParser/Clang/ClangASTImporter.h"
#include "Plugins/ExpressionParser/Clang/ClangASTMetadata.h"
#include "Plugins/ExpressionParser/Clang/ClangExternalASTSourceCallbacks.h"
#include "Plugins/ExpressionParser/Clang/ClangFunctionCaller.h"
#include "Plugins/ExpressionParser/Clang/ClangPersistentVariables.h"
#include "Plugins/ExpressionParser/Clang/ClangUserExpression.h"
#include "Plugins/ExpressionParser/Clang/ClangUtil.h"
#include "Plugins/ExpressionParser/Clang/ClangUtilityFunction.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/DumpDataExtractor.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/UniqueCStringMap.h"
#include "lldb/Host/StreamFile.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/SymbolFile.h"
#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/Language.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/DataExtractor.h"
#include "lldb/Utility/Flags.h"
#include "lldb/Utility/LLDBAssert.h"
#include "lldb/Utility/LLDBLog.h"
#include "lldb/Utility/RegularExpression.h"
#include "lldb/Utility/Scalar.h"
#include "lldb/Utility/ThreadSafeDenseMap.h"
#include "Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h"
#include "Plugins/SymbolFile/DWARF/DWARFASTParserClang.h"
#include "Plugins/SymbolFile/PDB/PDBASTParser.h"
#include "Plugins/SymbolFile/NativePDB/PdbAstBuilder.h"
#include <cstdio>
#include <mutex>
#include <optional>
usingnamespacelldb;
usingnamespacelldb_private;
usingnamespacelldb_private::dwarf;
usingnamespacelldb_private::plugin::dwarf;
usingnamespaceclang;
StringSwitch;
LLDB_PLUGIN_DEFINE(…)
namespace {
static void VerifyDecl(clang::Decl *decl) { … }
static inline bool
TypeSystemClangSupportsLanguage(lldb::LanguageType language) { … }
bool isOverload(clang::CXXMethodDecl *m1, clang::CXXMethodDecl *m2) { … }
void addOverridesForMethod(clang::CXXMethodDecl *decl) { … }
}
static lldb::addr_t GetVTableAddress(Process &process,
VTableContextBase &vtable_ctx,
ValueObject &valobj,
const ASTRecordLayout &record_layout) { … }
static int64_t ReadVBaseOffsetFromVTable(Process &process,
VTableContextBase &vtable_ctx,
lldb::addr_t vtable_ptr,
const CXXRecordDecl *cxx_record_decl,
const CXXRecordDecl *base_class_decl) { … }
static bool GetVBaseBitOffset(VTableContextBase &vtable_ctx,
ValueObject &valobj,
const ASTRecordLayout &record_layout,
const CXXRecordDecl *cxx_record_decl,
const CXXRecordDecl *base_class_decl,
int32_t &bit_offset) { … }
ClangASTMap;
static ClangASTMap &GetASTMap() { … }
TypePayloadClang::TypePayloadClang(OptionalClangModuleID owning_module,
bool is_complete_objc_class)
: … { … }
void TypePayloadClang::SetOwningModule(OptionalClangModuleID id) { … }
static void SetMemberOwningModule(clang::Decl *member,
const clang::Decl *parent) { … }
char TypeSystemClang::ID;
bool TypeSystemClang::IsOperator(llvm::StringRef name,
clang::OverloadedOperatorKind &op_kind) { … }
clang::AccessSpecifier
TypeSystemClang::ConvertAccessTypeToAccessSpecifier(AccessType access) { … }
static void ParseLangArgs(LangOptions &Opts, ArchSpec arch) { … }
TypeSystemClang::TypeSystemClang(llvm::StringRef name,
llvm::Triple target_triple) { … }
TypeSystemClang::TypeSystemClang(llvm::StringRef name,
ASTContext &existing_ctxt) { … }
TypeSystemClang::~TypeSystemClang() { … }
lldb::TypeSystemSP TypeSystemClang::CreateInstance(lldb::LanguageType language,
lldb_private::Module *module,
Target *target) { … }
LanguageSet TypeSystemClang::GetSupportedLanguagesForTypes() { … }
LanguageSet TypeSystemClang::GetSupportedLanguagesForExpressions() { … }
void TypeSystemClang::Initialize() { … }
void TypeSystemClang::Terminate() { … }
void TypeSystemClang::Finalize() { … }
void TypeSystemClang::setSema(Sema *s) { … }
const char *TypeSystemClang::GetTargetTriple() { … }
void TypeSystemClang::SetTargetTriple(llvm::StringRef target_triple) { … }
void TypeSystemClang::SetExternalSource(
llvm::IntrusiveRefCntPtr<ExternalASTSource> &ast_source_up) { … }
ASTContext &TypeSystemClang::getASTContext() const { … }
class NullDiagnosticConsumer : public DiagnosticConsumer { … };
void TypeSystemClang::CreateASTContext() { … }
TypeSystemClang *TypeSystemClang::GetASTContext(clang::ASTContext *ast) { … }
clang::MangleContext *TypeSystemClang::getMangleContext() { … }
std::shared_ptr<clang::TargetOptions> &TypeSystemClang::getTargetOptions() { … }
TargetInfo *TypeSystemClang::getTargetInfo() { … }
#pragma mark Basic Types
static inline bool QualTypeMatchesBitSize(const uint64_t bit_size,
ASTContext &ast, QualType qual_type) { … }
CompilerType
TypeSystemClang::GetBuiltinTypeForEncodingAndBitSize(Encoding encoding,
size_t bit_size) { … }
lldb::BasicType TypeSystemClang::GetBasicTypeEnumeration(llvm::StringRef name) { … }
uint32_t TypeSystemClang::GetPointerByteSize() { … }
CompilerType TypeSystemClang::GetBasicType(lldb::BasicType basic_type) { … }
CompilerType TypeSystemClang::GetBuiltinTypeForDWARFEncodingAndBitSize(
llvm::StringRef type_name, uint32_t dw_ate, uint32_t bit_size) { … }
CompilerType TypeSystemClang::GetCStringType(bool is_const) { … }
bool TypeSystemClang::AreTypesSame(CompilerType type1, CompilerType type2,
bool ignore_qualifiers) { … }
CompilerType TypeSystemClang::GetTypeForDecl(void *opaque_decl) { … }
CompilerDeclContext TypeSystemClang::CreateDeclContext(DeclContext *ctx) { … }
CompilerType TypeSystemClang::GetTypeForDecl(clang::NamedDecl *decl) { … }
CompilerType TypeSystemClang::GetTypeForDecl(TagDecl *decl) { … }
CompilerType TypeSystemClang::GetTypeForDecl(ObjCInterfaceDecl *decl) { … }
CompilerType TypeSystemClang::GetTypeForDecl(clang::ValueDecl *value_decl) { … }
#pragma mark Structure, Unions, Classes
void TypeSystemClang::SetOwningModule(clang::Decl *decl,
OptionalClangModuleID owning_module) { … }
OptionalClangModuleID
TypeSystemClang::GetOrCreateClangModule(llvm::StringRef name,
OptionalClangModuleID parent,
bool is_framework, bool is_explicit) { … }
CompilerType TypeSystemClang::CreateRecordType(
clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module,
AccessType access_type, llvm::StringRef name, int kind,
LanguageType language, std::optional<ClangASTMetadata> metadata,
bool exports_symbols) { … }
namespace {
bool IsValueParam(const clang::TemplateArgument &argument) { … }
void AddAccessSpecifierDecl(clang::CXXRecordDecl *cxx_record_decl,
ASTContext &ct,
clang::AccessSpecifier previous_access,
clang::AccessSpecifier access_specifier) { … }
}
static TemplateParameterList *CreateTemplateParameterList(
ASTContext &ast,
const TypeSystemClang::TemplateParameterInfos &template_param_infos,
llvm::SmallVector<NamedDecl *, 8> &template_param_decls) { … }
std::string TypeSystemClang::PrintTemplateParams(
const TemplateParameterInfos &template_param_infos) { … }
clang::FunctionTemplateDecl *TypeSystemClang::CreateFunctionTemplateDecl(
clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module,
clang::FunctionDecl *func_decl,
const TemplateParameterInfos &template_param_infos) { … }
void TypeSystemClang::CreateFunctionTemplateSpecializationInfo(
FunctionDecl *func_decl, clang::FunctionTemplateDecl *func_tmpl_decl,
const TemplateParameterInfos &infos) { … }
static bool TemplateParameterAllowsValue(NamedDecl *param,
const TemplateArgument &value) { … }
static bool ClassTemplateAllowsToInstantiationArgs(
ClassTemplateDecl *class_template_decl,
const TypeSystemClang::TemplateParameterInfos &instantiation_values) { … }
ClassTemplateDecl *TypeSystemClang::CreateClassTemplateDecl(
DeclContext *decl_ctx, OptionalClangModuleID owning_module,
lldb::AccessType access_type, llvm::StringRef class_name, int kind,
const TemplateParameterInfos &template_param_infos) { … }
TemplateTemplateParmDecl *
TypeSystemClang::CreateTemplateTemplateParmDecl(const char *template_name) { … }
ClassTemplateSpecializationDecl *
TypeSystemClang::CreateClassTemplateSpecializationDecl(
DeclContext *decl_ctx, OptionalClangModuleID owning_module,
ClassTemplateDecl *class_template_decl, int kind,
const TemplateParameterInfos &template_param_infos) { … }
CompilerType TypeSystemClang::CreateClassTemplateSpecializationType(
ClassTemplateSpecializationDecl *class_template_specialization_decl) { … }
static inline bool check_op_param(bool is_method,
clang::OverloadedOperatorKind op_kind,
bool unary, bool binary,
uint32_t num_params) { … }
bool TypeSystemClang::CheckOverloadedOperatorKindParameterCount(
bool is_method, clang::OverloadedOperatorKind op_kind,
uint32_t num_params) { … }
clang::AccessSpecifier
TypeSystemClang::UnifyAccessSpecifiers(clang::AccessSpecifier lhs,
clang::AccessSpecifier rhs) { … }
bool TypeSystemClang::FieldIsBitfield(FieldDecl *field,
uint32_t &bitfield_bit_size) { … }
bool TypeSystemClang::RecordHasFields(const RecordDecl *record_decl) { … }
#pragma mark Objective-C Classes
CompilerType TypeSystemClang::CreateObjCClass(
llvm::StringRef name, clang::DeclContext *decl_ctx,
OptionalClangModuleID owning_module, bool isInternal,
std::optional<ClangASTMetadata> metadata) { … }
bool TypeSystemClang::BaseSpecifierIsEmpty(const CXXBaseSpecifier *b) { … }
uint32_t
TypeSystemClang::GetNumBaseClasses(const CXXRecordDecl *cxx_record_decl,
bool omit_empty_base_classes) { … }
#pragma mark Namespace Declarations
NamespaceDecl *TypeSystemClang::GetUniqueNamespaceDeclaration(
const char *name, clang::DeclContext *decl_ctx,
OptionalClangModuleID owning_module, bool is_inline) { … }
clang::BlockDecl *
TypeSystemClang::CreateBlockDeclaration(clang::DeclContext *ctx,
OptionalClangModuleID owning_module) { … }
clang::DeclContext *FindLCABetweenDecls(clang::DeclContext *left,
clang::DeclContext *right,
clang::DeclContext *root) { … }
clang::UsingDirectiveDecl *TypeSystemClang::CreateUsingDirectiveDeclaration(
clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module,
clang::NamespaceDecl *ns_decl) { … }
clang::UsingDecl *
TypeSystemClang::CreateUsingDeclaration(clang::DeclContext *current_decl_ctx,
OptionalClangModuleID owning_module,
clang::NamedDecl *target) { … }
clang::VarDecl *TypeSystemClang::CreateVariableDeclaration(
clang::DeclContext *decl_context, OptionalClangModuleID owning_module,
const char *name, clang::QualType type) { … }
lldb::opaque_compiler_type_t
TypeSystemClang::GetOpaqueCompilerType(clang::ASTContext *ast,
lldb::BasicType basic_type) { … }
#pragma mark Function Types
clang::DeclarationName
TypeSystemClang::GetDeclarationName(llvm::StringRef name,
const CompilerType &function_clang_type) { … }
PrintingPolicy TypeSystemClang::GetTypePrintingPolicy() { … }
std::string TypeSystemClang::GetTypeNameForDecl(const NamedDecl *named_decl,
bool qualified) { … }
FunctionDecl *TypeSystemClang::CreateFunctionDeclaration(
clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module,
llvm::StringRef name, const CompilerType &function_clang_type,
clang::StorageClass storage, bool is_inline) { … }
CompilerType TypeSystemClang::CreateFunctionType(
const CompilerType &result_type, const CompilerType *args,
unsigned num_args, bool is_variadic, unsigned type_quals,
clang::CallingConv cc, clang::RefQualifierKind ref_qual) { … }
ParmVarDecl *TypeSystemClang::CreateParameterDeclaration(
clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module,
const char *name, const CompilerType ¶m_type, int storage,
bool add_decl) { … }
void TypeSystemClang::SetFunctionParameters(
FunctionDecl *function_decl, llvm::ArrayRef<ParmVarDecl *> params) { … }
CompilerType
TypeSystemClang::CreateBlockPointerType(const CompilerType &function_type) { … }
#pragma mark Array Types
CompilerType
TypeSystemClang::CreateArrayType(const CompilerType &element_type,
std::optional<size_t> element_count,
bool is_vector) { … }
CompilerType TypeSystemClang::CreateStructForIdentifier(
llvm::StringRef type_name,
const std::initializer_list<std::pair<const char *, CompilerType>>
&type_fields,
bool packed) { … }
CompilerType TypeSystemClang::GetOrCreateStructForIdentifier(
llvm::StringRef type_name,
const std::initializer_list<std::pair<const char *, CompilerType>>
&type_fields,
bool packed) { … }
#pragma mark Enumeration Types
CompilerType TypeSystemClang::CreateEnumerationType(
llvm::StringRef name, clang::DeclContext *decl_ctx,
OptionalClangModuleID owning_module, const Declaration &decl,
const CompilerType &integer_clang_type, bool is_scoped) { … }
CompilerType TypeSystemClang::GetIntTypeFromBitSize(size_t bit_size,
bool is_signed) { … }
CompilerType TypeSystemClang::GetPointerSizedIntType(bool is_signed) { … }
void TypeSystemClang::DumpDeclContextHiearchy(clang::DeclContext *decl_ctx) { … }
void TypeSystemClang::DumpDeclHiearchy(clang::Decl *decl) { … }
bool TypeSystemClang::GetCompleteDecl(clang::ASTContext *ast,
clang::Decl *decl) { … }
void TypeSystemClang::SetMetadataAsUserID(const clang::Decl *decl,
user_id_t user_id) { … }
void TypeSystemClang::SetMetadataAsUserID(const clang::Type *type,
user_id_t user_id) { … }
void TypeSystemClang::SetMetadata(const clang::Decl *object,
ClangASTMetadata metadata) { … }
void TypeSystemClang::SetMetadata(const clang::Type *object,
ClangASTMetadata metadata) { … }
std::optional<ClangASTMetadata>
TypeSystemClang::GetMetadata(const clang::Decl *object) { … }
std::optional<ClangASTMetadata>
TypeSystemClang::GetMetadata(const clang::Type *object) { … }
void TypeSystemClang::SetCXXRecordDeclAccess(const clang::CXXRecordDecl *object,
clang::AccessSpecifier access) { … }
clang::AccessSpecifier
TypeSystemClang::GetCXXRecordDeclAccess(const clang::CXXRecordDecl *object) { … }
clang::DeclContext *
TypeSystemClang::GetDeclContextForType(const CompilerType &type) { … }
CompilerDeclContext
TypeSystemClang::GetCompilerDeclContextForType(const CompilerType &type) { … }
static QualType
RemoveWrappingTypes(QualType type, ArrayRef<clang::Type::TypeClass> mask = { … }
clang::DeclContext *
TypeSystemClang::GetDeclContextForType(clang::QualType type) { … }
static const clang::RecordType *GetCompleteRecordType(clang::ASTContext *ast,
clang::QualType qual_type,
bool allow_completion) { … }
static const clang::EnumType *GetCompleteEnumType(clang::ASTContext *ast,
clang::QualType qual_type,
bool allow_completion) { … }
static const clang::ObjCObjectType *
GetCompleteObjCObjectType(clang::ASTContext *ast, QualType qual_type,
bool allow_completion) { … }
static bool GetCompleteQualType(clang::ASTContext *ast,
clang::QualType qual_type,
bool allow_completion = true) { … }
static clang::ObjCIvarDecl::AccessControl
ConvertAccessTypeToObjCIvarAccessControl(AccessType access) { … }
#ifndef NDEBUG
bool TypeSystemClang::Verify(lldb::opaque_compiler_type_t type) {
return !type || llvm::isa<clang::Type>(GetQualType(type).getTypePtr());
}
#endif
bool TypeSystemClang::IsAggregateType(lldb::opaque_compiler_type_t type) { … }
bool TypeSystemClang::IsAnonymousType(lldb::opaque_compiler_type_t type) { … }
bool TypeSystemClang::IsArrayType(lldb::opaque_compiler_type_t type,
CompilerType *element_type_ptr,
uint64_t *size, bool *is_incomplete) { … }
bool TypeSystemClang::IsVectorType(lldb::opaque_compiler_type_t type,
CompilerType *element_type, uint64_t *size) { … }
bool TypeSystemClang::IsRuntimeGeneratedType(
lldb::opaque_compiler_type_t type) { … }
bool TypeSystemClang::IsCharType(lldb::opaque_compiler_type_t type) { … }
bool TypeSystemClang::IsCompleteType(lldb::opaque_compiler_type_t type) { … }
bool TypeSystemClang::IsConst(lldb::opaque_compiler_type_t type) { … }
bool TypeSystemClang::IsCStringType(lldb::opaque_compiler_type_t type,
uint32_t &length) { … }
unsigned TypeSystemClang::GetPtrAuthKey(lldb::opaque_compiler_type_t type) { … }
unsigned
TypeSystemClang::GetPtrAuthDiscriminator(lldb::opaque_compiler_type_t type) { … }
bool TypeSystemClang::GetPtrAuthAddressDiversity(
lldb::opaque_compiler_type_t type) { … }
bool TypeSystemClang::IsFunctionType(lldb::opaque_compiler_type_t type) { … }
uint32_t
TypeSystemClang::IsHomogeneousAggregate(lldb::opaque_compiler_type_t type,
CompilerType *base_type_ptr) { … }
size_t TypeSystemClang::GetNumberOfFunctionArguments(
lldb::opaque_compiler_type_t type) { … }
CompilerType
TypeSystemClang::GetFunctionArgumentAtIndex(lldb::opaque_compiler_type_t type,
const size_t index) { … }
bool TypeSystemClang::IsTypeImpl(
lldb::opaque_compiler_type_t type,
llvm::function_ref<bool(clang::QualType)> predicate) const { … }
bool TypeSystemClang::IsMemberFunctionPointerType(
lldb::opaque_compiler_type_t type) { … }
bool TypeSystemClang::IsFunctionPointerType(lldb::opaque_compiler_type_t type) { … }
bool TypeSystemClang::IsBlockPointerType(
lldb::opaque_compiler_type_t type,
CompilerType *function_pointer_type_ptr) { … }
bool TypeSystemClang::IsIntegerType(lldb::opaque_compiler_type_t type,
bool &is_signed) { … }
bool TypeSystemClang::IsEnumerationType(lldb::opaque_compiler_type_t type,
bool &is_signed) { … }
bool TypeSystemClang::IsScopedEnumerationType(
lldb::opaque_compiler_type_t type) { … }
bool TypeSystemClang::IsPointerType(lldb::opaque_compiler_type_t type,
CompilerType *pointee_type) { … }
bool TypeSystemClang::IsPointerOrReferenceType(
lldb::opaque_compiler_type_t type, CompilerType *pointee_type) { … }
bool TypeSystemClang::IsReferenceType(lldb::opaque_compiler_type_t type,
CompilerType *pointee_type,
bool *is_rvalue) { … }
bool TypeSystemClang::IsFloatingPointType(lldb::opaque_compiler_type_t type,
uint32_t &count, bool &is_complex) { … }
bool TypeSystemClang::IsDefined(lldb::opaque_compiler_type_t type) { … }
bool TypeSystemClang::IsObjCClassType(const CompilerType &type) { … }
bool TypeSystemClang::IsObjCObjectOrInterfaceType(const CompilerType &type) { … }
bool TypeSystemClang::IsClassType(lldb::opaque_compiler_type_t type) { … }
bool TypeSystemClang::IsEnumType(lldb::opaque_compiler_type_t type) { … }
bool TypeSystemClang::IsPolymorphicClass(lldb::opaque_compiler_type_t type) { … }
bool TypeSystemClang::IsPossibleDynamicType(lldb::opaque_compiler_type_t type,
CompilerType *dynamic_pointee_type,
bool check_cplusplus,
bool check_objc) { … }
bool TypeSystemClang::IsScalarType(lldb::opaque_compiler_type_t type) { … }
bool TypeSystemClang::IsTypedefType(lldb::opaque_compiler_type_t type) { … }
bool TypeSystemClang::IsVoidType(lldb::opaque_compiler_type_t type) { … }
bool TypeSystemClang::CanPassInRegisters(const CompilerType &type) { … }
bool TypeSystemClang::SupportsLanguage(lldb::LanguageType language) { … }
std::optional<std::string>
TypeSystemClang::GetCXXClassName(const CompilerType &type) { … }
bool TypeSystemClang::IsCXXClassType(const CompilerType &type) { … }
bool TypeSystemClang::IsBeingDefined(lldb::opaque_compiler_type_t type) { … }
bool TypeSystemClang::IsObjCObjectPointerType(const CompilerType &type,
CompilerType *class_type_ptr) { … }
bool TypeSystemClang::GetCompleteType(lldb::opaque_compiler_type_t type) { … }
ConstString TypeSystemClang::GetTypeName(lldb::opaque_compiler_type_t type,
bool base_only) { … }
ConstString
TypeSystemClang::GetDisplayTypeName(lldb::opaque_compiler_type_t type) { … }
uint32_t
TypeSystemClang::GetTypeInfo(lldb::opaque_compiler_type_t type,
CompilerType *pointee_or_element_clang_type) { … }
lldb::LanguageType
TypeSystemClang::GetMinimumLanguage(lldb::opaque_compiler_type_t type) { … }
lldb::TypeClass
TypeSystemClang::GetTypeClass(lldb::opaque_compiler_type_t type) { … }
unsigned TypeSystemClang::GetTypeQualifiers(lldb::opaque_compiler_type_t type) { … }
CompilerType
TypeSystemClang::GetArrayElementType(lldb::opaque_compiler_type_t type,
ExecutionContextScope *exe_scope) { … }
CompilerType TypeSystemClang::GetArrayType(lldb::opaque_compiler_type_t type,
uint64_t size) { … }
CompilerType
TypeSystemClang::GetCanonicalType(lldb::opaque_compiler_type_t type) { … }
static clang::QualType GetFullyUnqualifiedType_Impl(clang::ASTContext *ast,
clang::QualType qual_type) { … }
CompilerType
TypeSystemClang::GetFullyUnqualifiedType(lldb::opaque_compiler_type_t type) { … }
CompilerType
TypeSystemClang::GetEnumerationIntegerType(lldb::opaque_compiler_type_t type) { … }
int TypeSystemClang::GetFunctionArgumentCount(
lldb::opaque_compiler_type_t type) { … }
CompilerType TypeSystemClang::GetFunctionArgumentTypeAtIndex(
lldb::opaque_compiler_type_t type, size_t idx) { … }
CompilerType
TypeSystemClang::GetFunctionReturnType(lldb::opaque_compiler_type_t type) { … }
size_t
TypeSystemClang::GetNumMemberFunctions(lldb::opaque_compiler_type_t type) { … }
TypeMemberFunctionImpl
TypeSystemClang::GetMemberFunctionAtIndex(lldb::opaque_compiler_type_t type,
size_t idx) { … }
CompilerType
TypeSystemClang::GetNonReferenceType(lldb::opaque_compiler_type_t type) { … }
CompilerType
TypeSystemClang::GetPointeeType(lldb::opaque_compiler_type_t type) { … }
CompilerType
TypeSystemClang::GetPointerType(lldb::opaque_compiler_type_t type) { … }
CompilerType
TypeSystemClang::GetLValueReferenceType(lldb::opaque_compiler_type_t type) { … }
CompilerType
TypeSystemClang::GetRValueReferenceType(lldb::opaque_compiler_type_t type) { … }
CompilerType TypeSystemClang::GetAtomicType(lldb::opaque_compiler_type_t type) { … }
CompilerType
TypeSystemClang::AddConstModifier(lldb::opaque_compiler_type_t type) { … }
CompilerType
TypeSystemClang::AddPtrAuthModifier(lldb::opaque_compiler_type_t type,
uint32_t payload) { … }
CompilerType
TypeSystemClang::AddVolatileModifier(lldb::opaque_compiler_type_t type) { … }
CompilerType
TypeSystemClang::AddRestrictModifier(lldb::opaque_compiler_type_t type) { … }
CompilerType TypeSystemClang::CreateTypedef(
lldb::opaque_compiler_type_t type, const char *typedef_name,
const CompilerDeclContext &compiler_decl_ctx, uint32_t payload) { … }
CompilerType
TypeSystemClang::GetTypedefedType(lldb::opaque_compiler_type_t type) { … }
CompilerType TypeSystemClang::GetBasicTypeFromAST(lldb::BasicType basic_type) { … }
CompilerType TypeSystemClang::CreateGenericFunctionPrototype() { … }
const llvm::fltSemantics &
TypeSystemClang::GetFloatTypeSemantics(size_t byte_size) { … }
std::optional<uint64_t>
TypeSystemClang::GetObjCBitSize(QualType qual_type,
ExecutionContextScope *exe_scope) { … }
std::optional<uint64_t>
TypeSystemClang::GetBitSize(lldb::opaque_compiler_type_t type,
ExecutionContextScope *exe_scope) { … }
std::optional<size_t>
TypeSystemClang::GetTypeBitAlign(lldb::opaque_compiler_type_t type,
ExecutionContextScope *exe_scope) { … }
lldb::Encoding TypeSystemClang::GetEncoding(lldb::opaque_compiler_type_t type,
uint64_t &count) { … }
lldb::Format TypeSystemClang::GetFormat(lldb::opaque_compiler_type_t type) { … }
static bool ObjCDeclHasIVars(clang::ObjCInterfaceDecl *class_interface_decl,
bool check_superclass) { … }
static std::optional<SymbolFile::ArrayInfo>
GetDynamicArrayInfo(TypeSystemClang &ast, SymbolFile *sym_file,
clang::QualType qual_type,
const ExecutionContext *exe_ctx) { … }
llvm::Expected<uint32_t>
TypeSystemClang::GetNumChildren(lldb::opaque_compiler_type_t type,
bool omit_empty_base_classes,
const ExecutionContext *exe_ctx) { … }
CompilerType TypeSystemClang::GetBuiltinTypeByName(ConstString name) { … }
lldb::BasicType
TypeSystemClang::GetBasicTypeEnumeration(lldb::opaque_compiler_type_t type) { … }
void TypeSystemClang::ForEachEnumerator(
lldb::opaque_compiler_type_t type,
std::function<bool(const CompilerType &integer_type,
ConstString name,
const llvm::APSInt &value)> const &callback) { … }
#pragma mark Aggregate Types
uint32_t TypeSystemClang::GetNumFields(lldb::opaque_compiler_type_t type) { … }
static lldb::opaque_compiler_type_t
GetObjCFieldAtIndex(clang::ASTContext *ast,
clang::ObjCInterfaceDecl *class_interface_decl, size_t idx,
std::string &name, uint64_t *bit_offset_ptr,
uint32_t *bitfield_bit_size_ptr, bool *is_bitfield_ptr) { … }
CompilerType TypeSystemClang::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) { … }
uint32_t
TypeSystemClang::GetNumDirectBaseClasses(lldb::opaque_compiler_type_t type) { … }
uint32_t
TypeSystemClang::GetNumVirtualBaseClasses(lldb::opaque_compiler_type_t type) { … }
CompilerType TypeSystemClang::GetDirectBaseClassAtIndex(
lldb::opaque_compiler_type_t type, size_t idx, uint32_t *bit_offset_ptr) { … }
CompilerType TypeSystemClang::GetVirtualBaseClassAtIndex(
lldb::opaque_compiler_type_t type, size_t idx, uint32_t *bit_offset_ptr) { … }
CompilerDecl
TypeSystemClang::GetStaticFieldWithName(lldb::opaque_compiler_type_t type,
llvm::StringRef name) { … }
uint32_t TypeSystemClang::GetNumPointeeChildren(clang::QualType type) { … }
llvm::Expected<CompilerType> TypeSystemClang::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) { … }
uint32_t TypeSystemClang::GetIndexForRecordBase(
const clang::RecordDecl *record_decl,
const clang::CXXBaseSpecifier *base_spec,
bool omit_empty_base_classes) { … }
uint32_t TypeSystemClang::GetIndexForRecordChild(
const clang::RecordDecl *record_decl, clang::NamedDecl *canonical_decl,
bool omit_empty_base_classes) { … }
size_t TypeSystemClang::GetIndexOfChildMemberWithName(
lldb::opaque_compiler_type_t type, llvm::StringRef name,
bool omit_empty_base_classes, std::vector<uint32_t> &child_indexes) { … }
uint32_t
TypeSystemClang::GetIndexOfChildWithName(lldb::opaque_compiler_type_t type,
llvm::StringRef name,
bool omit_empty_base_classes) { … }
CompilerType
TypeSystemClang::GetDirectNestedTypeWithName(lldb::opaque_compiler_type_t type,
llvm::StringRef name) { … }
bool TypeSystemClang::IsTemplateType(lldb::opaque_compiler_type_t type) { … }
size_t
TypeSystemClang::GetNumTemplateArguments(lldb::opaque_compiler_type_t type,
bool expand_pack) { … }
const clang::ClassTemplateSpecializationDecl *
TypeSystemClang::GetAsTemplateSpecialization(
lldb::opaque_compiler_type_t type) { … }
const TemplateArgument *
GetNthTemplateArgument(const clang::ClassTemplateSpecializationDecl *decl,
size_t idx, bool expand_pack) { … }
lldb::TemplateArgumentKind
TypeSystemClang::GetTemplateArgumentKind(lldb::opaque_compiler_type_t type,
size_t arg_idx, bool expand_pack) { … }
CompilerType
TypeSystemClang::GetTypeTemplateArgument(lldb::opaque_compiler_type_t type,
size_t idx, bool expand_pack) { … }
std::optional<CompilerType::IntegralTemplateArgument>
TypeSystemClang::GetIntegralTemplateArgument(lldb::opaque_compiler_type_t type,
size_t idx, bool expand_pack) { … }
CompilerType TypeSystemClang::GetTypeForFormatters(void *type) { … }
clang::EnumDecl *TypeSystemClang::GetAsEnumDecl(const CompilerType &type) { … }
clang::RecordDecl *TypeSystemClang::GetAsRecordDecl(const CompilerType &type) { … }
clang::TagDecl *TypeSystemClang::GetAsTagDecl(const CompilerType &type) { … }
clang::TypedefNameDecl *
TypeSystemClang::GetAsTypedefDecl(const CompilerType &type) { … }
clang::CXXRecordDecl *
TypeSystemClang::GetAsCXXRecordDecl(lldb::opaque_compiler_type_t type) { … }
clang::ObjCInterfaceDecl *
TypeSystemClang::GetAsObjCInterfaceDecl(const CompilerType &type) { … }
clang::FieldDecl *TypeSystemClang::AddFieldToRecordType(
const CompilerType &type, llvm::StringRef name,
const CompilerType &field_clang_type, AccessType access,
uint32_t bitfield_bit_size) { … }
void TypeSystemClang::BuildIndirectFields(const CompilerType &type) { … }
void TypeSystemClang::SetIsPacked(const CompilerType &type) { … }
clang::VarDecl *TypeSystemClang::AddVariableToRecordType(
const CompilerType &type, llvm::StringRef name,
const CompilerType &var_type, AccessType access) { … }
void TypeSystemClang::SetIntegerInitializerForVariable(
VarDecl *var, const llvm::APInt &init_value) { … }
void TypeSystemClang::SetFloatingInitializerForVariable(
clang::VarDecl *var, const llvm::APFloat &init_value) { … }
clang::CXXMethodDecl *TypeSystemClang::AddMethodToCXXRecordType(
lldb::opaque_compiler_type_t type, llvm::StringRef name,
const char *mangled_name, const CompilerType &method_clang_type,
lldb::AccessType access, bool is_virtual, bool is_static, bool is_inline,
bool is_explicit, bool is_attr_used, bool is_artificial) { … }
void TypeSystemClang::AddMethodOverridesForCXXRecordType(
lldb::opaque_compiler_type_t type) { … }
#pragma mark C++ Base Classes
std::unique_ptr<clang::CXXBaseSpecifier>
TypeSystemClang::CreateBaseClassSpecifier(lldb::opaque_compiler_type_t type,
AccessType access, bool is_virtual,
bool base_of_class) { … }
bool TypeSystemClang::TransferBaseClasses(
lldb::opaque_compiler_type_t type,
std::vector<std::unique_ptr<clang::CXXBaseSpecifier>> bases) { … }
bool TypeSystemClang::SetObjCSuperClass(
const CompilerType &type, const CompilerType &superclass_clang_type) { … }
bool TypeSystemClang::AddObjCClassProperty(
const CompilerType &type, const char *property_name,
const CompilerType &property_clang_type, clang::ObjCIvarDecl *ivar_decl,
const char *property_setter_name, const char *property_getter_name,
uint32_t property_attributes, ClangASTMetadata metadata) { … }
bool TypeSystemClang::IsObjCClassTypeAndHasIVars(const CompilerType &type,
bool check_superclass) { … }
clang::ObjCMethodDecl *TypeSystemClang::AddMethodToObjCObjectType(
const CompilerType &type,
const char *name,
const CompilerType &method_clang_type, bool is_artificial, bool is_variadic,
bool is_objc_direct_call) { … }
bool TypeSystemClang::SetHasExternalStorage(lldb::opaque_compiler_type_t type,
bool has_extern) { … }
#pragma mark TagDecl
bool TypeSystemClang::StartTagDeclarationDefinition(const CompilerType &type) { … }
bool TypeSystemClang::CompleteTagDeclarationDefinition(
const CompilerType &type) { … }
clang::EnumConstantDecl *TypeSystemClang::AddEnumerationValueToEnumerationType(
const CompilerType &enum_type, const Declaration &decl, const char *name,
const llvm::APSInt &value) { … }
clang::EnumConstantDecl *TypeSystemClang::AddEnumerationValueToEnumerationType(
const CompilerType &enum_type, const Declaration &decl, const char *name,
int64_t enum_value, uint32_t enum_value_bit_size) { … }
CompilerType TypeSystemClang::GetEnumerationIntegerType(CompilerType type) { … }
CompilerType
TypeSystemClang::CreateMemberPointerType(const CompilerType &type,
const CompilerType &pointee_type) { … }
#define DEPTH_INCREMENT …
#ifndef NDEBUG
LLVM_DUMP_METHOD void
TypeSystemClang::dump(lldb::opaque_compiler_type_t type) const {
if (!type)
return;
clang::QualType qual_type(GetQualType(type));
qual_type.dump();
}
#endif
void TypeSystemClang::Dump(llvm::raw_ostream &output) { … }
void TypeSystemClang::DumpFromSymbolFile(Stream &s,
llvm::StringRef symbol_name) { … }
static bool DumpEnumValue(const clang::QualType &qual_type, Stream &s,
const DataExtractor &data, lldb::offset_t byte_offset,
size_t byte_size, uint32_t bitfield_bit_offset,
uint32_t bitfield_bit_size) { … }
bool TypeSystemClang::DumpTypeValue(
lldb::opaque_compiler_type_t type, Stream &s, lldb::Format format,
const lldb_private::DataExtractor &data, lldb::offset_t byte_offset,
size_t byte_size, uint32_t bitfield_bit_size, uint32_t bitfield_bit_offset,
ExecutionContextScope *exe_scope) { … }
void TypeSystemClang::DumpTypeDescription(lldb::opaque_compiler_type_t type,
lldb::DescriptionLevel level) { … }
void TypeSystemClang::DumpTypeDescription(lldb::opaque_compiler_type_t type,
Stream &s,
lldb::DescriptionLevel level) { … }
void TypeSystemClang::DumpTypeName(const CompilerType &type) { … }
clang::ClassTemplateDecl *TypeSystemClang::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) { … }
void TypeSystemClang::CompleteTagDecl(clang::TagDecl *decl) { … }
void TypeSystemClang::CompleteObjCInterfaceDecl(
clang::ObjCInterfaceDecl *decl) { … }
DWARFASTParser *TypeSystemClang::GetDWARFParser() { … }
PDBASTParser *TypeSystemClang::GetPDBParser() { … }
npdb::PdbAstBuilder *TypeSystemClang::GetNativePDBParser() { … }
bool TypeSystemClang::LayoutRecordType(
const clang::RecordDecl *record_decl, uint64_t &bit_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) { … }
ConstString TypeSystemClang::DeclGetName(void *opaque_decl) { … }
ConstString TypeSystemClang::DeclGetMangledName(void *opaque_decl) { … }
CompilerDeclContext TypeSystemClang::DeclGetDeclContext(void *opaque_decl) { … }
CompilerType TypeSystemClang::DeclGetFunctionReturnType(void *opaque_decl) { … }
size_t TypeSystemClang::DeclGetFunctionNumArguments(void *opaque_decl) { … }
static CompilerContextKind GetCompilerKind(clang::Decl::Kind clang_kind,
clang::DeclContext const *decl_ctx) { … }
static void
InsertCompilerContext(TypeSystemClang *ts, clang::DeclContext *decl_ctx,
std::vector<lldb_private::CompilerContext> &context) { … }
std::vector<lldb_private::CompilerContext>
TypeSystemClang::DeclGetCompilerContext(void *opaque_decl) { … }
CompilerType TypeSystemClang::DeclGetFunctionArgumentType(void *opaque_decl,
size_t idx) { … }
Scalar TypeSystemClang::DeclGetConstantValue(void *opaque_decl) { … }
std::vector<CompilerDecl> TypeSystemClang::DeclContextFindDeclByName(
void *opaque_decl_ctx, ConstString name, const bool ignore_using_decls) { … }
uint32_t TypeSystemClang::CountDeclLevels(clang::DeclContext *frame_decl_ctx,
clang::DeclContext *child_decl_ctx,
ConstString *child_name,
CompilerType *child_type) { … }
ConstString TypeSystemClang::DeclContextGetName(void *opaque_decl_ctx) { … }
ConstString
TypeSystemClang::DeclContextGetScopeQualifiedName(void *opaque_decl_ctx) { … }
bool TypeSystemClang::DeclContextIsClassMethod(void *opaque_decl_ctx) { … }
std::vector<lldb_private::CompilerContext>
TypeSystemClang::DeclContextGetCompilerContext(void *opaque_decl_ctx) { … }
bool TypeSystemClang::DeclContextIsContainedInLookup(
void *opaque_decl_ctx, void *other_opaque_decl_ctx) { … }
lldb::LanguageType
TypeSystemClang::DeclContextGetLanguage(void *opaque_decl_ctx) { … }
static bool IsClangDeclContext(const CompilerDeclContext &dc) { … }
clang::DeclContext *
TypeSystemClang::DeclContextGetAsDeclContext(const CompilerDeclContext &dc) { … }
ObjCMethodDecl *
TypeSystemClang::DeclContextGetAsObjCMethodDecl(const CompilerDeclContext &dc) { … }
CXXMethodDecl *
TypeSystemClang::DeclContextGetAsCXXMethodDecl(const CompilerDeclContext &dc) { … }
clang::FunctionDecl *
TypeSystemClang::DeclContextGetAsFunctionDecl(const CompilerDeclContext &dc) { … }
clang::NamespaceDecl *
TypeSystemClang::DeclContextGetAsNamespaceDecl(const CompilerDeclContext &dc) { … }
std::optional<ClangASTMetadata>
TypeSystemClang::DeclContextGetMetaData(const CompilerDeclContext &dc,
const Decl *object) { … }
clang::ASTContext *
TypeSystemClang::DeclContextGetTypeSystemClang(const CompilerDeclContext &dc) { … }
void TypeSystemClang::RequireCompleteType(CompilerType type) { … }
namespace {
class SpecializedScratchAST : public TypeSystemClang { … };
}
char ScratchTypeSystemClang::ID;
const std::nullopt_t ScratchTypeSystemClang::DefaultAST = …;
ScratchTypeSystemClang::ScratchTypeSystemClang(Target &target,
llvm::Triple triple)
: … { … }
void ScratchTypeSystemClang::Finalize() { … }
TypeSystemClangSP
ScratchTypeSystemClang::GetForTarget(Target &target,
std::optional<IsolatedASTKind> ast_kind,
bool create_on_demand) { … }
static llvm::StringRef
GetNameForIsolatedASTKind(ScratchTypeSystemClang::IsolatedASTKind kind) { … }
void ScratchTypeSystemClang::Dump(llvm::raw_ostream &output) { … }
UserExpression *ScratchTypeSystemClang::GetUserExpression(
llvm::StringRef expr, llvm::StringRef prefix, SourceLanguage language,
Expression::ResultType desired_type,
const EvaluateExpressionOptions &options, ValueObject *ctx_obj) { … }
FunctionCaller *ScratchTypeSystemClang::GetFunctionCaller(
const CompilerType &return_type, const Address &function_address,
const ValueList &arg_value_list, const char *name) { … }
std::unique_ptr<UtilityFunction>
ScratchTypeSystemClang::CreateUtilityFunction(std::string text,
std::string name) { … }
PersistentExpressionState *
ScratchTypeSystemClang::GetPersistentExpressionState() { … }
void ScratchTypeSystemClang::ForgetSource(ASTContext *src_ctx,
ClangASTImporter &importer) { … }
std::unique_ptr<ClangASTSource> ScratchTypeSystemClang::CreateASTSource() { … }
static llvm::StringRef
GetSpecializedASTName(ScratchTypeSystemClang::IsolatedASTKind feature) { … }
TypeSystemClang &ScratchTypeSystemClang::GetIsolatedAST(
ScratchTypeSystemClang::IsolatedASTKind feature) { … }
bool TypeSystemClang::IsForcefullyCompleted(lldb::opaque_compiler_type_t type) { … }
bool TypeSystemClang::SetDeclIsForcefullyCompleted(const clang::TagDecl *td) { … }
void TypeSystemClang::LogCreation() const { … }