24 #include "llvm/Support/MemoryBuffer.h"
122 unsigned NumFromArgs,
125 bool Complain =
true);
127 bool Complain =
true);
230 using namespace clang;
237 struct StructuralEquivalenceContext {
244 llvm::DenseMap<Decl *, Decl *> TentativeEquivalences;
248 std::deque<Decl *> DeclsToCheck;
256 bool StrictTypeSpelling;
266 bool StrictTypeSpelling =
false,
267 bool Complain =
true)
268 : C1(C1), C2(C2), NonEquivalentDecls(NonEquivalentDecls),
269 StrictTypeSpelling(StrictTypeSpelling), Complain(Complain),
270 LastDiagFromC2(
false) {}
287 assert(Complain &&
"Not allowed to complain");
289 C1.getDiagnostics().notePriorDiagnosticFrom(C2.getDiagnostics());
290 LastDiagFromC2 =
false;
291 return C1.getDiagnostics().Report(Loc, DiagID);
295 assert(Complain &&
"Not allowed to complain");
297 C2.getDiagnostics().notePriorDiagnosticFrom(C1.getDiagnostics());
298 LastDiagFromC2 =
true;
299 return C2.getDiagnostics().Report(Loc, DiagID);
322 if (!Name1 || !Name2)
323 return Name1 == Name2;
381 for (
unsigned I = 0, N = Arg1.
pack_size(); I != N; ++I)
390 llvm_unreachable(
"Invalid template argument kind");
416 if (!Context.StrictTypeSpelling) {
419 T1 = Context.C1.getCanonicalType(T1);
420 T2 = Context.C2.getCanonicalType(T2);
433 TC = Type::FunctionNoProto;
436 TC = Type::FunctionNoProto;
444 if (cast<BuiltinType>(T1)->getKind() != cast<BuiltinType>(T2)->
getKind())
450 cast<ComplexType>(T1)->getElementType(),
458 cast<AdjustedType>(T1)->getOriginalType(),
459 cast<AdjustedType>(T2)->getOriginalType()))
465 cast<PointerType>(T1)->getPointeeType(),
466 cast<PointerType>(T2)->getPointeeType()))
470 case Type::BlockPointer:
472 cast<BlockPointerType>(T1)->getPointeeType(),
473 cast<BlockPointerType>(T2)->getPointeeType()))
477 case Type::LValueReference:
478 case Type::RValueReference: {
487 Ref2->getPointeeTypeAsWritten()))
492 case Type::MemberPointer: {
506 case Type::ConstantArray: {
509 if (!llvm::APInt::isSameValue(Array1->
getSize(), Array2->getSize()))
517 case Type::IncompleteArray:
520 cast<ArrayType>(T2)))
524 case Type::VariableArray: {
537 case Type::DependentSizedArray: {
550 case Type::DependentSizedExtVector: {
552 = cast<DependentSizedExtVectorType>(T1);
554 = cast<DependentSizedExtVectorType>(T2);
560 Vec2->getElementType()))
566 case Type::ExtVector: {
567 const VectorType *Vec1 = cast<VectorType>(T1);
568 const VectorType *Vec2 = cast<VectorType>(T2);
571 Vec2->getElementType()))
580 case Type::FunctionProto: {
585 for (
unsigned I = 0, N = Proto1->
getNumParams(); I != N; ++I) {
587 Proto2->getParamType(I)))
590 if (Proto1->
isVariadic() != Proto2->isVariadic())
600 Proto2->getExceptionType(I)))
606 Proto2->getNoexceptExpr()))
615 case Type::FunctionNoProto: {
619 Function2->getReturnType()))
621 if (Function1->
getExtInfo() != Function2->getExtInfo())
626 case Type::UnresolvedUsing:
628 cast<UnresolvedUsingType>(T1)->getDecl(),
629 cast<UnresolvedUsingType>(T2)->getDecl()))
634 case Type::Attributed:
636 cast<AttributedType>(T1)->getModifiedType(),
637 cast<AttributedType>(T2)->getModifiedType()))
640 cast<AttributedType>(T1)->getEquivalentType(),
641 cast<AttributedType>(T2)->getEquivalentType()))
647 cast<ParenType>(T1)->getInnerType(),
648 cast<ParenType>(T2)->getInnerType()))
654 cast<TypedefType>(T1)->getDecl(),
655 cast<TypedefType>(T2)->getDecl()))
659 case Type::TypeOfExpr:
661 cast<TypeOfExprType>(T1)->getUnderlyingExpr(),
662 cast<TypeOfExprType>(T2)->getUnderlyingExpr()))
673 case Type::UnaryTransform:
682 cast<DecltypeType>(T1)->getUnderlyingExpr(),
683 cast<DecltypeType>(T2)->getUnderlyingExpr()))
689 cast<AutoType>(T1)->getDeducedType(),
690 cast<AutoType>(T2)->getDeducedType()))
697 cast<TagType>(T1)->getDecl(),
698 cast<TagType>(T2)->getDecl()))
702 case Type::TemplateTypeParm: {
705 if (Parm1->
getDepth() != Parm2->getDepth())
707 if (Parm1->
getIndex() != Parm2->getIndex())
716 case Type::SubstTemplateTypeParm: {
718 = cast<SubstTemplateTypeParmType>(T1);
720 = cast<SubstTemplateTypeParmType>(T2);
723 QualType(Subst2->getReplacedParameter(), 0)))
727 Subst2->getReplacementType()))
732 case Type::SubstTemplateTypeParmPack: {
734 = cast<SubstTemplateTypeParmPackType>(T1);
736 = cast<SubstTemplateTypeParmPackType>(T2);
739 QualType(Subst2->getReplacedParameter(), 0)))
743 Subst2->getArgumentPack()))
747 case Type::TemplateSpecialization: {
749 = cast<TemplateSpecializationType>(T1);
751 = cast<TemplateSpecializationType>(T2);
754 Spec2->getTemplateName()))
756 if (Spec1->
getNumArgs() != Spec2->getNumArgs())
758 for (
unsigned I = 0, N = Spec1->
getNumArgs(); I != N; ++I) {
760 Spec1->
getArg(I), Spec2->getArg(I)))
766 case Type::Elaborated: {
770 if (Elab1->
getKeyword() != Elab2->getKeyword())
774 Elab2->getQualifier()))
778 Elab2->getNamedType()))
783 case Type::InjectedClassName: {
788 Inj2->getInjectedSpecializationType()))
793 case Type::DependentName: {
798 Typename2->getQualifier()))
801 Typename2->getIdentifier()))
807 case Type::DependentTemplateSpecialization: {
809 cast<DependentTemplateSpecializationType>(T1);
811 cast<DependentTemplateSpecializationType>(T2);
814 Spec2->getQualifier()))
817 Spec2->getIdentifier()))
819 if (Spec1->
getNumArgs() != Spec2->getNumArgs())
821 for (
unsigned I = 0, N = Spec1->
getNumArgs(); I != N; ++I) {
823 Spec1->
getArg(I), Spec2->getArg(I)))
829 case Type::PackExpansion:
831 cast<PackExpansionType>(T1)->getPattern(),
832 cast<PackExpansionType>(T2)->getPattern()))
836 case Type::ObjCInterface: {
840 Iface1->
getDecl(), Iface2->getDecl()))
845 case Type::ObjCObject: {
850 Obj2->getBaseType()))
857 Obj2->getProtocol(I)))
863 case Type::ObjCObjectPointer: {
875 cast<AtomicType>(T1)->getValueType(),
876 cast<AtomicType>(T2)->getValueType()))
909 if (Context.Complain) {
910 Context.Diag2(Owner2->
getLocation(), diag::warn_odr_tag_type_inconsistent)
911 << Context.C2.getTypeDeclType(Owner2);
912 Context.Diag2(Field2->
getLocation(), diag::note_odr_field)
914 Context.Diag1(Field1->
getLocation(), diag::note_odr_field)
921 if (Context.Complain) {
922 Context.Diag2(Owner2->
getLocation(), diag::warn_odr_tag_type_inconsistent)
923 << Context.C2.getTypeDeclType(Owner2);
925 Context.Diag1(Field1->
getLocation(), diag::note_odr_bit_field)
928 Context.Diag2(Field2->
getLocation(), diag::note_odr_not_bit_field)
931 Context.Diag2(Field2->
getLocation(), diag::note_odr_bit_field)
934 Context.Diag1(Field1->
getLocation(), diag::note_odr_not_bit_field)
946 if (Bits1 != Bits2) {
947 if (Context.Complain) {
948 Context.Diag2(Owner2->
getLocation(), diag::warn_odr_tag_type_inconsistent)
949 << Context.C2.getTypeDeclType(Owner2);
950 Context.Diag2(Field2->
getLocation(), diag::note_odr_bit_field)
952 Context.Diag1(Field1->
getLocation(), diag::note_odr_bit_field)
980 if (!F || !F->isAnonymousStructOrUnion())
996 if (Context.Complain) {
997 Context.Diag2(D2->
getLocation(), diag::warn_odr_tag_type_inconsistent)
998 << Context.C2.getTypeDeclType(D2);
999 Context.Diag1(D1->
getLocation(), diag::note_odr_tag_kind_here)
1010 if (*Index1 != *Index2)
1022 if (Spec1 && Spec2) {
1025 Spec2->getSpecializedTemplate()))
1035 Spec2->getTemplateArgs().get(I)))
1040 else if (Spec1 || Spec2)
1052 if (D1CXX->getNumBases() != D2CXX->getNumBases()) {
1053 if (Context.Complain) {
1054 Context.Diag2(D2->
getLocation(), diag::warn_odr_tag_type_inconsistent)
1055 << Context.C2.getTypeDeclType(D2);
1056 Context.Diag2(D2->
getLocation(), diag::note_odr_number_of_bases)
1057 << D2CXX->getNumBases();
1058 Context.Diag1(D1->
getLocation(), diag::note_odr_number_of_bases)
1059 << D1CXX->getNumBases();
1066 BaseEnd1 = D1CXX->bases_end(),
1067 Base2 = D2CXX->bases_begin();
1071 Base1->getType(), Base2->getType())) {
1072 if (Context.Complain) {
1073 Context.Diag2(D2->
getLocation(), diag::warn_odr_tag_type_inconsistent)
1074 << Context.C2.getTypeDeclType(D2);
1075 Context.Diag2(Base2->getLocStart(), diag::note_odr_base)
1077 << Base2->getSourceRange();
1078 Context.Diag1(Base1->getLocStart(), diag::note_odr_base)
1080 << Base1->getSourceRange();
1086 if (Base1->isVirtual() != Base2->isVirtual()) {
1087 if (Context.Complain) {
1088 Context.Diag2(D2->
getLocation(), diag::warn_odr_tag_type_inconsistent)
1089 << Context.C2.getTypeDeclType(D2);
1090 Context.Diag2(Base2->getLocStart(),
1091 diag::note_odr_virtual_base)
1092 << Base2->isVirtual() << Base2->getSourceRange();
1093 Context.Diag1(Base1->getLocStart(), diag::note_odr_base)
1094 << Base1->isVirtual()
1095 << Base1->getSourceRange();
1100 }
else if (D1CXX->getNumBases() > 0) {
1101 if (Context.Complain) {
1102 Context.Diag2(D2->
getLocation(), diag::warn_odr_tag_type_inconsistent)
1103 << Context.C2.getTypeDeclType(D2);
1105 Context.Diag1(Base1->
getLocStart(), diag::note_odr_base)
1108 Context.Diag2(D2->
getLocation(), diag::note_odr_missing_base);
1119 Field1 != Field1End;
1120 ++Field1, ++Field2) {
1121 if (Field2 == Field2End) {
1122 if (Context.Complain) {
1123 Context.Diag2(D2->
getLocation(), diag::warn_odr_tag_type_inconsistent)
1124 << Context.C2.getTypeDeclType(D2);
1125 Context.Diag1(Field1->getLocation(), diag::note_odr_field)
1126 << Field1->getDeclName() << Field1->getType();
1127 Context.Diag2(D2->
getLocation(), diag::note_odr_missing_field);
1136 if (Field2 != Field2End) {
1137 if (Context.Complain) {
1138 Context.Diag2(D2->
getLocation(), diag::warn_odr_tag_type_inconsistent)
1139 << Context.C2.getTypeDeclType(D2);
1140 Context.Diag2(Field2->getLocation(), diag::note_odr_field)
1141 << Field2->getDeclName() << Field2->getType();
1142 Context.Diag1(D1->
getLocation(), diag::note_odr_missing_field);
1157 EC1 != EC1End; ++EC1, ++EC2) {
1158 if (EC2 == EC2End) {
1159 if (Context.Complain) {
1160 Context.Diag2(D2->
getLocation(), diag::warn_odr_tag_type_inconsistent)
1161 << Context.C2.getTypeDeclType(D2);
1162 Context.Diag1(EC1->getLocation(), diag::note_odr_enumerator)
1163 << EC1->getDeclName()
1164 << EC1->getInitVal().toString(10);
1165 Context.Diag2(D2->
getLocation(), diag::note_odr_missing_enumerator);
1170 llvm::APSInt Val1 = EC1->getInitVal();
1171 llvm::APSInt Val2 = EC2->getInitVal();
1172 if (!llvm::APSInt::isSameValue(Val1, Val2) ||
1174 if (Context.Complain) {
1175 Context.Diag2(D2->
getLocation(), diag::warn_odr_tag_type_inconsistent)
1176 << Context.C2.getTypeDeclType(D2);
1177 Context.Diag2(EC2->getLocation(), diag::note_odr_enumerator)
1178 << EC2->getDeclName()
1179 << EC2->getInitVal().toString(10);
1180 Context.Diag1(EC1->getLocation(), diag::note_odr_enumerator)
1181 << EC1->getDeclName()
1182 << EC1->getInitVal().toString(10);
1188 if (EC2 != EC2End) {
1189 if (Context.Complain) {
1190 Context.Diag2(D2->
getLocation(), diag::warn_odr_tag_type_inconsistent)
1191 << Context.C2.getTypeDeclType(D2);
1192 Context.Diag2(EC2->getLocation(), diag::note_odr_enumerator)
1193 << EC2->getDeclName()
1194 << EC2->getInitVal().toString(10);
1195 Context.Diag1(D1->
getLocation(), diag::note_odr_missing_enumerator);
1206 if (Params1->
size() != Params2->
size()) {
1207 if (Context.Complain) {
1209 diag::err_odr_different_num_template_parameters)
1210 << Params1->
size() << Params2->
size();
1212 diag::note_odr_template_parameter_list);
1217 for (
unsigned I = 0, N = Params1->
size(); I != N; ++I) {
1219 if (Context.Complain) {
1221 diag::err_odr_different_template_parameter_kind);
1223 diag::note_odr_template_parameter_here);
1228 if (!Context.IsStructurallyEquivalent(Params1->
getParam(I),
1242 if (Context.Complain) {
1243 Context.Diag2(D2->
getLocation(), diag::err_odr_parameter_pack_non_pack)
1245 Context.Diag1(D1->
getLocation(), diag::note_odr_parameter_pack_non_pack)
1258 if (Context.Complain) {
1259 Context.Diag2(D2->
getLocation(), diag::err_odr_parameter_pack_non_pack)
1261 Context.Diag1(D1->
getLocation(), diag::note_odr_parameter_pack_non_pack)
1268 if (!Context.IsStructurallyEquivalent(D1->
getType(), D2->
getType())) {
1269 if (Context.Complain) {
1271 diag::err_odr_non_type_parameter_type_inconsistent)
1273 Context.Diag1(D1->
getLocation(), diag::note_odr_value_here)
1286 if (Context.Complain) {
1287 Context.Diag2(D2->
getLocation(), diag::err_odr_parameter_pack_non_pack)
1289 Context.Diag1(D1->
getLocation(), diag::note_odr_parameter_pack_non_pack)
1321 if (Context.NonEquivalentDecls.count(std::make_pair(D1->
getCanonicalDecl(),
1352 bool StructuralEquivalenceContext::Finish() {
1353 while (!DeclsToCheck.empty()) {
1355 Decl *D1 = DeclsToCheck.front();
1356 DeclsToCheck.pop_front();
1358 Decl *D2 = TentativeEquivalences[D1];
1359 assert(D2 &&
"Unrecorded tentative equivalence?");
1361 bool Equivalent =
true;
1365 if (
RecordDecl *Record1 = dyn_cast<RecordDecl>(D1)) {
1366 if (
RecordDecl *Record2 = dyn_cast<RecordDecl>(D2)) {
1369 if (!Name1 && Record1->getTypedefNameForAnonDecl())
1370 Name1 = Record1->getTypedefNameForAnonDecl()->getIdentifier();
1372 if (!Name2 && Record2->getTypedefNameForAnonDecl())
1373 Name2 = Record2->getTypedefNameForAnonDecl()->getIdentifier();
1381 }
else if (
EnumDecl *Enum1 = dyn_cast<EnumDecl>(D1)) {
1382 if (
EnumDecl *Enum2 = dyn_cast<EnumDecl>(D2)) {
1385 if (!Name1 && Enum1->getTypedefNameForAnonDecl())
1386 Name1 = Enum1->getTypedefNameForAnonDecl()->getIdentifier();
1388 if (!Name2 && Enum2->getTypedefNameForAnonDecl())
1389 Name2 = Enum2->getTypedefNameForAnonDecl()->getIdentifier();
1397 }
else if (
TypedefNameDecl *Typedef1 = dyn_cast<TypedefNameDecl>(D1)) {
1400 Typedef2->getIdentifier()) ||
1402 Typedef1->getUnderlyingType(),
1403 Typedef2->getUnderlyingType()))
1410 = dyn_cast<ClassTemplateDecl>(D1)) {
1413 ClassTemplate2->getIdentifier()) ||
1429 = dyn_cast<NonTypeTemplateParmDecl>(D1)) {
1431 = dyn_cast<NonTypeTemplateParmDecl>(D2)) {
1439 = dyn_cast<TemplateTemplateParmDecl>(D1)) {
1441 = dyn_cast<TemplateTemplateParmDecl>(D2)) {
1475 #define SHARED_SINGLETON_TYPE(Expansion)
1476 #define BUILTIN_TYPE(Id, SingletonId) \
1477 case BuiltinType::Id: return Importer.getToContext().SingletonId;
1478 #include "clang/AST/BuiltinTypes.def"
1486 case BuiltinType::Char_U:
1495 case BuiltinType::Char_S:
1504 case BuiltinType::WChar_S:
1505 case BuiltinType::WChar_U:
1511 llvm_unreachable(
"Invalid BuiltinType Kind!");
1516 if (ToElementType.
isNull())
1524 if (ToPointeeType.
isNull())
1533 if (ToPointeeType.
isNull())
1543 if (ToPointeeType.
isNull())
1553 if (ToPointeeType.
isNull())
1562 if (ToPointeeType.
isNull())
1572 if (ToElementType.
isNull())
1584 if (ToElementType.
isNull())
1594 if (ToElementType.
isNull())
1610 if (ToElementType.
isNull())
1620 if (ToElementType.
isNull())
1632 if (ToResultType.
isNull())
1641 if (ToResultType.
isNull())
1650 ArgTypes.push_back(ArgType);
1657 if (ExceptionType.
isNull())
1659 ExceptionTypes.push_back(ExceptionType);
1684 if (ToInnerType.
isNull())
1692 = dyn_cast_or_null<TypedefNameDecl>(Importer.
Import(T->
getDecl()));
1709 if (ToUnderlyingType.
isNull())
1722 if (UnderlyingType.
isNull())
1743 if (!FromDeduced.
isNull()) {
1744 ToDeduced = Importer.
Import(FromDeduced);
1755 = dyn_cast_or_null<RecordDecl>(Importer.
Import(T->
getDecl()));
1764 = dyn_cast_or_null<EnumDecl>(Importer.
Import(T->
getDecl()));
1777 if (!FromModifiedType.
isNull()) {
1778 ToModifiedType = Importer.
Import(FromModifiedType);
1779 if (ToModifiedType.
isNull())
1782 if (!FromEquivalentType.
isNull()) {
1783 ToEquivalentType = Importer.
Import(FromEquivalentType);
1784 if (ToEquivalentType.
isNull())
1789 ToModifiedType, ToEquivalentType);
1803 if (!
QualType(T, 0).isCanonical()) {
1806 ToCanonType =Importer.
Import(FromCanonType);
1807 if (ToCanonType.
isNull())
1811 ToTemplateArgs.data(),
1812 ToTemplateArgs.size(),
1826 if (ToNamedType.
isNull())
1830 ToQualifier, ToNamedType);
1835 = dyn_cast_or_null<ObjCInterfaceDecl>(Importer.
Import(T->
getDecl()));
1850 if (ImportedTypeArg.
isNull())
1853 TypeArgs.push_back(ImportedTypeArg);
1857 for (
auto *
P : T->
quals()) {
1859 = dyn_cast_or_null<ObjCProtocolDecl>(Importer.
Import(
P));
1862 Protocols.push_back(Protocol);
1873 if (ToPointeeType.
isNull())
1915 ToD = Importer.
Import(FromD);
1920 if (
RecordDecl *FromRecord = dyn_cast<RecordDecl>(FromD)) {
1921 if (
RecordDecl *ToRecord = cast_or_null<RecordDecl>(ToD)) {
1922 if (FromRecord->getDefinition() && FromRecord->isCompleteDefinition() && !ToRecord->getDefinition()) {
1929 if (
EnumDecl *FromEnum = dyn_cast<EnumDecl>(FromD)) {
1930 if (
EnumDecl *ToEnum = cast_or_null<EnumDecl>(ToD)) {
1931 if (FromEnum->getDefinition() && !ToEnum->getDefinition()) {
1970 llvm_unreachable(
"Unknown name kind.");
1979 for (
auto *From : FromDC->
decls())
1998 struct CXXRecordDecl::DefinitionData &ToData = ToCXX->data();
1999 struct CXXRecordDecl::DefinitionData &FromData = FromCXX->data();
2000 ToData.UserDeclaredConstructor = FromData.UserDeclaredConstructor;
2001 ToData.UserDeclaredSpecialMembers = FromData.UserDeclaredSpecialMembers;
2002 ToData.Aggregate = FromData.Aggregate;
2003 ToData.PlainOldData = FromData.PlainOldData;
2004 ToData.Empty = FromData.Empty;
2005 ToData.Polymorphic = FromData.Polymorphic;
2006 ToData.Abstract = FromData.Abstract;
2007 ToData.IsStandardLayout = FromData.IsStandardLayout;
2008 ToData.HasNoNonEmptyBases = FromData.HasNoNonEmptyBases;
2009 ToData.HasPrivateFields = FromData.HasPrivateFields;
2010 ToData.HasProtectedFields = FromData.HasProtectedFields;
2011 ToData.HasPublicFields = FromData.HasPublicFields;
2012 ToData.HasMutableFields = FromData.HasMutableFields;
2013 ToData.HasVariantMembers = FromData.HasVariantMembers;
2014 ToData.HasOnlyCMembers = FromData.HasOnlyCMembers;
2015 ToData.HasInClassInitializer = FromData.HasInClassInitializer;
2016 ToData.HasUninitializedReferenceMember
2017 = FromData.HasUninitializedReferenceMember;
2018 ToData.NeedOverloadResolutionForMoveConstructor
2019 = FromData.NeedOverloadResolutionForMoveConstructor;
2020 ToData.NeedOverloadResolutionForMoveAssignment
2021 = FromData.NeedOverloadResolutionForMoveAssignment;
2022 ToData.NeedOverloadResolutionForDestructor
2023 = FromData.NeedOverloadResolutionForDestructor;
2024 ToData.DefaultedMoveConstructorIsDeleted
2025 = FromData.DefaultedMoveConstructorIsDeleted;
2026 ToData.DefaultedMoveAssignmentIsDeleted
2027 = FromData.DefaultedMoveAssignmentIsDeleted;
2028 ToData.DefaultedDestructorIsDeleted = FromData.DefaultedDestructorIsDeleted;
2029 ToData.HasTrivialSpecialMembers = FromData.HasTrivialSpecialMembers;
2030 ToData.HasIrrelevantDestructor = FromData.HasIrrelevantDestructor;
2031 ToData.HasConstexprNonCopyMoveConstructor
2032 = FromData.HasConstexprNonCopyMoveConstructor;
2033 ToData.DefaultedDefaultConstructorIsConstexpr
2034 = FromData.DefaultedDefaultConstructorIsConstexpr;
2035 ToData.HasConstexprDefaultConstructor
2036 = FromData.HasConstexprDefaultConstructor;
2037 ToData.HasNonLiteralTypeFieldsOrBases
2038 = FromData.HasNonLiteralTypeFieldsOrBases;
2040 ToData.UserProvidedDefaultConstructor
2041 = FromData.UserProvidedDefaultConstructor;
2042 ToData.DeclaredSpecialMembers = FromData.DeclaredSpecialMembers;
2043 ToData.ImplicitCopyConstructorHasConstParam
2044 = FromData.ImplicitCopyConstructorHasConstParam;
2045 ToData.ImplicitCopyAssignmentHasConstParam
2046 = FromData.ImplicitCopyAssignmentHasConstParam;
2047 ToData.HasDeclaredCopyConstructorWithConstParam
2048 = FromData.HasDeclaredCopyConstructorWithConstParam;
2049 ToData.HasDeclaredCopyAssignmentWithConstParam
2050 = FromData.HasDeclaredCopyAssignmentWithConstParam;
2051 ToData.IsLambda = FromData.IsLambda;
2054 for (
const auto &Base1 : FromCXX->
bases()) {
2060 if (Base1.isPackExpansion())
2061 EllipsisLoc = Importer.
Import(Base1.getEllipsisLoc());
2070 Base1.isBaseOfClass(),
2071 Base1.getAccessSpecifierAsWritten(),
2072 Importer.
Import(Base1.getTypeSourceInfo()),
2076 ToCXX->setBases(Bases.data(), Bases.size());
2116 if (ToPromotionType.
isNull())
2133 ToParams.reserve(Params->
size());
2135 PEnd = Params->
end();
2141 ToParams.push_back(cast<NamedDecl>(To));
2147 ToParams.data(), ToParams.size(),
2174 if (!To || ToType.
isNull())
2216 std::copy(ToPack.begin(), ToPack.end(), ToArgs);
2221 llvm_unreachable(
"Invalid template argument kind");
2225 unsigned NumFromArgs,
2227 for (
unsigned I = 0; I != NumFromArgs; ++I) {
2232 ToArgs.push_back(To);
2246 ToRecord = ToOriginRecord;
2253 return Ctx.IsStructurallyEquivalent(FromRecord, ToRecord);
2258 StructuralEquivalenceContext Ctx(
2261 return Ctx.IsStructurallyEquivalent(FromVar, ToVar);
2268 return Ctx.IsStructurallyEquivalent(FromEnum, ToEnum);
2274 const llvm::APSInt &FromVal = FromEC->
getInitVal();
2275 const llvm::APSInt &ToVal = ToEC->
getInitVal();
2277 return FromVal.isSigned() == ToVal.isSigned() &&
2278 FromVal.getBitWidth() == ToVal.getBitWidth() &&
2287 return Ctx.IsStructurallyEquivalent(From, To);
2295 return Ctx.IsStructurallyEquivalent(From, To);
2332 MergeWithNamespace = cast<NamespaceDecl>(DC)->getAnonymousNamespace();
2337 for (
unsigned I = 0, N = FoundDecls.size(); I != N; ++I) {
2341 if (
NamespaceDecl *FoundNS = dyn_cast<NamespaceDecl>(FoundDecls[I])) {
2342 MergeWithNamespace = FoundNS;
2343 ConflictingDecls.clear();
2347 ConflictingDecls.push_back(FoundDecls[I]);
2350 if (!ConflictingDecls.empty()) {
2352 ConflictingDecls.data(),
2353 ConflictingDecls.size());
2372 TU->setAnonymousNamespace(ToNamespace);
2374 cast<NamespaceDecl>(DC)->setAnonymousNamespace(ToNamespace);
2403 for (
unsigned I = 0, N = FoundDecls.size(); I != N; ++I) {
2404 if (!FoundDecls[I]->isInIdentifierNamespace(IDNS))
2407 dyn_cast<TypedefNameDecl>(FoundDecls[I])) {
2409 FoundTypedef->getUnderlyingType()))
2410 return Importer.
Imported(D, FoundTypedef);
2413 ConflictingDecls.push_back(FoundDecls[I]);
2416 if (!ConflictingDecls.empty()) {
2418 ConflictingDecls.data(),
2419 ConflictingDecls.size());
2446 ToTypedef->setLexicalDeclContext(LexicalDC);
2486 for (
unsigned I = 0, N = FoundDecls.size(); I != N; ++I) {
2487 if (!FoundDecls[I]->isInIdentifierNamespace(IDNS))
2490 Decl *Found = FoundDecls[I];
2493 Found = Tag->getDecl();
2496 if (
EnumDecl *FoundEnum = dyn_cast<EnumDecl>(Found)) {
2498 return Importer.
Imported(D, FoundEnum);
2501 ConflictingDecls.push_back(FoundDecls[I]);
2504 if (!ConflictingDecls.empty()) {
2506 ConflictingDecls.data(),
2507 ConflictingDecls.size());
2526 if (ToIntegerType.
isNull())
2542 if (Definition && Definition != D) {
2543 Decl *ImportedDef = Importer.
Import(Definition);
2547 return Importer.
Imported(D, ImportedDef);
2575 for (
unsigned I = 0, N = FoundDecls.size(); I != N; ++I) {
2576 if (!FoundDecls[I]->isInIdentifierNamespace(IDNS))
2579 Decl *Found = FoundDecls[I];
2582 Found = Tag->getDecl();
2585 if (
RecordDecl *FoundRecord = dyn_cast<RecordDecl>(Found)) {
2587 FoundRecord->isAnonymousStructOrUnion()) {
2594 if (*Index1 != *Index2)
2604 == FoundDef->isAnonymousStructOrUnion() &&
2610 return Importer.
Imported(D, FoundDef);
2619 if (FoundRecord->hasExternalLexicalStorage() &&
2620 !FoundRecord->isCompleteDefinition())
2625 if (FoundRecord->isCompleteDefinition() &&
2630 AdoptDecl = FoundRecord;
2632 }
else if (!SearchName) {
2637 ConflictingDecls.push_back(FoundDecls[I]);
2640 if (!ConflictingDecls.empty() && SearchName) {
2642 ConflictingDecls.data(),
2643 ConflictingDecls.size());
2651 if (isa<CXXRecordDecl>(D)) {
2700 for (
unsigned I = 0, N = FoundDecls.size(); I != N; ++I) {
2701 if (!FoundDecls[I]->isInIdentifierNamespace(IDNS))
2705 = dyn_cast<EnumConstantDecl>(FoundDecls[I])) {
2707 return Importer.
Imported(D, FoundEnumConstant);
2710 ConflictingDecls.push_back(FoundDecls[I]);
2713 if (!ConflictingDecls.empty()) {
2715 ConflictingDecls.data(),
2716 ConflictingDecls.size());
2732 Importer.
Imported(D, ToEnumerator);
2734 return ToEnumerator;
2755 for (
unsigned I = 0, N = FoundDecls.size(); I != N; ++I) {
2756 if (!FoundDecls[I]->isInIdentifierNamespace(IDNS))
2759 if (
FunctionDecl *FoundFunction = dyn_cast<FunctionDecl>(FoundDecls[I])) {
2760 if (FoundFunction->hasExternalFormalLinkage() &&
2763 FoundFunction->getType())) {
2765 return Importer.
Imported(D, FoundFunction);
2776 Importer.
ToDiag(Loc, diag::err_odr_function_type_inconsistent)
2777 << Name << D->
getType() << FoundFunction->getType();
2778 Importer.
ToDiag(FoundFunction->getLocation(),
2779 diag::note_odr_value_here)
2780 << FoundFunction->getType();
2784 ConflictingDecls.push_back(FoundDecls[I]);
2787 if (!ConflictingDecls.empty()) {
2789 ConflictingDecls.data(),
2790 ConflictingDecls.size());
2801 bool usedDifferentExceptionSpec =
false;
2815 FromFPT->getReturnType(), FromFPT->getParamTypes(), DefaultEPI);
2816 usedDifferentExceptionSpec =
true;
2832 Parameters.push_back(ToP);
2841 cast<CXXRecordDecl>(DC),
2844 FromConstructor->isExplicit(),
2848 }
else if (isa<CXXDestructorDecl>(D)) {
2850 cast<CXXRecordDecl>(DC),
2856 = dyn_cast<CXXConversionDecl>(D)) {
2858 cast<CXXRecordDecl>(DC),
2862 FromConversion->isExplicit(),
2865 }
else if (
CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(D)) {
2867 cast<CXXRecordDecl>(DC),
2870 Method->getStorageClass(),
2871 Method->isInlineSpecified(),
2893 for (
unsigned I = 0, N = Parameters.size(); I != N; ++I) {
2894 Parameters[I]->setOwningFunction(ToFunction);
2897 ToFunction->setParams(Parameters);
2899 if (usedDifferentExceptionSpec) {
2909 if (
Stmt *ToBody = Importer.
Import(FromBody)) {
2948 if (isa<FieldDecl>(*D) || isa<IndirectFieldDecl>(*D))
2969 for (
unsigned I = 0, N = FoundDecls.size(); I != N; ++I) {
2970 if (
FieldDecl *FoundField = dyn_cast<FieldDecl>(FoundDecls[I])) {
2976 FoundField->getType())) {
2981 Importer.
ToDiag(Loc, diag::err_odr_field_type_inconsistent)
2982 << Name << D->
getType() << FoundField->getType();
2983 Importer.
ToDiag(FoundField->getLocation(), diag::note_odr_value_here)
2984 << FoundField->getType();
3028 for (
unsigned I = 0, N = FoundDecls.size(); I != N; ++I) {
3030 = dyn_cast<IndirectFieldDecl>(FoundDecls[I])) {
3036 FoundField->getType(),
3043 if (!Name && I < N-1)
3046 Importer.
ToDiag(Loc, diag::err_odr_field_type_inconsistent)
3047 << Name << D->
getType() << FoundField->getType();
3048 Importer.
ToDiag(FoundField->getLocation(), diag::note_odr_value_here)
3049 << FoundField->getType();
3063 for (
auto *PI : D->
chain()) {
3067 NamedChain[i++] = cast<NamedDecl>(D);
3079 Importer.
Imported(D, ToIndirectField);
3081 return ToIndirectField;
3098 for (
unsigned I = 0, N = FoundDecls.size(); I != N; ++I) {
3099 if (
ObjCIvarDecl *FoundIvar = dyn_cast<ObjCIvarDecl>(FoundDecls[I])) {
3101 FoundIvar->getType())) {
3106 Importer.
ToDiag(Loc, diag::err_odr_ivar_type_inconsistent)
3107 << Name << D->
getType() << FoundIvar->getType();
3108 Importer.
ToDiag(FoundIvar->getLocation(), diag::note_odr_value_here)
3109 << FoundIvar->getType();
3125 cast<ObjCContainerDecl>(DC),
3151 VarDecl *MergeWithVar =
nullptr;
3156 for (
unsigned I = 0, N = FoundDecls.size(); I != N; ++I) {
3157 if (!FoundDecls[I]->isInIdentifierNamespace(IDNS))
3160 if (
VarDecl *FoundVar = dyn_cast<VarDecl>(FoundDecls[I])) {
3162 if (FoundVar->hasExternalFormalLinkage() &&
3165 FoundVar->getType())) {
3166 MergeWithVar = FoundVar;
3174 if (FoundArray && TArray) {
3175 if (isa<IncompleteArrayType>(FoundArray) &&
3176 isa<ConstantArrayType>(TArray)) {
3182 FoundVar->setType(T);
3183 MergeWithVar = FoundVar;
3185 }
else if (isa<IncompleteArrayType>(TArray) &&
3186 isa<ConstantArrayType>(FoundArray)) {
3187 MergeWithVar = FoundVar;
3192 Importer.
ToDiag(Loc, diag::err_odr_variable_type_inconsistent)
3193 << Name << D->
getType() << FoundVar->getType();
3194 Importer.
ToDiag(FoundVar->getLocation(), diag::note_odr_value_here)
3195 << FoundVar->getType();
3199 ConflictingDecls.push_back(FoundDecls[I]);
3205 Importer.
Imported(D, MergeWithVar);
3209 Importer.
ToDiag(ExistingDef->getLocation(),
3210 diag::err_odr_variable_multiple_def)
3212 Importer.
FromDiag(DDef->getLocation(), diag::note_odr_defined_here);
3214 Expr *Init = Importer.
Import(DDef->getInit());
3216 if (DDef->isInitKnownICE()) {
3219 Eval->
IsICE = DDef->isInitICE();
3224 return MergeWithVar;
3227 if (!ConflictingDecls.empty()) {
3229 ConflictingDecls.data(),
3230 ConflictingDecls.size());
3288 return Importer.
Imported(D, ToParm);
3321 return Importer.
Imported(D, ToParm);
3337 for (
unsigned I = 0, N = FoundDecls.size(); I != N; ++I) {
3338 if (
ObjCMethodDecl *FoundMethod = dyn_cast<ObjCMethodDecl>(FoundDecls[I])) {
3344 FoundMethod->getReturnType())) {
3345 Importer.
ToDiag(Loc, diag::err_odr_objc_method_result_type_inconsistent)
3347 << FoundMethod->getReturnType();
3348 Importer.
ToDiag(FoundMethod->getLocation(),
3349 diag::note_odr_objc_method_here)
3355 if (D->
param_size() != FoundMethod->param_size()) {
3356 Importer.
ToDiag(Loc, diag::err_odr_objc_method_num_params_inconsistent)
3358 << D->
param_size() << FoundMethod->param_size();
3359 Importer.
ToDiag(FoundMethod->getLocation(),
3360 diag::note_odr_objc_method_here)
3367 PEnd = D->
param_end(), FoundP = FoundMethod->param_begin();
3368 P != PEnd; ++
P, ++FoundP) {
3370 (*FoundP)->getType())) {
3371 Importer.
FromDiag((*P)->getLocation(),
3372 diag::err_odr_objc_method_param_type_inconsistent)
3374 << (*P)->getType() << (*FoundP)->getType();
3375 Importer.
ToDiag((*FoundP)->getLocation(), diag::note_odr_value_here)
3376 << (*FoundP)->getType();
3383 if (D->
isVariadic() != FoundMethod->isVariadic()) {
3384 Importer.
ToDiag(Loc, diag::err_odr_objc_method_variadic_inconsistent)
3386 Importer.
ToDiag(FoundMethod->getLocation(),
3387 diag::note_odr_objc_method_here)
3393 return Importer.
Imported(D, FoundMethod);
3415 for (
auto *FromP : D->
params()) {
3420 ToParams.push_back(ToP);
3424 for (
unsigned I = 0, N = ToParams.size(); I != N; ++I) {
3512 FromProto != FromProtoEnd;
3513 ++FromProto, ++FromProtoLoc) {
3515 = cast_or_null<ObjCProtocolDecl>(Importer.
Import(*FromProto));
3518 Protocols.push_back(ToProto);
3519 ProtocolLocs.push_back(Importer.
Import(*FromProtoLoc));
3536 = cast_or_null<ObjCCategoryImplDecl>(
3566 FromProto != FromProtoEnd;
3567 ++FromProto, ++FromProtoLoc) {
3569 = cast_or_null<ObjCProtocolDecl>(Importer.
Import(*FromProto));
3572 Protocols.push_back(ToProto);
3573 ProtocolLocs.push_back(Importer.
Import(*FromProtoLoc));
3592 if (Definition && Definition != D) {
3593 Decl *ImportedDef = Importer.
Import(Definition);
3597 return Importer.
Imported(D, ImportedDef);
3613 for (
unsigned I = 0, N = FoundDecls.size(); I != N; ++I) {
3617 if ((MergeWithProtocol = dyn_cast<ObjCProtocolDecl>(FoundDecls[I])))
3664 Importer.
Imported(D, ToLinkageSpec);
3666 return ToLinkageSpec;
3676 FromSuper = cast_or_null<ObjCInterfaceDecl>(Importer.
Import(FromSuper));
3682 if ((
bool)FromSuper != (
bool)ToSuper ||
3685 diag::err_odr_objc_superclass_inconsistent)
3692 diag::note_odr_objc_missing_superclass);
3695 diag::note_odr_objc_superclass)
3699 diag::note_odr_objc_missing_superclass);
3727 FromProto != FromProtoEnd;
3728 ++FromProto, ++FromProtoLoc) {
3730 = cast_or_null<ObjCProtocolDecl>(Importer.
Import(*FromProto));
3733 Protocols.push_back(ToProto);
3734 ProtocolLocs.push_back(Importer.
Import(*FromProtoLoc));
3769 for (
auto fromTypeParam : *list) {
3770 auto toTypeParam = cast_or_null<ObjCTypeParamDecl>(
3771 Importer.
Import(fromTypeParam));
3775 toTypeParams.push_back(toTypeParam);
3779 Importer.
Import(list->getLAngleLoc()),
3781 Importer.
Import(list->getRAngleLoc()));
3789 if (Definition && Definition != D) {
3790 Decl *ImportedDef = Importer.
Import(Definition);
3794 return Importer.
Imported(D, ImportedDef);
3811 for (
unsigned I = 0, N = FoundDecls.size(); I != N; ++I) {
3815 if ((MergeWithIface = dyn_cast<ObjCInterfaceDecl>(FoundDecls[I])))
3891 Super = cast_or_null<ObjCInterfaceDecl>(
3931 diag::err_odr_objc_superclass_inconsistent)
3937 diag::note_odr_objc_superclass)
3941 diag::note_odr_objc_missing_superclass);
3944 diag::note_odr_objc_superclass)
3948 diag::note_odr_objc_missing_superclass);
3973 for (
unsigned I = 0, N = FoundDecls.size(); I != N; ++I) {
3975 = dyn_cast<ObjCPropertyDecl>(FoundDecls[I])) {
3978 FoundProp->getType())) {
3979 Importer.
ToDiag(Loc, diag::err_odr_objc_property_type_inconsistent)
3980 << Name << D->
getType() << FoundProp->getType();
3981 Importer.
ToDiag(FoundProp->getLocation(), diag::note_odr_value_here)
3982 << FoundProp->getType();
4051 Ivar = cast_or_null<ObjCIvarDecl>(
4075 diag::err_odr_objc_property_impl_kind_inconsistent)
4080 diag::note_odr_objc_property_impl_kind)
4090 diag::err_odr_objc_synthesize_ivar_inconsistent)
4095 diag::note_odr_objc_synthesize_ivar_here)
4167 if (!TemplateParams)
4192 return Importer.
Imported(D, ImportedDef);
4210 for (
unsigned I = 0, N = FoundDecls.size(); I != N; ++I) {
4214 Decl *Found = FoundDecls[I];
4216 = dyn_cast<ClassTemplateDecl>(Found)) {
4222 FoundTemplate->getTemplatedDecl());
4223 return Importer.
Imported(D, FoundTemplate);
4227 ConflictingDecls.push_back(FoundDecls[I]);
4230 if (!ConflictingDecls.empty()) {
4232 ConflictingDecls.data(),
4233 ConflictingDecls.size());
4247 DC, StartLoc, IdLoc,
4256 if (!TemplateParams)
4260 Loc, Name, TemplateParams,
4263 D2Templated->setDescribedClassTemplate(D2);
4271 Importer.
Imported(DTemplated, D2Templated);
4274 !D2Templated->isCompleteDefinition()) {
4287 if (Definition && Definition != D) {
4288 Decl *ImportedDef = Importer.
Import(Definition);
4292 return Importer.
Imported(D, ImportedDef);
4296 = cast_or_null<ClassTemplateDecl>(Importer.
Import(
4325 void *InsertPos =
nullptr;
4339 return Importer.
Imported(D, FoundDef);
4348 TemplateArgs.data(),
4349 TemplateArgs.size(),
4354 ClassTemplate->AddSpecialization(D2, InsertPos);
4383 return Importer.
Imported(D, ImportedDef);
4398 "Variable templates cannot be declared at function scope");
4402 for (
unsigned I = 0, N = FoundDecls.size(); I != N; ++I) {
4406 Decl *Found = FoundDecls[I];
4407 if (
VarTemplateDecl *FoundTemplate = dyn_cast<VarTemplateDecl>(Found)) {
4411 FoundTemplate->getTemplatedDecl());
4412 return Importer.
Imported(D, FoundTemplate);
4416 ConflictingDecls.push_back(FoundDecls[I]);
4419 if (!ConflictingDecls.empty()) {
4421 ConflictingDecls.data(),
4422 ConflictingDecls.size());
4456 if (!TemplateParams)
4460 Importer.
getToContext(), DC, Loc, Name, TemplateParams, D2Templated);
4469 Importer.
Imported(DTemplated, D2Templated);
4485 if (Definition && Definition != D) {
4486 Decl *ImportedDef = Importer.
Import(Definition);
4490 return Importer.
Imported(D, ImportedDef);
4521 void *InsertPos =
nullptr;
4523 TemplateArgs, InsertPos);
4536 return Importer.
Imported(D, FoundDef);
4549 Importer.
getToContext(), DC, StartLoc, IdLoc, VarTemplate, T, TInfo,
4555 VarTemplate->AddSpecialization(D2, InsertPos);
4579 size_t NumDecls = DG.
end() - DG.
begin();
4581 auto &_Importer = this->Importer;
4582 std::transform(DG.
begin(), DG.
end(), ToDecls.begin(),
4584 return _Importer.Import(D);
4592 Importer.
FromDiag(S->getLocStart(), diag::err_unsupported_ast_node)
4593 << S->getStmtClassName();
4599 for (
Decl *ToD : ToDG) {
4616 auto &_Importer = this->Importer;
4619 return _Importer.Import(CS);
4621 for (
Stmt *ToS : ToStmts) {
4629 ToLBraceLoc, ToRBraceLoc);
4637 if (!ToRHS && S->
getRHS())
4643 ToCaseLoc, ToEllipsisLoc,
4661 if (!ToLabelDecl && S->
getDecl())
4675 std::transform(FromAttrs.begin(), FromAttrs.end(), ToAttrs.begin(),
4676 [&_ToContext](
const Attr *A) ->
const Attr * {
4677 return A->
clone(_ToContext);
4679 for (
const Attr *ToA : ToAttrs) {
4687 ToAttrs, ToSubStmt);
4692 VarDecl *ToConditionVariable =
nullptr;
4694 ToConditionVariable =
4695 dyn_cast_or_null<VarDecl>(Importer.
Import(FromConditionVariable));
4696 if (!ToConditionVariable)
4700 if (!ToCondition && S->
getCond())
4703 if (!ToThenStmt && S->
getThen())
4707 if (!ToElseStmt && S->
getElse())
4710 ToIfLoc, ToConditionVariable,
4711 ToCondition, ToThenStmt,
4712 ToElseLoc, ToElseStmt);
4716 VarDecl *ToConditionVariable =
nullptr;
4718 ToConditionVariable =
4719 dyn_cast_or_null<VarDecl>(Importer.
Import(FromConditionVariable));
4720 if (!ToConditionVariable)
4724 if (!ToCondition && S->
getCond())
4741 if (LastChainedSwitchCase)
4745 LastChainedSwitchCase = ToSC;
4751 VarDecl *ToConditionVariable =
nullptr;
4753 ToConditionVariable =
4754 dyn_cast_or_null<VarDecl>(Importer.
Import(FromConditionVariable));
4755 if (!ToConditionVariable)
4759 if (!ToCondition && S->
getCond())
4766 ToConditionVariable,
4767 ToCondition, ToBody,
4776 if (!ToCondition && S->
getCond())
4782 ToDoLoc, ToWhileLoc,
4791 if (!ToCondition && S->
getCond())
4793 VarDecl *ToConditionVariable =
nullptr;
4795 ToConditionVariable =
4796 dyn_cast_or_null<VarDecl>(Importer.
Import(FromConditionVariable));
4797 if (!ToConditionVariable)
4801 if (!ToInc && S->
getInc())
4810 ToInit, ToCondition,
4811 ToConditionVariable,
4813 ToForLoc, ToLParenLoc,
4820 ToLabel = dyn_cast_or_null<LabelDecl>(Importer.
Import(FromLabel));
4827 ToGotoLoc, ToLabelLoc);
4856 VarDecl *ToNRVOCandidate = cast_or_null<VarDecl>(Importer.
Import(NRVOCandidate));
4857 if (!ToNRVOCandidate && NRVOCandidate)
4865 VarDecl *ToExceptionDecl =
nullptr;
4868 dyn_cast_or_null<VarDecl>(Importer.
Import(FromExceptionDecl));
4869 if (!ToExceptionDecl)
4886 for (
unsigned HI = 0, HE = S->
getNumHandlers(); HI != HE; ++HI) {
4888 if (
Stmt *ToHandler = Importer.
Import(FromHandler))
4889 ToHandlers[HI] = ToHandler;
4910 if (!ToInc && S->
getInc())
4925 ToForLoc, ToColonLoc,
4950 VarDecl *ToExceptionDecl =
nullptr;
4953 dyn_cast_or_null<VarDecl>(Importer.
Import(FromExceptionDecl));
4954 if (!ToExceptionDecl)
4983 if (
Stmt *ToCatchStmt = Importer.
Import(FromCatchStmt))
4984 ToCatchStmts[CI] = ToCatchStmt;
4992 ToAtTryLoc, ToAtTryStmt,
4993 ToCatchStmts.begin(), ToCatchStmts.size(),
5008 ToAtSynchronizedLoc, ToSynchExpr, ToSynchBody);
5033 Importer.
FromDiag(E->getLocStart(), diag::err_unsupported_ast_node)
5034 << E->getStmtClassName();
5134 SubExpr, ResultType,
5165 if (CompLHSType.
isNull())
5169 if (CompResultType.
isNull())
5184 CompLHSType, CompResultType,
5232 SubExpr, &BasePath, TInfo,
5252 return _Importer.
Import(AE);
5254 for (
Expr *ToA : ToArgs) {
5300 ToMember, ToFoundDecl, ToMemberNameInfo,
5318 for (
unsigned ai = 0, ae = NumArgs; ai != ae; ++ai) {
5329 for (
unsigned ai = 0, ae = NumArgs; ai != ae; ++ai)
5330 ToArgs_Copied[ai] = ToArgs[ai];
5341 : ToContext(ToContext), FromContext(FromContext),
5342 ToFileManager(ToFileManager), FromFileManager(FromFileManager),
5343 Minimal(MinimalImport), LastDiagFromFrom(
false)
5358 llvm::DenseMap<const Type *, const Type *>::iterator Pos
5359 = ImportedTypes.find(fromTy);
5360 if (Pos != ImportedTypes.end())
5390 llvm::DenseMap<Decl *, Decl *>::iterator Pos = ImportedDecls.find(FromD);
5391 if (Pos != ImportedDecls.end()) {
5392 Decl *ToD = Pos->second;
5407 llvm::DenseMap<Decl *, Decl *>::iterator Pos = ImportedDecls.find(FromD);
5408 if (Pos != ImportedDecls.end()) {
5409 Decl *ToD = Pos->second;
5420 ImportedDecls[FromD] = ToD;
5422 if (
TagDecl *FromTag = dyn_cast<TagDecl>(FromD)) {
5424 if (FromTag->getTypedefNameForAnonDecl())
5425 AnonTagsWithPendingTypedefs.push_back(FromTag);
5426 }
else if (
TypedefNameDecl *FromTypedef = dyn_cast<TypedefNameDecl>(FromD)) {
5430 FromTag = AnonTagsWithPendingTypedefs.begin(),
5431 FromTagEnd = AnonTagsWithPendingTypedefs.end();
5432 FromTag != FromTagEnd; ++FromTag) {
5433 if ((*FromTag)->getTypedefNameForAnonDecl() == FromTypedef) {
5434 if (
TagDecl *ToTag = cast_or_null<TagDecl>(
Import(*FromTag))) {
5436 ToTag->setTypedefNameForAnonDecl(cast<TypedefNameDecl>(ToD));
5437 AnonTagsWithPendingTypedefs.erase(FromTag);
5457 if (
RecordDecl *ToRecord = dyn_cast<RecordDecl>(ToDC)) {
5458 RecordDecl *FromRecord = cast<RecordDecl>(FromDC);
5459 if (ToRecord->isCompleteDefinition()) {
5467 }
else if (
EnumDecl *ToEnum = dyn_cast<EnumDecl>(ToDC)) {
5468 EnumDecl *FromEnum = cast<EnumDecl>(FromDC);
5469 if (ToEnum->isCompleteDefinition()) {
5479 if (ToClass->getDefinition()) {
5489 if (ToProto->getDefinition()) {
5506 return cast_or_null<Expr>(
Import(cast<Stmt>(FromE)));
5514 llvm::DenseMap<Stmt *, Stmt *>::iterator Pos = ImportedStmts.find(FromS);
5515 if (Pos != ImportedStmts.end())
5520 Stmt *ToS = Importer.Visit(FromS);
5525 ImportedStmts[FromS] = ToS;
5570 bool bTemplate = FromNNS->
getKind() ==
5579 llvm_unreachable(
"Invalid nested name specifier kind");
5600 E = FromStorage->
end();
5658 = cast_or_null<TemplateTemplateParmDecl>(
5673 llvm_unreachable(
"Invalid template name kind");
5701 llvm::DenseMap<FileID, FileID>::iterator Pos
5702 = ImportedFileIDs.find(FromID);
5703 if (Pos != ImportedFileIDs.end())
5709 assert(FromSLoc.
isFile() &&
"Cannot handle macro expansions yet");
5717 if (Cache->OrigEntry && Cache->OrigEntry->getDir()) {
5722 const FileEntry *Entry = ToFileManager.
getFile(Cache->OrigEntry->getName());
5729 const llvm::MemoryBuffer *
5730 FromBuf = Cache->getBuffer(FromContext.
getDiagnostics(), FromSM);
5731 std::unique_ptr<llvm::MemoryBuffer> ToBuf
5732 = llvm::MemoryBuffer::getMemBufferCopy(FromBuf->getBuffer(),
5733 FromBuf->getBufferIdentifier());
5739 ImportedFileIDs[FromID] = ToID;
5748 if (
DeclContext *FromDC = cast<DeclContext>(From)) {
5751 if (
RecordDecl *ToRecord = dyn_cast<RecordDecl>(To)) {
5752 if (!ToRecord->getDefinition()) {
5759 if (
EnumDecl *ToEnum = dyn_cast<EnumDecl>(To)) {
5760 if (!ToEnum->getDefinition()) {
5768 if (!ToIFace->getDefinition()) {
5776 if (!ToProto->getDefinition()) {
5840 llvm_unreachable(
"Invalid DeclarationName Kind!");
5856 for (
unsigned I = 1, N = FromSel.
getNumArgs(); I < N; ++I)
5865 unsigned NumDecls) {
5870 if (LastDiagFromFrom)
5873 LastDiagFromFrom =
false;
5878 if (!LastDiagFromFrom)
5881 LastDiagFromFrom =
true;
5887 if (!
ID->getDefinition())
5888 ID->startDefinition();
5891 if (!PD->getDefinition())
5892 PD->startDefinition();
5894 else if (
TagDecl *TD = dyn_cast<TagDecl>(D)) {
5895 if (!TD->getDefinition() && !TD->isBeingDefined()) {
5896 TD->startDefinition();
5897 TD->setCompleteDefinition(
true);
5901 assert (0 &&
"CompleteDecl called on a Decl that can't be completed");
5906 ImportedDecls[From] = To;
5912 llvm::DenseMap<const Type *, const Type *>::iterator Pos
5917 StructuralEquivalenceContext Ctx(FromContext, ToContext, NonEquivalentDecls,
5919 return Ctx.IsStructurallyEquivalent(From, To);
unsigned getNumElements() const
static NamespaceDecl * Create(ASTContext &C, DeclContext *DC, bool Inline, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, NamespaceDecl *PrevDecl)
param_const_iterator param_begin() const
ValueDecl * getMemberDecl() const
Retrieve the member declaration to which this expression refers.
SourceRange getParenOrBraceRange() const
void setMethodParams(ASTContext &C, ArrayRef< ParmVarDecl * > Params, ArrayRef< SourceLocation > SelLocs=llvm::None)
Sets the method's parameters and selector source locations. If the method is implicit (not coming fro...
QualType getElaboratedType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, QualType NamedType) const
Defines the clang::ASTContext interface.
QualType getExceptionType(unsigned i) const
Represents a type that was referred to using an elaborated type keyword, e.g., struct S...
SourceLocation getEnd() const
const SwitchCase * getNextSwitchCase() const
void setOwningFunction(DeclContext *FD)
Expr * getSizeExpr() const
QualType getUnderlyingType() const
TemplateParameterList * ImportTemplateParameterList(TemplateParameterList *Params)
Stmt * VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt *S)
Qualifiers getLocalQualifiers() const
Retrieve the set of qualifiers local to this particular QualType instance, not including any qualifie...
ObjCInterfaceDecl * getDecl() const
getDecl - Get the declaration of this interface.
CastKind getCastKind() const
ExprObjectKind getObjectKind() const
static unsigned getFieldIndex(Decl *F)
void setImplicit(bool I=true)
Decl * VisitCXXMethodDecl(CXXMethodDecl *D)
NamedDecl * getFoundDecl()
Get the NamedDecl through which this reference occurred.
QualType VisitVectorType(const VectorType *T)
Decl * VisitEnumDecl(EnumDecl *D)
unsigned getDepth() const
bool isMinimalImport() const
Whether the importer will perform a minimal import, creating to-be-completed forward declarations whe...
Stmt * VisitDoStmt(DoStmt *S)
const DeclGroupRef getDeclGroup() const
Smart pointer class that efficiently represents Objective-C method names.
This is a discriminated union of FileInfo and ExpansionInfo.
SubstTemplateTemplateParmStorage * getAsSubstTemplateTemplateParm() const
Retrieve the substituted template template parameter, if known.
void setAnonymousStructOrUnion(bool Anon)
const ObjCAtFinallyStmt * getFinallyStmt() const
Retrieve the @finally statement, if any.
ImplementationControl getImplementationControl() const
QualType VisitDecltypeType(const DecltypeType *T)
TemplateName getReplacement() const
SourceRange getBracketsRange() const
llvm::APSInt getAsIntegral() const
Retrieve the template argument as an integral value.
Expr * getArg(unsigned Arg)
getArg - Return the specified argument.
Stmt * VisitCaseStmt(CaseStmt *S)
ObjCInterfaceDecl * getClassInterface()
Implements support for file system lookup, file system caching, and directory search management...
void startDefinition()
Starts the definition of this Objective-C class, taking it from a forward declaration (@class) to a d...
bool isBitField() const
Determines whether this field is a bitfield.
bool hasLeadingEmptyMacro() const
SourceLocation getLParenLoc() const
ObjCTypeParamList * ImportObjCTypeParamList(ObjCTypeParamList *list)
QualType getType() const
Retrieves the type of the base class.
bool isElidable() const
Whether this construction is elidable.
DeclarationNameInfo getMemberNameInfo() const
Retrieve the member declaration name info.
Defines the clang::FileManager interface and associated types.
protocol_iterator protocol_end() const
QualType getComplexType(QualType T) const
Return the uniqued reference to the type for a complex number with the specified element type...
Stmt * VisitObjCAtCatchStmt(ObjCAtCatchStmt *S)
IdentifierInfo * getIdentifier() const
SourceLocation getTemplateKeywordLoc() const
Retrieve the location of the template keyword preceding the member name, if any.
Decl * VisitDecl(Decl *D)
bool isKindOfTypeAsWritten() const
Whether this is a "__kindof" type as written.
PropertyControl getPropertyImplementation() const
QualType getQualifiedType(SplitQualType split) const
Un-split a SplitQualType.
static CXXConstructExpr * Create(const ASTContext &C, QualType T, SourceLocation Loc, CXXConstructorDecl *D, bool Elidable, ArrayRef< Expr * > Args, bool HadMultipleCandidates, bool ListInitialization, bool StdInitListInitialization, bool ZeroInitialization, ConstructionKind ConstructKind, SourceRange ParenOrBraceRange)
Stmt * VisitContinueStmt(ContinueStmt *S)
CharacterKind getKind() const
SourceLocation getSpellingLoc(SourceLocation Loc) const
Given a SourceLocation object, return the spelling location referenced by the ID. ...
SourceLocation getCXXLiteralOperatorNameLoc() const
bool isFixed() const
Returns true if this is an Objective-C, C++11, or Microsoft-style enumeration with a fixed underlying...
bool isParameterPack() const
Returns whether this is a parameter pack.
CXXCatchStmt * getHandler(unsigned i)
TemplateDecl * getAsTemplateDecl() const
Retrieve the underlying template declaration that this template name refers to, if known...
bool IsICE
Whether this statement is an integral constant expression, or in C++11, whether the statement is a co...
const Expr * getInitExpr() const
bool isArgumentType() const
bool isThisDeclarationADefinition() const
Determine whether this particular declaration of this class is actually also a definition.
ClassTemplateSpecializationDecl * findSpecialization(ArrayRef< TemplateArgument > Args, void *&InsertPos)
Return the specialization with the provided arguments if it exists, otherwise return the insertion po...
QualType getRValueReferenceType(QualType T) const
Return the uniqued reference to the type for an rvalue reference to the specified type...
unsigned getNumArgs() const
Retrieve the number of template arguments.
Expr * VisitImplicitCastExpr(ImplicitCastExpr *E)
IdentifierInfo * getCXXLiteralIdentifier() const
OverloadedOperatorKind getOperator() const
Return the overloaded operator to which this template name refers.
Expr * VisitCXXConstructExpr(CXXConstructExpr *E)
Defines the SourceManager interface.
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in...
Expr * VisitBinaryOperator(BinaryOperator *E)
Represents a qualified type name for which the type name is dependent.
QualType getUnaryTransformType(QualType BaseType, QualType UnderlyingType, UnaryTransformType::UTTKind UKind) const
Unary type transforms.
SourceLocation getForLoc() const
static TemplateTemplateParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation L, unsigned D, unsigned P, bool ParameterPack, IdentifierInfo *Id, TemplateParameterList *Params)
CXXRecordDecl * getTemplatedDecl() const
Get the underlying class declarations of the template.
QualType getUnderlyingType() const
AccessSpecifier getAccess() const
static TemplateParameterList * Create(const ASTContext &C, SourceLocation TemplateLoc, SourceLocation LAngleLoc, NamedDecl **Params, unsigned NumParams, SourceLocation RAngleLoc)
DeclGroupRef ImportDeclGroup(DeclGroupRef DG)
chain_range chain() const
VarDecl * getDefinition(ASTContext &)
Get the real (not just tentative) definition for this declaration.
Represents a C++11 auto or C++1y decltype(auto) type.
void setPure(bool P=true)
Represents an attribute applied to a statement.
static ObjCProtocolDecl * Create(ASTContext &C, DeclContext *DC, IdentifierInfo *Id, SourceLocation nameLoc, SourceLocation atStartLoc, ObjCProtocolDecl *PrevDecl)
static ObjCPropertyDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, IdentifierInfo *Id, SourceLocation AtLocation, SourceLocation LParenLocation, QualType T, TypeSourceInfo *TSI, PropertyControl propControl=None)
pack_iterator pack_begin() const
Iterator referencing the first argument of a template argument pack.
QualType getLValueReferenceType(QualType T, bool SpelledAsLValue=true) const
Return the uniqued reference to the type for an lvalue reference to the specified type...
QualType getPointeeType() const
IdentifierInfo * getAsIdentifierInfo() const
static ClassTemplateSpecializationDecl * Create(ASTContext &Context, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, ClassTemplateDecl *SpecializedTemplate, const TemplateArgument *Args, unsigned NumArgs, ClassTemplateSpecializationDecl *PrevDecl)
CXXRecordDecl * getAsRecordDecl() const
Retrieve the record declaration stored in this nested name specifier.
enumerator_iterator enumerator_end() const
Represents Objective-C's @throw statement.
QualType VisitTemplateSpecializationType(const TemplateSpecializationType *T)
QualType getRecordType(const RecordDecl *Decl) const
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.
Declaration of a variable template.
SourceLocation getIfLoc() const
TemplateTemplateParmDecl * getParameterPack() const
Retrieve the template template parameter pack being substituted.
NamespaceDecl - Represent a C++ namespace.
protocol_loc_iterator protocol_loc_begin() const
NestedNameSpecifier * getPrefix() const
Return the prefix of this nested name specifier.
Represents a call to a C++ constructor.
RetTy Visit(const Type *T)
Performs the operation associated with this visitor object.
void setSpecializationKind(TemplateSpecializationKind TSK)
virtual void completeDefinition()
NamedDecl * getParam(unsigned Idx)
bool isDecltypeAuto() const
Decl * VisitFieldDecl(FieldDecl *D)
A container of type source information.
RefQualifierKind RefQualifier
void setSwitchCaseList(SwitchCase *SC)
Set the case list for this switch statement.
const Stmt * getElse() const
unsigned getIndex() const
Decl * VisitObjCCategoryImplDecl(ObjCCategoryImplDecl *D)
SourceLocation getOperatorLoc() const
Expr * getAsExpr() const
Retrieve the template argument as an expression.
void setTemplateArgsInfo(const TemplateArgumentListInfo &ArgsInfo)
ObjCProtocolList::iterator protocol_iterator
enumerator_iterator enumerator_begin() const
const TemplateArgument & get(unsigned Idx) const
Retrieve the template argument at a given index.
VarDecl * getConditionVariable() const
Retrieve the variable declared in this "for" statement, if any.
SourceLocation getLocEnd() const LLVM_READONLY
void localUncachedLookup(DeclarationName Name, SmallVectorImpl< NamedDecl * > &Results)
A simplistic name lookup mechanism that performs name lookup into this declaration context without co...
Represents a C++ constructor within a class.
bool isSpelledAsLValue() const
A template template parameter that has been substituted for some other template name.
Expr * getInClassInitializer() const
InClassInitStyle getInClassInitStyle() const
bool hasExplicitTemplateArgs() const
Determines whether the member name was followed by an explicit template argument list.
const llvm::APInt & getSize() const
protocol_loc_iterator protocol_loc_begin() const
ObjCTypeParamVariance getVariance() const
Determine the variance of this type parameter.
SourceLocation getIncludeLoc() const
SourceLocation getTemplateKeywordLoc() const
Retrieve the location of the template keyword preceding this name, if any.
CharacteristicKind getFileCharacteristic() const
Return whether this is a system header or not.
An identifier, stored as an IdentifierInfo*.
VarTemplateDecl * getSpecializedTemplate() const
Retrieve the template that this specialization specializes.
QualType VisitPointerType(const PointerType *T)
QualType getBlockPointerType(QualType T) const
Return the uniqued reference to the type for a block of the specified type.
virtual Decl * GetOriginalDecl(Decl *To)
Called by StructuralEquivalenceContext. If a RecordDecl is being compared to another RecordDecl as pa...
void setImplementation(ObjCCategoryImplDecl *ImplD)
SourceLocation getReturnLoc() const
static CXXConversionDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, bool isInline, bool isExplicit, bool isConstexpr, SourceLocation EndLocation)
bool isFileVarDecl() const
isFileVarDecl - Returns true for file scoped variable declaration.
static NestedNameSpecifier * Create(const ASTContext &Context, NestedNameSpecifier *Prefix, IdentifierInfo *II)
Builds a specifier combining a prefix and an identifier.
unsigned getIndex() const
Retrieve the index into its type parameter list.
void setCXXLiteralOperatorNameLoc(SourceLocation Loc)
const Expr * getCallee() const
Stmt * VisitLabelStmt(LabelStmt *S)
SourceLocation getIvarRBraceLoc() const
Expr * VisitIntegerLiteral(IntegerLiteral *E)
Represents an empty template argument, e.g., one that has not been deduced.
ExtProtoInfo - Extra information about a function prototype.
AccessSpecifier getAccess() const
TypeSourceInfo * getSuperClassTInfo() const
field_iterator field_begin() const
Represents a variable template specialization, which refers to a variable template with a given set o...
SourceLocation getLocation() const
Retrieve the location of the literal.
Decl * VisitVarDecl(VarDecl *D)
A namespace, stored as a NamespaceDecl*.
DiagnosticBuilder ToDiag(SourceLocation Loc, unsigned DiagID)
Report a diagnostic in the "to" context.
SourceLocation getDoLoc() const
UnaryExprOrTypeTrait getKind() const
Expr * VisitUnaryOperator(UnaryOperator *E)
Stores a list of template parameters for a TemplateDecl and its derived classes.
void getSelectorLocs(SmallVectorImpl< SourceLocation > &SelLocs) const
static bool ImportCastPath(CastExpr *E, CXXCastPath &Path)
QualType Import(QualType FromT)
Import the given type from the "from" context into the "to" context.
Qualifiers getIndexTypeQualifiers() const
unsigned param_size() const
unsigned getValue() const
TemplateTemplateParmDecl * getParameter() const
ParmVarDecl - Represents a parameter to a function.
Represents the result of substituting a type for a template type parameter.
bool ImportTemplateArguments(const TemplateArgument *FromArgs, unsigned NumFromArgs, SmallVectorImpl< TemplateArgument > &ToArgs)
unsigned getNumArgs() const
Retrieve the number of template arguments.
SourceLocation getDefaultLoc() const
SourceLocation getLocation() const
SourceLocation getEllipsisLoc() const
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier (with source-location information) that qualifies the name of this...
QualType getFunctionNoProtoType(QualType ResultTy, const FunctionType::ExtInfo &Info) const
Return a K&R style C function type like 'int()'.
IdentifierInfo * getIdentifier() const
TypeSourceInfo * getTypeSourceInfo() const
EvaluatedStmt * ensureEvaluatedStmt() const
const IdentifierInfo * getIdentifier() const
Returns the identifier to which this template name refers.
bool hasExternalFormalLinkage() const
True if this decl has external linkage.
unsigned getNumParams() const
Kind getPropertyImplementation() const
ObjCProtocolList::iterator protocol_iterator
ObjCTypeParamList * getTypeParamListAsWritten() const
Decl * VisitObjCCategoryDecl(ObjCCategoryDecl *D)
QualType VisitBlockPointerType(const BlockPointerType *T)
virtual DeclarationName HandleNameConflict(DeclarationName Name, DeclContext *DC, unsigned IDNS, NamedDecl **Decls, unsigned NumDecls)
Cope with a name conflict when importing a declaration into the given context.
const IdentifierInfo * getIdentifier() const
Retrieve the type named by the typename specifier as an identifier.
QualType getElementType() const
DeclarationName getName() const
getName - Returns the embedded declaration name.
FunctionType::ExtInfo ExtInfo
Represents a class template specialization, which refers to a class template with a given set of temp...
void setIntegerType(QualType T)
Set the underlying integer type.
unsigned getIndexTypeCVRQualifiers() const
bool isScopedUsingClassTag() const
Returns true if this is a C++11 scoped enumeration.
Decl * VisitTypedefDecl(TypedefDecl *D)
DiagnosticBuilder FromDiag(SourceLocation Loc, unsigned DiagID)
Report a diagnostic in the "from" context.
Decl * VisitClassTemplateSpecializationDecl(ClassTemplateSpecializationDecl *D)
Expr * VisitCompoundAssignOperator(CompoundAssignOperator *E)
static RecordDecl * Create(const ASTContext &C, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, RecordDecl *PrevDecl=nullptr)
QualType getAutoType(QualType DeducedType, bool IsDecltypeAuto, bool IsDependent) const
C++11 deduced auto type.
Expr * getSizeExpr() const
IdentifierInfo * getIdentifierInfoForSlot(unsigned argIndex) const
Retrieve the identifier at a given position in the selector.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
A C++ nested-name-specifier augmented with source location information.
Represents a dependent template name that cannot be resolved prior to template instantiation.
bool hasExternalLexicalStorage() const
Whether this DeclContext has external storage containing additional declarations that are lexically i...
bool CheckedICE
Whether we already checked whether this statement was an integral constant expression.
bool isIdentifier() const
Determine whether this template name refers to an identifier.
Decl * VisitTemplateTemplateParmDecl(TemplateTemplateParmDecl *D)
QualType VisitMemberPointerType(const MemberPointerType *T)
SourceLocation getLocStart() const LLVM_READONLY
protocol_iterator protocol_begin() const
QualType getExtVectorType(QualType VectorType, unsigned NumElts) const
Return the unique reference to an extended vector type of the specified element type and size...
bool isCompleteDefinition() const
void setTypeParamList(ObjCTypeParamList *TPL)
QualType VisitParenType(const ParenType *T)
SourceLocation getRParen() const
Get the location of the right parentheses ')'.
void startDefinition()
Starts the definition of this tag declaration.
void setSuperClass(TypeSourceInfo *superClass)
SourceLocation getCaseLoc() const
CXXRecordDecl * getDefinition() const
unsigned size() const
Retrieve the number of template arguments in this template argument list.
NestedNameSpecifier * getQualifier() const
Retrieve the qualification on this type.
TagKind getTagKind() const
bool hasSameType(QualType T1, QualType T2) const
Determine whether the given types T1 and T2 are equivalent.
Represents the result of substituting a set of types for a template type parameter pack...
static DeclRefExpr * Create(const ASTContext &Context, NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, ValueDecl *D, bool RefersToEnclosingVariableOrCapture, SourceLocation NameLoc, QualType T, ExprValueKind VK, NamedDecl *FoundD=nullptr, const TemplateArgumentListInfo *TemplateArgs=nullptr)
QualType getTypeOfType(QualType t) const
Expr * VisitExpr(Expr *E)
Decl * VisitObjCImplementationDecl(ObjCImplementationDecl *D)
SourceLocation getLBracLoc() const
void startDefinition()
Starts the definition of this Objective-C protocol.
bool isNull() const
Determine whether this is the empty selector.
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
SubstTemplateTemplateParmPackStorage * getAsSubstTemplateTemplateParmPack() const
Retrieve the substituted template template parameter pack, if known.
QualType VisitObjCInterfaceType(const ObjCInterfaceType *T)
SourceLocation getRParenLoc() const
TypeSourceInfo * getNamedTypeInfo() const
QualType getUnderlyingType() const
bool hasBraces() const
Determines whether this linkage specification had braces in its syntactic form.
QualType VisitComplexType(const ComplexType *T)
SourceLocation getCategoryNameLoc() const
bool isFPContractable() const
StorageClass getStorageClass() const
Returns the storage class as written in the source. For the computed linkage of symbol, see getLinkage.
Expr * getUnderlyingExpr() const
const VarDecl * getCatchParamDecl() const
SourceLocation getColonLoc() const
SourceLocation getWhileLoc() const
Represents Objective-C's @catch statement.
const CompoundStmt * getSynchBody() const
const VarDecl * getNRVOCandidate() const
Retrieve the variable that might be used for the named return value optimization. ...
bool isNull() const
Determine whether this template name is NULL.
QualType VisitVariableArrayType(const VariableArrayType *T)
Stmt * VisitBreakStmt(BreakStmt *S)
Decl * VisitCXXConstructorDecl(CXXConstructorDecl *D)
TemplateArgument getArgumentPack() const
param_type_range param_types() const
SourceLocation getLAngleLoc() const
QualType getParenType(QualType NamedType) const
const Stmt * getFinallyBody() const
A qualified template name, where the qualification is kept to describe the source code as written...
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier (with source-location information) that qualifies the name of this...
bool isParameterPack() const
Whether this parameter is a non-type template parameter pack.
SourceLocation getLocWithOffset(int Offset) const
Return a source location with the specified offset from this SourceLocation.
static ObjCInterfaceDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation atLoc, IdentifierInfo *Id, ObjCTypeParamList *typeParamList, ObjCInterfaceDecl *PrevDecl, SourceLocation ClassLoc=SourceLocation(), bool isInternal=false)
QualType VisitElaboratedType(const ElaboratedType *T)
static DeclAccessPair make(NamedDecl *D, AccessSpecifier AS)
const LangOptions & getLangOpts() const
Stmt * VisitAttributedStmt(AttributedStmt *S)
bool isInline() const
Returns true if this is an inline namespace declaration.
ObjCTypeParamList * getTypeParamList() const
void setCXXOperatorNameRange(SourceRange R)
SourceLocation getIvarLBraceLoc() const
SourceLocation getSuperClassLoc() const
Retrieve the starting location of the superclass.
static ObjCCategoryDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation AtLoc, SourceLocation ClassNameLoc, SourceLocation CategoryNameLoc, IdentifierInfo *Id, ObjCInterfaceDecl *IDecl, ObjCTypeParamList *typeParamList, SourceLocation IvarLBraceLoc=SourceLocation(), SourceLocation IvarRBraceLoc=SourceLocation())
QualType getBaseType() const
TemplateName getTemplateName() const
Retrieve the name of the template that we are specializing.
SourceLocation getAtFinallyLoc() const
static ObjCPropertyImplDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation atLoc, SourceLocation L, ObjCPropertyDecl *property, Kind PK, ObjCIvarDecl *ivarDecl, SourceLocation ivarLoc)
protocol_iterator protocol_end() const
QualType getReturnType() const
static EnumConstantDecl * Create(ASTContext &C, EnumDecl *DC, SourceLocation L, IdentifierInfo *Id, QualType T, Expr *E, const llvm::APSInt &V)
SourceLocation getRParenLoc() const
OverloadedTemplateStorage * getAsOverloadedTemplate() const
Retrieve the underlying, overloaded function template.
Stmt * getHandlerBlock() const
SourceLocation getLParen() const
Get the location of the left parentheses '('.
TemplateArgument getArgumentPack() const
Retrieve the template template argument pack with which this parameter was substituted.
TemplateName getSubstTemplateTemplateParm(TemplateTemplateParmDecl *param, TemplateName replacement) const
const ArrayType * getAsArrayType(QualType T) const
Decl * VisitObjCPropertyDecl(ObjCPropertyDecl *D)
TypeOfExprType (GCC extension).
Expr * VisitCharacterLiteral(CharacterLiteral *E)
static TemplateTypeParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation KeyLoc, SourceLocation NameLoc, unsigned D, unsigned P, IdentifierInfo *Id, bool Typename, bool ParameterPack)
Expr * getNoexceptExpr() const
A builtin binary operation expression such as "x + y" or "x <= y".
static ObjCTypeParamList * create(ASTContext &ctx, SourceLocation lAngleLoc, ArrayRef< ObjCTypeParamDecl * > typeParams, SourceLocation rAngleLoc)
Create a new Objective-C type parameter list.
RecordDecl * getDecl() const
static CXXTryStmt * Create(const ASTContext &C, SourceLocation tryLoc, Stmt *tryBlock, ArrayRef< Stmt * > handlers)
Decl * VisitObjCPropertyImplDecl(ObjCPropertyImplDecl *D)
Selector getSetterName() const
Stmt * VisitObjCAtFinallyStmt(ObjCAtFinallyStmt *S)
SourceLocation getThrowLoc()
ObjCProtocolDecl * getDefinition()
Retrieve the definition of this protocol, if any.
void setSpecializationKind(TemplateSpecializationKind TSK)
bool declaresSameEntity(const Decl *D1, const Decl *D2)
Determine whether two declarations declare the same entity.
const Stmt * getCatchBody() const
Decl * VisitObjCProtocolDecl(ObjCProtocolDecl *D)
NestedNameSpecifier * getQualifier() const
Retrieve the qualification on this type.
TypeClass getTypeClass() const
Represents an Objective-C protocol declaration.
const ObjCAtCatchStmt * getCatchStmt(unsigned I) const
Retrieve a @catch statement.
bool IsStructurallyEquivalent(QualType From, QualType To, bool Complain=true)
Determine whether the given types are structurally equivalent.
DeclContext * getLexicalDeclContext()
NestedNameSpecifier * getQualifier() const
Return the nested name specifier that qualifies this name.
static VarDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S)
static IntegerLiteral * Create(const ASTContext &C, const llvm::APInt &V, QualType type, SourceLocation l)
Returns a new integer literal with value 'V' and type 'type'.
Stmt * VisitNullStmt(NullStmt *S)
TypeSourceInfo * getTypeInfoAsWritten() const
void setProtocolList(ObjCProtocolDecl *const *List, unsigned Num, const SourceLocation *Locs, ASTContext &C)
Stmt * VisitCXXCatchStmt(CXXCatchStmt *S)
TemplateSpecializationKind getSpecializationKind() const
Determine the kind of specialization that this declaration represents.
Represents an ObjC class declaration.
SourceLocation getLocEnd() const LLVM_READONLY
Represents a linkage specification.
Expr * VisitCStyleCastExpr(CStyleCastExpr *E)
Stmt * VisitCXXTryStmt(CXXTryStmt *S)
PropertyAttributeKind getPropertyAttributes() const
FunctionDecl * SourceDecl
bool ImportDefinition(RecordDecl *From, RecordDecl *To, ImportDefinitionKind Kind=IDK_Default)
ASTImporter(ASTContext &ToContext, FileManager &ToFileManager, ASTContext &FromContext, FileManager &FromFileManager, bool MinimalImport)
Create a new AST importer.
known_categories_range known_categories() const
CanQualType UnsignedCharTy
static FunctionDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation NLoc, DeclarationName N, QualType T, TypeSourceInfo *TInfo, StorageClass SC, bool isInlineSpecified=false, bool hasWrittenPrototype=true, bool isConstexprSpecified=false)
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
SourceLocation getIvarLBraceLoc() const
Import the default subset of the definition, which might be nothing (if minimal import is set) or mig...
SourceLocation getSwitchLoc() const
void addDeclInternal(Decl *D)
Add the declaration D into this context, but suppress searches for external declarations with the sam...
SourceLocation getAtStartLoc() const
Stmt * VisitDeclStmt(DeclStmt *S)
ObjCProtocolDecl * getProtocol(unsigned I) const
Fetch a protocol by index.
const TemplateTypeParmType * getReplacedParameter() const
Gets the template parameter that was substituted for.
bool hadMultipleCandidates() const
Whether the referred constructor was resolved from an overloaded set having size greater than 1...
DiagnosticsEngine & getDiagnostics() const
field_iterator field_end() const
SourceLocation getLoc() const
getLoc - Returns the main location of the declaration name.
SourceLocation getAtLoc() const
EnumDecl * getDecl() const
QualType getTemplateSpecializationType(TemplateName T, const TemplateArgument *Args, unsigned NumArgs, QualType Canon=QualType()) const
DependentTemplateName * getAsDependentTemplateName() const
Retrieve the underlying dependent template name structure, if any.
SourceLocation getOperatorLoc() const LLVM_READONLY
Decl * VisitTypedefNameDecl(TypedefNameDecl *D, bool IsAlias)
Optional< unsigned > getNumTemplateExpansions() const
Retrieve the number of expansions that a template template argument expansion will produce...
const FileEntry * getFile(StringRef Filename, bool OpenFile=false, bool CacheFailure=true)
Lookup, cache, and verify the specified file (real or virtual).
void completeDefinition(QualType NewType, QualType PromotionType, unsigned NumPositiveBits, unsigned NumNegativeBits)
QualType getInjectedSpecializationType() const
Decl * VisitCXXDestructorDecl(CXXDestructorDecl *D)
bool isThisDeclarationADefinition() const
Determine whether this particular declaration is also the definition.
SourceLocation getLocStart() const LLVM_READONLY
QualType VisitObjCObjectType(const ObjCObjectType *T)
ExtInfo getExtInfo() const
SourceLocation getTryLoc() const
QualType getObjCObjectType(QualType Base, ObjCProtocolDecl *const *Protocols, unsigned NumProtocols) const
Legacy interface: cannot provide type arguments or __kindof.
llvm::APInt getValue() const
A little helper class used to produce diagnostics.
QualType getParamType(unsigned i) const
Decl * VisitRecordDecl(RecordDecl *D)
ExceptionSpecificationType getExceptionSpecType() const
Get the kind of exception specification on this function.
SourceLocation getLocStart() const LLVM_READONLY
unsigned getPosition() const
Get the position of the template parameter within its parameter list.
Decl * VisitCXXConversionDecl(CXXConversionDecl *D)
static ImplicitCastExpr * Create(const ASTContext &Context, QualType T, CastKind Kind, Expr *Operand, const CXXCastPath *BasePath, ExprValueKind Cat)
DeclarationNameTable DeclarationNames
A dependent template name that has not been resolved to a template (or set of templates).
unsigned getChainingSize() const
decl_range noload_decls() const
protocol_loc_iterator protocol_loc_begin() const
NamedDecl * getDecl() const
Stmt * VisitObjCForCollectionStmt(ObjCForCollectionStmt *S)
void setTypeParamList(ObjCTypeParamList *TPL)
ImportDefinitionKind
What we should import from the definition.
SourceLocation getSuperClassLoc() const
ID
Defines the set of possible language-specific address spaces.
StorageClass getStorageClass() const
Returns the storage class as written in the source. For the computed linkage of symbol, see getLinkage.
QualType getPointeeType() const
void setInClassInitializer(Expr *Init)
SourceLocation getColonLoc() const
QualType getObjCInterfaceType(const ObjCInterfaceDecl *Decl, ObjCInterfaceDecl *PrevDecl=nullptr) const
NameKind getNameKind() const
getNameKind - Determine what kind of name this is.
bool requiresZeroInitialization() const
Whether this construction first requires zero-initialization before the initializer is called...
static NestedNameSpecifier * SuperSpecifier(const ASTContext &Context, CXXRecordDecl *RD)
Returns the nested name specifier representing the __super scope for the given CXXRecordDecl.
static CXXDestructorDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, bool isInline, bool isImplicitlyDeclared)
SpecifierKind getKind() const
Determine what kind of nested name specifier is stored.
Expr * VisitParenExpr(ParenExpr *E)
LabelDecl * getDecl() const
SourceLocation getVarianceLoc() const
Retrieve the location of the variance keyword.
void setGetterMethodDecl(ObjCMethodDecl *gDecl)
VarTemplateDecl * getDescribedVarTemplate() const
Retrieves the variable template that is described by this variable declaration.
QualType getPointeeType() const
Stmt * VisitGotoStmt(GotoStmt *S)
StringRef getName() const
Return the actual identifier string.
Decl * VisitEnumConstantDecl(EnumConstantDecl *D)
SourceLocation getRParenLoc() const
static ObjCMethodDecl * Create(ASTContext &C, SourceLocation beginLoc, SourceLocation endLoc, Selector SelInfo, QualType T, TypeSourceInfo *ReturnTInfo, DeclContext *contextDecl, bool isInstance=true, bool isVariadic=false, bool isPropertyAccessor=false, bool isImplicitlyDeclared=false, bool isDefined=false, ImplementationControl impControl=None, bool HasRelatedResultType=false)
Stmt * VisitCXXForRangeStmt(CXXForRangeStmt *S)
unsigned getNumArgs() const
bool isEmpty() const
Evaluates true when this declaration name is empty.
Declaration of a template type parameter.
void setSetterMethodDecl(ObjCMethodDecl *gDecl)
bool isListInitialization() const
Whether this constructor call was written as list-initialization.
VarDecl * getConditionVariable() const
Retrieve the variable declared in this "while" statement, if any.
FileID createFileID(const FileEntry *SourceFile, SourceLocation IncludePos, SrcMgr::CharacteristicKind FileCharacter, int LoadedID=0, unsigned LoadedOffset=0)
Create a new FileID that represents the specified file being #included from the specified IncludePosi...
bool wasDeclaredWithTypename() const
Whether this template type parameter was declared with the 'typename' keyword.
ObjCIvarDecl * getPropertyIvarDecl() const
Expr * VisitDeclRefExpr(DeclRefExpr *E)
protocol_iterator protocol_begin() const
static ClassTemplateDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl, ClassTemplateDecl *PrevDecl)
Create a class template node.
TemplateName getOverloadedTemplateName(UnresolvedSetIterator Begin, UnresolvedSetIterator End) const
Retrieve the template name that corresponds to a non-empty lookup.
Expr * getBitWidth() const
static bool IsStructurallyEquivalent(StructuralEquivalenceContext &Context, QualType T1, QualType T2)
Determine structural equivalence of two types.
SourceLocation getRParenLoc() const
bool IsStructuralMatch(RecordDecl *FromRecord, RecordDecl *ToRecord, bool Complain=true)
Represents a C++ destructor within a class.
TranslationUnitDecl * getTranslationUnitDecl() const
SourceLocation getGotoLoc() const
Expr * getUnderlyingExpr() const
void setRBraceLoc(SourceLocation L)
Stmt * VisitIfStmt(IfStmt *S)
QualType getNamedType() const
Retrieve the type named by the qualified-id.
ArgKind getKind() const
Return the kind of stored template argument.
SourceLocation getLocation() const
ExtProtoInfo getExtProtoInfo() const
Decl * VisitLinkageSpecDecl(LinkageSpecDecl *D)
static ObjCTypeParamDecl * Create(ASTContext &ctx, DeclContext *dc, ObjCTypeParamVariance variance, SourceLocation varianceLoc, unsigned index, SourceLocation nameLoc, IdentifierInfo *name, SourceLocation colonLoc, TypeSourceInfo *boundInfo)
DeclContext * getDeclContext()
A structure for storing the information associated with a substituted template template parameter...
QualType VisitFunctionNoProtoType(const FunctionNoProtoType *T)
ConstructionKind getConstructionKind() const
Determine whether this constructor is actually constructing a base class (rather than a complete obje...
ParmVarDecl *const * param_iterator
Represents Objective-C's @synchronized statement.
const char * getDeclKindName() const
void setGetterName(Selector Sel)
protocol_iterator protocol_begin() const
Represents a C++ template name within the type system.
QualType VisitConstantArrayType(const ConstantArrayType *T)
A namespace alias, stored as a NamespaceAliasDecl*.
void setImplementation(ObjCImplementationDecl *ImplD)
bool isParameterPack() const
Whether this template template parameter is a template parameter pack.
SourceLocation getEndLoc() const
Stmt * VisitObjCAtTryStmt(ObjCAtTryStmt *S)
const SwitchCase * getSwitchCaseList() const
bool isScoped() const
Returns true if this is a C++11 scoped enumeration.
Expr * getSubExpr() const
SourceLocation getLabelLoc() const
bool hasRelatedResultType() const
Determine whether this method has a result type that is related to the message receiver's type...
bool isInstanceMethod() const
bool isFunctionOrMethod() const
void ImportDeclarationNameLoc(const DeclarationNameInfo &From, DeclarationNameInfo &To)
QualType getCXXNameType() const
Decl * GetAlreadyImportedOrNull(Decl *FromD)
Return the copy of the given declaration in the "to" context if it has already been imported from the...
TemplateName getAsTemplateOrTemplatePattern() const
Retrieve the template argument as a template name; if the argument is a pack expansion, return the pattern as a template name.
const TemplateArgument * data() const
Retrieve a pointer to the template argument list.
DeclarationName getDeclName() const
Stmt * VisitReturnStmt(ReturnStmt *S)
ClassTemplateDecl * getSpecializedTemplate() const
Retrieve the template that this specialization specializes.
static AttributedStmt * Create(const ASTContext &C, SourceLocation Loc, ArrayRef< const Attr * > Attrs, Stmt *SubStmt)
const Type * getAsType() const
Retrieve the type stored in this nested name specifier.
QualType getElementType() const
QualType getComputationLHSType() const
Represents a C++ conversion function within a class.
The result type of a method or function.
RecordDecl * getDefinition() const
A type, stored as a Type*.
NestedNameSpecifierLoc getQualifierLoc() const
If the name was qualified, retrieves the nested-name-specifier that precedes the name, with source-location information.
SourceLocation getSemiLoc() const
TypeSourceInfo * getTypeSourceInfo() const
QualType getReplacementType() const
TypedefNameDecl * getTypedefNameForAnonDecl() const
const Expr * getAnyInitializer() const
SourceLocation getAtLoc() const
TypeSourceInfo * getReturnTypeSourceInfo() const
bool isConstexpr() const
Whether this is a (C++11) constexpr function or constexpr constructor.
Decl * VisitObjCMethodDecl(ObjCMethodDecl *D)
TemplateName getQualifiedTemplateName(NestedNameSpecifier *NNS, bool TemplateKeyword, TemplateDecl *Template) const
Retrieve the template name that represents a qualified template name such as std::vector.
bool isVirtualAsWritten() const
Whether this function is marked as virtual explicitly.
static CXXRecordDecl * Create(const ASTContext &C, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, CXXRecordDecl *PrevDecl=nullptr, bool DelayTypeCreation=false)
ObjCCategoryDecl * getCategoryDecl() const
param_const_iterator param_end() const
QualType getComputationResultType() const
QualType VisitEnumType(const EnumType *T)
LabelDecl * getLabel() const
const TemplateTypeParmType * getReplacedParameter() const
Gets the template parameter that was substituted for.
Stmt * getBody(const FunctionDecl *&Definition) const
SourceLocation getOperatorLoc() const
NamespaceDecl * getAsNamespace() const
Retrieve the namespace stored in this nested name specifier.
const IdentifierInfo * getIdentifier() const
A template template parameter pack that has been substituted for a template template argument pack...
ClassTemplateDecl * getDescribedClassTemplate() const
Retrieves the class template that is described by this class declaration.
ASTContext & getFromContext() const
Retrieve the context that AST nodes are being imported from.
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
ObjCPropertyImplDecl * FindPropertyImplDecl(IdentifierInfo *propertyId) const
SourceLocation getGotoLoc() const
SourceLocation getExternLoc() const
SelectorTable & Selectors
Decl * VisitIndirectFieldDecl(IndirectFieldDecl *D)
ExceptionSpecificationType Type
The kind of exception specification this is.
Decl * VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D)
Encodes a location in the source. The SourceManager can decode this to get at the full include stack...
bool isAnonymousStructOrUnion() const
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
ExternalASTSource * getExternalSource() const
Retrieve a pointer to the external AST source associated with this AST context, if any...
const Type * getTypePtr() const
TemplateName getAsTemplate() const
Retrieve the template name for a template name argument.
QualType VisitFunctionProtoType(const FunctionProtoType *T)
QualType getElementType() const
unsigned getBitWidthValue(const ASTContext &Ctx) const
TypeOfType (GCC extension).
const TemplateArgumentListInfo & getTemplateArgsInfo() const
QualType VisitBuiltinType(const BuiltinType *T)
SourceLocation getLocStart() const LLVM_READONLY
A structure for storing an already-substituted template template parameter pack.
static CXXConstructorDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, bool isExplicit, bool isInline, bool isImplicitlyDeclared, bool isConstexpr)
OverloadedOperatorKind getCXXOverloadedOperator() const
TagDecl - Represents the declaration of a struct/union/class/enum.
TemplateName getDependentTemplateName(NestedNameSpecifier *NNS, const IdentifierInfo *Name) const
Retrieve the template name that represents a dependent template name such as MetaFun::template apply...
static Optional< unsigned > findAnonymousStructOrUnionIndex(RecordDecl *Anon)
Find the index of the given anonymous struct/union within its context.
ASTContext & getASTContext() const LLVM_READONLY
TypeSourceInfo * getTrivialTypeSourceInfo(QualType T, SourceLocation Loc=SourceLocation()) const
Allocate a TypeSourceInfo where all locations have been initialized to a given location, which defaults to the empty location.
bool refersToEnclosingVariableOrCapture() const
Does this DeclRefExpr refer to an enclosing local or a captured variable?
static QualType getUnderlyingType(const SubRegion *R)
Decl * VisitTranslationUnitDecl(TranslationUnitDecl *D)
void setPropertyAttributesAsWritten(PropertyAttributeKind PRVal)
const Expr * getCond() const
VectorKind getVectorKind() const
Cached information about one file (either on disk or in the virtual file system). ...
SourceLocation getIdentLoc() const
Decl * VisitNonTypeTemplateParmDecl(NonTypeTemplateParmDecl *D)
Expr * VisitMemberExpr(MemberExpr *E)
bool getSynthesize() const
Represents a static or instance method of a struct/union/class.
unsigned getDepth() const
Retrieve the depth of the template parameter.
bool shouldForceImportDeclContext(ImportDefinitionKind IDK)
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
void setProtocolList(ObjCProtocolDecl *const *List, unsigned Num, const SourceLocation *Locs, ASTContext &C)
QualType getIncompleteArrayType(QualType EltTy, ArrayType::ArraySizeModifier ASM, unsigned IndexTypeQuals) const
Return a unique reference to the type for an incomplete array of the specified element type...
Decl * VisitFunctionDecl(FunctionDecl *D)
const ObjCInterfaceDecl * getClassInterface() const
bool isPropertyAccessor() const
void addDecl(NamedDecl *D)
QualType VisitTypedefType(const TypedefType *T)
SourceLocation getContinueLoc() const
const FileInfo & getFile() const
Represents one property declaration in an Objective-C interface.
VarDecl * getConditionVariable() const
Retrieve the variable declared in this "switch" statement, if any.
TypedefNameDecl * getDecl() const
void setProtocolList(ObjCProtocolDecl *const *List, unsigned Num, const SourceLocation *Locs, ASTContext &C)
ASTNodeImporter(ASTImporter &Importer)
Stmt * VisitForStmt(ForStmt *S)
unsigned getNumProtocols() const
A simple visitor class that helps create declaration visitors.
NamespaceAliasDecl * getAsNamespaceAlias() const
Retrieve the namespace alias stored in this nested name specifier.
SourceLocation getBegin() const
QualType getReturnType() const
QualType getAttributedType(AttributedType::Kind attrKind, QualType modifiedType, QualType equivalentType)
QualType VisitRecordType(const RecordType *T)
Decl * VisitVarTemplateDecl(VarTemplateDecl *D)
Stmt * VisitCompoundStmt(CompoundStmt *S)
Stmt * VisitIndirectGotoStmt(IndirectGotoStmt *S)
Decl * VisitImplicitParamDecl(ImplicitParamDecl *D)
SourceLocation getAtSynchronizedLoc() const
bool isInlineSpecified() const
Determine whether the "inline" keyword was specified for this function.
Stmt * VisitWhileStmt(WhileStmt *S)
Attr * clone(ASTContext &C) const
Expr * VisitCallExpr(CallExpr *E)
SourceLocation getCategoryNameLoc() const
QualifiedTemplateName * getAsQualifiedTemplateName() const
Retrieve the underlying qualified template name structure, if any.
QualType VisitObjCObjectPointerType(const ObjCObjectPointerType *T)
void setHasInheritedDefaultArg(bool I=true)
SourceLocation getForLoc() const
QualType getType() const
Return the type wrapped by this type source info.
SourceLocation getLParenLoc() const
ValueDecl * getAsDecl() const
Retrieve the declaration for a declaration non-type template argument.
static MemberExpr * Create(const ASTContext &C, Expr *base, bool isarrow, SourceLocation OperatorLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, ValueDecl *memberdecl, DeclAccessPair founddecl, DeclarationNameInfo MemberNameInfo, const TemplateArgumentListInfo *targs, QualType ty, ExprValueKind VK, ExprObjectKind OK)
The injected class name of a C++ class template or class template partial specialization. Used to record that a type was spelled with a bare identifier rather than as a template-id; the equivalent for non-templated classes is just RecordType.
QualType getPointeeType() const
SourceLocation getOperatorLoc() const
getOperatorLoc - Return the location of the operator.
void setVirtualAsWritten(bool V)
QualType getFunctionType(QualType ResultTy, ArrayRef< QualType > Args, const FunctionProtoType::ExtProtoInfo &EPI) const
Return a normal function type with a typed argument list.
static TypeAliasDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, TypeSourceInfo *TInfo)
ArrayRef< QualType > getTypeArgsAsWritten() const
const char * getTypeClassName() const
Expr * getSizeExpr() const
Base class for declarations which introduce a typedef-name.
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
bool isAnonymousStructOrUnion() const
Represents a template argument.
SourceLocation getLocation() const
QualType getMemberPointerType(QualType T, const Type *Cls) const
Return the uniqued reference to the type for a member pointer to the specified type in the specified ...
bool ImportDeclParts(NamedDecl *D, DeclContext *&DC, DeclContext *&LexicalDC, DeclarationName &Name, NamedDecl *&ToD, SourceLocation &Loc)
QualType getAsType() const
Retrieve the type for a type template argument.
static DeclGroupRef Create(ASTContext &C, Decl **Decls, unsigned NumDecls)
VarDecl * getConditionVariable() const
Retrieve the variable declared in this "if" statement, if any.
NonEquivalentDeclSet & getNonEquivalentDecls()
Return the set of declarations that we know are not equivalent.
Represents a template name that was expressed as a qualified name.
Selector getObjCSelector() const
TemplateName getSubstTemplateTemplateParmPack(TemplateTemplateParmDecl *Param, const TemplateArgument &ArgPack) const
ObjCCategoryDecl * FindCategoryDeclaration(IdentifierInfo *CategoryId) const
static ParmVarDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S, Expr *DefArg)
static LinkageSpecDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation ExternLoc, SourceLocation LangLoc, LanguageIDs Lang, bool HasBraces)
virtual void CompleteDecl(Decl *D)
Called for ObjCInterfaceDecl, ObjCProtocolDecl, and TagDecl. Mark the Decl as complete, filling it in as much as possible.
static const Type * getElementType(const Expr *BaseExpr)
SourceRange getCXXOperatorNameRange() const
SourceLocation getLParenLoc() const
ObjCCategoryImplDecl * getImplementation() const
void ImportDeclContext(DeclContext *FromDC, bool ForceImport=false)
bool hasTemplateKeyword() const
Whether the template name was prefixed by the "template" keyword.
bool hadMultipleCandidates() const
Returns true if this expression refers to a function that was resolved from an overloaded set having ...
static NonTypeTemplateParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, unsigned D, unsigned P, IdentifierInfo *Id, QualType T, bool ParameterPack, TypeSourceInfo *TInfo)
TemplateSpecializationKind getSpecializationKind() const
Determine the kind of specialization that this declaration represents.
SourceLocation getStarLoc() const
The base class of all kinds of template declarations (e.g., class, function, etc.).
TemplateArgument ImportTemplateArgument(const TemplateArgument &From)
QualType VisitIncompleteArrayType(const IncompleteArrayType *T)
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the variable template specialization.
virtual Decl * Imported(Decl *From, Decl *To)
Note that we have imported the "from" declaration by mapping it to the (potentially-newly-created) "t...
ObjCIvarDecl * getPropertyIvarDecl() const
const Stmt * getBody() const
SourceLocation getLocStart() const LLVM_READONLY
QualType getPromotionType() const
QualType VisitAttributedType(const AttributedType *T)
NestedNameSpecifierLoc getQualifierLoc() const
If the member name was qualified, retrieves the nested-name-specifier that precedes the member name...
static bool IsArrayStructurallyEquivalent(StructuralEquivalenceContext &Context, const ArrayType *Array1, const ArrayType *Array2)
Determine structural equivalence for the common part of array types.
QualType getEquivalentType() const
const llvm::APSInt & getInitVal() const
ObjCInterfaceDecl * getDefinition()
Retrieve the definition of this class, or NULL if this class has been forward-declared (with @class) ...
IdentifierInfo * getAsIdentifier() const
Retrieve the identifier stored in this nested name specifier.
bool isParameterPack() const
LanguageIDs getLanguage() const
Return the language specified by this linkage specification.
SourceLocation getPropertyIvarDeclLoc() const
bool hasWrittenPrototype() const
const ContentCache * getContentCache() const
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
const Expr * getSynchExpr() const
Expr * VisitUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr *E)
unsigned getNumHandlers() const
Selector getGetterName() const
QualType getObjCObjectPointerType(QualType OIT) const
Return a ObjCObjectPointerType type for the given ObjCObjectType.
DefinitionKind isThisDeclarationADefinition(ASTContext &) const
Check whether this declaration is a definition. If this could be a tentative definition (in C)...
bool isUsed(bool CheckUsedAttr=true) const
Whether this declaration was used, meaning that a definition is required.
static ObjCImplementationDecl * Create(ASTContext &C, DeclContext *DC, ObjCInterfaceDecl *classInterface, ObjCInterfaceDecl *superDecl, SourceLocation nameLoc, SourceLocation atStartLoc, SourceLocation superLoc=SourceLocation(), SourceLocation IvarLBraceLoc=SourceLocation(), SourceLocation IvarRBraceLoc=SourceLocation())
Decl * VisitClassTemplateDecl(ClassTemplateDecl *D)
A set of unresolved declarations.
SourceLocation getWhileLoc() const
SourceLocation getLocStart() const LLVM_READONLY
bool isNull() const
Determine whether this template argument has no value.
QualType getModifiedType() const
const Expr * getRetValue() const
unsigned getNumArgs() const
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
unsigned getNumArgs() const
A type that was preceded by the 'template' keyword, stored as a Type*.
static EnumDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, EnumDecl *PrevDecl, bool IsScoped, bool IsScopedUsingClassTag, bool IsFixed)
body_iterator body_begin()
Decl * VisitObjCIvarDecl(ObjCIvarDecl *D)
VarTemplateSpecializationDecl * findSpecialization(ArrayRef< TemplateArgument > Args, void *&InsertPos)
Return the specialization with the provided arguments if it exists, otherwise return the insertion po...
const TemplateArgument & getArg(unsigned Idx) const
Decl * VisitVarTemplateSpecializationDecl(VarTemplateSpecializationDecl *D)
unsigned getDepth() const
Get the nesting depth of the template parameter.
QualType getPointeeType() const
const Stmt * getThen() const
QualType VisitLValueReferenceType(const LValueReferenceType *T)
SourceLocation getAtCatchLoc() const
bool hasInheritedDefaultArg() const
static ObjCIvarDecl * Create(ASTContext &C, ObjCContainerDecl *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, AccessControl ac, Expr *BW=nullptr, bool synthesized=false)
SourceLocation getRParenLoc() const
ObjCMethodDecl * getGetterMethodDecl() const
FunctionDecl * SourceTemplate
const TemplateArgument * getArgs() const
Retrieve the template arguments.
unsigned getNumNegativeBits() const
Returns the width in bits required to store all the negative enumerators of this enum. These widths include the rightmost leading 1; that is:
void setIsUsed()
Set whether the declaration is used, in the sense of odr-use.
VarDecl * getTemplatedDecl() const
Get the underlying variable declarations of the template.
void setQualifierInfo(NestedNameSpecifierLoc QualifierLoc)
static VarTemplateSpecializationDecl * Create(ASTContext &Context, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, VarTemplateDecl *SpecializedTemplate, QualType T, TypeSourceInfo *TInfo, StorageClass S, const TemplateArgument *Args, unsigned NumArgs)
Imports selected nodes from one AST context into another context, merging AST nodes where appropriate...
DeclStmt * getBeginEndStmt()
unsigned getTypeQuals() const
const Stmt * getSubStmt() const
static ImplicitParamDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation IdLoc, IdentifierInfo *Id, QualType T)
Represents Objective-C's collection statement.
ObjCMethodDecl * getSetterMethodDecl() const
void setQualifierInfo(NestedNameSpecifierLoc QualifierLoc)
Selector getSelector(unsigned NumArgs, IdentifierInfo **IIV)
Can create any sort of selector.
SourceLocation getAtTryLoc() const
Retrieve the location of the @ in the @try.
static CStyleCastExpr * Create(const ASTContext &Context, QualType T, ExprValueKind VK, CastKind K, Expr *Op, const CXXCastPath *BasePath, TypeSourceInfo *WrittenTy, SourceLocation L, SourceLocation R)
QualType getIntegralType() const
Retrieve the type of the integral value.
ObjCProtocolList::iterator protocol_iterator
QualType getIntegerType() const
void setSwitchLoc(SourceLocation L)
QualType getInnerType() const
virtual void CompleteType(TagDecl *Tag)
Gives the external AST source an opportunity to complete an incomplete type.
void setSetterName(Selector Sel)
DeclContext * getRedeclContext()
CXXConstructorDecl * getConstructor() const
SourceLocation getRBraceLoc() const
ObjCInterfaceDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this Objective-C class.
Represents Objective-C's @finally statement.
static CXXMethodDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, StorageClass SC, bool isInline, bool isConstexpr, SourceLocation EndLocation)
The template argument is a type.
ObjCImplementationDecl * getImplementation() const
NestedNameSpecifier * getQualifier() const
protocol_iterator protocol_end() const
QualType getTagDeclType(const TagDecl *Decl) const
Return the unique reference to the type for the specified TagDecl (struct/union/class/enum) decl...
const TemplateArgument & getArg(unsigned Idx) const
Retrieve a specific template argument as a type.
Represents a base class of a C++ class.
QualType VisitUnaryTransformType(const UnaryTransformType *T)
unsigned getNumCatchStmts() const
Retrieve the number of @catch statements in this try-catch-finally block.
SourceLocation getRParenLoc() const
void setNamedTypeInfo(TypeSourceInfo *TInfo)
Decl * VisitObjCTypeParamDecl(ObjCTypeParamDecl *D)
ArrayRef< QualType > Exceptions
Explicitly-specified list of exception types.
SourceManager & getSourceManager()
SourceLocation getForLoc() const
DeclStmt * getRangeStmt()
Stmt * VisitObjCAtThrowStmt(ObjCAtThrowStmt *S)
ArrayRef< const Attr * > getAttrs() const
void ImportDefinition(Decl *From)
Import the definition of the given declaration, including all of the declarations it contains...
void setHadMultipleCandidates(bool V=true)
Sets the flag telling whether this expression refers to a function that was resolved from an overload...
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the class template specialization.
const Type * getClass() const
ObjCPropertyDecl * getPropertyDecl() const
SourceLocation getAttrLoc() const
AccessControl getAccessControl() const
Decl * VisitTypeAliasDecl(TypeAliasDecl *D)
Expr * NoexceptExpr
Noexcept expression, if this is EST_ComputedNoexcept.
QualType getNullPtrType() const
Retrieve the type for null non-type template argument.
QualType getTypeOfExprType(Expr *e) const
GCC extension.
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
unsigned pack_size() const
The number of template arguments in the given template argument pack.
bool isImplicitInterfaceDecl() const
const Expr * getSubExpr() const
QualType getVariableArrayType(QualType EltTy, Expr *NumElts, ArrayType::ArraySizeModifier ASM, unsigned IndexTypeQuals, SourceRange Brackets) const
Return a non-unique reference to the type for a variable array of the specified element type...
unsigned getNumPositiveBits() const
Returns the width in bits required to store all the non-negative enumerators of this enum...
Represents a C++ struct/union/class.
SourceLocation getRParenLoc() const
void setDescribedVarTemplate(VarTemplateDecl *Template)
SourceLocation getBreakLoc() const
static TypedefDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, TypeSourceInfo *TInfo)
ArraySizeModifier getSizeModifier() const
ElaboratedTypeKeyword getKeyword() const
A structure for storing the information associated with an overloaded template name.
SourceLocation getColonLoc() const
const Expr * getCond() const
SourceLocation getElseLoc() const
static VarTemplateDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, VarDecl *Decl)
Create a variable template node.
Declaration of a class template.
QualType getVectorType(QualType VectorType, unsigned NumElts, VectorType::VectorKind VecKind) const
Return the unique reference to a vector type of the specified element type and size.
Stmt * VisitSwitchStmt(SwitchStmt *S)
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
CompoundStmt * getTryBlock()
void setPropertyAttributes(PropertyAttributeKind PRVal)
Represents Objective-C's @try ... @catch ... @finally statement.
unsigned getIndex() const
Retrieve the index of the template parameter.
const Expr * getThrowExpr() const
QualType getParamTypeForDecl() const
NestedNameSpecifier * getQualifier() const
Return the nested name specifier that qualifies this name.
ASTContext & getToContext() const
Retrieve the context that AST nodes are being imported into.
static IndirectFieldDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, IdentifierInfo *Id, QualType T, NamedDecl **CH, unsigned CHS)
ObjCInterfaceDecl * getSuperClass() const
PropertyAttributeKind getPropertyAttributesAsWritten() const
Stmt * VisitDefaultStmt(DefaultStmt *S)
QualType getPointeeTypeAsWritten() const
SourceLocation getRBracLoc() const
Import only the bare bones needed to establish a valid DeclContext.
SourceLocation getColonLoc() const
static Decl::Kind getKind(const Decl *D)
QualType VisitExtVectorType(const ExtVectorType *T)
bool isStdInitListInitialization() const
Whether this constructor call was written as list-initialization, but was interpreted as forming a st...
void setNextSwitchCase(SwitchCase *SC)
SourceLocation getIvarRBraceLoc() const
const Stmt * getTryBody() const
Retrieve the @try body.
TranslationUnitDecl - The top declaration context.
void ImportDefinitionIfNeeded(Decl *FromD, Decl *ToD=nullptr)
QualType VisitTypeOfExprType(const TypeOfExprType *T)
NamespaceDecl * getAnonymousNamespace() const
Retrieve the anonymous namespace nested inside this namespace, if any.
VarDecl * getExceptionDecl() const
A reference to a declared variable, function, enum, etc. [C99 6.5.1p2].
ExprValueKind getValueKind() const
getValueKind - The value kind that this expression produces.
Represents a type template specialization; the template must be a class template, a type alias templa...
QualType getDecltypeType(Expr *e, QualType UnderlyingType) const
C++11 decltype.
SourceLocation getRAngleLoc() const
QualType getConstantArrayType(QualType EltTy, const llvm::APInt &ArySize, ArrayType::ArraySizeModifier ASM, unsigned IndexTypeQuals) const
Return the unique reference to the type for a constant array of the specified element type...
QualType getElementType() const
SourceLocation getLocForStartOfFile(FileID FID) const
Return the source location corresponding to the first byte of the specified file. ...
SourceLocation getInnerLocStart() const
DeclStmt * getLoopVarStmt()
A set of overloaded template declarations.
SourceLocation getRParenLoc() const
A trivial tuple used to represent a source range.
SourceLocation getLocation() const
void setLexicalDeclContext(DeclContext *DC)
DeclarationNameInfo getNameInfo() const
static ObjCCategoryImplDecl * Create(ASTContext &C, DeclContext *DC, IdentifierInfo *Id, ObjCInterfaceDecl *classInterface, SourceLocation nameLoc, SourceLocation atStartLoc, SourceLocation CategoryNameLoc)
static DeclarationName getUsingDirectiveName()
getUsingDirectiveName - Return name for all using-directives.
void setAccess(AccessSpecifier AS)
EnumDecl * getDefinition() const
Decl * VisitNamespaceDecl(NamespaceDecl *D)
Represents a C++ namespace alias.
Decl * VisitObjCInterfaceDecl(ObjCInterfaceDecl *D)
Stmt * VisitObjCAutoreleasePoolStmt(ObjCAutoreleasePoolStmt *S)
SourceLocation getStartLoc() const
std::pair< FileID, unsigned > getDecomposedLoc(SourceLocation Loc) const
Decompose the specified location into a raw FileID + Offset pair.
SourceRange getSourceRange() const LLVM_READONLY
Retrieves the source range that contains the entire base specifier.
bool isNull() const
isNull - Return true if this QualType doesn't point to a type yet.
TypeSourceInfo * getTypeSourceInfo() const
static FieldDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, Expr *BW, bool Mutable, InClassInitStyle InitStyle)
The global specifier '::'. There is no stored value.
void setType(QualType newType)
Decl * VisitParmVarDecl(ParmVarDecl *D)
SourceLocation getCatchLoc() const
QualType VisitRValueReferenceType(const RValueReferenceType *T)
Represents Objective-C's @autoreleasepool Statement.
QualType VisitAutoType(const AutoType *T)
ArrayRef< QualType > exceptions() const
bool isBeingDefined() const
isBeingDefined - Return true if this decl is currently being defined.
This class handles loading and caching of source files into memory.
ExceptionSpecInfo ExceptionSpec
QualType VisitType(const Type *T)
DeclContext * ImportContext(DeclContext *FromDC)
Import the given declaration context from the "from" AST context into the "to" AST context...
void setPropertyIvarDecl(ObjCIvarDecl *Ivar)
static ObjCAtTryStmt * Create(const ASTContext &Context, SourceLocation atTryLoc, Stmt *atTryStmt, Stmt **CatchStmts, unsigned NumCatchStmts, Stmt *atFinallyStmt)
Stmt * VisitStmt(Stmt *S)
Attr - This represents one attribute.
QualType VisitTypeOfType(const TypeOfType *T)
A single template declaration.
NamedDecl *const * iterator
DeclAccessPair getFoundDecl() const
Retrieves the declaration found by lookup.
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
bool isMutable() const
isMutable - Determines whether this field is mutable (C++ only).
bool hasInClassInitializer() const
TypeSourceInfo * getArgumentTypeInfo() const
unsigned getNumExceptions() const
Structure used to store a statement, the constant value to which it was evaluated (if any)...
const ObjCInterfaceDecl * getSuperClass() const
SourceLocation getTemplateLoc() const
static NestedNameSpecifier * GlobalSpecifier(const ASTContext &Context)
Returns the nested name specifier representing the global scope.
void notePriorDiagnosticFrom(const DiagnosticsEngine &Other)
Note that the prior diagnostic was emitted by some other DiagnosticsEngine, and we may be attaching a...
QualType getDeducedType() const
Get the type deduced for this auto type, or null if it's either not been deduced or was deduced to a ...