11#include "clang/AST/DeclBase.h" 
   12#include "clang/AST/ExprCXX.h" 
   13#include "clang/Frontend/ASTConsumers.h" 
   14#include "llvm/ADT/ScopeExit.h" 
   15#include "llvm/Support/Casting.h" 
   16#include "llvm/Support/FormatAdapters.h" 
   17#include "llvm/Support/FormatVariadic.h" 
   24#include "clang/AST/ASTContext.h" 
   25#include "clang/AST/ASTImporter.h" 
   26#include "clang/AST/Attr.h" 
   27#include "clang/AST/CXXInheritance.h" 
   28#include "clang/AST/DeclObjC.h" 
   29#include "clang/AST/DeclTemplate.h" 
   30#include "clang/AST/Mangle.h" 
   31#include "clang/AST/QualTypeNames.h" 
   32#include "clang/AST/RecordLayout.h" 
   33#include "clang/AST/Type.h" 
   34#include "clang/AST/VTableBuilder.h" 
   35#include "clang/Basic/Builtins.h" 
   36#include "clang/Basic/Diagnostic.h" 
   37#include "clang/Basic/FileManager.h" 
   38#include "clang/Basic/FileSystemOptions.h" 
   39#include "clang/Basic/LangStandard.h" 
   40#include "clang/Basic/SourceManager.h" 
   41#include "clang/Basic/TargetInfo.h" 
   42#include "clang/Basic/TargetOptions.h" 
   43#include "clang/Frontend/FrontendOptions.h" 
   44#include "clang/Lex/HeaderSearch.h" 
   45#include "clang/Lex/HeaderSearchOptions.h" 
   46#include "clang/Lex/ModuleMap.h" 
   47#include "clang/Sema/Sema.h" 
   49#include "llvm/Support/Signals.h" 
   50#include "llvm/Support/Threading.h" 
   94using namespace llvm::dwarf;
 
   96using llvm::StringSwitch;
 
  101static void VerifyDecl(clang::Decl *decl) {
 
  102  assert(decl && 
"VerifyDecl called with nullptr?");
 
  128bool isOverload(clang::CXXMethodDecl *m1, clang::CXXMethodDecl *m2) {
 
  130  lldbassert(&m1->getASTContext() == &m2->getASTContext() &&
 
  131             "Methods should have the same AST context");
 
  132  clang::ASTContext &context = m1->getASTContext();
 
  134  const auto *m1Type = llvm::cast<clang::FunctionProtoType>(
 
  135      context.getCanonicalType(m1->getType()));
 
  137  const auto *m2Type = llvm::cast<clang::FunctionProtoType>(
 
  138      context.getCanonicalType(m2->getType()));
 
  140  auto compareArgTypes = [&context](
const clang::QualType &m1p,
 
  141                                    const clang::QualType &m2p) {
 
  142    return context.hasSameType(m1p.getUnqualifiedType(),
 
  143                               m2p.getUnqualifiedType());
 
  148  return (m1->getNumParams() != m2->getNumParams()) ||
 
  149         !std::equal(m1Type->param_type_begin(), m1Type->param_type_end(),
 
  150                     m2Type->param_type_begin(), compareArgTypes);
 
  156void addOverridesForMethod(clang::CXXMethodDecl *decl) {
 
  157  if (!decl->isVirtual())
 
  160  clang::CXXBasePaths paths;
 
  161  llvm::SmallVector<clang::NamedDecl *, 4> decls;
 
  163  auto find_overridden_methods =
 
  164      [&decls, decl](
const clang::CXXBaseSpecifier *specifier,
 
  165                     clang::CXXBasePath &path) {
 
  166        if (
auto *base_record = specifier->getType()->getAsCXXRecordDecl()) {
 
  168          clang::DeclarationName name = decl->getDeclName();
 
  172          if (name.getNameKind() == clang::DeclarationName::CXXDestructorName)
 
  173            if (
auto *baseDtorDecl = base_record->getDestructor()) {
 
  174              if (baseDtorDecl->isVirtual()) {
 
  175                decls.push_back(baseDtorDecl);
 
  182          for (path.Decls = base_record->lookup(name).begin();
 
  183               path.Decls != path.Decls.end(); ++path.Decls) {
 
  184            if (
auto *method_decl =
 
  185                    llvm::dyn_cast<clang::CXXMethodDecl>(*path.Decls))
 
  186              if (method_decl->isVirtual() && !isOverload(decl, method_decl)) {
 
  187                decls.push_back(method_decl);
 
  196  if (decl->getParent()->lookupInBases(find_overridden_methods, paths)) {
 
  197    for (
auto *overridden_decl : decls)
 
  198      decl->addOverriddenMethod(
 
  199          llvm::cast<clang::CXXMethodDecl>(overridden_decl));
 
  205                                     VTableContextBase &vtable_ctx,
 
  207                                     const ASTRecordLayout &record_layout) {
 
  211  uint32_t type_info = this_type.
GetTypeInfo(&pointee_type);
 
  216  bool ptr_or_ref = 
false;
 
  217  if (type_info & (eTypeIsPointer | eTypeIsReference)) {
 
  223  const uint32_t cpp_class = eTypeIsClass | eTypeIsCPlusPlus;
 
  224  if ((type_info & cpp_class) != cpp_class)
 
  229      vtable_ctx.isMicrosoft() ? record_layout.getVBPtrOffset().getQuantity()
 
  243    vbtable_ptr_addr += vbtable_ptr_offset;
 
  254  auto size = valobj.
GetData(data, err);
 
 
  262                                         VTableContextBase &vtable_ctx,
 
  264                                         const CXXRecordDecl *cxx_record_decl,
 
  265                                         const CXXRecordDecl *base_class_decl) {
 
  266  if (vtable_ctx.isMicrosoft()) {
 
  267    clang::MicrosoftVTableContext &msoft_vtable_ctx =
 
  268        static_cast<clang::MicrosoftVTableContext &
>(vtable_ctx);
 
  272    const unsigned vbtable_index =
 
  273        msoft_vtable_ctx.getVBTableIndex(cxx_record_decl, base_class_decl);
 
  274    const lldb::addr_t base_offset_addr = vtable_ptr + vbtable_index * 4;
 
  280  clang::ItaniumVTableContext &itanium_vtable_ctx =
 
  281      static_cast<clang::ItaniumVTableContext &
>(vtable_ctx);
 
  283  clang::CharUnits base_offset_offset =
 
  284      itanium_vtable_ctx.getVirtualBaseOffsetOffset(cxx_record_decl,
 
  287      vtable_ptr + base_offset_offset.getQuantity();
 
 
  296                              const ASTRecordLayout &record_layout,
 
  297                              const CXXRecordDecl *cxx_record_decl,
 
  298                              const CXXRecordDecl *base_class_decl,
 
  299                              int32_t &bit_offset) {
 
  311      *process, vtable_ctx, vtable_ptr, cxx_record_decl, base_class_decl);
 
  312  if (base_offset == INT64_MAX)
 
  315  bit_offset = base_offset * 8;
 
 
  325  static llvm::once_flag g_once_flag;
 
  326  llvm::call_once(g_once_flag, []() {
 
 
  333                                   bool is_complete_objc_class)
 
 
  346                                  const clang::Decl *parent) {
 
  347  if (!member || !parent)
 
  354  member->setFromASTFile();
 
  355  member->setOwningModuleID(
id.GetValue());
 
  356  member->setModuleOwnershipKind(clang::Decl::ModuleOwnershipKind::Visible);
 
  357  if (llvm::isa<clang::NamedDecl>(member))
 
  358    if (
auto *dc = llvm::dyn_cast<clang::DeclContext>(parent)) {
 
  359      dc->setHasExternalVisibleStorage(
true);
 
  362      dc->setHasExternalLexicalStorage(
true);
 
 
  369                                 clang::OverloadedOperatorKind &op_kind) {
 
  371  if (!name.consume_front(
"operator"))
 
  376  bool space_after_operator = name.consume_front(
" ");
 
  378  op_kind = StringSwitch<clang::OverloadedOperatorKind>(name)
 
  379                .Case(
"+", clang::OO_Plus)
 
  380                .Case(
"+=", clang::OO_PlusEqual)
 
  381                .Case(
"++", clang::OO_PlusPlus)
 
  382                .Case(
"-", clang::OO_Minus)
 
  383                .Case(
"-=", clang::OO_MinusEqual)
 
  384                .Case(
"--", clang::OO_MinusMinus)
 
  385                .Case(
"->", clang::OO_Arrow)
 
  386                .Case(
"->*", clang::OO_ArrowStar)
 
  387                .Case(
"*", clang::OO_Star)
 
  388                .Case(
"*=", clang::OO_StarEqual)
 
  389                .Case(
"/", clang::OO_Slash)
 
  390                .Case(
"/=", clang::OO_SlashEqual)
 
  391                .Case(
"%", clang::OO_Percent)
 
  392                .Case(
"%=", clang::OO_PercentEqual)
 
  393                .Case(
"^", clang::OO_Caret)
 
  394                .Case(
"^=", clang::OO_CaretEqual)
 
  395                .Case(
"&", clang::OO_Amp)
 
  396                .Case(
"&=", clang::OO_AmpEqual)
 
  397                .Case(
"&&", clang::OO_AmpAmp)
 
  398                .Case(
"|", clang::OO_Pipe)
 
  399                .Case(
"|=", clang::OO_PipeEqual)
 
  400                .Case(
"||", clang::OO_PipePipe)
 
  401                .Case(
"~", clang::OO_Tilde)
 
  402                .Case(
"!", clang::OO_Exclaim)
 
  403                .Case(
"!=", clang::OO_ExclaimEqual)
 
  404                .Case(
"=", clang::OO_Equal)
 
  405                .Case(
"==", clang::OO_EqualEqual)
 
  406                .Case(
"<", clang::OO_Less)
 
  407                .Case(
"<=>", clang::OO_Spaceship)
 
  408                .Case(
"<<", clang::OO_LessLess)
 
  409                .Case(
"<<=", clang::OO_LessLessEqual)
 
  410                .Case(
"<=", clang::OO_LessEqual)
 
  411                .Case(
">", clang::OO_Greater)
 
  412                .Case(
">>", clang::OO_GreaterGreater)
 
  413                .Case(
">>=", clang::OO_GreaterGreaterEqual)
 
  414                .Case(
">=", clang::OO_GreaterEqual)
 
  415                .Case(
"()", clang::OO_Call)
 
  416                .Case(
"[]", clang::OO_Subscript)
 
  417                .Case(
",", clang::OO_Comma)
 
  418                .Default(clang::NUM_OVERLOADED_OPERATORS);
 
  421  if (op_kind != clang::NUM_OVERLOADED_OPERATORS)
 
  433  if (!space_after_operator)
 
  438  op_kind = StringSwitch<clang::OverloadedOperatorKind>(name)
 
  439                .Case(
"new", clang::OO_New)
 
  440                .Case(
"new[]", clang::OO_Array_New)
 
  441                .Case(
"delete", clang::OO_Delete)
 
  442                .Case(
"delete[]", clang::OO_Array_Delete)
 
  444                .Default(clang::NUM_OVERLOADED_OPERATORS);
 
 
  449clang::AccessSpecifier
 
  469  std::vector<std::string> Includes;
 
  470  LangOptions::setLangDefaults(Opts, clang::Language::ObjCXX, arch.
GetTriple(),
 
  471                               Includes, clang::LangStandard::lang_gnucxx98);
 
  473  Opts.setValueVisibilityMode(DefaultVisibility);
 
  477  Opts.Trigraphs = !Opts.GNUMode;
 
  482  Opts.ModulesLocalVisibility = 1;
 
 
  486                                 llvm::Triple target_triple) {
 
  488  if (!target_triple.str().empty())
 
 
  498                                 ASTContext &existing_ctxt) {
 
  514  if (!TypeSystemClangSupportsLanguage(language))
 
  518    arch = 
module->GetArchitecture();
 
  528  if (triple.getVendor() == llvm::Triple::Apple &&
 
  529      triple.getOS() == llvm::Triple::UnknownOS) {
 
  530    if (triple.getArch() == llvm::Triple::arm ||
 
  531        triple.getArch() == llvm::Triple::aarch64 ||
 
  532        triple.getArch() == llvm::Triple::aarch64_32 ||
 
  533        triple.getArch() == llvm::Triple::thumb) {
 
  534      triple.setOS(llvm::Triple::IOS);
 
  536      triple.setOS(llvm::Triple::MacOSX);
 
  541    std::string ast_name =
 
  542        "ASTContext for '" + 
module->GetFileSpec().GetPath() + "'";
 
  543    return std::make_shared<TypeSystemClang>(ast_name, triple);
 
  544  } 
else if (target && target->
IsValid())
 
  545    return std::make_shared<ScratchTypeSystemClang>(*target, triple);
 
 
  607  assert(s == 
nullptr || &s->getASTContext() == 
m_ast_up.get());
 
 
  620    llvm::IntrusiveRefCntPtr<ExternalASTSource> ast_source_sp) {
 
  622  ast.getTranslationUnitDecl()->setHasExternalLexicalStorage(
true);
 
  623  ast.setExternalSource(std::move(ast_source_sp));
 
 
  636                        const clang::Diagnostic &info)
 override {
 
  638      llvm::SmallVector<char, 32> diag_str(10);
 
  639      info.FormatDiagnostic(diag_str);
 
  640      diag_str.push_back(
'\0');
 
 
  645  DiagnosticConsumer *
clone(DiagnosticsEngine &Diags)
 const {
 
 
 
  666  clang::FileSystemOptions file_system_options;
 
  676  m_ast_up = std::make_unique<ASTContext>(
 
  688    m_ast_up->InitBuiltinTypes(*target_info);
 
  692            "Failed to initialize builtin ASTContext types for target '{0}'. " 
  693            "Printing variables may behave unexpectedly.",
 
  699    static std::once_flag s_uninitialized_target_warning;
 
  701                            &s_uninitialized_target_warning);
 
  707      llvm::makeIntrusiveRefCnt<ClangExternalASTSourceCallbacks>(*
this);
 
 
  739#pragma mark Basic Types 
  742                                          ASTContext &ast, QualType qual_type) {
 
  743  uint64_t qual_type_bit_size = ast.getTypeSize(qual_type);
 
  744  return qual_type_bit_size == bit_size;
 
 
  763      return GetType(ast.UnsignedCharTy);
 
  765      return GetType(ast.UnsignedShortTy);
 
  767      return GetType(ast.UnsignedIntTy);
 
  769      return GetType(ast.UnsignedLongTy);
 
  771      return GetType(ast.UnsignedLongLongTy);
 
  773      return GetType(ast.UnsignedInt128Ty);
 
  778      return GetType(ast.SignedCharTy);
 
  786      return GetType(ast.LongLongTy);
 
  797      return GetType(ast.LongDoubleTy);
 
  801      return GetType(ast.Float128Ty);
 
  806    if (bit_size && !(bit_size & 0x7u))
 
  807      return GetType(ast.getExtVectorType(ast.UnsignedCharTy, bit_size / 8));
 
 
  815  static const llvm::StringMap<lldb::BasicType> g_type_map = {
 
  880  auto iter = g_type_map.find(name);
 
  881  if (iter == g_type_map.end())
 
 
  908    llvm::StringRef type_name, uint32_t dw_ate, uint32_t bit_size) {
 
  927      return GetType(ast.UnsignedCharTy);
 
  929      return GetType(ast.UnsignedShortTy);
 
  931      return GetType(ast.UnsignedIntTy);
 
  936    if (type_name.contains(
"complex")) {
 
  945  case DW_ATE_complex_float: {
 
  946    CanQualType FloatComplexTy = ast.getComplexType(ast.FloatTy);
 
  948      return GetType(FloatComplexTy);
 
  950    CanQualType DoubleComplexTy = ast.getComplexType(ast.DoubleTy);
 
  952      return GetType(DoubleComplexTy);
 
  954    CanQualType LongDoubleComplexTy = ast.getComplexType(ast.LongDoubleTy);
 
  956      return GetType(LongDoubleComplexTy);
 
  966    if (type_name == 
"float" &&
 
  969    if (type_name == 
"double" &&
 
  972    if (type_name == 
"long double" &&
 
  974      return GetType(ast.LongDoubleTy);
 
  975    if (type_name == 
"__bf16" &&
 
  977      return GetType(ast.BFloat16Ty);
 
  978    if (type_name == 
"_Float16" &&
 
  984    if ((type_name == 
"__float128" || type_name == 
"_Float128" ||
 
  985         type_name == 
"f128") &&
 
  987      return GetType(ast.Float128Ty);
 
  994      return GetType(ast.LongDoubleTy);
 
  998      return GetType(ast.Float128Ty);
 
 1002    if (!type_name.empty()) {
 
 1003      if (type_name.starts_with(
"_BitInt"))
 
 1004        return GetType(ast.getBitIntType(
false, bit_size));
 
 1005      if (type_name == 
"wchar_t" &&
 
 1010      if (type_name == 
"void" &&
 
 1013      if (type_name.contains(
"long long") &&
 
 1015        return GetType(ast.LongLongTy);
 
 1016      if (type_name.contains(
"long") &&
 
 1019      if (type_name.contains(
"short") &&
 
 1022      if (type_name.contains(
"char")) {
 
 1026          return GetType(ast.SignedCharTy);
 
 1028      if (type_name.contains(
"int")) {
 
 1045      return GetType(ast.LongLongTy);
 
 1050  case DW_ATE_signed_char:
 
 1051    if (type_name == 
"char") {
 
 1056      return GetType(ast.SignedCharTy);
 
 1059  case DW_ATE_unsigned:
 
 1060    if (!type_name.empty()) {
 
 1061      if (type_name.starts_with(
"unsigned _BitInt"))
 
 1062        return GetType(ast.getBitIntType(
true, bit_size));
 
 1063      if (type_name == 
"wchar_t") {
 
 1070      if (type_name.contains(
"long long")) {
 
 1072          return GetType(ast.UnsignedLongLongTy);
 
 1073      } 
else if (type_name.contains(
"long")) {
 
 1075          return GetType(ast.UnsignedLongTy);
 
 1076      } 
else if (type_name.contains(
"short")) {
 
 1078          return GetType(ast.UnsignedShortTy);
 
 1079      } 
else if (type_name.contains(
"char")) {
 
 1081          return GetType(ast.UnsignedCharTy);
 
 1082      } 
else if (type_name.contains(
"int")) {
 
 1084          return GetType(ast.UnsignedIntTy);
 
 1086          return GetType(ast.UnsignedInt128Ty);
 
 1091      return GetType(ast.UnsignedCharTy);
 
 1093      return GetType(ast.UnsignedShortTy);
 
 1095      return GetType(ast.UnsignedIntTy);
 
 1097      return GetType(ast.UnsignedLongTy);
 
 1099      return GetType(ast.UnsignedLongLongTy);
 
 1101      return GetType(ast.UnsignedInt128Ty);
 
 1104  case DW_ATE_unsigned_char:
 
 1105    if (type_name == 
"char") {
 
 1110      return GetType(ast.UnsignedCharTy);
 
 1112      return GetType(ast.UnsignedShortTy);
 
 1115  case DW_ATE_imaginary_float:
 
 1127      if (!type_name.empty()) {
 
 1128        if (type_name == 
"char16_t")
 
 1130        if (type_name == 
"char32_t")
 
 1132        if (type_name == 
"char8_t")
 
 1141           "error: need to add support for DW_TAG_base_type '{0}' " 
 1142           "encoded with DW_ATE = {1:x}, bit_size = {2}",
 
 1143           type_name, dw_ate, bit_size);
 
 
 1149  QualType char_type(ast.CharTy);
 
 1152    char_type.addConst();
 
 1154  return GetType(ast.getPointerType(char_type));
 
 
 1158                                   bool ignore_qualifiers) {
 
 1169  if (ignore_qualifiers) {
 
 1170    type1_qual = type1_qual.getUnqualifiedType();
 
 1171    type2_qual = type2_qual.getUnqualifiedType();
 
 1174  return ast->getASTContext().hasSameType(type1_qual, type2_qual);
 
 
 1181  clang::Decl *decl = 
static_cast<clang::Decl *
>(opaque_decl);
 
 1182  if (
auto *named_decl = llvm::dyn_cast<clang::NamedDecl>(decl))
 
 
 1194  if (clang::ObjCInterfaceDecl *interface_decl =
 
 1195      llvm::dyn_cast<clang::ObjCInterfaceDecl>(decl))
 
 1197  if (clang::TagDecl *tag_decl = llvm::dyn_cast<clang::TagDecl>(decl))
 
 1199  if (clang::ValueDecl *value_decl = llvm::dyn_cast<clang::ValueDecl>(decl))
 
 
 1213  return GetType(value_decl->getType());
 
 
 1216#pragma mark Structure, Unions, Classes 
 1220  if (!decl || !owning_module.
HasValue())
 
 1223  decl->setFromASTFile();
 
 1224  decl->setOwningModuleID(owning_module.
GetValue());
 
 1225  decl->setModuleOwnershipKind(clang::Decl::ModuleOwnershipKind::Visible);
 
 
 1231                                        bool is_framework, 
bool is_explicit) {
 
 1233  auto *ast_source = llvm::dyn_cast_or_null<ClangExternalASTSourceCallbacks>(
 
 1235  assert(ast_source && 
"external ast source was lost");
 
 1253  clang::Module *module;
 
 1254  auto parent_desc = ast_source->getSourceDescriptor(parent.
GetValue());
 
 1256      name, parent_desc ? parent_desc->getModuleOrNull() : 
nullptr,
 
 1257      is_framework, is_explicit);
 
 1259    return ast_source->GetIDForModule(module);
 
 1261  return ast_source->RegisterModule(module);
 
 
 1266    AccessType access_type, llvm::StringRef name, 
int kind,
 
 1267    LanguageType language, std::optional<ClangASTMetadata> metadata,
 
 1268    bool exports_symbols) {
 
 1271  if (decl_ctx == 
nullptr)
 
 1272    decl_ctx = ast.getTranslationUnitDecl();
 
 1276    bool isInternal = 
false;
 
 1277    return CreateObjCClass(name, decl_ctx, owning_module, isInternal, metadata);
 
 1286  bool has_name = !name.empty();
 
 1287  CXXRecordDecl *decl = CXXRecordDecl::CreateDeserialized(ast, GlobalDeclID());
 
 1288  decl->setTagKind(
static_cast<TagDecl::TagKind
>(kind));
 
 1289  decl->setDeclContext(decl_ctx);
 
 1291    decl->setDeclName(&ast.Idents.get(name));
 
 1319    if (isa<CXXRecordDecl>(decl_ctx) && exports_symbols)
 
 1320      decl->setAnonymousStructOrUnion(
true);
 
 1330    decl_ctx->addDecl(decl);
 
 1332  return GetType(ast.getCanonicalTagType(decl));
 
 
 1339QualType GetValueParamType(
const clang::TemplateArgument &argument) {
 
 1340  switch (argument.getKind()) {
 
 1341  case TemplateArgument::Integral:
 
 1342    return argument.getIntegralType();
 
 1343  case TemplateArgument::StructuralValue:
 
 1344    return argument.getStructuralValueType();
 
 1350void AddAccessSpecifierDecl(clang::CXXRecordDecl *cxx_record_decl,
 
 1352                            clang::AccessSpecifier previous_access,
 
 1353                            clang::AccessSpecifier access_specifier) {
 
 1354  if (!cxx_record_decl->isClass() && !cxx_record_decl->isStruct())
 
 1356  if (previous_access != access_specifier) {
 
 1359    if ((cxx_record_decl->isStruct() &&
 
 1360         previous_access == clang::AccessSpecifier::AS_none &&
 
 1361         access_specifier == clang::AccessSpecifier::AS_public) ||
 
 1362        (cxx_record_decl->isClass() &&
 
 1363         previous_access == clang::AccessSpecifier::AS_none &&
 
 1364         access_specifier == clang::AccessSpecifier::AS_private)) {
 
 1367    cxx_record_decl->addDecl(
 
 1368        AccessSpecDecl::Create(ct, access_specifier, cxx_record_decl,
 
 1369                               SourceLocation(), SourceLocation()));
 
 1377    llvm::SmallVector<NamedDecl *, 8> &template_param_decls) {
 
 1378  const bool parameter_pack = 
false;
 
 1379  const bool is_typename = 
false;
 
 1380  const unsigned depth = 0;
 
 1381  const size_t num_template_params = template_param_infos.
Size();
 
 1382  DeclContext *
const decl_context =
 
 1383      ast.getTranslationUnitDecl(); 
 
 1385  auto const &args = template_param_infos.
GetArgs();
 
 1386  auto const &names = template_param_infos.
GetNames();
 
 1387  for (
size_t i = 0; i < num_template_params; ++i) {
 
 1388    const char *name = names[i];
 
 1390    IdentifierInfo *identifier_info = 
nullptr;
 
 1391    if (name && name[0])
 
 1392      identifier_info = &ast.Idents.get(name);
 
 1393    TemplateArgument 
const &targ = args[i];
 
 1394    QualType template_param_type = GetValueParamType(targ);
 
 1395    if (!template_param_type.isNull()) {
 
 1396      template_param_decls.push_back(NonTypeTemplateParmDecl::Create(
 
 1397          ast, decl_context, SourceLocation(), SourceLocation(), depth, i,
 
 1398          identifier_info, template_param_type, parameter_pack,
 
 1399          ast.getTrivialTypeSourceInfo(template_param_type)));
 
 1401      template_param_decls.push_back(TemplateTypeParmDecl::Create(
 
 1402          ast, decl_context, SourceLocation(), SourceLocation(), depth, i,
 
 1403          identifier_info, is_typename, parameter_pack));
 
 1408    IdentifierInfo *identifier_info = 
nullptr;
 
 1410      identifier_info = &ast.Idents.get(template_param_infos.
GetPackName());
 
 1411    const bool parameter_pack_true = 
true;
 
 1413    QualType template_param_type =
 
 1417    if (!template_param_type.isNull()) {
 
 1418      template_param_decls.push_back(NonTypeTemplateParmDecl::Create(
 
 1419          ast, decl_context, SourceLocation(), SourceLocation(), depth,
 
 1420          num_template_params, identifier_info, template_param_type,
 
 1421          parameter_pack_true,
 
 1422          ast.getTrivialTypeSourceInfo(template_param_type)));
 
 1424      template_param_decls.push_back(TemplateTypeParmDecl::Create(
 
 1425          ast, decl_context, SourceLocation(), SourceLocation(), depth,
 
 1426          num_template_params, identifier_info, is_typename,
 
 1427          parameter_pack_true));
 
 1430  clang::Expr *
const requires_clause = 
nullptr; 
 
 1431  TemplateParameterList *template_param_list = TemplateParameterList::Create(
 
 1432      ast, SourceLocation(), SourceLocation(), template_param_decls,
 
 1433      SourceLocation(), requires_clause);
 
 1434  return template_param_list;
 
 
 1439    clang::FunctionDecl *func_decl,
 
 1444  llvm::SmallVector<NamedDecl *, 8> template_param_decls;
 
 1446      ast, template_param_infos, template_param_decls);
 
 1447  FunctionTemplateDecl *func_tmpl_decl =
 
 1448      FunctionTemplateDecl::CreateDeserialized(ast, GlobalDeclID());
 
 1449  func_tmpl_decl->setDeclContext(decl_ctx);
 
 1450  func_tmpl_decl->setLocation(func_decl->getLocation());
 
 1451  func_tmpl_decl->setDeclName(func_decl->getDeclName());
 
 1452  func_tmpl_decl->setTemplateParameters(template_param_list);
 
 1453  func_tmpl_decl->init(func_decl);
 
 1456  for (
size_t i = 0, template_param_decl_count = template_param_decls.size();
 
 1457       i < template_param_decl_count; ++i) {
 
 1459    template_param_decls[i]->setDeclContext(func_decl);
 
 1464  if (decl_ctx->isRecord())
 
 1465    func_tmpl_decl->setAccess(clang::AccessSpecifier::AS_public);
 
 1467  return func_tmpl_decl;
 
 
 1471    FunctionDecl *func_decl, clang::FunctionTemplateDecl *func_tmpl_decl,
 
 1473  TemplateArgumentList *template_args_ptr = TemplateArgumentList::CreateCopy(
 
 1474      func_decl->getASTContext(), infos.
GetArgs());
 
 1476  func_decl->setFunctionTemplateSpecialization(func_tmpl_decl,
 
 1477                                               template_args_ptr, 
nullptr);
 
 
 1484                                         const TemplateArgument &value) {
 
 1485  if (llvm::isa<TemplateTypeParmDecl>(param)) {
 
 1487    if (value.getKind() != TemplateArgument::Type)
 
 1489  } 
else if (
auto *type_param =
 
 1490                 llvm::dyn_cast<NonTypeTemplateParmDecl>(param)) {
 
 1492    QualType value_param_type = GetValueParamType(value);
 
 1493    if (value_param_type.isNull())
 
 1497    if (type_param->getType() != value_param_type)
 
 1505             "Don't know how to compare template parameter to passed" 
 1506             " value. Decl kind of parameter is: {0}",
 
 1507             param->getDeclKindName());
 
 1508    lldbassert(
false && 
"Can't compare this TemplateParmDecl subclass");
 
 
 1523    ClassTemplateDecl *class_template_decl,
 
 1526  TemplateParameterList ¶ms = *class_template_decl->getTemplateParameters();
 
 1532  std::optional<NamedDecl *> pack_parameter;
 
 1534  size_t non_pack_params = params.size();
 
 1535  for (
size_t i = 0; i < params.size(); ++i) {
 
 1536    NamedDecl *param = params.getParam(i);
 
 1537    if (param->isParameterPack()) {
 
 1538      pack_parameter = param;
 
 1539      non_pack_params = i;
 
 1547  if (non_pack_params != instantiation_values.
Size())
 
 1565  for (
const auto pair :
 
 1566       llvm::zip_first(instantiation_values.
GetArgs(), params)) {
 
 1567    const TemplateArgument &passed_arg = std::get<0>(pair);
 
 1568    NamedDecl *found_param = std::get<1>(pair);
 
 1573  return class_template_decl;
 
 
 1582  ClassTemplateDecl *class_template_decl = 
nullptr;
 
 1583  if (decl_ctx == 
nullptr)
 
 1584    decl_ctx = ast.getTranslationUnitDecl();
 
 1586  IdentifierInfo &identifier_info = ast.Idents.get(class_name);
 
 1587  DeclarationName decl_name(&identifier_info);
 
 1590  clang::DeclContext::lookup_result result = decl_ctx->lookup(decl_name);
 
 1591  for (NamedDecl *decl : result) {
 
 1592    class_template_decl = dyn_cast<clang::ClassTemplateDecl>(decl);
 
 1593    if (!class_template_decl)
 
 1602                                                template_param_infos))
 
 1604    return class_template_decl;
 
 1607  llvm::SmallVector<NamedDecl *, 8> template_param_decls;
 
 1610      ast, template_param_infos, template_param_decls);
 
 1612  CXXRecordDecl *template_cxx_decl =
 
 1613      CXXRecordDecl::CreateDeserialized(ast, GlobalDeclID());
 
 1614  template_cxx_decl->setTagKind(
static_cast<TagDecl::TagKind
>(kind));
 
 1616  template_cxx_decl->setDeclContext(decl_ctx);
 
 1617  template_cxx_decl->setDeclName(decl_name);
 
 1620  for (
size_t i = 0, template_param_decl_count = template_param_decls.size();
 
 1621       i < template_param_decl_count; ++i) {
 
 1622    template_param_decls[i]->setDeclContext(template_cxx_decl);
 
 1630  class_template_decl =
 
 1631      ClassTemplateDecl::CreateDeserialized(ast, GlobalDeclID());
 
 1633  class_template_decl->setDeclContext(decl_ctx);
 
 1634  class_template_decl->setDeclName(decl_name);
 
 1635  class_template_decl->setTemplateParameters(template_param_list);
 
 1636  class_template_decl->init(template_cxx_decl);
 
 1637  template_cxx_decl->setDescribedClassTemplate(class_template_decl);
 
 1641    class_template_decl->setAccess(
 
 1644  decl_ctx->addDecl(class_template_decl);
 
 1646  VerifyDecl(class_template_decl);
 
 1648  return class_template_decl;
 
 
 1651TemplateTemplateParmDecl *
 
 1655  auto *decl_ctx = ast.getTranslationUnitDecl();
 
 1657  IdentifierInfo &identifier_info = ast.Idents.get(template_name);
 
 1658  llvm::SmallVector<NamedDecl *, 8> template_param_decls;
 
 1662      ast, template_param_infos, template_param_decls);
 
 1668  return TemplateTemplateParmDecl::Create(
 
 1669      ast, decl_ctx, SourceLocation(),
 
 1671      false, &identifier_info,
 
 1672      TemplateNameKind::TNK_Type_template, 
true,
 
 1673      template_param_list);
 
 
 1676ClassTemplateSpecializationDecl *
 
 1679    ClassTemplateDecl *class_template_decl, 
int kind,
 
 1682  llvm::SmallVector<clang::TemplateArgument, 2> args(
 
 1683      template_param_infos.
Size() +
 
 1686  auto const &orig_args = template_param_infos.
GetArgs();
 
 1687  std::copy(orig_args.begin(), orig_args.end(), args.begin());
 
 1689    args[args.size() - 1] = TemplateArgument::CreatePackCopy(
 
 1692  ClassTemplateSpecializationDecl *class_template_specialization_decl =
 
 1693      ClassTemplateSpecializationDecl::CreateDeserialized(ast, GlobalDeclID());
 
 1694  class_template_specialization_decl->setTagKind(
 
 1695      static_cast<TagDecl::TagKind
>(kind));
 
 1696  class_template_specialization_decl->setDeclContext(decl_ctx);
 
 1697  class_template_specialization_decl->setInstantiationOf(class_template_decl);
 
 1698  class_template_specialization_decl->setTemplateArgs(
 
 1699      TemplateArgumentList::CreateCopy(ast, args));
 
 1700  void *insert_pos = 
nullptr;
 
 1701  if (class_template_decl->findSpecialization(args, insert_pos))
 
 1703  class_template_decl->AddSpecialization(class_template_specialization_decl,
 
 1705  class_template_specialization_decl->setDeclName(
 
 1706      class_template_decl->getDeclName());
 
 1711  class_template_specialization_decl->setStrictPackMatch(
false);
 
 1714  decl_ctx->addDecl(class_template_specialization_decl);
 
 1716  class_template_specialization_decl->setSpecializationKind(
 
 1717      TSK_ExplicitSpecialization);
 
 1719  return class_template_specialization_decl;
 
 
 1723    ClassTemplateSpecializationDecl *class_template_specialization_decl) {
 
 1724  if (class_template_specialization_decl) {
 
 1726    return GetType(ast.getCanonicalTagType(class_template_specialization_decl));
 
 
 1732                                  clang::OverloadedOperatorKind op_kind,
 
 1733                                  bool unary, 
bool binary,
 
 1734                                  uint32_t num_params) {
 
 1736  if (op_kind == OO_Call)
 
 1742  if (num_params == 1)
 
 1744  if (num_params == 2)
 
 
 1751    bool is_method, clang::OverloadedOperatorKind op_kind,
 
 1752    uint32_t num_params) {
 
 1760  case OO_Array_Delete:
 
 1764#define OVERLOADED_OPERATOR(Name, Spelling, Token, Unary, Binary, MemberOnly)  \ 
 1766    return check_op_param(is_method, op_kind, Unary, Binary, num_params); 
 1768#include "clang/Basic/OperatorKinds.def" 
 
 1775clang::AccessSpecifier
 
 1777                                       clang::AccessSpecifier rhs) {
 
 1780  if (lhs == AS_none || rhs == AS_none)
 
 1782  if (lhs == AS_private || rhs == AS_private)
 
 1784  if (lhs == AS_protected || rhs == AS_protected)
 
 1785    return AS_protected;
 
 
 1790                                      uint32_t &bitfield_bit_size) {
 
 1792  if (field == 
nullptr)
 
 1795  if (field->isBitField()) {
 
 1796    Expr *bit_width_expr = field->getBitWidth();
 
 1797    if (bit_width_expr) {
 
 1798      if (std::optional<llvm::APSInt> bit_width_apsint =
 
 1799              bit_width_expr->getIntegerConstantExpr(ast)) {
 
 1800        bitfield_bit_size = bit_width_apsint->getLimitedValue(
UINT32_MAX);
 
 
 1809  if (record_decl == 
nullptr)
 
 1812  if (!record_decl->field_empty())
 
 1816  const CXXRecordDecl *cxx_record_decl = dyn_cast<CXXRecordDecl>(record_decl);
 
 1817  if (cxx_record_decl) {
 
 1818    CXXRecordDecl::base_class_const_iterator base_class, base_class_end;
 
 1819    for (base_class = cxx_record_decl->bases_begin(),
 
 1820        base_class_end = cxx_record_decl->bases_end();
 
 1821         base_class != base_class_end; ++base_class) {
 
 1822      assert(record_decl != base_class->getType()->getAsCXXRecordDecl() &&
 
 1823             "Base can't inherit from itself.");
 
 1835  if (std::optional<ClangASTMetadata> meta_data = 
GetMetadata(record_decl);
 
 1836      meta_data && meta_data->IsForcefullyCompleted())
 
 
 1842#pragma mark Objective-C Classes 
 1845    llvm::StringRef name, clang::DeclContext *decl_ctx,
 
 1847    std::optional<ClangASTMetadata> metadata) {
 
 1849  assert(!name.empty());
 
 1851    decl_ctx = ast.getTranslationUnitDecl();
 
 1853  ObjCInterfaceDecl *decl =
 
 1854      ObjCInterfaceDecl::CreateDeserialized(ast, GlobalDeclID());
 
 1855  decl->setDeclContext(decl_ctx);
 
 1856  decl->setDeclName(&ast.Idents.get(name));
 
 1857  decl->setImplicit(isInternal);
 
 1863  return GetType(ast.getObjCInterfaceType(decl));
 
 
 1872                                   bool omit_empty_base_classes) {
 
 1873  uint32_t num_bases = 0;
 
 1874  if (cxx_record_decl) {
 
 1875    if (omit_empty_base_classes) {
 
 1876      CXXRecordDecl::base_class_const_iterator base_class, base_class_end;
 
 1877      for (base_class = cxx_record_decl->bases_begin(),
 
 1878          base_class_end = cxx_record_decl->bases_end();
 
 1879           base_class != base_class_end; ++base_class) {
 
 1886      num_bases = cxx_record_decl->getNumBases();
 
 
 1891#pragma mark Namespace Declarations 
 1894    const char *name, clang::DeclContext *decl_ctx,
 
 1896  NamespaceDecl *namespace_decl = 
nullptr;
 
 1898  TranslationUnitDecl *translation_unit_decl = ast.getTranslationUnitDecl();
 
 1900    decl_ctx = translation_unit_decl;
 
 1903    IdentifierInfo &identifier_info = ast.Idents.get(name);
 
 1904    DeclarationName decl_name(&identifier_info);
 
 1905    clang::DeclContext::lookup_result result = decl_ctx->lookup(decl_name);
 
 1906    for (NamedDecl *decl : result) {
 
 1907      namespace_decl = dyn_cast<clang::NamespaceDecl>(decl);
 
 1909        return namespace_decl;
 
 1912    namespace_decl = NamespaceDecl::Create(ast, decl_ctx, is_inline,
 
 1913                                           SourceLocation(), SourceLocation(),
 
 1914                                           &identifier_info, 
nullptr, 
false);
 
 1916    decl_ctx->addDecl(namespace_decl);
 
 1918    if (decl_ctx == translation_unit_decl) {
 
 1919      namespace_decl = translation_unit_decl->getAnonymousNamespace();
 
 1921        return namespace_decl;
 
 1924          NamespaceDecl::Create(ast, decl_ctx, 
false, SourceLocation(),
 
 1925                                SourceLocation(), 
nullptr, 
nullptr, 
false);
 
 1926      translation_unit_decl->setAnonymousNamespace(namespace_decl);
 
 1927      translation_unit_decl->addDecl(namespace_decl);
 
 1928      assert(namespace_decl == translation_unit_decl->getAnonymousNamespace());
 
 1930      NamespaceDecl *parent_namespace_decl = cast<NamespaceDecl>(decl_ctx);
 
 1931      if (parent_namespace_decl) {
 
 1932        namespace_decl = parent_namespace_decl->getAnonymousNamespace();
 
 1934          return namespace_decl;
 
 1936            NamespaceDecl::Create(ast, decl_ctx, 
false, SourceLocation(),
 
 1937                                  SourceLocation(), 
nullptr, 
nullptr, 
false);
 
 1938        parent_namespace_decl->setAnonymousNamespace(namespace_decl);
 
 1939        parent_namespace_decl->addDecl(namespace_decl);
 
 1940        assert(namespace_decl ==
 
 1941               parent_namespace_decl->getAnonymousNamespace());
 
 1943        assert(
false && 
"GetUniqueNamespaceDeclaration called with no name and " 
 1944                        "no namespace as decl_ctx");
 
 1952  VerifyDecl(namespace_decl);
 
 1953  return namespace_decl;
 
 
 1960    clang::BlockDecl *decl =
 
 1961        clang::BlockDecl::CreateDeserialized(
getASTContext(), GlobalDeclID());
 
 1962    decl->setDeclContext(ctx);
 
 
 1971                                        clang::DeclContext *right,
 
 1972                                        clang::DeclContext *root) {
 
 1973  if (root == 
nullptr)
 
 1976  std::set<clang::DeclContext *> path_left;
 
 1977  for (clang::DeclContext *d = left; d != 
nullptr; d = d->getParent())
 
 1978    path_left.insert(d);
 
 1980  for (clang::DeclContext *d = right; d != 
nullptr; d = d->getParent())
 
 1981    if (path_left.find(d) != path_left.end())
 
 
 1989    clang::NamespaceDecl *ns_decl) {
 
 1990  if (decl_ctx && ns_decl) {
 
 1991    auto *translation_unit = 
getASTContext().getTranslationUnitDecl();
 
 1992    clang::UsingDirectiveDecl *using_decl = clang::UsingDirectiveDecl::Create(
 
 1994          clang::SourceLocation(), clang::NestedNameSpecifierLoc(),
 
 1995          clang::SourceLocation(), ns_decl,
 
 1998      decl_ctx->addDecl(using_decl);
 
 
 2008                                        clang::NamedDecl *target) {
 
 2009  if (current_decl_ctx && target) {
 
 2010    clang::UsingDecl *using_decl = clang::UsingDecl::Create(
 
 2012        clang::NestedNameSpecifierLoc(), clang::DeclarationNameInfo(), 
false);
 
 2014    clang::UsingShadowDecl *shadow_decl = clang::UsingShadowDecl::Create(
 
 2016        target->getDeclName(), using_decl, target);
 
 2018    using_decl->addShadowDecl(shadow_decl);
 
 2019    current_decl_ctx->addDecl(using_decl);
 
 
 2027    const char *name, clang::QualType type) {
 
 2029    clang::VarDecl *var_decl =
 
 2030        clang::VarDecl::CreateDeserialized(
getASTContext(), GlobalDeclID());
 
 2031    var_decl->setDeclContext(decl_context);
 
 2032    if (name && name[0])
 
 2033      var_decl->setDeclName(&
getASTContext().Idents.getOwn(name));
 
 2034    var_decl->setType(type);
 
 2036    var_decl->setAccess(clang::AS_public);
 
 2037    decl_context->addDecl(var_decl);
 
 
 2046  switch (basic_type) {
 
 2048    return ast->VoidTy.getAsOpaquePtr();
 
 2050    return ast->CharTy.getAsOpaquePtr();
 
 2052    return ast->SignedCharTy.getAsOpaquePtr();
 
 2054    return ast->UnsignedCharTy.getAsOpaquePtr();
 
 2056    return ast->getWCharType().getAsOpaquePtr();
 
 2058    return ast->getSignedWCharType().getAsOpaquePtr();
 
 2060    return ast->getUnsignedWCharType().getAsOpaquePtr();
 
 2062    return ast->Char8Ty.getAsOpaquePtr();
 
 2064    return ast->Char16Ty.getAsOpaquePtr();
 
 2066    return ast->Char32Ty.getAsOpaquePtr();
 
 2068    return ast->ShortTy.getAsOpaquePtr();
 
 2070    return ast->UnsignedShortTy.getAsOpaquePtr();
 
 2072    return ast->IntTy.getAsOpaquePtr();
 
 2074    return ast->UnsignedIntTy.getAsOpaquePtr();
 
 2076    return ast->LongTy.getAsOpaquePtr();
 
 2078    return ast->UnsignedLongTy.getAsOpaquePtr();
 
 2080    return ast->LongLongTy.getAsOpaquePtr();
 
 2082    return ast->UnsignedLongLongTy.getAsOpaquePtr();
 
 2084    return ast->Int128Ty.getAsOpaquePtr();
 
 2086    return ast->UnsignedInt128Ty.getAsOpaquePtr();
 
 2088    return ast->BoolTy.getAsOpaquePtr();
 
 2090    return ast->HalfTy.getAsOpaquePtr();
 
 2092    return ast->FloatTy.getAsOpaquePtr();
 
 2094    return ast->DoubleTy.getAsOpaquePtr();
 
 2096    return ast->LongDoubleTy.getAsOpaquePtr();
 
 2098    return ast->Float128Ty.getAsOpaquePtr();
 
 2100    return ast->getComplexType(ast->FloatTy).getAsOpaquePtr();
 
 2102    return ast->getComplexType(ast->DoubleTy).getAsOpaquePtr();
 
 2104    return ast->getComplexType(ast->LongDoubleTy).getAsOpaquePtr();
 
 2106    return ast->getObjCIdType().getAsOpaquePtr();
 
 2108    return ast->getObjCClassType().getAsOpaquePtr();
 
 2110    return ast->getObjCSelType().getAsOpaquePtr();
 
 2112    return ast->NullPtrTy.getAsOpaquePtr();
 
 
 2118#pragma mark Function Types 
 2120clang::DeclarationName
 
 2123  clang::OverloadedOperatorKind op_kind = clang::NUM_OVERLOADED_OPERATORS;
 
 2124  if (!
IsOperator(name, op_kind) || op_kind == clang::NUM_OVERLOADED_OPERATORS)
 
 2133  const clang::FunctionProtoType *function_type =
 
 2134      llvm::dyn_cast<clang::FunctionProtoType>(method_qual_type.getTypePtr());
 
 2135  if (function_type == 
nullptr)
 
 2136    return clang::DeclarationName();
 
 2138  const bool is_method = 
false;
 
 2139  const unsigned int num_params = function_type->getNumParams();
 
 2141          is_method, op_kind, num_params))
 
 2142    return clang::DeclarationName();
 
 2144  return getASTContext().DeclarationNames.getCXXOperatorName(op_kind);
 
 
 2148  clang::PrintingPolicy printing_policy(
getASTContext().getPrintingPolicy());
 
 2149  printing_policy.SuppressTagKeyword = 
true;
 
 2152  printing_policy.SuppressInlineNamespace = 
false;
 
 2153  printing_policy.SuppressUnwrittenScope = 
false;
 
 2165  printing_policy.SuppressDefaultTemplateArgs = 
false;
 
 2166  return printing_policy;
 
 
 2173  llvm::raw_string_ostream os(result);
 
 2174  named_decl->getNameForDiagnostic(os, printing_policy, qualified);
 
 
 2180    llvm::StringRef name, 
const CompilerType &function_clang_type,
 
 2181    clang::StorageClass storage, 
bool is_inline, llvm::StringRef asm_label) {
 
 2182  FunctionDecl *func_decl = 
nullptr;
 
 2185    decl_ctx = ast.getTranslationUnitDecl();
 
 2187  const bool hasWrittenPrototype = 
true;
 
 2188  const bool isConstexprSpecified = 
false;
 
 2190  clang::DeclarationName declarationName =
 
 2192  func_decl = FunctionDecl::CreateDeserialized(ast, GlobalDeclID());
 
 2193  func_decl->setDeclContext(decl_ctx);
 
 2194  func_decl->setDeclName(declarationName);
 
 2196  func_decl->setStorageClass(storage);
 
 2197  func_decl->setInlineSpecified(is_inline);
 
 2198  func_decl->setHasWrittenPrototype(hasWrittenPrototype);
 
 2199  func_decl->setConstexprKind(isConstexprSpecified
 
 2200                                  ? ConstexprSpecKind::Constexpr
 
 2201                                  : ConstexprSpecKind::Unspecified);
 
 2213  if (!asm_label.empty())
 
 2214    func_decl->addAttr(clang::AsmLabelAttr::CreateImplicit(ast, asm_label));
 
 2217  decl_ctx->addDecl(func_decl);
 
 2219  VerifyDecl(func_decl);
 
 
 2225    const CompilerType &result_type, llvm::ArrayRef<CompilerType> args,
 
 2226    bool is_variadic, 
unsigned type_quals, clang::CallingConv cc,
 
 2227    clang::RefQualifierKind ref_qual) {
 
 2231  std::vector<QualType> qual_type_args;
 
 2233  for (
const auto &arg : args) {
 
 2248  FunctionProtoType::ExtProtoInfo proto_info;
 
 2249  proto_info.ExtInfo = cc;
 
 2250  proto_info.Variadic = is_variadic;
 
 2251  proto_info.ExceptionSpec = EST_None;
 
 2252  proto_info.TypeQuals = clang::Qualifiers::fromFastMask(type_quals);
 
 2253  proto_info.RefQualifier = ref_qual;
 
 
 2261    const char *name, 
const CompilerType ¶m_type, 
int storage,
 
 2264  auto *decl = ParmVarDecl::CreateDeserialized(ast, GlobalDeclID());
 
 2265  decl->setDeclContext(decl_ctx);
 
 2266  if (name && name[0])
 
 2267    decl->setDeclName(&ast.Idents.get(name));
 
 2269  decl->setStorageClass(
static_cast<clang::StorageClass
>(storage));
 
 2272    decl_ctx->addDecl(decl);
 
 
 2279  QualType block_type = 
m_ast_up->getBlockPointerType(
 
 
 2285#pragma mark Array Types 
 2289                                 std::optional<size_t> element_count,
 
 2302                                   clang::ArraySizeModifier::Normal, 0));
 
 2308  llvm::APInt ap_element_count(64, *element_count);
 
 2310                                          ap_element_count, 
nullptr,
 
 2311                                          clang::ArraySizeModifier::Normal, 0));
 
 
 2315    llvm::StringRef type_name,
 
 2316    const std::initializer_list<std::pair<const char *, CompilerType>>
 
 2323    lldbassert(0 && 
"Trying to create a type for an existing name");
 
 2331  for (
const auto &field : type_fields)
 
 
 2341    llvm::StringRef type_name,
 
 2342    const std::initializer_list<std::pair<const char *, CompilerType>>
 
 
 2354#pragma mark Enumeration Types 
 2357    llvm::StringRef name, clang::DeclContext *decl_ctx,
 
 2359    const CompilerType &integer_clang_type, 
bool is_scoped,
 
 2360    std::optional<clang::EnumExtensibilityAttr::Kind> enum_kind) {
 
 2367  EnumDecl *enum_decl = EnumDecl::CreateDeserialized(ast, GlobalDeclID());
 
 2368  enum_decl->setDeclContext(decl_ctx);
 
 2370    enum_decl->setDeclName(&ast.Idents.get(name));
 
 2371  enum_decl->setScoped(is_scoped);
 
 2372  enum_decl->setScopedUsingClassTag(is_scoped);
 
 2373  enum_decl->setFixed(
false);
 
 2376    decl_ctx->addDecl(enum_decl);
 
 2380        clang::EnumExtensibilityAttr::CreateImplicit(ast, *enum_kind));
 
 2385  enum_decl->setAccess(AS_public); 
 
 2387  return GetType(ast.getCanonicalTagType(enum_decl));
 
 
 2398    if (bit_size == ast.getTypeSize(ast.SignedCharTy))
 
 2399      return GetType(ast.SignedCharTy);
 
 2401    if (bit_size == ast.getTypeSize(ast.ShortTy))
 
 2404    if (bit_size == ast.getTypeSize(ast.IntTy))
 
 2407    if (bit_size == ast.getTypeSize(ast.LongTy))
 
 2410    if (bit_size == ast.getTypeSize(ast.LongLongTy))
 
 2411      return GetType(ast.LongLongTy);
 
 2413    if (bit_size == ast.getTypeSize(ast.Int128Ty))
 
 2416    if (bit_size == ast.getTypeSize(ast.UnsignedCharTy))
 
 2417      return GetType(ast.UnsignedCharTy);
 
 2419    if (bit_size == ast.getTypeSize(ast.UnsignedShortTy))
 
 2420      return GetType(ast.UnsignedShortTy);
 
 2422    if (bit_size == ast.getTypeSize(ast.UnsignedIntTy))
 
 2423      return GetType(ast.UnsignedIntTy);
 
 2425    if (bit_size == ast.getTypeSize(ast.UnsignedLongTy))
 
 2426      return GetType(ast.UnsignedLongTy);
 
 2428    if (bit_size == ast.getTypeSize(ast.UnsignedLongLongTy))
 
 2429      return GetType(ast.UnsignedLongLongTy);
 
 2431    if (bit_size == ast.getTypeSize(ast.UnsignedInt128Ty))
 
 2432      return GetType(ast.UnsignedInt128Ty);
 
 
 2449    clang::NamedDecl *named_decl = llvm::dyn_cast<clang::NamedDecl>(decl_ctx);
 
 2451      printf(
"%20s: %s\n", decl_ctx->getDeclKindName(),
 
 2452             named_decl->getDeclName().getAsString().c_str());
 
 2454      printf(
"%20s\n", decl_ctx->getDeclKindName());
 
 
 2460  if (decl == 
nullptr)
 
 2464  clang::RecordDecl *record_decl = llvm::dyn_cast<clang::RecordDecl>(decl);
 
 2466    bool is_injected_class_name =
 
 2467        llvm::isa<clang::CXXRecordDecl>(record_decl) &&
 
 2468        llvm::cast<CXXRecordDecl>(record_decl)->isInjectedClassName();
 
 2469    printf(
"%20s: %s%s\n", decl->getDeclKindName(),
 
 2470           record_decl->getDeclName().getAsString().c_str(),
 
 2471           is_injected_class_name ? 
" (injected class name)" : 
"");
 
 2474    clang::NamedDecl *named_decl = llvm::dyn_cast<clang::NamedDecl>(decl);
 
 2476      printf(
"%20s: %s\n", decl->getDeclKindName(),
 
 2477             named_decl->getDeclName().getAsString().c_str());
 
 2479      printf(
"%20s\n", decl->getDeclKindName());
 
 
 2485                                      clang::Decl *decl) {
 
 2489  ExternalASTSource *ast_source = ast->getExternalSource();
 
 2494  if (clang::TagDecl *tag_decl = llvm::dyn_cast<clang::TagDecl>(decl)) {
 
 2495    if (tag_decl->isCompleteDefinition())
 
 2498    if (!tag_decl->hasExternalLexicalStorage())
 
 2501    ast_source->CompleteType(tag_decl);
 
 2503    return !ast->getCanonicalTagType(tag_decl)->isIncompleteType();
 
 2504  } 
else if (clang::ObjCInterfaceDecl *objc_interface_decl =
 
 2505                 llvm::dyn_cast<clang::ObjCInterfaceDecl>(decl)) {
 
 2506    if (objc_interface_decl->getDefinition())
 
 2509    if (!objc_interface_decl->hasExternalLexicalStorage())
 
 2512    ast_source->CompleteType(objc_interface_decl);
 
 2514    return !objc_interface_decl->getTypeForDecl()->isIncompleteType();
 
 
 2544std::optional<ClangASTMetadata>
 
 2550  return std::nullopt;
 
 
 2553std::optional<ClangASTMetadata>
 
 2559  return std::nullopt;
 
 
 2563                                             clang::AccessSpecifier access) {
 
 2564  if (access == clang::AccessSpecifier::AS_none)
 
 
 2570clang::AccessSpecifier
 
 2575  return clang::AccessSpecifier::AS_none;
 
 
 2597    if (find(mask, type->getTypeClass()) != mask.end())
 
 2599    switch (type->getTypeClass()) {
 
 2602    case clang::Type::Atomic:
 
 2603      type = cast<clang::AtomicType>(type)->getValueType();
 
 2605    case clang::Type::Auto:
 
 2606    case clang::Type::Decltype:
 
 2607    case clang::Type::Paren:
 
 2608    case clang::Type::SubstTemplateTypeParm:
 
 2609    case clang::Type::TemplateSpecialization:
 
 2610    case clang::Type::Typedef:
 
 2611    case clang::Type::TypeOf:
 
 2612    case clang::Type::TypeOfExpr:
 
 2613    case clang::Type::Using:
 
 2614    case clang::Type::PredefinedSugar:
 
 2615      type = type->getLocallyUnqualifiedSingleStepDesugaredType();
 
 
 2629  const clang::Type::TypeClass type_class = qual_type->getTypeClass();
 
 2630  switch (type_class) {
 
 2631  case clang::Type::ObjCInterface:
 
 2632    return llvm::cast<clang::ObjCObjectType>(qual_type.getTypePtr())
 
 2634  case clang::Type::ObjCObjectPointer:
 
 2636        llvm::cast<clang::ObjCObjectPointerType>(qual_type.getTypePtr())
 
 2637            ->getPointeeType());
 
 2638  case clang::Type::Enum:
 
 2639  case clang::Type::Record:
 
 2640    return llvm::cast<clang::TagType>(qual_type)
 
 2642        ->getDefinitionOrSelf();
 
 
 2655                                                      clang::QualType qual_type,
 
 2656                                                      bool allow_completion) {
 
 2657  assert(qual_type->isRecordType());
 
 2659  const auto *tag_type = llvm::cast<clang::RecordType>(qual_type.getTypePtr());
 
 2661  clang::CXXRecordDecl *cxx_record_decl = qual_type->getAsCXXRecordDecl();
 
 2665  if (!cxx_record_decl || !cxx_record_decl->hasExternalLexicalStorage())
 
 2668  const bool is_complete = cxx_record_decl->isCompleteDefinition();
 
 2669  const bool fields_loaded =
 
 2670      cxx_record_decl->hasLoadedFieldsFromExternalStorage();
 
 2673  if (is_complete && fields_loaded)
 
 2676  if (!allow_completion)
 
 2684  clang::ExternalASTSource *external_ast_source = ast->getExternalSource();
 
 2685  if (external_ast_source) {
 
 2686    external_ast_source->CompleteType(cxx_record_decl);
 
 2687    if (cxx_record_decl->isCompleteDefinition()) {
 
 2688      cxx_record_decl->field_begin();
 
 2689      cxx_record_decl->setHasLoadedFieldsFromExternalStorage(
true);
 
 
 2701                                                  clang::QualType qual_type,
 
 2702                                                  bool allow_completion) {
 
 2703  assert(qual_type->isEnumeralType());
 
 2706  const clang::EnumType *enum_type =
 
 2707      llvm::cast<clang::EnumType>(qual_type.getTypePtr());
 
 2709  auto *tag_decl = enum_type->getAsTagDecl();
 
 2713  if (tag_decl->getDefinition())
 
 2716  if (!allow_completion)
 
 2720  if (!tag_decl->hasExternalLexicalStorage())
 
 2724  clang::ExternalASTSource *external_ast_source = ast->getExternalSource();
 
 2725  if (!external_ast_source)
 
 2728  external_ast_source->CompleteType(tag_decl);
 
 
 2736static const clang::ObjCObjectType *
 
 2738                          bool allow_completion) {
 
 2739  assert(qual_type->isObjCObjectType());
 
 2742  const clang::ObjCObjectType *objc_class_type =
 
 2743      llvm::cast<clang::ObjCObjectType>(qual_type);
 
 2745  clang::ObjCInterfaceDecl *class_interface_decl =
 
 2746      objc_class_type->getInterface();
 
 2749  if (!class_interface_decl)
 
 2750    return objc_class_type;
 
 2753  if (class_interface_decl->getDefinition())
 
 2754    return objc_class_type;
 
 2756  if (!allow_completion)
 
 2760  if (!class_interface_decl->hasExternalLexicalStorage())
 
 2764  clang::ExternalASTSource *external_ast_source = ast->getExternalSource();
 
 2765  if (!external_ast_source)
 
 2768  external_ast_source->CompleteType(class_interface_decl);
 
 2769  return objc_class_type;
 
 
 2773                                clang::QualType qual_type,
 
 2774                                bool allow_completion = 
true) {
 
 2776  const clang::Type::TypeClass type_class = qual_type->getTypeClass();
 
 2777  switch (type_class) {
 
 2778  case clang::Type::ConstantArray:
 
 2779  case clang::Type::IncompleteArray:
 
 2780  case clang::Type::VariableArray: {
 
 2781    const clang::ArrayType *array_type =
 
 2782        llvm::dyn_cast<clang::ArrayType>(qual_type.getTypePtr());
 
 2788  case clang::Type::Record: {
 
 2789    if (
const auto *RT =
 
 2791      return !RT->isIncompleteType();
 
 2796  case clang::Type::Enum: {
 
 2798      return !ET->isIncompleteType();
 
 2802  case clang::Type::ObjCObject:
 
 2803  case clang::Type::ObjCInterface: {
 
 2804    if (
const auto *OT =
 
 2806      return !OT->isIncompleteType();
 
 2811  case clang::Type::Attributed:
 
 2813        ast, llvm::cast<clang::AttributedType>(qual_type)->getModifiedType(),
 
 2816  case clang::Type::MemberPointer:
 
 2819    if (ast->getTargetInfo().getCXXABI().isMicrosoft()) {
 
 2820      auto *MPT = qual_type.getTypePtr()->castAs<clang::MemberPointerType>();
 
 2821      if (
auto *RD = MPT->getMostRecentCXXRecordDecl())
 
 2825      return !qual_type.getTypePtr()->isIncompleteType();
 
 
 2836static clang::ObjCIvarDecl::AccessControl
 
 2840    return clang::ObjCIvarDecl::None;
 
 2842    return clang::ObjCIvarDecl::Public;
 
 2844    return clang::ObjCIvarDecl::Private;
 
 2846    return clang::ObjCIvarDecl::Protected;
 
 2848    return clang::ObjCIvarDecl::Package;
 
 2850  return clang::ObjCIvarDecl::None;
 
 
 2857  return !type || llvm::isa<clang::Type>(
GetQualType(type).getTypePtr());
 
 
 2864  const clang::Type::TypeClass type_class = qual_type->getTypeClass();
 
 2865  switch (type_class) {
 
 2866  case clang::Type::IncompleteArray:
 
 2867  case clang::Type::VariableArray:
 
 2868  case clang::Type::ConstantArray:
 
 2869  case clang::Type::ExtVector:
 
 2870  case clang::Type::Vector:
 
 2871  case clang::Type::Record:
 
 2872  case clang::Type::ObjCObject:
 
 2873  case clang::Type::ObjCInterface:
 
 
 2885  const clang::Type::TypeClass type_class = qual_type->getTypeClass();
 
 2886  switch (type_class) {
 
 2887  case clang::Type::Record: {
 
 2888    if (
const clang::RecordType *record_type =
 
 2889            llvm::dyn_cast_or_null<clang::RecordType>(
 
 2890                qual_type.getTypePtrOrNull())) {
 
 2891      if (
const clang::RecordDecl *record_decl = record_type->getDecl()) {
 
 2892        return record_decl->isAnonymousStructOrUnion();
 
 
 2906                                  uint64_t *size, 
bool *is_incomplete) {
 
 2909  const clang::Type::TypeClass type_class = qual_type->getTypeClass();
 
 2910  switch (type_class) {
 
 2914  case clang::Type::ConstantArray:
 
 2915    if (element_type_ptr)
 
 2917          weak_from_this(), llvm::cast<clang::ConstantArrayType>(qual_type)
 
 2921      *size = llvm::cast<clang::ConstantArrayType>(qual_type)
 
 2923                  .getLimitedValue(ULLONG_MAX);
 
 2925      *is_incomplete = 
false;
 
 2928  case clang::Type::IncompleteArray:
 
 2929    if (element_type_ptr)
 
 2931          weak_from_this(), llvm::cast<clang::IncompleteArrayType>(qual_type)
 
 2937      *is_incomplete = 
true;
 
 2940  case clang::Type::VariableArray:
 
 2941    if (element_type_ptr)
 
 2943          weak_from_this(), llvm::cast<clang::VariableArrayType>(qual_type)
 
 2949      *is_incomplete = 
false;
 
 2952  case clang::Type::DependentSizedArray:
 
 2953    if (element_type_ptr)
 
 2956          llvm::cast<clang::DependentSizedArrayType>(qual_type)
 
 2962      *is_incomplete = 
false;
 
 2965  if (element_type_ptr)
 
 2966    element_type_ptr->
Clear();
 
 2970    *is_incomplete = 
false;
 
 
 2978  const clang::Type::TypeClass type_class = qual_type->getTypeClass();
 
 2979  switch (type_class) {
 
 2980  case clang::Type::Vector: {
 
 2981    const clang::VectorType *vector_type =
 
 2982        qual_type->getAs<clang::VectorType>();
 
 2985        *size = vector_type->getNumElements();
 
 2987        *element_type = 
GetType(vector_type->getElementType());
 
 2991  case clang::Type::ExtVector: {
 
 2992    const clang::ExtVectorType *ext_vector_type =
 
 2993        qual_type->getAs<clang::ExtVectorType>();
 
 2994    if (ext_vector_type) {
 
 2996        *size = ext_vector_type->getNumElements();
 
 3000                         ext_vector_type->getElementType().getAsOpaquePtr());
 
 
 3016  if (!llvm::isa<clang::ObjCInterfaceDecl>(decl_ctx))
 
 3019  clang::ObjCInterfaceDecl *result_iface_decl =
 
 3020      llvm::dyn_cast<clang::ObjCInterfaceDecl>(decl_ctx);
 
 3022  std::optional<ClangASTMetadata> ast_metadata = 
GetMetadata(result_iface_decl);
 
 3026  return (ast_metadata->GetISAPtr() != 0);
 
 
 3030  return GetQualType(type).getUnqualifiedType()->isCharType();
 
 
 3039  const bool allow_completion = 
true;
 
 
 3054  if (!pointee_or_element_clang_type.
IsValid())
 
 3057  if (type_flags.
AnySet(eTypeIsArray | eTypeIsPointer)) {
 
 3058    if (pointee_or_element_clang_type.
IsCharType()) {
 
 3059      if (type_flags.
Test(eTypeIsArray)) {
 
 3062        length = llvm::cast<clang::ConstantArrayType>(
 
 
 3076    if (
auto pointer_auth = qual_type.getPointerAuth())
 
 3077      return pointer_auth.getKey();
 
 
 3086    if (
auto pointer_auth = qual_type.getPointerAuth())
 
 3087      return pointer_auth.getExtraDiscriminator();
 
 
 3096    if (
auto pointer_auth = qual_type.getPointerAuth())
 
 3097      return pointer_auth.isAddressDiscriminated();
 
 
 3103  auto isFunctionType = [&](clang::QualType qual_type) {
 
 3104    return qual_type->isFunctionType();
 
 
 3118  const clang::Type::TypeClass type_class = qual_type->getTypeClass();
 
 3119  switch (type_class) {
 
 3120  case clang::Type::Record:
 
 3122      const clang::CXXRecordDecl *cxx_record_decl =
 
 3123          qual_type->getAsCXXRecordDecl();
 
 3124      if (cxx_record_decl) {
 
 3125        if (cxx_record_decl->getNumBases() || cxx_record_decl->isDynamicClass())
 
 3128      const clang::RecordType *record_type =
 
 3129          llvm::cast<clang::RecordType>(qual_type.getTypePtr());
 
 3131        if (
const clang::RecordDecl *record_decl =
 
 3132                record_type->getDecl()->getDefinition()) {
 
 3135          clang::RecordDecl::field_iterator field_pos,
 
 3136              field_end = record_decl->field_end();
 
 3137          uint32_t num_fields = 0;
 
 3138          bool is_hva = 
false;
 
 3139          bool is_hfa = 
false;
 
 3140          clang::QualType base_qual_type;
 
 3141          uint64_t base_bitwidth = 0;
 
 3142          for (field_pos = record_decl->field_begin(); field_pos != field_end;
 
 3144            clang::QualType field_qual_type = field_pos->getType();
 
 3145            uint64_t field_bitwidth = 
getASTContext().getTypeSize(qual_type);
 
 3146            if (field_qual_type->isFloatingType()) {
 
 3147              if (field_qual_type->isComplexType())
 
 3150                if (num_fields == 0)
 
 3151                  base_qual_type = field_qual_type;
 
 3156                  if (field_qual_type.getTypePtr() !=
 
 3157                      base_qual_type.getTypePtr())
 
 3161            } 
else if (field_qual_type->isVectorType() ||
 
 3162                       field_qual_type->isExtVectorType()) {
 
 3163              if (num_fields == 0) {
 
 3164                base_qual_type = field_qual_type;
 
 3165                base_bitwidth = field_bitwidth;
 
 3170                if (base_bitwidth != field_bitwidth)
 
 3172                if (field_qual_type.getTypePtr() != base_qual_type.getTypePtr())
 
 3181                CompilerType(weak_from_this(), base_qual_type.getAsOpaquePtr());
 
 
 3198    const clang::FunctionProtoType *func =
 
 3199        llvm::dyn_cast<clang::FunctionProtoType>(qual_type.getTypePtr());
 
 3201      return func->getNumParams();
 
 
 3208                                            const size_t index) {
 
 3211    const clang::FunctionProtoType *func =
 
 3212        llvm::dyn_cast<clang::FunctionProtoType>(qual_type.getTypePtr());
 
 3214      if (index < func->getNumParams())
 
 3215        return CompilerType(weak_from_this(), func->getParamType(index).getAsOpaquePtr());
 
 
 3223    llvm::function_ref<
bool(clang::QualType)> predicate)
 const {
 
 3227    if (predicate(qual_type))
 
 3230    const clang::Type::TypeClass type_class = qual_type->getTypeClass();
 
 3231    switch (type_class) {
 
 3235    case clang::Type::LValueReference:
 
 3236    case clang::Type::RValueReference: {
 
 3237      const clang::ReferenceType *reference_type =
 
 3238          llvm::cast<clang::ReferenceType>(qual_type.getTypePtr());
 
 3240        return IsTypeImpl(reference_type->getPointeeType().getAsOpaquePtr(), predicate);
 
 
 3249  auto isMemberFunctionPointerType = [](clang::QualType qual_type) {
 
 3250    return qual_type->isMemberFunctionPointerType();
 
 3253  return IsTypeImpl(type, isMemberFunctionPointerType);
 
 
 3257  auto isFunctionPointerType = [](clang::QualType qual_type) {
 
 3258    return qual_type->isFunctionPointerType();
 
 3261  return IsTypeImpl(type, isFunctionPointerType);
 
 
 3267  auto isBlockPointerType = [&](clang::QualType qual_type) {
 
 3268    if (qual_type->isBlockPointerType()) {
 
 3269      if (function_pointer_type_ptr) {
 
 3270        const clang::BlockPointerType *block_pointer_type =
 
 3271            qual_type->castAs<clang::BlockPointerType>();
 
 3272        QualType pointee_type = block_pointer_type->getPointeeType();
 
 3273        QualType function_pointer_type = 
m_ast_up->getPointerType(pointee_type);
 
 3275            weak_from_this(), function_pointer_type.getAsOpaquePtr());
 
 
 3292  const clang::BuiltinType *builtin_type =
 
 3293      llvm::dyn_cast<clang::BuiltinType>(qual_type->getCanonicalTypeInternal());
 
 3296    if (builtin_type->isInteger()) {
 
 3297      is_signed = builtin_type->isSignedInteger();
 
 
 3308    const clang::EnumType *enum_type = llvm::dyn_cast<clang::EnumType>(
 
 3313                        ->getDefinitionOrSelf()
 
 
 3327    const clang::EnumType *enum_type = llvm::dyn_cast<clang::EnumType>(
 
 3331      return enum_type->isScopedEnumeralType();
 
 
 3342    const clang::Type::TypeClass type_class = qual_type->getTypeClass();
 
 3343    switch (type_class) {
 
 3344    case clang::Type::Builtin:
 
 3345      switch (llvm::cast<clang::BuiltinType>(qual_type)->getKind()) {
 
 3348      case clang::BuiltinType::ObjCId:
 
 3349      case clang::BuiltinType::ObjCClass:
 
 3353    case clang::Type::ObjCObjectPointer:
 
 3357            llvm::cast<clang::ObjCObjectPointerType>(qual_type)
 
 3361    case clang::Type::BlockPointer:
 
 3364            weak_from_this(), llvm::cast<clang::BlockPointerType>(qual_type)
 
 3368    case clang::Type::Pointer:
 
 3371                                      llvm::cast<clang::PointerType>(qual_type)
 
 3375    case clang::Type::MemberPointer:
 
 3378            weak_from_this(), llvm::cast<clang::MemberPointerType>(qual_type)
 
 3387    pointee_type->
Clear();
 
 
 3395    const clang::Type::TypeClass type_class = qual_type->getTypeClass();
 
 3396    switch (type_class) {
 
 3397    case clang::Type::Builtin:
 
 3398      switch (llvm::cast<clang::BuiltinType>(qual_type)->getKind()) {
 
 3401      case clang::BuiltinType::ObjCId:
 
 3402      case clang::BuiltinType::ObjCClass:
 
 3406    case clang::Type::ObjCObjectPointer:
 
 3410            llvm::cast<clang::ObjCObjectPointerType>(qual_type)
 
 3414    case clang::Type::BlockPointer:
 
 3417            weak_from_this(), llvm::cast<clang::BlockPointerType>(qual_type)
 
 3421    case clang::Type::Pointer:
 
 3424                                      llvm::cast<clang::PointerType>(qual_type)
 
 3428    case clang::Type::MemberPointer:
 
 3431            weak_from_this(), llvm::cast<clang::MemberPointerType>(qual_type)
 
 3435    case clang::Type::LValueReference:
 
 3438            weak_from_this(), llvm::cast<clang::LValueReferenceType>(qual_type)
 
 3442    case clang::Type::RValueReference:
 
 3445            weak_from_this(), llvm::cast<clang::RValueReferenceType>(qual_type)
 
 3454    pointee_type->
Clear();
 
 
 3463    const clang::Type::TypeClass type_class = qual_type->getTypeClass();
 
 3465    switch (type_class) {
 
 3466    case clang::Type::LValueReference:
 
 3469            weak_from_this(), llvm::cast<clang::LValueReferenceType>(qual_type)
 
 3475    case clang::Type::RValueReference:
 
 3478            weak_from_this(), llvm::cast<clang::RValueReferenceType>(qual_type)
 
 3490    pointee_type->
Clear();
 
 
 3499    if (
const clang::BuiltinType *BT = llvm::dyn_cast<clang::BuiltinType>(
 
 3500            qual_type->getCanonicalTypeInternal())) {
 
 3501      clang::BuiltinType::Kind kind = BT->getKind();
 
 3502      if (kind >= clang::BuiltinType::Float &&
 
 3503          kind <= clang::BuiltinType::LongDouble) {
 
 3507    } 
else if (
const clang::ComplexType *CT =
 
 3508                   llvm::dyn_cast<clang::ComplexType>(
 
 3509                       qual_type->getCanonicalTypeInternal())) {
 
 3515    } 
else if (
const clang::VectorType *VT = llvm::dyn_cast<clang::VectorType>(
 
 3516                   qual_type->getCanonicalTypeInternal())) {
 
 
 3533  const clang::TagType *tag_type =
 
 3534      llvm::dyn_cast<clang::TagType>(qual_type.getTypePtr());
 
 3536    if (clang::TagDecl *tag_decl = tag_type->getDecl()->getDefinition())
 
 3537      return tag_decl->isCompleteDefinition();
 
 3540    const clang::ObjCObjectType *objc_class_type =
 
 3541        llvm::dyn_cast<clang::ObjCObjectType>(qual_type);
 
 3542    if (objc_class_type) {
 
 3543      clang::ObjCInterfaceDecl *class_interface_decl =
 
 3544          objc_class_type->getInterface();
 
 3545      if (class_interface_decl)
 
 3546        return class_interface_decl->getDefinition() != 
nullptr;
 
 
 3557    const clang::ObjCObjectPointerType *obj_pointer_type =
 
 3558        llvm::dyn_cast<clang::ObjCObjectPointerType>(qual_type);
 
 3560    if (obj_pointer_type)
 
 3561      return obj_pointer_type->isObjCClassType();
 
 
 3576  const clang::Type::TypeClass type_class = qual_type->getTypeClass();
 
 3577  return (type_class == clang::Type::Record);
 
 
 3584  const clang::Type::TypeClass type_class = qual_type->getTypeClass();
 
 3585  return (type_class == clang::Type::Enum);
 
 
 3591    const clang::Type::TypeClass type_class = qual_type->getTypeClass();
 
 3592    switch (type_class) {
 
 3593    case clang::Type::Record:
 
 3595        if (
const auto *cxx_record_decl = qual_type->getAsCXXRecordDecl()) {
 
 3602          return cxx_record_decl->isDynamicClass();
 
 
 3616                                            bool check_cplusplus,
 
 3618  if (dynamic_pointee_type)
 
 3619    dynamic_pointee_type->
Clear();
 
 3623  auto set_dynamic_pointee_type = [&](clang::QualType type) {
 
 3624    if (dynamic_pointee_type)
 
 3626                                            type.getAsOpaquePtr());
 
 3629  clang::QualType pointee_qual_type;
 
 3631  switch (qual_type->getTypeClass()) {
 
 3632  case clang::Type::Builtin:
 
 3633    if (check_objc && llvm::cast<clang::BuiltinType>(qual_type)->getKind() ==
 
 3634                          clang::BuiltinType::ObjCId) {
 
 3635      set_dynamic_pointee_type(qual_type);
 
 3640  case clang::Type::ObjCObjectPointer:
 
 3643    if (
const auto *objc_pointee_type =
 
 3644            qual_type->getPointeeType().getTypePtrOrNull()) {
 
 3645      if (
const auto *objc_object_type =
 
 3646              llvm::dyn_cast_or_null<clang::ObjCObjectType>(
 
 3647                  objc_pointee_type)) {
 
 3648        if (objc_object_type->isObjCClass())
 
 3652    set_dynamic_pointee_type(
 
 3653        llvm::cast<clang::ObjCObjectPointerType>(qual_type)->getPointeeType());
 
 3656  case clang::Type::Pointer:
 
 3658        llvm::cast<clang::PointerType>(qual_type)->getPointeeType();
 
 3661  case clang::Type::LValueReference:
 
 3662  case clang::Type::RValueReference:
 
 3664        llvm::cast<clang::ReferenceType>(qual_type)->getPointeeType();
 
 3674  switch (pointee_qual_type.getCanonicalType()->getTypeClass()) {
 
 3675  case clang::Type::Builtin:
 
 3676    switch (llvm::cast<clang::BuiltinType>(pointee_qual_type)->getKind()) {
 
 3677    case clang::BuiltinType::UnknownAny:
 
 3678    case clang::BuiltinType::Void:
 
 3679      set_dynamic_pointee_type(pointee_qual_type);
 
 3685  case clang::Type::Record: {
 
 3686    if (!check_cplusplus)
 
 3688    clang::CXXRecordDecl *cxx_record_decl =
 
 3689        pointee_qual_type->getAsCXXRecordDecl();
 
 3690    if (!cxx_record_decl)
 
 3694    if (cxx_record_decl->isCompleteDefinition())
 
 3695      success = cxx_record_decl->isDynamicClass();
 
 3697      std::optional<ClangASTMetadata> metadata = 
GetMetadata(cxx_record_decl);
 
 3698      std::optional<bool> is_dynamic =
 
 3699          metadata ? metadata->GetIsDynamicCXXType() : std::nullopt;
 
 3701        success = *is_dynamic;
 
 3703        success = cxx_record_decl->isDynamicClass();
 
 3709      set_dynamic_pointee_type(pointee_qual_type);
 
 3713  case clang::Type::ObjCObject:
 
 3714  case clang::Type::ObjCInterface:
 
 3716      set_dynamic_pointee_type(pointee_qual_type);
 
 
 3731  return (
GetTypeInfo(type, 
nullptr) & eTypeIsScalar) != 0;
 
 
 3738             ->getTypeClass() == clang::Type::Typedef;
 
 
 3748  if (
auto *record_decl =
 
 3750    return record_decl->canPassInRegisters();
 
 
 3756  return TypeSystemClangSupportsLanguage(language);
 
 
 3759std::optional<std::string>
 
 3762    return std::nullopt;
 
 3765  if (qual_type.isNull())
 
 3766    return std::nullopt;
 
 3768  clang::CXXRecordDecl *cxx_record_decl = qual_type->getAsCXXRecordDecl();
 
 3769  if (!cxx_record_decl)
 
 3770    return std::nullopt;
 
 3772  return std::string(cxx_record_decl->getIdentifier()->getNameStart());
 
 
 3780  return !qual_type.isNull() && qual_type->getAsCXXRecordDecl() != 
nullptr;
 
 
 3787  const clang::TagType *tag_type = llvm::dyn_cast<clang::TagType>(qual_type);
 
 3789    return tag_type->getDecl()->isEntityBeingDefined();
 
 
 3800  if (!qual_type.isNull() && qual_type->isObjCObjectPointerType()) {
 
 3801    if (class_type_ptr) {
 
 3802      if (!qual_type->isObjCClassType() && !qual_type->isObjCIdType()) {
 
 3803        const clang::ObjCObjectPointerType *obj_pointer_type =
 
 3804            llvm::dyn_cast<clang::ObjCObjectPointerType>(qual_type);
 
 3805        if (obj_pointer_type == 
nullptr)
 
 3806          class_type_ptr->
Clear();
 
 3810              clang::QualType(obj_pointer_type->getInterfaceType(), 0)
 
 3817    class_type_ptr->
Clear();
 
 
 3826  const bool allow_completion = 
true;
 
 
 3846                                  {clang::Type::Typedef, clang::Type::Atomic});
 
 3849  if (
const auto *typedef_type = qual_type->getAs<clang::TypedefType>()) {
 
 3850    const clang::TypedefNameDecl *typedef_decl = typedef_type->getDecl();
 
 3857  if (
auto *named_decl = qual_type->getAsTagDecl())
 
 
 3869  clang::PrintingPolicy printing_policy(
getASTContext().getPrintingPolicy());
 
 3870  printing_policy.SuppressTagKeyword = 
true;
 
 3871  printing_policy.SuppressScope = 
false;
 
 3872  printing_policy.SuppressUnwrittenScope = 
true;
 
 3873  printing_policy.SuppressInlineNamespace = 
true;
 
 3874  return ConstString(qual_type.getAsString(printing_policy));
 
 
 3883  if (pointee_or_element_clang_type)
 
 3884    pointee_or_element_clang_type->
Clear();
 
 3886  clang::QualType qual_type =
 
 3889  const clang::Type::TypeClass type_class = qual_type->getTypeClass();
 
 3890  switch (type_class) {
 
 3891  case clang::Type::Attributed:
 
 3892    return GetTypeInfo(qual_type->castAs<clang::AttributedType>()
 
 3895                       pointee_or_element_clang_type);
 
 3896  case clang::Type::BitInt: {
 
 3897    uint32_t type_flags = eTypeIsScalar | eTypeIsInteger | eTypeHasValue;
 
 3898    if (qual_type->isSignedIntegerType())
 
 3899      type_flags |= eTypeIsSigned;
 
 3903  case clang::Type::Builtin: {
 
 3904    const clang::BuiltinType *builtin_type =
 
 3905        llvm::cast<clang::BuiltinType>(qual_type->getCanonicalTypeInternal());
 
 3907    uint32_t builtin_type_flags = eTypeIsBuiltIn | eTypeHasValue;
 
 3908    switch (builtin_type->getKind()) {
 
 3909    case clang::BuiltinType::ObjCId:
 
 3910    case clang::BuiltinType::ObjCClass:
 
 3911      if (pointee_or_element_clang_type)
 
 3915      builtin_type_flags |= eTypeIsPointer | eTypeIsObjC;
 
 3918    case clang::BuiltinType::ObjCSel:
 
 3919      if (pointee_or_element_clang_type)
 
 3922      builtin_type_flags |= eTypeIsPointer | eTypeIsObjC;
 
 3925    case clang::BuiltinType::Bool:
 
 3926    case clang::BuiltinType::Char_U:
 
 3927    case clang::BuiltinType::UChar:
 
 3928    case clang::BuiltinType::WChar_U:
 
 3929    case clang::BuiltinType::Char16:
 
 3930    case clang::BuiltinType::Char32:
 
 3931    case clang::BuiltinType::UShort:
 
 3932    case clang::BuiltinType::UInt:
 
 3933    case clang::BuiltinType::ULong:
 
 3934    case clang::BuiltinType::ULongLong:
 
 3935    case clang::BuiltinType::UInt128:
 
 3936    case clang::BuiltinType::Char_S:
 
 3937    case clang::BuiltinType::SChar:
 
 3938    case clang::BuiltinType::WChar_S:
 
 3939    case clang::BuiltinType::Short:
 
 3940    case clang::BuiltinType::Int:
 
 3941    case clang::BuiltinType::Long:
 
 3942    case clang::BuiltinType::LongLong:
 
 3943    case clang::BuiltinType::Int128:
 
 3944    case clang::BuiltinType::Float:
 
 3945    case clang::BuiltinType::Double:
 
 3946    case clang::BuiltinType::LongDouble:
 
 3947      builtin_type_flags |= eTypeIsScalar;
 
 3948      if (builtin_type->isInteger()) {
 
 3949        builtin_type_flags |= eTypeIsInteger;
 
 3950        if (builtin_type->isSignedInteger())
 
 3951          builtin_type_flags |= eTypeIsSigned;
 
 3952      } 
else if (builtin_type->isFloatingPoint())
 
 3953        builtin_type_flags |= eTypeIsFloat;
 
 3958    return builtin_type_flags;
 
 3961  case clang::Type::BlockPointer:
 
 3962    if (pointee_or_element_clang_type)
 
 3964          weak_from_this(), qual_type->getPointeeType().getAsOpaquePtr());
 
 3965    return eTypeIsPointer | eTypeHasChildren | eTypeIsBlock;
 
 3967  case clang::Type::Complex: {
 
 3968    uint32_t complex_type_flags =
 
 3969        eTypeIsBuiltIn | eTypeHasValue | eTypeIsComplex;
 
 3970    const clang::ComplexType *complex_type = llvm::dyn_cast<clang::ComplexType>(
 
 3971        qual_type->getCanonicalTypeInternal());
 
 3973      clang::QualType complex_element_type(complex_type->getElementType());
 
 3974      if (complex_element_type->isIntegerType())
 
 3975        complex_type_flags |= eTypeIsInteger;
 
 3976      else if (complex_element_type->isFloatingType())
 
 3977        complex_type_flags |= eTypeIsFloat;
 
 3979    return complex_type_flags;
 
 3982  case clang::Type::ConstantArray:
 
 3983  case clang::Type::DependentSizedArray:
 
 3984  case clang::Type::IncompleteArray:
 
 3985  case clang::Type::VariableArray:
 
 3986    if (pointee_or_element_clang_type)
 
 3988          weak_from_this(), llvm::cast<clang::ArrayType>(qual_type.getTypePtr())
 
 3991    return eTypeHasChildren | eTypeIsArray;
 
 3993  case clang::Type::DependentName:
 
 3995  case clang::Type::DependentSizedExtVector:
 
 3996    return eTypeHasChildren | eTypeIsVector;
 
 3998  case clang::Type::Enum:
 
 3999    if (pointee_or_element_clang_type)
 
 4001          weak_from_this(), llvm::cast<clang::EnumType>(qual_type)
 
 4003                                ->getDefinitionOrSelf()
 
 4006    return eTypeIsEnumeration | eTypeHasValue;
 
 4008  case clang::Type::FunctionProto:
 
 4009    return eTypeIsFuncPrototype | eTypeHasValue;
 
 4010  case clang::Type::FunctionNoProto:
 
 4011    return eTypeIsFuncPrototype | eTypeHasValue;
 
 4012  case clang::Type::InjectedClassName:
 
 4015  case clang::Type::LValueReference:
 
 4016  case clang::Type::RValueReference:
 
 4017    if (pointee_or_element_clang_type)
 
 4020          llvm::cast<clang::ReferenceType>(qual_type.getTypePtr())
 
 4023    return eTypeHasChildren | eTypeIsReference | eTypeHasValue;
 
 4025  case clang::Type::MemberPointer:
 
 4026    return eTypeIsPointer | eTypeIsMember | eTypeHasValue;
 
 4028  case clang::Type::ObjCObjectPointer:
 
 4029    if (pointee_or_element_clang_type)
 
 4031          weak_from_this(), qual_type->getPointeeType().getAsOpaquePtr());
 
 4032    return eTypeHasChildren | eTypeIsObjC | eTypeIsClass | eTypeIsPointer |
 
 4035  case clang::Type::ObjCObject:
 
 4036    return eTypeHasChildren | eTypeIsObjC | eTypeIsClass;
 
 4037  case clang::Type::ObjCInterface:
 
 4038    return eTypeHasChildren | eTypeIsObjC | eTypeIsClass;
 
 4040  case clang::Type::Pointer:
 
 4041    if (pointee_or_element_clang_type)
 
 4043          weak_from_this(), qual_type->getPointeeType().getAsOpaquePtr());
 
 4044    return eTypeHasChildren | eTypeIsPointer | eTypeHasValue;
 
 4046  case clang::Type::Record:
 
 4047    if (qual_type->getAsCXXRecordDecl())
 
 4048      return eTypeHasChildren | eTypeIsClass | eTypeIsCPlusPlus;
 
 4050      return eTypeHasChildren | eTypeIsStructUnion;
 
 4052  case clang::Type::SubstTemplateTypeParm:
 
 4053    return eTypeIsTemplate;
 
 4054  case clang::Type::TemplateTypeParm:
 
 4055    return eTypeIsTemplate;
 
 4056  case clang::Type::TemplateSpecialization:
 
 4057    return eTypeIsTemplate;
 
 4059  case clang::Type::Typedef:
 
 4060    return eTypeIsTypedef | 
GetType(llvm::cast<clang::TypedefType>(qual_type)
 
 4062                                        ->getUnderlyingType())
 
 4064  case clang::Type::UnresolvedUsing:
 
 4067  case clang::Type::ExtVector:
 
 4068  case clang::Type::Vector: {
 
 4069    uint32_t vector_type_flags = eTypeHasChildren | eTypeIsVector;
 
 4070    const clang::VectorType *vector_type = llvm::dyn_cast<clang::VectorType>(
 
 4071        qual_type->getCanonicalTypeInternal());
 
 4075    QualType element_type = vector_type->getElementType();
 
 4076    if (element_type.isNull())
 
 4079    if (element_type->isIntegerType())
 
 4080      vector_type_flags |= eTypeIsInteger;
 
 4081    else if (element_type->isFloatingType())
 
 4082      vector_type_flags |= eTypeIsFloat;
 
 4083    return vector_type_flags;
 
 
 4098  if (qual_type->isAnyPointerType()) {
 
 4099    if (qual_type->isObjCObjectPointerType())
 
 4101    if (qual_type->getPointeeCXXRecordDecl())
 
 4104    clang::QualType pointee_type(qual_type->getPointeeType());
 
 4105    if (pointee_type->getPointeeCXXRecordDecl())
 
 4107    if (pointee_type->isObjCObjectOrInterfaceType())
 
 4109    if (pointee_type->isObjCClassType())
 
 4111    if (pointee_type.getTypePtr() ==
 
 4115    if (qual_type->isObjCObjectOrInterfaceType())
 
 4117    if (qual_type->getAsCXXRecordDecl())
 
 4119    switch (qual_type->getTypeClass()) {
 
 4122    case clang::Type::Builtin:
 
 4123      switch (llvm::cast<clang::BuiltinType>(qual_type)->getKind()) {
 
 4125      case clang::BuiltinType::Void:
 
 4126      case clang::BuiltinType::Bool:
 
 4127      case clang::BuiltinType::Char_U:
 
 4128      case clang::BuiltinType::UChar:
 
 4129      case clang::BuiltinType::WChar_U:
 
 4130      case clang::BuiltinType::Char16:
 
 4131      case clang::BuiltinType::Char32:
 
 4132      case clang::BuiltinType::UShort:
 
 4133      case clang::BuiltinType::UInt:
 
 4134      case clang::BuiltinType::ULong:
 
 4135      case clang::BuiltinType::ULongLong:
 
 4136      case clang::BuiltinType::UInt128:
 
 4137      case clang::BuiltinType::Char_S:
 
 4138      case clang::BuiltinType::SChar:
 
 4139      case clang::BuiltinType::WChar_S:
 
 4140      case clang::BuiltinType::Short:
 
 4141      case clang::BuiltinType::Int:
 
 4142      case clang::BuiltinType::Long:
 
 4143      case clang::BuiltinType::LongLong:
 
 4144      case clang::BuiltinType::Int128:
 
 4145      case clang::BuiltinType::Float:
 
 4146      case clang::BuiltinType::Double:
 
 4147      case clang::BuiltinType::LongDouble:
 
 4150      case clang::BuiltinType::NullPtr:
 
 4153      case clang::BuiltinType::ObjCId:
 
 4154      case clang::BuiltinType::ObjCClass:
 
 4155      case clang::BuiltinType::ObjCSel:
 
 4158      case clang::BuiltinType::Dependent:
 
 4159      case clang::BuiltinType::Overload:
 
 4160      case clang::BuiltinType::BoundMember:
 
 4161      case clang::BuiltinType::UnknownAny:
 
 4165    case clang::Type::Typedef:
 
 4166      return GetType(llvm::cast<clang::TypedefType>(qual_type)
 
 4168                         ->getUnderlyingType())
 
 
 4178    return lldb::eTypeClassInvalid;
 
 4180  clang::QualType qual_type =
 
 4183  switch (qual_type->getTypeClass()) {
 
 4184  case clang::Type::Atomic:
 
 4185  case clang::Type::Auto:
 
 4186  case clang::Type::CountAttributed:
 
 4187  case clang::Type::Decltype:
 
 4188  case clang::Type::Paren:
 
 4189  case clang::Type::TypeOf:
 
 4190  case clang::Type::TypeOfExpr:
 
 4191  case clang::Type::Using:
 
 4192  case clang::Type::PredefinedSugar:
 
 4193    llvm_unreachable(
"Handled in RemoveWrappingTypes!");
 
 4194  case clang::Type::UnaryTransform:
 
 4196  case clang::Type::FunctionNoProto:
 
 4197    return lldb::eTypeClassFunction;
 
 4198  case clang::Type::FunctionProto:
 
 4199    return lldb::eTypeClassFunction;
 
 4200  case clang::Type::IncompleteArray:
 
 4201    return lldb::eTypeClassArray;
 
 4202  case clang::Type::VariableArray:
 
 4203    return lldb::eTypeClassArray;
 
 4204  case clang::Type::ConstantArray:
 
 4205    return lldb::eTypeClassArray;
 
 4206  case clang::Type::DependentSizedArray:
 
 4207    return lldb::eTypeClassArray;
 
 4208  case clang::Type::ArrayParameter:
 
 4209    return lldb::eTypeClassArray;
 
 4210  case clang::Type::DependentSizedExtVector:
 
 4211    return lldb::eTypeClassVector;
 
 4212  case clang::Type::DependentVector:
 
 4213    return lldb::eTypeClassVector;
 
 4214  case clang::Type::ExtVector:
 
 4215    return lldb::eTypeClassVector;
 
 4216  case clang::Type::Vector:
 
 4217    return lldb::eTypeClassVector;
 
 4218  case clang::Type::Builtin:
 
 4220  case clang::Type::BitInt:
 
 4221  case clang::Type::DependentBitInt:
 
 4222    return lldb::eTypeClassBuiltin;
 
 4223  case clang::Type::ObjCObjectPointer:
 
 4224    return lldb::eTypeClassObjCObjectPointer;
 
 4225  case clang::Type::BlockPointer:
 
 4226    return lldb::eTypeClassBlockPointer;
 
 4227  case clang::Type::Pointer:
 
 4228    return lldb::eTypeClassPointer;
 
 4229  case clang::Type::LValueReference:
 
 4230    return lldb::eTypeClassReference;
 
 4231  case clang::Type::RValueReference:
 
 4232    return lldb::eTypeClassReference;
 
 4233  case clang::Type::MemberPointer:
 
 4234    return lldb::eTypeClassMemberPointer;
 
 4235  case clang::Type::Complex:
 
 4236    if (qual_type->isComplexType())
 
 4237      return lldb::eTypeClassComplexFloat;
 
 4239      return lldb::eTypeClassComplexInteger;
 
 4240  case clang::Type::ObjCObject:
 
 4241    return lldb::eTypeClassObjCObject;
 
 4242  case clang::Type::ObjCInterface:
 
 4243    return lldb::eTypeClassObjCInterface;
 
 4244  case clang::Type::Record: {
 
 4245    const clang::RecordType *record_type =
 
 4246        llvm::cast<clang::RecordType>(qual_type.getTypePtr());
 
 4247    const clang::RecordDecl *record_decl = record_type->getDecl();
 
 4248    if (record_decl->isUnion())
 
 4249      return lldb::eTypeClassUnion;
 
 4250    else if (record_decl->isStruct())
 
 4251      return lldb::eTypeClassStruct;
 
 4253      return lldb::eTypeClassClass;
 
 4255  case clang::Type::Enum:
 
 4256    return lldb::eTypeClassEnumeration;
 
 4257  case clang::Type::Typedef:
 
 4258    return lldb::eTypeClassTypedef;
 
 4259  case clang::Type::UnresolvedUsing:
 
 4262  case clang::Type::Attributed:
 
 4263  case clang::Type::BTFTagAttributed:
 
 4265  case clang::Type::TemplateTypeParm:
 
 4267  case clang::Type::SubstTemplateTypeParm:
 
 4269  case clang::Type::SubstTemplateTypeParmPack:
 
 4271  case clang::Type::InjectedClassName:
 
 4273  case clang::Type::DependentName:
 
 4275  case clang::Type::PackExpansion:
 
 4278  case clang::Type::TemplateSpecialization:
 
 4280  case clang::Type::DeducedTemplateSpecialization:
 
 4282  case clang::Type::Pipe:
 
 4286  case clang::Type::Decayed:
 
 4288  case clang::Type::Adjusted:
 
 4290  case clang::Type::ObjCTypeParam:
 
 4293  case clang::Type::DependentAddressSpace:
 
 4295  case clang::Type::MacroQualified:
 
 4299  case clang::Type::ConstantMatrix:
 
 4300  case clang::Type::DependentSizedMatrix:
 
 4304  case clang::Type::PackIndexing:
 
 4307  case clang::Type::HLSLAttributedResource:
 
 4309  case clang::Type::HLSLInlineSpirv:
 
 4311  case clang::Type::SubstBuiltinTemplatePack:
 
 4315  return lldb::eTypeClassOther;
 
 
 4320    return GetQualType(type).getQualifiers().getCVRQualifiers();
 
 
 4332    const clang::Type *array_eletype =
 
 4333        qual_type.getTypePtr()->getArrayElementTypeNoTypeQual();
 
 4338    return GetType(clang::QualType(array_eletype, 0));
 
 
 4349      return GetType(ast_ctx.getConstantArrayType(
 
 4350          qual_type, llvm::APInt(64, size), 
nullptr,
 
 4351          clang::ArraySizeModifier::Normal, 0));
 
 4353      return GetType(ast_ctx.getIncompleteArrayType(
 
 4354          qual_type, clang::ArraySizeModifier::Normal, 0));
 
 
 4368                                                    clang::QualType qual_type) {
 
 4369  if (qual_type->isPointerType())
 
 4370    qual_type = ast->getPointerType(
 
 4372  else if (
const ConstantArrayType *arr =
 
 4373               ast->getAsConstantArrayType(qual_type)) {
 
 4374    qual_type = ast->getConstantArrayType(
 
 4376        arr->getSize(), arr->getSizeExpr(), arr->getSizeModifier(),
 
 4377        arr->getIndexTypeQualifiers().getAsOpaqueValue());
 
 4379    qual_type = qual_type.getUnqualifiedType();
 
 4380  qual_type.removeLocalConst();
 
 4381  qual_type.removeLocalRestrict();
 
 4382  qual_type.removeLocalVolatile();
 
 
 4404    const clang::FunctionProtoType *func =
 
 4407      return func->getNumParams();
 
 
 4415    const clang::FunctionProtoType *func =
 
 4416        llvm::dyn_cast<clang::FunctionProtoType>(
GetQualType(type));
 
 4418      const uint32_t num_args = func->getNumParams();
 
 4420        return GetType(func->getParamType(idx));
 
 
 4430    const clang::FunctionProtoType *func =
 
 4431        llvm::dyn_cast<clang::FunctionProtoType>(qual_type.getTypePtr());
 
 4433      return GetType(func->getReturnType());
 
 
 4440  size_t num_functions = 0;
 
 4443    switch (qual_type->getTypeClass()) {
 
 4444    case clang::Type::Record:
 
 4446        if (
const auto *cxx_record_decl = qual_type->getAsCXXRecordDecl())
 
 4447          num_functions = std::distance(cxx_record_decl->method_begin(),
 
 4448                                        cxx_record_decl->method_end());
 
 4451    case clang::Type::ObjCObjectPointer: {
 
 4452      const clang::ObjCObjectPointerType *objc_class_type =
 
 4453          qual_type->castAs<clang::ObjCObjectPointerType>();
 
 4454      const clang::ObjCInterfaceType *objc_interface_type =
 
 4455          objc_class_type->getInterfaceType();
 
 4456      if (objc_interface_type &&
 
 4458              const_cast<clang::ObjCInterfaceType *
>(objc_interface_type)))) {
 
 4459        clang::ObjCInterfaceDecl *class_interface_decl =
 
 4460            objc_interface_type->getDecl();
 
 4461        if (class_interface_decl) {
 
 4462          num_functions = std::distance(class_interface_decl->meth_begin(),
 
 4463                                        class_interface_decl->meth_end());
 
 4469    case clang::Type::ObjCObject:
 
 4470    case clang::Type::ObjCInterface:
 
 4472        const clang::ObjCObjectType *objc_class_type =
 
 4473            llvm::dyn_cast<clang::ObjCObjectType>(qual_type.getTypePtr());
 
 4474        if (objc_class_type) {
 
 4475          clang::ObjCInterfaceDecl *class_interface_decl =
 
 4476              objc_class_type->getInterface();
 
 4477          if (class_interface_decl)
 
 4478            num_functions = std::distance(class_interface_decl->meth_begin(),
 
 4479                                          class_interface_decl->meth_end());
 
 4488  return num_functions;
 
 
 4500    switch (qual_type->getTypeClass()) {
 
 4501    case clang::Type::Record:
 
 4503        if (
const auto *cxx_record_decl = qual_type->getAsCXXRecordDecl()) {
 
 4504          auto method_iter = cxx_record_decl->method_begin();
 
 4505          auto method_end = cxx_record_decl->method_end();
 
 4507              static_cast<size_t>(std::distance(method_iter, method_end))) {
 
 4508            std::advance(method_iter, idx);
 
 4509            clang::CXXMethodDecl *cxx_method_decl =
 
 4510                method_iter->getCanonicalDecl();
 
 4511            if (cxx_method_decl) {
 
 4512              name = cxx_method_decl->getDeclName().getAsString();
 
 4513              if (cxx_method_decl->isStatic())
 
 4515              else if (llvm::isa<clang::CXXConstructorDecl>(cxx_method_decl))
 
 4517              else if (llvm::isa<clang::CXXDestructorDecl>(cxx_method_decl))
 
 4521              clang_type = 
GetType(cxx_method_decl->getType());
 
 4529    case clang::Type::ObjCObjectPointer: {
 
 4530      const clang::ObjCObjectPointerType *objc_class_type =
 
 4531          qual_type->castAs<clang::ObjCObjectPointerType>();
 
 4532      const clang::ObjCInterfaceType *objc_interface_type =
 
 4533          objc_class_type->getInterfaceType();
 
 4534      if (objc_interface_type &&
 
 4536              const_cast<clang::ObjCInterfaceType *
>(objc_interface_type)))) {
 
 4537        clang::ObjCInterfaceDecl *class_interface_decl =
 
 4538            objc_interface_type->getDecl();
 
 4539        if (class_interface_decl) {
 
 4540          auto method_iter = class_interface_decl->meth_begin();
 
 4541          auto method_end = class_interface_decl->meth_end();
 
 4543              static_cast<size_t>(std::distance(method_iter, method_end))) {
 
 4544            std::advance(method_iter, idx);
 
 4545            clang::ObjCMethodDecl *objc_method_decl =
 
 4546                method_iter->getCanonicalDecl();
 
 4547            if (objc_method_decl) {
 
 4549              name = objc_method_decl->getSelector().getAsString();
 
 4550              if (objc_method_decl->isClassMethod())
 
 4561    case clang::Type::ObjCObject:
 
 4562    case clang::Type::ObjCInterface:
 
 4564        const clang::ObjCObjectType *objc_class_type =
 
 4565            llvm::dyn_cast<clang::ObjCObjectType>(qual_type.getTypePtr());
 
 4566        if (objc_class_type) {
 
 4567          clang::ObjCInterfaceDecl *class_interface_decl =
 
 4568              objc_class_type->getInterface();
 
 4569          if (class_interface_decl) {
 
 4570            auto method_iter = class_interface_decl->meth_begin();
 
 4571            auto method_end = class_interface_decl->meth_end();
 
 4573                static_cast<size_t>(std::distance(method_iter, method_end))) {
 
 4574              std::advance(method_iter, idx);
 
 4575              clang::ObjCMethodDecl *objc_method_decl =
 
 4576                  method_iter->getCanonicalDecl();
 
 4577              if (objc_method_decl) {
 
 4579                name = objc_method_decl->getSelector().getAsString();
 
 4580                if (objc_method_decl->isClassMethod())
 
 
 4613    return GetType(qual_type.getTypePtr()->getPointeeType());
 
 
 4623    switch (qual_type.getDesugaredType(
getASTContext())->getTypeClass()) {
 
 4624    case clang::Type::ObjCObject:
 
 4625    case clang::Type::ObjCInterface:
 
 
 4672    auto pauth = PointerAuthQualifier::fromOpaqueValue(payload);
 
 4673    clang::QualType result =
 
 4674        clang_ast.getPointerAuthType(
GetQualType(type), pauth);
 
 
 4684    result.addVolatile();
 
 
 4694    result.addRestrict();
 
 
 4703  if (type && typedef_name && typedef_name[0]) {
 
 4707    clang::DeclContext *decl_ctx =
 
 4712    clang::TypedefDecl *decl =
 
 4713        clang::TypedefDecl::CreateDeserialized(clang_ast, GlobalDeclID());
 
 4714    decl->setDeclContext(decl_ctx);
 
 4715    decl->setDeclName(&clang_ast.Idents.get(typedef_name));
 
 4716    decl->setTypeSourceInfo(clang_ast.getTrivialTypeSourceInfo(qual_type));
 
 4717    decl_ctx->addDecl(decl);
 
 4720    clang::TagDecl *tdecl = 
nullptr;
 
 4721    if (!qual_type.isNull()) {
 
 4722      if (
const clang::RecordType *rt = qual_type->getAs<clang::RecordType>())
 
 4723        tdecl = rt->getDecl();
 
 4724      if (
const clang::EnumType *et = qual_type->getAs<clang::EnumType>())
 
 4725        tdecl = et->getDecl();
 
 4731    if (tdecl && !tdecl->getIdentifier() && !tdecl->getTypedefNameForAnonDecl())
 
 4732      tdecl->setTypedefNameForAnonDecl(decl);
 
 4734    decl->setAccess(clang::AS_public); 
 
 4737    NestedNameSpecifier Qualifier =
 
 4738        clang::TypeName::getFullyQualifiedDeclaredContext(clang_ast, decl);
 
 4740        clang_ast.getTypedefType(ElaboratedTypeKeyword::None, Qualifier, decl));
 
 
 4748    const clang::TypedefType *typedef_type = llvm::dyn_cast<clang::TypedefType>(
 
 4751      return GetType(typedef_type->getDecl()->getUnderlyingType());
 
 
 4764  const FunctionType::ExtInfo generic_ext_info(
 
 4773  QualType func_type = ast.getFunctionNoProtoType(ast.VoidTy, generic_ext_info);
 
 
 4778const llvm::fltSemantics &
 
 4781  const size_t bit_size = byte_size * 8;
 
 4782  if (bit_size == ast.getTypeSize(ast.FloatTy))
 
 4783    return ast.getFloatTypeSemantics(ast.FloatTy);
 
 4784  else if (bit_size == ast.getTypeSize(ast.DoubleTy))
 
 4785    return ast.getFloatTypeSemantics(ast.DoubleTy);
 
 4787           bit_size == ast.getTypeSize(ast.Float128Ty))
 
 4788    return ast.getFloatTypeSemantics(ast.Float128Ty);
 
 4789  else if (bit_size == ast.getTypeSize(ast.LongDoubleTy) ||
 
 4790           bit_size == llvm::APFloat::semanticsSizeInBits(
 
 4791                           ast.getFloatTypeSemantics(ast.LongDoubleTy)))
 
 4792    return ast.getFloatTypeSemantics(ast.LongDoubleTy);
 
 4793  else if (bit_size == ast.getTypeSize(ast.HalfTy))
 
 4794    return ast.getFloatTypeSemantics(ast.HalfTy);
 
 4795  else if (bit_size == ast.getTypeSize(ast.Float128Ty))
 
 4796    return ast.getFloatTypeSemantics(ast.Float128Ty);
 
 4797  return llvm::APFloatBase::Bogus();
 
 
 4800llvm::Expected<uint64_t>
 
 4803  assert(qual_type->isObjCObjectOrInterfaceType());
 
 4808      if (std::optional<uint64_t> bit_size =
 
 4809              objc_runtime->GetTypeBitSize(
GetType(qual_type)))
 
 4813    static bool g_printed = 
false;
 
 4818      llvm::outs() << 
"warning: trying to determine the size of type ";
 
 4820      llvm::outs() << 
"without a valid ExecutionContext. this is not " 
 4821                      "reliable. please file a bug against LLDB.\n";
 
 4822      llvm::outs() << 
"backtrace:\n";
 
 4823      llvm::sys::PrintStackTrace(llvm::outs());
 
 4824      llvm::outs() << 
"\n";
 
 
 4833llvm::Expected<uint64_t>
 
 4836  const bool base_name_only = 
true;
 
 4838    return llvm::createStringError(
 
 4839        "could not complete type %s",
 
 4843  const clang::Type::TypeClass type_class = qual_type->getTypeClass();
 
 4844  switch (type_class) {
 
 4845  case clang::Type::ConstantArray:
 
 4846  case clang::Type::FunctionProto:
 
 4847  case clang::Type::Record:
 
 4849  case clang::Type::ObjCInterface:
 
 4850  case clang::Type::ObjCObject:
 
 4852  case clang::Type::IncompleteArray: {
 
 4853    const uint64_t bit_size = 
getASTContext().getTypeSize(qual_type);
 
 4856          qual_type->getArrayElementTypeNoTypeQual()
 
 4857              ->getCanonicalTypeUnqualified());
 
 4862    if (
const uint64_t bit_size = 
getASTContext().getTypeSize(qual_type))
 
 4866  return llvm::createStringError(
 
 4867      "could not get size of type %s",
 
 
 4871std::optional<size_t>
 
 4885  switch (qual_type->getTypeClass()) {
 
 4886  case clang::Type::Atomic:
 
 4887  case clang::Type::Auto:
 
 4888  case clang::Type::CountAttributed:
 
 4889  case clang::Type::Decltype:
 
 4890  case clang::Type::Paren:
 
 4891  case clang::Type::Typedef:
 
 4892  case clang::Type::TypeOf:
 
 4893  case clang::Type::TypeOfExpr:
 
 4894  case clang::Type::Using:
 
 4895  case clang::Type::PredefinedSugar:
 
 4896    llvm_unreachable(
"Handled in RemoveWrappingTypes!");
 
 4898  case clang::Type::UnaryTransform:
 
 4901  case clang::Type::FunctionNoProto:
 
 4902  case clang::Type::FunctionProto:
 
 4905  case clang::Type::IncompleteArray:
 
 4906  case clang::Type::VariableArray:
 
 4907  case clang::Type::ArrayParameter:
 
 4910  case clang::Type::ConstantArray:
 
 4913  case clang::Type::DependentVector:
 
 4914  case clang::Type::ExtVector:
 
 4915  case clang::Type::Vector:
 
 4918  case clang::Type::BitInt:
 
 4919  case clang::Type::DependentBitInt:
 
 4923  case clang::Type::Builtin:
 
 4924    switch (llvm::cast<clang::BuiltinType>(qual_type)->getKind()) {
 
 4925    case clang::BuiltinType::Void:
 
 4928    case clang::BuiltinType::Char_S:
 
 4929    case clang::BuiltinType::SChar:
 
 4930    case clang::BuiltinType::WChar_S:
 
 4931    case clang::BuiltinType::Short:
 
 4932    case clang::BuiltinType::Int:
 
 4933    case clang::BuiltinType::Long:
 
 4934    case clang::BuiltinType::LongLong:
 
 4935    case clang::BuiltinType::Int128:
 
 4938    case clang::BuiltinType::Bool:
 
 4939    case clang::BuiltinType::Char_U:
 
 4940    case clang::BuiltinType::UChar:
 
 4941    case clang::BuiltinType::WChar_U:
 
 4942    case clang::BuiltinType::Char8:
 
 4943    case clang::BuiltinType::Char16:
 
 4944    case clang::BuiltinType::Char32:
 
 4945    case clang::BuiltinType::UShort:
 
 4946    case clang::BuiltinType::UInt:
 
 4947    case clang::BuiltinType::ULong:
 
 4948    case clang::BuiltinType::ULongLong:
 
 4949    case clang::BuiltinType::UInt128:
 
 4953    case clang::BuiltinType::ShortAccum:
 
 4954    case clang::BuiltinType::Accum:
 
 4955    case clang::BuiltinType::LongAccum:
 
 4956    case clang::BuiltinType::UShortAccum:
 
 4957    case clang::BuiltinType::UAccum:
 
 4958    case clang::BuiltinType::ULongAccum:
 
 4959    case clang::BuiltinType::ShortFract:
 
 4960    case clang::BuiltinType::Fract:
 
 4961    case clang::BuiltinType::LongFract:
 
 4962    case clang::BuiltinType::UShortFract:
 
 4963    case clang::BuiltinType::UFract:
 
 4964    case clang::BuiltinType::ULongFract:
 
 4965    case clang::BuiltinType::SatShortAccum:
 
 4966    case clang::BuiltinType::SatAccum:
 
 4967    case clang::BuiltinType::SatLongAccum:
 
 4968    case clang::BuiltinType::SatUShortAccum:
 
 4969    case clang::BuiltinType::SatUAccum:
 
 4970    case clang::BuiltinType::SatULongAccum:
 
 4971    case clang::BuiltinType::SatShortFract:
 
 4972    case clang::BuiltinType::SatFract:
 
 4973    case clang::BuiltinType::SatLongFract:
 
 4974    case clang::BuiltinType::SatUShortFract:
 
 4975    case clang::BuiltinType::SatUFract:
 
 4976    case clang::BuiltinType::SatULongFract:
 
 4979    case clang::BuiltinType::Half:
 
 4980    case clang::BuiltinType::Float:
 
 4981    case clang::BuiltinType::Float16:
 
 4982    case clang::BuiltinType::Float128:
 
 4983    case clang::BuiltinType::Double:
 
 4984    case clang::BuiltinType::LongDouble:
 
 4985    case clang::BuiltinType::BFloat16:
 
 4986    case clang::BuiltinType::Ibm128:
 
 4989    case clang::BuiltinType::ObjCClass:
 
 4990    case clang::BuiltinType::ObjCId:
 
 4991    case clang::BuiltinType::ObjCSel:
 
 4994    case clang::BuiltinType::NullPtr:
 
 4997    case clang::BuiltinType::Kind::ARCUnbridgedCast:
 
 4998    case clang::BuiltinType::Kind::BoundMember:
 
 4999    case clang::BuiltinType::Kind::BuiltinFn:
 
 5000    case clang::BuiltinType::Kind::Dependent:
 
 5001    case clang::BuiltinType::Kind::OCLClkEvent:
 
 5002    case clang::BuiltinType::Kind::OCLEvent:
 
 5003    case clang::BuiltinType::Kind::OCLImage1dRO:
 
 5004    case clang::BuiltinType::Kind::OCLImage1dWO:
 
 5005    case clang::BuiltinType::Kind::OCLImage1dRW:
 
 5006    case clang::BuiltinType::Kind::OCLImage1dArrayRO:
 
 5007    case clang::BuiltinType::Kind::OCLImage1dArrayWO:
 
 5008    case clang::BuiltinType::Kind::OCLImage1dArrayRW:
 
 5009    case clang::BuiltinType::Kind::OCLImage1dBufferRO:
 
 5010    case clang::BuiltinType::Kind::OCLImage1dBufferWO:
 
 5011    case clang::BuiltinType::Kind::OCLImage1dBufferRW:
 
 5012    case clang::BuiltinType::Kind::OCLImage2dRO:
 
 5013    case clang::BuiltinType::Kind::OCLImage2dWO:
 
 5014    case clang::BuiltinType::Kind::OCLImage2dRW:
 
 5015    case clang::BuiltinType::Kind::OCLImage2dArrayRO:
 
 5016    case clang::BuiltinType::Kind::OCLImage2dArrayWO:
 
 5017    case clang::BuiltinType::Kind::OCLImage2dArrayRW:
 
 5018    case clang::BuiltinType::Kind::OCLImage2dArrayDepthRO:
 
 5019    case clang::BuiltinType::Kind::OCLImage2dArrayDepthWO:
 
 5020    case clang::BuiltinType::Kind::OCLImage2dArrayDepthRW:
 
 5021    case clang::BuiltinType::Kind::OCLImage2dArrayMSAARO:
 
 5022    case clang::BuiltinType::Kind::OCLImage2dArrayMSAAWO:
 
 5023    case clang::BuiltinType::Kind::OCLImage2dArrayMSAARW:
 
 5024    case clang::BuiltinType::Kind::OCLImage2dArrayMSAADepthRO:
 
 5025    case clang::BuiltinType::Kind::OCLImage2dArrayMSAADepthWO:
 
 5026    case clang::BuiltinType::Kind::OCLImage2dArrayMSAADepthRW:
 
 5027    case clang::BuiltinType::Kind::OCLImage2dDepthRO:
 
 5028    case clang::BuiltinType::Kind::OCLImage2dDepthWO:
 
 5029    case clang::BuiltinType::Kind::OCLImage2dDepthRW:
 
 5030    case clang::BuiltinType::Kind::OCLImage2dMSAARO:
 
 5031    case clang::BuiltinType::Kind::OCLImage2dMSAAWO:
 
 5032    case clang::BuiltinType::Kind::OCLImage2dMSAARW:
 
 5033    case clang::BuiltinType::Kind::OCLImage2dMSAADepthRO:
 
 5034    case clang::BuiltinType::Kind::OCLImage2dMSAADepthWO:
 
 5035    case clang::BuiltinType::Kind::OCLImage2dMSAADepthRW:
 
 5036    case clang::BuiltinType::Kind::OCLImage3dRO:
 
 5037    case clang::BuiltinType::Kind::OCLImage3dWO:
 
 5038    case clang::BuiltinType::Kind::OCLImage3dRW:
 
 5039    case clang::BuiltinType::Kind::OCLQueue:
 
 5040    case clang::BuiltinType::Kind::OCLReserveID:
 
 5041    case clang::BuiltinType::Kind::OCLSampler:
 
 5042    case clang::BuiltinType::Kind::HLSLResource:
 
 5043    case clang::BuiltinType::Kind::ArraySection:
 
 5044    case clang::BuiltinType::Kind::OMPArrayShaping:
 
 5045    case clang::BuiltinType::Kind::OMPIterator:
 
 5046    case clang::BuiltinType::Kind::Overload:
 
 5047    case clang::BuiltinType::Kind::PseudoObject:
 
 5048    case clang::BuiltinType::Kind::UnknownAny:
 
 5051    case clang::BuiltinType::OCLIntelSubgroupAVCMcePayload:
 
 5052    case clang::BuiltinType::OCLIntelSubgroupAVCImePayload:
 
 5053    case clang::BuiltinType::OCLIntelSubgroupAVCRefPayload:
 
 5054    case clang::BuiltinType::OCLIntelSubgroupAVCSicPayload:
 
 5055    case clang::BuiltinType::OCLIntelSubgroupAVCMceResult:
 
 5056    case clang::BuiltinType::OCLIntelSubgroupAVCImeResult:
 
 5057    case clang::BuiltinType::OCLIntelSubgroupAVCRefResult:
 
 5058    case clang::BuiltinType::OCLIntelSubgroupAVCSicResult:
 
 5059    case clang::BuiltinType::OCLIntelSubgroupAVCImeResultSingleReferenceStreamout:
 
 5060    case clang::BuiltinType::OCLIntelSubgroupAVCImeResultDualReferenceStreamout:
 
 5061    case clang::BuiltinType::OCLIntelSubgroupAVCImeSingleReferenceStreamin:
 
 5062    case clang::BuiltinType::OCLIntelSubgroupAVCImeDualReferenceStreamin:
 
 5066    case clang::BuiltinType::VectorPair:
 
 5067    case clang::BuiltinType::VectorQuad:
 
 5068    case clang::BuiltinType::DMR1024:
 
 5069    case clang::BuiltinType::DMR2048:
 
 5073#define SVE_TYPE(Name, Id, SingletonId) case clang::BuiltinType::Id: 
 5074#include "clang/Basic/AArch64ACLETypes.def" 
 5078#define RVV_TYPE(Name, Id, SingletonId) case clang::BuiltinType::Id: 
 5079#include "clang/Basic/RISCVVTypes.def" 
 5083    case clang::BuiltinType::WasmExternRef:
 
 5086    case clang::BuiltinType::IncompleteMatrixIdx:
 
 5089    case clang::BuiltinType::UnresolvedTemplate:
 
 5093#define AMDGPU_TYPE(Name, Id, SingletonId, Width, Align)                       \ 
 5094  case clang::BuiltinType::Id: 
 5095#include "clang/Basic/AMDGPUTypes.def" 
 5101  case clang::Type::ObjCObjectPointer:
 
 5102  case clang::Type::BlockPointer:
 
 5103  case clang::Type::Pointer:
 
 5104  case clang::Type::LValueReference:
 
 5105  case clang::Type::RValueReference:
 
 5106  case clang::Type::MemberPointer:
 
 5108  case clang::Type::Complex: {
 
 5110    if (qual_type->isComplexType())
 
 5113      const clang::ComplexType *complex_type =
 
 5114          qual_type->getAsComplexIntegerType();
 
 5123  case clang::Type::ObjCInterface:
 
 5125  case clang::Type::Record:
 
 5127  case clang::Type::Enum:
 
 5128    return qual_type->isUnsignedIntegerOrEnumerationType()
 
 5131  case clang::Type::DependentSizedArray:
 
 5132  case clang::Type::DependentSizedExtVector:
 
 5133  case clang::Type::UnresolvedUsing:
 
 5134  case clang::Type::Attributed:
 
 5135  case clang::Type::BTFTagAttributed:
 
 5136  case clang::Type::TemplateTypeParm:
 
 5137  case clang::Type::SubstTemplateTypeParm:
 
 5138  case clang::Type::SubstTemplateTypeParmPack:
 
 5139  case clang::Type::InjectedClassName:
 
 5140  case clang::Type::DependentName:
 
 5141  case clang::Type::PackExpansion:
 
 5142  case clang::Type::ObjCObject:
 
 5144  case clang::Type::TemplateSpecialization:
 
 5145  case clang::Type::DeducedTemplateSpecialization:
 
 5146  case clang::Type::Adjusted:
 
 5147  case clang::Type::Pipe:
 
 5151  case clang::Type::Decayed:
 
 5153  case clang::Type::ObjCTypeParam:
 
 5156  case clang::Type::DependentAddressSpace:
 
 5158  case clang::Type::MacroQualified:
 
 5161  case clang::Type::ConstantMatrix:
 
 5162  case clang::Type::DependentSizedMatrix:
 
 5166  case clang::Type::PackIndexing:
 
 5169  case clang::Type::HLSLAttributedResource:
 
 5171  case clang::Type::HLSLInlineSpirv:
 
 5173  case clang::Type::SubstBuiltinTemplatePack:
 
 
 5186  switch (qual_type->getTypeClass()) {
 
 5187  case clang::Type::Atomic:
 
 5188  case clang::Type::Auto:
 
 5189  case clang::Type::CountAttributed:
 
 5190  case clang::Type::Decltype:
 
 5191  case clang::Type::Paren:
 
 5192  case clang::Type::Typedef:
 
 5193  case clang::Type::TypeOf:
 
 5194  case clang::Type::TypeOfExpr:
 
 5195  case clang::Type::Using:
 
 5196  case clang::Type::PredefinedSugar:
 
 5197    llvm_unreachable(
"Handled in RemoveWrappingTypes!");
 
 5198  case clang::Type::UnaryTransform:
 
 5201  case clang::Type::FunctionNoProto:
 
 5202  case clang::Type::FunctionProto:
 
 5205  case clang::Type::IncompleteArray:
 
 5206  case clang::Type::VariableArray:
 
 5207  case clang::Type::ArrayParameter:
 
 5210  case clang::Type::ConstantArray:
 
 5213  case clang::Type::DependentVector:
 
 5214  case clang::Type::ExtVector:
 
 5215  case clang::Type::Vector:
 
 5218  case clang::Type::BitInt:
 
 5219  case clang::Type::DependentBitInt:
 
 5223  case clang::Type::Builtin:
 
 5224    switch (llvm::cast<clang::BuiltinType>(qual_type)->getKind()) {
 
 5225    case clang::BuiltinType::UnknownAny:
 
 5226    case clang::BuiltinType::Void:
 
 5227    case clang::BuiltinType::BoundMember:
 
 5230    case clang::BuiltinType::Bool:
 
 5232    case clang::BuiltinType::Char_S:
 
 5233    case clang::BuiltinType::SChar:
 
 5234    case clang::BuiltinType::WChar_S:
 
 5235    case clang::BuiltinType::Char_U:
 
 5236    case clang::BuiltinType::UChar:
 
 5237    case clang::BuiltinType::WChar_U:
 
 5239    case clang::BuiltinType::Char8:
 
 5241    case clang::BuiltinType::Char16:
 
 5243    case clang::BuiltinType::Char32:
 
 5245    case clang::BuiltinType::UShort:
 
 5247    case clang::BuiltinType::Short:
 
 5249    case clang::BuiltinType::UInt:
 
 5251    case clang::BuiltinType::Int:
 
 5253    case clang::BuiltinType::ULong:
 
 5255    case clang::BuiltinType::Long:
 
 5257    case clang::BuiltinType::ULongLong:
 
 5259    case clang::BuiltinType::LongLong:
 
 5261    case clang::BuiltinType::UInt128:
 
 5263    case clang::BuiltinType::Int128:
 
 5265    case clang::BuiltinType::Half:
 
 5266    case clang::BuiltinType::Float:
 
 5267    case clang::BuiltinType::Double:
 
 5268    case clang::BuiltinType::LongDouble:
 
 5270    case clang::BuiltinType::Float128:
 
 5276  case clang::Type::ObjCObjectPointer:
 
 5278  case clang::Type::BlockPointer:
 
 5280  case clang::Type::Pointer:
 
 5282  case clang::Type::LValueReference:
 
 5283  case clang::Type::RValueReference:
 
 5285  case clang::Type::MemberPointer:
 
 5287  case clang::Type::Complex: {
 
 5288    if (qual_type->isComplexType())
 
 5293  case clang::Type::ObjCInterface:
 
 5295  case clang::Type::Record:
 
 5297  case clang::Type::Enum:
 
 5299  case clang::Type::DependentSizedArray:
 
 5300  case clang::Type::DependentSizedExtVector:
 
 5301  case clang::Type::UnresolvedUsing:
 
 5302  case clang::Type::Attributed:
 
 5303  case clang::Type::BTFTagAttributed:
 
 5304  case clang::Type::TemplateTypeParm:
 
 5305  case clang::Type::SubstTemplateTypeParm:
 
 5306  case clang::Type::SubstTemplateTypeParmPack:
 
 5307  case clang::Type::InjectedClassName:
 
 5308  case clang::Type::DependentName:
 
 5309  case clang::Type::PackExpansion:
 
 5310  case clang::Type::ObjCObject:
 
 5312  case clang::Type::TemplateSpecialization:
 
 5313  case clang::Type::DeducedTemplateSpecialization:
 
 5314  case clang::Type::Adjusted:
 
 5315  case clang::Type::Pipe:
 
 5319  case clang::Type::Decayed:
 
 5321  case clang::Type::ObjCTypeParam:
 
 5324  case clang::Type::DependentAddressSpace:
 
 5326  case clang::Type::MacroQualified:
 
 5330  case clang::Type::ConstantMatrix:
 
 5331  case clang::Type::DependentSizedMatrix:
 
 5335  case clang::Type::PackIndexing:
 
 5338  case clang::Type::HLSLAttributedResource:
 
 5340  case clang::Type::HLSLInlineSpirv:
 
 5342  case clang::Type::SubstBuiltinTemplatePack:
 
 
 5350  while (class_interface_decl) {
 
 5351    if (class_interface_decl->ivar_size() > 0)
 
 5354    class_interface_decl = class_interface_decl->getSuperClass();
 
 
 5359static std::optional<SymbolFile::ArrayInfo>
 
 5361                    clang::QualType qual_type,
 
 5363  if (qual_type->isIncompleteArrayType())
 
 5364    if (std::optional<ClangASTMetadata> metadata =
 
 5368  return std::nullopt;
 
 
 5371llvm::Expected<uint32_t>
 
 5373                                bool omit_empty_base_classes,
 
 5376    return llvm::createStringError(
"invalid clang type");
 
 5378  uint32_t num_children = 0;
 
 5380  const clang::Type::TypeClass type_class = qual_type->getTypeClass();
 
 5381  switch (type_class) {
 
 5382  case clang::Type::Builtin:
 
 5383    switch (llvm::cast<clang::BuiltinType>(qual_type)->getKind()) {
 
 5384    case clang::BuiltinType::ObjCId:    
 
 5385    case clang::BuiltinType::ObjCClass: 
 
 5394  case clang::Type::Complex:
 
 5396  case clang::Type::Record:
 
 5398      const clang::RecordType *record_type =
 
 5399          llvm::cast<clang::RecordType>(qual_type.getTypePtr());
 
 5400      const clang::RecordDecl *record_decl =
 
 5401          record_type->getDecl()->getDefinitionOrSelf();
 
 5402      const clang::CXXRecordDecl *cxx_record_decl =
 
 5403          llvm::dyn_cast<clang::CXXRecordDecl>(record_decl);
 
 5407      num_children += std::distance(record_decl->field_begin(),
 
 5408                               record_decl->field_end());
 
 5410      return llvm::createStringError(
 
 5413  case clang::Type::ObjCObject:
 
 5414  case clang::Type::ObjCInterface:
 
 5416      const clang::ObjCObjectType *objc_class_type =
 
 5417          llvm::dyn_cast<clang::ObjCObjectType>(qual_type.getTypePtr());
 
 5418      assert(objc_class_type);
 
 5419      if (objc_class_type) {
 
 5420        clang::ObjCInterfaceDecl *class_interface_decl =
 
 5421            objc_class_type->getInterface();
 
 5423        if (class_interface_decl) {
 
 5425          clang::ObjCInterfaceDecl *superclass_interface_decl =
 
 5426              class_interface_decl->getSuperClass();
 
 5427          if (superclass_interface_decl) {
 
 5428            if (omit_empty_base_classes) {
 
 5435          num_children += class_interface_decl->ivar_size();
 
 5441  case clang::Type::LValueReference:
 
 5442  case clang::Type::RValueReference:
 
 5443  case clang::Type::ObjCObjectPointer: {
 
 5446    uint32_t num_pointee_children = 0;
 
 5448      auto num_children_or_err =
 
 5449          pointee_clang_type.
GetNumChildren(omit_empty_base_classes, exe_ctx);
 
 5450      if (!num_children_or_err)
 
 5451        return num_children_or_err;
 
 5452      num_pointee_children = *num_children_or_err;
 
 5455    if (num_pointee_children == 0)
 
 5458      num_children = num_pointee_children;
 
 5461  case clang::Type::Vector:
 
 5462  case clang::Type::ExtVector:
 
 5464        llvm::cast<clang::VectorType>(qual_type.getTypePtr())->getNumElements();
 
 5467  case clang::Type::ConstantArray:
 
 5468    num_children = llvm::cast<clang::ConstantArrayType>(qual_type.getTypePtr())
 
 5472  case clang::Type::IncompleteArray:
 
 5473    if (
auto array_info =
 
 5476      num_children = array_info->element_orders.size()
 
 5477                         ? array_info->element_orders.back().value_or(0)
 
 5481  case clang::Type::Pointer: {
 
 5482    const clang::PointerType *pointer_type =
 
 5483        llvm::cast<clang::PointerType>(qual_type.getTypePtr());
 
 5484    clang::QualType pointee_type(pointer_type->getPointeeType());
 
 5486    uint32_t num_pointee_children = 0;
 
 5488      auto num_children_or_err =
 
 5489          pointee_clang_type.
GetNumChildren(omit_empty_base_classes, exe_ctx);
 
 5490      if (!num_children_or_err)
 
 5491        return num_children_or_err;
 
 5492      num_pointee_children = *num_children_or_err;
 
 5494    if (num_pointee_children == 0) {
 
 5499      num_children = num_pointee_children;
 
 5505  return num_children;
 
 
 5516    const clang::Type::TypeClass type_class = qual_type->getTypeClass();
 
 5517    if (type_class == clang::Type::Builtin) {
 
 5518      switch (llvm::cast<clang::BuiltinType>(qual_type)->getKind()) {
 
 5519      case clang::BuiltinType::Void:
 
 5521      case clang::BuiltinType::Bool:
 
 5523      case clang::BuiltinType::Char_S:
 
 5525      case clang::BuiltinType::Char_U:
 
 5527      case clang::BuiltinType::Char8:
 
 5529      case clang::BuiltinType::Char16:
 
 5531      case clang::BuiltinType::Char32:
 
 5533      case clang::BuiltinType::UChar:
 
 5535      case clang::BuiltinType::SChar:
 
 5537      case clang::BuiltinType::WChar_S:
 
 5539      case clang::BuiltinType::WChar_U:
 
 5541      case clang::BuiltinType::Short:
 
 5543      case clang::BuiltinType::UShort:
 
 5545      case clang::BuiltinType::Int:
 
 5547      case clang::BuiltinType::UInt:
 
 5549      case clang::BuiltinType::Long:
 
 5551      case clang::BuiltinType::ULong:
 
 5553      case clang::BuiltinType::LongLong:
 
 5555      case clang::BuiltinType::ULongLong:
 
 5557      case clang::BuiltinType::Int128:
 
 5559      case clang::BuiltinType::UInt128:
 
 5562      case clang::BuiltinType::Half:
 
 5564      case clang::BuiltinType::Float:
 
 5566      case clang::BuiltinType::Double:
 
 5568      case clang::BuiltinType::LongDouble:
 
 5570      case clang::BuiltinType::Float128:
 
 5573      case clang::BuiltinType::NullPtr:
 
 5575      case clang::BuiltinType::ObjCId:
 
 5577      case clang::BuiltinType::ObjCClass:
 
 5579      case clang::BuiltinType::ObjCSel:
 
 
 5593                       const llvm::APSInt &value)> 
const &callback) {
 
 5594  const clang::EnumType *enum_type =
 
 5597    const clang::EnumDecl *enum_decl =
 
 5598        enum_type->getDecl()->getDefinitionOrSelf();
 
 5602      clang::EnumDecl::enumerator_iterator enum_pos, enum_end_pos;
 
 5603      for (enum_pos = enum_decl->enumerator_begin(),
 
 5604          enum_end_pos = enum_decl->enumerator_end();
 
 5605           enum_pos != enum_end_pos; ++enum_pos) {
 
 5606        ConstString name(enum_pos->getNameAsString().c_str());
 
 5607        if (!callback(integer_type, name, enum_pos->getInitVal()))
 
 
 5614#pragma mark Aggregate Types 
 5622  const clang::Type::TypeClass type_class = qual_type->getTypeClass();
 
 5623  switch (type_class) {
 
 5624  case clang::Type::Record:
 
 5626      const clang::RecordType *record_type =
 
 5627          llvm::dyn_cast<clang::RecordType>(qual_type.getTypePtr());
 
 5629        clang::RecordDecl *record_decl =
 
 5630            record_type->getDecl()->getDefinition();
 
 5632          count = std::distance(record_decl->field_begin(),
 
 5633                                record_decl->field_end());
 
 5639  case clang::Type::ObjCObjectPointer: {
 
 5640    const clang::ObjCObjectPointerType *objc_class_type =
 
 5641        qual_type->castAs<clang::ObjCObjectPointerType>();
 
 5642    const clang::ObjCInterfaceType *objc_interface_type =
 
 5643        objc_class_type->getInterfaceType();
 
 5644    if (objc_interface_type &&
 
 5646            const_cast<clang::ObjCInterfaceType *
>(objc_interface_type)))) {
 
 5647      clang::ObjCInterfaceDecl *class_interface_decl =
 
 5648          objc_interface_type->getDecl();
 
 5649      if (class_interface_decl) {
 
 5650        count = class_interface_decl->ivar_size();
 
 5656  case clang::Type::ObjCObject:
 
 5657  case clang::Type::ObjCInterface:
 
 5659      const clang::ObjCObjectType *objc_class_type =
 
 5660          llvm::dyn_cast<clang::ObjCObjectType>(qual_type.getTypePtr());
 
 5661      if (objc_class_type) {
 
 5662        clang::ObjCInterfaceDecl *class_interface_decl =
 
 5663            objc_class_type->getInterface();
 
 5665        if (class_interface_decl)
 
 5666          count = class_interface_decl->ivar_size();
 
 
 5679                    clang::ObjCInterfaceDecl *class_interface_decl, 
size_t idx,
 
 5680                    std::string &name, uint64_t *bit_offset_ptr,
 
 5681                    uint32_t *bitfield_bit_size_ptr, 
bool *is_bitfield_ptr) {
 
 5682  if (class_interface_decl) {
 
 5683    if (idx < (class_interface_decl->ivar_size())) {
 
 5684      clang::ObjCInterfaceDecl::ivar_iterator ivar_pos,
 
 5685          ivar_end = class_interface_decl->ivar_end();
 
 5686      uint32_t ivar_idx = 0;
 
 5688      for (ivar_pos = class_interface_decl->ivar_begin(); ivar_pos != ivar_end;
 
 5689           ++ivar_pos, ++ivar_idx) {
 
 5690        if (ivar_idx == idx) {
 
 5691          const clang::ObjCIvarDecl *ivar_decl = *ivar_pos;
 
 5693          clang::QualType ivar_qual_type(ivar_decl->getType());
 
 5695          name.assign(ivar_decl->getNameAsString());
 
 5697          if (bit_offset_ptr) {
 
 5698            const clang::ASTRecordLayout &interface_layout =
 
 5699                ast->getASTObjCInterfaceLayout(class_interface_decl);
 
 5700            *bit_offset_ptr = interface_layout.getFieldOffset(ivar_idx);
 
 5703          const bool is_bitfield = ivar_pos->isBitField();
 
 5705          if (bitfield_bit_size_ptr) {
 
 5706            *bitfield_bit_size_ptr = 0;
 
 5708            if (is_bitfield && ast) {
 
 5709              clang::Expr *bitfield_bit_size_expr = ivar_pos->getBitWidth();
 
 5710              clang::Expr::EvalResult result;
 
 5711              if (bitfield_bit_size_expr &&
 
 5712                  bitfield_bit_size_expr->EvaluateAsInt(result, *ast)) {
 
 5713                llvm::APSInt bitfield_apsint = result.Val.getInt();
 
 5714                *bitfield_bit_size_ptr = bitfield_apsint.getLimitedValue();
 
 5718          if (is_bitfield_ptr)
 
 5719            *is_bitfield_ptr = is_bitfield;
 
 5721          return ivar_qual_type.getAsOpaquePtr();
 
 
 5730                                              size_t idx, std::string &name,
 
 5731                                              uint64_t *bit_offset_ptr,
 
 5732                                              uint32_t *bitfield_bit_size_ptr,
 
 5733                                              bool *is_bitfield_ptr) {
 
 5738  const clang::Type::TypeClass type_class = qual_type->getTypeClass();
 
 5739  switch (type_class) {
 
 5740  case clang::Type::Record:
 
 5742      const clang::RecordType *record_type =
 
 5743          llvm::cast<clang::RecordType>(qual_type.getTypePtr());
 
 5744      const clang::RecordDecl *record_decl =
 
 5745          record_type->getDecl()->getDefinitionOrSelf();
 
 5746      uint32_t field_idx = 0;
 
 5747      clang::RecordDecl::field_iterator field, field_end;
 
 5748      for (field = record_decl->field_begin(),
 
 5749          field_end = record_decl->field_end();
 
 5750           field != field_end; ++field, ++field_idx) {
 
 5751        if (idx == field_idx) {
 
 5754          name.assign(field->getNameAsString());
 
 5758          if (bit_offset_ptr) {
 
 5759            const clang::ASTRecordLayout &record_layout =
 
 5761            *bit_offset_ptr = record_layout.getFieldOffset(field_idx);
 
 5764          const bool is_bitfield = field->isBitField();
 
 5766          if (bitfield_bit_size_ptr) {
 
 5767            *bitfield_bit_size_ptr = 0;
 
 5770              clang::Expr *bitfield_bit_size_expr = field->getBitWidth();
 
 5771              clang::Expr::EvalResult result;
 
 5772              if (bitfield_bit_size_expr &&
 
 5773                  bitfield_bit_size_expr->EvaluateAsInt(result,
 
 5775                llvm::APSInt bitfield_apsint = result.Val.getInt();
 
 5776                *bitfield_bit_size_ptr = bitfield_apsint.getLimitedValue();
 
 5780          if (is_bitfield_ptr)
 
 5781            *is_bitfield_ptr = is_bitfield;
 
 5783          return GetType(field->getType());
 
 5789  case clang::Type::ObjCObjectPointer: {
 
 5790    const clang::ObjCObjectPointerType *objc_class_type =
 
 5791        qual_type->castAs<clang::ObjCObjectPointerType>();
 
 5792    const clang::ObjCInterfaceType *objc_interface_type =
 
 5793        objc_class_type->getInterfaceType();
 
 5794    if (objc_interface_type &&
 
 5796            const_cast<clang::ObjCInterfaceType *
>(objc_interface_type)))) {
 
 5797      clang::ObjCInterfaceDecl *class_interface_decl =
 
 5798          objc_interface_type->getDecl();
 
 5799      if (class_interface_decl) {
 
 5803                                name, bit_offset_ptr, bitfield_bit_size_ptr,
 
 5810  case clang::Type::ObjCObject:
 
 5811  case clang::Type::ObjCInterface:
 
 5813      const clang::ObjCObjectType *objc_class_type =
 
 5814          llvm::dyn_cast<clang::ObjCObjectType>(qual_type.getTypePtr());
 
 5815      assert(objc_class_type);
 
 5816      if (objc_class_type) {
 
 5817        clang::ObjCInterfaceDecl *class_interface_decl =
 
 5818            objc_class_type->getInterface();
 
 5822                                name, bit_offset_ptr, bitfield_bit_size_ptr,
 
 
 5838  const clang::Type::TypeClass type_class = qual_type->getTypeClass();
 
 5839  switch (type_class) {
 
 5840  case clang::Type::Record:
 
 5842      const clang::CXXRecordDecl *cxx_record_decl =
 
 5843          qual_type->getAsCXXRecordDecl();
 
 5844      if (cxx_record_decl)
 
 5845        count = cxx_record_decl->getNumBases();
 
 5849  case clang::Type::ObjCObjectPointer:
 
 5853  case clang::Type::ObjCObject:
 
 5855      const clang::ObjCObjectType *objc_class_type =
 
 5856          qual_type->getAsObjCQualifiedInterfaceType();
 
 5857      if (objc_class_type) {
 
 5858        clang::ObjCInterfaceDecl *class_interface_decl =
 
 5859            objc_class_type->getInterface();
 
 5861        if (class_interface_decl && class_interface_decl->getSuperClass())
 
 5866  case clang::Type::ObjCInterface:
 
 5868      const clang::ObjCInterfaceType *objc_interface_type =
 
 5869          qual_type->getAs<clang::ObjCInterfaceType>();
 
 5870      if (objc_interface_type) {
 
 5871        clang::ObjCInterfaceDecl *class_interface_decl =
 
 5872            objc_interface_type->getInterface();
 
 5874        if (class_interface_decl && class_interface_decl->getSuperClass())
 
 
 5890  const clang::Type::TypeClass type_class = qual_type->getTypeClass();
 
 5891  switch (type_class) {
 
 5892  case clang::Type::Record:
 
 5894      const clang::CXXRecordDecl *cxx_record_decl =
 
 5895          qual_type->getAsCXXRecordDecl();
 
 5896      if (cxx_record_decl)
 
 5897        count = cxx_record_decl->getNumVBases();
 
 
 5910  const clang::Type::TypeClass type_class = qual_type->getTypeClass();
 
 5911  switch (type_class) {
 
 5912  case clang::Type::Record:
 
 5914      const clang::CXXRecordDecl *cxx_record_decl =
 
 5915          qual_type->getAsCXXRecordDecl();
 
 5916      if (cxx_record_decl) {
 
 5917        uint32_t curr_idx = 0;
 
 5918        clang::CXXRecordDecl::base_class_const_iterator base_class,
 
 5920        for (base_class = cxx_record_decl->bases_begin(),
 
 5921            base_class_end = cxx_record_decl->bases_end();
 
 5922             base_class != base_class_end; ++base_class, ++curr_idx) {
 
 5923          if (curr_idx == idx) {
 
 5924            if (bit_offset_ptr) {
 
 5925              const clang::ASTRecordLayout &record_layout =
 
 5927              const clang::CXXRecordDecl *base_class_decl =
 
 5928                  llvm::cast<clang::CXXRecordDecl>(
 
 5929                      base_class->getType()
 
 5930                          ->castAs<clang::RecordType>()
 
 5932              if (base_class->isVirtual())
 
 5934                    record_layout.getVBaseClassOffset(base_class_decl)
 
 5939                    record_layout.getBaseClassOffset(base_class_decl)
 
 5943            return GetType(base_class->getType());
 
 5950  case clang::Type::ObjCObjectPointer:
 
 5953  case clang::Type::ObjCObject:
 
 5955      const clang::ObjCObjectType *objc_class_type =
 
 5956          qual_type->getAsObjCQualifiedInterfaceType();
 
 5957      if (objc_class_type) {
 
 5958        clang::ObjCInterfaceDecl *class_interface_decl =
 
 5959            objc_class_type->getInterface();
 
 5961        if (class_interface_decl) {
 
 5962          clang::ObjCInterfaceDecl *superclass_interface_decl =
 
 5963              class_interface_decl->getSuperClass();
 
 5964          if (superclass_interface_decl) {
 
 5966              *bit_offset_ptr = 0;
 
 5968                superclass_interface_decl));
 
 5974  case clang::Type::ObjCInterface:
 
 5976      const clang::ObjCObjectType *objc_interface_type =
 
 5977          qual_type->getAs<clang::ObjCInterfaceType>();
 
 5978      if (objc_interface_type) {
 
 5979        clang::ObjCInterfaceDecl *class_interface_decl =
 
 5980            objc_interface_type->getInterface();
 
 5982        if (class_interface_decl) {
 
 5983          clang::ObjCInterfaceDecl *superclass_interface_decl =
 
 5984              class_interface_decl->getSuperClass();
 
 5985          if (superclass_interface_decl) {
 
 5987              *bit_offset_ptr = 0;
 
 5989                superclass_interface_decl));
 
 
 6005  const clang::Type::TypeClass type_class = qual_type->getTypeClass();
 
 6006  switch (type_class) {
 
 6007  case clang::Type::Record:
 
 6009      const clang::CXXRecordDecl *cxx_record_decl =
 
 6010          qual_type->getAsCXXRecordDecl();
 
 6011      if (cxx_record_decl) {
 
 6012        uint32_t curr_idx = 0;
 
 6013        clang::CXXRecordDecl::base_class_const_iterator base_class,
 
 6015        for (base_class = cxx_record_decl->vbases_begin(),
 
 6016            base_class_end = cxx_record_decl->vbases_end();
 
 6017             base_class != base_class_end; ++base_class, ++curr_idx) {
 
 6018          if (curr_idx == idx) {
 
 6019            if (bit_offset_ptr) {
 
 6020              const clang::ASTRecordLayout &record_layout =
 
 6022              const clang::CXXRecordDecl *base_class_decl =
 
 6023                  llvm::cast<clang::CXXRecordDecl>(
 
 6024                      base_class->getType()
 
 6025                          ->castAs<clang::RecordType>()
 
 6028                  record_layout.getVBaseClassOffset(base_class_decl)
 
 6032            return GetType(base_class->getType());
 
 
 6047                                        llvm::StringRef name) {
 
 6049  switch (qual_type->getTypeClass()) {
 
 6050  case clang::Type::Record: {
 
 6054    const clang::RecordType *record_type =
 
 6055        llvm::cast<clang::RecordType>(qual_type.getTypePtr());
 
 6056    const clang::RecordDecl *record_decl =
 
 6057        record_type->getDecl()->getDefinitionOrSelf();
 
 6059    clang::DeclarationName decl_name(&
getASTContext().Idents.get(name));
 
 6060    for (NamedDecl *decl : record_decl->lookup(decl_name)) {
 
 6061      auto *var_decl = dyn_cast<clang::VarDecl>(decl);
 
 6062      if (!var_decl || var_decl->getStorageClass() != clang::SC_Static)
 
 
 6086  const clang::Type::TypeClass type_class = qual_type->getTypeClass();
 
 6087  switch (type_class) {
 
 6088  case clang::Type::Builtin:
 
 6089    switch (llvm::cast<clang::BuiltinType>(qual_type)->getKind()) {
 
 6090    case clang::BuiltinType::UnknownAny:
 
 6091    case clang::BuiltinType::Void:
 
 6092    case clang::BuiltinType::NullPtr:
 
 6093    case clang::BuiltinType::OCLEvent:
 
 6094    case clang::BuiltinType::OCLImage1dRO:
 
 6095    case clang::BuiltinType::OCLImage1dWO:
 
 6096    case clang::BuiltinType::OCLImage1dRW:
 
 6097    case clang::BuiltinType::OCLImage1dArrayRO:
 
 6098    case clang::BuiltinType::OCLImage1dArrayWO:
 
 6099    case clang::BuiltinType::OCLImage1dArrayRW:
 
 6100    case clang::BuiltinType::OCLImage1dBufferRO:
 
 6101    case clang::BuiltinType::OCLImage1dBufferWO:
 
 6102    case clang::BuiltinType::OCLImage1dBufferRW:
 
 6103    case clang::BuiltinType::OCLImage2dRO:
 
 6104    case clang::BuiltinType::OCLImage2dWO:
 
 6105    case clang::BuiltinType::OCLImage2dRW:
 
 6106    case clang::BuiltinType::OCLImage2dArrayRO:
 
 6107    case clang::BuiltinType::OCLImage2dArrayWO:
 
 6108    case clang::BuiltinType::OCLImage2dArrayRW:
 
 6109    case clang::BuiltinType::OCLImage3dRO:
 
 6110    case clang::BuiltinType::OCLImage3dWO:
 
 6111    case clang::BuiltinType::OCLImage3dRW:
 
 6112    case clang::BuiltinType::OCLSampler:
 
 6113    case clang::BuiltinType::HLSLResource:
 
 6115    case clang::BuiltinType::Bool:
 
 6116    case clang::BuiltinType::Char_U:
 
 6117    case clang::BuiltinType::UChar:
 
 6118    case clang::BuiltinType::WChar_U:
 
 6119    case clang::BuiltinType::Char16:
 
 6120    case clang::BuiltinType::Char32:
 
 6121    case clang::BuiltinType::UShort:
 
 6122    case clang::BuiltinType::UInt:
 
 6123    case clang::BuiltinType::ULong:
 
 6124    case clang::BuiltinType::ULongLong:
 
 6125    case clang::BuiltinType::UInt128:
 
 6126    case clang::BuiltinType::Char_S:
 
 6127    case clang::BuiltinType::SChar:
 
 6128    case clang::BuiltinType::WChar_S:
 
 6129    case clang::BuiltinType::Short:
 
 6130    case clang::BuiltinType::Int:
 
 6131    case clang::BuiltinType::Long:
 
 6132    case clang::BuiltinType::LongLong:
 
 6133    case clang::BuiltinType::Int128:
 
 6134    case clang::BuiltinType::Float:
 
 6135    case clang::BuiltinType::Double:
 
 6136    case clang::BuiltinType::LongDouble:
 
 6137    case clang::BuiltinType::Float128:
 
 6138    case clang::BuiltinType::Dependent:
 
 6139    case clang::BuiltinType::Overload:
 
 6140    case clang::BuiltinType::ObjCId:
 
 6141    case clang::BuiltinType::ObjCClass:
 
 6142    case clang::BuiltinType::ObjCSel:
 
 6143    case clang::BuiltinType::BoundMember:
 
 6144    case clang::BuiltinType::Half:
 
 6145    case clang::BuiltinType::ARCUnbridgedCast:
 
 6146    case clang::BuiltinType::PseudoObject:
 
 6147    case clang::BuiltinType::BuiltinFn:
 
 6148    case clang::BuiltinType::ArraySection:
 
 6155  case clang::Type::Complex:
 
 6157  case clang::Type::Pointer:
 
 6159  case clang::Type::BlockPointer:
 
 6162  case clang::Type::LValueReference:
 
 6164  case clang::Type::RValueReference:
 
 6166  case clang::Type::MemberPointer:
 
 6168  case clang::Type::ConstantArray:
 
 6170  case clang::Type::IncompleteArray:
 
 6172  case clang::Type::VariableArray:
 
 6174  case clang::Type::DependentSizedArray:
 
 6176  case clang::Type::DependentSizedExtVector:
 
 6178  case clang::Type::Vector:
 
 6180  case clang::Type::ExtVector:
 
 6182  case clang::Type::FunctionProto:
 
 6184  case clang::Type::FunctionNoProto:
 
 6186  case clang::Type::UnresolvedUsing:
 
 6188  case clang::Type::Record:
 
 6190  case clang::Type::Enum:
 
 6192  case clang::Type::TemplateTypeParm:
 
 6194  case clang::Type::SubstTemplateTypeParm:
 
 6196  case clang::Type::TemplateSpecialization:
 
 6198  case clang::Type::InjectedClassName:
 
 6200  case clang::Type::DependentName:
 
 6202  case clang::Type::ObjCObject:
 
 6204  case clang::Type::ObjCInterface:
 
 6206  case clang::Type::ObjCObjectPointer:
 
 
 6216    std::string &deref_name, uint32_t &deref_byte_size,
 
 6217    int32_t &deref_byte_offset, 
ValueObject *valobj, uint64_t &language_flags) {
 
 6221    return llvm::createStringError(
"not a pointer, reference or array type");
 
 6222  uint32_t child_bitfield_bit_size = 0;
 
 6223  uint32_t child_bitfield_bit_offset = 0;
 
 6224  bool child_is_base_class;
 
 6225  bool child_is_deref_of_parent;
 
 6227      type, exe_ctx, 0, 
false, 
true, 
false, deref_name, deref_byte_size,
 
 6228      deref_byte_offset, child_bitfield_bit_size, child_bitfield_bit_offset,
 
 6229      child_is_base_class, child_is_deref_of_parent, valobj, language_flags);
 
 
 6234    bool transparent_pointers, 
bool omit_empty_base_classes,
 
 6235    bool ignore_array_bounds, std::string &child_name,
 
 6236    uint32_t &child_byte_size, int32_t &child_byte_offset,
 
 6237    uint32_t &child_bitfield_bit_size, uint32_t &child_bitfield_bit_offset,
 
 6238    bool &child_is_base_class, 
bool &child_is_deref_of_parent,
 
 6243  auto get_exe_scope = [&exe_ctx]() {
 
 6247  clang::QualType parent_qual_type(
 
 6249  const clang::Type::TypeClass parent_type_class =
 
 6250      parent_qual_type->getTypeClass();
 
 6251  child_bitfield_bit_size = 0;
 
 6252  child_bitfield_bit_offset = 0;
 
 6253  child_is_base_class = 
false;
 
 6256  auto num_children_or_err =
 
 6258  if (!num_children_or_err)
 
 6259    return num_children_or_err.takeError();
 
 6261  const bool idx_is_valid = idx < *num_children_or_err;
 
 6263  switch (parent_type_class) {
 
 6264  case clang::Type::Builtin:
 
 6266      switch (llvm::cast<clang::BuiltinType>(parent_qual_type)->getKind()) {
 
 6267      case clang::BuiltinType::ObjCId:
 
 6268      case clang::BuiltinType::ObjCClass:
 
 6281  case clang::Type::Record:
 
 6283      const clang::RecordType *record_type =
 
 6284          llvm::cast<clang::RecordType>(parent_qual_type.getTypePtr());
 
 6285      const clang::RecordDecl *record_decl =
 
 6286          record_type->getDecl()->getDefinitionOrSelf();
 
 6287      const clang::ASTRecordLayout &record_layout =
 
 6289      uint32_t child_idx = 0;
 
 6291      const clang::CXXRecordDecl *cxx_record_decl =
 
 6292          llvm::dyn_cast<clang::CXXRecordDecl>(record_decl);
 
 6293      if (cxx_record_decl) {
 
 6295        clang::CXXRecordDecl::base_class_const_iterator base_class,
 
 6297        for (base_class = cxx_record_decl->bases_begin(),
 
 6298            base_class_end = cxx_record_decl->bases_end();
 
 6299             base_class != base_class_end; ++base_class) {
 
 6300          const clang::CXXRecordDecl *base_class_decl = 
nullptr;
 
 6303          if (omit_empty_base_classes) {
 
 6304            base_class_decl = llvm::cast<clang::CXXRecordDecl>(
 
 6305                                  base_class->getType()
 
 6306                                      ->getAs<clang::RecordType>()
 
 6308                                  ->getDefinitionOrSelf();
 
 6313          if (idx == child_idx) {
 
 6314            if (base_class_decl == 
nullptr)
 
 6315              base_class_decl = llvm::cast<clang::CXXRecordDecl>(
 
 6316                                    base_class->getType()
 
 6317                                        ->getAs<clang::RecordType>()
 
 6319                                    ->getDefinitionOrSelf();
 
 6321            if (base_class->isVirtual()) {
 
 6322              bool handled = 
false;
 
 6324                clang::VTableContextBase *vtable_ctx =
 
 6328                                              record_layout, cxx_record_decl,
 
 6329                                              base_class_decl, bit_offset);
 
 6332                bit_offset = record_layout.getVBaseClassOffset(base_class_decl)
 
 6336              bit_offset = record_layout.getBaseClassOffset(base_class_decl)
 
 6341            child_byte_offset = bit_offset / 8;
 
 6345                base_class_clang_type.
GetBitSize(get_exe_scope());
 
 6347              return llvm::joinErrors(
 
 6348                  llvm::createStringError(
"no size info for base class"),
 
 6349                  size_or_err.takeError());
 
 6351            uint64_t base_class_clang_type_bit_size = *size_or_err;
 
 6354            assert(base_class_clang_type_bit_size % 8 == 0);
 
 6355            child_byte_size = base_class_clang_type_bit_size / 8;
 
 6356            child_is_base_class = 
true;
 
 6357            return base_class_clang_type;
 
 6365      uint32_t field_idx = 0;
 
 6366      clang::RecordDecl::field_iterator field, field_end;
 
 6367      for (field = record_decl->field_begin(),
 
 6368          field_end = record_decl->field_end();
 
 6369           field != field_end; ++field, ++field_idx, ++child_idx) {
 
 6370        if (idx == child_idx) {
 
 6373          child_name.assign(field->getNameAsString());
 
 6378          assert(field_idx < record_layout.getFieldCount());
 
 6379          auto size_or_err = field_clang_type.
GetByteSize(get_exe_scope());
 
 6381            return llvm::joinErrors(
 
 6382                llvm::createStringError(
"no size info for field"),
 
 6383                size_or_err.takeError());
 
 6385          child_byte_size = *size_or_err;
 
 6386          const uint32_t child_bit_size = child_byte_size * 8;
 
 6390          bit_offset = record_layout.getFieldOffset(field_idx);
 
 6392            child_bitfield_bit_offset = bit_offset % child_bit_size;
 
 6393            const uint32_t child_bit_offset =
 
 6394                bit_offset - child_bitfield_bit_offset;
 
 6395            child_byte_offset = child_bit_offset / 8;
 
 6397            child_byte_offset = bit_offset / 8;
 
 6400          return field_clang_type;
 
 6406  case clang::Type::ObjCObject:
 
 6407  case clang::Type::ObjCInterface:
 
 6409      const clang::ObjCObjectType *objc_class_type =
 
 6410          llvm::dyn_cast<clang::ObjCObjectType>(parent_qual_type.getTypePtr());
 
 6411      assert(objc_class_type);
 
 6412      if (objc_class_type) {
 
 6413        uint32_t child_idx = 0;
 
 6414        clang::ObjCInterfaceDecl *class_interface_decl =
 
 6415            objc_class_type->getInterface();
 
 6417        if (class_interface_decl) {
 
 6419          const clang::ASTRecordLayout &interface_layout =
 
 6420              getASTContext().getASTObjCInterfaceLayout(class_interface_decl);
 
 6421          clang::ObjCInterfaceDecl *superclass_interface_decl =
 
 6422              class_interface_decl->getSuperClass();
 
 6423          if (superclass_interface_decl) {
 
 6424            if (omit_empty_base_classes) {
 
 6427                      superclass_interface_decl));
 
 6428              if (llvm::expectedToStdOptional(
 
 6430                          omit_empty_base_classes, exe_ctx))
 
 6433                  clang::QualType ivar_qual_type(
 
 6435                          superclass_interface_decl));
 
 6438                      superclass_interface_decl->getNameAsString());
 
 6440                  clang::TypeInfo ivar_type_info =
 
 6443                  child_byte_size = ivar_type_info.Width / 8;
 
 6444                  child_byte_offset = 0;
 
 6445                  child_is_base_class = 
true;
 
 6447                  return GetType(ivar_qual_type);
 
 6456          const uint32_t superclass_idx = child_idx;
 
 6458          if (idx < (child_idx + class_interface_decl->ivar_size())) {
 
 6459            clang::ObjCInterfaceDecl::ivar_iterator ivar_pos,
 
 6460                ivar_end = class_interface_decl->ivar_end();
 
 6462            for (ivar_pos = class_interface_decl->ivar_begin();
 
 6463                 ivar_pos != ivar_end; ++ivar_pos) {
 
 6464              if (child_idx == idx) {
 
 6465                clang::ObjCIvarDecl *ivar_decl = *ivar_pos;
 
 6467                clang::QualType ivar_qual_type(ivar_decl->getType());
 
 6469                child_name.assign(ivar_decl->getNameAsString());
 
 6471                clang::TypeInfo ivar_type_info =
 
 6474                child_byte_size = ivar_type_info.Width / 8;
 
 6490                  if (objc_runtime != 
nullptr) {
 
 6493                        parent_ast_type, ivar_decl->getNameAsString().c_str());
 
 6501                if (child_byte_offset ==
 
 6503                  bit_offset = interface_layout.getFieldOffset(child_idx -
 
 6505                  child_byte_offset = bit_offset / 8;
 
 6516                    bit_offset = interface_layout.getFieldOffset(
 
 6517                        child_idx - superclass_idx);
 
 6519                  child_bitfield_bit_offset = bit_offset % 8;
 
 6521                return GetType(ivar_qual_type);
 
 6531  case clang::Type::ObjCObjectPointer:
 
 6536        child_is_deref_of_parent = 
false;
 
 6537        bool tmp_child_is_deref_of_parent = 
false;
 
 6539            exe_ctx, idx, transparent_pointers, omit_empty_base_classes,
 
 6540            ignore_array_bounds, child_name, child_byte_size, child_byte_offset,
 
 6541            child_bitfield_bit_size, child_bitfield_bit_offset,
 
 6542            child_is_base_class, tmp_child_is_deref_of_parent, valobj,
 
 6545        child_is_deref_of_parent = 
true;
 
 6546        const char *parent_name =
 
 6549          child_name.assign(1, 
'*');
 
 6550          child_name += parent_name;
 
 6555          auto size_or_err = pointee_clang_type.
GetByteSize(get_exe_scope());
 
 6557            return size_or_err.takeError();
 
 6558          child_byte_size = *size_or_err;
 
 6559          child_byte_offset = 0;
 
 6560          return pointee_clang_type;
 
 6566  case clang::Type::Vector:
 
 6567  case clang::Type::ExtVector:
 
 6569      const clang::VectorType *array =
 
 6570          llvm::cast<clang::VectorType>(parent_qual_type.getTypePtr());
 
 6574          char element_name[64];
 
 6575          ::snprintf(element_name, 
sizeof(element_name), 
"[%" PRIu64 
"]",
 
 6576                     static_cast<uint64_t
>(idx));
 
 6577          child_name.assign(element_name);
 
 6578          auto size_or_err = element_type.
GetByteSize(get_exe_scope());
 
 6580            return size_or_err.takeError();
 
 6581          child_byte_size = *size_or_err;
 
 6582          child_byte_offset = (int32_t)idx * (int32_t)child_byte_size;
 
 6583          return element_type;
 
 6589  case clang::Type::ConstantArray:
 
 6590  case clang::Type::IncompleteArray:
 
 6591    if (ignore_array_bounds || idx_is_valid) {
 
 6592      const clang::ArrayType *array = 
GetQualType(type)->getAsArrayTypeUnsafe();
 
 6596          child_name = std::string(llvm::formatv(
"[{0}]", idx));
 
 6597          auto size_or_err = element_type.
GetByteSize(get_exe_scope());
 
 6599            return size_or_err.takeError();
 
 6600          child_byte_size = *size_or_err;
 
 6601          child_byte_offset = (int32_t)idx * (int32_t)child_byte_size;
 
 6602          return element_type;
 
 6608  case clang::Type::Pointer: {
 
 6616      child_is_deref_of_parent = 
false;
 
 6617      bool tmp_child_is_deref_of_parent = 
false;
 
 6619          exe_ctx, idx, transparent_pointers, omit_empty_base_classes,
 
 6620          ignore_array_bounds, child_name, child_byte_size, child_byte_offset,
 
 6621          child_bitfield_bit_size, child_bitfield_bit_offset,
 
 6622          child_is_base_class, tmp_child_is_deref_of_parent, valobj,
 
 6625      child_is_deref_of_parent = 
true;
 
 6627      const char *parent_name =
 
 6630        child_name.assign(1, 
'*');
 
 6631        child_name += parent_name;
 
 6636        auto size_or_err = pointee_clang_type.
GetByteSize(get_exe_scope());
 
 6638          return size_or_err.takeError();
 
 6639        child_byte_size = *size_or_err;
 
 6640        child_byte_offset = 0;
 
 6641        return pointee_clang_type;
 
 6647  case clang::Type::LValueReference:
 
 6648  case clang::Type::RValueReference:
 
 6650      const clang::ReferenceType *reference_type =
 
 6651          llvm::cast<clang::ReferenceType>(
 
 6654          GetType(reference_type->getPointeeType());
 
 6656        child_is_deref_of_parent = 
false;
 
 6657        bool tmp_child_is_deref_of_parent = 
false;
 
 6659            exe_ctx, idx, transparent_pointers, omit_empty_base_classes,
 
 6660            ignore_array_bounds, child_name, child_byte_size, child_byte_offset,
 
 6661            child_bitfield_bit_size, child_bitfield_bit_offset,
 
 6662            child_is_base_class, tmp_child_is_deref_of_parent, valobj,
 
 6665        const char *parent_name =
 
 6668          child_name.assign(1, 
'&');
 
 6669          child_name += parent_name;
 
 6674          auto size_or_err = pointee_clang_type.
GetByteSize(get_exe_scope());
 
 6676            return size_or_err.takeError();
 
 6677          child_byte_size = *size_or_err;
 
 6678          child_byte_offset = 0;
 
 6679          return pointee_clang_type;
 
 
 6692    const clang::RecordDecl *record_decl,
 
 6693    const clang::CXXBaseSpecifier *base_spec,
 
 6694    bool omit_empty_base_classes) {
 
 6695  uint32_t child_idx = 0;
 
 6697  const clang::CXXRecordDecl *cxx_record_decl =
 
 6698      llvm::dyn_cast<clang::CXXRecordDecl>(record_decl);
 
 6700  if (cxx_record_decl) {
 
 6701    clang::CXXRecordDecl::base_class_const_iterator base_class, base_class_end;
 
 6702    for (base_class = cxx_record_decl->bases_begin(),
 
 6703        base_class_end = cxx_record_decl->bases_end();
 
 6704         base_class != base_class_end; ++base_class) {
 
 6705      if (omit_empty_base_classes) {
 
 6710      if (base_class == base_spec)
 
 
 6720    const clang::RecordDecl *record_decl, clang::NamedDecl *canonical_decl,
 
 6721    bool omit_empty_base_classes) {
 
 6723      llvm::dyn_cast<clang::CXXRecordDecl>(record_decl),
 
 6724      omit_empty_base_classes);
 
 6726  clang::RecordDecl::field_iterator field, field_end;
 
 6727  for (field = record_decl->field_begin(), field_end = record_decl->field_end();
 
 6728       field != field_end; ++field, ++child_idx) {
 
 6729    if (field->getCanonicalDecl() == canonical_decl)
 
 
 6771    bool omit_empty_base_classes, std::vector<uint32_t> &child_indexes) {
 
 6772  if (type && !name.empty()) {
 
 6774    const clang::Type::TypeClass type_class = qual_type->getTypeClass();
 
 6775    switch (type_class) {
 
 6776    case clang::Type::Record:
 
 6778        const clang::RecordType *record_type =
 
 6779            llvm::cast<clang::RecordType>(qual_type.getTypePtr());
 
 6780        const clang::RecordDecl *record_decl =
 
 6781            record_type->getDecl()->getDefinitionOrSelf();
 
 6783        assert(record_decl);
 
 6784        uint32_t child_idx = 0;
 
 6786        const clang::CXXRecordDecl *cxx_record_decl =
 
 6787            llvm::dyn_cast<clang::CXXRecordDecl>(record_decl);
 
 6790        clang::RecordDecl::field_iterator field, field_end;
 
 6791        for (field = record_decl->field_begin(),
 
 6792            field_end = record_decl->field_end();
 
 6793             field != field_end; ++field, ++child_idx) {
 
 6794          llvm::StringRef field_name = field->getName();
 
 6795          if (field_name.empty()) {
 
 6797            std::vector<uint32_t> save_indices = child_indexes;
 
 6798            child_indexes.push_back(
 
 6800                                cxx_record_decl, omit_empty_base_classes));
 
 6802                    name, omit_empty_base_classes, child_indexes))
 
 6803              return child_indexes.size();
 
 6804            child_indexes = std::move(save_indices);
 
 6805          } 
else if (field_name == name) {
 
 6807            child_indexes.push_back(
 
 6809                                cxx_record_decl, omit_empty_base_classes));
 
 6810            return child_indexes.size();
 
 6814        if (cxx_record_decl) {
 
 6815          const clang::RecordDecl *parent_record_decl = cxx_record_decl;
 
 6818          clang::IdentifierInfo &ident_ref = 
getASTContext().Idents.get(name);
 
 6819          clang::DeclarationName decl_name(&ident_ref);
 
 6821          clang::CXXBasePaths paths;
 
 6822          if (cxx_record_decl->lookupInBases(
 
 6823                  [decl_name](
const clang::CXXBaseSpecifier *specifier,
 
 6824                              clang::CXXBasePath &path) {
 
 6825                    CXXRecordDecl *record =
 
 6826                      specifier->getType()->getAsCXXRecordDecl();
 
 6827                    auto r = record->lookup(decl_name);
 
 6828                    path.Decls = r.begin();
 
 6832            clang::CXXBasePaths::const_paths_iterator path,
 
 6833                path_end = paths.end();
 
 6834            for (path = paths.begin(); path != path_end; ++path) {
 
 6835              const size_t num_path_elements = path->size();
 
 6836              for (
size_t e = 0; e < num_path_elements; ++e) {
 
 6837                clang::CXXBasePathElement elem = (*path)[e];
 
 6840                                                  omit_empty_base_classes);
 
 6842                  child_indexes.clear();
 
 6845                  child_indexes.push_back(child_idx);
 
 6846                  parent_record_decl = elem.Base->getType()
 
 6847                                           ->castAs<clang::RecordType>()
 
 6849                                           ->getDefinitionOrSelf();
 
 6852              for (clang::DeclContext::lookup_iterator I = path->Decls, E;
 
 6855                    parent_record_decl, *I, omit_empty_base_classes);
 
 6857                  child_indexes.clear();
 
 6860                  child_indexes.push_back(child_idx);
 
 6864            return child_indexes.size();
 
 6870    case clang::Type::ObjCObject:
 
 6871    case clang::Type::ObjCInterface:
 
 6873        llvm::StringRef name_sref(name);
 
 6874        const clang::ObjCObjectType *objc_class_type =
 
 6875            llvm::dyn_cast<clang::ObjCObjectType>(qual_type.getTypePtr());
 
 6876        assert(objc_class_type);
 
 6877        if (objc_class_type) {
 
 6878          uint32_t child_idx = 0;
 
 6879          clang::ObjCInterfaceDecl *class_interface_decl =
 
 6880              objc_class_type->getInterface();
 
 6882          if (class_interface_decl) {
 
 6883            clang::ObjCInterfaceDecl::ivar_iterator ivar_pos,
 
 6884                ivar_end = class_interface_decl->ivar_end();
 
 6885            clang::ObjCInterfaceDecl *superclass_interface_decl =
 
 6886                class_interface_decl->getSuperClass();
 
 6888            for (ivar_pos = class_interface_decl->ivar_begin();
 
 6889                 ivar_pos != ivar_end; ++ivar_pos, ++child_idx) {
 
 6890              const clang::ObjCIvarDecl *ivar_decl = *ivar_pos;
 
 6892              if (ivar_decl->getName() == name_sref) {
 
 6893                if ((!omit_empty_base_classes && superclass_interface_decl) ||
 
 6894                    (omit_empty_base_classes &&
 
 6898                child_indexes.push_back(child_idx);
 
 6899                return child_indexes.size();
 
 6903            if (superclass_interface_decl) {
 
 6907              child_indexes.push_back(0);
 
 6911                      superclass_interface_decl));
 
 6913                      name, omit_empty_base_classes, child_indexes)) {
 
 6916                return child_indexes.size();
 
 6921              child_indexes.pop_back();
 
 6928    case clang::Type::ObjCObjectPointer: {
 
 6930          llvm::cast<clang::ObjCObjectPointerType>(qual_type.getTypePtr())
 
 6931              ->getPointeeType());
 
 6933          name, omit_empty_base_classes, child_indexes);
 
 6936    case clang::Type::LValueReference:
 
 6937    case clang::Type::RValueReference: {
 
 6938      const clang::ReferenceType *reference_type =
 
 6939          llvm::cast<clang::ReferenceType>(qual_type.getTypePtr());
 
 6940      clang::QualType pointee_type(reference_type->getPointeeType());
 
 6945            name, omit_empty_base_classes, child_indexes);
 
 6949    case clang::Type::Pointer: {
 
 6954            name, omit_empty_base_classes, child_indexes);
 
 
 6969llvm::Expected<uint32_t>
 
 6971                                         llvm::StringRef name,
 
 6972                                         bool omit_empty_base_classes) {
 
 6973  if (type && !name.empty()) {
 
 6976    const clang::Type::TypeClass type_class = qual_type->getTypeClass();
 
 6978    switch (type_class) {
 
 6979    case clang::Type::Record:
 
 6981        const clang::RecordType *record_type =
 
 6982            llvm::cast<clang::RecordType>(qual_type.getTypePtr());
 
 6983        const clang::RecordDecl *record_decl =
 
 6984            record_type->getDecl()->getDefinitionOrSelf();
 
 6986        assert(record_decl);
 
 6987        uint32_t child_idx = 0;
 
 6989        const clang::CXXRecordDecl *cxx_record_decl =
 
 6990            llvm::dyn_cast<clang::CXXRecordDecl>(record_decl);
 
 6992        if (cxx_record_decl) {
 
 6993          clang::CXXRecordDecl::base_class_const_iterator base_class,
 
 6995          for (base_class = cxx_record_decl->bases_begin(),
 
 6996              base_class_end = cxx_record_decl->bases_end();
 
 6997               base_class != base_class_end; ++base_class) {
 
 6999            clang::CXXRecordDecl *base_class_decl =
 
 7000                llvm::cast<clang::CXXRecordDecl>(
 
 7001                    base_class->getType()
 
 7002                        ->castAs<clang::RecordType>()
 
 7004                    ->getDefinitionOrSelf();
 
 7005            if (omit_empty_base_classes &&
 
 7010            std::string base_class_type_name(
 
 7012            if (base_class_type_name == name)
 
 7019        clang::RecordDecl::field_iterator field, field_end;
 
 7020        for (field = record_decl->field_begin(),
 
 7021            field_end = record_decl->field_end();
 
 7022             field != field_end; ++field, ++child_idx) {
 
 7023          if (field->getName() == name)
 
 7029    case clang::Type::ObjCObject:
 
 7030    case clang::Type::ObjCInterface:
 
 7032        const clang::ObjCObjectType *objc_class_type =
 
 7033            llvm::dyn_cast<clang::ObjCObjectType>(qual_type.getTypePtr());
 
 7034        assert(objc_class_type);
 
 7035        if (objc_class_type) {
 
 7036          uint32_t child_idx = 0;
 
 7037          clang::ObjCInterfaceDecl *class_interface_decl =
 
 7038              objc_class_type->getInterface();
 
 7040          if (class_interface_decl) {
 
 7041            clang::ObjCInterfaceDecl::ivar_iterator ivar_pos,
 
 7042                ivar_end = class_interface_decl->ivar_end();
 
 7043            clang::ObjCInterfaceDecl *superclass_interface_decl =
 
 7044                class_interface_decl->getSuperClass();
 
 7046            for (ivar_pos = class_interface_decl->ivar_begin();
 
 7047                 ivar_pos != ivar_end; ++ivar_pos, ++child_idx) {
 
 7048              const clang::ObjCIvarDecl *ivar_decl = *ivar_pos;
 
 7050              if (ivar_decl->getName() == name) {
 
 7051                if ((!omit_empty_base_classes && superclass_interface_decl) ||
 
 7052                    (omit_empty_base_classes &&
 
 7060            if (superclass_interface_decl) {
 
 7061              if (superclass_interface_decl->getName() == name)
 
 7069    case clang::Type::ObjCObjectPointer: {
 
 7071          llvm::cast<clang::ObjCObjectPointerType>(qual_type.getTypePtr())
 
 7072              ->getPointeeType());
 
 7074          name, omit_empty_base_classes);
 
 7077    case clang::Type::LValueReference:
 
 7078    case clang::Type::RValueReference: {
 
 7079      const clang::ReferenceType *reference_type =
 
 7080          llvm::cast<clang::ReferenceType>(qual_type.getTypePtr());
 
 7085                                                    omit_empty_base_classes);
 
 7089    case clang::Type::Pointer: {
 
 7090      const clang::PointerType *pointer_type =
 
 7091          llvm::cast<clang::PointerType>(qual_type.getTypePtr());
 
 7096                                                    omit_empty_base_classes);
 
 7104  return llvm::createStringError(
"Type has no child named '%s'",
 
 7105                                 name.str().c_str());
 
 
 7110                                             llvm::StringRef name) {
 
 7111  if (!type || name.empty())
 
 7115  const clang::Type::TypeClass type_class = qual_type->getTypeClass();
 
 7117  switch (type_class) {
 
 7118  case clang::Type::Record: {
 
 7121    const clang::RecordType *record_type =
 
 7122        llvm::cast<clang::RecordType>(qual_type.getTypePtr());
 
 7123    const clang::RecordDecl *record_decl =
 
 7124        record_type->getDecl()->getDefinitionOrSelf();
 
 7126    clang::DeclarationName decl_name(&
getASTContext().Idents.get(name));
 
 7127    for (NamedDecl *decl : record_decl->lookup(decl_name)) {
 
 7128      if (
auto *tag_decl = dyn_cast<clang::TagDecl>(decl))
 
 7130      if (
auto *typedef_decl = dyn_cast<clang::TypedefNameDecl>(decl))
 
 7132            ElaboratedTypeKeyword::None, std::nullopt,
 
 
 7148  if (
auto *cxx_record_decl = dyn_cast<clang::TagType>(clang_type))
 
 7149    return isa<clang::ClassTemplateSpecializationDecl>(
 
 7150        cxx_record_decl->getDecl());
 
 
 7161  const clang::Type::TypeClass type_class = qual_type->getTypeClass();
 
 7162  switch (type_class) {
 
 7163  case clang::Type::Record:
 
 7165      const clang::CXXRecordDecl *cxx_record_decl =
 
 7166          qual_type->getAsCXXRecordDecl();
 
 7167      if (cxx_record_decl) {
 
 7168        const clang::ClassTemplateSpecializationDecl *template_decl =
 
 7169            llvm::dyn_cast<clang::ClassTemplateSpecializationDecl>(
 
 7171        if (template_decl) {
 
 7172          const auto &template_arg_list = template_decl->getTemplateArgs();
 
 7173          size_t num_args = template_arg_list.size();
 
 7174          assert(num_args && 
"template specialization without any args");
 
 7175          if (expand_pack && num_args) {
 
 7176            const auto &pack = template_arg_list[num_args - 1];
 
 7177            if (pack.getKind() == clang::TemplateArgument::Pack)
 
 7178              num_args += pack.pack_size() - 1;
 
 
 7193const clang::ClassTemplateSpecializationDecl *
 
 7200  const clang::Type::TypeClass type_class = qual_type->getTypeClass();
 
 7201  switch (type_class) {
 
 7202  case clang::Type::Record: {
 
 7205    const clang::CXXRecordDecl *cxx_record_decl =
 
 7206        qual_type->getAsCXXRecordDecl();
 
 7207    if (!cxx_record_decl)
 
 7209    return llvm::dyn_cast<clang::ClassTemplateSpecializationDecl>(
 
 
 7218const TemplateArgument *
 
 7220                       size_t idx, 
bool expand_pack) {
 
 7221  const auto &args = decl->getTemplateArgs();
 
 7222  const size_t args_size = args.size();
 
 7224  assert(args_size && 
"template specialization without any args");
 
 7228  const size_t last_idx = args_size - 1;
 
 7237  if (!expand_pack || args[last_idx].getKind() != clang::TemplateArgument::Pack)
 
 7238    return idx >= args.size() ? nullptr : &args[idx];
 
 7243  const auto &pack = args[last_idx];
 
 7244  const size_t pack_idx = idx - last_idx;
 
 7245  if (pack_idx >= pack.pack_size())
 
 7247  return &pack.pack_elements()[pack_idx];
 
 
 7252                                         size_t arg_idx, 
bool expand_pack) {
 
 7253  const clang::ClassTemplateSpecializationDecl *template_decl =
 
 7262  switch (arg->getKind()) {
 
 7263  case clang::TemplateArgument::Null:
 
 7266  case clang::TemplateArgument::NullPtr:
 
 7269  case clang::TemplateArgument::Type:
 
 7272  case clang::TemplateArgument::Declaration:
 
 7275  case clang::TemplateArgument::Integral:
 
 7278  case clang::TemplateArgument::Template:
 
 7281  case clang::TemplateArgument::TemplateExpansion:
 
 7284  case clang::TemplateArgument::Expression:
 
 7287  case clang::TemplateArgument::Pack:
 
 7290  case clang::TemplateArgument::StructuralValue:
 
 7293  llvm_unreachable(
"Unhandled clang::TemplateArgument::ArgKind");
 
 
 7298                                         size_t idx, 
bool expand_pack) {
 
 7299  const clang::ClassTemplateSpecializationDecl *template_decl =
 
 7305  if (!arg || arg->getKind() != clang::TemplateArgument::Type)
 
 7308  return GetType(arg->getAsType());
 
 
 7311std::optional<CompilerType::IntegralTemplateArgument>
 
 7313                                             size_t idx, 
bool expand_pack) {
 
 7314  const clang::ClassTemplateSpecializationDecl *template_decl =
 
 7317    return std::nullopt;
 
 7321    return std::nullopt;
 
 7323  switch (arg->getKind()) {
 
 7324  case clang::TemplateArgument::Integral:
 
 7325    return {{arg->getAsIntegral(), 
GetType(arg->getIntegralType())}};
 
 7326  case clang::TemplateArgument::StructuralValue: {
 
 7327    clang::APValue value = arg->getAsStructuralValue();
 
 7330    if (value.isFloat())
 
 7331      return {{value.getFloat(), type}};
 
 7334      return {{value.getInt(), type}};
 
 7336    return std::nullopt;
 
 7339    return std::nullopt;
 
 
 7350  const clang::EnumType *enutype =
 
 7353    return enutype->getDecl()->getDefinitionOrSelf();
 
 
 7358  const clang::RecordType *record_type =
 
 7361    return record_type->getDecl()->getDefinitionOrSelf();
 
 
 7369clang::TypedefNameDecl *
 
 7371  const clang::TypedefType *typedef_type =
 
 7374    return typedef_type->getDecl();
 
 
 7378clang::CXXRecordDecl *
 
 7383clang::ObjCInterfaceDecl *
 
 7385  const clang::ObjCObjectType *objc_class_type =
 
 7386      llvm::dyn_cast<clang::ObjCObjectType>(
 
 7388  if (objc_class_type)
 
 7389    return objc_class_type->getInterface();
 
 
 7396    uint32_t bitfield_bit_size) {
 
 7402  clang::ASTContext &clang_ast = ast->getASTContext();
 
 7403  clang::IdentifierInfo *ident = 
nullptr;
 
 7405    ident = &clang_ast.Idents.get(name);
 
 7407  clang::FieldDecl *field = 
nullptr;
 
 7409  clang::Expr *bit_width = 
nullptr;
 
 7410  if (bitfield_bit_size != 0) {
 
 7411    if (clang_ast.IntTy.isNull()) {
 
 7414          "{0} failed: builtin ASTContext types have not been initialized");
 
 7418    llvm::APInt bitfield_bit_size_apint(clang_ast.getTypeSize(clang_ast.IntTy),
 
 7420    bit_width = 
new (clang_ast)
 
 7421        clang::IntegerLiteral(clang_ast, bitfield_bit_size_apint,
 
 7422                              clang_ast.IntTy, clang::SourceLocation());
 
 7423    bit_width = clang::ConstantExpr::Create(
 
 7424        clang_ast, bit_width, APValue(llvm::APSInt(bitfield_bit_size_apint)));
 
 7427  clang::RecordDecl *record_decl = ast->GetAsRecordDecl(type);
 
 7429    field = clang::FieldDecl::CreateDeserialized(clang_ast, GlobalDeclID());
 
 7430    field->setDeclContext(record_decl);
 
 7431    field->setDeclName(ident);
 
 7434      field->setBitWidth(bit_width);
 
 7440      if (
const clang::TagType *TagT =
 
 7441              field->getType()->getAs<clang::TagType>()) {
 
 7442        if (clang::RecordDecl *Rec =
 
 7443                llvm::dyn_cast<clang::RecordDecl>(TagT->getDecl()))
 
 7444          if (!Rec->getDeclName()) {
 
 7445            Rec->setAnonymousStructOrUnion(
true);
 
 7446            field->setImplicit();
 
 7452      clang::AccessSpecifier access_specifier =
 
 7454      field->setAccess(access_specifier);
 
 7456      if (clang::CXXRecordDecl *cxx_record_decl =
 
 7457              llvm::dyn_cast<CXXRecordDecl>(record_decl)) {
 
 7458        AddAccessSpecifierDecl(cxx_record_decl, ast->getASTContext(),
 
 7459                               ast->GetCXXRecordDeclAccess(cxx_record_decl),
 
 7461        ast->SetCXXRecordDeclAccess(cxx_record_decl, access_specifier);
 
 7463      record_decl->addDecl(field);
 
 7468    clang::ObjCInterfaceDecl *class_interface_decl =
 
 7469        ast->GetAsObjCInterfaceDecl(type);
 
 7471    if (class_interface_decl) {
 
 7472      const bool is_synthesized = 
false;
 
 7477          clang::ObjCIvarDecl::CreateDeserialized(clang_ast, GlobalDeclID());
 
 7478      ivar->setDeclContext(class_interface_decl);
 
 7479      ivar->setDeclName(ident);
 
 7483        ivar->setBitWidth(bit_width);
 
 7484      ivar->setSynthesize(is_synthesized);
 
 7489        class_interface_decl->addDecl(field);
 
 
 7506  clang::RecordDecl *record_decl = ast->GetAsRecordDecl(type);
 
 7511  typedef llvm::SmallVector<clang::IndirectFieldDecl *, 1> IndirectFieldVector;
 
 7513  IndirectFieldVector indirect_fields;
 
 7514  clang::RecordDecl::field_iterator field_pos;
 
 7515  clang::RecordDecl::field_iterator field_end_pos = record_decl->field_end();
 
 7516  clang::RecordDecl::field_iterator last_field_pos = field_end_pos;
 
 7517  for (field_pos = record_decl->field_begin(); field_pos != field_end_pos;
 
 7518       last_field_pos = field_pos++) {
 
 7519    if (field_pos->isAnonymousStructOrUnion()) {
 
 7520      clang::QualType field_qual_type = field_pos->getType();
 
 7522      const clang::RecordType *field_record_type =
 
 7523          field_qual_type->getAs<clang::RecordType>();
 
 7525      if (!field_record_type)
 
 7528      clang::RecordDecl *field_record_decl =
 
 7529          field_record_type->getDecl()->getDefinition();
 
 7531      if (!field_record_decl)
 
 7534      for (clang::RecordDecl::decl_iterator
 
 7535               di = field_record_decl->decls_begin(),
 
 7536               de = field_record_decl->decls_end();
 
 7538        if (clang::FieldDecl *nested_field_decl =
 
 7539                llvm::dyn_cast<clang::FieldDecl>(*di)) {
 
 7540          clang::NamedDecl **chain =
 
 7541              new (ast->getASTContext()) clang::NamedDecl *[2];
 
 7542          chain[0] = *field_pos;
 
 7543          chain[1] = nested_field_decl;
 
 7544          clang::IndirectFieldDecl *indirect_field =
 
 7545              clang::IndirectFieldDecl::Create(
 
 7546                  ast->getASTContext(), record_decl, clang::SourceLocation(),
 
 7547                  nested_field_decl->getIdentifier(),
 
 7548                  nested_field_decl->getType(), {chain, 2});
 
 7551          indirect_field->setImplicit();
 
 7554              field_pos->getAccess(), nested_field_decl->getAccess()));
 
 7556          indirect_fields.push_back(indirect_field);
 
 7557        } 
else if (clang::IndirectFieldDecl *nested_indirect_field_decl =
 
 7558                       llvm::dyn_cast<clang::IndirectFieldDecl>(*di)) {
 
 7559          size_t nested_chain_size =
 
 7560              nested_indirect_field_decl->getChainingSize();
 
 7561          clang::NamedDecl **chain = 
new (ast->getASTContext())
 
 7562              clang::NamedDecl *[nested_chain_size + 1];
 
 7563          chain[0] = *field_pos;
 
 7565          int chain_index = 1;
 
 7566          for (clang::IndirectFieldDecl::chain_iterator
 
 7567                   nci = nested_indirect_field_decl->chain_begin(),
 
 7568                   nce = nested_indirect_field_decl->chain_end();
 
 7570            chain[chain_index] = *nci;
 
 7574          clang::IndirectFieldDecl *indirect_field =
 
 7575              clang::IndirectFieldDecl::Create(
 
 7576                  ast->getASTContext(), record_decl, clang::SourceLocation(),
 
 7577                  nested_indirect_field_decl->getIdentifier(),
 
 7578                  nested_indirect_field_decl->getType(),
 
 7579                  {chain, nested_chain_size + 1});
 
 7582          indirect_field->setImplicit();
 
 7585              field_pos->getAccess(), nested_indirect_field_decl->getAccess()));
 
 7587          indirect_fields.push_back(indirect_field);
 
 7595  if (last_field_pos != field_end_pos) {
 
 7596    if (last_field_pos->getType()->isIncompleteArrayType())
 
 7597      record_decl->hasFlexibleArrayMember();
 
 7600  for (IndirectFieldVector::iterator ifi = indirect_fields.begin(),
 
 7601                                     ife = indirect_fields.end();
 
 7603    record_decl->addDecl(*ifi);
 
 
 7616      record_decl->addAttr(
 
 7617          clang::PackedAttr::CreateImplicit(ast->getASTContext()));
 
 
 7632  clang::RecordDecl *record_decl = ast->GetAsRecordDecl(type);
 
 7636  clang::VarDecl *var_decl = 
nullptr;
 
 7637  clang::IdentifierInfo *ident = 
nullptr;
 
 7639    ident = &ast->getASTContext().Idents.get(name);
 
 7642      clang::VarDecl::CreateDeserialized(ast->getASTContext(), GlobalDeclID());
 
 7643  var_decl->setDeclContext(record_decl);
 
 7644  var_decl->setDeclName(ident);
 
 7646  var_decl->setStorageClass(clang::SC_Static);
 
 7651  var_decl->setAccess(
 
 7653  record_decl->addDecl(var_decl);
 
 7655  VerifyDecl(var_decl);
 
 
 7661    VarDecl *var, 
const llvm::APInt &init_value) {
 
 7662  assert(!var->hasInit() && 
"variable already initialized");
 
 7664  clang::ASTContext &ast = var->getASTContext();
 
 7665  QualType qt = var->getType();
 
 7666  assert(qt->isIntegralOrEnumerationType() &&
 
 7667         "only integer or enum types supported");
 
 7670  if (
const EnumType *enum_type = qt->getAs<EnumType>()) {
 
 7671    const EnumDecl *enum_decl = enum_type->getDecl()->getDefinitionOrSelf();
 
 7672    qt = enum_decl->getIntegerType();
 
 7676  if (qt->isSpecificBuiltinType(BuiltinType::Bool)) {
 
 7677    var->setInit(CXXBoolLiteralExpr::Create(
 
 7678        ast, !init_value.isZero(), qt.getUnqualifiedType(), SourceLocation()));
 
 7680    var->setInit(IntegerLiteral::Create(
 
 7681        ast, init_value, qt.getUnqualifiedType(), SourceLocation()));
 
 
 7686    clang::VarDecl *var, 
const llvm::APFloat &init_value) {
 
 7687  assert(!var->hasInit() && 
"variable already initialized");
 
 7689  clang::ASTContext &ast = var->getASTContext();
 
 7690  QualType qt = var->getType();
 
 7691  assert(qt->isFloatingType() && 
"only floating point types supported");
 
 7692  var->setInit(FloatingLiteral::Create(
 
 7693      ast, init_value, 
true, qt.getUnqualifiedType(), SourceLocation()));
 
 
 7696llvm::SmallVector<clang::ParmVarDecl *>
 
 7698    clang::FunctionDecl *func, 
const clang::FunctionProtoType &prototype,
 
 7699    const llvm::SmallVector<llvm::StringRef> ¶meter_names) {
 
 7701  assert(parameter_names.empty() ||
 
 7702         parameter_names.size() == prototype.getNumParams());
 
 7704  llvm::SmallVector<clang::ParmVarDecl *> params;
 
 7705  for (
unsigned param_index = 0; param_index < prototype.getNumParams();
 
 7707    llvm::StringRef name =
 
 7708        !parameter_names.empty() ? parameter_names[param_index] : 
"";
 
 7712                                   GetType(prototype.getParamType(param_index)),
 
 7713                                   clang::SC_None, 
false);
 
 7716    params.push_back(param);
 
 
 7724    llvm::StringRef asm_label, 
const CompilerType &method_clang_type,
 
 7726    bool is_explicit, 
bool is_attr_used, 
bool is_artificial) {
 
 7727  if (!type || !method_clang_type.
IsValid() || name.empty())
 
 7732  clang::CXXRecordDecl *cxx_record_decl =
 
 7733      record_qual_type->getAsCXXRecordDecl();
 
 7735  if (cxx_record_decl == 
nullptr)
 
 7740  clang::CXXMethodDecl *cxx_method_decl = 
nullptr;
 
 7742  clang::DeclarationName decl_name(&
getASTContext().Idents.get(name));
 
 7744  const clang::FunctionType *function_type =
 
 7745      llvm::dyn_cast<clang::FunctionType>(method_qual_type.getTypePtr());
 
 7747  if (function_type == 
nullptr)
 
 7750  const clang::FunctionProtoType *method_function_prototype(
 
 7751      llvm::dyn_cast<clang::FunctionProtoType>(function_type));
 
 7753  if (!method_function_prototype)
 
 7756  unsigned int num_params = method_function_prototype->getNumParams();
 
 7758  clang::CXXDestructorDecl *cxx_dtor_decl(
nullptr);
 
 7759  clang::CXXConstructorDecl *cxx_ctor_decl(
nullptr);
 
 7764  const clang::ExplicitSpecifier explicit_spec(
 
 7765      nullptr , is_explicit ? clang::ExplicitSpecKind::ResolvedTrue
 
 7766                                    : clang::ExplicitSpecKind::ResolvedFalse);
 
 7768  if (name.starts_with(
"~")) {
 
 7769    cxx_dtor_decl = clang::CXXDestructorDecl::CreateDeserialized(
 
 7771    cxx_dtor_decl->setDeclContext(cxx_record_decl);
 
 7772    cxx_dtor_decl->setDeclName(
 
 7775    cxx_dtor_decl->setType(method_qual_type);
 
 7776    cxx_dtor_decl->setImplicit(is_artificial);
 
 7777    cxx_dtor_decl->setInlineSpecified(is_inline);
 
 7778    cxx_dtor_decl->setConstexprKind(ConstexprSpecKind::Unspecified);
 
 7779    cxx_method_decl = cxx_dtor_decl;
 
 7780  } 
else if (decl_name == cxx_record_decl->getDeclName()) {
 
 7781    cxx_ctor_decl = clang::CXXConstructorDecl::CreateDeserialized(
 
 7783    cxx_ctor_decl->setDeclContext(cxx_record_decl);
 
 7784    cxx_ctor_decl->setDeclName(
 
 7787    cxx_ctor_decl->setType(method_qual_type);
 
 7788    cxx_ctor_decl->setImplicit(is_artificial);
 
 7789    cxx_ctor_decl->setInlineSpecified(is_inline);
 
 7790    cxx_ctor_decl->setConstexprKind(ConstexprSpecKind::Unspecified);
 
 7791    cxx_ctor_decl->setNumCtorInitializers(0);
 
 7792    cxx_ctor_decl->setExplicitSpecifier(explicit_spec);
 
 7793    cxx_method_decl = cxx_ctor_decl;
 
 7795    clang::StorageClass SC = is_static ? clang::SC_Static : clang::SC_None;
 
 7796    clang::OverloadedOperatorKind op_kind = clang::NUM_OVERLOADED_OPERATORS;
 
 7799      if (op_kind != clang::NUM_OVERLOADED_OPERATORS) {
 
 7804        const bool is_method = 
true;
 
 7806                is_method, op_kind, num_params))
 
 7808        cxx_method_decl = clang::CXXMethodDecl::CreateDeserialized(
 
 7810        cxx_method_decl->setDeclContext(cxx_record_decl);
 
 7811        cxx_method_decl->setDeclName(
 
 7812            getASTContext().DeclarationNames.getCXXOperatorName(op_kind));
 
 7813        cxx_method_decl->setType(method_qual_type);
 
 7814        cxx_method_decl->setStorageClass(SC);
 
 7815        cxx_method_decl->setInlineSpecified(is_inline);
 
 7816        cxx_method_decl->setConstexprKind(ConstexprSpecKind::Unspecified);
 
 7817      } 
else if (num_params == 0) {
 
 7819        auto *cxx_conversion_decl =
 
 7820            clang::CXXConversionDecl::CreateDeserialized(
getASTContext(),
 
 7822        cxx_conversion_decl->setDeclContext(cxx_record_decl);
 
 7823        cxx_conversion_decl->setDeclName(
 
 7824            getASTContext().DeclarationNames.getCXXConversionFunctionName(
 
 7826                    function_type->getReturnType())));
 
 7827        cxx_conversion_decl->setType(method_qual_type);
 
 7828        cxx_conversion_decl->setInlineSpecified(is_inline);
 
 7829        cxx_conversion_decl->setExplicitSpecifier(explicit_spec);
 
 7830        cxx_conversion_decl->setConstexprKind(ConstexprSpecKind::Unspecified);
 
 7831        cxx_method_decl = cxx_conversion_decl;
 
 7835    if (cxx_method_decl == 
nullptr) {
 
 7836      cxx_method_decl = clang::CXXMethodDecl::CreateDeserialized(
 
 7838      cxx_method_decl->setDeclContext(cxx_record_decl);
 
 7839      cxx_method_decl->setDeclName(decl_name);
 
 7840      cxx_method_decl->setType(method_qual_type);
 
 7841      cxx_method_decl->setInlineSpecified(is_inline);
 
 7842      cxx_method_decl->setStorageClass(SC);
 
 7843      cxx_method_decl->setConstexprKind(ConstexprSpecKind::Unspecified);
 
 7848  clang::AccessSpecifier access_specifier =
 
 7851  cxx_method_decl->setAccess(access_specifier);
 
 7852  cxx_method_decl->setVirtualAsWritten(is_virtual);
 
 7855    cxx_method_decl->addAttr(clang::UsedAttr::CreateImplicit(
getASTContext()));
 
 7857  if (!asm_label.empty())
 
 7858    cxx_method_decl->addAttr(
 
 7859        clang::AsmLabelAttr::CreateImplicit(
getASTContext(), asm_label));
 
 7864      cxx_method_decl, *method_function_prototype, {}));
 
 7871  cxx_record_decl->addDecl(cxx_method_decl);
 
 7880  if (is_artificial) {
 
 7881    if (cxx_ctor_decl && ((cxx_ctor_decl->isDefaultConstructor() &&
 
 7882                           cxx_record_decl->hasTrivialDefaultConstructor()) ||
 
 7883                          (cxx_ctor_decl->isCopyConstructor() &&
 
 7884                           cxx_record_decl->hasTrivialCopyConstructor()) ||
 
 7885                          (cxx_ctor_decl->isMoveConstructor() &&
 
 7886                           cxx_record_decl->hasTrivialMoveConstructor()))) {
 
 7887      cxx_ctor_decl->setDefaulted();
 
 7888      cxx_ctor_decl->setTrivial(
true);
 
 7889    } 
else if (cxx_dtor_decl) {
 
 7890      if (cxx_record_decl->hasTrivialDestructor()) {
 
 7891        cxx_dtor_decl->setDefaulted();
 
 7892        cxx_dtor_decl->setTrivial(
true);
 
 7894    } 
else if ((cxx_method_decl->isCopyAssignmentOperator() &&
 
 7895                cxx_record_decl->hasTrivialCopyAssignment()) ||
 
 7896               (cxx_method_decl->isMoveAssignmentOperator() &&
 
 7897                cxx_record_decl->hasTrivialMoveAssignment())) {
 
 7898      cxx_method_decl->setDefaulted();
 
 7899      cxx_method_decl->setTrivial(
true);
 
 7903  VerifyDecl(cxx_method_decl);
 
 7905  return cxx_method_decl;
 
 
 7911    for (
auto *method : record->methods())
 
 7912      addOverridesForMethod(method);
 
 
 7915#pragma mark C++ Base Classes 
 7917std::unique_ptr<clang::CXXBaseSpecifier>
 
 7920                                          bool base_of_class) {
 
 7924  return std::make_unique<clang::CXXBaseSpecifier>(
 
 7925      clang::SourceRange(), is_virtual, base_of_class,
 
 7928      clang::SourceLocation());
 
 
 7933    std::vector<std::unique_ptr<clang::CXXBaseSpecifier>> bases) {
 
 7937  if (!cxx_record_decl)
 
 7939  std::vector<clang::CXXBaseSpecifier *> raw_bases;
 
 7940  raw_bases.reserve(bases.size());
 
 7944  for (
auto &b : bases)
 
 7945    raw_bases.push_back(b.get());
 
 7946  cxx_record_decl->setBases(raw_bases.data(), raw_bases.size());
 
 
 7955  clang::ASTContext &clang_ast = ast->getASTContext();
 
 7957  if (type && superclass_clang_type.
IsValid() &&
 
 7959    clang::ObjCInterfaceDecl *class_interface_decl =
 
 7961    clang::ObjCInterfaceDecl *super_interface_decl =
 
 7963    if (class_interface_decl && super_interface_decl) {
 
 7964      class_interface_decl->setSuperClass(clang_ast.getTrivialTypeSourceInfo(
 
 7965          clang_ast.getObjCInterfaceType(super_interface_decl)));
 
 
 7974    const CompilerType &property_clang_type, clang::ObjCIvarDecl *ivar_decl,
 
 7975    const char *property_setter_name, 
const char *property_getter_name,
 
 7977  if (!type || !property_clang_type.
IsValid() || property_name == 
nullptr ||
 
 7978      property_name[0] == 
'\0')
 
 7983  clang::ASTContext &clang_ast = ast->getASTContext();
 
 7986  if (!class_interface_decl)
 
 7991  if (property_clang_type.
IsValid())
 
 7992    property_clang_type_to_access = property_clang_type;
 
 7994    property_clang_type_to_access = ast->GetType(ivar_decl->getType());
 
 7996  if (!class_interface_decl || !property_clang_type_to_access.
IsValid())
 
 7999  clang::TypeSourceInfo *prop_type_source;
 
 8001    prop_type_source = clang_ast.getTrivialTypeSourceInfo(ivar_decl->getType());
 
 8003    prop_type_source = clang_ast.getTrivialTypeSourceInfo(
 
 8006  clang::ObjCPropertyDecl *property_decl =
 
 8007      clang::ObjCPropertyDecl::CreateDeserialized(clang_ast, GlobalDeclID());
 
 8008  property_decl->setDeclContext(class_interface_decl);
 
 8009  property_decl->setDeclName(&clang_ast.Idents.get(property_name));
 
 8010  property_decl->setType(ivar_decl
 
 8011                             ? ivar_decl->getType()
 
 8019  ast->SetMetadata(property_decl, metadata);
 
 8021  class_interface_decl->addDecl(property_decl);
 
 8023  clang::Selector setter_sel, getter_sel;
 
 8025  if (property_setter_name) {
 
 8026    std::string property_setter_no_colon(property_setter_name,
 
 8027                                         strlen(property_setter_name) - 1);
 
 8028    const clang::IdentifierInfo *setter_ident =
 
 8029        &clang_ast.Idents.get(property_setter_no_colon);
 
 8030    setter_sel = clang_ast.Selectors.getSelector(1, &setter_ident);
 
 8031  } 
else if (!(property_attributes & DW_APPLE_PROPERTY_readonly)) {
 
 8032    std::string setter_sel_string(
"set");
 
 8033    setter_sel_string.push_back(::toupper(property_name[0]));
 
 8034    setter_sel_string.append(&property_name[1]);
 
 8035    const clang::IdentifierInfo *setter_ident =
 
 8036        &clang_ast.Idents.get(setter_sel_string);
 
 8037    setter_sel = clang_ast.Selectors.getSelector(1, &setter_ident);
 
 8039  property_decl->setSetterName(setter_sel);
 
 8040  property_decl->setPropertyAttributes(ObjCPropertyAttribute::kind_setter);
 
 8042  if (property_getter_name != 
nullptr) {
 
 8043    const clang::IdentifierInfo *getter_ident =
 
 8044        &clang_ast.Idents.get(property_getter_name);
 
 8045    getter_sel = clang_ast.Selectors.getSelector(0, &getter_ident);
 
 8047    const clang::IdentifierInfo *getter_ident =
 
 8048        &clang_ast.Idents.get(property_name);
 
 8049    getter_sel = clang_ast.Selectors.getSelector(0, &getter_ident);
 
 8051  property_decl->setGetterName(getter_sel);
 
 8052  property_decl->setPropertyAttributes(ObjCPropertyAttribute::kind_getter);
 
 8055    property_decl->setPropertyIvarDecl(ivar_decl);
 
 8057  if (property_attributes & DW_APPLE_PROPERTY_readonly)
 
 8058    property_decl->setPropertyAttributes(ObjCPropertyAttribute::kind_readonly);
 
 8059  if (property_attributes & DW_APPLE_PROPERTY_readwrite)
 
 8060    property_decl->setPropertyAttributes(ObjCPropertyAttribute::kind_readwrite);
 
 8061  if (property_attributes & DW_APPLE_PROPERTY_assign)
 
 8062    property_decl->setPropertyAttributes(ObjCPropertyAttribute::kind_assign);
 
 8063  if (property_attributes & DW_APPLE_PROPERTY_retain)
 
 8064    property_decl->setPropertyAttributes(ObjCPropertyAttribute::kind_retain);
 
 8065  if (property_attributes & DW_APPLE_PROPERTY_copy)
 
 8066    property_decl->setPropertyAttributes(ObjCPropertyAttribute::kind_copy);
 
 8067  if (property_attributes & DW_APPLE_PROPERTY_nonatomic)
 
 8068    property_decl->setPropertyAttributes(ObjCPropertyAttribute::kind_nonatomic);
 
 8069  if (property_attributes & ObjCPropertyAttribute::kind_nullability)
 
 8070    property_decl->setPropertyAttributes(
 
 8071        ObjCPropertyAttribute::kind_nullability);
 
 8072  if (property_attributes & ObjCPropertyAttribute::kind_null_resettable)
 
 8073    property_decl->setPropertyAttributes(
 
 8074        ObjCPropertyAttribute::kind_null_resettable);
 
 8075  if (property_attributes & ObjCPropertyAttribute::kind_class)
 
 8076    property_decl->setPropertyAttributes(ObjCPropertyAttribute::kind_class);
 
 8078  const bool isInstance =
 
 8079      (property_attributes & ObjCPropertyAttribute::kind_class) == 0;
 
 8081  clang::ObjCMethodDecl *getter = 
nullptr;
 
 8082  if (!getter_sel.isNull())
 
 8083    getter = isInstance ? class_interface_decl->lookupInstanceMethod(getter_sel)
 
 8084                        : class_interface_decl->lookupClassMethod(getter_sel);
 
 8085  if (!getter_sel.isNull() && !getter) {
 
 8086    const bool isVariadic = 
false;
 
 8087    const bool isPropertyAccessor = 
true;
 
 8088    const bool isSynthesizedAccessorStub = 
false;
 
 8089    const bool isImplicitlyDeclared = 
true;
 
 8090    const bool isDefined = 
false;
 
 8091    const clang::ObjCImplementationControl impControl =
 
 8092        clang::ObjCImplementationControl::None;
 
 8093    const bool HasRelatedResultType = 
false;
 
 8096        clang::ObjCMethodDecl::CreateDeserialized(clang_ast, GlobalDeclID());
 
 8097    getter->setDeclName(getter_sel);
 
 8099    getter->setDeclContext(class_interface_decl);
 
 8100    getter->setInstanceMethod(isInstance);
 
 8101    getter->setVariadic(isVariadic);
 
 8102    getter->setPropertyAccessor(isPropertyAccessor);
 
 8103    getter->setSynthesizedAccessorStub(isSynthesizedAccessorStub);
 
 8104    getter->setImplicit(isImplicitlyDeclared);
 
 8105    getter->setDefined(isDefined);
 
 8106    getter->setDeclImplementation(impControl);
 
 8107    getter->setRelatedResultType(HasRelatedResultType);
 
 8111      ast->SetMetadata(getter, metadata);
 
 8113      getter->setMethodParams(clang_ast, llvm::ArrayRef<clang::ParmVarDecl *>(),
 
 8114                              llvm::ArrayRef<clang::SourceLocation>());
 
 8115      class_interface_decl->addDecl(getter);
 
 8119    getter->setPropertyAccessor(
true);
 
 8120    property_decl->setGetterMethodDecl(getter);
 
 8123  clang::ObjCMethodDecl *setter = 
nullptr;
 
 8124    setter = isInstance ? class_interface_decl->lookupInstanceMethod(setter_sel)
 
 8125                        : class_interface_decl->lookupClassMethod(setter_sel);
 
 8126  if (!setter_sel.isNull() && !setter) {
 
 8127    clang::QualType result_type = clang_ast.VoidTy;
 
 8128    const bool isVariadic = 
false;
 
 8129    const bool isPropertyAccessor = 
true;
 
 8130    const bool isSynthesizedAccessorStub = 
false;
 
 8131    const bool isImplicitlyDeclared = 
true;
 
 8132    const bool isDefined = 
false;
 
 8133    const clang::ObjCImplementationControl impControl =
 
 8134        clang::ObjCImplementationControl::None;
 
 8135    const bool HasRelatedResultType = 
false;
 
 8138        clang::ObjCMethodDecl::CreateDeserialized(clang_ast, GlobalDeclID());
 
 8139    setter->setDeclName(setter_sel);
 
 8140    setter->setReturnType(result_type);
 
 8141    setter->setDeclContext(class_interface_decl);
 
 8142    setter->setInstanceMethod(isInstance);
 
 8143    setter->setVariadic(isVariadic);
 
 8144    setter->setPropertyAccessor(isPropertyAccessor);
 
 8145    setter->setSynthesizedAccessorStub(isSynthesizedAccessorStub);
 
 8146    setter->setImplicit(isImplicitlyDeclared);
 
 8147    setter->setDefined(isDefined);
 
 8148    setter->setDeclImplementation(impControl);
 
 8149    setter->setRelatedResultType(HasRelatedResultType);
 
 8153      ast->SetMetadata(setter, metadata);
 
 8155      llvm::SmallVector<clang::ParmVarDecl *, 1> params;
 
 8156      params.push_back(clang::ParmVarDecl::Create(
 
 8157          clang_ast, setter, clang::SourceLocation(), clang::SourceLocation(),
 
 8160          clang::SC_Auto, 
nullptr));
 
 8162      setter->setMethodParams(clang_ast,
 
 8163                              llvm::ArrayRef<clang::ParmVarDecl *>(params),
 
 8164                              llvm::ArrayRef<clang::SourceLocation>());
 
 8166      class_interface_decl->addDecl(setter);
 
 8170    setter->setPropertyAccessor(
true);
 
 8171    property_decl->setSetterMethodDecl(setter);
 
 
 8182    const CompilerType &method_clang_type, 
bool is_artificial, 
bool is_variadic,
 
 8183    bool is_objc_direct_call) {
 
 8184  if (!type || !method_clang_type.
IsValid())
 
 8189  if (class_interface_decl == 
nullptr)
 
 8192  if (lldb_ast == 
nullptr)
 
 8194  clang::ASTContext &ast = lldb_ast->getASTContext();
 
 8196  const char *selector_start = ::strchr(name, 
' ');
 
 8197  if (selector_start == 
nullptr)
 
 8201  llvm::SmallVector<const clang::IdentifierInfo *, 12> selector_idents;
 
 8206  unsigned num_selectors_with_args = 0;
 
 8207  for (start = selector_start; start && *start != 
'\0' && *start != 
']';
 
 8209    len = ::strcspn(start, 
":]");
 
 8210    bool has_arg = (start[len] == 
':');
 
 8212      ++num_selectors_with_args;
 
 8213    selector_idents.push_back(&ast.Idents.get(llvm::StringRef(start, len)));
 
 8218  if (selector_idents.size() == 0)
 
 8221  clang::Selector method_selector = ast.Selectors.getSelector(
 
 8222      num_selectors_with_args ? selector_idents.size() : 0,
 
 8223      selector_idents.data());
 
 8228  const clang::Type *method_type(method_qual_type.getTypePtr());
 
 8230  if (method_type == 
nullptr)
 
 8233  const clang::FunctionProtoType *method_function_prototype(
 
 8234      llvm::dyn_cast<clang::FunctionProtoType>(method_type));
 
 8236  if (!method_function_prototype)
 
 8239  const bool isInstance = (name[0] == 
'-');
 
 8240  const bool isVariadic = is_variadic;
 
 8241  const bool isPropertyAccessor = 
false;
 
 8242  const bool isSynthesizedAccessorStub = 
false;
 
 8244  const bool isImplicitlyDeclared = 
true;
 
 8245  const bool isDefined = 
false;
 
 8246  const clang::ObjCImplementationControl impControl =
 
 8247      clang::ObjCImplementationControl::None;
 
 8248  const bool HasRelatedResultType = 
false;
 
 8250  const unsigned num_args = method_function_prototype->getNumParams();
 
 8252  if (num_args != num_selectors_with_args)
 
 8256  auto *objc_method_decl =
 
 8257      clang::ObjCMethodDecl::CreateDeserialized(ast, GlobalDeclID());
 
 8258  objc_method_decl->setDeclName(method_selector);
 
 8259  objc_method_decl->setReturnType(method_function_prototype->getReturnType());
 
 8260  objc_method_decl->setDeclContext(
 
 8262  objc_method_decl->setInstanceMethod(isInstance);
 
 8263  objc_method_decl->setVariadic(isVariadic);
 
 8264  objc_method_decl->setPropertyAccessor(isPropertyAccessor);
 
 8265  objc_method_decl->setSynthesizedAccessorStub(isSynthesizedAccessorStub);
 
 8266  objc_method_decl->setImplicit(isImplicitlyDeclared);
 
 8267  objc_method_decl->setDefined(isDefined);
 
 8268  objc_method_decl->setDeclImplementation(impControl);
 
 8269  objc_method_decl->setRelatedResultType(HasRelatedResultType);
 
 8272  if (objc_method_decl == 
nullptr)
 
 8276    llvm::SmallVector<clang::ParmVarDecl *, 12> params;
 
 8278    for (
unsigned param_index = 0; param_index < num_args; ++param_index) {
 
 8279      params.push_back(clang::ParmVarDecl::Create(
 
 8280          ast, objc_method_decl, clang::SourceLocation(),
 
 8281          clang::SourceLocation(),
 
 8283          method_function_prototype->getParamType(param_index), 
nullptr,
 
 8284          clang::SC_Auto, 
nullptr));
 
 8287    objc_method_decl->setMethodParams(
 
 8288        ast, llvm::ArrayRef<clang::ParmVarDecl *>(params),
 
 8289        llvm::ArrayRef<clang::SourceLocation>());
 
 8292  if (is_objc_direct_call) {
 
 8295    objc_method_decl->addAttr(
 
 8296        clang::ObjCDirectAttr::CreateImplicit(ast, SourceLocation()));
 
 8301    objc_method_decl->createImplicitParams(ast, class_interface_decl);
 
 8304  class_interface_decl->addDecl(objc_method_decl);
 
 8306  VerifyDecl(objc_method_decl);
 
 8308  return objc_method_decl;
 
 
 8318  const clang::Type::TypeClass type_class = qual_type->getTypeClass();
 
 8319  switch (type_class) {
 
 8320  case clang::Type::Record: {
 
 8321    clang::CXXRecordDecl *cxx_record_decl = qual_type->getAsCXXRecordDecl();
 
 8322    if (cxx_record_decl) {
 
 8323      cxx_record_decl->setHasExternalLexicalStorage(has_extern);
 
 8324      cxx_record_decl->setHasExternalVisibleStorage(has_extern);
 
 8329  case clang::Type::Enum: {
 
 8330    clang::EnumDecl *enum_decl =
 
 8331        llvm::cast<clang::EnumType>(qual_type)->getDecl();
 
 8333      enum_decl->setHasExternalLexicalStorage(has_extern);
 
 8334      enum_decl->setHasExternalVisibleStorage(has_extern);
 
 8339  case clang::Type::ObjCObject:
 
 8340  case clang::Type::ObjCInterface: {
 
 8341    const clang::ObjCObjectType *objc_class_type =
 
 8342        llvm::dyn_cast<clang::ObjCObjectType>(qual_type.getTypePtr());
 
 8343    assert(objc_class_type);
 
 8344    if (objc_class_type) {
 
 8345      clang::ObjCInterfaceDecl *class_interface_decl =
 
 8346          objc_class_type->getInterface();
 
 8348      if (class_interface_decl) {
 
 8349        class_interface_decl->setHasExternalLexicalStorage(has_extern);
 
 8350        class_interface_decl->setHasExternalVisibleStorage(has_extern);
 
 
 8366  if (!qual_type.isNull()) {
 
 8367    const clang::TagType *tag_type = qual_type->getAs<clang::TagType>();
 
 8369      clang::TagDecl *tag_decl = tag_type->getDecl();
 
 8371        tag_decl->startDefinition();
 
 8376    const clang::ObjCObjectType *object_type =
 
 8377        qual_type->getAs<clang::ObjCObjectType>();
 
 8379      clang::ObjCInterfaceDecl *interface_decl = object_type->getInterface();
 
 8380      if (interface_decl) {
 
 8381        interface_decl->startDefinition();
 
 
 8392  if (qual_type.isNull())
 
 8396  if (lldb_ast == 
nullptr)
 
 8402  const clang::TagType *tag_type = qual_type->getAs<clang::TagType>();
 
 8404    clang::TagDecl *tag_decl = tag_type->getDecl()->getDefinitionOrSelf();
 
 8406    if (
auto *cxx_record_decl = llvm::dyn_cast<CXXRecordDecl>(tag_decl)) {
 
 8416      if (cxx_record_decl->hasUserDeclaredMoveConstructor() ||
 
 8417          cxx_record_decl->hasUserDeclaredMoveAssignment()) {
 
 8418        if (cxx_record_decl->needsImplicitCopyConstructor())
 
 8419          cxx_record_decl->setImplicitCopyConstructorIsDeleted();
 
 8420        if (cxx_record_decl->needsImplicitCopyAssignment())
 
 8421          cxx_record_decl->setImplicitCopyAssignmentIsDeleted();
 
 8424      if (!cxx_record_decl->isCompleteDefinition())
 
 8425        cxx_record_decl->completeDefinition();
 
 8426      cxx_record_decl->setHasLoadedFieldsFromExternalStorage(
true);
 
 8427      cxx_record_decl->setHasExternalLexicalStorage(
false);
 
 8428      cxx_record_decl->setHasExternalVisibleStorage(
false);
 
 8429      lldb_ast->SetCXXRecordDeclAccess(cxx_record_decl,
 
 8430                                       clang::AccessSpecifier::AS_none);
 
 8435  const clang::EnumType *enutype = qual_type->getAs<clang::EnumType>();
 
 8439  clang::EnumDecl *enum_decl = enutype->getDecl()->getDefinitionOrSelf();
 
 8441  if (enum_decl->isCompleteDefinition())
 
 8444  QualType integer_type(enum_decl->getIntegerType());
 
 8445  if (!integer_type.isNull()) {
 
 8446    clang::ASTContext &ast = lldb_ast->getASTContext();
 
 8448    unsigned NumNegativeBits = 0;
 
 8449    unsigned NumPositiveBits = 0;
 
 8450    ast.computeEnumBits(enum_decl->enumerators(), NumNegativeBits,
 
 8453    clang::QualType BestPromotionType;
 
 8454    clang::QualType BestType;
 
 8455    ast.computeBestEnumTypes(
false, NumNegativeBits,
 
 8456                             NumPositiveBits, BestType, BestPromotionType);
 
 8458    enum_decl->completeDefinition(enum_decl->getIntegerType(),
 
 8459                                  BestPromotionType, NumPositiveBits,
 
 
 8467    const llvm::APSInt &value) {
 
 8478  if (!enum_opaque_compiler_type)
 
 8481  clang::QualType enum_qual_type(
 
 8484  const clang::Type *clang_type = enum_qual_type.getTypePtr();
 
 8489  const clang::EnumType *enutype = llvm::dyn_cast<clang::EnumType>(clang_type);
 
 8494  clang::EnumConstantDecl *enumerator_decl =
 
 8495      clang::EnumConstantDecl::CreateDeserialized(
getASTContext(),
 
 8497  clang::EnumDecl *enum_decl = enutype->getDecl()->getDefinitionOrSelf();
 
 8498  enumerator_decl->setDeclContext(enum_decl);
 
 8499  if (name && name[0])
 
 8500    enumerator_decl->setDeclName(&
getASTContext().Idents.get(name));
 
 8501  enumerator_decl->setType(clang::QualType(enutype, 0));
 
 8505  if (!enumerator_decl)
 
 8508  enum_decl->addDecl(enumerator_decl);
 
 8510  VerifyDecl(enumerator_decl);
 
 8511  return enumerator_decl;
 
 
 8516    uint64_t enum_value, uint32_t enum_value_bit_size) {
 
 8518  llvm::APSInt value(enum_value_bit_size,
 
 
 8527  const clang::Type *clang_type = qt.getTypePtrOrNull();
 
 8528  const auto *enum_type = llvm::dyn_cast_or_null<clang::EnumType>(clang_type);
 
 8532  return GetType(enum_type->getDecl()->getDefinitionOrSelf()->getIntegerType());
 
 
 8538  if (type && pointee_type.
IsValid() &&
 
 8543    return ast->GetType(ast->getASTContext().getMemberPointerType(
 
 
 8552#define DEPTH_INCREMENT 2 
 8555LLVM_DUMP_METHOD 
void 
 8565struct ScopedASTColor {
 
 8566  ScopedASTColor(clang::ASTContext &ast, 
bool show_colors)
 
 8567      : ast(ast), old_show_colors(ast.getDiagnostics().getShowColors()) {
 
 8568    ast.getDiagnostics().setShowColors(show_colors);
 
 8571  ~ScopedASTColor() { ast.getDiagnostics().setShowColors(old_show_colors); }
 
 8573  clang::ASTContext *
 
 8574  const bool old_show_colors;
 
 8583      clang::CreateASTDumper(output, filter,
 
 8587                             false, clang::ADOF_Default);
 
 8590  consumer->HandleTranslationUnit(*
m_ast_up);
 
 
 8594                                         llvm::StringRef symbol_name) {
 
 8601  symfile->
GetTypes(
nullptr, eTypeClassAny, type_list);
 
 8602  size_t ntypes = type_list.
GetSize();
 
 8604  for (
size_t i = 0; i < ntypes; ++i) {
 
 8607    if (!symbol_name.empty())
 
 8608      if (symbol_name != type->GetName().GetStringRef())
 
 8611    s << type->GetName().AsCString() << 
"\n";
 
 8614    if (clang::TagDecl *tag_decl = 
GetAsTagDecl(full_type)) {
 
 8622    if (
auto *objc_obj = llvm::dyn_cast<clang::ObjCObjectType>(
 
 8624      if (clang::ObjCInterfaceDecl *interface_decl = objc_obj->getInterface()) {
 
 
 8636                          size_t byte_size, uint32_t bitfield_bit_offset,
 
 8637                          uint32_t bitfield_bit_size) {
 
 8638  const clang::EnumType *enutype =
 
 8639      llvm::cast<clang::EnumType>(qual_type.getTypePtr());
 
 8640  const clang::EnumDecl *enum_decl = enutype->getDecl()->getDefinitionOrSelf();
 
 8642  bool qual_type_is_signed = qual_type->isSignedIntegerOrEnumerationType();
 
 8643  const uint64_t enum_svalue =
 
 8646                                   bitfield_bit_offset)
 
 8648                                   bitfield_bit_offset);
 
 8649  bool can_be_bitfield = 
true;
 
 8650  uint64_t covered_bits = 0;
 
 8651  int num_enumerators = 0;
 
 8659  clang::EnumDecl::enumerator_range enumerators = enum_decl->enumerators();
 
 8660  if (enumerators.empty())
 
 8661    can_be_bitfield = 
false;
 
 8663    for (
auto *enumerator : enumerators) {
 
 8664      llvm::APSInt init_val = enumerator->getInitVal();
 
 8665      uint64_t val = qual_type_is_signed ? init_val.getSExtValue()
 
 8666                                         : init_val.getZExtValue();
 
 8667      if (qual_type_is_signed)
 
 8668        val = llvm::SignExtend64(val, 8 * byte_size);
 
 8669      if (llvm::popcount(val) != 1 && (val & ~covered_bits) != 0)
 
 8670        can_be_bitfield = 
false;
 
 8671      covered_bits |= val;
 
 8673      if (val == enum_svalue) {
 
 8682  offset = byte_offset;
 
 8684      &offset, byte_size, bitfield_bit_size, bitfield_bit_offset);
 
 8688  if (!can_be_bitfield) {
 
 8689    if (qual_type_is_signed)
 
 8690      s.
Printf(
"%" PRIi64, enum_svalue);
 
 8692      s.
Printf(
"%" PRIu64, enum_uvalue);
 
 8699    s.
Printf(
"0x%" PRIx64, enum_uvalue);
 
 8703  uint64_t remaining_value = enum_uvalue;
 
 8704  std::vector<std::pair<uint64_t, llvm::StringRef>> values;
 
 8705  values.reserve(num_enumerators);
 
 8706  for (
auto *enumerator : enum_decl->enumerators())
 
 8707    if (
auto val = enumerator->getInitVal().getZExtValue())
 
 8708      values.emplace_back(val, enumerator->getName());
 
 8713  llvm::stable_sort(values, [](
const auto &a, 
const auto &b) {
 
 8714    return llvm::popcount(a.first) > llvm::popcount(b.first);
 
 8717  for (
const auto &val : values) {
 
 8718    if ((remaining_value & val.first) != val.first)
 
 8720    remaining_value &= ~val.first;
 
 8722    if (remaining_value)
 
 8728  if (remaining_value)
 
 8729    s.
Printf(
"0x%" PRIx64, remaining_value);
 
 
 8737    size_t byte_size, uint32_t bitfield_bit_size, uint32_t bitfield_bit_offset,
 
 8746    switch (qual_type->getTypeClass()) {
 
 8747    case clang::Type::Typedef: {
 
 8748      clang::QualType typedef_qual_type =
 
 8749          llvm::cast<clang::TypedefType>(qual_type)
 
 8751              ->getUnderlyingType();
 
 8754        format = typedef_clang_type.
GetFormat();
 
 8755      clang::TypeInfo typedef_type_info =
 
 8757      uint64_t typedef_byte_size = typedef_type_info.Width / 8;
 
 8767          bitfield_bit_offset, 
 
 8772    case clang::Type::Enum:
 
 8777        return DumpEnumValue(qual_type, s, data, byte_offset, byte_size,
 
 8778                             bitfield_bit_offset, bitfield_bit_size);
 
 8786        uint32_t item_count = 1;
 
 8826          item_count = byte_size;
 
 8831          item_count = byte_size / 2;
 
 8836          item_count = byte_size / 4;
 
 8842                                 bitfield_bit_size, bitfield_bit_offset,
 
 
 8858  if (std::optional<ClangASTMetadata> metadata = 
GetMetadata(clang_type)) {
 
 
 8867    clang::QualType qual_type =
 
 8870    llvm::SmallVector<char, 1024> buf;
 
 8871    llvm::raw_svector_ostream llvm_ostrm(buf);
 
 8873    const clang::Type::TypeClass type_class = qual_type->getTypeClass();
 
 8874    switch (type_class) {
 
 8875    case clang::Type::ObjCObject:
 
 8876    case clang::Type::ObjCInterface: {
 
 8879      auto *objc_class_type =
 
 8880          llvm::dyn_cast<clang::ObjCObjectType>(qual_type.getTypePtr());
 
 8881      assert(objc_class_type);
 
 8882      if (!objc_class_type)
 
 8884      clang::ObjCInterfaceDecl *class_interface_decl =
 
 8885            objc_class_type->getInterface();
 
 8886      if (!class_interface_decl)
 
 8889        class_interface_decl->dump(llvm_ostrm);
 
 8891        class_interface_decl->print(llvm_ostrm,
 
 8896    case clang::Type::Typedef: {
 
 8897      auto *typedef_type = qual_type->getAs<clang::TypedefType>();
 
 8900      const clang::TypedefNameDecl *typedef_decl = typedef_type->getDecl();
 
 8902        typedef_decl->dump(llvm_ostrm);
 
 8905        if (!clang_typedef_name.empty()) {
 
 8912    case clang::Type::Record: {
 
 8915      auto *record_type = llvm::cast<clang::RecordType>(qual_type.getTypePtr());
 
 8916      const clang::RecordDecl *record_decl = record_type->getDecl();
 
 8918        record_decl->dump(llvm_ostrm);
 
 8920        record_decl->print(llvm_ostrm, 
getASTContext().getPrintingPolicy(),
 
 8926      if (
auto *tag_type =
 
 8927              llvm::dyn_cast<clang::TagType>(qual_type.getTypePtr())) {
 
 8928        if (clang::TagDecl *tag_decl = tag_type->getDecl()) {
 
 8930            tag_decl->dump(llvm_ostrm);
 
 8932            tag_decl->print(llvm_ostrm, 0);
 
 8938          std::string clang_type_name(qual_type.getAsString());
 
 8939          if (!clang_type_name.empty())
 
 8946    if (buf.size() > 0) {
 
 8947      s.
Write(buf.data(), buf.size());
 
 
 8954    clang::QualType qual_type(
 
 8957    const clang::Type::TypeClass type_class = qual_type->getTypeClass();
 
 8958    switch (type_class) {
 
 8959    case clang::Type::Record: {
 
 8960      const clang::CXXRecordDecl *cxx_record_decl =
 
 8961          qual_type->getAsCXXRecordDecl();
 
 8962      if (cxx_record_decl)
 
 8963        printf(
"class %s", cxx_record_decl->getName().str().c_str());
 
 8966    case clang::Type::Enum: {
 
 8967      clang::EnumDecl *enum_decl =
 
 8968          llvm::cast<clang::EnumType>(qual_type)->getDecl();
 
 8970        printf(
"enum %s", enum_decl->getName().str().c_str());
 
 8974    case clang::Type::ObjCObject:
 
 8975    case clang::Type::ObjCInterface: {
 
 8976      const clang::ObjCObjectType *objc_class_type =
 
 8977          llvm::dyn_cast<clang::ObjCObjectType>(qual_type);
 
 8978      if (objc_class_type) {
 
 8979        clang::ObjCInterfaceDecl *class_interface_decl =
 
 8980            objc_class_type->getInterface();
 
 8984        if (class_interface_decl)
 
 8985          printf(
"@class %s", class_interface_decl->getName().str().c_str());
 
 8989    case clang::Type::Typedef:
 
 8990      printf(
"typedef %s", llvm::cast<clang::TypedefType>(qual_type)
 
 8997    case clang::Type::Auto:
 
 9000                                       llvm::cast<clang::AutoType>(qual_type)
 
 9002                                           .getAsOpaquePtr()));
 
 9004    case clang::Type::Paren:
 
 9008          llvm::cast<clang::ParenType>(qual_type)->desugar().getAsOpaquePtr()));
 
 9011      printf(
"TypeSystemClang::DumpTypeName() type_class = %u", type_class);
 
 
 9021  if (template_param_infos.
IsValid()) {
 
 9022    std::string template_basename(parent_name);
 
 9024    if (
auto i = template_basename.find(
'<'); i != std::string::npos)
 
 9025      template_basename.erase(i);
 
 9028                                   template_basename.c_str(), tag_decl_kind,
 
 9029                                   template_param_infos);
 
 
 9044    clang::ObjCInterfaceDecl *decl) {
 
 
 9072    const clang::RecordDecl *record_decl, uint64_t &bit_size,
 
 9073    uint64_t &alignment,
 
 9074    llvm::DenseMap<const clang::FieldDecl *, uint64_t> &field_offsets,
 
 9075    llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits>
 
 9077    llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits>
 
 9090                                    field_offsets, base_offsets, vbase_offsets);
 
 
 9097    clang::NamedDecl *nd =
 
 9098        llvm::dyn_cast<NamedDecl>((clang::Decl *)opaque_decl);
 
 
 9108  if (!label_or_err) {
 
 9109    llvm::consumeError(label_or_err.takeError());
 
 9113  llvm::StringRef mangled = label_or_err->lookup_name;
 
 
 9121  clang::NamedDecl *nd = llvm::dyn_cast_or_null<clang::NamedDecl>(
 
 9122      static_cast<clang::Decl *
>(opaque_decl));
 
 9124  if (!nd || llvm::isa<clang::ObjCMethodDecl>(nd))
 
 9128  if (!mc || !mc->shouldMangleCXXName(nd))
 
 9133  if (
const auto *label = nd->getAttr<AsmLabelAttr>())
 
 9138  llvm::SmallVector<char, 1024> buf;
 
 9139  llvm::raw_svector_ostream llvm_ostrm(buf);
 
 9140  if (llvm::isa<clang::CXXConstructorDecl>(nd)) {
 
 9142        clang::GlobalDecl(llvm::dyn_cast<clang::CXXConstructorDecl>(nd),
 
 9145  } 
else if (llvm::isa<clang::CXXDestructorDecl>(nd)) {
 
 9147        clang::GlobalDecl(llvm::dyn_cast<clang::CXXDestructorDecl>(nd),
 
 9151    mc->mangleName(nd, llvm_ostrm);
 
 
 9167  if (clang::FunctionDecl *func_decl =
 
 9168          llvm::dyn_cast<clang::FunctionDecl>((clang::Decl *)opaque_decl))
 
 9169    return GetType(func_decl->getReturnType());
 
 9170  if (clang::ObjCMethodDecl *objc_method =
 
 9171          llvm::dyn_cast<clang::ObjCMethodDecl>((clang::Decl *)opaque_decl))
 
 9172    return GetType(objc_method->getReturnType());
 
 
 9178  if (clang::FunctionDecl *func_decl =
 
 9179          llvm::dyn_cast<clang::FunctionDecl>((clang::Decl *)opaque_decl))
 
 9180    return func_decl->param_size();
 
 9181  if (clang::ObjCMethodDecl *objc_method =
 
 9182          llvm::dyn_cast<clang::ObjCMethodDecl>((clang::Decl *)opaque_decl))
 
 9183    return objc_method->param_size();
 
 
 9189                                           clang::DeclContext 
const *decl_ctx) {
 
 9190  switch (clang_kind) {
 
 9191  case Decl::TranslationUnit:
 
 9193  case Decl::Namespace:
 
 9204      if (decl_ctx->isFunctionOrMethod())
 
 9206      if (decl_ctx->isRecord())
 
 
 9216                      std::vector<lldb_private::CompilerContext> &context) {
 
 9217  if (decl_ctx == 
nullptr)
 
 9220  clang::Decl::Kind clang_kind = decl_ctx->getDeclKind();
 
 9221  if (clang_kind == Decl::TranslationUnit)
 
 9226  context.push_back({compiler_kind, decl_ctx_name});
 
 
 9229std::vector<lldb_private::CompilerContext>
 
 9231  std::vector<lldb_private::CompilerContext> context;
 
 9234    clang::Decl *decl = (clang::Decl *)opaque_decl;
 
 9236    clang::DeclContext *decl_ctx = decl->getDeclContext();
 
 9239    auto compiler_kind =
 
 9241    context.push_back({compiler_kind, decl_name});
 
 
 9248  if (clang::FunctionDecl *func_decl =
 
 9249          llvm::dyn_cast<clang::FunctionDecl>((clang::Decl *)opaque_decl)) {
 
 9250    if (idx < func_decl->param_size()) {
 
 9251      ParmVarDecl *var_decl = func_decl->getParamDecl(idx);
 
 9253        return GetType(var_decl->getOriginalType());
 
 9255  } 
else if (clang::ObjCMethodDecl *objc_method =
 
 9256                 llvm::dyn_cast<clang::ObjCMethodDecl>(
 
 9257                     (clang::Decl *)opaque_decl)) {
 
 9258    if (idx < objc_method->param_size())
 
 9259      return GetType(objc_method->parameters()[idx]->getOriginalType());
 
 
 9265  clang::Decl *decl = 
static_cast<clang::Decl *
>(opaque_decl);
 
 9266  clang::VarDecl *var_decl = llvm::dyn_cast<clang::VarDecl>(decl);
 
 9269  clang::Expr *init_expr = var_decl->getInit();
 
 9272  std::optional<llvm::APSInt> value =
 
 
 9282    void *opaque_decl_ctx, 
ConstString name, 
const bool ignore_using_decls) {
 
 9283  std::vector<CompilerDecl> found_decls;
 
 9285  if (opaque_decl_ctx && symbol_file) {
 
 9286    DeclContext *root_decl_ctx = (DeclContext *)opaque_decl_ctx;
 
 9287    std::set<DeclContext *> searched;
 
 9288    std::multimap<DeclContext *, DeclContext *> search_queue;
 
 9290    for (clang::DeclContext *decl_context = root_decl_ctx;
 
 9291         decl_context != 
nullptr && found_decls.empty();
 
 9292         decl_context = decl_context->getParent()) {
 
 9293      search_queue.insert(std::make_pair(decl_context, decl_context));
 
 9295      for (
auto it = search_queue.find(decl_context); it != search_queue.end();
 
 9297        if (!searched.insert(it->second).second)
 
 9302        for (clang::Decl *child : it->second->decls()) {
 
 9303          if (clang::UsingDirectiveDecl *ud =
 
 9304                  llvm::dyn_cast<clang::UsingDirectiveDecl>(child)) {
 
 9305            if (ignore_using_decls)
 
 9307            clang::DeclContext *from = ud->getCommonAncestor();
 
 9308            if (searched.find(ud->getNominatedNamespace()) == searched.end())
 
 9309              search_queue.insert(
 
 9310                  std::make_pair(from, ud->getNominatedNamespace()));
 
 9311          } 
else if (clang::UsingDecl *ud =
 
 9312                         llvm::dyn_cast<clang::UsingDecl>(child)) {
 
 9313            if (ignore_using_decls)
 
 9315            for (clang::UsingShadowDecl *usd : ud->shadows()) {
 
 9316              clang::Decl *target = usd->getTargetDecl();
 
 9317              if (clang::NamedDecl *nd =
 
 9318                      llvm::dyn_cast<clang::NamedDecl>(target)) {
 
 9319                IdentifierInfo *ii = nd->getIdentifier();
 
 9320                if (ii != 
nullptr && ii->getName() == name.
AsCString(
nullptr))
 
 9324          } 
else if (clang::NamedDecl *nd =
 
 9325                         llvm::dyn_cast<clang::NamedDecl>(child)) {
 
 9326            IdentifierInfo *ii = nd->getIdentifier();
 
 9327            if (ii != 
nullptr && ii->getName() == name.
AsCString(
nullptr))
 
 
 9378                                          clang::DeclContext *child_decl_ctx,
 
 9382  if (frame_decl_ctx && symbol_file) {
 
 9383    std::set<DeclContext *> searched;
 
 9384    std::multimap<DeclContext *, DeclContext *> search_queue;
 
 9387    clang::DeclContext *parent_decl_ctx = child_decl_ctx->getParent();
 
 9391    for (clang::DeclContext *decl_ctx = frame_decl_ctx; decl_ctx != 
nullptr;
 
 9392         decl_ctx = decl_ctx->getParent()) {
 
 9393      if (!decl_ctx->isLookupContext())
 
 9395      if (decl_ctx == parent_decl_ctx)
 
 9398      search_queue.insert(std::make_pair(decl_ctx, decl_ctx));
 
 9399      for (
auto it = search_queue.find(decl_ctx); it != search_queue.end();
 
 9401        if (searched.find(it->second) != searched.end())
 
 9409        if (llvm::isa<clang::TranslationUnitDecl>(it->second))
 
 9412        searched.insert(it->second);
 
 9416        for (clang::Decl *child : it->second->decls()) {
 
 9417          if (clang::UsingDirectiveDecl *ud =
 
 9418                  llvm::dyn_cast<clang::UsingDirectiveDecl>(child)) {
 
 9419            clang::DeclContext *ns = ud->getNominatedNamespace();
 
 9420            if (ns == parent_decl_ctx)
 
 9423            clang::DeclContext *from = ud->getCommonAncestor();
 
 9424            if (searched.find(ns) == searched.end())
 
 9425              search_queue.insert(std::make_pair(from, ns));
 
 9426          } 
else if (child_name) {
 
 9427            if (clang::UsingDecl *ud =
 
 9428                    llvm::dyn_cast<clang::UsingDecl>(child)) {
 
 9429              for (clang::UsingShadowDecl *usd : ud->shadows()) {
 
 9430                clang::Decl *target = usd->getTargetDecl();
 
 9431                clang::NamedDecl *nd = llvm::dyn_cast<clang::NamedDecl>(target);
 
 9435                IdentifierInfo *ii = nd->getIdentifier();
 
 9436                if (ii == 
nullptr ||
 
 9437                    ii->getName() != child_name->
AsCString(
nullptr))
 
 
 9460  if (opaque_decl_ctx) {
 
 9461    clang::NamedDecl *named_decl =
 
 9462        llvm::dyn_cast<clang::NamedDecl>((clang::DeclContext *)opaque_decl_ctx);
 
 9465      llvm::raw_string_ostream stream{name};
 
 9467      policy.AlwaysIncludeTypeForTemplateArgument = 
true;
 
 9468      named_decl->getNameForDiagnostic(stream, policy, 
false);
 
 
 9477  if (opaque_decl_ctx) {
 
 9478    clang::NamedDecl *named_decl =
 
 9479        llvm::dyn_cast<clang::NamedDecl>((clang::DeclContext *)opaque_decl_ctx);
 
 
 9487  if (!opaque_decl_ctx)
 
 9490  clang::DeclContext *decl_ctx = (clang::DeclContext *)opaque_decl_ctx;
 
 9491  if (llvm::isa<clang::ObjCMethodDecl>(decl_ctx)) {
 
 9493  } 
else if (llvm::isa<clang::CXXMethodDecl>(decl_ctx)) {
 
 9495  } 
else if (clang::FunctionDecl *fun_decl =
 
 9496                 llvm::dyn_cast<clang::FunctionDecl>(decl_ctx)) {
 
 9497    if (std::optional<ClangASTMetadata> metadata = 
GetMetadata(fun_decl))
 
 9498      return metadata->HasObjectPtr();
 
 
 9504std::vector<lldb_private::CompilerContext>
 
 9506  auto *decl_ctx = (clang::DeclContext *)opaque_decl_ctx;
 
 9507  std::vector<lldb_private::CompilerContext> context;
 
 
 9513    void *opaque_decl_ctx, 
void *other_opaque_decl_ctx) {
 
 9514  auto *decl_ctx = (clang::DeclContext *)opaque_decl_ctx;
 
 9515  auto *other = (clang::DeclContext *)other_opaque_decl_ctx;
 
 9519  auto is_transparent_lookup_allowed = [](clang::DeclContext *DC) {
 
 9520    if (DC->isInlineNamespace())
 
 9523    if (
auto const *NS = dyn_cast<NamespaceDecl>(DC))
 
 9524      return NS->isAnonymousNamespace();
 
 9531    if (decl_ctx == other)
 
 9533  } 
while (is_transparent_lookup_allowed(other) &&
 
 9534           (other = other->getParent()));
 
 
 9541  if (!opaque_decl_ctx)
 
 9544  auto *decl_ctx = (clang::DeclContext *)opaque_decl_ctx;
 
 9545  if (llvm::isa<clang::ObjCMethodDecl>(decl_ctx)) {
 
 9547  } 
else if (llvm::isa<clang::CXXMethodDecl>(decl_ctx)) {
 
 9549  } 
else if (
auto *fun_decl = llvm::dyn_cast<clang::FunctionDecl>(decl_ctx)) {
 
 9550    if (std::optional<ClangASTMetadata> metadata = 
GetMetadata(fun_decl))
 
 9551      return metadata->GetObjectPtrLanguage();
 
 
 9571    return llvm::dyn_cast<clang::ObjCMethodDecl>(
 
 
 9579    return llvm::dyn_cast<clang::CXXMethodDecl>(
 
 
 9584clang::FunctionDecl *
 
 9587    return llvm::dyn_cast<clang::FunctionDecl>(
 
 
 9592clang::NamespaceDecl *
 
 9595    return llvm::dyn_cast<clang::NamespaceDecl>(
 
 
 9600std::optional<ClangASTMetadata>
 
 9602                                        const Decl *
object) {
 
 
 9610      llvm::dyn_cast_or_null<TypeSystemClang>(dc.
GetTypeSystem());
 
 
 9632  lldbassert(started && 
"Unable to start a class type definition.");
 
 9637    ts->SetDeclIsForcefullyCompleted(td);
 
 
 9651  SpecializedScratchAST(llvm::StringRef name, llvm::Triple triple,
 
 9652                        std::unique_ptr<ClangASTSource> ast_source)
 
 9654        m_scratch_ast_source_up(std::move(ast_source)) {
 
 9656    m_scratch_ast_source_up->InstallASTContext(*
this);
 
 9657    llvm::IntrusiveRefCntPtr<clang::ExternalASTSource> proxy_ast_source =
 
 9658        m_scratch_ast_source_up->CreateProxy();
 
 9659    SetExternalSource(proxy_ast_source);
 
 9663  std::unique_ptr<ClangASTSource> m_scratch_ast_source_up;
 
 9671                                               llvm::Triple triple)
 
 9678  llvm::IntrusiveRefCntPtr<clang::ExternalASTSource> proxy_ast_source =
 
 
 9690                                     std::optional<IsolatedASTKind> ast_kind,
 
 9691                                     bool create_on_demand) {
 
 9694  if (
auto err = type_system_or_err.takeError()) {
 
 9696                   "Couldn't get scratch TypeSystemClang: {0}");
 
 9699  auto ts_sp = *type_system_or_err;
 
 9701      llvm::dyn_cast_or_null<ScratchTypeSystemClang>(ts_sp.get());
 
 9706    return std::static_pointer_cast<TypeSystemClang>(ts_sp);
 
 9708  return std::static_pointer_cast<TypeSystemClang>(
 
 
 9713static llvm::StringRef
 
 9717    return "C++ modules";
 
 9719  llvm_unreachable(
"Unimplemented IsolatedASTKind?");
 
 
 9723                                  llvm::StringRef filter, 
bool show_color) {
 
 9725  output << 
"State of scratch Clang type system:\n";
 
 9729  typedef std::pair<IsolatedASTKey, TypeSystem *> KeyAndTS;
 
 9730  std::vector<KeyAndTS> sorted_typesystems;
 
 9732    sorted_typesystems.emplace_back(a.first, a.second.get());
 
 9733  llvm::stable_sort(sorted_typesystems, llvm::less_first());
 
 9736  for (
const auto &a : sorted_typesystems) {
 
 9739    output << 
"State of scratch Clang type subsystem " 
 9741    a.second->Dump(output, filter, show_color);
 
 
 9746    llvm::StringRef expr, llvm::StringRef prefix, 
SourceLanguage language,
 
 9754                                 desired_type, options, ctx_obj);
 
 
 9759    const ValueList &arg_value_list, 
const char *name) {
 
 9764  Process *process = target_sp->GetProcessSP().get();
 
 9769                                 arg_value_list, name);
 
 
 9772std::unique_ptr<UtilityFunction>
 
 9779  return std::make_unique<ClangUtilityFunction>(
 
 9780      *target_sp.get(), std::move(text), std::move(name),
 
 9781      target_sp->GetDebugUtilityExpression());
 
 
 9795    importer.
ForgetSource(&a.second->getASTContext(), src_ctx);
 
 
 9799  return std::make_unique<ClangASTSource>(
 
 
 9804static llvm::StringRef
 
 9808    return "scratch ASTContext for C++ module types";
 
 9810  llvm_unreachable(
"Unimplemented ASTFeature kind?");
 
 
 9817    return *found_ast->second;
 
 9820  std::shared_ptr<TypeSystemClang> new_ast_sp =
 
 
 9830    const clang::RecordType *record_type =
 
 9831        llvm::dyn_cast<clang::RecordType>(qual_type.getTypePtr());
 
 9833      const clang::RecordDecl *record_decl =
 
 9834          record_type->getDecl()->getDefinitionOrSelf();
 
 9835      if (std::optional<ClangASTMetadata> metadata = 
GetMetadata(record_decl))
 
 9836        return metadata->IsForcefullyCompleted();
 
 
 9845  std::optional<ClangASTMetadata> metadata = 
GetMetadata(td);
 
 9849  metadata->SetIsForcefullyCompleted();
 
 
 9857    LLDB_LOG(log, 
"Created new TypeSystem for (ASTContext*){0:x} '{1}'",
 
 
#define LLDB_LOG(log,...)
The LLDB_LOG* macros defined below are the way to emit log messages.
#define LLDB_LOGF(log,...)
#define LLDB_LOG_ERROR(log, error,...)
#define LLDB_PLUGIN_DEFINE(PluginName)
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)
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)
static void ParseLangArgs(LangOptions &Opts, ArchSpec arch)
static clang::QualType GetFullyUnqualifiedType_Impl(clang::ASTContext *ast, clang::QualType qual_type)
const TemplateArgument * GetNthTemplateArgument(const clang::ClassTemplateSpecializationDecl *decl, size_t idx, bool expand_pack)
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 const clang::RecordType * GetCompleteRecordType(clang::ASTContext *ast, clang::QualType qual_type, bool allow_completion)
Returns the clang::RecordType of the specified qual_type.
lldb_private::ThreadSafeDenseMap< clang::ASTContext *, TypeSystemClang * > ClangASTMap
static bool IsClangDeclContext(const CompilerDeclContext &dc)
static bool TemplateParameterAllowsValue(NamedDecl *param, const TemplateArgument &value)
Returns true if the given template parameter can represent the given value.
static CompilerContextKind GetCompilerKind(clang::Decl::Kind clang_kind, clang::DeclContext const *decl_ctx)
static QualType RemoveWrappingTypes(QualType type, ArrayRef< clang::Type::TypeClass > mask={})
Aggressively desugar the provided type, skipping past various kinds of syntactic sugar and other cons...
static TemplateParameterList * CreateTemplateParameterList(ASTContext &ast, const TypeSystemClang::TemplateParameterInfos &template_param_infos, llvm::SmallVector< NamedDecl *, 8 > &template_param_decls)
clang::DeclContext * FindLCABetweenDecls(clang::DeclContext *left, clang::DeclContext *right, clang::DeclContext *root)
static bool check_op_param(bool is_method, clang::OverloadedOperatorKind op_kind, bool unary, bool binary, uint32_t num_params)
static llvm::StringRef GetSpecializedASTName(ScratchTypeSystemClang::IsolatedASTKind feature)
static bool ObjCDeclHasIVars(clang::ObjCInterfaceDecl *class_interface_decl)
static const clang::ObjCObjectType * GetCompleteObjCObjectType(clang::ASTContext *ast, QualType qual_type, bool allow_completion)
Returns the clang::ObjCObjectType of the specified qual_type.
static lldb::addr_t GetVTableAddress(Process &process, VTableContextBase &vtable_ctx, ValueObject &valobj, const ASTRecordLayout &record_layout)
static clang::ObjCIvarDecl::AccessControl ConvertAccessTypeToObjCIvarAccessControl(AccessType access)
static std::optional< SymbolFile::ArrayInfo > GetDynamicArrayInfo(TypeSystemClang &ast, SymbolFile *sym_file, clang::QualType qual_type, const ExecutionContext *exe_ctx)
static ConstString ExtractMangledNameFromFunctionCallLabel(llvm::StringRef label)
static llvm::StringRef GetNameForIsolatedASTKind(ScratchTypeSystemClang::IsolatedASTKind kind)
Returns a human-readable name that uniquely identifiers the sub-AST kind.
static void InsertCompilerContext(TypeSystemClang *ts, clang::DeclContext *decl_ctx, std::vector< lldb_private::CompilerContext > &context)
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)
static const clang::EnumType * GetCompleteEnumType(clang::ASTContext *ast, clang::QualType qual_type, bool allow_completion)
Returns the clang::EnumType of the specified qual_type.
static bool QualTypeMatchesBitSize(const uint64_t bit_size, ASTContext &ast, QualType qual_type)
static ClangASTMap & GetASTMap()
static bool GetCompleteQualType(clang::ASTContext *ast, clang::QualType qual_type, bool allow_completion=true)
static void SetMemberOwningModule(clang::Decl *member, const clang::Decl *parent)
static bool ClassTemplateAllowsToInstantiationArgs(ClassTemplateDecl *class_template_decl, const TypeSystemClang::TemplateParameterInfos &instantiation_values)
Returns true if the given class template declaration could produce an instantiation with the specifie...
#define LLDB_INVALID_DECL_LEVEL
void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, const clang::Diagnostic &info) override
DiagnosticConsumer * clone(DiagnosticsEngine &Diags) const
A section + offset based address class.
An architecture specification class.
bool IsValid() const
Tests if this ArchSpec is valid.
llvm::Triple & GetTriple()
Architecture triple accessor.
bool CharIsSignedByDefault() const
Returns true if 'char' is a signed type by default in the architecture false otherwise.
Manages and observes all Clang AST node importing in LLDB.
bool 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)
void ForgetSource(clang::ASTContext *dst_ctx, clang::ASTContext *src_ctx)
"lldb/Expression/ClangFunctionCaller.h" Encapsulates a function that can be called.
"lldb/Expression/ClangPersistentVariables.h" Manages persistent values that need to be preserved betw...
"lldb/Expression/ClangUserExpression.h" Encapsulates a single expression for use with Clang
Represents a generic declaration context in a program.
TypeSystem * GetTypeSystem() const
void * GetOpaqueDeclContext() const
Represents a generic declaration such as a function declaration.
lldb::TypeSystemSP GetSharedPointer() const
Generic representation of a type in a programming language.
lldb::LanguageType GetMinimumLanguage()
bool IsEnumerationType(bool &is_signed) const
TypeSystemSPWrapper GetTypeSystem() const
Accessors.
void SetCompilerType(lldb::TypeSystemWP type_system, lldb::opaque_compiler_type_t type)
size_t GetIndexOfChildMemberWithName(llvm::StringRef name, bool omit_empty_base_classes, std::vector< uint32_t > &child_indexes) const
Lookup a child member given a name.
llvm::Expected< uint64_t > GetByteSize(ExecutionContextScope *exe_scope) const
Return the size of the type in bytes.
lldb::opaque_compiler_type_t GetOpaqueQualType() const
lldb::Encoding GetEncoding() const
LLVM_DUMP_METHOD void dump() const
Dumping types.
uint32_t GetNumDirectBaseClasses() const
ConstString GetTypeName(bool BaseOnly=false) const
bool IsEnumerationIntegerTypeSigned() const
bool DumpTypeValue(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)
bool IsAggregateType() const
lldb::Format GetFormat() const
llvm::Expected< CompilerType > GetChildCompilerTypeAtIndex(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) const
CompilerType GetDirectBaseClassAtIndex(size_t idx, uint32_t *bit_offset_ptr) const
bool GetCompleteType() const
Type Completion.
uint32_t GetTypeInfo(CompilerType *pointee_or_element_compiler_type=nullptr) const
llvm::Expected< uint32_t > GetIndexOfChildWithName(llvm::StringRef name, bool omit_empty_base_classes) const
Lookup a child given a name.
llvm::Expected< uint32_t > GetNumChildren(bool omit_empty_base_classes, const ExecutionContext *exe_ctx) const
llvm::Expected< uint64_t > GetBitSize(ExecutionContextScope *exe_scope) const
Return the size of the type in bits.
A uniqued constant string class.
const char * AsCString(const char *value_if_empty=nullptr) const
Get the string value as a C string.
const char * GetCString() const
Get the string value as a C string.
static void ReportWarning(std::string message, std::optional< lldb::user_id_t > debugger_id=std::nullopt, std::once_flag *once=nullptr)
Report warning events.
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.
ExecutionContextScope * GetBestExecutionContextScope() const
Process * GetProcessPtr() const
Returns a pointer to the process object.
static FileSystem & Instance()
bool Test(ValueType bit) const
Test a single flag bit.
bool AnySet(ValueType mask) const
Test one or more flags.
Encapsulates a function that can be called.
static bool LanguageIsC(lldb::LanguageType language)
static bool LanguageIsCPlusPlus(lldb::LanguageType language)
static bool LanguageIsPascal(lldb::LanguageType language)
static bool LanguageIsObjC(lldb::LanguageType language)
static bool IsMangledName(llvm::StringRef name)
A class that describes an executable image and its associated object and symbol files.
virtual size_t GetByteOffsetForIvar(CompilerType &parent_qual_type, const char *ivar_name)
static ObjCLanguageRuntime * Get(Process &process)
unsigned GetValue() const
static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description, ABICreateInstance create_callback)
static bool UnregisterPlugin(ABICreateInstance create_callback)
A plug-in interface definition class for debugging a process.
int64_t ReadSignedIntegerFromMemory(lldb::addr_t load_addr, size_t byte_size, int64_t fail_value, Status &error)
lldb::addr_t ReadPointerFromMemory(lldb::addr_t vm_addr, Status &error)
uint32_t GetAddressByteSize() const
void Finalize() override
Free up any resources associated with this TypeSystem.
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.
UserExpression * GetUserExpression(llvm::StringRef expr, llvm::StringRef prefix, SourceLanguage language, Expression::ResultType desired_type, const EvaluateExpressionOptions &options, ValueObject *ctx_obj) override
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...
void Dump(llvm::raw_ostream &output, llvm::StringRef filter, bool show_color) override
std::unique_ptr< ClangPersistentVariables > m_persistent_variables
The persistent variables associated with this process for the expression parser.
static char ID
LLVM RTTI support.
PersistentExpressionState * GetPersistentExpressionState() override
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 const std::nullopt_t DefaultAST
Alias for requesting the default scratch TypeSystemClang in GetForTarget.
ScratchTypeSystemClang(Target &target, llvm::Triple triple)
llvm::DenseMap< IsolatedASTKey, std::shared_ptr< TypeSystemClang > > m_isolated_asts
Map from IsolatedASTKind to their actual TypeSystemClang instance.
bool Fail() const
Test for error condition.
llvm::StringRef GetString() const
A stream class that can stream formatted output to a file.
size_t Write(const void *src, size_t src_len)
Output character bytes to the stream.
llvm::raw_ostream & AsRawOstream()
Returns a raw_ostream that forwards the data to this Stream object.
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
unsigned GetIndentLevel() const
Get the current indentation level.
Provides public interface for all SymbolFiles.
virtual void ParseDeclsForContext(CompilerDeclContext decl_ctx)
virtual bool CompleteType(CompilerType &compiler_type)=0
virtual void GetTypes(lldb_private::SymbolContextScope *sc_scope, lldb::TypeClass type_mask, lldb_private::TypeList &type_list)=0
virtual std::optional< ArrayInfo > GetDynamicArrayInfoForUID(lldb::user_id_t type_uid, const lldb_private::ExecutionContext *exe_ctx)=0
If type_uid points to an array type, return its characteristics.
llvm::Expected< lldb::TypeSystemSP > GetScratchTypeSystemForLanguage(lldb::LanguageType language, bool create_on_demand=true)
const ArchSpec & GetArchitecture() const
void Insert(_KeyType k, _ValueType v)
_ValueType Lookup(_KeyType k)
lldb::TypeSP GetTypeAtIndex(uint32_t idx)
The implementation of lldb::Type's m_payload field for TypeSystemClang.
void SetIsCompleteObjCClass(bool is_complete_objc_class)
bool IsCompleteObjCClass()
Type::Payload m_payload
The payload is used for typedefs and ptrauth types.
TypePayloadClang()=default
void SetOwningModule(OptionalClangModuleID id)
static constexpr unsigned ObjCClassBit
llvm::ArrayRef< clang::TemplateArgument > GetParameterPackArgs() const
clang::TemplateArgument const & Front() const
llvm::StringRef GetPackName() const
bool hasParameterPack() const
TemplateParameterInfos const & GetParameterPack() const
llvm::ArrayRef< const char * > GetNames() const
llvm::ArrayRef< clang::TemplateArgument > GetArgs() const
A TypeSystem implementation based on Clang.
bool IsMemberFunctionPointerType(lldb::opaque_compiler_type_t type) override
CompilerType GetTypeForIdentifier(const clang::ASTContext &Ctx, llvm::StringRef type_name, clang::DeclContext *decl_context=nullptr)
llvm::Expected< uint64_t > GetBitSize(lldb::opaque_compiler_type_t type, ExecutionContextScope *exe_scope) override
CompilerType CreateFunctionType(const CompilerType &result_type, llvm::ArrayRef< CompilerType > args, bool is_variadic, unsigned type_quals, clang::CallingConv cc=clang::CC_C, clang::RefQualifierKind ref_qual=clang::RQ_None)
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
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
std::string m_display_name
A string describing what this TypeSystemClang represents (e.g., AST for debug information,...
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.
llvm::Expected< uint64_t > GetObjCBitSize(clang::QualType qual_type, ExecutionContextScope *exe_scope)
std::unique_ptr< clang::TargetInfo > m_target_info_up
std::unique_ptr< clang::LangOptions > m_language_options_up
Scalar DeclGetConstantValue(void *opaque_decl) override
llvm::Expected< CompilerType > GetDereferencedType(lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx, std::string &deref_name, uint32_t &deref_byte_size, int32_t &deref_byte_offset, ValueObject *valobj, uint64_t &language_flags) override
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)
std::unique_ptr< clang::HeaderSearchOptions > m_header_search_opts_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
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(llvm::StringRef name, llvm::Triple triple)
Constructs a TypeSystemClang with an ASTContext using the given triple.
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)
CompilerType CreateArrayType(const CompilerType &element_type, std::optional< size_t > element_count, bool is_vector)
static bool AreTypesSame(CompilerType type1, CompilerType type2, bool ignore_qualifiers=false)
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
std::optional< ClangASTMetadata > GetMetadata(const clang::Decl *object)
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 CanPassInRegisters(const CompilerType &type) override
CompilerDecl GetStaticFieldWithName(lldb::opaque_compiler_type_t type, llvm::StringRef name) override
static clang::DeclContext * GetDeclContextForType(clang::QualType type)
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
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)
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
CompilerType CreateStructForIdentifier(llvm::StringRef type_name, const std::initializer_list< std::pair< const char *, CompilerType > > &type_fields, bool packed=false)
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
llvm::Expected< CompilerType > GetChildCompilerTypeAtIndex(lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx, size_t idx, bool transparent_pointers, bool omit_empty_base_classes, bool ignore_array_bounds, std::string &child_name, uint32_t &child_byte_size, int32_t &child_byte_offset, uint32_t &child_bitfield_bit_size, uint32_t &child_bitfield_bit_offset, bool &child_is_base_class, bool &child_is_deref_of_parent, ValueObject *valobj, uint64_t &language_flags) override
CompilerType 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 lldb::BasicType GetBasicTypeEnumeration(llvm::StringRef name)
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)
bool IsPointerType(lldb::opaque_compiler_type_t type, CompilerType *pointee_type) override
std::unique_ptr< clang::DiagnosticOptions > m_diagnostic_options_up
void CreateFunctionTemplateSpecializationInfo(clang::FunctionDecl *func_decl, clang::FunctionTemplateDecl *Template, const TemplateParameterInfos &infos)
clang::EnumConstantDecl * AddEnumerationValueToEnumerationType(const CompilerType &enum_type, const Declaration &decl, const char *name, uint64_t enum_value, uint32_t enum_value_bit_size)
llvm::StringRef getDisplayName() const
Returns the display name of this TypeSystemClang that indicates what purpose it serves in LLDB.
bool IsCStringType(lldb::opaque_compiler_type_t type, uint32_t &length)
CompilerType GetRValueReferenceType(lldb::opaque_compiler_type_t type) override
CompilerDecl GetCompilerDecl(clang::Decl *decl)
Creates a CompilerDecl from the given Decl with the current TypeSystemClang instance as its typesyste...
unsigned GetPtrAuthDiscriminator(lldb::opaque_compiler_type_t type) override
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
const llvm::fltSemantics & GetFloatTypeSemantics(size_t byte_size, lldb::Format format) override
llvm::Expected< uint32_t > GetIndexOfChildWithName(lldb::opaque_compiler_type_t type, llvm::StringRef name, bool omit_empty_base_classes) override
void setSema(clang::Sema *s)
uint32_t GetPointerByteSize() override
bool IsCompleteType(lldb::opaque_compiler_type_t type) override
CompilerType GetIntTypeFromBitSize(size_t bit_size, bool is_signed)
clang::MangleContext * getMangleContext()
void CompleteObjCInterfaceDecl(clang::ObjCInterfaceDecl *)
unsigned GetPtrAuthKey(lldb::opaque_compiler_type_t type) override
static void DumpDeclContextHiearchy(clang::DeclContext *decl_ctx)
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
This is used by swift.
static LanguageSet GetSupportedLanguagesForExpressions()
clang::FunctionDecl * CreateFunctionDeclaration(clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, llvm::StringRef name, const CompilerType &function_Type, clang::StorageClass storage, bool is_inline, llvm::StringRef asm_label)
CompilerType GetTypedefedType(lldb::opaque_compiler_type_t type) override
CompilerDeclContext GetCompilerDeclContextForType(const CompilerType &type) override
Returns the direct parent context of specified type.
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
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)
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)
lldb::Encoding GetEncoding(lldb::opaque_compiler_type_t type) override
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 ...
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)
llvm::SmallVector< clang::ParmVarDecl * > CreateParameterDeclarations(clang::FunctionDecl *context, const clang::FunctionProtoType &prototype, const llvm::SmallVector< llvm::StringRef > ¶m_names)
For each parameter type of prototype, creates a clang::ParmVarDecl whose clang::DeclContext is contex...
std::unique_ptr< clang::HeaderSearch > m_header_search_up
void Finalize() override
Free up any resources associated with this TypeSystem.
static clang::ASTContext * DeclContextGetTypeSystemClang(const CompilerDeclContext &dc)
uint32_t IsHomogeneousAggregate(lldb::opaque_compiler_type_t type, CompilerType *base_type_ptr) override
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.
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
CompilerType CreateGenericFunctionPrototype() override
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)
CompilerType GetDirectNestedTypeWithName(lldb::opaque_compiler_type_t type, llvm::StringRef name) override
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
bool GetPtrAuthAddressDiversity(lldb::opaque_compiler_type_t type) override
std::shared_ptr< clang::TargetOptions > m_target_options_rp
lldb::TypeClass GetTypeClass(lldb::opaque_compiler_type_t type) override
static bool IsClassType(lldb::opaque_compiler_type_t type)
bool IsDefined(lldb::opaque_compiler_type_t type) override
static bool IsObjCClassType(const CompilerType &type)
TypeMetadataMap m_type_metadata
Maps Types to their associated ClangASTMetadata.
CompilerType GetCanonicalType(lldb::opaque_compiler_type_t type) override
bool RecordHasFields(const clang::RecordDecl *record_decl)
CompilerType GetFunctionArgumentAtIndex(lldb::opaque_compiler_type_t type, const size_t index) override
static std::optional< ClangASTMetadata > DeclContextGetMetaData(const CompilerDeclContext &dc, const clang::Decl *object)
static bool CompleteTagDeclarationDefinition(const CompilerType &type)
unsigned GetTypeQualifiers(lldb::opaque_compiler_type_t type) override
static clang::ObjCMethodDecl * AddMethodToObjCObjectType(const CompilerType &type, const char *name, const CompilerType &method_compiler_type, bool is_artificial, bool is_variadic, bool is_objc_direct_call)
~TypeSystemClang() override
CompilerDeclContext DeclGetDeclContext(void *opaque_decl) override
CompilerType CreateRecordType(clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, lldb::AccessType access_type, llvm::StringRef name, int kind, lldb::LanguageType language, std::optional< ClangASTMetadata > metadata=std::nullopt, bool exports_symbols=false)
bool DeclContextIsContainedInLookup(void *opaque_decl_ctx, void *other_opaque_decl_ctx) override
CompilerType AddPtrAuthModifier(lldb::opaque_compiler_type_t type, uint32_t payload) override
static bool AddObjCClassProperty(const CompilerType &type, const char *property_name, const CompilerType &property_compiler_type, clang::ObjCIvarDecl *ivar_decl, const char *property_setter_name, const char *property_getter_name, uint32_t property_attributes, ClangASTMetadata metadata)
static bool SetHasExternalStorage(lldb::opaque_compiler_type_t type, bool has_extern)
void SetMetadata(const clang::Decl *object, ClangASTMetadata meta_data)
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)
CompilerType CreateEnumerationType(llvm::StringRef name, clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, const Declaration &decl, const CompilerType &integer_qual_type, bool is_scoped, std::optional< clang::EnumExtensibilityAttr::Kind > enum_kind=std::nullopt)
npdb::PdbAstBuilder * GetNativePDBParser() override
std::unique_ptr< clang::DiagnosticConsumer > m_diagnostic_consumer_up
CompilerType CreateObjCClass(llvm::StringRef name, clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, bool isInternal, std::optional< ClangASTMetadata > metadata=std::nullopt)
CompilerType GetTypeForDecl(clang::NamedDecl *decl)
CompilerType GetDirectBaseClassAtIndex(lldb::opaque_compiler_type_t type, size_t idx, uint32_t *bit_offset_ptr) override
CompilerType GetArrayElementType(lldb::opaque_compiler_type_t type, ExecutionContextScope *exe_scope) override
static clang::DeclContext * DeclContextGetAsDeclContext(const CompilerDeclContext &dc)
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
void Dump(llvm::raw_ostream &output, llvm::StringRef filter, bool show_color) override
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
CompilerType GetOrCreateStructForIdentifier(llvm::StringRef type_name, const std::initializer_list< std::pair< const char *, CompilerType > > &type_fields, bool packed=false)
void LogCreation() const
Emits information about this TypeSystem into the expression log.
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
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 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)
plugin::dwarf::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)
bool IsFloatingPointType(lldb::opaque_compiler_type_t type, bool &is_complex) override
CompilerType AddVolatileModifier(lldb::opaque_compiler_type_t type) override
std::unique_ptr< clang::ModuleMap > m_module_map_up
clang::CXXMethodDecl * AddMethodToCXXRecordType(lldb::opaque_compiler_type_t type, llvm::StringRef name, llvm::StringRef asm_label, 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 bool IsObjCObjectOrInterfaceType(const CompilerType &type)
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::Expected< uint32_t > GetNumChildren(lldb::opaque_compiler_type_t type, bool omit_empty_base_classes, const ExecutionContext *exe_ctx) override
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)
clang::ASTContext & getASTContext() const
Returns the clang::ASTContext instance managed by this TypeSystemClang.
std::vector< lldb_private::CompilerContext > DeclGetCompilerContext(void *opaque_decl) override
static CompilerType CreateMemberPointerType(const CompilerType &type, const CompilerType &pointee_type)
std::vector< lldb_private::CompilerContext > DeclContextGetCompilerContext(void *opaque_decl_ctx) override
void CreateASTContext()
Creates the internal ASTContext.
void SetExternalSource(llvm::IntrusiveRefCntPtr< clang::ExternalASTSource > ast_source_sp)
CompilerType GetCStringType(bool is_const)
bool IsAggregateType(lldb::opaque_compiler_type_t type) 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 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::Expected< uint64_t > GetByteSize(lldb::opaque_compiler_type_t type, ExecutionContextScope *exe_scope)
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
virtual SymbolFile * GetSymbolFile() const
bool m_has_forcefully_completed_types
Used for reporting statistics.
Encapsulates a one-time expression for use in lldb.
virtual uint64_t GetData(DataExtractor &data, Status &error)
CompilerType GetCompilerType()
virtual uint64_t GetValueAsUnsigned(uint64_t fail_value, bool *success=nullptr)
AddressType GetAddressTypeOfChildren()
ConstString GetName() const
const ExecutionContextRef & GetExecutionContextRef() const
#define LLDB_INVALID_ADDRESS
#define LLDB_INVALID_IVAR_OFFSET
A class that represents a running process on the host machine.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
lldb::offset_t DumpDataExtractor(const DataExtractor &DE, Stream *s, lldb::offset_t offset, lldb::Format item_format, size_t item_byte_size, size_t item_count, size_t num_per_line, uint64_t base_addr, uint32_t item_bit_size, uint32_t item_bit_offset, ExecutionContextScope *exe_scope=nullptr, bool show_memory_tags=false)
Dumps item_count objects into the stream s.
@ eAddressTypeLoad
Address is an address as in the current target inferior process.
std::shared_ptr< lldb_private::TypeSystem > TypeSystemSP
void * opaque_compiler_type_t
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
@ eDescriptionLevelVerbose
BasicType
Basic types enumeration for the public API SBType::GetBasicType().
@ eBasicTypeUnsignedShort
@ eBasicTypeUnsignedInt128
@ eBasicTypeUnsignedWChar
@ eBasicTypeLongDoubleComplex
@ eBasicTypeUnsignedLongLong
@ eBasicTypeDoubleComplex
Format
Display format definitions.
@ eFormatCString
NULL terminated C strings.
@ eFormatCharArray
Print characters with no single quotes, used for character arrays that can contain non printable char...
@ eFormatVoid
Do not print this.
@ eFormatComplex
Floating point complex type.
@ eFormatOSType
OS character codes encoded into an integer 'PICT' 'text' etc...
@ eFormatCharPrintable
Only printable characters, '.' if not printable.
@ eFormatComplexInteger
Integer complex type.
@ eFormatFloat128
Disambiguate between 128-bit long double (which uses eFormatFloat) and __float128 (which uses eFormat...
LanguageType
Programming language type.
@ eLanguageTypeC_plus_plus_20
ISO C++:2020.
@ eLanguageTypeC_plus_plus_14
ISO C++:2014.
@ eLanguageTypeC11
ISO C:2011.
@ eLanguageTypeC99
ISO C:1999.
@ eLanguageTypeC_plus_plus_03
ISO C++:2003.
@ eLanguageTypeUnknown
Unknown or invalid language value.
@ eLanguageTypeC_plus_plus_17
ISO C++:2017.
@ eLanguageTypeObjC_plus_plus
Objective-C++.
@ eLanguageTypeC_plus_plus_11
ISO C++:2011.
@ eLanguageTypeC89
ISO C:1989.
@ eLanguageTypeC
Non-standardized C, such as K&R.
@ eLanguageTypeObjC
Objective-C.
@ eLanguageTypeC_plus_plus
ISO C++:1998.
@ eLanguageTypeDylan
Dylan.
std::shared_ptr< lldb_private::Type > TypeSP
@ eTemplateArgumentKindTemplate
@ eTemplateArgumentKindTemplateExpansion
@ eTemplateArgumentKindNull
@ eTemplateArgumentKindNullPtr
@ eTemplateArgumentKindDeclaration
@ eTemplateArgumentKindIntegral
@ eTemplateArgumentKindPack
@ eTemplateArgumentKindType
@ eTemplateArgumentKindStructuralValue
@ eTemplateArgumentKindExpression
Encoding
Register encoding definitions.
@ eEncodingVector
vector registers
@ eEncodingUint
unsigned integer
@ eEncodingSint
signed integer
MemberFunctionKind
Kind of member function.
@ eMemberFunctionKindInstanceMethod
A function that applies to a specific instance.
@ eMemberFunctionKindConstructor
A function used to create instances.
@ eMemberFunctionKindUnknown
Not sure what the type of this is.
@ eMemberFunctionKindDestructor
A function used to tear down existing instances.
@ eMemberFunctionKindStaticMethod
A function that applies to a type rather than any instance.
std::shared_ptr< lldb_private::TypeSystemClang > TypeSystemClangSP
std::shared_ptr< lldb_private::Target > TargetSP
static clang::QualType GetQualType(const CompilerType &ct)
static clang::QualType GetCanonicalQualType(const CompilerType &ct)
static bool IsClangType(const CompilerType &ct)
static CompilerType RemoveFastQualifiers(const CompilerType &ct)
static clang::TagDecl * GetAsTagDecl(const CompilerType &type)
static llvm::Expected< FunctionCallLabel > fromString(llvm::StringRef label)
Decodes the specified function label into a FunctionCallLabel.
A SmallBitVector that represents a set of source languages (lldb::LanguageType).
void Insert(lldb::LanguageType language)
A type-erased pair of llvm::dwarf::SourceLanguageName and version.