Lines Matching +full:p0 +full:- +full:retry +full:- +full:params

1 //===- ASTContext.cpp - Context to hold long-lived AST nodes --------------===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
11 //===----------------------------------------------------------------------===//
125 if (D->isImplicit()) in getDeclLocsForCommentSearch()
130 if (FD->getTemplateSpecializationKind() == TSK_ImplicitInstantiation) in getDeclLocsForCommentSearch()
135 if (VD->isStaticDataMember() && in getDeclLocsForCommentSearch()
136 VD->getTemplateSpecializationKind() == TSK_ImplicitInstantiation) in getDeclLocsForCommentSearch()
141 if (CRD->getTemplateSpecializationKind() == TSK_ImplicitInstantiation) in getDeclLocsForCommentSearch()
146 TemplateSpecializationKind TSK = CTSD->getSpecializationKind(); in getDeclLocsForCommentSearch()
153 if (ED->getTemplateSpecializationKind() == TSK_ImplicitInstantiation) in getDeclLocsForCommentSearch()
158 // decl-specifier-seq of some other declaration, it doesn't get comment in getDeclLocsForCommentSearch()
159 if (TD->isEmbeddedInDeclarator() && !TD->isCompleteDefinition()) in getDeclLocsForCommentSearch()
175 // For Objective-C declarations we generally don't expect to have multiple in getDeclLocsForCommentSearch()
186 BaseLocation = D->getBeginLoc(); in getDeclLocsForCommentSearch()
188 BaseLocation = D->getLocation(); in getDeclLocsForCommentSearch()
190 if (!D->getLocation().isMacroID()) { in getDeclLocsForCommentSearch()
193 const auto *DeclCtx = D->getDeclContext(); in getDeclLocsForCommentSearch()
198 // there we should retry to see if there is a comment inside the macro as in getDeclLocsForCommentSearch()
203 Decl::castFromDeclContext(DeclCtx)->getLocation().isMacroID())) { in getDeclLocsForCommentSearch()
211 Locations.emplace_back(SourceMgr.getSpellingLoc(D->getBeginLoc())); in getDeclLocsForCommentSearch()
241 RawComment *CommentBehindDecl = OffsetCommentBehindDecl->second; in getRawCommentForDeclNoCacheImpl()
242 if ((CommentBehindDecl->isDocumentation() || in getRawCommentForDeclNoCacheImpl()
244 CommentBehindDecl->isTrailingComment() && in getRawCommentForDeclNoCacheImpl()
252 OffsetCommentBehindDecl->first)) { in getRawCommentForDeclNoCacheImpl()
263 auto OffsetCommentBeforeDecl = --OffsetCommentBehindDecl; in getRawCommentForDeclNoCacheImpl()
264 RawComment *CommentBeforeDecl = OffsetCommentBeforeDecl->second; in getRawCommentForDeclNoCacheImpl()
266 // Check that we actually have a non-member Doxygen comment. in getRawCommentForDeclNoCacheImpl()
267 if (!(CommentBeforeDecl->isDocumentation() || in getRawCommentForDeclNoCacheImpl()
269 CommentBeforeDecl->isTrailingComment()) in getRawCommentForDeclNoCacheImpl()
285 DeclLocDecomp.second - CommentEndOffset); in getRawCommentForDeclNoCacheImpl()
305 ExternalSource->ReadComments(); in getRawCommentForDeclNoCache()
317 if (!CommentsInThisFile || CommentsInThisFile->empty()) in getRawCommentForDeclNoCache()
340 if (const FunctionTemplateDecl *FTD = FD->getDescribedFunctionTemplate()) in adjustDeclToTemplate()
344 if (FD->getTemplateSpecializationKind() != TSK_ImplicitInstantiation) in adjustDeclToTemplate()
348 if (const FunctionTemplateDecl *FTD = FD->getPrimaryTemplate()) in adjustDeclToTemplate()
353 FD->getInstantiatedFromMemberFunction()) in adjustDeclToTemplate()
361 if (VD->isStaticDataMember()) in adjustDeclToTemplate()
362 if (const VarDecl *MemberDecl = VD->getInstantiatedFromStaticDataMember()) in adjustDeclToTemplate()
369 if (const ClassTemplateDecl *CTD = CRD->getDescribedClassTemplate()) in adjustDeclToTemplate()
375 if (CTSD->getSpecializationKind() != TSK_ImplicitInstantiation) in adjustDeclToTemplate()
379 PU = CTSD->getSpecializedTemplateOrPartial(); in adjustDeclToTemplate()
388 CRD->getMemberSpecializationInfo()) in adjustDeclToTemplate()
389 return *Info->getInstantiatedFrom(); in adjustDeclToTemplate()
395 if (const EnumDecl *MemberDecl = ED->getInstantiatedFromMemberEnum()) in adjustDeclToTemplate()
421 return DeclComment->second; in getRawCommentForAnyRedecl()
426 const Decl *CanonicalD = D->getCanonicalDecl(); in getRawCommentForAnyRedecl()
434 *OriginalDecl = RedeclComment->second; in getRawCommentForAnyRedecl()
435 auto CommentAtRedecl = DeclRawComments.find(RedeclComment->second); in getRawCommentForAnyRedecl()
438 return CommentAtRedecl->second; in getRawCommentForAnyRedecl()
444 auto LastCheckedRedecl = [this, CanonicalD]() -> const Decl * { in getRawCommentForAnyRedecl()
448 for (const auto Redecl : D->redecls()) { in getRawCommentForAnyRedecl()
483 const DeclContext *DC = ObjCMethod->getDeclContext(); in addRedeclaredMethods()
485 const ObjCInterfaceDecl *ID = IMD->getClassInterface(); in addRedeclaredMethods()
489 for (const auto *Ext : ID->known_extensions()) { in addRedeclaredMethods()
491 Ext->getMethod(ObjCMethod->getSelector(), in addRedeclaredMethods()
492 ObjCMethod->isInstanceMethod())) in addRedeclaredMethods()
505 if (D->isInvalidDecl()) in attachCommentsToJustParsedDecls()
509 SourceLocation Loc = D->getLocation(); in attachCommentsToJustParsedDecls()
512 // The location doesn't have to be precise - we care only about the file. in attachCommentsToJustParsedDecls()
522 if (!CommentsInThisFile || CommentsInThisFile->empty() || in attachCommentsToJustParsedDecls()
523 CommentsInThisFile->rbegin()->second->isAttached()) in attachCommentsToJustParsedDecls()
530 // declaration, but also comments that *follow* the declaration -- thanks to in attachCommentsToJustParsedDecls()
535 if (D->isInvalidDecl()) in attachCommentsToJustParsedDecls()
552 comments::FullComment *FC = DocComment->parse(*this, PP, D); in attachCommentsToJustParsedDecls()
553 ParsedComments[D->getCanonicalDecl()] = FC; in attachCommentsToJustParsedDecls()
563 ThisDeclInfo->CommentDecl = D; in cloneFullComment()
564 ThisDeclInfo->IsFilled = false; in cloneFullComment()
565 ThisDeclInfo->fill(); in cloneFullComment()
566 ThisDeclInfo->CommentDecl = FC->getDecl(); in cloneFullComment()
567 if (!ThisDeclInfo->TemplateParameters) in cloneFullComment()
568 ThisDeclInfo->TemplateParameters = FC->getDeclInfo()->TemplateParameters; in cloneFullComment()
570 new (*this) comments::FullComment(FC->getBlocks(), in cloneFullComment()
577 return RC ? RC->parse(*this, nullptr, D) : nullptr; in getLocalCommentForDeclUncached()
583 if (!D || D->isInvalidDecl()) in getCommentForDecl()
587 const Decl *Canonical = D->getCanonicalDecl(); in getCommentForDecl()
593 comments::FullComment *FC = Pos->second; in getCommentForDecl()
597 return Pos->second; in getCommentForDecl()
607 if (OMD && OMD->isPropertyAccessor()) in getCommentForDecl()
608 if (const ObjCPropertyDecl *PDecl = OMD->findPropertyDecl()) in getCommentForDecl()
621 QualType QT = TD->getUnderlyingType(); in getCommentForDecl()
622 if (const auto *TT = QT->getAs<TagType>()) in getCommentForDecl()
623 if (const Decl *TD = TT->getDecl()) in getCommentForDecl()
628 while (IC->getSuperClass()) { in getCommentForDecl()
629 IC = IC->getSuperClass(); in getCommentForDecl()
635 if (const ObjCInterfaceDecl *IC = CD->getClassInterface()) in getCommentForDecl()
640 if (!(RD = RD->getDefinition())) in getCommentForDecl()
642 // Check non-virtual bases. in getCommentForDecl()
643 for (const auto &I : RD->bases()) { in getCommentForDecl()
649 if (const CXXRecordDecl *NonVirtualBase = Ty->getAsCXXRecordDecl()) { in getCommentForDecl()
650 if (!(NonVirtualBase= NonVirtualBase->getDefinition())) in getCommentForDecl()
658 for (const auto &I : RD->vbases()) { in getCommentForDecl()
664 if (const CXXRecordDecl *VirtualBase = Ty->getAsCXXRecordDecl()) { in getCommentForDecl()
665 if (!(VirtualBase= VirtualBase->getDefinition())) in getCommentForDecl()
682 comments::FullComment *FC = RC->parse(*this, PP, D); in getCommentForDecl()
691 ID.AddInteger(Parm->getDepth()); in Profile()
692 ID.AddInteger(Parm->getPosition()); in Profile()
693 ID.AddBoolean(Parm->isParameterPack()); in Profile()
695 TemplateParameterList *Params = Parm->getTemplateParameters(); in Profile() local
696 ID.AddInteger(Params->size()); in Profile()
697 for (TemplateParameterList::const_iterator P = Params->begin(), in Profile()
698 PEnd = Params->end(); in Profile()
702 ID.AddBoolean(TTP->isParameterPack()); in Profile()
703 if (TTP->isExpandedParameterPack()) { in Profile()
705 ID.AddInteger(TTP->getNumExpansionParameters()); in Profile()
713 ID.AddBoolean(NTTP->isParameterPack()); in Profile()
714 ID.AddPointer(C.getUnconstrainedType(C.getCanonicalType(NTTP->getType())) in Profile()
716 if (NTTP->isExpandedParameterPack()) { in Profile()
718 ID.AddInteger(NTTP->getNumExpansionTypes()); in Profile()
719 for (unsigned I = 0, N = NTTP->getNumExpansionTypes(); I != N; ++I) { in Profile()
720 QualType T = NTTP->getExpansionType(I); in Profile()
744 return Canonical->getParam(); in getCanonicalTemplateTemplateParmDecl()
747 TemplateParameterList *Params = TTP->getTemplateParameters(); in getCanonicalTemplateTemplateParmDecl() local
749 CanonParams.reserve(Params->size()); in getCanonicalTemplateTemplateParmDecl()
750 for (TemplateParameterList::const_iterator P = Params->begin(), in getCanonicalTemplateTemplateParmDecl()
751 PEnd = Params->end(); in getCanonicalTemplateTemplateParmDecl()
754 // template-parameters are equivalent, constraints are ignored. in getCanonicalTemplateTemplateParmDecl()
758 TTP->getDepth(), TTP->getIndex(), nullptr, false, in getCanonicalTemplateTemplateParmDecl()
759 TTP->isParameterPack(), /*HasTypeConstraint=*/false, in getCanonicalTemplateTemplateParmDecl()
760 TTP->isExpandedParameterPack() in getCanonicalTemplateTemplateParmDecl()
761 ? std::optional<unsigned>(TTP->getNumExpansionParameters()) in getCanonicalTemplateTemplateParmDecl()
765 QualType T = getUnconstrainedType(getCanonicalType(NTTP->getType())); in getCanonicalTemplateTemplateParmDecl()
768 if (NTTP->isExpandedParameterPack()) { in getCanonicalTemplateTemplateParmDecl()
771 for (unsigned I = 0, N = NTTP->getNumExpansionTypes(); I != N; ++I) { in getCanonicalTemplateTemplateParmDecl()
772 ExpandedTypes.push_back(getCanonicalType(NTTP->getExpansionType(I))); in getCanonicalTemplateTemplateParmDecl()
780 NTTP->getDepth(), in getCanonicalTemplateTemplateParmDecl()
781 NTTP->getPosition(), nullptr, in getCanonicalTemplateTemplateParmDecl()
790 NTTP->getDepth(), in getCanonicalTemplateTemplateParmDecl()
791 NTTP->getPosition(), nullptr, in getCanonicalTemplateTemplateParmDecl()
793 NTTP->isParameterPack(), in getCanonicalTemplateTemplateParmDecl()
803 *this, getTranslationUnitDecl(), SourceLocation(), TTP->getDepth(), in getCanonicalTemplateTemplateParmDecl()
804 TTP->getPosition(), TTP->isParameterPack(), nullptr, /*Typename=*/false, in getCanonicalTemplateTemplateParmDecl()
914 if (auto *R = const_cast<ASTRecordLayout *>((I++)->second)) in cleanup()
915 R->Destroy(*this); in cleanup()
921 if (auto *R = const_cast<ASTRecordLayout *>((I++)->second)) in cleanup()
922 R->Destroy(*this); in cleanup()
929 A->second->~AttrVec(); in cleanup()
933 Value.second->~PerModuleInitializers(); in cleanup()
966 counts[(unsigned)T->getTypeClass()]++; in PrintStats()
1008 ExternalSource->PrintStats(); in PrintStats()
1018 Listener->RedefinedHiddenDefinition(ND, M); in mergeDefinitionIntoModule()
1020 MergedDefModules[cast<NamedDecl>(ND->getCanonicalDecl())].push_back(M); in mergeDefinitionIntoModule()
1024 auto It = MergedDefModules.find(cast<NamedDecl>(ND->getCanonicalDecl())); in deduplicateMergedDefinitonsFor()
1028 auto &Merged = It->second; in deduplicateMergedDefinitonsFor()
1039 MergedDefModules.find(cast<NamedDecl>(Def->getCanonicalDecl())); in getModulesWithMergedDefinition()
1042 return MergedIt->second; in getModulesWithMergedDefinition()
1056 Initializers.push_back(Source->GetExternalDecl(ID)); in resolve()
1066 auto It = ModuleInitializers.find(ID->getImportedModule()); in addModuleInitializer()
1073 auto &Imported = *It->second; in addModuleInitializer()
1085 Inits->Initializers.push_back(D); in addModuleInitializer()
1093 Inits->LazyInitializers.insert(Inits->LazyInitializers.end(), in addLazyModuleInitializers()
1102 auto *Inits = It->second; in getModuleInitializers()
1103 Inits->resolve(*this); in getModuleInitializers()
1104 return Inits->Initializers; in getModuleInitializers()
1108 assert(M->isNamedModule()); in setCurrentNamedModule()
1126 return Iter->second; in isInSameModule()
1129 PrimaryModuleNameMap.try_emplace(M->getPrimaryModuleInterfaceName(), M) in isInSameModule()
1130 .first->second; in isInSameModule()
1151 BuiltinTemplate->setImplicit(); in buildBuiltinTemplateDecl()
1152 getTranslationUnitDecl()->addDecl(BuiltinTemplate); in buildBuiltinTemplateDecl()
1183 NewDecl->setImplicit(); in buildImplicitRecord()
1184 NewDecl->addAttr(TypeVisibilityAttr::CreateImplicit( in buildImplicitRecord()
1195 NewDecl->setImplicit(); in buildImplicitTypedef()
1219 assert((!this->Target || this->Target == &Target) && in InitBuiltinTypes()
1223 this->Target = &Target; in InitBuiltinTypes()
1224 this->AuxTarget = AuxTarget; in InitBuiltinTypes()
1264 // C11 extension ISO/IEC TS 18661-3 in InitBuiltinTypes()
1293 // GNU extension, 128-bit integers. in InitBuiltinTypes()
1300 else // -fshort-wchar makes wchar_t be unsigned. in InitBuiltinTypes()
1305 // C99 (or C++ using -fno-wchar). in InitBuiltinTypes()
1324 // Placeholder type for type-dependent expressions whose type is in InitBuiltinTypes()
1327 // help diagnose failures to properly check for type-dependent in InitBuiltinTypes()
1340 // Placeholder type for pseudo-objects. in InitBuiltinTypes()
1343 // "any" type; useful for debugger-like clients. in InitBuiltinTypes()
1388 (AuxTarget && AuxTarget->hasAArch64SVETypes())) { in InitBuiltinTypes()
1409 if (Target.getTriple().isWasm() && Target.hasFeature("reference-types")) { in InitBuiltinTypes()
1416 (AuxTarget && AuxTarget->getTriple().isAMDGPU())) { in InitBuiltinTypes()
1454 getTranslationUnitDecl()->addDecl(MSGuidTagDecl); in InitBuiltinTypes()
1476 Pos->second->~AttrVec(); in eraseDeclAttrs()
1484 assert(Var->isStaticDataMember() && "Not a static data member"); in getInstantiatedFromStaticDataMember()
1496 return Pos->second; in getTemplateOrSpecializationInfo()
1503 assert(Inst->isStaticDataMember() && "Not a static data member"); in setInstantiatedFromStaticDataMember()
1504 assert(Tmpl->isStaticDataMember() && "Not a static data member"); in setInstantiatedFromStaticDataMember()
1565 assert(!Inst->getDeclName() && "Instantiated field decl is not unnamed"); in setInstantiatedFromUnnamedFieldDecl()
1566 assert(!Tmpl->getDeclName() && "Template field decl is not unnamed"); in setInstantiatedFromUnnamedFieldDecl()
1586 return Range.end() - Range.begin(); in overridden_methods_size()
1592 OverriddenMethods.find(Method->getCanonicalDecl()); in overridden_methods()
1595 return overridden_method_range(Pos->second.begin(), Pos->second.end()); in overridden_methods()
1600 assert(Method->isCanonicalDecl() && Overridden->isCanonicalDecl()); in addOverriddenMethod()
1620 Method->getOverriddenMethods(OverDecls); in getOverriddenMethods()
1625 assert(!Import->getNextLocalImport() && in addedLocalImportDecl()
1627 assert(!Import->isFromASTFile() && "Non-local import declaration"); in addedLocalImportDecl()
1634 LastLocalImport->setNextLocalImport(Import); in addedLocalImportDecl()
1638 //===----------------------------------------------------------------------===//
1640 //===----------------------------------------------------------------------===//
1642 /// getFloatTypeSemantics - Return the APFloat 'semantics' for the specified
1645 switch (T->castAs<BuiltinType>()->getKind()) { in getFloatTypeSemantics()
1649 return Target->getBFloat16Format(); in getFloatTypeSemantics()
1651 return Target->getHalfFormat(); in getFloatTypeSemantics()
1653 return Target->getHalfFormat(); in getFloatTypeSemantics()
1654 case BuiltinType::Float: return Target->getFloatFormat(); in getFloatTypeSemantics()
1655 case BuiltinType::Double: return Target->getDoubleFormat(); in getFloatTypeSemantics()
1657 return Target->getIbm128Format(); in getFloatTypeSemantics()
1660 return AuxTarget->getLongDoubleFormat(); in getFloatTypeSemantics()
1661 return Target->getLongDoubleFormat(); in getFloatTypeSemantics()
1664 return AuxTarget->getFloat128Format(); in getFloatTypeSemantics()
1665 return Target->getFloat128Format(); in getFloatTypeSemantics()
1670 unsigned Align = Target->getCharWidth(); in getDeclAlign()
1672 const unsigned AlignFromAttr = D->getMaxAlignment(); in getDeclAlign()
1685 FD->hasAttr<PackedAttr>() || FD->getParent()->hasAttr<PackedAttr>(); in getDeclAlign()
1693 QualType T = VD->getType(); in getDeclAlign()
1694 if (const auto *RT = T->getAs<ReferenceType>()) { in getDeclAlign()
1696 T = RT->getPointeeType(); in getDeclAlign()
1698 T = getPointerType(RT->getPointeeType()); in getDeclAlign()
1701 if (T->isFunctionType()) in getDeclAlign()
1703 else if (!BaseT->isIncompleteType()) { in getDeclAlign()
1705 // large-array alignment on the target. in getDeclAlign()
1707 unsigned MinWidth = Target->getLargeArrayMinWidth(); in getDeclAlign()
1710 Align = std::max(Align, Target->getLargeArrayAlign()); in getDeclAlign()
1713 Align = std::max(Align, Target->getLargeArrayAlign()); in getDeclAlign()
1718 Align = Target->getCharWidth(); in getDeclAlign()
1723 if (VD->hasGlobalStorage() && !ForAlignof) { in getDeclAlign()
1725 !BaseT->isIncompleteType() ? getTypeSize(T.getTypePtr()) : 0; in getDeclAlign()
1731 // a max-field-alignment constraint (#pragma pack). So calculate in getDeclAlign()
1735 const RecordDecl *Parent = Field->getParent(); in getDeclAlign()
1737 if (!Parent->isInvalidDecl()) { in getDeclAlign()
1744 uint64_t Offset = Layout.getFieldOffset(Field->getFieldIndex()); in getDeclAlign()
1762 if (MaxAlignedAttr && VD && VD->getStorageClass() == SC_Static) in getDeclAlign()
1769 return toCharUnitsFromBits(Target->getExnObjectAlignment()); in getExnObjectAlignment()
1772 // getTypeInfoDataSizeInChars - Return the size of a type, in
1780 // of a base-class subobject. We decide whether that's possible in getTypeInfoDataSizeInChars()
1783 if (const auto *RT = T->getAs<RecordType>(); in getTypeInfoDataSizeInChars()
1784 RT && !RT->getDecl()->isInvalidDecl()) { in getTypeInfoDataSizeInChars()
1785 const ASTRecordLayout &layout = getASTRecordLayout(RT->getDecl()); in getTypeInfoDataSizeInChars()
1793 /// getConstantArrayInfoInChars - Performing the computation in CharUnits
1798 TypeInfoChars EltInfo = Context.getTypeInfoInChars(CAT->getElementType()); in getConstantArrayInfoInChars()
1799 uint64_t Size = CAT->getZExtSize(); in getConstantArrayInfoInChars()
1801 (uint64_t)(-1)/Size) && in getConstantArrayInfoInChars()
1827 // just uses the rank-based promotion rules for all types. in isPromotableIntegerType()
1831 if (const auto *BT = T->getAs<BuiltinType>()) in isPromotableIntegerType()
1832 switch (BT->getKind()) { in isPromotableIntegerType()
1852 if (const auto *ET = T->getAs<EnumType>()) { in isPromotableIntegerType()
1853 if (T->isDependentType() || ET->getDecl()->getPromotionType().isNull() || in isPromotableIntegerType()
1854 ET->getDecl()->isScoped()) in isPromotableIntegerType()
1874 if (const auto *TT = T->getAs<TypedefType>()) in getTypeAlignIfKnown()
1875 if (unsigned Align = TT->getDecl()->getMaxAlignment()) in getTypeAlignIfKnown()
1880 if (!T->isIncompleteType()) in getTypeAlignIfKnown()
1885 if (const auto *TT = T->getAs<TypedefType>()) in getTypeAlignIfKnown()
1886 if (unsigned Align = TT->getDecl()->getMaxAlignment()) in getTypeAlignIfKnown()
1890 if (const auto *TT = T->getAs<TagType>()) in getTypeAlignIfKnown()
1891 return TT->getDecl()->getMaxAlignment(); in getTypeAlignIfKnown()
1899 return I->second; in getTypeInfo()
1907 /// getTypeInfoImpl - Return the size of the specified type, in bits. This
1918 switch (T->getTypeClass()) { in getTypeInfoImpl()
1925 assert(!T->isDependentType() && "should not see dependent types here"); \ in getTypeInfoImpl()
1926 return getTypeInfo(cast<Class##Type>(T)->desugar().getTypePtr()); in getTypeInfoImpl()
1941 // Model non-constant sized arrays as size zero, but track the alignment. in getTypeInfoImpl()
1944 Size = CAT->getZExtSize(); in getTypeInfoImpl()
1946 TypeInfo EltInfo = getTypeInfo(cast<ArrayType>(T)->getElementType()); in getTypeInfoImpl()
1947 assert((Size == 0 || EltInfo.Width <= (uint64_t)(-1) / Size) && in getTypeInfoImpl()
1961 TypeInfo EltInfo = getTypeInfo(VT->getElementType()); in getTypeInfoImpl()
1962 Width = VT->isExtVectorBoolType() ? VT->getNumElements() in getTypeInfoImpl()
1963 : EltInfo.Width * VT->getNumElements(); in getTypeInfoImpl()
1969 // This happens for non-power-of-2 length vectors. in getTypeInfoImpl()
1970 if (Align & (Align-1)) { in getTypeInfoImpl()
1975 uint64_t TargetVectorAlign = Target->getMaxVectorAlign(); in getTypeInfoImpl()
1978 if (VT->getVectorKind() == VectorKind::SveFixedLengthData) in getTypeInfoImpl()
1979 // Adjust the alignment for fixed-length SVE vectors. This is important in getTypeInfoImpl()
1980 // for non-power-of-2 vector lengths. in getTypeInfoImpl()
1982 else if (VT->getVectorKind() == VectorKind::SveFixedLengthPredicate) in getTypeInfoImpl()
1983 // Adjust the alignment for fixed-length SVE predicates. in getTypeInfoImpl()
1985 else if (VT->getVectorKind() == VectorKind::RVVFixedLengthData || in getTypeInfoImpl()
1986 VT->getVectorKind() == VectorKind::RVVFixedLengthMask) in getTypeInfoImpl()
1987 // Adjust the alignment for fixed-length RVV vectors. in getTypeInfoImpl()
1994 TypeInfo ElementInfo = getTypeInfo(MT->getElementType()); in getTypeInfoImpl()
1998 Width = ElementInfo.Width * MT->getNumRows() * MT->getNumColumns(); in getTypeInfoImpl()
2004 switch (cast<BuiltinType>(T)->getKind()) { in getTypeInfoImpl()
2012 Width = Target->getBoolWidth(); in getTypeInfoImpl()
2013 Align = Target->getBoolAlign(); in getTypeInfoImpl()
2020 Width = Target->getCharWidth(); in getTypeInfoImpl()
2021 Align = Target->getCharAlign(); in getTypeInfoImpl()
2025 Width = Target->getWCharWidth(); in getTypeInfoImpl()
2026 Align = Target->getWCharAlign(); in getTypeInfoImpl()
2029 Width = Target->getChar16Width(); in getTypeInfoImpl()
2030 Align = Target->getChar16Align(); in getTypeInfoImpl()
2033 Width = Target->getChar32Width(); in getTypeInfoImpl()
2034 Align = Target->getChar32Align(); in getTypeInfoImpl()
2038 Width = Target->getShortWidth(); in getTypeInfoImpl()
2039 Align = Target->getShortAlign(); in getTypeInfoImpl()
2043 Width = Target->getIntWidth(); in getTypeInfoImpl()
2044 Align = Target->getIntAlign(); in getTypeInfoImpl()
2048 Width = Target->getLongWidth(); in getTypeInfoImpl()
2049 Align = Target->getLongAlign(); in getTypeInfoImpl()
2053 Width = Target->getLongLongWidth(); in getTypeInfoImpl()
2054 Align = Target->getLongLongAlign(); in getTypeInfoImpl()
2059 Align = Target->getInt128Align(); in getTypeInfoImpl()
2065 Width = Target->getShortAccumWidth(); in getTypeInfoImpl()
2066 Align = Target->getShortAccumAlign(); in getTypeInfoImpl()
2072 Width = Target->getAccumWidth(); in getTypeInfoImpl()
2073 Align = Target->getAccumAlign(); in getTypeInfoImpl()
2079 Width = Target->getLongAccumWidth(); in getTypeInfoImpl()
2080 Align = Target->getLongAccumAlign(); in getTypeInfoImpl()
2086 Width = Target->getShortFractWidth(); in getTypeInfoImpl()
2087 Align = Target->getShortFractAlign(); in getTypeInfoImpl()
2093 Width = Target->getFractWidth(); in getTypeInfoImpl()
2094 Align = Target->getFractAlign(); in getTypeInfoImpl()
2100 Width = Target->getLongFractWidth(); in getTypeInfoImpl()
2101 Align = Target->getLongFractAlign(); in getTypeInfoImpl()
2104 if (Target->hasBFloat16Type()) { in getTypeInfoImpl()
2105 Width = Target->getBFloat16Width(); in getTypeInfoImpl()
2106 Align = Target->getBFloat16Align(); in getTypeInfoImpl()
2110 AuxTarget->hasBFloat16Type()) { in getTypeInfoImpl()
2111 Width = AuxTarget->getBFloat16Width(); in getTypeInfoImpl()
2112 Align = AuxTarget->getBFloat16Align(); in getTypeInfoImpl()
2117 if (Target->hasFloat16Type() || !getLangOpts().OpenMP || in getTypeInfoImpl()
2119 Width = Target->getHalfWidth(); in getTypeInfoImpl()
2120 Align = Target->getHalfAlign(); in getTypeInfoImpl()
2124 Width = AuxTarget->getHalfWidth(); in getTypeInfoImpl()
2125 Align = AuxTarget->getHalfAlign(); in getTypeInfoImpl()
2129 Width = Target->getFloatWidth(); in getTypeInfoImpl()
2130 Align = Target->getFloatAlign(); in getTypeInfoImpl()
2133 Width = Target->getDoubleWidth(); in getTypeInfoImpl()
2134 Align = Target->getDoubleAlign(); in getTypeInfoImpl()
2137 Width = Target->getIbm128Width(); in getTypeInfoImpl()
2138 Align = Target->getIbm128Align(); in getTypeInfoImpl()
2142 (Target->getLongDoubleWidth() != AuxTarget->getLongDoubleWidth() || in getTypeInfoImpl()
2143 Target->getLongDoubleAlign() != AuxTarget->getLongDoubleAlign())) { in getTypeInfoImpl()
2144 Width = AuxTarget->getLongDoubleWidth(); in getTypeInfoImpl()
2145 Align = AuxTarget->getLongDoubleAlign(); in getTypeInfoImpl()
2147 Width = Target->getLongDoubleWidth(); in getTypeInfoImpl()
2148 Align = Target->getLongDoubleAlign(); in getTypeInfoImpl()
2152 if (Target->hasFloat128Type() || !getLangOpts().OpenMP || in getTypeInfoImpl()
2154 Width = Target->getFloat128Width(); in getTypeInfoImpl()
2155 Align = Target->getFloat128Align(); in getTypeInfoImpl()
2159 Width = AuxTarget->getFloat128Width(); in getTypeInfoImpl()
2160 Align = AuxTarget->getFloat128Align(); in getTypeInfoImpl()
2165 Width = Target->getPointerWidth(LangAS::Default); in getTypeInfoImpl()
2166 Align = Target->getPointerAlign(LangAS::Default); in getTypeInfoImpl()
2171 Width = Target->getPointerWidth(LangAS::Default); in getTypeInfoImpl()
2172 Align = Target->getPointerAlign(LangAS::Default); in getTypeInfoImpl()
2185 AS = Target->getOpenCLTypeAddrSpace(getOpenCLTypeKind(T)); in getTypeInfoImpl()
2186 Width = Target->getPointerWidth(AS); in getTypeInfoImpl()
2187 Align = Target->getPointerAlign(AS); in getTypeInfoImpl()
2189 // The SVE types are effectively target-specific. The length of an in getTypeInfoImpl()
2248 Width = Target->getPointerWidth(LangAS::Default); in getTypeInfoImpl()
2249 Align = Target->getPointerAlign(LangAS::Default); in getTypeInfoImpl()
2252 AS = cast<BlockPointerType>(T)->getPointeeType().getAddressSpace(); in getTypeInfoImpl()
2253 Width = Target->getPointerWidth(AS); in getTypeInfoImpl()
2254 Align = Target->getPointerAlign(AS); in getTypeInfoImpl()
2260 AS = cast<ReferenceType>(T)->getPointeeType().getAddressSpace(); in getTypeInfoImpl()
2261 Width = Target->getPointerWidth(AS); in getTypeInfoImpl()
2262 Align = Target->getPointerAlign(AS); in getTypeInfoImpl()
2265 AS = cast<PointerType>(T)->getPointeeType().getAddressSpace(); in getTypeInfoImpl()
2266 Width = Target->getPointerWidth(AS); in getTypeInfoImpl()
2267 Align = Target->getPointerAlign(AS); in getTypeInfoImpl()
2271 CXXABI::MemberPointerInfo MPI = ABI->getMemberPointerInfo(MPT); in getTypeInfoImpl()
2279 TypeInfo EltInfo = getTypeInfo(cast<ComplexType>(T)->getElementType()); in getTypeInfoImpl()
2285 return getTypeInfo(cast<ObjCObjectType>(T)->getBaseType().getTypePtr()); in getTypeInfoImpl()
2288 return getTypeInfo(cast<AdjustedType>(T)->getAdjustedType().getTypePtr()); in getTypeInfoImpl()
2291 if (ObjCI->getDecl()->isInvalidDecl()) { in getTypeInfoImpl()
2296 const ASTRecordLayout &Layout = getASTObjCInterfaceLayout(ObjCI->getDecl()); in getTypeInfoImpl()
2303 Align = Target->getBitIntAlign(EIT->getNumBits()); in getTypeInfoImpl()
2304 Width = Target->getBitIntWidth(EIT->getNumBits()); in getTypeInfoImpl()
2311 if (TT->getDecl()->isInvalidDecl()) { in getTypeInfoImpl()
2318 const EnumDecl *ED = ET->getDecl(); in getTypeInfoImpl()
2320 getTypeInfo(ED->getIntegerType()->getUnqualifiedDesugaredType()); in getTypeInfoImpl()
2321 if (unsigned AttrAlign = ED->getMaxAlignment()) { in getTypeInfoImpl()
2329 const RecordDecl *RD = RT->getDecl(); in getTypeInfoImpl()
2333 AlignRequirement = RD->hasAttr<AlignedAttr>() in getTypeInfoImpl()
2340 return getTypeInfo(cast<SubstTemplateTypeParmType>(T)-> in getTypeInfoImpl()
2346 assert(!A->getDeducedType().isNull() && in getTypeInfoImpl()
2348 return getTypeInfo(A->getDeducedType().getTypePtr()); in getTypeInfoImpl()
2352 return getTypeInfo(cast<ParenType>(T)->getInnerType().getTypePtr()); in getTypeInfoImpl()
2356 cast<MacroQualifiedType>(T)->getUnderlyingType().getTypePtr()); in getTypeInfoImpl()
2359 return getTypeInfo(cast<ObjCTypeParamType>(T)->desugar().getTypePtr()); in getTypeInfoImpl()
2362 return getTypeInfo(cast<UsingType>(T)->desugar().getTypePtr()); in getTypeInfoImpl()
2366 TypeInfo Info = getTypeInfo(TT->desugar().getTypePtr()); in getTypeInfoImpl()
2370 if (unsigned AttrAlign = TT->getDecl()->getMaxAlignment()) { in getTypeInfoImpl()
2382 return getTypeInfo(cast<ElaboratedType>(T)->getNamedType().getTypePtr()); in getTypeInfoImpl()
2386 cast<AttributedType>(T)->getEquivalentType().getTypePtr()); in getTypeInfoImpl()
2389 return getTypeInfo(cast<CountAttributedType>(T)->desugar().getTypePtr()); in getTypeInfoImpl()
2393 cast<BTFTagAttributedType>(T)->getWrappedType().getTypePtr()); in getTypeInfoImpl()
2397 TypeInfo Info = getTypeInfo(cast<AtomicType>(T)->getValueType()); in getTypeInfoImpl()
2402 // An otherwise zero-sized type should still generate an in getTypeInfoImpl()
2404 Width = Target->getCharWidth(); in getTypeInfoImpl()
2406 } else if (Width <= Target->getMaxAtomicPromoteWidth()) { in getTypeInfoImpl()
2421 Width = Target->getPointerWidth(LangAS::opencl_global); in getTypeInfoImpl()
2422 Align = Target->getPointerAlign(LangAS::opencl_global); in getTypeInfoImpl()
2433 return I->second; in getTypeUnadjustedAlign()
2436 if (const auto *RT = T->getAs<RecordType>()) { in getTypeUnadjustedAlign()
2437 const RecordDecl *RD = RT->getDecl(); in getTypeUnadjustedAlign()
2440 } else if (const auto *ObjCI = T->getAs<ObjCInterfaceType>()) { in getTypeUnadjustedAlign()
2441 const ASTRecordLayout &Layout = getASTObjCInterfaceLayout(ObjCI->getDecl()); in getTypeUnadjustedAlign()
2444 UnadjustedAlign = getTypeAlign(T->getUnqualifiedDesugaredType()); in getTypeUnadjustedAlign()
2453 getTargetInfo().getTriple(), Target->getTargetOpts().FeatureMap); in getOpenMPDefaultSimdAlign()
2457 /// toCharUnitsFromBits - Convert a size in bits to a size in characters.
2462 /// toBits - Convert a size in characters to a size in characters.
2467 /// getTypeSizeInChars - Return the size of the specified type, in characters.
2476 /// getTypeAlignInChars - Return the ABI-specified alignment of a type, in
2485 /// getTypeUnadjustedAlignInChars - Return the ABI-specified alignment of a
2495 /// getPreferredTypeAlign - Return the "preferred" alignment of the specified
2499 /// the preferred alignment is ABI-impacting, and not an optimization.)
2504 T = T->getBaseElementTypeUnsafe(); in getPreferredTypeAlign()
2507 if (T->isMemberPointerType()) in getPreferredTypeAlign()
2510 if (!Target->allowsLargerPreferedTypeAlignment()) in getPreferredTypeAlign()
2513 if (const auto *RT = T->getAs<RecordType>()) { in getPreferredTypeAlign()
2514 const RecordDecl *RD = RT->getDecl(); in getPreferredTypeAlign()
2521 RD->isInvalidDecl()) in getPreferredTypeAlign()
2534 if (const auto *CT = T->getAs<ComplexType>()) in getPreferredTypeAlign()
2535 T = CT->getElementType().getTypePtr(); in getPreferredTypeAlign()
2536 if (const auto *ET = T->getAs<EnumType>()) in getPreferredTypeAlign()
2537 T = ET->getDecl()->getIntegerType().getTypePtr(); in getPreferredTypeAlign()
2538 if (T->isSpecificBuiltinType(BuiltinType::Double) || in getPreferredTypeAlign()
2539 T->isSpecificBuiltinType(BuiltinType::LongLong) || in getPreferredTypeAlign()
2540 T->isSpecificBuiltinType(BuiltinType::ULongLong) || in getPreferredTypeAlign()
2541 (T->isSpecificBuiltinType(BuiltinType::LongDouble) && in getPreferredTypeAlign()
2542 Target->defaultsToAIXPowerAlignment())) in getPreferredTypeAlign()
2551 /// getTargetDefaultAlignForAttributeAligned - Return the default alignment
2558 /// getAlignOfGlobalVar - Return the alignment in bits that should be given
2566 /// getAlignOfGlobalVarInChars - Return the alignment in characters that
2575 // Make the default handling as that of a non-weak definition in the in getMinGlobalAlignOfVar()
2577 bool HasNonWeakDef = !VD || (VD->hasDefinition() && !VD->isWeak()); in getMinGlobalAlignOfVar()
2584 while (const CXXRecordDecl *Base = Layout->getBaseSharingVBPtr()) { in getOffsetOfBaseWithVBPtr()
2585 Offset += Layout->getBaseClassOffset(Base); in getOffsetOfBaseWithVBPtr()
2596 const CXXRecordDecl *RD = cast<CXXRecordDecl>(MPD->getDeclContext()); in getMemberPointerPathAdjustment()
2606 ThisAdjustment = -ThisAdjustment; in getMemberPointerPathAdjustment()
2610 /// DeepCollectObjCIvars -
2618 if (const ObjCInterfaceDecl *SuperClass = OI->getSuperClass()) in DeepCollectObjCIvars()
2621 llvm::append_range(Ivars, OI->ivars()); in DeepCollectObjCIvars()
2624 for (const ObjCIvarDecl *Iv = IDecl->all_declared_ivar_begin(); Iv; in DeepCollectObjCIvars()
2625 Iv= Iv->getNextIvar()) in DeepCollectObjCIvars()
2630 /// CollectInheritedProtocols - Collect all protocols in current class and
2637 for (auto *Proto : OI->all_referenced_protocols()) { in CollectInheritedProtocols()
2642 for (const auto *Cat : OI->visible_categories()) in CollectInheritedProtocols()
2645 if (ObjCInterfaceDecl *SD = OI->getSuperClass()) in CollectInheritedProtocols()
2648 SD = SD->getSuperClass(); in CollectInheritedProtocols()
2651 for (auto *Proto : OC->protocols()) { in CollectInheritedProtocols()
2657 const_cast<ObjCProtocolDecl *>(OP->getCanonicalDecl())).second) in CollectInheritedProtocols()
2660 for (auto *Proto : OP->protocols()) in CollectInheritedProtocols()
2668 assert(RD->isUnion() && "Must be union type"); in unionHasUniqueObjectRepresentations()
2669 CharUnits UnionSize = Context.getTypeSizeInChars(RD->getTypeForDecl()); in unionHasUniqueObjectRepresentations()
2671 for (const auto *Field : RD->fields()) { in unionHasUniqueObjectRepresentations()
2672 if (!Context.hasUniqueObjectRepresentations(Field->getType(), in unionHasUniqueObjectRepresentations()
2675 CharUnits FieldSize = Context.getTypeSizeInChars(Field->getType()); in unionHasUniqueObjectRepresentations()
2679 return !RD->field_empty(); in unionHasUniqueObjectRepresentations()
2702 if (Field->getType()->isRecordType()) { in getSubobjectSizeInBits()
2703 const RecordDecl *RD = Field->getType()->getAsRecordDecl(); in getSubobjectSizeInBits()
2704 if (!RD->isUnion()) in getSubobjectSizeInBits()
2711 bool IsBitIntType = Field->getType()->isBitIntType(); in getSubobjectSizeInBits()
2712 if (!Field->getType()->isReferenceType() && !IsBitIntType && in getSubobjectSizeInBits()
2713 !Context.hasUniqueObjectRepresentations(Field->getType(), in getSubobjectSizeInBits()
2718 Context.toBits(Context.getTypeSizeInChars(Field->getType())); in getSubobjectSizeInBits()
2719 if (Field->isBitField()) { in getSubobjectSizeInBits()
2722 if (Field->isUnnamedBitField()) in getSubobjectSizeInBits()
2725 int64_t BitfieldSize = Field->getBitWidthValue(Context); in getSubobjectSizeInBits()
2728 cast<BitIntType>(Field->getType())->getNumBits()) in getSubobjectSizeInBits()
2735 Field->getType(), CheckIfTriviallyCopyable)) { in getSubobjectSizeInBits()
2772 assert(!RD->isUnion() && "Must be struct/class type"); in structHasUniqueObjectRepresentations()
2777 if (ClassDecl->isDynamicClass()) in structHasUniqueObjectRepresentations()
2781 for (const auto &Base : ClassDecl->bases()) { in structHasUniqueObjectRepresentations()
2782 // Empty types can be inherited from, and non-empty types can potentially in structHasUniqueObjectRepresentations()
2784 Bases.emplace_back(Base.getType()->getAsCXXRecordDecl()); in structHasUniqueObjectRepresentations()
2801 RD->fields(), CurOffsetInBits, Context, Layout, in structHasUniqueObjectRepresentations()
2815 // (9.1) - T is trivially copyable, and in hasUniqueObjectRepresentations()
2816 // (9.2) - any two objects of type T with the same value have the same in hasUniqueObjectRepresentations()
2818 // - two objects of array or non-union class type are considered to have in hasUniqueObjectRepresentations()
2821 // - two objects of union type are considered to have the same value if in hasUniqueObjectRepresentations()
2825 // implementation-defined. [ Note: If a type has padding bits, the condition in hasUniqueObjectRepresentations()
2827 // types. -- end note ] in hasUniqueObjectRepresentations()
2831 if (Ty->isArrayType()) in hasUniqueObjectRepresentations()
2835 assert((Ty->isVoidType() || !Ty->isIncompleteType()) && in hasUniqueObjectRepresentations()
2839 // (9.1) - T is trivially copyable... in hasUniqueObjectRepresentations()
2844 if (Ty->isIntegralOrEnumerationType()) { in hasUniqueObjectRepresentations()
2846 if (const auto *BIT = Ty->getAs<BitIntType>()) in hasUniqueObjectRepresentations()
2847 return getTypeSize(BIT) == BIT->getNumBits(); in hasUniqueObjectRepresentations()
2853 if (Ty->isPointerType()) in hasUniqueObjectRepresentations()
2856 if (const auto *MPT = Ty->getAs<MemberPointerType>()) in hasUniqueObjectRepresentations()
2857 return !ABI->getMemberPointerInfo(MPT).HasPadding; in hasUniqueObjectRepresentations()
2859 if (Ty->isRecordType()) { in hasUniqueObjectRepresentations()
2860 const RecordDecl *Record = Ty->castAs<RecordType>()->getDecl(); in hasUniqueObjectRepresentations()
2862 if (Record->isInvalidDecl()) in hasUniqueObjectRepresentations()
2865 if (Record->isUnion()) in hasUniqueObjectRepresentations()
2879 // Obj-C block pointers in hasUniqueObjectRepresentations()
2880 // Obj-C object pointers in hasUniqueObjectRepresentations()
2883 // There're also Obj-C class types and the Obj-C selector type, but I think it in hasUniqueObjectRepresentations()
2892 for (const auto *Ext : OI->known_extensions()) in CountNonClassIvars()
2893 count += Ext->ivar_size(); in CountNonClassIvars()
2897 if (ObjCImplementationDecl *ImplDecl = OI->getImplementation()) in CountNonClassIvars()
2898 count += ImplDecl->ivar_size(); in CountNonClassIvars()
2908 if (E->getType()->isNullPtrType()) return true; in isSentinelNullExpr()
2910 if (E->getType()->isAnyPointerType() && in isSentinelNullExpr()
2911 E->IgnoreParenCasts()->isNullPointerConstant(*this, in isSentinelNullExpr()
2927 return cast<ObjCImplementationDecl>(I->second); in getObjCImplementation()
2937 return cast<ObjCCategoryImplDecl>(I->second); in getObjCImplementation()
2944 assert(IFaceD && ImplD && "Passed null params"); in setObjCImplementation()
2951 assert(CatD && ImplD && "Passed null params"); in setObjCImplementation()
2968 if (const auto *ID = dyn_cast<ObjCInterfaceDecl>(ND->getDeclContext())) in getObjContainingInterface()
2970 if (const auto *CD = dyn_cast<ObjCCategoryDecl>(ND->getDeclContext())) in getObjContainingInterface()
2971 return CD->getClassInterface(); in getObjContainingInterface()
2972 if (const auto *IMD = dyn_cast<ObjCImplDecl>(ND->getDeclContext())) in getObjContainingInterface()
2973 return IMD->getClassInterface(); in getObjContainingInterface()
2981 assert(VD && "Passed null params"); in getBlockVarCopyInit()
2982 assert(VD->hasAttr<BlocksAttr>() && in getBlockVarCopyInit()
2983 "getBlockVarCopyInits - not __block var"); in getBlockVarCopyInit()
2986 return I->second; in getBlockVarCopyInit()
2993 assert(VD && CopyExpr && "Passed null params"); in setBlockVarCopyInit()
2994 assert(VD->hasAttr<BlocksAttr>() && in setBlockVarCopyInit()
2995 "setBlockVarCopyInits - not __block var"); in setBlockVarCopyInit()
3016 DI->getTypeLoc().initialize(const_cast<ASTContext &>(*this), L); in getTrivialTypeSourceInfo()
3028 return getObjCLayout(D->getClassInterface(), D); in getASTObjCImplementationLayout()
3043 //===----------------------------------------------------------------------===//
3045 //===----------------------------------------------------------------------===//
3057 assert(eq->getQualifiers() == quals); in getExtQualType()
3063 if (!baseType->isCanonicalUnqualified()) { in getExtQualType()
3064 SplitQualType canonSplit = baseType->getCanonicalTypeInternal().split(); in getExtQualType()
3068 // Re-find the insert position. in getExtQualType()
3107 if (T.getTypePtr()->isArrayType()) { in removeAddrSpaceQualType()
3129 // non-fast qualifiers, so creating an ExtQualType isn't possible (asserts) in removeAddrSpaceQualType()
3139 assert(RD->isPolymorphic() && in getPointerAuthVTablePointerDiscriminator()
3144 MC->mangleCXXVTable(RD, Out); in getPointerAuthVTablePointerDiscriminator()
3171 switch (T->getTypeClass()) { in encodeTypeForFunctionPointerAuth()
3174 Ctx, OS, cast<AtomicType>(T)->getValueType()); in encodeTypeForFunctionPointerAuth()
3179 cast<ReferenceType>(T)->getPointeeType()); in encodeTypeForFunctionPointerAuth()
3184 cast<ReferenceType>(T)->getPointeeType()); in encodeTypeForFunctionPointerAuth()
3203 Ctx, OS, cast<ComplexType>(T)->getElementType()); in encodeTypeForFunctionPointerAuth()
3219 Ctx, OS, cast<ArrayType>(T)->getElementType()); in encodeTypeForFunctionPointerAuth()
3232 QualType UnderlyingType = cast<EnumType>(T)->getDecl()->getIntegerType(); in encodeTypeForFunctionPointerAuth()
3248 // what the user meant. This behavior is non-conforming. in encodeTypeForFunctionPointerAuth()
3253 encodeTypeForFunctionPointerAuth(Ctx, OS, FuncType->getReturnType()); in encodeTypeForFunctionPointerAuth()
3255 for (QualType Param : FPT->param_types()) { in encodeTypeForFunctionPointerAuth()
3259 if (FPT->isVariadic()) in encodeTypeForFunctionPointerAuth()
3268 const auto *MPT = T->getAs<MemberPointerType>(); in encodeTypeForFunctionPointerAuth()
3269 encodeTypeForFunctionPointerAuth(Ctx, OS, QualType(MPT->getClass(), 0)); in encodeTypeForFunctionPointerAuth()
3270 encodeTypeForFunctionPointerAuth(Ctx, OS, MPT->getPointeeType()); in encodeTypeForFunctionPointerAuth()
3286 const auto *BTy = T->getAs<BuiltinType>(); in encodeTypeForFunctionPointerAuth()
3287 switch (BTy->getKind()) { in encodeTypeForFunctionPointerAuth()
3343 // Don't bother discriminating based on these seldom-used types. in encodeTypeForFunctionPointerAuth()
3368 const RecordDecl *RD = T->getAs<RecordType>()->getDecl(); in encodeTypeForFunctionPointerAuth()
3369 const IdentifierInfo *II = RD->getIdentifier(); in encodeTypeForFunctionPointerAuth()
3387 if (const TypedefNameDecl *Typedef = RD->getTypedefNameForAnonDecl()) in encodeTypeForFunctionPointerAuth()
3388 II = Typedef->getDeclName().getAsIdentifierInfo(); in encodeTypeForFunctionPointerAuth()
3394 OS << II->getLength() << II->getName(); in encodeTypeForFunctionPointerAuth()
3405 llvm_unreachable("unexpected non-canonical or dependent type!"); in encodeTypeForFunctionPointerAuth()
3411 assert(!T->isDependentType() && in getPointerAuthTypeDiscriminator()
3417 if (T->isFunctionPointerType() || T->isFunctionReferenceType()) in getPointerAuthTypeDiscriminator()
3418 T = T->getPointeeType(); in getPointerAuthTypeDiscriminator()
3420 if (T->isFunctionType()) { in getPointerAuthTypeDiscriminator()
3425 MC->mangleCanonicalTypeName(T, Out); in getPointerAuthTypeDiscriminator()
3437 if (const auto *ptr = T->getAs<PointerType>()) { in getObjCGCQualType()
3438 QualType Pointee = ptr->getPointeeType(); in getObjCGCQualType()
3439 if (Pointee->isAnyPointerType()) { in getObjCGCQualType()
3460 if (const PointerType *Ptr = T->getAs<PointerType>()) { in removePtrSizeAddrSpace()
3461 QualType Pointee = Ptr->getPointeeType(); in removePtrSizeAddrSpace()
3472 assert(WrappedTy->isPointerType() || WrappedTy->isArrayType()); in getCountAttributedType()
3497 if (T->getExtInfo() == Info) in adjustFunctionType()
3502 Result = getFunctionNoProtoType(FNPT->getReturnType(), Info); in adjustFunctionType()
3505 FunctionProtoType::ExtProtoInfo EPI = FPT->getExtProtoInfo(); in adjustFunctionType()
3507 Result = getFunctionType(FPT->getReturnType(), FPT->getParamTypes(), EPI); in adjustFunctionType()
3515 FD = FD->getMostRecentDecl(); in adjustDeducedFunctionResultType()
3517 const auto *FPT = FD->getType()->castAs<FunctionProtoType>(); in adjustDeducedFunctionResultType()
3518 FunctionProtoType::ExtProtoInfo EPI = FPT->getExtProtoInfo(); in adjustDeducedFunctionResultType()
3519 FD->setType(getFunctionType(ResultType, FPT->getParamTypes(), EPI)); in adjustDeducedFunctionResultType()
3520 if (FunctionDecl *Next = FD->getPreviousDecl()) in adjustDeducedFunctionResultType()
3526 L->DeducedReturnType(FD, ResultType); in adjustDeducedFunctionResultType()
3538 getFunctionTypeWithExceptionSpec(PT->getInnerType(), ESI)); in getFunctionTypeWithExceptionSpec()
3543 getFunctionTypeWithExceptionSpec(MQT->getUnderlyingType(), ESI), in getFunctionTypeWithExceptionSpec()
3544 MQT->getMacroIdentifier()); in getFunctionTypeWithExceptionSpec()
3546 // Might have a calling-convention attribute. in getFunctionTypeWithExceptionSpec()
3549 AT->getAttrKind(), in getFunctionTypeWithExceptionSpec()
3550 getFunctionTypeWithExceptionSpec(AT->getModifiedType(), ESI), in getFunctionTypeWithExceptionSpec()
3551 getFunctionTypeWithExceptionSpec(AT->getEquivalentType(), ESI)); in getFunctionTypeWithExceptionSpec()
3555 const auto *Proto = Orig->castAs<FunctionProtoType>(); in getFunctionTypeWithExceptionSpec()
3557 Proto->getReturnType(), Proto->getParamTypes(), in getFunctionTypeWithExceptionSpec()
3558 Proto->getExtProtoInfo().withExceptionSpec(ESI)); in getFunctionTypeWithExceptionSpec()
3570 if (const auto *Proto = T->getAs<FunctionProtoType>()) { in getFunctionTypeWithoutPtrSizes()
3571 QualType RetTy = removePtrSizeAddrSpace(Proto->getReturnType()); in getFunctionTypeWithoutPtrSizes()
3572 SmallVector<QualType, 16> Args(Proto->param_types().size()); in getFunctionTypeWithoutPtrSizes()
3574 Args[i] = removePtrSizeAddrSpace(Proto->param_types()[i]); in getFunctionTypeWithoutPtrSizes()
3575 return getFunctionType(RetTy, Args, Proto->getExtProtoInfo()); in getFunctionTypeWithoutPtrSizes()
3578 if (const FunctionNoProtoType *Proto = T->getAs<FunctionNoProtoType>()) { in getFunctionTypeWithoutPtrSizes()
3579 QualType RetTy = removePtrSizeAddrSpace(Proto->getReturnType()); in getFunctionTypeWithoutPtrSizes()
3580 return getFunctionNoProtoType(RetTy, Proto->getExtInfo()); in getFunctionTypeWithoutPtrSizes()
3597 getFunctionTypeWithExceptionSpec(FD->getType(), ESI); in adjustExceptionSpec()
3598 FD->setType(Updated); in adjustExceptionSpec()
3604 if (TypeSourceInfo *TSInfo = FD->getTypeSourceInfo()) { in adjustExceptionSpec()
3605 // If the type and the type-as-written differ, we may need to update in adjustExceptionSpec()
3606 // the type-as-written too. in adjustExceptionSpec()
3607 if (TSInfo->getType() != FD->getType()) in adjustExceptionSpec()
3608 Updated = getFunctionTypeWithExceptionSpec(TSInfo->getType(), ESI); in adjustExceptionSpec()
3614 TypeLoc::getFullDataSizeForType(TSInfo->getType()) && in adjustExceptionSpec()
3616 TSInfo->overrideType(Updated); in adjustExceptionSpec()
3620 /// getComplexType - Return the uniqued reference to the type for a complex
3648 /// getPointerType - Return the uniqued reference to the type for a pointer to
3718 assert((T->isArrayType() || T->isFunctionType()) && "T does not decay"); in getDecayedType()
3727 if (T->isArrayType()) in getDecayedType()
3734 if (T->isFunctionType()) in getDecayedType()
3741 if (Ty->isArrayParameterType()) in getArrayParameterType()
3743 assert(Ty->isConstantArrayType() && "Ty must be an array type."); in getArrayParameterType()
3746 ATy->Profile(ID, *this, ATy->getElementType(), ATy->getZExtSize(), in getArrayParameterType()
3747 ATy->getSizeExpr(), ATy->getSizeModifier(), in getArrayParameterType()
3748 ATy->getIndexTypeQualifiers().getAsOpaqueValue()); in getArrayParameterType()
3771 /// getBlockPointerType - Return the uniqued reference to the type for
3774 assert(T->isFunctionType() && "block of function types only"); in getBlockPointerType()
3803 /// getLValueReferenceType - Return the uniqued reference to the type for an
3807 assert((!T->isPlaceholderType() || in getLValueReferenceType()
3808 T->isSpecificPlaceholderType(BuiltinType::UnknownAny)) && in getLValueReferenceType()
3821 const auto *InnerRef = T->getAs<ReferenceType>(); in getLValueReferenceType()
3827 QualType PointeeType = (InnerRef ? InnerRef->getPointeeType() : T); in getLValueReferenceType()
3844 /// getRValueReferenceType - Return the uniqued reference to the type for an
3847 assert((!T->isPlaceholderType() || in getRValueReferenceType()
3848 T->isSpecificPlaceholderType(BuiltinType::UnknownAny)) && in getRValueReferenceType()
3861 const auto *InnerRef = T->getAs<ReferenceType>(); in getRValueReferenceType()
3867 QualType PointeeType = (InnerRef ? InnerRef->getPointeeType() : T); in getRValueReferenceType()
3883 /// getMemberPointerType - Return the uniqued reference to the type for a
3899 if (!T.isCanonical() || !Cls->isCanonicalUnqualified()) { in getMemberPointerType()
3914 /// getConstantArrayType - Return the unique reference to the type for an
3921 assert((EltTy->isDependentType() || in getConstantArrayType()
3922 EltTy->isIncompleteType() || EltTy->isConstantSizeType()) && in getConstantArrayType()
3925 // We only need the size as part of the type if it's instantiation-dependent. in getConstantArrayType()
3926 if (SizeExpr && !SizeExpr->isInstantiationDependent()) in getConstantArrayType()
3932 ArySize = ArySize.zextOrTrunc(Target->getMaxPointerWidth()); in getConstantArrayType()
3944 // is instantiation-dependent, this won't be a canonical type either, so fill in getConstantArrayType()
3967 /// getVariableArrayDecayedType - Turns the given type, which may be
3968 /// variably-modified, into the corresponding type with all the known
3972 if (!type->isVariablyModifiedType()) return type; in getVariableArrayDecayedType()
3978 switch (ty->getTypeClass()) { in getVariableArrayDecayedType()
3983 llvm_unreachable("didn't desugar past all non-canonical types?"); in getVariableArrayDecayedType()
3985 // These types should never be variably-modified. in getVariableArrayDecayedType()
4018 llvm_unreachable("type should never be variably-modified"); in getVariableArrayDecayedType()
4020 // These types can be variably-modified but should never need to in getVariableArrayDecayedType()
4029 // These types can be variably-modified. All these modifications in getVariableArrayDecayedType()
4031 // TODO: if we ever care about optimizing VLAs, there are no-op in getVariableArrayDecayedType()
4035 cast<PointerType>(ty)->getPointeeType())); in getVariableArrayDecayedType()
4041 getVariableArrayDecayedType(lv->getPointeeType()), in getVariableArrayDecayedType()
4042 lv->isSpelledAsLValue()); in getVariableArrayDecayedType()
4049 getVariableArrayDecayedType(lv->getPointeeType())); in getVariableArrayDecayedType()
4055 result = getAtomicType(getVariableArrayDecayedType(at->getValueType())); in getVariableArrayDecayedType()
4062 getVariableArrayDecayedType(cat->getElementType()), in getVariableArrayDecayedType()
4063 cat->getSize(), in getVariableArrayDecayedType()
4064 cat->getSizeExpr(), in getVariableArrayDecayedType()
4065 cat->getSizeModifier(), in getVariableArrayDecayedType()
4066 cat->getIndexTypeCVRQualifiers()); in getVariableArrayDecayedType()
4073 getVariableArrayDecayedType(dat->getElementType()), in getVariableArrayDecayedType()
4074 dat->getSizeExpr(), in getVariableArrayDecayedType()
4075 dat->getSizeModifier(), in getVariableArrayDecayedType()
4076 dat->getIndexTypeCVRQualifiers(), in getVariableArrayDecayedType()
4077 dat->getBracketsRange()); in getVariableArrayDecayedType()
4085 getVariableArrayType(getVariableArrayDecayedType(iat->getElementType()), in getVariableArrayDecayedType()
4087 iat->getIndexTypeCVRQualifiers(), SourceRange()); in getVariableArrayDecayedType()
4095 getVariableArrayDecayedType(vat->getElementType()), in getVariableArrayDecayedType()
4097 vat->getIndexTypeCVRQualifiers(), vat->getBracketsRange()); in getVariableArrayDecayedType()
4102 // Apply the top-level qualifiers from the original. in getVariableArrayDecayedType()
4106 /// getVariableArrayType - Returns a non-unique reference to the type for a
4133 /// getDependentSizedArrayType - Returns a non-unique reference to
4134 /// the type for a dependently-sized array of the specified element
4141 assert((!numElements || numElements->isTypeDependent() || in getDependentSizedArrayType()
4142 numElements->isValueDependent()) && in getDependentSizedArrayType()
4143 "Size must be type- or value-dependent!"); in getDependentSizedArrayType()
4157 // Dependently-sized array types that do not have a specified number in getDependentSizedArrayType()
4188 canonTy->getSizeExpr() == numElements) in getDependentSizedArrayType()
4246 switch (Ty->getKind()) { in getBuiltinVectorTypeInfo()
4370 /// getExternrefType - Return a WebAssembly externref type, which represents an
4373 if (Target->getTriple().isWasm() && Target->hasFeature("reference-types")) { in getWebAssemblyExternrefType()
4383 /// getScalableVectorType - Return the unique reference to a scalable vector
4384 /// type of the specified element type and size. VectorType must be a built-in
4388 if (Target->hasAArch64SVETypes()) { in getScalableVectorType()
4392 if (!EltTy->isBooleanType() && \ in getScalableVectorType()
4393 ((EltTy->hasIntegerRepresentation() && \ in getScalableVectorType()
4394 EltTy->hasSignedIntegerRepresentation() == IsSigned) || \ in getScalableVectorType()
4395 (EltTy->hasFloatingRepresentation() && !EltTy->isBFloat16Type() && \ in getScalableVectorType()
4397 (EltTy->hasFloatingRepresentation() && EltTy->isBFloat16Type() && \ in getScalableVectorType()
4403 if (EltTy->isBooleanType() && NumElts == NumEls) \ in getScalableVectorType()
4407 } else if (Target->hasRISCVVTypes()) { in getScalableVectorType()
4411 if (!EltTy->isBooleanType() && \ in getScalableVectorType()
4412 ((EltTy->hasIntegerRepresentation() && \ in getScalableVectorType()
4413 EltTy->hasSignedIntegerRepresentation() == IsSigned) || \ in getScalableVectorType()
4414 (EltTy->hasFloatingRepresentation() && !EltTy->isBFloat16Type() && \ in getScalableVectorType()
4416 (EltTy->hasFloatingRepresentation() && EltTy->isBFloat16Type() && \ in getScalableVectorType()
4421 if (EltTy->isBooleanType() && NumElts == NumEls) \ in getScalableVectorType()
4428 /// getVectorType - Return the unique reference to a vector type of
4429 /// the specified element type and size. VectorType must be a built-in type.
4432 assert(vecType->isBuiltinType() || in getVectorType()
4433 (vecType->isBitIntType() && in getVectorType()
4434 // Only support _BitInt elements with byte-sized power of 2 NumBits. in getVectorType()
4435 llvm::isPowerOf2_32(vecType->castAs<BitIntType>()->getNumBits()) && in getVectorType()
4436 vecType->castAs<BitIntType>()->getNumBits() >= 8)); in getVectorType()
4486 "Dependent-sized vector_size canonical type broken"); in getDependentVectorType()
4501 /// getExtVectorType - Return the unique reference to an extended vector type of
4502 /// the specified element type and size. VectorType must be a built-in type.
4505 assert(vecType->isBuiltinType() || vecType->isDependentType() || in getExtVectorType()
4506 (vecType->isBitIntType() && in getExtVectorType()
4507 // Only support _BitInt elements with byte-sized power of 2 NumBits. in getExtVectorType()
4508 llvm::isPowerOf2_32(vecType->castAs<BitIntType>()->getNumBits()) && in getExtVectorType()
4509 vecType->castAs<BitIntType>()->getNumBits() >= 8)); in getExtVectorType()
4550 // the canonical type for a newly-built type. in getDependentSizedExtVectorType()
4562 assert(!CanonCheck && "Dependent-sized ext_vector canonical type broken"); in getDependentSizedExtVectorType()
4629 assert(!CanonCheck && "Dependent-sized matrix canonical type broken"); in getDependentSizedMatrixType()
4638 if (Canon->getElementType() == ElementTy && Canon->getRowExpr() == RowExpr && in getDependentSizedMatrixType()
4639 Canon->getRowExpr() == ColumnExpr) in getDependentSizedMatrixType()
4642 // Use Canon as the canonical type for newly-built type. in getDependentSizedMatrixType()
4653 assert(AddrSpaceExpr->isInstantiationDependent()); in getDependentAddressSpaceType()
4674 canonTy->getAddrSpaceExpr() == AddrSpaceExpr) in getDependentAddressSpaceType()
4691 /// getFunctionNoProtoType - Return a K&R style C function type like 'int()'.
4758 // value-dependent. in isCanonicalExceptionSpecification()
4763 // expansions (so we can't tell whether it's non-throwing) and all its in isCanonicalExceptionSpecification()
4770 if (ET->getAs<PackExpansionType>()) in isCanonicalExceptionSpecification()
4798 // If we find a pre-existing equivalent FunctionProtoType, we can just reuse in getFunctionTypeInternal()
4804 EPI.ExceptionSpec.NoexceptExpr == FPT->getNoexceptExpr()) in getFunctionTypeInternal()
4827 "given non-canonical parameters constructing canonical type"); in getFunctionTypeInternal()
4847 // We don't know yet. It shouldn't matter what we pick here; no-one in getFunctionTypeInternal()
4859 if (ET->getAs<PackExpansionType>()) in getFunctionTypeInternal()
4979 assert(NumBitsExpr->isInstantiationDependent() && "Only good for dependent"); in getDependentBitIntType()
5002 if (RD->getDescribedClassTemplate() && in NeedsInjectedClassNameType()
5009 /// getInjectedClassNameType - Return the unique reference to the
5014 if (Decl->TypeForDecl) { in getInjectedClassNameType()
5015 assert(isa<InjectedClassNameType>(Decl->TypeForDecl)); in getInjectedClassNameType()
5016 } else if (CXXRecordDecl *PrevDecl = Decl->getPreviousDecl()) { in getInjectedClassNameType()
5017 assert(PrevDecl->TypeForDecl && "previous declaration has no type"); in getInjectedClassNameType()
5018 Decl->TypeForDecl = PrevDecl->TypeForDecl; in getInjectedClassNameType()
5019 assert(isa<InjectedClassNameType>(Decl->TypeForDecl)); in getInjectedClassNameType()
5023 Decl->TypeForDecl = newType; in getInjectedClassNameType()
5026 return QualType(Decl->TypeForDecl, 0); in getInjectedClassNameType()
5029 /// getTypeDeclType - Return the unique reference to the type for the
5033 assert(!Decl->TypeForDecl && "TypeForDecl present in slow case"); in getTypeDeclTypeSlow()
5042 assert(Record->isFirstDecl() && "struct/union has previous declaration"); in getTypeDeclTypeSlow()
5046 assert(Enum->isFirstDecl() && "enum has previous declaration"); in getTypeDeclTypeSlow()
5053 return QualType(Decl->TypeForDecl, 0); in getTypeDeclTypeSlow()
5056 /// getTypedefType - Return the unique reference to the type for the
5060 if (!Decl->TypeForDecl) { in getTypedefType()
5062 Underlying = Decl->getUnderlyingType(); in getTypedefType()
5065 Decl->TypeForDecl = NewType; in getTypedefType()
5069 if (Underlying.isNull() || Decl->getUnderlyingType() == Underlying) in getTypedefType()
5070 return QualType(Decl->TypeForDecl, 0); in getTypedefType()
5071 assert(hasSameType(Decl->getUnderlyingType(), Underlying)); in getTypedefType()
5078 assert(!T->typeMatchesDecl() && in getTypedefType()
5079 "non-divergent case should be handled with TypeDecl"); in getTypedefType()
5102 cast<TypeDecl>(Found->getTargetDecl())->getTypeForDecl(); in getUsingType()
5105 QualType Canon = Underlying->getCanonicalTypeInternal(); in getUsingType()
5106 assert(TypeForDecl->getCanonicalTypeInternal() == Canon); in getUsingType()
5120 if (Decl->TypeForDecl) return QualType(Decl->TypeForDecl, 0); in getRecordType()
5122 if (const RecordDecl *PrevDecl = Decl->getPreviousDecl()) in getRecordType()
5123 if (PrevDecl->TypeForDecl) in getRecordType()
5124 return QualType(Decl->TypeForDecl = PrevDecl->TypeForDecl, 0); in getRecordType()
5127 Decl->TypeForDecl = newType; in getRecordType()
5133 if (Decl->TypeForDecl) return QualType(Decl->TypeForDecl, 0); in getEnumType()
5135 if (const EnumDecl *PrevDecl = Decl->getPreviousDecl()) in getEnumType()
5136 if (PrevDecl->TypeForDecl) in getEnumType()
5137 return QualType(Decl->TypeForDecl = PrevDecl->TypeForDecl, 0); in getEnumType()
5140 Decl->TypeForDecl = newType; in getEnumType()
5147 if (Decl->TypeForDecl) in getUnresolvedUsingType()
5148 return QualType(Decl->TypeForDecl, 0); in getUnresolvedUsingType()
5151 Decl->getCanonicalDecl()) in getUnresolvedUsingType()
5152 if (CanonicalDecl->TypeForDecl) in getUnresolvedUsingType()
5153 return QualType(Decl->TypeForDecl = CanonicalDecl->TypeForDecl, 0); in getUnresolvedUsingType()
5157 Decl->TypeForDecl = newType; in getUnresolvedUsingType()
5203 /// Retrieve a substitution-result type.
5234 assert(P.getKind() == TemplateArgument::Type && "Pack contains a non-type"); in getSubstTemplateTypeParmPackType()
5248 if (!AssociatedDecl->isCanonicalDecl() || in getSubstTemplateTypeParmPackType()
5251 AssociatedDecl->getCanonicalDecl(), Index, Final, CanonArgPack); in getSubstTemplateTypeParmPackType()
5312 DI->getTypeLoc().castAs<TemplateSpecializationTypeLoc>(); in getTemplateSpecializationTypeInfo()
5355 bool IsTypeAlias = TD && TD->isTypeAlias(); in getTemplateSpecializationType()
5368 // Allocate the (non-canonical) template specialization type, but don't in getTemplateSpecializationType()
5416 assert(Spec->isDependentType() && in getCanonicalTemplateSpecializationType()
5417 "Non-dependent template-id type must have a canonical type"); in getCanonicalTemplateSpecializationType()
5530 assert((!NNS || NNS->isDependent()) && in getDependentTemplateSpecializationType()
5531 "nested-name-specifier must be dependent"); in getDependentTemplateSpecializationType()
5579 if (TTP->isParameterPack()) in getInjectedTemplateArg()
5585 NTTP->getType().getNonPackExpansionType().getNonLValueExprType(*this); in getInjectedTemplateArg()
5589 // lvalue-to-rvalue conversion applied to a const-qualified lvalue. in getInjectedTemplateArg()
5590 if (T->isRecordType()) in getInjectedTemplateArg()
5594 Expr::getValueKindForType(NTTP->getType()), NTTP->getLocation()); in getInjectedTemplateArg()
5596 if (NTTP->isParameterPack()) in getInjectedTemplateArg()
5598 PackExpansionExpr(DependentTy, E, NTTP->getLocation(), std::nullopt); in getInjectedTemplateArg()
5604 if (TTP->isParameterPack()) in getInjectedTemplateArg()
5610 if (Param->isTemplateParameterPack()) in getInjectedTemplateArg()
5617 ASTContext::getInjectedTemplateArgs(const TemplateParameterList *Params, in getInjectedTemplateArgs() argument
5619 Args.reserve(Args.size() + Params->size()); in getInjectedTemplateArgs()
5621 for (NamedDecl *Param : *Params) in getInjectedTemplateArgs()
5628 assert((!ExpectPackInType || Pattern->containsUnexpandedParameterPack()) && in getPackExpansionType()
5656 /// CmpProtocolNames - Comparison predicate for sorting protocols
5660 return DeclarationName::compare((*LHS)->getDeclName(), (*RHS)->getDeclName()); in CmpProtocolNames()
5666 if (Protocols[0]->getCanonicalDecl() != Protocols[0]) in areSortedAndUniqued()
5670 if (CmpProtocolNames(&Protocols[i - 1], &Protocols[i]) >= 0 || in areSortedAndUniqued()
5671 Protocols[i]->getCanonicalDecl() != Protocols[i]) in areSortedAndUniqued()
5683 P = P->getCanonicalDecl(); in SortAndUniqueProtocols()
5721 if (const auto *baseObject = baseType->getAs<ObjCObjectType>()) in getObjCObjectType()
5722 effectiveTypeArgs = baseObject->getTypeArgs(); in getObjCObjectType()
5726 // sorted-and-uniqued list of protocols and the type arguments in getObjCObjectType()
5775 /// Apply Objective-C protocol qualifiers to the given type.
5785 return getObjCTypeParamType(objT->getDecl(), protocols); in applyObjCProtocolQualifiers()
5792 const ObjCObjectType *objT = objPtr->getObjectType(); in applyObjCProtocolQualifiers()
5795 protocolsVec.append(objT->qual_begin(), in applyObjCProtocolQualifiers()
5796 objT->qual_end()); in applyObjCProtocolQualifiers()
5800 objT->getBaseType(), in applyObjCProtocolQualifiers()
5801 objT->getTypeArgsAsWritten(), in applyObjCProtocolQualifiers()
5803 objT->isKindOfTypeAsWritten()); in applyObjCProtocolQualifiers()
5813 return getObjCObjectType(objT->getBaseType(), in applyObjCProtocolQualifiers()
5814 objT->getTypeArgsAsWritten(), in applyObjCProtocolQualifiers()
5816 objT->isKindOfTypeAsWritten()); in applyObjCProtocolQualifiers()
5820 if (type->isObjCObjectType()) { in applyObjCProtocolQualifiers()
5829 // id<protocol-list> in applyObjCProtocolQualifiers()
5830 if (type->isObjCIdType()) { in applyObjCProtocolQualifiers()
5831 const auto *objPtr = type->castAs<ObjCObjectPointerType>(); in applyObjCProtocolQualifiers()
5833 objPtr->isKindOfType()); in applyObjCProtocolQualifiers()
5837 // Class<protocol-list> in applyObjCProtocolQualifiers()
5838 if (type->isObjCClassType()) { in applyObjCProtocolQualifiers()
5839 const auto *objPtr = type->castAs<ObjCObjectPointerType>(); in applyObjCProtocolQualifiers()
5841 objPtr->isKindOfType()); in applyObjCProtocolQualifiers()
5854 ObjCTypeParamType::Profile(ID, Decl, Decl->getUnderlyingType(), protocols); in getObjCTypeParamType()
5861 QualType Canonical = getCanonicalType(Decl->getUnderlyingType()); in getObjCTypeParamType()
5882 New->setTypeSourceInfo(getTrivialTypeSourceInfo(Orig->getUnderlyingType())); in adjustObjCTypeParamBoundType()
5884 auto NewTypeParamTy = cast<ObjCTypeParamType>(New->getTypeForDecl()); in adjustObjCTypeParamBoundType()
5886 protocols.append(NewTypeParamTy->qual_begin(), NewTypeParamTy->qual_end()); in adjustObjCTypeParamBoundType()
5888 New->setTypeForDecl(UpdatedTy.getTypePtr()); in adjustObjCTypeParamBoundType()
5891 /// ObjCObjectAdoptsQTypeProtocols - Checks that protocols in IC's
5892 /// protocol list adopt all protocols in QT's qualified-id protocol
5896 if (!QT->isObjCQualifiedIdType()) in ObjCObjectAdoptsQTypeProtocols()
5899 if (const auto *OPT = QT->getAs<ObjCObjectPointerType>()) { in ObjCObjectAdoptsQTypeProtocols()
5901 for (auto *Proto : OPT->quals()) { in ObjCObjectAdoptsQTypeProtocols()
5902 if (!IC->ClassImplementsProtocol(Proto, false)) in ObjCObjectAdoptsQTypeProtocols()
5910 /// QIdProtocolsAdoptObjCObjectProtocols - Checks that protocols in
5911 /// QT's qualified-id protocol list adopt all protocols in IDecl's list
5915 if (!QT->isObjCQualifiedIdType()) in QIdProtocolsAdoptObjCObjectProtocols()
5917 const auto *OPT = QT->getAs<ObjCObjectPointerType>(); in QIdProtocolsAdoptObjCObjectProtocols()
5920 if (!IDecl->hasDefinition()) in QIdProtocolsAdoptObjCObjectProtocols()
5929 for (auto *Proto : OPT->quals()) { in QIdProtocolsAdoptObjCObjectProtocols()
5946 for (auto *Proto : OPT->quals()) { in QIdProtocolsAdoptObjCObjectProtocols()
5957 /// getObjCObjectPointerType - Return a ObjCObjectPointerType type for
5988 /// getObjCInterfaceType - Return the unique reference to the type for the
5992 if (Decl->TypeForDecl) in getObjCInterfaceType()
5993 return QualType(Decl->TypeForDecl, 0); in getObjCInterfaceType()
5996 assert(PrevDecl->TypeForDecl && "previous decl has no TypeForDecl"); in getObjCInterfaceType()
5997 Decl->TypeForDecl = PrevDecl->TypeForDecl; in getObjCInterfaceType()
5998 return QualType(PrevDecl->TypeForDecl, 0); in getObjCInterfaceType()
6002 if (const ObjCInterfaceDecl *Def = Decl->getDefinition()) in getObjCInterfaceType()
6007 Decl->TypeForDecl = T; in getObjCInterfaceType()
6012 /// getTypeOfExprType - Unlike many "get<Type>" functions, we can't unique
6019 if (tofExpr->isTypeDependent()) { in getTypeOfExprType()
6040 QualType Canonical = getCanonicalType(tofExpr->getType()); in getTypeOfExprType()
6048 /// getTypeOfType - Unlike many "get<Type>" functions, we don't unique
6061 /// getReferenceQualifiedType - Given an expr, will return the type for
6062 /// that expression, as in [dcl.type.simple]p4 but without taking id-expressions
6067 QualType T = E->getType(); in getReferenceQualifiedType()
6068 switch (E->getValueKind()) { in getReferenceQualifiedType()
6069 // - otherwise, if e is an xvalue, decltype(e) is T&&, where T is the in getReferenceQualifiedType()
6073 // - otherwise, if e is an lvalue, decltype(e) is T&, where T is the in getReferenceQualifiedType()
6077 // - otherwise, decltype(e) is the type of e. in getReferenceQualifiedType()
6093 // unique dependent type. Two such decltype-specifiers refer to the same in getDecltypeType()
6095 if (e->isInstantiationDependent()) { in getDecltypeType()
6123 if (FullySubstituted && Index != -1) { in getPackIndexingType()
6151 /// getUnaryTransformationType - We don't unique these, since the memory
6159 if (BaseType->isDependentType()) { in getUnaryTransformType()
6207 ConceptDecl *CanonicalConcept = TypeConstraintConcept->getCanonicalDecl(); in getAutoTypeInternal()
6236 /// getAutoType - Return the uniqued reference to the 'auto' type which has been
6238 /// canonical deduced-but-dependent 'auto' type.
6254 // Remove a type-constraint from a top-level auto or decltype(auto). in getUnconstrainedType()
6255 if (auto *AT = CanonT->getAs<AutoType>()) { in getUnconstrainedType()
6256 if (!AT->isConstrained()) in getUnconstrainedType()
6258 return getQualifiedType(getAutoType(QualType(), AT->getKeyword(), in getUnconstrainedType()
6259 AT->isDependentType(), in getUnconstrainedType()
6260 AT->containsUnexpandedParameterPack()), in getUnconstrainedType()
6265 // non-type template parameter at the moment. Once we lift that restriction, in getUnconstrainedType()
6267 assert(!CanonT->getContainedAutoType() || in getUnconstrainedType()
6268 !CanonT->getContainedAutoType()->isConstrained()); in getUnconstrainedType()
6274 /// such type, or the canonical deduced-but-dependent such type.
6289 DTST->Profile(TempID); in getDeducedTemplateSpecializationType()
6296 /// getAtomicType - Return the uniqued reference to the atomic type for
6324 /// getAutoDeductType - Get type pattern for deducing against 'auto'.
6335 /// getAutoRRefDeductType - Get type pattern for deducing against 'auto &&'.
6343 /// getTagDeclType - Return the unique reference to the type for the
6352 /// getSizeType - Return the unique type for "size_t" (C99 7.17), the result
6356 return getFromTargetType(Target->getSizeType()); in getSizeType()
6362 return getFromTargetType(Target->getSignedSizeType()); in getSignedSizeType()
6365 /// getIntMaxType - Return the unique type for "intmax_t" (C99 7.18.1.5).
6367 return getFromTargetType(Target->getIntMaxType()); in getIntMaxType()
6370 /// getUIntMaxType - Return the unique type for "uintmax_t" (C99 7.18.1.5).
6372 return getFromTargetType(Target->getUIntMaxType()); in getUIntMaxType()
6375 /// getSignedWCharType - Return the type of "signed wchar_t".
6382 /// getUnsignedWCharType - Return the type of "unsigned wchar_t".
6390 return getFromTargetType(Target->getIntPtrType()); in getIntPtrType()
6397 /// getPointerDiffType - Return the unique type for "ptrdiff_t" (C99 7.17)
6398 /// defined in <stddef.h>. Pointer - pointer requires this (C99 6.5.6p9).
6400 return getFromTargetType(Target->getPtrDiffType(LangAS::Default)); in getPointerDiffType()
6407 return getFromTargetType(Target->getUnsignedPtrDiffType(LangAS::Default)); in getUnsignedPointerDiffType()
6413 return getFromTargetType(Target->getProcessIDType()); in getProcessIDType()
6416 //===----------------------------------------------------------------------===//
6418 //===----------------------------------------------------------------------===//
6449 dyn_cast<ArrayType>(splitType.Ty->getUnqualifiedDesugaredType()); in getUnqualifiedArrayType()
6458 QualType elementType = AT->getElementType(); in getUnqualifiedArrayType()
6474 return getConstantArrayType(unqualElementType, CAT->getSize(), in getUnqualifiedArrayType()
6475 CAT->getSizeExpr(), CAT->getSizeModifier(), 0); in getUnqualifiedArrayType()
6479 return getIncompleteArrayType(unqualElementType, IAT->getSizeModifier(), 0); in getUnqualifiedArrayType()
6484 VAT->getSizeExpr(), in getUnqualifiedArrayType()
6485 VAT->getSizeModifier(), in getUnqualifiedArrayType()
6486 VAT->getIndexTypeCVRQualifiers(), in getUnqualifiedArrayType()
6487 VAT->getBracketsRange()); in getUnqualifiedArrayType()
6491 return getDependentSizedArrayType(unqualElementType, DSAT->getSizeExpr(), in getUnqualifiedArrayType()
6492 DSAT->getSizeModifier(), 0, in getUnqualifiedArrayType()
6498 /// cv-decomposition of two types per C++ [conv.qual].
6520 if (!((CAT2 && CAT1->getSize() == CAT2->getSize()) || in UnwrapSimilarArrayTypes()
6533 T1 = AT1->getElementType(); in UnwrapSimilarArrayTypes()
6534 T2 = AT2->getElementType(); in UnwrapSimilarArrayTypes()
6542 /// unwrapped. Top-level qualifiers on T1 and T2 are ignored.
6545 /// "unwraps" pointer and pointer-to-member types to compare them at each
6557 const auto *T1PtrType = T1->getAs<PointerType>(); in UnwrapSimilarTypes()
6558 const auto *T2PtrType = T2->getAs<PointerType>(); in UnwrapSimilarTypes()
6560 T1 = T1PtrType->getPointeeType(); in UnwrapSimilarTypes()
6561 T2 = T2PtrType->getPointeeType(); in UnwrapSimilarTypes()
6565 const auto *T1MPType = T1->getAs<MemberPointerType>(); in UnwrapSimilarTypes()
6566 const auto *T2MPType = T2->getAs<MemberPointerType>(); in UnwrapSimilarTypes()
6568 hasSameUnqualifiedType(QualType(T1MPType->getClass(), 0), in UnwrapSimilarTypes()
6569 QualType(T2MPType->getClass(), 0))) { in UnwrapSimilarTypes()
6570 T1 = T1MPType->getPointeeType(); in UnwrapSimilarTypes()
6571 T2 = T2MPType->getPointeeType(); in UnwrapSimilarTypes()
6576 const auto *T1OPType = T1->getAs<ObjCObjectPointerType>(); in UnwrapSimilarTypes()
6577 const auto *T2OPType = T2->getAs<ObjCObjectPointerType>(); in UnwrapSimilarTypes()
6579 T1 = T1OPType->getPointeeType(); in UnwrapSimilarTypes()
6580 T2 = T2OPType->getPointeeType(); in UnwrapSimilarTypes()
6628 return DeclarationNameInfo(Name.getAsTemplateDecl()->getDeclName(), in getNameForTemplate()
6634 return DeclarationNameInfo((*Storage->begin())->getDeclName(), NameLoc); in getNameForTemplate()
6639 return DeclarationNameInfo(Storage->getDeclName(), NameLoc); in getNameForTemplate()
6645 if (DTN->isIdentifier()) { in getNameForTemplate()
6646 DName = DeclarationNames.getIdentifier(DTN->getIdentifier()); in getNameForTemplate()
6649 DName = DeclarationNames.getCXXOperatorName(DTN->getOperator()); in getNameForTemplate()
6660 return DeclarationNameInfo(subst->getParameter()->getDeclName(), in getNameForTemplate()
6667 return DeclarationNameInfo(subst->getParameterPack()->getDeclName(), in getNameForTemplate()
6671 return DeclarationNameInfo(Name.getAsUsingShadowDecl()->getDeclName(), in getNameForTemplate()
6689 return TemplateName(cast<TemplateDecl>(Template->getCanonicalDecl())); in getCanonicalTemplateName()
6698 assert(DTN && "Non-dependent template names must refer to template decls."); in getCanonicalTemplateName()
6699 return DTN->CanonicalTemplateName; in getCanonicalTemplateName()
6705 return getCanonicalTemplateName(subst->getReplacement()); in getCanonicalTemplateName()
6712 getCanonicalTemplateArgument(subst->getArgumentPack()); in getCanonicalTemplateName()
6714 canonArgPack, subst->getAssociatedDecl()->getCanonicalDecl(), in getCanonicalTemplateName()
6715 subst->getFinal(), subst->getIndex()); in getCanonicalTemplateName()
6736 XCE->Profile(XCEID, *this, /*Canonical=*/true, /*ProfileLambdaExpr=*/true); in isSameConstraintExpr()
6737 YCE->Profile(YCEID, *this, /*Canonical=*/true, /*ProfileLambdaExpr=*/true); in isSameConstraintExpr()
6749 auto *NCX = XTC->getNamedConcept(); in isSameTypeConstraint()
6750 auto *NCY = YTC->getNamedConcept(); in isSameTypeConstraint()
6753 if (XTC->getConceptReference()->hasExplicitTemplateArgs() != in isSameTypeConstraint()
6754 YTC->getConceptReference()->hasExplicitTemplateArgs()) in isSameTypeConstraint()
6756 if (XTC->getConceptReference()->hasExplicitTemplateArgs()) in isSameTypeConstraint()
6757 if (XTC->getConceptReference() in isSameTypeConstraint()
6758 ->getTemplateArgsAsWritten() in isSameTypeConstraint()
6759 ->NumTemplateArgs != in isSameTypeConstraint()
6760 YTC->getConceptReference()->getTemplateArgsAsWritten()->NumTemplateArgs) in isSameTypeConstraint()
6778 return isSameConstraintExpr(XTC->getImmediatelyDeclaredConstraint(), in isSameTypeConstraint()
6779 YTC->getImmediatelyDeclaredConstraint()); in isSameTypeConstraint()
6784 if (X->getKind() != Y->getKind()) in isSameTemplateParameter()
6789 if (TX->isParameterPack() != TY->isParameterPack()) in isSameTemplateParameter()
6791 if (TX->hasTypeConstraint() != TY->hasTypeConstraint()) in isSameTemplateParameter()
6793 return isSameTypeConstraint(TX->getTypeConstraint(), in isSameTemplateParameter()
6794 TY->getTypeConstraint()); in isSameTemplateParameter()
6799 return TX->isParameterPack() == TY->isParameterPack() && in isSameTemplateParameter()
6800 TX->getASTContext().hasSameType(TX->getType(), TY->getType()) && in isSameTemplateParameter()
6801 isSameConstraintExpr(TX->getPlaceholderTypeConstraint(), in isSameTemplateParameter()
6802 TY->getPlaceholderTypeConstraint()); in isSameTemplateParameter()
6807 return TX->isParameterPack() == TY->isParameterPack() && in isSameTemplateParameter()
6808 isSameTemplateParameterList(TX->getTemplateParameters(), in isSameTemplateParameter()
6809 TY->getTemplateParameters()); in isSameTemplateParameter()
6814 if (X->size() != Y->size()) in isSameTemplateParameterList()
6817 for (unsigned I = 0, N = X->size(); I != N; ++I) in isSameTemplateParameterList()
6818 if (!isSameTemplateParameter(X->getParam(I), Y->getParam(I))) in isSameTemplateParameterList()
6821 return isSameConstraintExpr(X->getRequiresClause(), Y->getRequiresClause()); in isSameTemplateParameterList()
6833 if (!TTPX->hasDefaultArgument() || !TTPY->hasDefaultArgument()) in isSameDefaultTemplateArgument()
6836 return hasSameType(TTPX->getDefaultArgument().getArgument().getAsType(), in isSameDefaultTemplateArgument()
6837 TTPY->getDefaultArgument().getArgument().getAsType()); in isSameDefaultTemplateArgument()
6842 if (!NTTPX->hasDefaultArgument() || !NTTPY->hasDefaultArgument()) in isSameDefaultTemplateArgument()
6846 NTTPX->getDefaultArgument().getArgument().getAsExpr()->IgnoreImpCasts(); in isSameDefaultTemplateArgument()
6848 NTTPY->getDefaultArgument().getArgument().getAsExpr()->IgnoreImpCasts(); in isSameDefaultTemplateArgument()
6850 DefaultArgumentX->Profile(XID, *this, /*Canonical=*/true); in isSameDefaultTemplateArgument()
6851 DefaultArgumentY->Profile(YID, *this, /*Canonical=*/true); in isSameDefaultTemplateArgument()
6858 if (!TTPX->hasDefaultArgument() || !TTPY->hasDefaultArgument()) in isSameDefaultTemplateArgument()
6861 const TemplateArgument &TAX = TTPX->getDefaultArgument().getArgument(); in isSameDefaultTemplateArgument()
6862 const TemplateArgument &TAY = TTPY->getDefaultArgument().getArgument(); in isSameDefaultTemplateArgument()
6867 if (auto *NS = X->getAsNamespace()) in getNamespace()
6869 if (auto *NAS = X->getAsNamespaceAlias()) in getNamespace()
6870 return NAS->getNamespace(); in getNamespace()
6878 if (!NSY || NSX->getCanonicalDecl() != NSY->getCanonicalDecl()) in isSameQualifier()
6880 } else if (X->getKind() != Y->getKind()) in isSameQualifier()
6885 switch (X->getKind()) { in isSameQualifier()
6887 if (X->getAsIdentifier() != Y->getAsIdentifier()) in isSameQualifier()
6896 if (X->getAsType()->getCanonicalTypeInternal() != in isSameQualifier()
6897 Y->getAsType()->getCanonicalTypeInternal()) in isSameQualifier()
6906 auto *PX = X->getPrefix(); in isSameQualifier()
6907 auto *PY = Y->getPrefix(); in isSameQualifier()
6921 auto AEnableIfAttrs = A->specific_attrs<EnableIfAttr>(); in hasSameOverloadableAttrs()
6922 auto BEnableIfAttrs = B->specific_attrs<EnableIfAttr>(); in hasSameOverloadableAttrs()
6935 (*Cand1A)->getCond()->Profile(Cand1ID, A->getASTContext(), true); in hasSameOverloadableAttrs()
6936 (*Cand2A)->getCond()->Profile(Cand2ID, B->getASTContext(), true); in hasSameOverloadableAttrs()
6948 // so it cannot rely on AST invariants being met. Non-trivial accessors in isSameEntity()
6954 if (X->getDeclName() != Y->getDeclName()) in isSameEntity()
6962 if (!declaresSameEntity(cast<Decl>(X->getDeclContext()->getRedeclContext()), in isSameEntity()
6963 cast<Decl>(Y->getDeclContext()->getRedeclContext()))) in isSameEntity()
6970 return hasSameType(TypedefX->getUnderlyingType(), in isSameEntity()
6971 TypedefY->getUnderlyingType()); in isSameEntity()
6974 if (X->getKind() != Y->getKind()) in isSameEntity()
6977 // Objective-C classes and protocols with the same name always match. in isSameEntity()
6990 return (TagX->getTagKind() == TagY->getTagKind()) || in isSameEntity()
6991 ((TagX->getTagKind() == TagTypeKind::Struct || in isSameEntity()
6992 TagX->getTagKind() == TagTypeKind::Class || in isSameEntity()
6993 TagX->getTagKind() == TagTypeKind::Interface) && in isSameEntity()
6994 (TagY->getTagKind() == TagTypeKind::Struct || in isSameEntity()
6995 TagY->getTagKind() == TagTypeKind::Class || in isSameEntity()
6996 TagY->getTagKind() == TagTypeKind::Interface)); in isSameEntity()
7000 // FIXME: This needs to cope with merging of prototyped/non-prototyped in isSameEntity()
7006 if (CtorX->getInheritedConstructor() && in isSameEntity()
7007 !isSameEntity(CtorX->getInheritedConstructor().getConstructor(), in isSameEntity()
7008 CtorY->getInheritedConstructor().getConstructor())) in isSameEntity()
7012 if (FuncX->isMultiVersion() != FuncY->isMultiVersion()) in isSameEntity()
7017 if (FuncX->isMultiVersion()) { in isSameEntity()
7018 const auto *TAX = FuncX->getAttr<TargetAttr>(); in isSameEntity()
7019 const auto *TAY = FuncY->getAttr<TargetAttr>(); in isSameEntity()
7022 if (TAX->getFeaturesStr() != TAY->getFeaturesStr()) in isSameEntity()
7028 if ((FuncX->isMemberLikeConstrainedFriend() || in isSameEntity()
7029 FuncY->isMemberLikeConstrainedFriend()) && in isSameEntity()
7030 !FuncX->getLexicalDeclContext()->Equals( in isSameEntity()
7031 FuncY->getLexicalDeclContext())) { in isSameEntity()
7035 if (!isSameConstraintExpr(FuncX->getTrailingRequiresClause(), in isSameEntity()
7036 FuncY->getTrailingRequiresClause())) in isSameEntity()
7044 FD = FD->getCanonicalDecl(); in isSameEntity()
7045 return FD->getTypeSourceInfo() ? FD->getTypeSourceInfo()->getType() in isSameEntity()
7046 : FD->getType(); in isSameEntity()
7053 auto *XFPT = XT->getAs<FunctionProtoType>(); in isSameEntity()
7054 auto *YFPT = YT->getAs<FunctionProtoType>(); in isSameEntity()
7056 (isUnresolvedExceptionSpec(XFPT->getExceptionSpecType()) || in isSameEntity()
7057 isUnresolvedExceptionSpec(YFPT->getExceptionSpecType())) && in isSameEntity()
7063 return FuncX->getLinkageInternal() == FuncY->getLinkageInternal() && in isSameEntity()
7070 if (VarX->getLinkageInternal() == VarY->getLinkageInternal()) { in isSameEntity()
7073 if (VarX->getType().isNull() || VarY->getType().isNull()) in isSameEntity()
7076 if (hasSameType(VarX->getType(), VarY->getType())) in isSameEntity()
7084 const ArrayType *VarXTy = getAsArrayType(VarX->getType()); in isSameEntity()
7085 const ArrayType *VarYTy = getAsArrayType(VarY->getType()); in isSameEntity()
7088 if (VarXTy->isIncompleteArrayType() || VarYTy->isIncompleteArrayType()) in isSameEntity()
7089 return hasSameType(VarXTy->getElementType(), VarYTy->getElementType()); in isSameEntity()
7097 return NamespaceX->isInline() == NamespaceY->isInline(); in isSameEntity()
7108 if (!isSameConstraintExpr(ConceptX->getConstraintExpr(), in isSameEntity()
7109 ConceptY->getConstraintExpr())) in isSameEntity()
7113 return isSameEntity(TemplateX->getTemplatedDecl(), in isSameEntity()
7114 TemplateY->getTemplatedDecl()) && in isSameEntity()
7115 isSameTemplateParameterList(TemplateX->getTemplateParameters(), in isSameEntity()
7116 TemplateY->getTemplateParameters()); in isSameEntity()
7122 // FIXME: Also check the bitwidth is odr-equivalent, if any. in isSameEntity()
7123 return hasSameType(FDX->getType(), FDY->getType()); in isSameEntity()
7129 return IFDX->getAnonField()->getCanonicalDecl() == in isSameEntity()
7130 IFDY->getAnonField()->getCanonicalDecl(); in isSameEntity()
7135 // FIXME: Also check the value is odr-equivalent. in isSameEntity()
7141 return declaresSameEntity(USX->getTargetDecl(), USY->getTargetDecl()); in isSameEntity()
7148 return isSameQualifier(UX->getQualifier(), UY->getQualifier()) && in isSameEntity()
7149 UX->hasTypename() == UY->hasTypename() && in isSameEntity()
7150 UX->isAccessDeclaration() == UY->isAccessDeclaration(); in isSameEntity()
7154 return isSameQualifier(UX->getQualifier(), UY->getQualifier()) && in isSameEntity()
7155 UX->isAccessDeclaration() == UY->isAccessDeclaration(); in isSameEntity()
7159 UX->getQualifier(), in isSameEntity()
7160 cast<UnresolvedUsingTypenameDecl>(Y)->getQualifier()); in isSameEntity()
7163 // Using-pack declarations are only created by instantiation, and match if in isSameEntity()
7167 UX->getInstantiatedFromUsingDecl(), in isSameEntity()
7168 cast<UsingPackDecl>(Y)->getInstantiatedFromUsingDecl()); in isSameEntity()
7174 return NAX->getNamespace()->Equals(NAY->getNamespace()); in isSameEntity()
7190 auto *D = cast<ValueDecl>(Arg.getAsDecl()->getCanonicalDecl()); in getCanonicalTemplateArgument()
7240 switch (NNS->getKind()) { in getCanonicalNestedNameSpecifier()
7244 getCanonicalNestedNameSpecifier(NNS->getPrefix()), in getCanonicalNestedNameSpecifier()
7245 NNS->getAsIdentifier()); in getCanonicalNestedNameSpecifier()
7248 // A namespace is canonical; build a nested-name-specifier with in getCanonicalNestedNameSpecifier()
7251 NNS->getAsNamespace()->getFirstDecl()); in getCanonicalNestedNameSpecifier()
7254 // A namespace is canonical; build a nested-name-specifier with in getCanonicalNestedNameSpecifier()
7258 NNS->getAsNamespaceAlias()->getNamespace()->getFirstDecl()); in getCanonicalNestedNameSpecifier()
7264 const Type *T = getCanonicalType(NNS->getAsType()); in getCanonicalNestedNameSpecifier()
7266 // If we have some kind of dependent-named type (e.g., "typename T::type"), in getCanonicalNestedNameSpecifier()
7268 // as the canonical nested-name-specifier. This is required to canonicalize in getCanonicalNestedNameSpecifier()
7269 // a dependent nested-name-specifier involving typedefs of dependent-name in getCanonicalNestedNameSpecifier()
7273 if (const auto *DNT = T->getAs<DependentNameType>()) in getCanonicalNestedNameSpecifier()
7274 return NestedNameSpecifier::Create(*this, DNT->getQualifier(), in getCanonicalNestedNameSpecifier()
7275 DNT->getIdentifier()); in getCanonicalNestedNameSpecifier()
7276 if (const auto *DTST = T->getAs<DependentTemplateSpecializationType>()) in getCanonicalNestedNameSpecifier()
7277 return NestedNameSpecifier::Create(*this, DTST->getQualifier(), true, T); in getCanonicalNestedNameSpecifier()
7293 // Handle the non-qualified case efficiently. in getAsArrayType()
7322 QualType NewEltTy = getQualifiedType(ATy->getElementType(), qs); in getAsArrayType()
7325 return cast<ArrayType>(getConstantArrayType(NewEltTy, CAT->getSize(), in getAsArrayType()
7326 CAT->getSizeExpr(), in getAsArrayType()
7327 CAT->getSizeModifier(), in getAsArrayType()
7328 CAT->getIndexTypeCVRQualifiers())); in getAsArrayType()
7331 IAT->getSizeModifier(), in getAsArrayType()
7332 IAT->getIndexTypeCVRQualifiers())); in getAsArrayType()
7337 DSAT->getSizeExpr(), in getAsArrayType()
7338 DSAT->getSizeModifier(), in getAsArrayType()
7339 DSAT->getIndexTypeCVRQualifiers(), in getAsArrayType()
7340 DSAT->getBracketsRange())); in getAsArrayType()
7344 VAT->getSizeExpr(), in getAsArrayType()
7345 VAT->getSizeModifier(), in getAsArrayType()
7346 VAT->getIndexTypeCVRQualifiers(), in getAsArrayType()
7347 VAT->getBracketsRange())); in getAsArrayType()
7351 if (getLangOpts().HLSL && T->isConstantArrayType()) in getAdjustedParameterType()
7353 if (T->isArrayType() || T->isFunctionType()) in getAdjustedParameterType()
7366 // A throw-expression initializes a temporary object, called the exception in getExceptionObjectType()
7367 // object, the type of which is determined by removing any top-level in getExceptionObjectType()
7368 // cv-qualifiers from the static type of the operand of throw and adjusting in getExceptionObjectType()
7372 if (T->isArrayType() || T->isFunctionType()) in getExceptionObjectType()
7377 /// getArrayDecayedType - Return the properly qualified result of decaying the
7378 /// specified array type to a pointer. This operation is non-trivial when
7391 QualType PtrTy = getPointerType(PrettyArrayType->getElementType()); in getArrayDecayedType()
7393 // int x[restrict 4] -> int *restrict in getArrayDecayedType()
7395 PrettyArrayType->getIndexTypeQualifiers()); in getArrayDecayedType()
7397 // int x[_Nullable] -> int * _Nullable in getArrayDecayedType()
7398 if (auto Nullability = Ty->getNullability()) { in getArrayDecayedType()
7399 Result = const_cast<ASTContext *>(this)->getAttributedType( in getArrayDecayedType()
7406 return getBaseElementType(array->getElementType()); in getBaseElementType()
7413 const ArrayType *array = split.Ty->getAsArrayTypeUnsafe(); in getBaseElementType()
7416 type = array->getElementType(); in getBaseElementType()
7423 /// getConstantArrayElementCount - Returns number of constant array elements.
7428 ElementCount *= CA->getZExtSize(); in getConstantArrayElementCount()
7430 CA->getElementType()->getAsArrayTypeUnsafe()); in getConstantArrayElementCount()
7443 ElementCount *= AILE->getArraySize().getZExtValue(); in getArrayInitLoopExprElementCount()
7444 AILE = dyn_cast<ArrayInitLoopExpr>(AILE->getSubExpr()); in getArrayInitLoopExprElementCount()
7450 /// getFloatingRank - Return a relative rank for floating point types.
7451 /// This routine will assert if passed a built-in type that isn't a float.
7453 if (const auto *CT = T->getAs<ComplexType>()) in getFloatingRank()
7454 return getFloatingRank(CT->getElementType()); in getFloatingRank()
7456 switch (T->castAs<BuiltinType>()->getKind()) { in getFloatingRank()
7469 /// getFloatingTypeOrder - Compare the rank of the two specified floating
7472 /// LHS < RHS, return -1.
7481 return -1; in getFloatingTypeOrder()
7490 /// getIntegerRank - Return an integer conversion rank (C99 6.3.1.1p1). This
7491 /// routine will assert if passed a built-in type that isn't an integer or enum,
7494 assert(T->isCanonicalUnqualified() && "T should be canonicalized"); in getIntegerRank()
7499 return 0 + (EIT->getNumBits() << 3); in getIntegerRank()
7501 switch (cast<BuiltinType>(T)->getKind()) { in getIntegerRank()
7502 default: llvm_unreachable("getIntegerRank(): not a built-in integer"); in getIntegerRank()
7532 getFromTargetType(Target->getChar16Type()).getTypePtr()); in getIntegerRank()
7535 getFromTargetType(Target->getChar32Type()).getTypePtr()); in getIntegerRank()
7539 getFromTargetType(Target->getWCharType()).getTypePtr()); in getIntegerRank()
7546 /// \returns the type this bit-field will promote to, or NULL if no
7549 if (E->isTypeDependent() || E->isValueDependent()) in isPromotableBitField()
7553 // If the bit-field has an enumerated type, it is treated as any other in isPromotableBitField()
7555 if (getLangOpts().CPlusPlus && E->getType()->isEnumeralType()) in isPromotableBitField()
7558 // FIXME: We should not do this unless E->refersToBitField() is true. This in isPromotableBitField()
7559 // matters in C where getSourceBitField() will find bit-fields for various in isPromotableBitField()
7560 // cases where the source expression is not a bit-field designator. in isPromotableBitField()
7562 FieldDecl *Field = E->getSourceBitField(); // FIXME: conditional bit-fields? in isPromotableBitField()
7566 QualType FT = Field->getType(); in isPromotableBitField()
7568 uint64_t BitWidth = Field->getBitWidthValue(*this); in isPromotableBitField()
7571 // A prvalue for an integral bit-field can be converted to a prvalue of type in isPromotableBitField()
7572 // int if int can represent all the values of the bit-field; otherwise, it in isPromotableBitField()
7574 // values of the bit-field. If the bit-field is larger yet, no integral in isPromotableBitField()
7577 // [For a bit-field of type _Bool, int, signed int, or unsigned int:] in isPromotableBitField()
7579 // the width, for a bit-field), the value is converted to an int; otherwise, in isPromotableBitField()
7584 // FIXME: C does not permit promotion of an enum bit-field whose rank is in isPromotableBitField()
7588 // The value from a bit-field of a bit-precise integer type is converted to in isPromotableBitField()
7589 // the corresponding bit-precise integer type. (The rest is the same as in in isPromotableBitField()
7591 if (QualType QT = Field->getType(); QT->isBitIntType()) in isPromotableBitField()
7598 return FT->isSignedIntegerType() ? IntTy : UnsignedIntTy; in isPromotableBitField()
7600 // Bit-fields wider than int are not subject to promotions, and therefore act in isPromotableBitField()
7602 // deliberately do not follow (GCC follows a pre-standard resolution to in isPromotableBitField()
7603 // C's DR315 which treats bit-width as being part of the type, and this leaks in isPromotableBitField()
7608 /// getPromotedIntegerType - Returns the type that Promotable will
7614 if (const auto *ET = Promotable->getAs<EnumType>()) in getPromotedIntegerType()
7615 return ET->getDecl()->getPromotionType(); in getPromotedIntegerType()
7617 if (const auto *BT = Promotable->getAs<BuiltinType>()) { in getPromotedIntegerType()
7624 if (BT->getKind() == BuiltinType::WChar_S || in getPromotedIntegerType()
7625 BT->getKind() == BuiltinType::WChar_U || in getPromotedIntegerType()
7626 BT->getKind() == BuiltinType::Char8 || in getPromotedIntegerType()
7627 BT->getKind() == BuiltinType::Char16 || in getPromotedIntegerType()
7628 BT->getKind() == BuiltinType::Char32) { in getPromotedIntegerType()
7629 bool FromIsSigned = BT->getKind() == BuiltinType::WChar_S; in getPromotedIntegerType()
7636 (FromSize == ToSize && FromIsSigned == PT->isSignedIntegerType())) in getPromotedIntegerType()
7644 if (Promotable->isSignedIntegerType()) in getPromotedIntegerType()
7648 assert(Promotable->isUnsignedIntegerType() && PromotableSize <= IntSize); in getPromotedIntegerType()
7658 if (T->isArrayType()) in getInnerObjCOwnership()
7660 else if (const auto *PT = T->getAs<PointerType>()) in getInnerObjCOwnership()
7661 T = PT->getPointeeType(); in getInnerObjCOwnership()
7662 else if (const auto *RT = T->getAs<ReferenceType>()) in getInnerObjCOwnership()
7663 T = RT->getPointeeType(); in getInnerObjCOwnership()
7674 if (ET->getDecl()->isComplete() && !ET->getDecl()->isScoped()) in getIntegerTypeForEnum()
7675 return ET->getDecl()->getIntegerType().getTypePtr(); in getIntegerTypeForEnum()
7679 /// getIntegerTypeOrder - Returns the highest ranked integer type:
7681 /// LHS < RHS, return -1.
7694 bool LHSUnsigned = LHSC->isUnsignedIntegerType(); in getIntegerTypeOrder()
7695 bool RHSUnsigned = RHSC->isUnsignedIntegerType(); in getIntegerTypeOrder()
7702 return LHSRank > RHSRank ? 1 : -1; in getIntegerTypeOrder()
7714 return -1; in getIntegerTypeOrder()
7719 return -1; in getIntegerTypeOrder()
7734 CFConstantStringTagDecl->startDefinition(); in getCFConstantStringDecl()
7742 /// Objective-C ABI in getCFConstantStringDecl()
7781 Fields[Count++] = { getFromTargetType(Target->getUInt64Type()), "_swift_rc" }; in getCFConstantStringDecl()
7797 Field->setAccess(AS_public); in getCFConstantStringDecl()
7798 CFConstantStringTagDecl->addDecl(Field); in getCFConstantStringDecl()
7801 CFConstantStringTagDecl->completeDefinition(); in getCFConstantStringDecl()
7817 // getCFConstantStringType - Return the type used for constant CFStrings.
7825 getTranslationUnitDecl()->addDecl(ObjCSuperTypeDecl); in getObjCSuperType()
7832 const auto *TD = T->castAs<TypedefType>(); in setCFConstantStringType()
7833 CFConstantStringTypeDecl = cast<TypedefDecl>(TD->getDecl()); in setCFConstantStringType()
7835 CFConstantStringTypeDecl->getUnderlyingType()->castAs<RecordType>(); in setCFConstantStringType()
7836 CFConstantStringTagDecl = TagType->getDecl(); in setCFConstantStringType()
7846 RD->startDefinition(); in getBlockDescriptorType()
7863 Field->setAccess(AS_public); in getBlockDescriptorType()
7864 RD->addDecl(Field); in getBlockDescriptorType()
7867 RD->completeDefinition(); in getBlockDescriptorType()
7881 RD->startDefinition(); in getBlockDescriptorExtendedType()
7903 Field->setAccess(AS_public); in getBlockDescriptorExtendedType()
7904 RD->addDecl(Field); in getBlockDescriptorExtendedType()
7907 RD->completeDefinition(); in getBlockDescriptorExtendedType()
7923 switch (BT->getKind()) { in getOpenCLTypeKind()
7950 return Target->getOpenCLTypeAddrSpace(getOpenCLTypeKind(T)); in getOpenCLTypeAddrSpace()
7953 /// BlockRequiresCopying - Returns true if byref variable "D" of type "Ty"
7958 if (const CXXRecordDecl *record = Ty->getAsCXXRecordDecl()) { in BlockRequiresCopying()
7960 if (!copyExpr && record->hasTrivialDestructor()) return false; in BlockRequiresCopying()
7965 // The block needs copy/destroy helpers if Ty is non-trivial to destructively in BlockRequiresCopying()
7970 if (!Ty->isObjCRetainableType()) return false; in BlockRequiresCopying()
7985 // non-triviality. in BlockRequiresCopying()
7992 return (Ty->isBlockPointerType() || isObjCNSObjectType(Ty) || in BlockRequiresCopying()
7993 Ty->isObjCObjectPointerType()); in BlockRequiresCopying()
8004 if (Ty->isRecordType()) { in getByrefLifetime()
8009 } else if (Ty->isObjCObjectPointerType() || Ty->isBlockPointerType()) { in getByrefLifetime()
8020 const llvm::Triple &T = Target->getTriple(); in getNSUIntegerType()
8029 const llvm::Triple &T = Target->getTriple(); in getNSIntegerType()
8047 if (IdentifierInfo *II = TT->getDecl()->getIdentifier()) in isTypeTypedefedAsBOOL()
8048 return II->isStr("BOOL"); in isTypeTypedefedAsBOOL()
8053 /// getObjCEncodingTypeSize returns size of type for objective-c encoding
8056 if (!type->isIncompleteArrayType() && type->isIncompleteType()) in getObjCEncodingTypeSize()
8062 if (sz.isPositive() && type->isIntegralOrEnumerationType()) in getObjCEncodingTypeSize()
8065 else if (type->isArrayType()) in getObjCEncodingTypeSize()
8072 VD->isStaticDataMember() && in isMSStaticDataMemberInlineDefinition()
8073 VD->getType()->isIntegralOrEnumerationType() && in isMSStaticDataMemberInlineDefinition()
8074 !VD->getFirstDecl()->isOutOfLine() && VD->getFirstDecl()->hasInit(); in isMSStaticDataMemberInlineDefinition()
8079 if (!VD->isInline()) in getInlineVariableDefinitionKind()
8083 auto *First = VD->getFirstDecl(); in getInlineVariableDefinitionKind()
8084 if (First->isInlineSpecified() || !First->isStaticDataMember()) in getInlineVariableDefinitionKind()
8087 // If there's a file-context declaration in this translation unit, it's a in getInlineVariableDefinitionKind()
8088 // non-discardable definition. in getInlineVariableDefinitionKind()
8089 for (auto *D : VD->redecls()) in getInlineVariableDefinitionKind()
8090 if (D->getLexicalDeclContext()->isFileContext() && in getInlineVariableDefinitionKind()
8091 !D->isInlineSpecified() && (D->isConstexpr() || First->isConstexpr())) in getInlineVariableDefinitionKind()
8102 /// getObjCEncodingForBlock - Return the encoded type for this block
8107 const BlockDecl *Decl = Expr->getBlockDecl(); in getObjCEncodingForBlock()
8109 Expr->getType()->castAs<BlockPointerType>()->getPointeeType(); in getObjCEncodingForBlock()
8110 QualType BlockReturnTy = BlockTy->castAs<FunctionType>()->getReturnType(); in getObjCEncodingForBlock()
8122 for (auto *PI : Decl->parameters()) { in getObjCEncodingForBlock()
8123 QualType PType = PI->getType(); in getObjCEncodingForBlock()
8127 assert(sz.isPositive() && "BlockExpr - Incomplete param type"); in getObjCEncodingForBlock()
8137 for (auto *PVDecl : Decl->parameters()) { in getObjCEncodingForBlock()
8138 QualType PType = PVDecl->getOriginalType(); in getObjCEncodingForBlock()
8140 dyn_cast<ArrayType>(PType->getCanonicalTypeInternal())) { in getObjCEncodingForBlock()
8144 PType = PVDecl->getType(); in getObjCEncodingForBlock()
8145 } else if (PType->isFunctionType()) in getObjCEncodingForBlock()
8146 PType = PVDecl->getType(); in getObjCEncodingForBlock()
8163 getObjCEncodingForType(Decl->getReturnType(), S); in getObjCEncodingForFunctionDecl()
8166 for (auto *PI : Decl->parameters()) { in getObjCEncodingForFunctionDecl()
8167 QualType PType = PI->getType(); in getObjCEncodingForFunctionDecl()
8173 "getObjCEncodingForFunctionDecl - Incomplete param type"); in getObjCEncodingForFunctionDecl()
8180 for (auto *PVDecl : Decl->parameters()) { in getObjCEncodingForFunctionDecl()
8181 QualType PType = PVDecl->getOriginalType(); in getObjCEncodingForFunctionDecl()
8183 dyn_cast<ArrayType>(PType->getCanonicalTypeInternal())) { in getObjCEncodingForFunctionDecl()
8187 PType = PVDecl->getType(); in getObjCEncodingForFunctionDecl()
8188 } else if (PType->isFunctionType()) in getObjCEncodingForFunctionDecl()
8189 PType = PVDecl->getType(); in getObjCEncodingForFunctionDecl()
8198 /// getObjCEncodingForMethodParameter - Return the encoded type for a single
8216 /// getObjCEncodingForMethodDecl - Return the encoded type for this method
8223 getObjCEncodingForMethodParameter(Decl->getObjCDeclQualifier(), in getObjCEncodingForMethodDecl()
8224 Decl->getReturnType(), S, Extended); in getObjCEncodingForMethodDecl()
8232 for (ObjCMethodDecl::param_const_iterator PI = Decl->param_begin(), in getObjCEncodingForMethodDecl()
8233 E = Decl->sel_param_end(); PI != E; ++PI) { in getObjCEncodingForMethodDecl()
8234 QualType PType = (*PI)->getType(); in getObjCEncodingForMethodDecl()
8240 "getObjCEncodingForMethodDecl - Incomplete param type"); in getObjCEncodingForMethodDecl()
8249 for (ObjCMethodDecl::param_const_iterator PI = Decl->param_begin(), in getObjCEncodingForMethodDecl()
8250 E = Decl->sel_param_end(); PI != E; ++PI) { in getObjCEncodingForMethodDecl()
8252 QualType PType = PVDecl->getOriginalType(); in getObjCEncodingForMethodDecl()
8254 dyn_cast<ArrayType>(PType->getCanonicalTypeInternal())) { in getObjCEncodingForMethodDecl()
8258 PType = PVDecl->getType(); in getObjCEncodingForMethodDecl()
8259 } else if (PType->isFunctionType()) in getObjCEncodingForMethodDecl()
8260 PType = PVDecl->getType(); in getObjCEncodingForMethodDecl()
8261 getObjCEncodingForMethodParameter(PVDecl->getObjCDeclQualifier(), in getObjCEncodingForMethodDecl()
8277 for (auto *PID : CID->property_impls()) in getObjCPropertyImplDeclForPropertyDecl()
8278 if (PID->getPropertyDecl() == PD) in getObjCPropertyImplDeclForPropertyDecl()
8282 for (auto *PID : OID->property_impls()) in getObjCPropertyImplDeclForPropertyDecl()
8283 if (PID->getPropertyDecl() == PD) in getObjCPropertyImplDeclForPropertyDecl()
8289 /// getObjCEncodingForPropertyDecl - Return the encoded type for this
8290 /// property declaration. If non-NULL, Container must be either an
8293 /// Property attributes are stored as a comma-delimited C string. The simple
8301 /// kPropertyReadOnly = 'R', // property is read-only.
8308 /// kPropertyType = 'T' // followed by old-style type encoding.
8311 /// kPropertyNonAtomic = 'N' // property non-atomic
8324 if (PropertyImpDecl->getPropertyImplementation() == ObjCPropertyImplDecl::Dynamic) in getObjCEncodingForPropertyDecl()
8336 getObjCEncodingForPropertyType(PD->getType(), S); in getObjCEncodingForPropertyDecl()
8338 if (PD->isOptional()) in getObjCEncodingForPropertyDecl()
8341 if (PD->isReadOnly()) { in getObjCEncodingForPropertyDecl()
8343 if (PD->getPropertyAttributes() & ObjCPropertyAttribute::kind_copy) in getObjCEncodingForPropertyDecl()
8345 if (PD->getPropertyAttributes() & ObjCPropertyAttribute::kind_retain) in getObjCEncodingForPropertyDecl()
8347 if (PD->getPropertyAttributes() & ObjCPropertyAttribute::kind_weak) in getObjCEncodingForPropertyDecl()
8350 switch (PD->getSetterKind()) { in getObjCEncodingForPropertyDecl()
8363 if (PD->getPropertyAttributes() & ObjCPropertyAttribute::kind_nonatomic) in getObjCEncodingForPropertyDecl()
8366 if (PD->getPropertyAttributes() & ObjCPropertyAttribute::kind_getter) { in getObjCEncodingForPropertyDecl()
8368 S += PD->getGetterName().getAsString(); in getObjCEncodingForPropertyDecl()
8371 if (PD->getPropertyAttributes() & ObjCPropertyAttribute::kind_setter) { in getObjCEncodingForPropertyDecl()
8373 S += PD->getSetterName().getAsString(); in getObjCEncodingForPropertyDecl()
8377 const ObjCIvarDecl *OID = SynthesizePID->getPropertyIvarDecl(); in getObjCEncodingForPropertyDecl()
8379 S += OID->getNameAsString(); in getObjCEncodingForPropertyDecl()
8386 /// getLegacyIntegralTypeEncoding -
8387 /// Another legacy compatibility encoding: 32-bit longs are encoded as
8391 if (PointeeTy->getAs<TypedefType>()) { in getLegacyIntegralTypeEncoding()
8392 if (const auto *BT = PointeeTy->getAs<BuiltinType>()) { in getLegacyIntegralTypeEncoding()
8393 if (BT->getKind() == BuiltinType::ULong && getIntWidth(PointeeTy) == 32) in getLegacyIntegralTypeEncoding()
8396 if (BT->getKind() == BuiltinType::Long && getIntWidth(PointeeTy) == 32) in getLegacyIntegralTypeEncoding()
8433 BuiltinType::Kind kind = BT->getKind(); in getObjCEncodingForPrimitiveType()
8445 return C->getTargetInfo().getLongWidth() == 32 ? 'L' : 'Q'; in getObjCEncodingForPrimitiveType()
8455 return C->getTargetInfo().getLongWidth() == 32 ? 'l' : 'q'; in getObjCEncodingForPrimitiveType()
8505 DiagnosticsEngine &Diags = C->getDiagnostics(); in getObjCEncodingForPrimitiveType()
8508 Diags.Report(DiagID) << BT->getName(C->getPrintingPolicy()); in getObjCEncodingForPrimitiveType()
8543 EnumDecl *Enum = ET->getDecl(); in ObjCEncodingForEnumType()
8545 // The encoding of an non-fixed enum type is always 'i', regardless of size. in ObjCEncodingForEnumType()
8546 if (!Enum->isFixed()) in ObjCEncodingForEnumType()
8550 const auto *BT = Enum->getIntegerType()->castAs<BuiltinType>(); in ObjCEncodingForEnumType()
8556 assert(FD->isBitField() && "not a bitfield - getObjCEncodingForTypeImpl"); in EncodeBitField()
8568 // On a 32-bit system, the encoding for flags would be b2 for the NeXT in EncodeBitField()
8573 if (Ctx->getLangOpts().ObjCRuntime.isGNUFamily()) { in EncodeBitField()
8577 Offset = Ctx->lookupFieldBitOffset(IVD->getContainingInterface(), nullptr, in EncodeBitField()
8580 const RecordDecl *RD = FD->getParent(); in EncodeBitField()
8581 const ASTRecordLayout &RL = Ctx->getASTRecordLayout(RD); in EncodeBitField()
8582 Offset = RL.getFieldOffset(FD->getFieldIndex()); in EncodeBitField()
8587 if (const auto *ET = T->getAs<EnumType>()) in EncodeBitField()
8590 const auto *BT = T->castAs<BuiltinType>(); in EncodeBitField()
8594 S += llvm::utostr(FD->getBitWidthValue(*Ctx)); in EncodeBitField()
8601 T = T->getBaseElementTypeUnsafe(); in hasTemplateSpecializationInEncodedString()
8603 if (auto *PT = T->getAs<PointerType>()) in hasTemplateSpecializationInEncodedString()
8605 PT->getPointeeType().getTypePtr(), false); in hasTemplateSpecializationInEncodedString()
8607 auto *CXXRD = T->getAsCXXRecordDecl(); in hasTemplateSpecializationInEncodedString()
8615 if (!CXXRD->hasDefinition() || !VisitBasesAndFields) in hasTemplateSpecializationInEncodedString()
8618 for (const auto &B : CXXRD->bases()) in hasTemplateSpecializationInEncodedString()
8623 for (auto *FD : CXXRD->fields()) in hasTemplateSpecializationInEncodedString()
8624 if (hasTemplateSpecializationInEncodedString(FD->getType().getTypePtr(), in hasTemplateSpecializationInEncodedString()
8637 switch (CT->getTypeClass()) { in getObjCEncodingForTypeImpl()
8640 if (FD && FD->isBitField()) in getObjCEncodingForTypeImpl()
8650 getObjCEncodingForTypeImpl(T->castAs<ComplexType>()->getElementType(), S, in getObjCEncodingForTypeImpl()
8657 getObjCEncodingForTypeImpl(T->castAs<AtomicType>()->getValueType(), S, in getObjCEncodingForTypeImpl()
8668 const auto *PT = T->castAs<PointerType>(); in getObjCEncodingForTypeImpl()
8669 if (PT->isObjCSelType()) { in getObjCEncodingForTypeImpl()
8673 PointeeTy = PT->getPointeeType(); in getObjCEncodingForTypeImpl()
8675 PointeeTy = T->castAs<ReferenceType>()->getPointeeType(); in getObjCEncodingForTypeImpl()
8679 // For historical/compatibility reasons, the read-only qualifier of the in getObjCEncodingForTypeImpl()
8680 // pointee gets emitted _before_ the '^'. The read-only qualifier of in getObjCEncodingForTypeImpl()
8683 if (T->getAs<TypedefType>()) { in getObjCEncodingForTypeImpl()
8690 while (auto PT = P->getAs<PointerType>()) in getObjCEncodingForTypeImpl()
8691 P = PT->getPointeeType(); in getObjCEncodingForTypeImpl()
8702 S.replace(S.end()-2, S.end(), "rn"); in getObjCEncodingForTypeImpl()
8705 if (PointeeTy->isCharType()) { in getObjCEncodingForTypeImpl()
8712 } else if (const auto *RTy = PointeeTy->getAs<RecordType>()) { in getObjCEncodingForTypeImpl()
8714 if (RTy->getDecl()->getIdentifier() == &Idents.get("objc_class")) { in getObjCEncodingForTypeImpl()
8719 if (RTy->getDecl()->getIdentifier() == &Idents.get("objc_object")) { in getObjCEncodingForTypeImpl()
8755 AT->getElementType(), S, in getObjCEncodingForTypeImpl()
8761 S += llvm::utostr(CAT->getZExtSize()); in getObjCEncodingForTypeImpl()
8770 AT->getElementType(), S, in getObjCEncodingForTypeImpl()
8784 RecordDecl *RDecl = cast<RecordType>(CT)->getDecl(); in getObjCEncodingForTypeImpl()
8785 S += RDecl->isUnion() ? '(' : '{'; in getObjCEncodingForTypeImpl()
8787 if (const IdentifierInfo *II = RDecl->getIdentifier()) { in getObjCEncodingForTypeImpl()
8788 S += II->getName(); in getObjCEncodingForTypeImpl()
8790 const TemplateArgumentList &TemplateArgs = Spec->getTemplateArgs(); in getObjCEncodingForTypeImpl()
8800 if (!RDecl->isUnion()) { in getObjCEncodingForTypeImpl()
8803 for (const auto *Field : RDecl->fields()) { in getObjCEncodingForTypeImpl()
8806 S += Field->getNameAsString(); in getObjCEncodingForTypeImpl()
8810 // Special case bit-fields. in getObjCEncodingForTypeImpl()
8811 if (Field->isBitField()) { in getObjCEncodingForTypeImpl()
8812 getObjCEncodingForTypeImpl(Field->getType(), S, in getObjCEncodingForTypeImpl()
8816 QualType qt = Field->getType(); in getObjCEncodingForTypeImpl()
8826 S += RDecl->isUnion() ? ')' : '}'; in getObjCEncodingForTypeImpl()
8831 const auto *BT = T->castAs<BlockPointerType>(); in getObjCEncodingForTypeImpl()
8832 S += "@?"; // Unlike a pointer-to-function, which is "^?". in getObjCEncodingForTypeImpl()
8834 const auto *FT = BT->getPointeeType()->castAs<FunctionType>(); in getObjCEncodingForTypeImpl()
8838 getObjCEncodingForTypeImpl(FT->getReturnType(), S, in getObjCEncodingForTypeImpl()
8844 for (const auto &I : FPT->param_types()) in getObjCEncodingForTypeImpl()
8856 if (Ty->isObjCIdType()) { in getObjCEncodingForTypeImpl()
8860 else if (Ty->isObjCClassType()) { in getObjCEncodingForTypeImpl()
8871 ObjCInterfaceDecl *OI = T->castAs<ObjCObjectType>()->getInterface(); in getObjCEncodingForTypeImpl()
8873 S += OI->getObjCRuntimeNameAsString(); in getObjCEncodingForTypeImpl()
8880 if (Field->isBitField()) in getObjCEncodingForTypeImpl()
8881 getObjCEncodingForTypeImpl(Field->getType(), S, in getObjCEncodingForTypeImpl()
8885 getObjCEncodingForTypeImpl(Field->getType(), S, in getObjCEncodingForTypeImpl()
8895 const auto *OPT = T->castAs<ObjCObjectPointerType>(); in getObjCEncodingForTypeImpl()
8896 if (OPT->isObjCIdType()) { in getObjCEncodingForTypeImpl()
8901 if (OPT->isObjCClassType() || OPT->isObjCQualifiedClassType()) { in getObjCEncodingForTypeImpl()
8909 if (OPT->isObjCQualifiedIdType()) { in getObjCEncodingForTypeImpl()
8920 for (const auto *I : OPT->quals()) { in getObjCEncodingForTypeImpl()
8922 S += I->getObjCRuntimeNameAsString(); in getObjCEncodingForTypeImpl()
8931 if (OPT->getInterfaceDecl() && in getObjCEncodingForTypeImpl()
8934 S += OPT->getInterfaceDecl()->getObjCRuntimeNameAsString(); in getObjCEncodingForTypeImpl()
8935 for (const auto *I : OPT->quals()) { in getObjCEncodingForTypeImpl()
8937 S += I->getObjCRuntimeNameAsString(); in getObjCEncodingForTypeImpl()
8994 assert(RDecl && "Expected non-null RecordDecl"); in getObjCEncodingForStructureImpl()
8995 assert(!RDecl->isUnion() && "Should not be called for unions"); in getObjCEncodingForStructureImpl()
8996 if (!RDecl->getDefinition() || RDecl->getDefinition()->isInvalidDecl()) in getObjCEncodingForStructureImpl()
9004 for (const auto &BI : CXXRec->bases()) { in getObjCEncodingForStructureImpl()
9006 CXXRecordDecl *base = BI.getType()->getAsCXXRecordDecl(); in getObjCEncodingForStructureImpl()
9007 if (base->isEmpty()) in getObjCEncodingForStructureImpl()
9016 for (FieldDecl *Field : RDecl->fields()) { in getObjCEncodingForStructureImpl()
9017 if (!Field->isZeroLengthBitField(*this) && Field->isZeroSize(*this)) in getObjCEncodingForStructureImpl()
9019 uint64_t offs = layout.getFieldOffset(Field->getFieldIndex()); in getObjCEncodingForStructureImpl()
9025 for (const auto &BI : CXXRec->vbases()) { in getObjCEncodingForStructureImpl()
9026 CXXRecordDecl *base = BI.getType()->getAsCXXRecordDecl(); in getObjCEncodingForStructureImpl()
9027 if (base->isEmpty()) in getObjCEncodingForStructureImpl()
9050 if (CXXRec && CXXRec->isDynamicClass() && in getObjCEncodingForStructureImpl()
9051 (CurLayObj == FieldOrBaseOffsets.end() || CurLayObj->first != 0)) { in getObjCEncodingForStructureImpl()
9054 std::string recname = CXXRec->getNameAsString(); in getObjCEncodingForStructureImpl()
9065 if (!RDecl->hasFlexibleArrayMember()) { in getObjCEncodingForStructureImpl()
9074 assert(CurOffs <= CurLayObj->first); in getObjCEncodingForStructureImpl()
9075 if (CurOffs < CurLayObj->first) { in getObjCEncodingForStructureImpl()
9076 uint64_t padding = CurLayObj->first - CurOffs; in getObjCEncodingForStructureImpl()
9079 // the encoding will be out-of-sync with the real layout. in getObjCEncodingForStructureImpl()
9088 NamedDecl *dcl = CurLayObj->second; in getObjCEncodingForStructureImpl()
9099 assert(!base->isEmpty()); in getObjCEncodingForStructureImpl()
9107 S += field->getNameAsString(); in getObjCEncodingForStructureImpl()
9111 if (field->isBitField()) { in getObjCEncodingForStructureImpl()
9112 EncodeBitField(this, S, field->getType(), field); in getObjCEncodingForStructureImpl()
9114 CurOffs += field->getBitWidthValue(*this); in getObjCEncodingForStructureImpl()
9117 QualType qt = field->getType(); in getObjCEncodingForStructureImpl()
9123 CurOffs += getTypeSize(field->getType()); in getObjCEncodingForStructureImpl()
9186 //===----------------------------------------------------------------------===//
9188 //===----------------------------------------------------------------------===//
9193 QualType T = Context->getPointerType(Context->CharTy); in CreateCharPtrNamedVaListDecl()
9194 return Context->buildImplicitTypedef(T, Name); in CreateCharPtrNamedVaListDecl()
9207 QualType T = Context->getPointerType(Context->VoidTy); in CreateVoidPtrBuiltinVaListDecl()
9208 return Context->buildImplicitTypedef(T, "__builtin_va_list"); in CreateVoidPtrBuiltinVaListDecl()
9214 RecordDecl *VaListTagDecl = Context->buildImplicitRecord("__va_list"); in CreateAArch64ABIBuiltinVaListDecl()
9215 if (Context->getLangOpts().CPlusPlus) { in CreateAArch64ABIBuiltinVaListDecl()
9218 const_cast<ASTContext &>(*Context), Context->getTranslationUnitDecl(), in CreateAArch64ABIBuiltinVaListDecl()
9220 &Context->Idents.get("std"), in CreateAArch64ABIBuiltinVaListDecl()
9222 NS->setImplicit(); in CreateAArch64ABIBuiltinVaListDecl()
9223 VaListTagDecl->setDeclContext(NS); in CreateAArch64ABIBuiltinVaListDecl()
9226 VaListTagDecl->startDefinition(); in CreateAArch64ABIBuiltinVaListDecl()
9233 FieldTypes[0] = Context->getPointerType(Context->VoidTy); in CreateAArch64ABIBuiltinVaListDecl()
9237 FieldTypes[1] = Context->getPointerType(Context->VoidTy); in CreateAArch64ABIBuiltinVaListDecl()
9241 FieldTypes[2] = Context->getPointerType(Context->VoidTy); in CreateAArch64ABIBuiltinVaListDecl()
9245 FieldTypes[3] = Context->IntTy; in CreateAArch64ABIBuiltinVaListDecl()
9249 FieldTypes[4] = Context->IntTy; in CreateAArch64ABIBuiltinVaListDecl()
9258 &Context->Idents.get(FieldNames[i]), in CreateAArch64ABIBuiltinVaListDecl()
9263 Field->setAccess(AS_public); in CreateAArch64ABIBuiltinVaListDecl()
9264 VaListTagDecl->addDecl(Field); in CreateAArch64ABIBuiltinVaListDecl()
9266 VaListTagDecl->completeDefinition(); in CreateAArch64ABIBuiltinVaListDecl()
9267 Context->VaListTagDecl = VaListTagDecl; in CreateAArch64ABIBuiltinVaListDecl()
9268 QualType VaListTagType = Context->getRecordType(VaListTagDecl); in CreateAArch64ABIBuiltinVaListDecl()
9271 return Context->buildImplicitTypedef(VaListTagType, "__builtin_va_list"); in CreateAArch64ABIBuiltinVaListDecl()
9278 VaListTagDecl = Context->buildImplicitRecord("__va_list_tag"); in CreatePowerABIBuiltinVaListDecl()
9279 VaListTagDecl->startDefinition(); in CreatePowerABIBuiltinVaListDecl()
9286 FieldTypes[0] = Context->UnsignedCharTy; in CreatePowerABIBuiltinVaListDecl()
9290 FieldTypes[1] = Context->UnsignedCharTy; in CreatePowerABIBuiltinVaListDecl()
9294 FieldTypes[2] = Context->UnsignedShortTy; in CreatePowerABIBuiltinVaListDecl()
9298 FieldTypes[3] = Context->getPointerType(Context->VoidTy); in CreatePowerABIBuiltinVaListDecl()
9302 FieldTypes[4] = Context->getPointerType(Context->VoidTy); in CreatePowerABIBuiltinVaListDecl()
9310 &Context->Idents.get(FieldNames[i]), in CreatePowerABIBuiltinVaListDecl()
9315 Field->setAccess(AS_public); in CreatePowerABIBuiltinVaListDecl()
9316 VaListTagDecl->addDecl(Field); in CreatePowerABIBuiltinVaListDecl()
9318 VaListTagDecl->completeDefinition(); in CreatePowerABIBuiltinVaListDecl()
9319 Context->VaListTagDecl = VaListTagDecl; in CreatePowerABIBuiltinVaListDecl()
9320 QualType VaListTagType = Context->getRecordType(VaListTagDecl); in CreatePowerABIBuiltinVaListDecl()
9324 Context->buildImplicitTypedef(VaListTagType, "__va_list_tag"); in CreatePowerABIBuiltinVaListDecl()
9327 Context->getTypedefType(VaListTagTypedefDecl); in CreatePowerABIBuiltinVaListDecl()
9330 llvm::APInt Size(Context->getTypeSize(Context->getSizeType()), 1); in CreatePowerABIBuiltinVaListDecl()
9331 QualType VaListTagArrayType = Context->getConstantArrayType( in CreatePowerABIBuiltinVaListDecl()
9333 return Context->buildImplicitTypedef(VaListTagArrayType, "__builtin_va_list"); in CreatePowerABIBuiltinVaListDecl()
9340 VaListTagDecl = Context->buildImplicitRecord("__va_list_tag"); in CreateX86_64ABIBuiltinVaListDecl()
9341 VaListTagDecl->startDefinition(); in CreateX86_64ABIBuiltinVaListDecl()
9348 FieldTypes[0] = Context->UnsignedIntTy; in CreateX86_64ABIBuiltinVaListDecl()
9352 FieldTypes[1] = Context->UnsignedIntTy; in CreateX86_64ABIBuiltinVaListDecl()
9356 FieldTypes[2] = Context->getPointerType(Context->VoidTy); in CreateX86_64ABIBuiltinVaListDecl()
9360 FieldTypes[3] = Context->getPointerType(Context->VoidTy); in CreateX86_64ABIBuiltinVaListDecl()
9369 &Context->Idents.get(FieldNames[i]), in CreateX86_64ABIBuiltinVaListDecl()
9374 Field->setAccess(AS_public); in CreateX86_64ABIBuiltinVaListDecl()
9375 VaListTagDecl->addDecl(Field); in CreateX86_64ABIBuiltinVaListDecl()
9377 VaListTagDecl->completeDefinition(); in CreateX86_64ABIBuiltinVaListDecl()
9378 Context->VaListTagDecl = VaListTagDecl; in CreateX86_64ABIBuiltinVaListDecl()
9379 QualType VaListTagType = Context->getRecordType(VaListTagDecl); in CreateX86_64ABIBuiltinVaListDecl()
9384 llvm::APInt Size(Context->getTypeSize(Context->getSizeType()), 1); in CreateX86_64ABIBuiltinVaListDecl()
9385 QualType VaListTagArrayType = Context->getConstantArrayType( in CreateX86_64ABIBuiltinVaListDecl()
9387 return Context->buildImplicitTypedef(VaListTagArrayType, "__builtin_va_list"); in CreateX86_64ABIBuiltinVaListDecl()
9392 llvm::APInt Size(Context->getTypeSize(Context->getSizeType()), 4); in CreatePNaClABIBuiltinVaListDecl()
9393 QualType IntArrayType = Context->getConstantArrayType( in CreatePNaClABIBuiltinVaListDecl()
9394 Context->IntTy, Size, nullptr, ArraySizeModifier::Normal, 0); in CreatePNaClABIBuiltinVaListDecl()
9395 return Context->buildImplicitTypedef(IntArrayType, "__builtin_va_list"); in CreatePNaClABIBuiltinVaListDecl()
9401 RecordDecl *VaListDecl = Context->buildImplicitRecord("__va_list"); in CreateAAPCSABIBuiltinVaListDecl()
9402 if (Context->getLangOpts().CPlusPlus) { in CreateAAPCSABIBuiltinVaListDecl()
9406 Context->getTranslationUnitDecl(), in CreateAAPCSABIBuiltinVaListDecl()
9408 SourceLocation(), &Context->Idents.get("std"), in CreateAAPCSABIBuiltinVaListDecl()
9410 NS->setImplicit(); in CreateAAPCSABIBuiltinVaListDecl()
9411 VaListDecl->setDeclContext(NS); in CreateAAPCSABIBuiltinVaListDecl()
9414 VaListDecl->startDefinition(); in CreateAAPCSABIBuiltinVaListDecl()
9421 &Context->Idents.get("__ap"), in CreateAAPCSABIBuiltinVaListDecl()
9422 Context->getPointerType(Context->VoidTy), in CreateAAPCSABIBuiltinVaListDecl()
9427 Field->setAccess(AS_public); in CreateAAPCSABIBuiltinVaListDecl()
9428 VaListDecl->addDecl(Field); in CreateAAPCSABIBuiltinVaListDecl()
9431 VaListDecl->completeDefinition(); in CreateAAPCSABIBuiltinVaListDecl()
9432 Context->VaListTagDecl = VaListDecl; in CreateAAPCSABIBuiltinVaListDecl()
9435 QualType T = Context->getRecordType(VaListDecl); in CreateAAPCSABIBuiltinVaListDecl()
9436 return Context->buildImplicitTypedef(T, "__builtin_va_list"); in CreateAAPCSABIBuiltinVaListDecl()
9443 VaListTagDecl = Context->buildImplicitRecord("__va_list_tag"); in CreateSystemZBuiltinVaListDecl()
9444 VaListTagDecl->startDefinition(); in CreateSystemZBuiltinVaListDecl()
9451 FieldTypes[0] = Context->LongTy; in CreateSystemZBuiltinVaListDecl()
9455 FieldTypes[1] = Context->LongTy; in CreateSystemZBuiltinVaListDecl()
9459 FieldTypes[2] = Context->getPointerType(Context->VoidTy); in CreateSystemZBuiltinVaListDecl()
9463 FieldTypes[3] = Context->getPointerType(Context->VoidTy); in CreateSystemZBuiltinVaListDecl()
9472 &Context->Idents.get(FieldNames[i]), in CreateSystemZBuiltinVaListDecl()
9477 Field->setAccess(AS_public); in CreateSystemZBuiltinVaListDecl()
9478 VaListTagDecl->addDecl(Field); in CreateSystemZBuiltinVaListDecl()
9480 VaListTagDecl->completeDefinition(); in CreateSystemZBuiltinVaListDecl()
9481 Context->VaListTagDecl = VaListTagDecl; in CreateSystemZBuiltinVaListDecl()
9482 QualType VaListTagType = Context->getRecordType(VaListTagDecl); in CreateSystemZBuiltinVaListDecl()
9487 llvm::APInt Size(Context->getTypeSize(Context->getSizeType()), 1); in CreateSystemZBuiltinVaListDecl()
9488 QualType VaListTagArrayType = Context->getConstantArrayType( in CreateSystemZBuiltinVaListDecl()
9491 return Context->buildImplicitTypedef(VaListTagArrayType, "__builtin_va_list"); in CreateSystemZBuiltinVaListDecl()
9497 VaListTagDecl = Context->buildImplicitRecord("__va_list_tag"); in CreateHexagonBuiltinVaListDecl()
9498 VaListTagDecl->startDefinition(); in CreateHexagonBuiltinVaListDecl()
9505 FieldTypes[0] = Context->getPointerType(Context->VoidTy); in CreateHexagonBuiltinVaListDecl()
9509 FieldTypes[1] = Context->getPointerType(Context->VoidTy); in CreateHexagonBuiltinVaListDecl()
9513 FieldTypes[2] = Context->getPointerType(Context->VoidTy); in CreateHexagonBuiltinVaListDecl()
9520 SourceLocation(), &Context->Idents.get(FieldNames[i]), FieldTypes[i], in CreateHexagonBuiltinVaListDecl()
9524 Field->setAccess(AS_public); in CreateHexagonBuiltinVaListDecl()
9525 VaListTagDecl->addDecl(Field); in CreateHexagonBuiltinVaListDecl()
9527 VaListTagDecl->completeDefinition(); in CreateHexagonBuiltinVaListDecl()
9528 Context->VaListTagDecl = VaListTagDecl; in CreateHexagonBuiltinVaListDecl()
9529 QualType VaListTagType = Context->getRecordType(VaListTagDecl); in CreateHexagonBuiltinVaListDecl()
9533 Context->buildImplicitTypedef(VaListTagType, "__va_list_tag"); in CreateHexagonBuiltinVaListDecl()
9535 QualType VaListTagTypedefType = Context->getTypedefType(VaListTagTypedefDecl); in CreateHexagonBuiltinVaListDecl()
9538 llvm::APInt Size(Context->getTypeSize(Context->getSizeType()), 1); in CreateHexagonBuiltinVaListDecl()
9539 QualType VaListTagArrayType = Context->getConstantArrayType( in CreateHexagonBuiltinVaListDecl()
9542 return Context->buildImplicitTypedef(VaListTagArrayType, "__builtin_va_list"); in CreateHexagonBuiltinVaListDecl()
9573 BuiltinVaListDecl = CreateVaListDecl(this, Target->getBuiltinVaListKind()); in getBuiltinVaListDecl()
9574 assert(BuiltinVaListDecl->isImplicit()); in getBuiltinVaListDecl()
9598 if (LangOpts.HLSL && FD->getBuiltinID() != Builtin::NotBuiltin && in canBuiltinBeRedeclared()
9599 BuiltinInfo.hasCustomTypechecking(FD->getBuiltinID())) in canBuiltinBeRedeclared()
9601 return BuiltinInfo.canBeRedeclared(FD->getBuiltinID()); in canBuiltinBeRedeclared()
9611 /// Retrieve the template name that corresponds to a non-empty
9616 unsigned size = End - Begin; in getOverloadedTemplateName()
9623 NamedDecl **Storage = OT->getStorage(); in getOverloadedTemplateName()
9629 isa<FunctionTemplateDecl>(D->getUnderlyingDecl()))); in getOverloadedTemplateName()
9636 /// Retrieve a template name representing an unqualified-id that has been
9672 assert((!NNS || NNS->isDependent()) && in getDependentTemplateName()
9708 assert((!NNS || NNS->isDependent()) && in getDependentTemplateName()
9782 /// getFromTargetType - Given one of the integer types provided by
9803 //===----------------------------------------------------------------------===//
9805 //===----------------------------------------------------------------------===//
9807 /// getObjCGCAttr - Returns one of GCNone, Weak or Strong objc's
9817 // Default behaviour under objective-C's gc is for ObjC pointers in getObjCGCAttrKind()
9821 if (Ty->isObjCObjectPointerType() || Ty->isBlockPointerType()) in getObjCGCAttrKind()
9823 else if (Ty->isPointerType()) in getObjCGCAttrKind()
9824 return getObjCGCAttrKind(Ty->castAs<PointerType>()->getPointeeType()); in getObjCGCAttrKind()
9829 QualType CT = Ty->getCanonicalTypeInternal(); in getObjCGCAttrKind()
9831 CT = AT->getElementType(); in getObjCGCAttrKind()
9832 assert(CT->isAnyPointerType() || CT->isBlockPointerType()); in getObjCGCAttrKind()
9838 //===----------------------------------------------------------------------===//
9840 //===----------------------------------------------------------------------===//
9842 /// areCompatVectorTypes - Return true if the two specified vector types are
9846 assert(LHS->isCanonicalUnqualified() && RHS->isCanonicalUnqualified()); in areCompatVectorTypes()
9847 return LHS->getElementType() == RHS->getElementType() && in areCompatVectorTypes()
9848 LHS->getNumElements() == RHS->getNumElements(); in areCompatVectorTypes()
9851 /// areCompatMatrixTypes - Return true if the two specified matrix types are
9855 assert(LHS->isCanonicalUnqualified() && RHS->isCanonicalUnqualified()); in areCompatMatrixTypes()
9856 return LHS->getElementType() == RHS->getElementType() && in areCompatMatrixTypes()
9857 LHS->getNumRows() == RHS->getNumRows() && in areCompatMatrixTypes()
9858 LHS->getNumColumns() == RHS->getNumColumns(); in areCompatMatrixTypes()
9863 assert(FirstVec->isVectorType() && "FirstVec should be a vector type"); in areCompatibleVectorTypes()
9864 assert(SecondVec->isVectorType() && "SecondVec should be a vector type"); in areCompatibleVectorTypes()
9871 const auto *First = FirstVec->castAs<VectorType>(); in areCompatibleVectorTypes()
9872 const auto *Second = SecondVec->castAs<VectorType>(); in areCompatibleVectorTypes()
9873 if (First->getNumElements() == Second->getNumElements() && in areCompatibleVectorTypes()
9874 hasSameType(First->getElementType(), Second->getElementType()) && in areCompatibleVectorTypes()
9875 First->getVectorKind() != VectorKind::AltiVecPixel && in areCompatibleVectorTypes()
9876 First->getVectorKind() != VectorKind::AltiVecBool && in areCompatibleVectorTypes()
9877 Second->getVectorKind() != VectorKind::AltiVecPixel && in areCompatibleVectorTypes()
9878 Second->getVectorKind() != VectorKind::AltiVecBool && in areCompatibleVectorTypes()
9879 First->getVectorKind() != VectorKind::SveFixedLengthData && in areCompatibleVectorTypes()
9880 First->getVectorKind() != VectorKind::SveFixedLengthPredicate && in areCompatibleVectorTypes()
9881 Second->getVectorKind() != VectorKind::SveFixedLengthData && in areCompatibleVectorTypes()
9882 Second->getVectorKind() != VectorKind::SveFixedLengthPredicate && in areCompatibleVectorTypes()
9883 First->getVectorKind() != VectorKind::RVVFixedLengthData && in areCompatibleVectorTypes()
9884 Second->getVectorKind() != VectorKind::RVVFixedLengthData && in areCompatibleVectorTypes()
9885 First->getVectorKind() != VectorKind::RVVFixedLengthMask && in areCompatibleVectorTypes()
9886 Second->getVectorKind() != VectorKind::RVVFixedLengthMask) in areCompatibleVectorTypes()
9892 /// getSVETypeSize - Return SVE vector or predicate register size.
9894 assert(Ty->isSveVLSBuiltinType() && "Invalid SVE Type"); in getSVETypeSize()
9895 if (Ty->getKind() == BuiltinType::SveBool || in getSVETypeSize()
9896 Ty->getKind() == BuiltinType::SveCount) in getSVETypeSize()
9904 if (const auto *BT = FirstType->getAs<BuiltinType>()) { in areCompatibleSveTypes()
9905 if (const auto *VT = SecondType->getAs<VectorType>()) { in areCompatibleSveTypes()
9908 if (VT->getVectorKind() == VectorKind::SveFixedLengthPredicate) in areCompatibleSveTypes()
9909 return BT->getKind() == BuiltinType::SveBool; in areCompatibleSveTypes()
9910 else if (VT->getVectorKind() == VectorKind::SveFixedLengthData) in areCompatibleSveTypes()
9911 return VT->getElementType().getCanonicalType() == in areCompatibleSveTypes()
9912 FirstType->getSveEltType(*this); in areCompatibleSveTypes()
9913 else if (VT->getVectorKind() == VectorKind::Generic) in areCompatibleSveTypes()
9915 hasSameType(VT->getElementType(), in areCompatibleSveTypes()
9929 const auto *BT = FirstType->getAs<BuiltinType>(); in areLaxCompatibleSveTypes()
9933 const auto *VecTy = SecondType->getAs<VectorType>(); in areLaxCompatibleSveTypes()
9934 if (VecTy && (VecTy->getVectorKind() == VectorKind::SveFixedLengthData || in areLaxCompatibleSveTypes()
9935 VecTy->getVectorKind() == VectorKind::Generic)) { in areLaxCompatibleSveTypes()
9941 if (BT->getKind() == BuiltinType::SveBool && in areLaxCompatibleSveTypes()
9942 VecTy->getVectorKind() == VectorKind::SveFixedLengthData) in areLaxCompatibleSveTypes()
9950 if (VecTy->getVectorKind() == VectorKind::Generic && in areLaxCompatibleSveTypes()
9954 // If -flax-vector-conversions=all is specified, the types are in areLaxCompatibleSveTypes()
9959 // If -flax-vector-conversions=integer is specified, the types are in areLaxCompatibleSveTypes()
9962 return VecTy->getElementType().getCanonicalType()->isIntegerType() && in areLaxCompatibleSveTypes()
9963 FirstType->getSveEltType(*this)->isIntegerType(); in areLaxCompatibleSveTypes()
9973 /// getRVVTypeSize - Return RVV vector register size.
9975 assert(Ty->isRVVVLSBuiltinType() && "Invalid RVV Type"); in getRVVTypeSize()
9987 return VScale->first * MinElts * EltSize; in getRVVTypeSize()
9993 ((FirstType->isRVVSizelessBuiltinType() && SecondType->isVectorType()) || in areCompatibleRVVTypes()
9994 (FirstType->isVectorType() && SecondType->isRVVSizelessBuiltinType())) && in areCompatibleRVVTypes()
9998 if (const auto *BT = FirstType->getAs<BuiltinType>()) { in areCompatibleRVVTypes()
9999 if (const auto *VT = SecondType->getAs<VectorType>()) { in areCompatibleRVVTypes()
10000 if (VT->getVectorKind() == VectorKind::RVVFixedLengthMask) { in areCompatibleRVVTypes()
10002 return FirstType->isRVVVLSBuiltinType() && in areCompatibleRVVTypes()
10006 if (VT->getVectorKind() == VectorKind::RVVFixedLengthData || in areCompatibleRVVTypes()
10007 VT->getVectorKind() == VectorKind::Generic) in areCompatibleRVVTypes()
10008 return FirstType->isRVVVLSBuiltinType() && in areCompatibleRVVTypes()
10010 hasSameType(VT->getElementType(), in areCompatibleRVVTypes()
10024 ((FirstType->isRVVSizelessBuiltinType() && SecondType->isVectorType()) || in areLaxCompatibleRVVTypes()
10025 (FirstType->isVectorType() && SecondType->isRVVSizelessBuiltinType())) && in areLaxCompatibleRVVTypes()
10029 const auto *BT = FirstType->getAs<BuiltinType>(); in areLaxCompatibleRVVTypes()
10033 if (!BT->isRVVVLSBuiltinType()) in areLaxCompatibleRVVTypes()
10036 const auto *VecTy = SecondType->getAs<VectorType>(); in areLaxCompatibleRVVTypes()
10037 if (VecTy && VecTy->getVectorKind() == VectorKind::Generic) { in areLaxCompatibleRVVTypes()
10045 // If -flax-vector-conversions=all is specified, the types are in areLaxCompatibleRVVTypes()
10050 // If -flax-vector-conversions=integer is specified, the types are in areLaxCompatibleRVVTypes()
10053 return VecTy->getElementType().getCanonicalType()->isIntegerType() && in areLaxCompatibleRVVTypes()
10054 FirstType->getRVVEltType(*this)->isIntegerType(); in areLaxCompatibleRVVTypes()
10068 if (Attr->getAttrKind() == attr::ObjCOwnership) in hasDirectOwnershipQualifier()
10071 Ty = Attr->getModifiedType(); in hasDirectOwnershipQualifier()
10075 Ty = Paren->getInnerType(); in hasDirectOwnershipQualifier()
10086 //===----------------------------------------------------------------------===//
10087 // ObjCQualifiedIdTypesAreCompatible - Compatibility testing for qualified id's.
10088 //===----------------------------------------------------------------------===//
10090 /// ProtocolCompatibleWithProtocol - return 'true' if 'lProto' is in the
10097 for (auto *PI : rProto->protocols()) in ProtocolCompatibleWithProtocol()
10103 /// ObjCQualifiedClassTypesAreCompatible - compare Class<pr,...> and
10107 for (auto *lhsProto : lhs->quals()) { in ObjCQualifiedClassTypesAreCompatible()
10109 for (auto *rhsProto : rhs->quals()) { in ObjCQualifiedClassTypesAreCompatible()
10121 /// ObjCQualifiedIdTypesAreCompatible - We know that one of lhs/rhs is an
10127 if (lhs->isObjCIdType() || rhs->isObjCIdType()) in ObjCQualifiedIdTypesAreCompatible()
10131 if (lhs->isObjCClassType() || lhs->isObjCQualifiedClassType() || in ObjCQualifiedIdTypesAreCompatible()
10132 rhs->isObjCClassType() || rhs->isObjCQualifiedClassType()) in ObjCQualifiedIdTypesAreCompatible()
10135 if (lhs->isObjCQualifiedIdType()) { in ObjCQualifiedIdTypesAreCompatible()
10136 if (rhs->qual_empty()) { in ObjCQualifiedIdTypesAreCompatible()
10139 if (ObjCInterfaceDecl *rhsID = rhs->getInterfaceDecl()) { in ObjCQualifiedIdTypesAreCompatible()
10140 for (auto *I : lhs->quals()) { in ObjCQualifiedIdTypesAreCompatible()
10144 if (!rhsID->ClassImplementsProtocol(I, true)) in ObjCQualifiedIdTypesAreCompatible()
10152 for (auto *lhsProto : lhs->quals()) { in ObjCQualifiedIdTypesAreCompatible()
10158 for (auto *rhsProto : rhs->quals()) { in ObjCQualifiedIdTypesAreCompatible()
10167 if (ObjCInterfaceDecl *rhsID = rhs->getInterfaceDecl()) { in ObjCQualifiedIdTypesAreCompatible()
10168 for (auto *I : lhs->quals()) { in ObjCQualifiedIdTypesAreCompatible()
10172 if (rhsID->ClassImplementsProtocol(I, true)) { in ObjCQualifiedIdTypesAreCompatible()
10185 assert(rhs->isObjCQualifiedIdType() && "One of the LHS/RHS should be id<x>"); in ObjCQualifiedIdTypesAreCompatible()
10187 if (lhs->getInterfaceType()) { in ObjCQualifiedIdTypesAreCompatible()
10189 for (auto *lhsProto : lhs->quals()) { in ObjCQualifiedIdTypesAreCompatible()
10197 for (auto *rhsProto : rhs->quals()) { in ObjCQualifiedIdTypesAreCompatible()
10210 if (ObjCInterfaceDecl *lhsID = lhs->getInterfaceDecl()) { in ObjCQualifiedIdTypesAreCompatible()
10216 if (LHSInheritedProtocols.empty() && lhs->qual_empty()) in ObjCQualifiedIdTypesAreCompatible()
10220 for (auto *rhsProto : rhs->quals()) { in ObjCQualifiedIdTypesAreCompatible()
10236 /// canAssignObjCInterfaces - Return true if the two interface types are
10241 const ObjCObjectType* LHS = LHSOPT->getObjectType(); in canAssignObjCInterfaces()
10242 const ObjCObjectType* RHS = RHSOPT->getObjectType(); in canAssignObjCInterfaces()
10244 // If either type represents the built-in 'id' type, return true. in canAssignObjCInterfaces()
10245 if (LHS->isObjCUnqualifiedId() || RHS->isObjCUnqualifiedId()) in canAssignObjCInterfaces()
10250 auto finish = [&](bool succeeded) -> bool { in canAssignObjCInterfaces()
10254 if (!RHS->isKindOfType()) in canAssignObjCInterfaces()
10259 return canAssignObjCInterfaces(RHSOPT->stripObjCKindOfTypeAndQuals(*this), in canAssignObjCInterfaces()
10260 LHSOPT->stripObjCKindOfTypeAndQuals(*this)); in canAssignObjCInterfaces()
10265 if (LHS->isObjCQualifiedId() || RHS->isObjCQualifiedId()) { in canAssignObjCInterfaces()
10270 if (LHS->isObjCQualifiedClass() && RHS->isObjCQualifiedClass()) { in canAssignObjCInterfaces()
10274 // Casts from Class to Class<Foo>, or vice-versa, are allowed. in canAssignObjCInterfaces()
10275 if (LHS->isObjCClass() && RHS->isObjCClass()) { in canAssignObjCInterfaces()
10279 // If we have 2 user-defined types, fall into that path. in canAssignObjCInterfaces()
10280 if (LHS->getInterface() && RHS->getInterface()) { in canAssignObjCInterfaces()
10287 /// canAssignObjCInterfacesInBlockPointer - This routine is specifically written
10288 /// for providing type-safety for objective-c pointers used to pass/return
10299 auto finish = [&](bool succeeded) -> bool { in canAssignObjCInterfacesInBlockPointer()
10304 if (!Expected->isKindOfType()) in canAssignObjCInterfacesInBlockPointer()
10310 RHSOPT->stripObjCKindOfTypeAndQuals(*this), in canAssignObjCInterfacesInBlockPointer()
10311 LHSOPT->stripObjCKindOfTypeAndQuals(*this), in canAssignObjCInterfacesInBlockPointer()
10315 if (RHSOPT->isObjCBuiltinType() || LHSOPT->isObjCIdType()) in canAssignObjCInterfacesInBlockPointer()
10318 if (LHSOPT->isObjCBuiltinType()) { in canAssignObjCInterfacesInBlockPointer()
10319 return finish(RHSOPT->isObjCBuiltinType() || in canAssignObjCInterfacesInBlockPointer()
10320 RHSOPT->isObjCQualifiedIdType()); in canAssignObjCInterfacesInBlockPointer()
10323 if (LHSOPT->isObjCQualifiedIdType() || RHSOPT->isObjCQualifiedIdType()) { in canAssignObjCInterfacesInBlockPointer()
10327 // Or corrected type checking as in non-compat mode. in canAssignObjCInterfacesInBlockPointer()
10336 const ObjCInterfaceType* LHS = LHSOPT->getInterfaceType(); in canAssignObjCInterfacesInBlockPointer()
10337 const ObjCInterfaceType* RHS = RHSOPT->getInterfaceType(); in canAssignObjCInterfacesInBlockPointer()
10338 if (LHS && RHS) { // We have 2 user-defined types. in canAssignObjCInterfacesInBlockPointer()
10340 if (LHS->getDecl()->isSuperClassOf(RHS->getDecl())) in canAssignObjCInterfacesInBlockPointer()
10342 if (RHS->getDecl()->isSuperClassOf(LHS->getDecl())) in canAssignObjCInterfacesInBlockPointer()
10351 /// Comparison routine for Objective-C protocols to be used with
10355 return (*lhs)->getName().compare((*rhs)->getName()); in compareObjCProtocolsByName()
10358 /// getIntersectionOfProtocols - This routine finds the intersection of set
10359 /// of protocols inherited from two distinct objective-c pointer objects with
10362 /// the conditional expression involving two objective-c pointer objects.
10370 const ObjCObjectType* LHS = LHSOPT->getObjectType(); in getIntersectionOfProtocols()
10371 const ObjCObjectType* RHS = RHSOPT->getObjectType(); in getIntersectionOfProtocols()
10372 assert(LHS->getInterface() && "LHS must have an interface base"); in getIntersectionOfProtocols()
10373 assert(RHS->getInterface() && "RHS must have an interface base"); in getIntersectionOfProtocols()
10379 for (auto *proto : LHS->quals()) { in getIntersectionOfProtocols()
10384 Context.CollectInheritedProtocols(LHS->getInterface(), LHSProtocolSet); in getIntersectionOfProtocols()
10390 for (auto *proto : RHS->quals()) { in getIntersectionOfProtocols()
10395 Context.CollectInheritedProtocols(RHS->getInterface(), RHSProtocolSet); in getIntersectionOfProtocols()
10410 llvm::erase_if(IntersectionSet, [&](ObjCProtocolDecl *proto) -> bool { in getIntersectionOfProtocols()
10424 const auto *lhsOPT = lhs->getAs<ObjCObjectPointerType>(); in canAssignObjCObjectTypes()
10425 const auto *rhsOPT = rhs->getAs<ObjCObjectPointerType>(); in canAssignObjCObjectTypes()
10430 const auto *lhsBlock = lhs->getAs<BlockPointerType>(); in canAssignObjCObjectTypes()
10431 const auto *rhsBlock = rhs->getAs<BlockPointerType>(); in canAssignObjCObjectTypes()
10437 if ((lhsOPT && lhsOPT->isObjCIdType() && rhsBlock) || in canAssignObjCObjectTypes()
10438 (rhsOPT && rhsOPT->isObjCIdType() && lhsBlock)) in canAssignObjCObjectTypes()
10444 // Check that the given Objective-C type argument lists are equivalent.
10453 ObjCTypeParamList *typeParams = iface->getTypeParamList(); in sameObjCTypeArgs()
10461 switch (typeParams->begin()[i]->getVariance()) { in sameObjCTypeArgs()
10488 const ObjCObjectType *LHS = Lptr->getObjectType(); in areCommonBaseCompatible()
10489 const ObjCObjectType *RHS = Rptr->getObjectType(); in areCommonBaseCompatible()
10490 const ObjCInterfaceDecl* LDecl = LHS->getInterface(); in areCommonBaseCompatible()
10491 const ObjCInterfaceDecl* RDecl = RHS->getInterface(); in areCommonBaseCompatible()
10499 bool anyKindOf = LHS->isKindOfType() || RHS->isKindOfType(); in areCommonBaseCompatible()
10501 // Follow the left-hand side up the class hierarchy until we either hit a in areCommonBaseCompatible()
10508 LHSAncestors[LHS->getInterface()->getCanonicalDecl()] = LHS; in areCommonBaseCompatible()
10510 if (declaresSameEntity(LHS->getInterface(), RDecl)) { in areCommonBaseCompatible()
10512 ArrayRef<QualType> LHSTypeArgs = LHS->getTypeArgsAsWritten(); in areCommonBaseCompatible()
10514 if (LHS->isSpecialized() && RHS->isSpecialized()) { in areCommonBaseCompatible()
10516 if (!sameObjCTypeArgs(*this, LHS->getInterface(), in areCommonBaseCompatible()
10517 LHS->getTypeArgs(), RHS->getTypeArgs(), in areCommonBaseCompatible()
10520 } else if (LHS->isSpecialized() != RHS->isSpecialized()) { in areCommonBaseCompatible()
10529 getIntersectionOfProtocols(*this, LHS->getInterface(), Lptr, Rptr, in areCommonBaseCompatible()
10537 if (anyChanges || LHS->isKindOfType() != anyKindOf) { in areCommonBaseCompatible()
10538 QualType Result = getObjCInterfaceType(LHS->getInterface()); in areCommonBaseCompatible()
10540 anyKindOf || LHS->isKindOfType()); in areCommonBaseCompatible()
10548 QualType LHSSuperType = LHS->getSuperClassType(); in areCommonBaseCompatible()
10552 LHS = LHSSuperType->castAs<ObjCObjectType>(); in areCommonBaseCompatible()
10558 auto KnownLHS = LHSAncestors.find(RHS->getInterface()->getCanonicalDecl()); in areCommonBaseCompatible()
10560 LHS = KnownLHS->second; in areCommonBaseCompatible()
10563 ArrayRef<QualType> RHSTypeArgs = RHS->getTypeArgsAsWritten(); in areCommonBaseCompatible()
10565 if (LHS->isSpecialized() && RHS->isSpecialized()) { in areCommonBaseCompatible()
10567 if (!sameObjCTypeArgs(*this, LHS->getInterface(), in areCommonBaseCompatible()
10568 LHS->getTypeArgs(), RHS->getTypeArgs(), in areCommonBaseCompatible()
10571 } else if (LHS->isSpecialized() != RHS->isSpecialized()) { in areCommonBaseCompatible()
10580 getIntersectionOfProtocols(*this, RHS->getInterface(), Lptr, Rptr, in areCommonBaseCompatible()
10587 if (anyChanges || RHS->isKindOfType() != anyKindOf) { in areCommonBaseCompatible()
10588 QualType Result = getObjCInterfaceType(RHS->getInterface()); in areCommonBaseCompatible()
10590 anyKindOf || RHS->isKindOfType()); in areCommonBaseCompatible()
10598 QualType RHSSuperType = RHS->getSuperClassType(); in areCommonBaseCompatible()
10602 RHS = RHSSuperType->castAs<ObjCObjectType>(); in areCommonBaseCompatible()
10610 assert(LHS->getInterface() && "LHS is not an interface type"); in canAssignObjCInterfaces()
10611 assert(RHS->getInterface() && "RHS is not an interface type"); in canAssignObjCInterfaces()
10615 ObjCInterfaceDecl *LHSInterface = LHS->getInterface(); in canAssignObjCInterfaces()
10616 bool IsSuperClass = LHSInterface->isSuperClassOf(RHS->getInterface()); in canAssignObjCInterfaces()
10623 if (LHS->getNumProtocols() > 0) { in canAssignObjCInterfaces()
10629 CollectInheritedProtocols(RHS->getInterface(), SuperClassInheritedProtocols); in canAssignObjCInterfaces()
10632 for (auto *RHSPI : RHS->quals()) in canAssignObjCInterfaces()
10638 for (const auto *LHSProto : LHS->quals()) { in canAssignObjCInterfaces()
10641 if (SuperClassProto->lookupProtocolNamed(LHSProto->getIdentifier())) { in canAssignObjCInterfaces()
10651 if (LHS->isSpecialized()) { in canAssignObjCInterfaces()
10655 while (!declaresSameEntity(RHSSuper->getInterface(), LHSInterface)) in canAssignObjCInterfaces()
10656 RHSSuper = RHSSuper->getSuperClassType()->castAs<ObjCObjectType>(); in canAssignObjCInterfaces()
10659 if (RHSSuper->isSpecialized() && in canAssignObjCInterfaces()
10660 !sameObjCTypeArgs(*this, LHS->getInterface(), in canAssignObjCInterfaces()
10661 LHS->getTypeArgs(), RHSSuper->getTypeArgs(), in canAssignObjCInterfaces()
10672 const auto *LHSOPT = LHS->getAs<ObjCObjectPointerType>(); in areComparableObjCPointerTypes()
10673 const auto *RHSOPT = RHS->getAs<ObjCObjectPointerType>(); in areComparableObjCPointerTypes()
10684 getObjCObjectPointerType(To)->castAs<ObjCObjectPointerType>(), in canBindObjCObjectType()
10685 getObjCObjectPointerType(From)->castAs<ObjCObjectPointerType>()); in canBindObjCObjectType()
10688 /// typesAreCompatible - C99 6.7.3p9: For two qualified types to be compatible,
10708 /// mergeTransparentUnionType - if T is a transparent union type and a member
10714 if (const RecordType *UT = T->getAsUnionType()) { in mergeTransparentUnionType()
10715 RecordDecl *UD = UT->getDecl(); in mergeTransparentUnionType()
10716 if (UD->hasAttr<TransparentUnionAttr>()) { in mergeTransparentUnionType()
10717 for (const auto *I : UD->fields()) { in mergeTransparentUnionType()
10718 QualType ET = I->getType().getUnqualifiedType(); in mergeTransparentUnionType()
10729 /// mergeFunctionParameterTypes - merge two types which appear as function
10754 const auto *lbase = lhs->castAs<FunctionType>(); in mergeFunctionTypes()
10755 const auto *rbase = rhs->castAs<FunctionType>(); in mergeFunctionTypes()
10764 QualType RHS = rbase->getReturnType(); in mergeFunctionTypes()
10765 QualType LHS = lbase->getReturnType(); in mergeFunctionTypes()
10772 retType = mergeTypes(lbase->getReturnType(), rbase->getReturnType(), false, in mergeFunctionTypes()
10780 CanQualType LRetType = getCanonicalType(lbase->getReturnType()); in mergeFunctionTypes()
10781 CanQualType RRetType = getCanonicalType(rbase->getReturnType()); in mergeFunctionTypes()
10793 // FIXME: should we error if lbase->getRegParmAttr() != 0 && in mergeFunctionTypes()
10794 // rbase->getRegParmAttr() != 0 && in mergeFunctionTypes()
10795 // lbase->getRegParmAttr() != rbase->getRegParmAttr()? in mergeFunctionTypes()
10796 FunctionType::ExtInfo lbaseInfo = lbase->getExtInfo(); in mergeFunctionTypes()
10797 FunctionType::ExtInfo rbaseInfo = rbase->getExtInfo(); in mergeFunctionTypes()
10832 // higher-order functions (taking noreturn callbacks!), which is uncommon to in mergeFunctionTypes()
10848 (!lproto->hasExceptionSpec() && !rproto->hasExceptionSpec())) && in mergeFunctionTypes()
10851 if (lproto->getNumParams() != rproto->getNumParams()) in mergeFunctionTypes()
10854 // Variadic and non-variadic functions aren't compatible in mergeFunctionTypes()
10855 if (lproto->isVariadic() != rproto->isVariadic()) in mergeFunctionTypes()
10858 if (lproto->getMethodQuals() != rproto->getMethodQuals()) in mergeFunctionTypes()
10862 FunctionEffectsRef LHSFX = lproto->getFunctionEffects(); in mergeFunctionTypes()
10863 FunctionEffectsRef RHSFX = rproto->getFunctionEffects(); in mergeFunctionTypes()
10893 for (unsigned i = 0, n = lproto->getNumParams(); i < n; i++) { in mergeFunctionTypes()
10894 QualType lParamType = lproto->getParamType(i).getUnqualifiedType(); in mergeFunctionTypes()
10895 QualType rParamType = rproto->getParamType(i).getUnqualifiedType(); in mergeFunctionTypes()
10919 FunctionProtoType::ExtProtoInfo EPI = lproto->getExtProtoInfo(); in mergeFunctionTypes()
10933 assert((AllowCXX || !proto->hasExceptionSpec()) && "C++ shouldn't be here"); in mergeFunctionTypes()
10934 if (proto->isVariadic()) in mergeFunctionTypes()
10941 for (unsigned i = 0, n = proto->getNumParams(); i < n; ++i) { in mergeFunctionTypes()
10942 QualType paramTy = proto->getParamType(i); in mergeFunctionTypes()
10946 if (const auto *Enum = paramTy->getAs<EnumType>()) { in mergeFunctionTypes()
10947 paramTy = Enum->getDecl()->getIntegerType(); in mergeFunctionTypes()
10960 FunctionProtoType::ExtProtoInfo EPI = proto->getExtProtoInfo(); in mergeFunctionTypes()
10964 return getFunctionType(retType, proto->getParamTypes(), EPI); in mergeFunctionTypes()
10972 /// Given that we have an enum type and a non-enum type, try to merge them.
10979 QualType underlyingType = ET->getDecl()->getIntegerType(); in mergeEnumWithInteger()
10987 if (isBlockReturnType && other->isIntegerType() && in mergeEnumWithInteger()
11005 auto *LHSRefTy = LHS->getAs<ReferenceType>(); in mergeTypes()
11006 auto *RHSRefTy = RHS->getAs<ReferenceType>(); in mergeTypes()
11008 LHS->getTypeClass() == RHS->getTypeClass()) in mergeTypes()
11009 return mergeTypes(LHSRefTy->getPointeeType(), RHSRefTy->getPointeeType(), in mergeTypes()
11050 if (GC_L == Qualifiers::Strong && RHSCan->isObjCObjectPointerType()) { in mergeTypes()
11053 if (GC_R == Qualifiers::Strong && LHSCan->isObjCObjectPointerType()) { in mergeTypes()
11061 Type::TypeClass LHSClass = LHSCan->getTypeClass(); in mergeTypes()
11062 Type::TypeClass RHSClass = RHSCan->getTypeClass(); in mergeTypes()
11079 // Canonicalize ExtVector -> Vector. in mergeTypes()
11086 // returns into block int returns, not vice-versa. in mergeTypes()
11087 if (const auto *ETy = LHS->getAs<EnumType>()) { in mergeTypes()
11090 if (const EnumType* ETy = RHS->getAs<EnumType>()) { in mergeTypes()
11095 if (LHS->isObjCIdType() && RHS->isBlockPointerType()) in mergeTypes()
11097 if (RHS->isObjCIdType() && LHS->isBlockPointerType()) in mergeTypes()
11102 if (const auto *AT = LHS->getAs<AutoType>()) { in mergeTypes()
11103 if (!AT->isDeduced() && AT->isGNUAutoType()) in mergeTypes()
11106 if (const auto *AT = RHS->getAs<AutoType>()) { in mergeTypes()
11107 if (!AT->isDeduced() && AT->isGNUAutoType()) in mergeTypes()
11121 llvm_unreachable("Non-canonical and dependent types shouldn't get here"); in mergeTypes()
11140 QualType LHSPointee = LHS->castAs<PointerType>()->getPointeeType(); in mergeTypes()
11141 QualType RHSPointee = RHS->castAs<PointerType>()->getPointeeType(); in mergeTypes()
11159 QualType LHSPointee = LHS->castAs<BlockPointerType>()->getPointeeType(); in mergeTypes()
11160 QualType RHSPointee = RHS->castAs<BlockPointerType>()->getPointeeType(); in mergeTypes()
11192 QualType LHSValue = LHS->castAs<AtomicType>()->getValueType(); in mergeTypes()
11193 QualType RHSValue = RHS->castAs<AtomicType>()->getValueType(); in mergeTypes()
11212 if (LCAT && RCAT && RCAT->getZExtSize() != LCAT->getZExtSize()) in mergeTypes()
11215 QualType LHSElem = getAsArrayType(LHS)->getElementType(); in mergeTypes()
11216 QualType RHSElem = getAsArrayType(RHS)->getElementType(); in mergeTypes()
11234 -> std::pair<bool,llvm::APInt> { in mergeTypes()
11237 Expr *E = VAT->getSizeExpr(); in mergeTypes()
11238 if (E && (TheInt = E->getIntegerConstantExpr(*this))) in mergeTypes()
11243 return std::make_pair(true, CAT->getSize()); in mergeTypes()
11260 return getConstantArrayType(ResultType, LCAT->getSize(), in mergeTypes()
11261 LCAT->getSizeExpr(), ArraySizeModifier(), 0); in mergeTypes()
11263 return getConstantArrayType(ResultType, RCAT->getSize(), in mergeTypes()
11264 RCAT->getSizeExpr(), ArraySizeModifier(), 0); in mergeTypes()
11299 if (areCompatVectorTypes(LHSCan->castAs<VectorType>(), in mergeTypes()
11300 RHSCan->castAs<VectorType>())) in mergeTypes()
11304 if (areCompatMatrixTypes(LHSCan->castAs<ConstantMatrixType>(), in mergeTypes()
11305 RHSCan->castAs<ConstantMatrixType>())) in mergeTypes()
11312 if (canAssignObjCInterfaces(LHS->castAs<ObjCObjectType>(), in mergeTypes()
11313 RHS->castAs<ObjCObjectType>())) in mergeTypes()
11320 LHS->castAs<ObjCObjectPointerType>(), in mergeTypes()
11321 RHS->castAs<ObjCObjectPointerType>(), BlockReturnType)) in mergeTypes()
11325 if (canAssignObjCInterfaces(LHS->castAs<ObjCObjectPointerType>(), in mergeTypes()
11326 RHS->castAs<ObjCObjectPointerType>())) in mergeTypes()
11338 // Merge two bit-precise int types, while trying to preserve typedef info. in mergeTypes()
11339 bool LHSUnsigned = LHS->castAs<BitIntType>()->isUnsigned(); in mergeTypes()
11340 bool RHSUnsigned = RHS->castAs<BitIntType>()->isUnsigned(); in mergeTypes()
11341 unsigned LHSBits = LHS->castAs<BitIntType>()->getNumBits(); in mergeTypes()
11342 unsigned RHSBits = RHS->castAs<BitIntType>()->getNumBits(); in mergeTypes()
11363 bool FirstHasInfo = FirstFnType->hasExtParameterInfos(); in mergeExtParameterInfo()
11364 bool SecondHasInfo = SecondFnType->hasExtParameterInfos(); in mergeExtParameterInfo()
11372 size_t E = FirstHasInfo ? FirstFnType->getExtParameterInfos().size() in mergeExtParameterInfo()
11373 : SecondFnType->getExtParameterInfos().size(); in mergeExtParameterInfo()
11378 FirstParam = FirstFnType->getExtParameterInfo(I); in mergeExtParameterInfo()
11380 SecondParam = SecondFnType->getExtParameterInfo(I); in mergeExtParameterInfo()
11408 /// mergeObjCGCQualifiers - This routine merges ObjC's GC attribute of 'LHS' and
11417 if (RHSCan->isFunctionType()) { in mergeObjCGCQualifiers()
11418 if (!LHSCan->isFunctionType()) in mergeObjCGCQualifiers()
11421 cast<FunctionType>(RHSCan.getTypePtr())->getReturnType(); in mergeObjCGCQualifiers()
11423 cast<FunctionType>(LHSCan.getTypePtr())->getReturnType(); in mergeObjCGCQualifiers()
11431 const auto *F = LHS->castAs<FunctionType>(); in mergeObjCGCQualifiers()
11433 FunctionProtoType::ExtProtoInfo EPI = FPT->getExtProtoInfo(); in mergeObjCGCQualifiers()
11436 getFunctionType(OldReturnType, FPT->getParamTypes(), EPI); in mergeObjCGCQualifiers()
11471 if (LHSCan->isObjCObjectPointerType() && RHSCan->isObjCObjectPointerType()) { in mergeObjCGCQualifiers()
11472 QualType LHSBaseQT = LHS->castAs<ObjCObjectPointerType>()->getPointeeType(); in mergeObjCGCQualifiers()
11473 QualType RHSBaseQT = RHS->castAs<ObjCObjectPointerType>()->getPointeeType(); in mergeObjCGCQualifiers()
11483 //===----------------------------------------------------------------------===//
11485 //===----------------------------------------------------------------------===//
11488 if (const auto *ET = T->getAs<EnumType>()) in getIntWidth()
11489 T = ET->getDecl()->getIntegerType(); in getIntWidth()
11490 if (T->isBooleanType()) in getIntWidth()
11492 if (const auto *EIT = T->getAs<BitIntType>()) in getIntWidth()
11493 return EIT->getNumBits(); in getIntWidth()
11499 assert((T->hasIntegerRepresentation() || T->isEnumeralType() || in getCorrespondingUnsignedType()
11500 T->isFixedPointType()) && in getCorrespondingUnsignedType()
11503 // Turn <4 x signed int> -> <4 x unsigned int> in getCorrespondingUnsignedType()
11504 if (const auto *VTy = T->getAs<VectorType>()) in getCorrespondingUnsignedType()
11505 return getVectorType(getCorrespondingUnsignedType(VTy->getElementType()), in getCorrespondingUnsignedType()
11506 VTy->getNumElements(), VTy->getVectorKind()); in getCorrespondingUnsignedType()
11509 if (const auto *EITy = T->getAs<BitIntType>()) in getCorrespondingUnsignedType()
11510 return getBitIntType(/*Unsigned=*/true, EITy->getNumBits()); in getCorrespondingUnsignedType()
11514 if (const auto *ETy = T->getAs<EnumType>()) in getCorrespondingUnsignedType()
11515 T = ETy->getDecl()->getIntegerType(); in getCorrespondingUnsignedType()
11517 switch (T->castAs<BuiltinType>()->getKind()) { in getCorrespondingUnsignedType()
11565 assert((T->hasUnsignedIntegerRepresentation() || in getCorrespondingUnsignedType()
11566 T->isUnsignedFixedPointType()) && in getCorrespondingUnsignedType()
11573 assert((T->hasIntegerRepresentation() || T->isEnumeralType() || in getCorrespondingSignedType()
11574 T->isFixedPointType()) && in getCorrespondingSignedType()
11577 // Turn <4 x unsigned int> -> <4 x signed int> in getCorrespondingSignedType()
11578 if (const auto *VTy = T->getAs<VectorType>()) in getCorrespondingSignedType()
11579 return getVectorType(getCorrespondingSignedType(VTy->getElementType()), in getCorrespondingSignedType()
11580 VTy->getNumElements(), VTy->getVectorKind()); in getCorrespondingSignedType()
11583 if (const auto *EITy = T->getAs<BitIntType>()) in getCorrespondingSignedType()
11584 return getBitIntType(/*Unsigned=*/false, EITy->getNumBits()); in getCorrespondingSignedType()
11588 if (const auto *ETy = T->getAs<EnumType>()) in getCorrespondingSignedType()
11589 T = ETy->getDecl()->getIntegerType(); in getCorrespondingSignedType()
11591 switch (T->castAs<BuiltinType>()->getKind()) { in getCorrespondingSignedType()
11640 (T->hasSignedIntegerRepresentation() || T->isSignedFixedPointType()) && in getCorrespondingSignedType()
11651 //===----------------------------------------------------------------------===//
11653 //===----------------------------------------------------------------------===//
11655 /// DecodeTypeFromStr - This decodes one type descriptor from Str, advancing the
11679 default: Done = true; --Str; break; in DecodeTypeFromStr()
11859 // passed by reference. An example of a by-value va_list is in DecodeTypeFromStr()
11860 // x86, where va_list is a char*. An example of by-ref va_list in DecodeTypeFromStr()
11861 // is x86-64, where va_list is a __va_list_tag[1]. For x86, in DecodeTypeFromStr()
11862 // we want this argument to be a char*&; for x86-64, we want in DecodeTypeFromStr()
11866 if (Type->isArrayType()) in DecodeTypeFromStr()
11972 default: Done = true; --Str; break; in DecodeTypeFromStr()
11992 // FIXME: There's no way to have a built-in with an rvalue ref arg. in DecodeTypeFromStr()
12005 assert((!RequiresICE || Type->isIntegralOrEnumerationType()) && in DecodeTypeFromStr()
12012 // type descriptors for target-dependent types. These descriptors are decoded in
12014 // descriptor decoding to define builtins mixing target-dependent and target-
12023 /// GetBuiltinType - Return the type for the specified builtin.
12054 // Do array -> pointer decay. The builtin should use the decayed type. in GetBuiltinType()
12055 if (Ty->isArrayType()) in GetBuiltinType()
12074 // We really shouldn't be making a no-proto type here. in GetBuiltinType()
12090 if (!FD->isExternallyVisible()) in basicGVALinkageForFunction()
12093 // Non-user-provided functions get emitted as weak definitions with every in basicGVALinkageForFunction()
12095 if (!FD->isUserProvided()) in basicGVALinkageForFunction()
12099 switch (FD->getTemplateSpecializationKind()) { in basicGVALinkageForFunction()
12112 // inlining, but that no out-of-line copy of the inline function would be in basicGVALinkageForFunction()
12113 // generated in the translation unit. -- end note ] in basicGVALinkageForFunction()
12122 if (!FD->isInlined()) in basicGVALinkageForFunction()
12127 !FD->hasAttr<DLLExportAttr>()) || in basicGVALinkageForFunction()
12128 FD->hasAttr<GNUInlineAttr>()) { in basicGVALinkageForFunction()
12133 if (FD->isInlineDefinitionExternallyVisible()) in basicGVALinkageForFunction()
12140 // Functions specified with extern and inline in -fms-compatibility mode in basicGVALinkageForFunction()
12143 if (FD->isMSExternInline()) in basicGVALinkageForFunction()
12148 cast<CXXConstructorDecl>(FD)->isInheritingConstructor()) in basicGVALinkageForFunction()
12159 // See http://msdn.microsoft.com/en-us/library/xa0d9ste.aspx in adjustGVALinkageForAttributes()
12161 if (D->hasAttr<DLLImportAttr>()) { in adjustGVALinkageForAttributes()
12164 } else if (D->hasAttr<DLLExportAttr>()) { in adjustGVALinkageForAttributes()
12168 // Device-side functions with __global__ attribute must always be in adjustGVALinkageForAttributes()
12170 if (D->hasAttr<CUDAGlobalAttr>() && in adjustGVALinkageForAttributes()
12194 switch (Source->hasExternalDefinitions(D)) { in adjustGVALinkageForExternalDefinitionKind()
12223 VD->getType().isConstQualified() && in basicGVALinkageForVariable()
12224 !VD->getType().isVolatileQualified() && !VD->isInline() && in basicGVALinkageForVariable()
12225 !isa<VarTemplateSpecializationDecl>(VD) && !VD->getDescribedVarTemplate()) in basicGVALinkageForVariable()
12228 if (!VD->isExternallyVisible()) in basicGVALinkageForVariable()
12231 if (VD->isStaticLocal()) { in basicGVALinkageForVariable()
12232 const DeclContext *LexicalContext = VD->getParentFunctionOrMethod(); in basicGVALinkageForVariable()
12234 LexicalContext = LexicalContext->getLexicalParent(); in basicGVALinkageForVariable()
12248 // contains, whether inline or out-of-line." in basicGVALinkageForVariable()
12258 // MSVC treats in-class initialized static data members as definitions. in basicGVALinkageForVariable()
12259 // By giving them non-strong linkage, out-of-line definitions won't in basicGVALinkageForVariable()
12264 // Most non-template variables have strong linkage; inline variables are in basicGVALinkageForVariable()
12280 switch (VD->getTemplateSpecializationKind()) { in basicGVALinkageForVariable()
12286 VD->isStaticDataMember() in basicGVALinkageForVariable()
12311 if (!VD->isFileVarDecl()) in DeclMustBeEmitted()
12314 if (VD->getStorageClass() == SC_Register) in DeclMustBeEmitted()
12316 if (VD->getDescribedVarTemplate() || in DeclMustBeEmitted()
12321 if (FD->getTemplatedKind() == FunctionDecl::TK_FunctionTemplate) in DeclMustBeEmitted()
12330 return !D->getDeclContext()->isDependentContext(); in DeclMustBeEmitted()
12332 return !D->getDeclContext()->isDependentContext(); in DeclMustBeEmitted()
12334 return !D->getDeclContext()->isDependentContext(); in DeclMustBeEmitted()
12341 if (D->getDeclContext()->isDependentContext()) in DeclMustBeEmitted()
12345 if (D->hasAttr<WeakRefAttr>()) in DeclMustBeEmitted()
12349 if (D->hasAttr<AliasAttr>() || D->hasAttr<UsedAttr>()) in DeclMustBeEmitted()
12354 if (!FD->doesThisDeclarationHaveABody()) in DeclMustBeEmitted()
12355 return FD->doesDeclarationForceExternallyVisibleDefinition(); in DeclMustBeEmitted()
12358 if (FD->hasAttr<ConstructorAttr>() || FD->hasAttr<DestructorAttr>()) in DeclMustBeEmitted()
12365 const CXXRecordDecl *RD = MD->getParent(); in DeclMustBeEmitted()
12366 if (MD->isOutOfLine() && RD->isDynamicClass()) { in DeclMustBeEmitted()
12368 if (KeyFunc && KeyFunc->getCanonicalDecl() == MD->getCanonicalDecl()) in DeclMustBeEmitted()
12383 assert(VD->isFileVarDecl() && "Expected file scoped var"); in DeclMustBeEmitted()
12391 if (VD->isThisDeclarationADefinition() == VarDecl::DeclarationOnly && in DeclMustBeEmitted()
12395 if (VD->shouldEmitInExternalSource()) in DeclMustBeEmitted()
12407 // Variables that have destruction with side-effects are required. in DeclMustBeEmitted()
12408 if (VD->needsDestruction(*this)) in DeclMustBeEmitted()
12411 // Variables that have initialization with side-effects are required. in DeclMustBeEmitted()
12412 if (VD->getInit() && VD->getInit()->HasSideEffects(*this) && in DeclMustBeEmitted()
12413 // We can get a value-dependent initializer during error recovery. in DeclMustBeEmitted()
12414 (VD->getInit()->isValueDependent() || !VD->evaluateValue())) in DeclMustBeEmitted()
12417 // Likewise, variables with tuple-like bindings are required if their in DeclMustBeEmitted()
12418 // bindings have side-effects. in DeclMustBeEmitted()
12420 for (const auto *BD : DD->bindings()) in DeclMustBeEmitted()
12421 if (const auto *BindingVD = BD->getHoldingVar()) in DeclMustBeEmitted()
12431 assert(FD->isMultiVersion() && "Only valid for multiversioned functions"); in forEachMultiversionedFunctionVersion()
12433 FD = FD->getMostRecentDecl(); in forEachMultiversionedFunctionVersion()
12435 // lookup results, which happens to be (mostly) oldest-to-newest, but we in forEachMultiversionedFunctionVersion()
12438 FD->getDeclContext()->getRedeclContext()->lookup(FD->getDeclName())) { in forEachMultiversionedFunctionVersion()
12439 FunctionDecl *CurFD = CurDecl->getAsFunction()->getMostRecentDecl(); in forEachMultiversionedFunctionVersion()
12440 if (CurFD && hasSameType(CurFD->getType(), FD->getType()) && in forEachMultiversionedFunctionVersion()
12453 return ABI->getDefaultMethodCallConv(IsVariadic); in getDefaultCallingConvention()
12455 // Builtins ignore user-specified default calling convention and remain the in getDefaultCallingConvention()
12487 return Target->getDefaultCallingConv(); in getDefaultCallingConvention()
12492 return ABI->isNearlyEmpty(RD); in isNearlyEmpty()
12497 auto ABI = Target->getCXXABI(); in getVTableContext()
12513 switch (T->getCXXABI().getKind()) { in createMangleContext()
12547 [](ASTContext &, const NamedDecl *ND) -> std::optional<unsigned> { in createDeviceMangleContext()
12549 return RD->getDeviceLambdaManglingNumber(); in createDeviceMangleContext()
12578 /// getIntTypeForBitwidth -
12591 /// getRealTypeForBitwidth -
12625 Listener->AddedManglingNumber(ND, Number); in setManglingNumber()
12631 unsigned Res = I != MangleNumbers.end() ? I->second : 1; in getManglingNumber()
12650 Listener->AddedStaticLocalNumbers(VD, Number); in setStaticLocalNumber()
12655 return I != StaticLocalNumbers.end() ? I->second : 1; in getStaticLocalNumber()
12679 return ABI->createMangleNumberingContext(); in createMangleNumberingContext()
12684 return ABI->getCopyConstructorForExceptionObject( in getCopyConstructorForExceptionObject()
12685 cast<CXXRecordDecl>(RD->getFirstDecl())); in getCopyConstructorForExceptionObject()
12690 return ABI->addCopyConstructorForExceptionObject( in addCopyConstructorForExceptionObject()
12691 cast<CXXRecordDecl>(RD->getFirstDecl()), in addCopyConstructorForExceptionObject()
12692 cast<CXXConstructorDecl>(CD->getFirstDecl())); in addCopyConstructorForExceptionObject()
12697 return ABI->addTypedefNameForUnnamedTagDecl(TD, DD); in addTypedefNameForUnnamedTagDecl()
12702 return ABI->getTypedefNameForUnnamedTagDecl(TD); in getTypedefNameForUnnamedTagDecl()
12707 return ABI->addDeclaratorForUnnamedTagDecl(TD, DD); in addDeclaratorForUnnamedTagDecl()
12711 return ABI->getDeclaratorForUnnamedTagDecl(TD); in getDeclaratorForUnnamedTagDecl()
12722 return I->second; in getParameterIndex()
12727 // A C++ string literal has a const-qualified element type (C++ 2.13.4p1). in getStringLiteralArrayType()
12786 assert(T->isRecordType() && "template param object of unexpected type"); in getTemplateParamObjectDecl()
12814 QualType AtomicTy = E->getPtr()->getType()->getPointeeType(); in AtomicUsesUnsupportedLibcall()
12827 if (MethodDecl->hasAttr<UnavailableAttr>() in ObjCMethodsAreEqual()
12828 || MethodDecl->hasAttr<DeprecatedAttr>()) in ObjCMethodsAreEqual()
12830 if (MethodDecl->getObjCDeclQualifier() != in ObjCMethodsAreEqual()
12831 MethodImpl->getObjCDeclQualifier()) in ObjCMethodsAreEqual()
12833 if (!hasSameType(MethodDecl->getReturnType(), MethodImpl->getReturnType())) in ObjCMethodsAreEqual()
12836 if (MethodDecl->param_size() != MethodImpl->param_size()) in ObjCMethodsAreEqual()
12839 for (ObjCMethodDecl::param_const_iterator IM = MethodImpl->param_begin(), in ObjCMethodsAreEqual()
12840 IF = MethodDecl->param_begin(), EM = MethodImpl->param_end(), in ObjCMethodsAreEqual()
12841 EF = MethodDecl->param_end(); in ObjCMethodsAreEqual()
12845 if (ImplVar->getObjCDeclQualifier() != DeclVar->getObjCDeclQualifier()) in ObjCMethodsAreEqual()
12847 if (!hasSameType(DeclVar->getType(), ImplVar->getType())) in ObjCMethodsAreEqual()
12851 return (MethodDecl->isVariadic() == MethodImpl->isVariadic()); in ObjCMethodsAreEqual()
12856 if (QT->getUnqualifiedDesugaredType()->isNullPtrType()) in getTargetNullPointerValue()
12859 AS = QT->getPointeeType().getAddressSpace(); in getTargetNullPointerValue()
12874 X->Profile(IDX, *this, /*Canonical=*/true); in hasSameExpr()
12875 Y->Profile(IDY, *this, /*Canonical=*/true); in hasSameExpr()
12883 // The getCommon*Checked variants are 'null inputs not-allowed' equivalents of
12889 for (const Decl *DX : X->redecls()) { in getCommonDecl()
12894 if (DX->isFirstDecl()) in getCommonDecl()
12945 return X->getAttributeLoc() == Y->getAttributeLoc() ? X->getAttributeLoc() in getCommonAttrLoc()
12968 if (!Ctx.hasSameType(X.getAsExpr()->getType(), Y.getAsExpr()->getType())) in getCommonTemplateArgument()
13022 return X->getKeyword() == Y->getKeyword() ? X->getKeyword() in getCommonTypeKeyword()
13030 return X->getQualifier() == Y->getQualifier() in getCommonNNS()
13031 ? X->getQualifier() in getCommonNNS()
13032 : Ctx.getCanonicalNestedNameSpecifier(X->getQualifier()); in getCommonNNS()
13037 return Ctx.getCommonSugaredType(X->getElementType(), Y->getElementType()); in getCommonElementType()
13044 QualType EX = X->getElementType(), EY = Y->getElementType(); in getCommonArrayElementType()
13048 QX += EX.getQualifiers() - RQ; in getCommonArrayElementType()
13049 QY += EY.getQualifiers() - RQ; in getCommonArrayElementType()
13055 return Ctx.getCommonSugaredType(X->getPointeeType(), Y->getPointeeType()); in getCommonPointeeType()
13059 assert(Ctx.hasSameExpr(X->getSizeExpr(), Y->getSizeExpr())); in getCommonSizeExpr()
13060 return X->getSizeExpr(); in getCommonSizeExpr()
13064 assert(X->getSizeModifier() == Y->getSizeModifier()); in getCommonSizeModifier()
13065 return X->getSizeModifier(); in getCommonSizeModifier()
13070 assert(X->getIndexTypeCVRQualifiers() == Y->getIndexTypeCVRQualifiers()); in getCommonIndexTypeCVRQualifiers()
13071 return X->getIndexTypeCVRQualifiers(); in getCommonIndexTypeCVRQualifiers()
13085 QualType &U = Out[Res.first->second]; in mergeTypeLists()
13109 // If either of them is non-throwing, the result is the other. in mergeExceptionSpecs()
13118 // If we're left with value-dependent computed noexcept expressions, we're in mergeExceptionSpecs()
13165 Type::TypeClass TC = X->getTypeClass(); in getCommonNonSugarTypeNode()
13166 assert(TC == Y->getTypeClass()); in getCommonNonSugarTypeNode()
13172 #define NON_CANONICAL_TYPE(Class, Base) UNEXPECTED_TYPE(Class, "non-canonical") in getCommonNonSugarTypeNode()
13176 #define SUGAR_FREE_TYPE(Class) UNEXPECTED_TYPE(Class, "sugar-free") in getCommonNonSugarTypeNode()
13187 #define NON_UNIQUE_TYPE(Class) UNEXPECTED_TYPE(Class, "non-unique") in getCommonNonSugarTypeNode()
13198 assert(AX->getDeducedType().isNull()); in getCommonNonSugarTypeNode()
13199 assert(AY->getDeducedType().isNull()); in getCommonNonSugarTypeNode()
13200 assert(AX->getKeyword() == AY->getKeyword()); in getCommonNonSugarTypeNode()
13201 assert(AX->isInstantiationDependentType() == in getCommonNonSugarTypeNode()
13202 AY->isInstantiationDependentType()); in getCommonNonSugarTypeNode()
13203 auto As = getCommonTemplateArguments(Ctx, AX->getTypeConstraintArguments(), in getCommonNonSugarTypeNode()
13204 AY->getTypeConstraintArguments()); in getCommonNonSugarTypeNode()
13205 return Ctx.getAutoType(QualType(), AX->getKeyword(), in getCommonNonSugarTypeNode()
13206 AX->isInstantiationDependentType(), in getCommonNonSugarTypeNode()
13207 AX->containsUnexpandedParameterPack(), in getCommonNonSugarTypeNode()
13208 getCommonDeclChecked(AX->getTypeConstraintConcept(), in getCommonNonSugarTypeNode()
13209 AY->getTypeConstraintConcept()), in getCommonNonSugarTypeNode()
13226 AX->getBracketsRange() == AY->getBracketsRange() in getCommonNonSugarTypeNode()
13227 ? AX->getBracketsRange() in getCommonNonSugarTypeNode()
13233 assert(AX->getSize() == AY->getSize()); in getCommonNonSugarTypeNode()
13234 const Expr *SizeExpr = Ctx.hasSameExpr(AX->getSizeExpr(), AY->getSizeExpr()) in getCommonNonSugarTypeNode()
13235 ? AX->getSizeExpr() in getCommonNonSugarTypeNode()
13238 getCommonArrayElementType(Ctx, AX, QX, AY, QY), AX->getSize(), SizeExpr, in getCommonNonSugarTypeNode()
13244 assert(AX->getSize() == AY->getSize()); in getCommonNonSugarTypeNode()
13245 const Expr *SizeExpr = Ctx.hasSameExpr(AX->getSizeExpr(), AY->getSizeExpr()) in getCommonNonSugarTypeNode()
13246 ? AX->getSizeExpr() in getCommonNonSugarTypeNode()
13249 getCommonArrayElementType(Ctx, AX, QX, AY, QY), AX->getSize(), SizeExpr, in getCommonNonSugarTypeNode()
13256 Ctx.getCommonSugaredType(AX->getValueType(), AY->getValueType())); in getCommonNonSugarTypeNode()
13280 Ctx.getCommonSugaredType(QualType(PX->getClass(), 0), in getCommonNonSugarTypeNode()
13281 QualType(PY->getClass(), 0)) in getCommonNonSugarTypeNode()
13289 PX->isSpelledAsLValue() || in getCommonNonSugarTypeNode()
13290 PY->isSpelledAsLValue()); in getCommonNonSugarTypeNode()
13301 assert(Ctx.hasSameExpr(PX->getAddrSpaceExpr(), PY->getAddrSpaceExpr())); in getCommonNonSugarTypeNode()
13303 PX->getAddrSpaceExpr(), in getCommonNonSugarTypeNode()
13309 assert(FX->getExtInfo() == FY->getExtInfo()); in getCommonNonSugarTypeNode()
13311 Ctx.getCommonSugaredType(FX->getReturnType(), FY->getReturnType()), in getCommonNonSugarTypeNode()
13312 FX->getExtInfo()); in getCommonNonSugarTypeNode()
13317 FunctionProtoType::ExtProtoInfo EPIX = FX->getExtProtoInfo(), in getCommonNonSugarTypeNode()
13318 EPIY = FY->getExtProtoInfo(); in getCommonNonSugarTypeNode()
13331 Ctx.getCommonSugaredType(FX->getReturnType(), FY->getReturnType()); in getCommonNonSugarTypeNode()
13332 auto P = getCommonTypes(Ctx, FX->param_types(), FY->param_types(), in getCommonNonSugarTypeNode()
13343 std::equal(OX->getProtocols().begin(), OX->getProtocols().end(), in getCommonNonSugarTypeNode()
13344 OY->getProtocols().begin(), OY->getProtocols().end(), in getCommonNonSugarTypeNode()
13345 [](const ObjCProtocolDecl *P0, const ObjCProtocolDecl *P1) { in getCommonNonSugarTypeNode() argument
13346 return P0->getCanonicalDecl() == P1->getCanonicalDecl(); in getCommonNonSugarTypeNode()
13349 auto TAs = getCommonTypes(Ctx, OX->getTypeArgsAsWritten(), in getCommonNonSugarTypeNode()
13350 OY->getTypeArgsAsWritten()); in getCommonNonSugarTypeNode()
13352 Ctx.getCommonSugaredType(OX->getBaseType(), OY->getBaseType()), TAs, in getCommonNonSugarTypeNode()
13353 OX->getProtocols(), in getCommonNonSugarTypeNode()
13354 OX->isKindOfTypeAsWritten() && OY->isKindOfTypeAsWritten()); in getCommonNonSugarTypeNode()
13359 assert(MX->getNumRows() == MY->getNumRows()); in getCommonNonSugarTypeNode()
13360 assert(MX->getNumColumns() == MY->getNumColumns()); in getCommonNonSugarTypeNode()
13362 MX->getNumRows(), MX->getNumColumns()); in getCommonNonSugarTypeNode()
13367 assert(Ctx.hasSameExpr(MX->getRowExpr(), MY->getRowExpr())); in getCommonNonSugarTypeNode()
13368 assert(Ctx.hasSameExpr(MX->getColumnExpr(), MY->getColumnExpr())); in getCommonNonSugarTypeNode()
13370 getCommonElementType(Ctx, MX, MY), MX->getRowExpr(), in getCommonNonSugarTypeNode()
13371 MX->getColumnExpr(), getCommonAttrLoc(MX, MY)); in getCommonNonSugarTypeNode()
13375 assert(VX->getNumElements() == VY->getNumElements()); in getCommonNonSugarTypeNode()
13376 assert(VX->getVectorKind() == VY->getVectorKind()); in getCommonNonSugarTypeNode()
13378 VX->getNumElements(), VX->getVectorKind()); in getCommonNonSugarTypeNode()
13382 assert(VX->getNumElements() == VY->getNumElements()); in getCommonNonSugarTypeNode()
13384 VX->getNumElements()); in getCommonNonSugarTypeNode()
13396 assert(VX->getVectorKind() == VY->getVectorKind()); in getCommonNonSugarTypeNode()
13399 getCommonAttrLoc(VX, VY), VX->getVectorKind()); in getCommonNonSugarTypeNode()
13405 getCommonDeclChecked(IX->getDecl(), IY->getDecl()), in getCommonNonSugarTypeNode()
13406 Ctx.getCommonSugaredType(IX->getInjectedSpecializationType(), in getCommonNonSugarTypeNode()
13407 IY->getInjectedSpecializationType())); in getCommonNonSugarTypeNode()
13412 auto As = getCommonTemplateArguments(Ctx, TX->template_arguments(), in getCommonNonSugarTypeNode()
13413 TY->template_arguments()); in getCommonNonSugarTypeNode()
13415 ::getCommonTemplateNameChecked(Ctx, TX->getTemplateName(), in getCommonNonSugarTypeNode()
13416 TY->getTemplateName()), in getCommonNonSugarTypeNode()
13417 As, X->getCanonicalTypeInternal()); in getCommonNonSugarTypeNode()
13422 assert(DX->isDependentType()); in getCommonNonSugarTypeNode()
13423 assert(DY->isDependentType()); in getCommonNonSugarTypeNode()
13424 assert(Ctx.hasSameExpr(DX->getUnderlyingExpr(), DY->getUnderlyingExpr())); in getCommonNonSugarTypeNode()
13431 assert(DX->isDependentType()); in getCommonNonSugarTypeNode()
13432 assert(DY->isDependentType()); in getCommonNonSugarTypeNode()
13433 assert(Ctx.hasSameExpr(DX->getIndexExpr(), DY->getIndexExpr())); in getCommonNonSugarTypeNode()
13439 assert(NX->getIdentifier() == NY->getIdentifier()); in getCommonNonSugarTypeNode()
13442 NX->getIdentifier(), NX->getCanonicalTypeInternal()); in getCommonNonSugarTypeNode()
13447 assert(TX->getIdentifier() == TY->getIdentifier()); in getCommonNonSugarTypeNode()
13448 auto As = getCommonTemplateArguments(Ctx, TX->template_arguments(), in getCommonNonSugarTypeNode()
13449 TY->template_arguments()); in getCommonNonSugarTypeNode()
13452 TX->getIdentifier(), As); in getCommonNonSugarTypeNode()
13457 assert(TX->getUTTKind() == TY->getUTTKind()); in getCommonNonSugarTypeNode()
13459 Ctx.getCommonSugaredType(TX->getBaseType(), TY->getBaseType()), in getCommonNonSugarTypeNode()
13460 Ctx.getCommonSugaredType(TX->getUnderlyingType(), in getCommonNonSugarTypeNode()
13461 TY->getUnderlyingType()), in getCommonNonSugarTypeNode()
13462 TX->getUTTKind()); in getCommonNonSugarTypeNode()
13467 assert(PX->getNumExpansions() == PY->getNumExpansions()); in getCommonNonSugarTypeNode()
13469 Ctx.getCommonSugaredType(PX->getPattern(), PY->getPattern()), in getCommonNonSugarTypeNode()
13470 PX->getNumExpansions(), false); in getCommonNonSugarTypeNode()
13474 assert(PX->isReadOnly() == PY->isReadOnly()); in getCommonNonSugarTypeNode()
13475 auto MP = PX->isReadOnly() ? &ASTContext::getReadPipeType in getCommonNonSugarTypeNode()
13482 assert(TX->getDepth() == TY->getDepth()); in getCommonNonSugarTypeNode()
13483 assert(TX->getIndex() == TY->getIndex()); in getCommonNonSugarTypeNode()
13484 assert(TX->isParameterPack() == TY->isParameterPack()); in getCommonNonSugarTypeNode()
13486 TX->getDepth(), TX->getIndex(), TX->isParameterPack(), in getCommonNonSugarTypeNode()
13487 getCommonDecl(TX->getDecl(), TY->getDecl())); in getCommonNonSugarTypeNode()
13496 Type::TypeClass TC = X->getTypeClass(); in getCommonSugarTypeNode()
13497 if (TC != Y->getTypeClass()) in getCommonSugarTypeNode()
13538 QualType OX = AX->getOriginalType(), OY = AY->getOriginalType(); in getCommonSugarTypeNode()
13547 QualType OX = DX->getOriginalType(), OY = DY->getOriginalType(); in getCommonSugarTypeNode()
13556 AttributedType::Kind Kind = AX->getAttrKind(); in getCommonSugarTypeNode()
13557 if (Kind != AY->getAttrKind()) in getCommonSugarTypeNode()
13559 QualType MX = AX->getModifiedType(), MY = AY->getModifiedType(); in getCommonSugarTypeNode()
13568 const BTFTypeTagAttr *AX = BX->getAttr(); in getCommonSugarTypeNode()
13570 if (AX->getBTFTypeTag() != in getCommonSugarTypeNode()
13571 cast<BTFTagAttributedType>(Y)->getAttr()->getBTFTypeTag()) in getCommonSugarTypeNode()
13578 AutoTypeKeyword KW = AX->getKeyword(); in getCommonSugarTypeNode()
13579 if (KW != AY->getKeyword()) in getCommonSugarTypeNode()
13582 ConceptDecl *CD = ::getCommonDecl(AX->getTypeConstraintConcept(), in getCommonSugarTypeNode()
13583 AY->getTypeConstraintConcept()); in getCommonSugarTypeNode()
13586 getCommonTemplateArguments(Ctx, As, AX->getTypeConstraintArguments(), in getCommonSugarTypeNode()
13587 AY->getTypeConstraintArguments())) { in getCommonSugarTypeNode()
13594 return Ctx.getAutoType(Ctx.getQualifiedType(Underlying), AX->getKeyword(), in getCommonSugarTypeNode()
13609 ::getCommonDecl(EX->getOwnedTagDecl(), EY->getOwnedTagDecl())); in getCommonSugarTypeNode()
13614 const IdentifierInfo *IX = MX->getMacroIdentifier(); in getCommonSugarTypeNode()
13615 if (IX != MY->getMacroIdentifier()) in getCommonSugarTypeNode()
13623 ::getCommonDecl(SX->getAssociatedDecl(), SY->getAssociatedDecl()); in getCommonSugarTypeNode()
13626 unsigned Index = SX->getIndex(); in getCommonSugarTypeNode()
13627 if (Index != SY->getIndex()) in getCommonSugarTypeNode()
13629 auto PackIndex = SX->getPackIndex(); in getCommonSugarTypeNode()
13630 if (PackIndex != SY->getPackIndex()) in getCommonSugarTypeNode()
13644 TemplateName CTN = ::getCommonTemplateName(Ctx, TX->getTemplateName(), in getCommonSugarTypeNode()
13645 TY->getTemplateName()); in getCommonSugarTypeNode()
13649 if (getCommonTemplateArguments(Ctx, Args, TX->template_arguments(), in getCommonSugarTypeNode()
13650 TY->template_arguments())) in getCommonSugarTypeNode()
13657 const TypedefNameDecl *CD = ::getCommonDecl(TX->getDecl(), TY->getDecl()); in getCommonSugarTypeNode()
13668 if (cast<TypeOfType>(X)->getKind() == cast<TypeOfType>(Y)->getKind() && in getCommonSugarTypeNode()
13669 cast<TypeOfType>(X)->getKind() == TypeOfKind::Unqualified) in getCommonSugarTypeNode()
13679 UnaryTransformType::UTTKind KX = UX->getUTTKind(); in getCommonSugarTypeNode()
13680 if (KX != UY->getUTTKind()) in getCommonSugarTypeNode()
13682 QualType BX = UX->getBaseType(), BY = UY->getBaseType(); in getCommonSugarTypeNode()
13692 ::getCommonDecl(UX->getFoundDecl(), UY->getFoundDecl()); in getCommonSugarTypeNode()
13700 if (DX->isCountInBytes() != DY->isCountInBytes()) in getCommonSugarTypeNode()
13702 if (DX->isOrNull() != DY->isOrNull()) in getCommonSugarTypeNode()
13704 Expr *CEX = DX->getCountExpr(); in getCommonSugarTypeNode()
13705 Expr *CEY = DY->getCountExpr(); in getCommonSugarTypeNode()
13706 llvm::ArrayRef<clang::TypeCoupledDeclRefInfo> CDX = DX->getCoupledDecls(); in getCommonSugarTypeNode()
13709 DX->isCountInBytes(), DX->isOrNull(), in getCommonSugarTypeNode()
13711 if (!CEX->isIntegerConstantExpr(Ctx) || !CEY->isIntegerConstantExpr(Ctx)) in getCommonSugarTypeNode()
13715 llvm::APSInt VX = *CEX->getIntegerConstantExpr(Ctx); in getCommonSugarTypeNode()
13716 llvm::APSInt VY = *CEY->getIntegerConstantExpr(Ctx); in getCommonSugarTypeNode()
13720 DX->isCountInBytes(), DX->isOrNull(), in getCommonSugarTypeNode()
13731 QualType NT = T.Ty->getLocallyUnqualifiedSingleStepDesugaredType(); in unwrapSugar()
13768 QX -= SX.Quals; in getCommonSugaredType()
13769 QY -= SY.Quals; in getCommonSugaredType()
13793 QX -= Underlying.Quals; in getCommonSugaredType()
13804 assert(Ty->isFixedPointType()); in getCorrespondingUnsaturatedType()
13806 if (Ty->isUnsaturatedFixedPointType()) in getCorrespondingUnsaturatedType()
13809 switch (Ty->castAs<BuiltinType>()->getKind()) { in getCorrespondingUnsaturatedType()
13840 assert(Ty->isFixedPointType()); in getCorrespondingSaturatedType()
13842 if (Ty->isSaturatedFixedPointType()) return Ty; in getCorrespondingSaturatedType()
13844 switch (Ty->castAs<BuiltinType>()->getKind()) { in getCorrespondingSaturatedType()
13894 assert(Ty->isFixedPointType()); in getFixedPointScale()
13897 switch (Ty->castAs<BuiltinType>()->getKind()) { in getFixedPointScale()
13940 assert(Ty->isFixedPointType()); in getFixedPointIBits()
13943 switch (Ty->castAs<BuiltinType>()->getKind()) { in getFixedPointIBits()
13982 assert((Ty->isFixedPointType() || Ty->isIntegerType()) && in getFixedPointSemantics()
13985 if (Ty->isIntegerType()) in getFixedPointSemantics()
13987 getIntWidth(Ty), Ty->isSignedIntegerType()); in getFixedPointSemantics()
13989 bool isSigned = Ty->isSignedFixedPointType(); in getFixedPointSemantics()
13992 Ty->isSaturatedFixedPointType(), in getFixedPointSemantics()
13997 assert(Ty->isFixedPointType()); in getFixedPointMax()
14002 assert(Ty->isFixedPointType()); in getFixedPointMin()
14007 assert(Ty->isUnsignedFixedPointType() && in getCorrespondingSignedFixedPointType()
14010 switch (Ty->castAs<BuiltinType>()->getKind()) { in getCorrespondingSignedFixedPointType()
14047 for (StringRef F : FMVExt->getImpliedFeatures()) in getFMVBackendFeaturesFor()
14055 ParsedTargetAttr ParsedAttr = Target->parseTargetAttr(TD->getFeaturesStr()); in filterFunctionTargetAttrs()
14058 return !Target->isValidFeatureName(StringRef{Feat}.substr(1)); in filterFunctionTargetAttrs()
14068 Target->initFeatureMap(FeatureMap, getDiagnostics(), in getFunctionFeatureMap()
14069 Target->getTargetOpts().CPU, in getFunctionFeatureMap()
14070 Target->getTargetOpts().Features); in getFunctionFeatureMap()
14077 StringRef TargetCPU = Target->getTargetOpts().CPU; in getFunctionFeatureMap()
14078 const FunctionDecl *FD = GD.getDecl()->getAsFunction(); in getFunctionFeatureMap()
14079 if (const auto *TD = FD->getAttr<TargetAttr>()) { in getFunctionFeatureMap()
14085 if (!Target->getTriple().isAArch64()) in getFunctionFeatureMap()
14088 Target->getTargetOpts().FeaturesAsWritten.begin(), in getFunctionFeatureMap()
14089 Target->getTargetOpts().FeaturesAsWritten.end()); in getFunctionFeatureMap()
14091 if (ParsedAttr.CPU != "" && Target->isValidCPUName(ParsedAttr.CPU)) in getFunctionFeatureMap()
14098 Target->initFeatureMap(FeatureMap, getDiagnostics(), TargetCPU, in getFunctionFeatureMap()
14100 } else if (const auto *SD = FD->getAttr<CPUSpecificAttr>()) { in getFunctionFeatureMap()
14102 Target->getCPUSpecificCPUDispatchFeatures( in getFunctionFeatureMap()
14103 SD->getCPUName(GD.getMultiVersionIndex())->getName(), FeaturesTmp); in getFunctionFeatureMap()
14106 Target->getTargetOpts().FeaturesAsWritten.begin(), in getFunctionFeatureMap()
14107 Target->getTargetOpts().FeaturesAsWritten.end()); in getFunctionFeatureMap()
14108 Target->initFeatureMap(FeatureMap, getDiagnostics(), TargetCPU, Features); in getFunctionFeatureMap()
14109 } else if (const auto *TC = FD->getAttr<TargetClonesAttr>()) { in getFunctionFeatureMap()
14110 if (Target->getTriple().isAArch64()) { in getFunctionFeatureMap()
14112 TC->getFeatures(Feats, GD.getMultiVersionIndex()); in getFunctionFeatureMap()
14115 Target->getTargetOpts().FeaturesAsWritten.begin(), in getFunctionFeatureMap()
14116 Target->getTargetOpts().FeaturesAsWritten.end()); in getFunctionFeatureMap()
14117 Target->initFeatureMap(FeatureMap, getDiagnostics(), TargetCPU, Features); in getFunctionFeatureMap()
14120 StringRef VersionStr = TC->getFeatureStr(GD.getMultiVersionIndex()); in getFunctionFeatureMap()
14122 TargetCPU = VersionStr.drop_front(sizeof("arch=") - 1); in getFunctionFeatureMap()
14125 Target->initFeatureMap(FeatureMap, getDiagnostics(), TargetCPU, Features); in getFunctionFeatureMap()
14127 } else if (const auto *TV = FD->getAttr<TargetVersionAttr>()) { in getFunctionFeatureMap()
14129 TV->getFeatures(Feats); in getFunctionFeatureMap()
14132 Target->getTargetOpts().FeaturesAsWritten.begin(), in getFunctionFeatureMap()
14133 Target->getTargetOpts().FeaturesAsWritten.end()); in getFunctionFeatureMap()
14134 Target->initFeatureMap(FeatureMap, getDiagnostics(), TargetCPU, Features); in getFunctionFeatureMap()
14136 FeatureMap = Target->getTargetOpts().FeatureMap; in getFunctionFeatureMap()
14157 bool IsExplicitDeviceVar = (D->hasAttr<CUDADeviceAttr>() && in mayExternalize()
14158 !D->getAttr<CUDADeviceAttr>()->isImplicit()) || in mayExternalize()
14159 (D->hasAttr<CUDAConstantAttr>() && in mayExternalize()
14160 !D->getAttr<CUDAConstantAttr>()->isImplicit()); in mayExternalize()
14165 (D->hasAttr<HIPManagedAttr>() || IsExplicitDeviceVar)) || in mayExternalize()
14166 (D->hasAttr<CUDAGlobalAttr>() && in mayExternalize()
14173 (D->hasAttr<HIPManagedAttr>() || D->hasAttr<CUDAGlobalAttr>() || in shouldExternalize()
14189 assert(ThisClass->isPolymorphic()); in baseForVTableAuthentication()
14193 assert(PrimaryBase->isPolymorphic()); in baseForVTableAuthentication()
14196 if (!Base || Base == PrimaryBase || !Base->isPolymorphic()) in baseForVTableAuthentication()
14206 assert(Method->isVirtual()); in useAbbreviatedThunkName()
14215 return Existing->second.contains(MangledName.str()); in useAbbreviatedThunkName()
14220 if (const auto *ThunkInfos = VtableContext->getThunkInfo(VirtualMethodDecl)) { in useAbbreviatedThunkName()
14226 Mangler->mangleCXXDtorThunk(Destructor, VirtualMethodDecl.getDtorType(), in useAbbreviatedThunkName()
14230 Mangler->mangleThunk(Method, Thunk, /* elideOverrideInfo */ true, in useAbbreviatedThunkName()
14235 Mangler->mangleCXXDtorThunk(Destructor, VirtualMethodDecl.getDtorType(), in useAbbreviatedThunkName()
14239 Mangler->mangleThunk(Method, Thunk, /* elideOverrideInfo */ false, in useAbbreviatedThunkName()