Lines Matching +full:- +full:- +full:import
1 //===--- ASTImporter.cpp - Importing ASTs from other Contexts ---*- C++ -*-===//
8 //===----------------------------------------------------------------------===//
13 //===----------------------------------------------------------------------===//
95 /// \brief What we should import from the definition.
97 /// \brief Import the default subset of the definition, which might be
98 /// nothing (if minimal import is set) or might be everything (if minimal
99 /// import is not set).
101 /// \brief Import everything.
103 /// \brief Import only the bare bones needed to establish a valid
263 [&ImporterRef](ItemT From) -> ItemT { in ImportArray()
264 return ImporterRef.Import(From); in ImportArray()
274 [&ImporterRef, &Failed](ItemT *From) -> ItemT * { in ImportArrayChecked()
275 ItemT *To = ImporterRef.Import(From); in ImportArrayChecked()
287 //----------------------------------------------------------------------------
289 //----------------------------------------------------------------------------
380 return Name1->getName() == Name2->getName(); in IsStructurallyEquivalent()
383 /// \brief Determine whether two nested-name-specifiers are equivalent.
454 Array1->getElementType(), in IsArrayStructurallyEquivalent()
455 Array2->getElementType())) in IsArrayStructurallyEquivalent()
457 if (Array1->getSizeModifier() != Array2->getSizeModifier()) in IsArrayStructurallyEquivalent()
459 if (Array1->getIndexTypeQualifiers() != Array2->getIndexTypeQualifiers()) in IsArrayStructurallyEquivalent()
472 // We aren't being strict about token-to-token equivalence of types, in IsStructurallyEquivalent()
481 Type::TypeClass TC = T1->getTypeClass(); in IsStructurallyEquivalent()
483 if (T1->getTypeClass() != T2->getTypeClass()) { in IsStructurallyEquivalent()
486 if (T1->getTypeClass() == Type::FunctionProto && in IsStructurallyEquivalent()
487 T2->getTypeClass() == Type::FunctionNoProto) in IsStructurallyEquivalent()
489 else if (T1->getTypeClass() == Type::FunctionNoProto && in IsStructurallyEquivalent()
490 T2->getTypeClass() == Type::FunctionProto) in IsStructurallyEquivalent()
499 if (cast<BuiltinType>(T1)->getKind() != cast<BuiltinType>(T2)->getKind()) in IsStructurallyEquivalent()
505 cast<ComplexType>(T1)->getElementType(), in IsStructurallyEquivalent()
506 cast<ComplexType>(T2)->getElementType())) in IsStructurallyEquivalent()
513 cast<AdjustedType>(T1)->getOriginalType(), in IsStructurallyEquivalent()
514 cast<AdjustedType>(T2)->getOriginalType())) in IsStructurallyEquivalent()
520 cast<PointerType>(T1)->getPointeeType(), in IsStructurallyEquivalent()
521 cast<PointerType>(T2)->getPointeeType())) in IsStructurallyEquivalent()
527 cast<BlockPointerType>(T1)->getPointeeType(), in IsStructurallyEquivalent()
528 cast<BlockPointerType>(T2)->getPointeeType())) in IsStructurallyEquivalent()
536 if (Ref1->isSpelledAsLValue() != Ref2->isSpelledAsLValue()) in IsStructurallyEquivalent()
538 if (Ref1->isInnerRef() != Ref2->isInnerRef()) in IsStructurallyEquivalent()
541 Ref1->getPointeeTypeAsWritten(), in IsStructurallyEquivalent()
542 Ref2->getPointeeTypeAsWritten())) in IsStructurallyEquivalent()
551 MemPtr1->getPointeeType(), in IsStructurallyEquivalent()
552 MemPtr2->getPointeeType())) in IsStructurallyEquivalent()
555 QualType(MemPtr1->getClass(), 0), in IsStructurallyEquivalent()
556 QualType(MemPtr2->getClass(), 0))) in IsStructurallyEquivalent()
564 if (!llvm::APInt::isSameValue(Array1->getSize(), Array2->getSize())) in IsStructurallyEquivalent()
583 Array1->getSizeExpr(), Array2->getSizeExpr())) in IsStructurallyEquivalent()
596 Array1->getSizeExpr(), Array2->getSizeExpr())) in IsStructurallyEquivalent()
611 Vec1->getSizeExpr(), Vec2->getSizeExpr())) in IsStructurallyEquivalent()
614 Vec1->getElementType(), in IsStructurallyEquivalent()
615 Vec2->getElementType())) in IsStructurallyEquivalent()
625 Vec1->getElementType(), in IsStructurallyEquivalent()
626 Vec2->getElementType())) in IsStructurallyEquivalent()
628 if (Vec1->getNumElements() != Vec2->getNumElements()) in IsStructurallyEquivalent()
630 if (Vec1->getVectorKind() != Vec2->getVectorKind()) in IsStructurallyEquivalent()
638 if (Proto1->getNumParams() != Proto2->getNumParams()) in IsStructurallyEquivalent()
640 for (unsigned I = 0, N = Proto1->getNumParams(); I != N; ++I) { in IsStructurallyEquivalent()
641 if (!IsStructurallyEquivalent(Context, Proto1->getParamType(I), in IsStructurallyEquivalent()
642 Proto2->getParamType(I))) in IsStructurallyEquivalent()
645 if (Proto1->isVariadic() != Proto2->isVariadic()) in IsStructurallyEquivalent()
647 if (Proto1->getExceptionSpecType() != Proto2->getExceptionSpecType()) in IsStructurallyEquivalent()
649 if (Proto1->getExceptionSpecType() == EST_Dynamic) { in IsStructurallyEquivalent()
650 if (Proto1->getNumExceptions() != Proto2->getNumExceptions()) in IsStructurallyEquivalent()
652 for (unsigned I = 0, N = Proto1->getNumExceptions(); I != N; ++I) { in IsStructurallyEquivalent()
654 Proto1->getExceptionType(I), in IsStructurallyEquivalent()
655 Proto2->getExceptionType(I))) in IsStructurallyEquivalent()
658 } else if (Proto1->getExceptionSpecType() == EST_ComputedNoexcept) { in IsStructurallyEquivalent()
660 Proto1->getNoexceptExpr(), in IsStructurallyEquivalent()
661 Proto2->getNoexceptExpr())) in IsStructurallyEquivalent()
664 if (Proto1->getTypeQuals() != Proto2->getTypeQuals()) in IsStructurallyEquivalent()
673 if (!IsStructurallyEquivalent(Context, Function1->getReturnType(), in IsStructurallyEquivalent()
674 Function2->getReturnType())) in IsStructurallyEquivalent()
676 if (Function1->getExtInfo() != Function2->getExtInfo()) in IsStructurallyEquivalent()
683 cast<UnresolvedUsingType>(T1)->getDecl(), in IsStructurallyEquivalent()
684 cast<UnresolvedUsingType>(T2)->getDecl())) in IsStructurallyEquivalent()
691 cast<AttributedType>(T1)->getModifiedType(), in IsStructurallyEquivalent()
692 cast<AttributedType>(T2)->getModifiedType())) in IsStructurallyEquivalent()
695 cast<AttributedType>(T1)->getEquivalentType(), in IsStructurallyEquivalent()
696 cast<AttributedType>(T2)->getEquivalentType())) in IsStructurallyEquivalent()
702 cast<ParenType>(T1)->getInnerType(), in IsStructurallyEquivalent()
703 cast<ParenType>(T2)->getInnerType())) in IsStructurallyEquivalent()
709 cast<TypedefType>(T1)->getDecl(), in IsStructurallyEquivalent()
710 cast<TypedefType>(T2)->getDecl())) in IsStructurallyEquivalent()
716 cast<TypeOfExprType>(T1)->getUnderlyingExpr(), in IsStructurallyEquivalent()
717 cast<TypeOfExprType>(T2)->getUnderlyingExpr())) in IsStructurallyEquivalent()
723 cast<TypeOfType>(T1)->getUnderlyingType(), in IsStructurallyEquivalent()
724 cast<TypeOfType>(T2)->getUnderlyingType())) in IsStructurallyEquivalent()
730 cast<UnaryTransformType>(T1)->getUnderlyingType(), in IsStructurallyEquivalent()
731 cast<UnaryTransformType>(T1)->getUnderlyingType())) in IsStructurallyEquivalent()
737 cast<DecltypeType>(T1)->getUnderlyingExpr(), in IsStructurallyEquivalent()
738 cast<DecltypeType>(T2)->getUnderlyingExpr())) in IsStructurallyEquivalent()
744 cast<AutoType>(T1)->getDeducedType(), in IsStructurallyEquivalent()
745 cast<AutoType>(T2)->getDeducedType())) in IsStructurallyEquivalent()
752 cast<TagType>(T1)->getDecl(), in IsStructurallyEquivalent()
753 cast<TagType>(T2)->getDecl())) in IsStructurallyEquivalent()
760 if (Parm1->getDepth() != Parm2->getDepth()) in IsStructurallyEquivalent()
762 if (Parm1->getIndex() != Parm2->getIndex()) in IsStructurallyEquivalent()
764 if (Parm1->isParameterPack() != Parm2->isParameterPack()) in IsStructurallyEquivalent()
777 QualType(Subst1->getReplacedParameter(), 0), in IsStructurallyEquivalent()
778 QualType(Subst2->getReplacedParameter(), 0))) in IsStructurallyEquivalent()
781 Subst1->getReplacementType(), in IsStructurallyEquivalent()
782 Subst2->getReplacementType())) in IsStructurallyEquivalent()
793 QualType(Subst1->getReplacedParameter(), 0), in IsStructurallyEquivalent()
794 QualType(Subst2->getReplacedParameter(), 0))) in IsStructurallyEquivalent()
797 Subst1->getArgumentPack(), in IsStructurallyEquivalent()
798 Subst2->getArgumentPack())) in IsStructurallyEquivalent()
808 Spec1->getTemplateName(), in IsStructurallyEquivalent()
809 Spec2->getTemplateName())) in IsStructurallyEquivalent()
811 if (Spec1->getNumArgs() != Spec2->getNumArgs()) in IsStructurallyEquivalent()
813 for (unsigned I = 0, N = Spec1->getNumArgs(); I != N; ++I) { in IsStructurallyEquivalent()
815 Spec1->getArg(I), Spec2->getArg(I))) in IsStructurallyEquivalent()
825 if (Elab1->getKeyword() != Elab2->getKeyword()) in IsStructurallyEquivalent()
828 Elab1->getQualifier(), in IsStructurallyEquivalent()
829 Elab2->getQualifier())) in IsStructurallyEquivalent()
832 Elab1->getNamedType(), in IsStructurallyEquivalent()
833 Elab2->getNamedType())) in IsStructurallyEquivalent()
842 Inj1->getInjectedSpecializationType(), in IsStructurallyEquivalent()
843 Inj2->getInjectedSpecializationType())) in IsStructurallyEquivalent()
852 Typename1->getQualifier(), in IsStructurallyEquivalent()
853 Typename2->getQualifier())) in IsStructurallyEquivalent()
855 if (!IsStructurallyEquivalent(Typename1->getIdentifier(), in IsStructurallyEquivalent()
856 Typename2->getIdentifier())) in IsStructurallyEquivalent()
868 Spec1->getQualifier(), in IsStructurallyEquivalent()
869 Spec2->getQualifier())) in IsStructurallyEquivalent()
871 if (!IsStructurallyEquivalent(Spec1->getIdentifier(), in IsStructurallyEquivalent()
872 Spec2->getIdentifier())) in IsStructurallyEquivalent()
874 if (Spec1->getNumArgs() != Spec2->getNumArgs()) in IsStructurallyEquivalent()
876 for (unsigned I = 0, N = Spec1->getNumArgs(); I != N; ++I) { in IsStructurallyEquivalent()
878 Spec1->getArg(I), Spec2->getArg(I))) in IsStructurallyEquivalent()
886 cast<PackExpansionType>(T1)->getPattern(), in IsStructurallyEquivalent()
887 cast<PackExpansionType>(T2)->getPattern())) in IsStructurallyEquivalent()
895 Iface1->getDecl(), Iface2->getDecl())) in IsStructurallyEquivalent()
904 Obj1->getBaseType(), in IsStructurallyEquivalent()
905 Obj2->getBaseType())) in IsStructurallyEquivalent()
907 if (Obj1->getNumProtocols() != Obj2->getNumProtocols()) in IsStructurallyEquivalent()
909 for (unsigned I = 0, N = Obj1->getNumProtocols(); I != N; ++I) { in IsStructurallyEquivalent()
911 Obj1->getProtocol(I), in IsStructurallyEquivalent()
912 Obj2->getProtocol(I))) in IsStructurallyEquivalent()
922 Ptr1->getPointeeType(), in IsStructurallyEquivalent()
923 Ptr2->getPointeeType())) in IsStructurallyEquivalent()
930 cast<AtomicType>(T1)->getValueType(), in IsStructurallyEquivalent()
931 cast<AtomicType>(T2)->getValueType())) in IsStructurallyEquivalent()
938 cast<PipeType>(T1)->getElementType(), in IsStructurallyEquivalent()
939 cast<PipeType>(T2)->getElementType())) in IsStructurallyEquivalent()
952 RecordDecl *Owner2 = cast<RecordDecl>(Field2->getDeclContext()); in IsStructurallyEquivalent()
957 if (Field1->isAnonymousStructOrUnion() && in IsStructurallyEquivalent()
958 Field2->isAnonymousStructOrUnion()) { in IsStructurallyEquivalent()
959 RecordDecl *D1 = Field1->getType()->castAs<RecordType>()->getDecl(); in IsStructurallyEquivalent()
960 RecordDecl *D2 = Field2->getType()->castAs<RecordType>()->getDecl(); in IsStructurallyEquivalent()
965 IdentifierInfo *Name1 = Field1->getIdentifier(); in IsStructurallyEquivalent()
966 IdentifierInfo *Name2 = Field2->getIdentifier(); in IsStructurallyEquivalent()
971 Field1->getType(), Field2->getType())) { in IsStructurallyEquivalent()
973 Context.Diag2(Owner2->getLocation(), diag::warn_odr_tag_type_inconsistent) in IsStructurallyEquivalent()
975 Context.Diag2(Field2->getLocation(), diag::note_odr_field) in IsStructurallyEquivalent()
976 << Field2->getDeclName() << Field2->getType(); in IsStructurallyEquivalent()
977 Context.Diag1(Field1->getLocation(), diag::note_odr_field) in IsStructurallyEquivalent()
978 << Field1->getDeclName() << Field1->getType(); in IsStructurallyEquivalent()
983 if (Field1->isBitField() != Field2->isBitField()) { in IsStructurallyEquivalent()
985 Context.Diag2(Owner2->getLocation(), diag::warn_odr_tag_type_inconsistent) in IsStructurallyEquivalent()
987 if (Field1->isBitField()) { in IsStructurallyEquivalent()
988 Context.Diag1(Field1->getLocation(), diag::note_odr_bit_field) in IsStructurallyEquivalent()
989 << Field1->getDeclName() << Field1->getType() in IsStructurallyEquivalent()
990 << Field1->getBitWidthValue(Context.C1); in IsStructurallyEquivalent()
991 Context.Diag2(Field2->getLocation(), diag::note_odr_not_bit_field) in IsStructurallyEquivalent()
992 << Field2->getDeclName(); in IsStructurallyEquivalent()
994 Context.Diag2(Field2->getLocation(), diag::note_odr_bit_field) in IsStructurallyEquivalent()
995 << Field2->getDeclName() << Field2->getType() in IsStructurallyEquivalent()
996 << Field2->getBitWidthValue(Context.C2); in IsStructurallyEquivalent()
997 Context.Diag1(Field1->getLocation(), diag::note_odr_not_bit_field) in IsStructurallyEquivalent()
998 << Field1->getDeclName(); in IsStructurallyEquivalent()
1004 if (Field1->isBitField()) { in IsStructurallyEquivalent()
1005 // Make sure that the bit-fields are the same length. in IsStructurallyEquivalent()
1006 unsigned Bits1 = Field1->getBitWidthValue(Context.C1); in IsStructurallyEquivalent()
1007 unsigned Bits2 = Field2->getBitWidthValue(Context.C2); in IsStructurallyEquivalent()
1011 Context.Diag2(Owner2->getLocation(), diag::warn_odr_tag_type_inconsistent) in IsStructurallyEquivalent()
1013 Context.Diag2(Field2->getLocation(), diag::note_odr_bit_field) in IsStructurallyEquivalent()
1014 << Field2->getDeclName() << Field2->getType() << Bits2; in IsStructurallyEquivalent()
1015 Context.Diag1(Field1->getLocation(), diag::note_odr_bit_field) in IsStructurallyEquivalent()
1016 << Field1->getDeclName() << Field1->getType() << Bits1; in IsStructurallyEquivalent()
1033 ASTContext &Context = Anon->getASTContext(); in findUntaggedStructOrUnionIndex()
1036 RecordDecl *Owner = dyn_cast<RecordDecl>(Anon->getDeclContext()); in findUntaggedStructOrUnionIndex()
1041 for (const auto *D : Owner->noload_decls()) { in findUntaggedStructOrUnionIndex()
1046 if (F->isAnonymousStructOrUnion()) { in findUntaggedStructOrUnionIndex()
1047 if (Context.hasSameType(F->getType(), AnonTy)) in findUntaggedStructOrUnionIndex()
1055 QualType FieldType = F->getType(); in findUntaggedStructOrUnionIndex()
1057 const RecordDecl *RecDecl = RecType->getDecl(); in findUntaggedStructOrUnionIndex()
1058 if (RecDecl->getDeclContext() == Owner && in findUntaggedStructOrUnionIndex()
1059 !RecDecl->getIdentifier()) { in findUntaggedStructOrUnionIndex()
1074 if (D1->isUnion() != D2->isUnion()) { in IsStructurallyEquivalent()
1076 Context.Diag2(D2->getLocation(), diag::warn_odr_tag_type_inconsistent) in IsStructurallyEquivalent()
1078 Context.Diag1(D1->getLocation(), diag::note_odr_tag_kind_here) in IsStructurallyEquivalent()
1079 << D1->getDeclName() << (unsigned)D1->getTagKind(); in IsStructurallyEquivalent()
1084 if (D1->isAnonymousStructOrUnion() && D2->isAnonymousStructOrUnion()) { in IsStructurallyEquivalent()
1103 if (!IsStructurallyEquivalent(Context, Spec1->getSpecializedTemplate(), in IsStructurallyEquivalent()
1104 Spec2->getSpecializedTemplate())) in IsStructurallyEquivalent()
1108 if (Spec1->getTemplateArgs().size() != Spec2->getTemplateArgs().size()) in IsStructurallyEquivalent()
1111 for (unsigned I = 0, N = Spec1->getTemplateArgs().size(); I != N; ++I) in IsStructurallyEquivalent()
1113 Spec1->getTemplateArgs().get(I), in IsStructurallyEquivalent()
1114 Spec2->getTemplateArgs().get(I))) in IsStructurallyEquivalent()
1124 D1 = D1->getDefinition(); in IsStructurallyEquivalent()
1125 D2 = D2->getDefinition(); in IsStructurallyEquivalent()
1131 if (D1CXX->getNumBases() != D2CXX->getNumBases()) { in IsStructurallyEquivalent()
1133 Context.Diag2(D2->getLocation(), diag::warn_odr_tag_type_inconsistent) in IsStructurallyEquivalent()
1135 Context.Diag2(D2->getLocation(), diag::note_odr_number_of_bases) in IsStructurallyEquivalent()
1136 << D2CXX->getNumBases(); in IsStructurallyEquivalent()
1137 Context.Diag1(D1->getLocation(), diag::note_odr_number_of_bases) in IsStructurallyEquivalent()
1138 << D1CXX->getNumBases(); in IsStructurallyEquivalent()
1144 for (CXXRecordDecl::base_class_iterator Base1 = D1CXX->bases_begin(), in IsStructurallyEquivalent()
1145 BaseEnd1 = D1CXX->bases_end(), in IsStructurallyEquivalent()
1146 Base2 = D2CXX->bases_begin(); in IsStructurallyEquivalent()
1150 Base1->getType(), Base2->getType())) { in IsStructurallyEquivalent()
1152 Context.Diag2(D2->getLocation(), diag::warn_odr_tag_type_inconsistent) in IsStructurallyEquivalent()
1154 Context.Diag2(Base2->getLocStart(), diag::note_odr_base) in IsStructurallyEquivalent()
1155 << Base2->getType() in IsStructurallyEquivalent()
1156 << Base2->getSourceRange(); in IsStructurallyEquivalent()
1157 Context.Diag1(Base1->getLocStart(), diag::note_odr_base) in IsStructurallyEquivalent()
1158 << Base1->getType() in IsStructurallyEquivalent()
1159 << Base1->getSourceRange(); in IsStructurallyEquivalent()
1164 // Check virtual vs. non-virtual inheritance mismatch. in IsStructurallyEquivalent()
1165 if (Base1->isVirtual() != Base2->isVirtual()) { in IsStructurallyEquivalent()
1167 Context.Diag2(D2->getLocation(), diag::warn_odr_tag_type_inconsistent) in IsStructurallyEquivalent()
1169 Context.Diag2(Base2->getLocStart(), in IsStructurallyEquivalent()
1171 << Base2->isVirtual() << Base2->getSourceRange(); in IsStructurallyEquivalent()
1172 Context.Diag1(Base1->getLocStart(), diag::note_odr_base) in IsStructurallyEquivalent()
1173 << Base1->isVirtual() in IsStructurallyEquivalent()
1174 << Base1->getSourceRange(); in IsStructurallyEquivalent()
1179 } else if (D1CXX->getNumBases() > 0) { in IsStructurallyEquivalent()
1181 Context.Diag2(D2->getLocation(), diag::warn_odr_tag_type_inconsistent) in IsStructurallyEquivalent()
1183 const CXXBaseSpecifier *Base1 = D1CXX->bases_begin(); in IsStructurallyEquivalent()
1184 Context.Diag1(Base1->getLocStart(), diag::note_odr_base) in IsStructurallyEquivalent()
1185 << Base1->getType() in IsStructurallyEquivalent()
1186 << Base1->getSourceRange(); in IsStructurallyEquivalent()
1187 Context.Diag2(D2->getLocation(), diag::note_odr_missing_base); in IsStructurallyEquivalent()
1194 RecordDecl::field_iterator Field2 = D2->field_begin(), in IsStructurallyEquivalent()
1195 Field2End = D2->field_end(); in IsStructurallyEquivalent()
1196 for (RecordDecl::field_iterator Field1 = D1->field_begin(), in IsStructurallyEquivalent()
1197 Field1End = D1->field_end(); in IsStructurallyEquivalent()
1202 Context.Diag2(D2->getLocation(), diag::warn_odr_tag_type_inconsistent) in IsStructurallyEquivalent()
1204 Context.Diag1(Field1->getLocation(), diag::note_odr_field) in IsStructurallyEquivalent()
1205 << Field1->getDeclName() << Field1->getType(); in IsStructurallyEquivalent()
1206 Context.Diag2(D2->getLocation(), diag::note_odr_missing_field); in IsStructurallyEquivalent()
1217 Context.Diag2(D2->getLocation(), diag::warn_odr_tag_type_inconsistent) in IsStructurallyEquivalent()
1219 Context.Diag2(Field2->getLocation(), diag::note_odr_field) in IsStructurallyEquivalent()
1220 << Field2->getDeclName() << Field2->getType(); in IsStructurallyEquivalent()
1221 Context.Diag1(D1->getLocation(), diag::note_odr_missing_field); in IsStructurallyEquivalent()
1232 EnumDecl::enumerator_iterator EC2 = D2->enumerator_begin(), in IsStructurallyEquivalent()
1233 EC2End = D2->enumerator_end(); in IsStructurallyEquivalent()
1234 for (EnumDecl::enumerator_iterator EC1 = D1->enumerator_begin(), in IsStructurallyEquivalent()
1235 EC1End = D1->enumerator_end(); in IsStructurallyEquivalent()
1239 Context.Diag2(D2->getLocation(), diag::warn_odr_tag_type_inconsistent) in IsStructurallyEquivalent()
1241 Context.Diag1(EC1->getLocation(), diag::note_odr_enumerator) in IsStructurallyEquivalent()
1242 << EC1->getDeclName() in IsStructurallyEquivalent()
1243 << EC1->getInitVal().toString(10); in IsStructurallyEquivalent()
1244 Context.Diag2(D2->getLocation(), diag::note_odr_missing_enumerator); in IsStructurallyEquivalent()
1249 llvm::APSInt Val1 = EC1->getInitVal(); in IsStructurallyEquivalent()
1250 llvm::APSInt Val2 = EC2->getInitVal(); in IsStructurallyEquivalent()
1252 !IsStructurallyEquivalent(EC1->getIdentifier(), EC2->getIdentifier())) { in IsStructurallyEquivalent()
1254 Context.Diag2(D2->getLocation(), diag::warn_odr_tag_type_inconsistent) in IsStructurallyEquivalent()
1256 Context.Diag2(EC2->getLocation(), diag::note_odr_enumerator) in IsStructurallyEquivalent()
1257 << EC2->getDeclName() in IsStructurallyEquivalent()
1258 << EC2->getInitVal().toString(10); in IsStructurallyEquivalent()
1259 Context.Diag1(EC1->getLocation(), diag::note_odr_enumerator) in IsStructurallyEquivalent()
1260 << EC1->getDeclName() in IsStructurallyEquivalent()
1261 << EC1->getInitVal().toString(10); in IsStructurallyEquivalent()
1269 Context.Diag2(D2->getLocation(), diag::warn_odr_tag_type_inconsistent) in IsStructurallyEquivalent()
1271 Context.Diag2(EC2->getLocation(), diag::note_odr_enumerator) in IsStructurallyEquivalent()
1272 << EC2->getDeclName() in IsStructurallyEquivalent()
1273 << EC2->getInitVal().toString(10); in IsStructurallyEquivalent()
1274 Context.Diag1(D1->getLocation(), diag::note_odr_missing_enumerator); in IsStructurallyEquivalent()
1285 if (Params1->size() != Params2->size()) { in IsStructurallyEquivalent()
1287 Context.Diag2(Params2->getTemplateLoc(), in IsStructurallyEquivalent()
1289 << Params1->size() << Params2->size(); in IsStructurallyEquivalent()
1290 Context.Diag1(Params1->getTemplateLoc(), in IsStructurallyEquivalent()
1296 for (unsigned I = 0, N = Params1->size(); I != N; ++I) { in IsStructurallyEquivalent()
1297 if (Params1->getParam(I)->getKind() != Params2->getParam(I)->getKind()) { in IsStructurallyEquivalent()
1299 Context.Diag2(Params2->getParam(I)->getLocation(), in IsStructurallyEquivalent()
1301 Context.Diag1(Params1->getParam(I)->getLocation(), in IsStructurallyEquivalent()
1307 if (!Context.IsStructurallyEquivalent(Params1->getParam(I), in IsStructurallyEquivalent()
1308 Params2->getParam(I))) { in IsStructurallyEquivalent()
1320 if (D1->isParameterPack() != D2->isParameterPack()) { in IsStructurallyEquivalent()
1322 Context.Diag2(D2->getLocation(), diag::err_odr_parameter_pack_non_pack) in IsStructurallyEquivalent()
1323 << D2->isParameterPack(); in IsStructurallyEquivalent()
1324 Context.Diag1(D1->getLocation(), diag::note_odr_parameter_pack_non_pack) in IsStructurallyEquivalent()
1325 << D1->isParameterPack(); in IsStructurallyEquivalent()
1336 if (D1->isParameterPack() != D2->isParameterPack()) { in IsStructurallyEquivalent()
1338 Context.Diag2(D2->getLocation(), diag::err_odr_parameter_pack_non_pack) in IsStructurallyEquivalent()
1339 << D2->isParameterPack(); in IsStructurallyEquivalent()
1340 Context.Diag1(D1->getLocation(), diag::note_odr_parameter_pack_non_pack) in IsStructurallyEquivalent()
1341 << D1->isParameterPack(); in IsStructurallyEquivalent()
1347 if (!Context.IsStructurallyEquivalent(D1->getType(), D2->getType())) { in IsStructurallyEquivalent()
1349 Context.Diag2(D2->getLocation(), in IsStructurallyEquivalent()
1351 << D2->getType() << D1->getType(); in IsStructurallyEquivalent()
1352 Context.Diag1(D1->getLocation(), diag::note_odr_value_here) in IsStructurallyEquivalent()
1353 << D1->getType(); in IsStructurallyEquivalent()
1364 if (D1->isParameterPack() != D2->isParameterPack()) { in IsStructurallyEquivalent()
1366 Context.Diag2(D2->getLocation(), diag::err_odr_parameter_pack_non_pack) in IsStructurallyEquivalent()
1367 << D2->isParameterPack(); in IsStructurallyEquivalent()
1368 Context.Diag1(D1->getLocation(), diag::note_odr_parameter_pack_non_pack) in IsStructurallyEquivalent()
1369 << D1->isParameterPack(); in IsStructurallyEquivalent()
1375 return IsStructurallyEquivalent(Context, D1->getTemplateParameters(), in IsStructurallyEquivalent()
1376 D2->getTemplateParameters()); in IsStructurallyEquivalent()
1384 D1->getTemplateParameters(), in IsStructurallyEquivalent()
1385 D2->getTemplateParameters())) in IsStructurallyEquivalent()
1389 return Context.IsStructurallyEquivalent(D1->getTemplatedDecl(), in IsStructurallyEquivalent()
1390 D2->getTemplatedDecl()); in IsStructurallyEquivalent()
1400 if (Context.NonEquivalentDecls.count(std::make_pair(D1->getCanonicalDecl(), in IsStructurallyEquivalent()
1401 D2->getCanonicalDecl()))) in IsStructurallyEquivalent()
1405 Decl *&EquivToD1 = Context.TentativeEquivalences[D1->getCanonicalDecl()]; in IsStructurallyEquivalent()
1407 return EquivToD1 == D2->getCanonicalDecl(); in IsStructurallyEquivalent()
1409 // Produce a tentative equivalence D1 <-> D2, which will be checked later. in IsStructurallyEquivalent()
1410 EquivToD1 = D2->getCanonicalDecl(); in IsStructurallyEquivalent()
1411 Context.DeclsToCheck.push_back(D1->getCanonicalDecl()); in IsStructurallyEquivalent()
1447 IdentifierInfo *Name1 = Record1->getIdentifier(); in Finish()
1448 if (!Name1 && Record1->getTypedefNameForAnonDecl()) in Finish()
1449 Name1 = Record1->getTypedefNameForAnonDecl()->getIdentifier(); in Finish()
1450 IdentifierInfo *Name2 = Record2->getIdentifier(); in Finish()
1451 if (!Name2 && Record2->getTypedefNameForAnonDecl()) in Finish()
1452 Name2 = Record2->getTypedefNameForAnonDecl()->getIdentifier(); in Finish()
1457 // Record/non-record mismatch. in Finish()
1463 IdentifierInfo *Name1 = Enum1->getIdentifier(); in Finish()
1464 if (!Name1 && Enum1->getTypedefNameForAnonDecl()) in Finish()
1465 Name1 = Enum1->getTypedefNameForAnonDecl()->getIdentifier(); in Finish()
1466 IdentifierInfo *Name2 = Enum2->getIdentifier(); in Finish()
1467 if (!Name2 && Enum2->getTypedefNameForAnonDecl()) in Finish()
1468 Name2 = Enum2->getTypedefNameForAnonDecl()->getIdentifier(); in Finish()
1473 // Enum/non-enum mismatch in Finish()
1478 if (!::IsStructurallyEquivalent(Typedef1->getIdentifier(), in Finish()
1479 Typedef2->getIdentifier()) || in Finish()
1481 Typedef1->getUnderlyingType(), in Finish()
1482 Typedef2->getUnderlyingType())) in Finish()
1485 // Typedef/non-typedef mismatch. in Finish()
1491 if (!::IsStructurallyEquivalent(ClassTemplate1->getIdentifier(), in Finish()
1492 ClassTemplate2->getIdentifier()) || in Finish()
1496 // Class template/non-class-template mismatch. in Finish()
1532 NonEquivalentDecls.insert(std::make_pair(D1->getCanonicalDecl(), in Finish()
1533 D2->getCanonicalDecl())); in Finish()
1542 //----------------------------------------------------------------------------
1543 // Import Types
1544 //----------------------------------------------------------------------------
1548 << T->getTypeClassName(); in VisitType()
1553 switch (T->getKind()) { in VisitBuiltinType()
1598 QualType ToElementType = Importer.Import(T->getElementType()); in VisitComplexType()
1606 QualType ToPointeeType = Importer.Import(T->getPointeeType()); in VisitPointerType()
1615 QualType ToPointeeType = Importer.Import(T->getPointeeType()); in VisitBlockPointerType()
1625 QualType ToPointeeType = Importer.Import(T->getPointeeTypeAsWritten()); in VisitLValueReferenceType()
1635 QualType ToPointeeType = Importer.Import(T->getPointeeTypeAsWritten()); in VisitRValueReferenceType()
1644 QualType ToPointeeType = Importer.Import(T->getPointeeType()); in VisitMemberPointerType()
1648 QualType ClassType = Importer.Import(QualType(T->getClass(), 0)); in VisitMemberPointerType()
1654 QualType ToElementType = Importer.Import(T->getElementType()); in VisitConstantArrayType()
1659 T->getSize(), in VisitConstantArrayType()
1660 T->getSizeModifier(), in VisitConstantArrayType()
1661 T->getIndexTypeCVRQualifiers()); in VisitConstantArrayType()
1666 QualType ToElementType = Importer.Import(T->getElementType()); in VisitIncompleteArrayType()
1671 T->getSizeModifier(), in VisitIncompleteArrayType()
1672 T->getIndexTypeCVRQualifiers()); in VisitIncompleteArrayType()
1676 QualType ToElementType = Importer.Import(T->getElementType()); in VisitVariableArrayType()
1680 Expr *Size = Importer.Import(T->getSizeExpr()); in VisitVariableArrayType()
1684 SourceRange Brackets = Importer.Import(T->getBracketsRange()); in VisitVariableArrayType()
1686 T->getSizeModifier(), in VisitVariableArrayType()
1687 T->getIndexTypeCVRQualifiers(), in VisitVariableArrayType()
1692 QualType ToElementType = Importer.Import(T->getElementType()); in VisitVectorType()
1697 T->getNumElements(), in VisitVectorType()
1698 T->getVectorKind()); in VisitVectorType()
1702 QualType ToElementType = Importer.Import(T->getElementType()); in VisitExtVectorType()
1707 T->getNumElements()); in VisitExtVectorType()
1714 QualType ToResultType = Importer.Import(T->getReturnType()); in VisitFunctionNoProtoType()
1719 T->getExtInfo()); in VisitFunctionNoProtoType()
1723 QualType ToResultType = Importer.Import(T->getReturnType()); in VisitFunctionProtoType()
1727 // Import argument types in VisitFunctionProtoType()
1729 for (const auto &A : T->param_types()) { in VisitFunctionProtoType()
1730 QualType ArgType = Importer.Import(A); in VisitFunctionProtoType()
1736 // Import exception types in VisitFunctionProtoType()
1738 for (const auto &E : T->exceptions()) { in VisitFunctionProtoType()
1739 QualType ExceptionType = Importer.Import(E); in VisitFunctionProtoType()
1745 FunctionProtoType::ExtProtoInfo FromEPI = T->getExtProtoInfo(); in VisitFunctionProtoType()
1756 Importer.Import(FromEPI.ExceptionSpec.NoexceptExpr); in VisitFunctionProtoType()
1758 Importer.Import(FromEPI.ExceptionSpec.SourceDecl)); in VisitFunctionProtoType()
1760 Importer.Import(FromEPI.ExceptionSpec.SourceTemplate)); in VisitFunctionProtoType()
1766 QualType ToInnerType = Importer.Import(T->getInnerType()); in VisitParenType()
1775 = dyn_cast_or_null<TypedefNameDecl>(Importer.Import(T->getDecl())); in VisitTypedefType()
1783 Expr *ToExpr = Importer.Import(T->getUnderlyingExpr()); in VisitTypeOfExprType()
1791 QualType ToUnderlyingType = Importer.Import(T->getUnderlyingType()); in VisitTypeOfType()
1800 Expr *ToExpr = Importer.Import(T->getUnderlyingExpr()); in VisitDecltypeType()
1804 QualType UnderlyingType = Importer.Import(T->getUnderlyingType()); in VisitDecltypeType()
1812 QualType ToBaseType = Importer.Import(T->getBaseType()); in VisitUnaryTransformType()
1813 QualType ToUnderlyingType = Importer.Import(T->getUnderlyingType()); in VisitUnaryTransformType()
1819 T->getUTTKind()); in VisitUnaryTransformType()
1824 QualType FromDeduced = T->getDeducedType(); in VisitAutoType()
1827 ToDeduced = Importer.Import(FromDeduced); in VisitAutoType()
1832 return Importer.getToContext().getAutoType(ToDeduced, T->getKeyword(), in VisitAutoType()
1838 CXXRecordDecl *D = cast_or_null<CXXRecordDecl>(Importer.Import(T->getDecl())); in VisitInjectedClassNameType()
1842 QualType InjType = Importer.Import(T->getInjectedSpecializationType()); in VisitInjectedClassNameType()
1860 = dyn_cast_or_null<RecordDecl>(Importer.Import(T->getDecl())); in VisitRecordType()
1869 = dyn_cast_or_null<EnumDecl>(Importer.Import(T->getDecl())); in VisitEnumType()
1877 QualType FromModifiedType = T->getModifiedType(); in VisitAttributedType()
1878 QualType FromEquivalentType = T->getEquivalentType(); in VisitAttributedType()
1883 ToModifiedType = Importer.Import(FromModifiedType); in VisitAttributedType()
1888 ToEquivalentType = Importer.Import(FromEquivalentType); in VisitAttributedType()
1893 return Importer.getToContext().getAttributedType(T->getAttrKind(), in VisitAttributedType()
1901 cast_or_null<TemplateTypeParmDecl>(Importer.Import(T->getDecl())); in VisitTemplateTypeParmType()
1902 if (!ParmDecl && T->getDecl()) in VisitTemplateTypeParmType()
1906 T->getDepth(), T->getIndex(), T->isParameterPack(), ParmDecl); in VisitTemplateTypeParmType()
1911 TemplateName ToTemplate = Importer.Import(T->getTemplateName()); in VisitTemplateSpecializationType()
1916 if (ImportTemplateArguments(T->getArgs(), T->getNumArgs(), ToTemplateArgs)) in VisitTemplateSpecializationType()
1923 ToCanonType =Importer.Import(FromCanonType); in VisitTemplateSpecializationType()
1935 if (T->getQualifier()) { in VisitElaboratedType()
1936 ToQualifier = Importer.Import(T->getQualifier()); in VisitElaboratedType()
1941 QualType ToNamedType = Importer.Import(T->getNamedType()); in VisitElaboratedType()
1945 return Importer.getToContext().getElaboratedType(T->getKeyword(), in VisitElaboratedType()
1951 = dyn_cast_or_null<ObjCInterfaceDecl>(Importer.Import(T->getDecl())); in VisitObjCInterfaceType()
1959 QualType ToBaseType = Importer.Import(T->getBaseType()); in VisitObjCObjectType()
1964 for (auto TypeArg : T->getTypeArgsAsWritten()) { in VisitObjCObjectType()
1965 QualType ImportedTypeArg = Importer.Import(TypeArg); in VisitObjCObjectType()
1973 for (auto *P : T->quals()) { in VisitObjCObjectType()
1975 = dyn_cast_or_null<ObjCProtocolDecl>(Importer.Import(P)); in VisitObjCObjectType()
1983 T->isKindOfTypeAsWritten()); in VisitObjCObjectType()
1988 QualType ToPointeeType = Importer.Import(T->getPointeeType()); in VisitObjCObjectPointerType()
1995 //----------------------------------------------------------------------------
1996 // Import Declarations
1997 //----------------------------------------------------------------------------
2003 // Import the context of this declaration. in ImportDeclParts()
2004 DC = Importer.ImportContext(D->getDeclContext()); in ImportDeclParts()
2009 if (D->getDeclContext() != D->getLexicalDeclContext()) { in ImportDeclParts()
2010 LexicalDC = Importer.ImportContext(D->getLexicalDeclContext()); in ImportDeclParts()
2015 // Import the name of this declaration. in ImportDeclParts()
2016 Name = Importer.Import(D->getDeclName()); in ImportDeclParts()
2017 if (D->getDeclName() && !Name) in ImportDeclParts()
2020 // Import the location of this declaration. in ImportDeclParts()
2021 Loc = Importer.Import(D->getLocation()); in ImportDeclParts()
2031 ToD = Importer.Import(FromD); in ImportDefinitionIfNeeded()
2038 …if (FromRecord->getDefinition() && FromRecord->isCompleteDefinition() && !ToRecord->getDefinition(… in ImportDefinitionIfNeeded()
2047 if (FromEnum->getDefinition() && !ToEnum->getDefinition()) { in ImportDefinitionIfNeeded()
2059 // We only have to import To.LocInfo. in ImportDeclarationNameLoc()
2070 To.setCXXOperatorNameRange(Importer.Import(Range)); in ImportDeclarationNameLoc()
2075 To.setCXXLiteralOperatorNameLoc(Importer.Import(Loc)); in ImportDeclarationNameLoc()
2082 To.setNamedTypeInfo(Importer.Import(FromTInfo)); in ImportDeclarationNameLoc()
2095 for (auto *From : FromDC->decls()) in ImportDeclContext()
2096 Importer.Import(From); in ImportDeclContext()
2101 if (To->getDefinition() || To->isBeingDefined()) { in ImportDefinition()
2108 To->startDefinition(); in ImportDefinition()
2114 struct CXXRecordDecl::DefinitionData &ToData = ToCXX->data(); in ImportDefinition()
2115 struct CXXRecordDecl::DefinitionData &FromData = FromCXX->data(); in ImportDefinition()
2175 for (const auto &Base1 : FromCXX->bases()) { in ImportDefinition()
2176 QualType T = Importer.Import(Base1.getType()); in ImportDefinition()
2182 EllipsisLoc = Importer.Import(Base1.getEllipsisLoc()); in ImportDefinition()
2185 ImportDefinitionIfNeeded(Base1.getType()->getAsCXXRecordDecl()); in ImportDefinition()
2189 CXXBaseSpecifier(Importer.Import(Base1.getSourceRange()), in ImportDefinition()
2193 Importer.Import(Base1.getTypeSourceInfo()), in ImportDefinition()
2197 ToCXX->setBases(Bases.data(), Bases.size()); in ImportDefinition()
2203 To->completeDefinition(); in ImportDefinition()
2209 if (To->getAnyInitializer()) in ImportDefinition()
2212 // FIXME: Can we really import any initializer? Alternatively, we could force in ImportDefinition()
2213 // ourselves to import every declaration of a variable and then only use in ImportDefinition()
2215 To->setInit(Importer.Import(const_cast<Expr *>(From->getAnyInitializer()))); in ImportDefinition()
2224 if (To->getDefinition() || To->isBeingDefined()) { in ImportDefinition()
2230 To->startDefinition(); in ImportDefinition()
2232 QualType T = Importer.Import(Importer.getFromContext().getTypeDeclType(From)); in ImportDefinition()
2236 QualType ToPromotionType = Importer.Import(From->getPromotionType()); in ImportDefinition()
2245 To->completeDefinition(T, ToPromotionType, in ImportDefinition()
2246 From->getNumPositiveBits(), in ImportDefinition()
2247 From->getNumNegativeBits()); in ImportDefinition()
2254 ToParams.reserve(Params->size()); in ImportTemplateParameterList()
2255 for (TemplateParameterList::iterator P = Params->begin(), in ImportTemplateParameterList()
2256 PEnd = Params->end(); in ImportTemplateParameterList()
2258 Decl *To = Importer.Import(*P); in ImportTemplateParameterList()
2266 Importer.Import(Params->getTemplateLoc()), in ImportTemplateParameterList()
2267 Importer.Import(Params->getLAngleLoc()), in ImportTemplateParameterList()
2269 Importer.Import(Params->getRAngleLoc())); in ImportTemplateParameterList()
2279 QualType ToType = Importer.Import(From.getAsType()); in ImportTemplateArgument()
2286 QualType ToType = Importer.Import(From.getIntegralType()); in ImportTemplateArgument()
2293 ValueDecl *To = cast_or_null<ValueDecl>(Importer.Import(From.getAsDecl())); in ImportTemplateArgument()
2294 QualType ToType = Importer.Import(From.getParamTypeForDecl()); in ImportTemplateArgument()
2301 QualType ToType = Importer.Import(From.getNullPtrType()); in ImportTemplateArgument()
2308 TemplateName ToTemplate = Importer.Import(From.getAsTemplate()); in ImportTemplateArgument()
2317 = Importer.Import(From.getAsTemplateOrTemplatePattern()); in ImportTemplateArgument()
2325 if (Expr *ToExpr = Importer.Import(From.getAsExpr())) in ImportTemplateArgument()
2359 // Eliminate a potential failure point where we attempt to re-import in IsStructuralMatch()
2360 // something we're trying to import while completing ToRecord. in IsStructuralMatch()
2369 ToRecord->getASTContext(), in IsStructuralMatch()
2393 const llvm::APSInt &FromVal = FromEC->getInitVal(); in IsStructuralMatch()
2394 const llvm::APSInt &ToVal = ToEC->getInitVal(); in IsStructuralMatch()
2418 Importer.FromDiag(D->getLocation(), diag::err_unsupported_ast_node) in VisitDecl()
2419 << D->getDeclKindName(); in VisitDecl()
2434 SourceLocation Loc = Importer.Import(D->getLocation()); in VisitAccessSpecDecl()
2435 SourceLocation ColonLoc = Importer.Import(D->getColonLoc()); in VisitAccessSpecDecl()
2437 // Import the context of this declaration. in VisitAccessSpecDecl()
2438 DeclContext *DC = Importer.ImportContext(D->getDeclContext()); in VisitAccessSpecDecl()
2443 = AccessSpecDecl::Create(Importer.getToContext(), D->getAccess(), in VisitAccessSpecDecl()
2451 accessSpecDecl->setLexicalDeclContext(DC); in VisitAccessSpecDecl()
2452 DC->addDeclInternal(accessSpecDecl); in VisitAccessSpecDecl()
2458 // Import the major distinguishing characteristics of this namespace. in VisitNamespaceDecl()
2474 MergeWithNamespace = TU->getAnonymousNamespace(); in VisitNamespaceDecl()
2476 MergeWithNamespace = cast<NamespaceDecl>(DC)->getAnonymousNamespace(); in VisitNamespaceDecl()
2480 DC->getRedeclContext()->localUncachedLookup(Name, FoundDecls); in VisitNamespaceDecl()
2482 if (!FoundDecls[I]->isInIdentifierNamespace(Decl::IDNS_Namespace)) in VisitNamespaceDecl()
2505 D->isInline(), in VisitNamespaceDecl()
2506 Importer.Import(D->getLocStart()), in VisitNamespaceDecl()
2509 ToNamespace->setLexicalDeclContext(LexicalDC); in VisitNamespaceDecl()
2510 LexicalDC->addDeclInternal(ToNamespace); in VisitNamespaceDecl()
2516 TU->setAnonymousNamespace(ToNamespace); in VisitNamespaceDecl()
2518 cast<NamespaceDecl>(DC)->setAnonymousNamespace(ToNamespace); in VisitNamespaceDecl()
2529 // Import the major distinguishing characteristics of this typedef. in VisitTypedefNameDecl()
2542 if (!DC->isFunctionOrMethod()) { in VisitTypedefNameDecl()
2546 DC->getRedeclContext()->localUncachedLookup(Name, FoundDecls); in VisitTypedefNameDecl()
2548 if (!FoundDecls[I]->isInIdentifierNamespace(IDNS)) in VisitTypedefNameDecl()
2552 if (Importer.IsStructurallyEquivalent(D->getUnderlyingType(), in VisitTypedefNameDecl()
2553 FoundTypedef->getUnderlyingType())) in VisitTypedefNameDecl()
2569 // Import the underlying type of this typedef; in VisitTypedefNameDecl()
2570 QualType T = Importer.Import(D->getUnderlyingType()); in VisitTypedefNameDecl()
2575 TypeSourceInfo *TInfo = Importer.Import(D->getTypeSourceInfo()); in VisitTypedefNameDecl()
2576 SourceLocation StartL = Importer.Import(D->getLocStart()); in VisitTypedefNameDecl()
2589 ToTypedef->setAccess(D->getAccess()); in VisitTypedefNameDecl()
2590 ToTypedef->setLexicalDeclContext(LexicalDC); in VisitTypedefNameDecl()
2592 LexicalDC->addDeclInternal(ToTypedef); in VisitTypedefNameDecl()
2606 // Import the major distinguishing characteristics of this label. in VisitLabelDecl()
2616 assert(LexicalDC->isFunctionOrMethod()); in VisitLabelDecl()
2618 LabelDecl *ToLabel = D->isGnuLocal() in VisitLabelDecl()
2620 DC, Importer.Import(D->getLocation()), in VisitLabelDecl()
2622 Importer.Import(D->getLocStart())) in VisitLabelDecl()
2624 DC, Importer.Import(D->getLocation()), in VisitLabelDecl()
2628 LabelStmt *Label = cast_or_null<LabelStmt>(Importer.Import(D->getStmt())); in VisitLabelDecl()
2632 ToLabel->setStmt(Label); in VisitLabelDecl()
2633 ToLabel->setLexicalDeclContext(LexicalDC); in VisitLabelDecl()
2634 LexicalDC->addDeclInternal(ToLabel); in VisitLabelDecl()
2639 // Import the major distinguishing characteristics of this enum. in VisitEnumDecl()
2652 if (!SearchName && D->getTypedefNameForAnonDecl()) { in VisitEnumDecl()
2653 SearchName = Importer.Import(D->getTypedefNameForAnonDecl()->getDeclName()); in VisitEnumDecl()
2659 if (!DC->isFunctionOrMethod() && SearchName) { in VisitEnumDecl()
2662 DC->getRedeclContext()->localUncachedLookup(Name, FoundDecls); in VisitEnumDecl()
2664 if (!FoundDecls[I]->isInIdentifierNamespace(IDNS)) in VisitEnumDecl()
2669 if (const TagType *Tag = Typedef->getUnderlyingType()->getAs<TagType>()) in VisitEnumDecl()
2670 Found = Tag->getDecl(); in VisitEnumDecl()
2690 Importer.Import(D->getLocStart()), in VisitEnumDecl()
2692 D->isScoped(), D->isScopedUsingClassTag(), in VisitEnumDecl()
2693 D->isFixed()); in VisitEnumDecl()
2694 // Import the qualifier, if any. in VisitEnumDecl()
2695 D2->setQualifierInfo(Importer.Import(D->getQualifierLoc())); in VisitEnumDecl()
2696 D2->setAccess(D->getAccess()); in VisitEnumDecl()
2697 D2->setLexicalDeclContext(LexicalDC); in VisitEnumDecl()
2699 LexicalDC->addDeclInternal(D2); in VisitEnumDecl()
2701 // Import the integer type. in VisitEnumDecl()
2702 QualType ToIntegerType = Importer.Import(D->getIntegerType()); in VisitEnumDecl()
2705 D2->setIntegerType(ToIntegerType); in VisitEnumDecl()
2707 // Import the definition in VisitEnumDecl()
2708 if (D->isCompleteDefinition() && ImportDefinition(D, D2)) in VisitEnumDecl()
2716 // but this particular declaration is not that definition, import the in VisitRecordDecl()
2718 TagDecl *Definition = D->getDefinition(); in VisitRecordDecl()
2720 Decl *ImportedDef = Importer.Import(Definition); in VisitRecordDecl()
2727 // Import the major distinguishing characteristics of this record. in VisitRecordDecl()
2740 if (!SearchName && D->getTypedefNameForAnonDecl()) { in VisitRecordDecl()
2741 SearchName = Importer.Import(D->getTypedefNameForAnonDecl()->getDeclName()); in VisitRecordDecl()
2748 if (!DC->isFunctionOrMethod()) { in VisitRecordDecl()
2751 DC->getRedeclContext()->localUncachedLookup(Name, FoundDecls); in VisitRecordDecl()
2753 if (!FoundDecls[I]->isInIdentifierNamespace(IDNS)) in VisitRecordDecl()
2758 if (const TagType *Tag = Typedef->getUnderlyingType()->getAs<TagType>()) in VisitRecordDecl()
2759 Found = Tag->getDecl(); in VisitRecordDecl()
2763 if (D->isAnonymousStructOrUnion() && in VisitRecordDecl()
2764 FoundRecord->isAnonymousStructOrUnion()) { in VisitRecordDecl()
2777 if (RecordDecl *FoundDef = FoundRecord->getDefinition()) { in VisitRecordDecl()
2778 if ((SearchName && !D->isCompleteDefinition()) in VisitRecordDecl()
2779 || (D->isCompleteDefinition() && in VisitRecordDecl()
2780 D->isAnonymousStructOrUnion() in VisitRecordDecl()
2781 == FoundDef->isAnonymousStructOrUnion() && in VisitRecordDecl()
2789 } else if (!D->isCompleteDefinition()) { in VisitRecordDecl()
2796 if (FoundRecord->hasExternalLexicalStorage() && in VisitRecordDecl()
2797 !FoundRecord->isCompleteDefinition()) in VisitRecordDecl()
2798 FoundRecord->getASTContext().getExternalSource()->CompleteType(FoundRecord); in VisitRecordDecl()
2799 if (D->hasExternalLexicalStorage()) in VisitRecordDecl()
2800 D->getASTContext().getExternalSource()->CompleteType(D); in VisitRecordDecl()
2802 if (FoundRecord->isCompleteDefinition() && in VisitRecordDecl()
2803 D->isCompleteDefinition() && in VisitRecordDecl()
2826 SourceLocation StartLoc = Importer.Import(D->getLocStart()); in VisitRecordDecl()
2830 if (DCXX->isLambda()) { in VisitRecordDecl()
2831 TypeSourceInfo *TInfo = Importer.Import(DCXX->getLambdaTypeInfo()); in VisitRecordDecl()
2834 DCXX->isDependentLambda(), in VisitRecordDecl()
2835 DCXX->isGenericLambda(), in VisitRecordDecl()
2836 DCXX->getLambdaCaptureDefault()); in VisitRecordDecl()
2837 Decl *CDecl = Importer.Import(DCXX->getLambdaContextDecl()); in VisitRecordDecl()
2838 if (DCXX->getLambdaContextDecl() && !CDecl) in VisitRecordDecl()
2840 D2CXX->setLambdaMangling(DCXX->getLambdaManglingNumber(), CDecl); in VisitRecordDecl()
2841 } else if (DCXX->isInjectedClassName()) { in VisitRecordDecl()
2847 Importer.getToContext(), D->getTagKind(), DC, StartLoc, Loc, in VisitRecordDecl()
2853 D->getTagKind(), in VisitRecordDecl()
2858 D2->setAccess(D->getAccess()); in VisitRecordDecl()
2860 D2 = RecordDecl::Create(Importer.getToContext(), D->getTagKind(), in VisitRecordDecl()
2864 D2->setQualifierInfo(Importer.Import(D->getQualifierLoc())); in VisitRecordDecl()
2865 D2->setLexicalDeclContext(LexicalDC); in VisitRecordDecl()
2866 LexicalDC->addDeclInternal(D2); in VisitRecordDecl()
2867 if (D->isAnonymousStructOrUnion()) in VisitRecordDecl()
2868 D2->setAnonymousStructOrUnion(true); in VisitRecordDecl()
2873 if (D->isCompleteDefinition() && ImportDefinition(D, D2, IDK_Default)) in VisitRecordDecl()
2880 // Import the major distinguishing characteristics of this enumerator. in VisitEnumConstantDecl()
2890 QualType T = Importer.Import(D->getType()); in VisitEnumConstantDecl()
2896 if (!LexicalDC->isFunctionOrMethod()) { in VisitEnumConstantDecl()
2900 DC->getRedeclContext()->localUncachedLookup(Name, FoundDecls); in VisitEnumConstantDecl()
2902 if (!FoundDecls[I]->isInIdentifierNamespace(IDNS)) in VisitEnumConstantDecl()
2923 Expr *Init = Importer.Import(D->getInitExpr()); in VisitEnumConstantDecl()
2924 if (D->getInitExpr() && !Init) in VisitEnumConstantDecl()
2930 Init, D->getInitVal()); in VisitEnumConstantDecl()
2931 ToEnumerator->setAccess(D->getAccess()); in VisitEnumConstantDecl()
2932 ToEnumerator->setLexicalDeclContext(LexicalDC); in VisitEnumConstantDecl()
2934 LexicalDC->addDeclInternal(ToEnumerator); in VisitEnumConstantDecl()
2939 // Import the major distinguishing characteristics of this function. in VisitFunctionDecl()
2951 if (!LexicalDC->isFunctionOrMethod()) { in VisitFunctionDecl()
2955 DC->getRedeclContext()->localUncachedLookup(Name, FoundDecls); in VisitFunctionDecl()
2957 if (!FoundDecls[I]->isInIdentifierNamespace(IDNS)) in VisitFunctionDecl()
2961 if (FoundFunction->hasExternalFormalLinkage() && in VisitFunctionDecl()
2962 D->hasExternalFormalLinkage()) { in VisitFunctionDecl()
2963 if (Importer.IsStructurallyEquivalent(D->getType(), in VisitFunctionDecl()
2964 FoundFunction->getType())) { in VisitFunctionDecl()
2978 << Name << D->getType() << FoundFunction->getType(); in VisitFunctionDecl()
2979 Importer.ToDiag(FoundFunction->getLocation(), in VisitFunctionDecl()
2981 << FoundFunction->getType(); in VisitFunctionDecl()
2998 // Import additional name location/type info. in VisitFunctionDecl()
2999 ImportDeclarationNameLoc(D->getNameInfo(), NameInfo); in VisitFunctionDecl()
3001 QualType FromTy = D->getType(); in VisitFunctionDecl()
3005 FromFPT = D->getType()->getAs<FunctionProtoType>()) { in VisitFunctionDecl()
3006 FunctionProtoType::ExtProtoInfo FromEPI = FromFPT->getExtProtoInfo(); in VisitFunctionDecl()
3016 FromFPT->getReturnType(), FromFPT->getParamTypes(), DefaultEPI); in VisitFunctionDecl()
3021 // Import the type. in VisitFunctionDecl()
3022 QualType T = Importer.Import(FromTy); in VisitFunctionDecl()
3026 // Import the function parameters. in VisitFunctionDecl()
3028 for (auto P : D->parameters()) { in VisitFunctionDecl()
3029 ParmVarDecl *ToP = cast_or_null<ParmVarDecl>(Importer.Import(P)); in VisitFunctionDecl()
3037 TypeSourceInfo *TInfo = Importer.Import(D->getTypeSourceInfo()); in VisitFunctionDecl()
3039 SourceLocation InnerLocStart = Importer.Import(D->getInnerLocStart()); in VisitFunctionDecl()
3045 FromConstructor->isExplicit(), in VisitFunctionDecl()
3046 D->isInlineSpecified(), in VisitFunctionDecl()
3047 D->isImplicit(), in VisitFunctionDecl()
3048 D->isConstexpr()); in VisitFunctionDecl()
3049 if (unsigned NumInitializers = FromConstructor->getNumCtorInitializers()) { in VisitFunctionDecl()
3051 for (CXXCtorInitializer *I : FromConstructor->inits()) { in VisitFunctionDecl()
3053 cast_or_null<CXXCtorInitializer>(Importer.Import(I)); in VisitFunctionDecl()
3062 ToCtor->setCtorInitializers(Memory); in VisitFunctionDecl()
3063 ToCtor->setNumCtorInitializers(NumInitializers); in VisitFunctionDecl()
3070 D->isInlineSpecified(), in VisitFunctionDecl()
3071 D->isImplicit()); in VisitFunctionDecl()
3078 D->isInlineSpecified(), in VisitFunctionDecl()
3079 FromConversion->isExplicit(), in VisitFunctionDecl()
3080 D->isConstexpr(), in VisitFunctionDecl()
3081 Importer.Import(D->getLocEnd())); in VisitFunctionDecl()
3087 Method->getStorageClass(), in VisitFunctionDecl()
3088 Method->isInlineSpecified(), in VisitFunctionDecl()
3089 D->isConstexpr(), in VisitFunctionDecl()
3090 Importer.Import(D->getLocEnd())); in VisitFunctionDecl()
3094 NameInfo, T, TInfo, D->getStorageClass(), in VisitFunctionDecl()
3095 D->isInlineSpecified(), in VisitFunctionDecl()
3096 D->hasWrittenPrototype(), in VisitFunctionDecl()
3097 D->isConstexpr()); in VisitFunctionDecl()
3100 // Import the qualifier, if any. in VisitFunctionDecl()
3101 ToFunction->setQualifierInfo(Importer.Import(D->getQualifierLoc())); in VisitFunctionDecl()
3102 ToFunction->setAccess(D->getAccess()); in VisitFunctionDecl()
3103 ToFunction->setLexicalDeclContext(LexicalDC); in VisitFunctionDecl()
3104 ToFunction->setVirtualAsWritten(D->isVirtualAsWritten()); in VisitFunctionDecl()
3105 ToFunction->setTrivial(D->isTrivial()); in VisitFunctionDecl()
3106 ToFunction->setPure(D->isPure()); in VisitFunctionDecl()
3111 Parameters[I]->setOwningFunction(ToFunction); in VisitFunctionDecl()
3112 ToFunction->addDeclInternal(Parameters[I]); in VisitFunctionDecl()
3114 ToFunction->setParams(Parameters); in VisitFunctionDecl()
3118 QualType T = Importer.Import(D->getType()); in VisitFunctionDecl()
3121 ToFunction->setType(T); in VisitFunctionDecl()
3124 // Import the body, if any. in VisitFunctionDecl()
3125 if (Stmt *FromBody = D->getBody()) { in VisitFunctionDecl()
3126 if (Stmt *ToBody = Importer.Import(FromBody)) { in VisitFunctionDecl()
3127 ToFunction->setBody(ToBody); in VisitFunctionDecl()
3134 LexicalDC->addDeclInternal(ToFunction); in VisitFunctionDecl()
3156 RecordDecl *Owner = dyn_cast<RecordDecl>(F->getDeclContext()); in getFieldIndex()
3161 for (const auto *D : Owner->noload_decls()) { in getFieldIndex()
3173 // Import the major distinguishing characteristics of a variable. in VisitFieldDecl()
3185 DC->getRedeclContext()->localUncachedLookup(Name, FoundDecls); in VisitFieldDecl()
3192 if (Importer.IsStructurallyEquivalent(D->getType(), in VisitFieldDecl()
3193 FoundField->getType())) { in VisitFieldDecl()
3199 << Name << D->getType() << FoundField->getType(); in VisitFieldDecl()
3200 Importer.ToDiag(FoundField->getLocation(), diag::note_odr_value_here) in VisitFieldDecl()
3201 << FoundField->getType(); in VisitFieldDecl()
3206 // Import the type. in VisitFieldDecl()
3207 QualType T = Importer.Import(D->getType()); in VisitFieldDecl()
3211 TypeSourceInfo *TInfo = Importer.Import(D->getTypeSourceInfo()); in VisitFieldDecl()
3212 Expr *BitWidth = Importer.Import(D->getBitWidth()); in VisitFieldDecl()
3213 if (!BitWidth && D->getBitWidth()) in VisitFieldDecl()
3217 Importer.Import(D->getInnerLocStart()), in VisitFieldDecl()
3219 T, TInfo, BitWidth, D->isMutable(), in VisitFieldDecl()
3220 D->getInClassInitStyle()); in VisitFieldDecl()
3221 ToField->setAccess(D->getAccess()); in VisitFieldDecl()
3222 ToField->setLexicalDeclContext(LexicalDC); in VisitFieldDecl()
3223 if (Expr *FromInitializer = D->getInClassInitializer()) { in VisitFieldDecl()
3224 Expr *ToInitializer = Importer.Import(FromInitializer); in VisitFieldDecl()
3226 ToField->setInClassInitializer(ToInitializer); in VisitFieldDecl()
3230 ToField->setImplicit(D->isImplicit()); in VisitFieldDecl()
3232 LexicalDC->addDeclInternal(ToField); in VisitFieldDecl()
3237 // Import the major distinguishing characteristics of a variable. in VisitIndirectFieldDecl()
3249 DC->getRedeclContext()->localUncachedLookup(Name, FoundDecls); in VisitIndirectFieldDecl()
3257 if (Importer.IsStructurallyEquivalent(D->getType(), in VisitIndirectFieldDecl()
3258 FoundField->getType(), in VisitIndirectFieldDecl()
3265 if (!Name && I < N-1) in VisitIndirectFieldDecl()
3269 << Name << D->getType() << FoundField->getType(); in VisitIndirectFieldDecl()
3270 Importer.ToDiag(FoundField->getLocation(), diag::note_odr_value_here) in VisitIndirectFieldDecl()
3271 << FoundField->getType(); in VisitIndirectFieldDecl()
3276 // Import the type. in VisitIndirectFieldDecl()
3277 QualType T = Importer.Import(D->getType()); in VisitIndirectFieldDecl()
3282 new (Importer.getToContext())NamedDecl*[D->getChainingSize()]; in VisitIndirectFieldDecl()
3285 for (auto *PI : D->chain()) { in VisitIndirectFieldDecl()
3286 Decl *D = Importer.Import(PI); in VisitIndirectFieldDecl()
3294 {NamedChain, D->getChainingSize()}); in VisitIndirectFieldDecl()
3296 for (const auto *Attr : D->attrs()) in VisitIndirectFieldDecl()
3297 ToIndirectField->addAttr(Attr->clone(Importer.getToContext())); in VisitIndirectFieldDecl()
3299 ToIndirectField->setAccess(D->getAccess()); in VisitIndirectFieldDecl()
3300 ToIndirectField->setLexicalDeclContext(LexicalDC); in VisitIndirectFieldDecl()
3302 LexicalDC->addDeclInternal(ToIndirectField); in VisitIndirectFieldDecl()
3307 // Import the major distinguishing characteristics of an ivar. in VisitObjCIvarDecl()
3319 DC->getRedeclContext()->localUncachedLookup(Name, FoundDecls); in VisitObjCIvarDecl()
3322 if (Importer.IsStructurallyEquivalent(D->getType(), in VisitObjCIvarDecl()
3323 FoundIvar->getType())) { in VisitObjCIvarDecl()
3329 << Name << D->getType() << FoundIvar->getType(); in VisitObjCIvarDecl()
3330 Importer.ToDiag(FoundIvar->getLocation(), diag::note_odr_value_here) in VisitObjCIvarDecl()
3331 << FoundIvar->getType(); in VisitObjCIvarDecl()
3336 // Import the type. in VisitObjCIvarDecl()
3337 QualType T = Importer.Import(D->getType()); in VisitObjCIvarDecl()
3341 TypeSourceInfo *TInfo = Importer.Import(D->getTypeSourceInfo()); in VisitObjCIvarDecl()
3342 Expr *BitWidth = Importer.Import(D->getBitWidth()); in VisitObjCIvarDecl()
3343 if (!BitWidth && D->getBitWidth()) in VisitObjCIvarDecl()
3348 Importer.Import(D->getInnerLocStart()), in VisitObjCIvarDecl()
3350 T, TInfo, D->getAccessControl(), in VisitObjCIvarDecl()
3351 BitWidth, D->getSynthesize()); in VisitObjCIvarDecl()
3352 ToIvar->setLexicalDeclContext(LexicalDC); in VisitObjCIvarDecl()
3354 LexicalDC->addDeclInternal(ToIvar); in VisitObjCIvarDecl()
3360 // Import the major distinguishing characteristics of a variable. in VisitVarDecl()
3372 if (D->isFileVarDecl()) { in VisitVarDecl()
3377 DC->getRedeclContext()->localUncachedLookup(Name, FoundDecls); in VisitVarDecl()
3379 if (!FoundDecls[I]->isInIdentifierNamespace(IDNS)) in VisitVarDecl()
3384 if (FoundVar->hasExternalFormalLinkage() && in VisitVarDecl()
3385 D->hasExternalFormalLinkage()) { in VisitVarDecl()
3386 if (Importer.IsStructurallyEquivalent(D->getType(), in VisitVarDecl()
3387 FoundVar->getType())) { in VisitVarDecl()
3393 = Importer.getToContext().getAsArrayType(FoundVar->getType()); in VisitVarDecl()
3395 = Importer.getToContext().getAsArrayType(D->getType()); in VisitVarDecl()
3399 // Import the type. in VisitVarDecl()
3400 QualType T = Importer.Import(D->getType()); in VisitVarDecl()
3404 FoundVar->setType(T); in VisitVarDecl()
3415 << Name << D->getType() << FoundVar->getType(); in VisitVarDecl()
3416 Importer.ToDiag(FoundVar->getLocation(), diag::note_odr_value_here) in VisitVarDecl()
3417 << FoundVar->getType(); in VisitVarDecl()
3429 if (VarDecl *DDef = D->getDefinition()) { in VisitVarDecl()
3430 if (VarDecl *ExistingDef = MergeWithVar->getDefinition()) { in VisitVarDecl()
3431 Importer.ToDiag(ExistingDef->getLocation(), in VisitVarDecl()
3434 Importer.FromDiag(DDef->getLocation(), diag::note_odr_defined_here); in VisitVarDecl()
3436 Expr *Init = Importer.Import(DDef->getInit()); in VisitVarDecl()
3437 MergeWithVar->setInit(Init); in VisitVarDecl()
3438 if (DDef->isInitKnownICE()) { in VisitVarDecl()
3439 EvaluatedStmt *Eval = MergeWithVar->ensureEvaluatedStmt(); in VisitVarDecl()
3440 Eval->CheckedICE = true; in VisitVarDecl()
3441 Eval->IsICE = DDef->isInitICE(); in VisitVarDecl()
3458 // Import the type. in VisitVarDecl()
3459 QualType T = Importer.Import(D->getType()); in VisitVarDecl()
3464 TypeSourceInfo *TInfo = Importer.Import(D->getTypeSourceInfo()); in VisitVarDecl()
3466 Importer.Import(D->getInnerLocStart()), in VisitVarDecl()
3469 D->getStorageClass()); in VisitVarDecl()
3470 ToVar->setQualifierInfo(Importer.Import(D->getQualifierLoc())); in VisitVarDecl()
3471 ToVar->setAccess(D->getAccess()); in VisitVarDecl()
3472 ToVar->setLexicalDeclContext(LexicalDC); in VisitVarDecl()
3474 LexicalDC->addDeclInternal(ToVar); in VisitVarDecl()
3476 if (!D->isFileVarDecl() && in VisitVarDecl()
3477 D->isUsed()) in VisitVarDecl()
3478 ToVar->setIsUsed(); in VisitVarDecl()
3492 // Import the name of this declaration. in VisitImplicitParamDecl()
3493 DeclarationName Name = Importer.Import(D->getDeclName()); in VisitImplicitParamDecl()
3494 if (D->getDeclName() && !Name) in VisitImplicitParamDecl()
3497 // Import the location of this declaration. in VisitImplicitParamDecl()
3498 SourceLocation Loc = Importer.Import(D->getLocation()); in VisitImplicitParamDecl()
3500 // Import the parameter's type. in VisitImplicitParamDecl()
3501 QualType T = Importer.Import(D->getType()); in VisitImplicitParamDecl()
3518 // Import the name of this declaration. in VisitParmVarDecl()
3519 DeclarationName Name = Importer.Import(D->getDeclName()); in VisitParmVarDecl()
3520 if (D->getDeclName() && !Name) in VisitParmVarDecl()
3523 // Import the location of this declaration. in VisitParmVarDecl()
3524 SourceLocation Loc = Importer.Import(D->getLocation()); in VisitParmVarDecl()
3526 // Import the parameter's type. in VisitParmVarDecl()
3527 QualType T = Importer.Import(D->getType()); in VisitParmVarDecl()
3532 TypeSourceInfo *TInfo = Importer.Import(D->getTypeSourceInfo()); in VisitParmVarDecl()
3534 Importer.Import(D->getInnerLocStart()), in VisitParmVarDecl()
3536 T, TInfo, D->getStorageClass(), in VisitParmVarDecl()
3538 ToParm->setHasInheritedDefaultArg(D->hasInheritedDefaultArg()); in VisitParmVarDecl()
3540 if (D->isUsed()) in VisitParmVarDecl()
3541 ToParm->setIsUsed(); in VisitParmVarDecl()
3547 // Import the major distinguishing characteristics of a method. in VisitObjCMethodDecl()
3558 DC->getRedeclContext()->localUncachedLookup(Name, FoundDecls); in VisitObjCMethodDecl()
3561 if (FoundMethod->isInstanceMethod() != D->isInstanceMethod()) in VisitObjCMethodDecl()
3565 if (!Importer.IsStructurallyEquivalent(D->getReturnType(), in VisitObjCMethodDecl()
3566 FoundMethod->getReturnType())) { in VisitObjCMethodDecl()
3568 << D->isInstanceMethod() << Name << D->getReturnType() in VisitObjCMethodDecl()
3569 << FoundMethod->getReturnType(); in VisitObjCMethodDecl()
3570 Importer.ToDiag(FoundMethod->getLocation(), in VisitObjCMethodDecl()
3572 << D->isInstanceMethod() << Name; in VisitObjCMethodDecl()
3577 if (D->param_size() != FoundMethod->param_size()) { in VisitObjCMethodDecl()
3579 << D->isInstanceMethod() << Name in VisitObjCMethodDecl()
3580 << D->param_size() << FoundMethod->param_size(); in VisitObjCMethodDecl()
3581 Importer.ToDiag(FoundMethod->getLocation(), in VisitObjCMethodDecl()
3583 << D->isInstanceMethod() << Name; in VisitObjCMethodDecl()
3588 for (ObjCMethodDecl::param_iterator P = D->param_begin(), in VisitObjCMethodDecl()
3589 PEnd = D->param_end(), FoundP = FoundMethod->param_begin(); in VisitObjCMethodDecl()
3591 if (!Importer.IsStructurallyEquivalent((*P)->getType(), in VisitObjCMethodDecl()
3592 (*FoundP)->getType())) { in VisitObjCMethodDecl()
3593 Importer.FromDiag((*P)->getLocation(), in VisitObjCMethodDecl()
3595 << D->isInstanceMethod() << Name in VisitObjCMethodDecl()
3596 << (*P)->getType() << (*FoundP)->getType(); in VisitObjCMethodDecl()
3597 Importer.ToDiag((*FoundP)->getLocation(), diag::note_odr_value_here) in VisitObjCMethodDecl()
3598 << (*FoundP)->getType(); in VisitObjCMethodDecl()
3603 // Check variadic/non-variadic. in VisitObjCMethodDecl()
3605 if (D->isVariadic() != FoundMethod->isVariadic()) { in VisitObjCMethodDecl()
3607 << D->isInstanceMethod() << Name; in VisitObjCMethodDecl()
3608 Importer.ToDiag(FoundMethod->getLocation(), in VisitObjCMethodDecl()
3610 << D->isInstanceMethod() << Name; in VisitObjCMethodDecl()
3619 // Import the result type. in VisitObjCMethodDecl()
3620 QualType ResultTy = Importer.Import(D->getReturnType()); in VisitObjCMethodDecl()
3624 TypeSourceInfo *ReturnTInfo = Importer.Import(D->getReturnTypeSourceInfo()); in VisitObjCMethodDecl()
3627 Importer.getToContext(), Loc, Importer.Import(D->getLocEnd()), in VisitObjCMethodDecl()
3628 Name.getObjCSelector(), ResultTy, ReturnTInfo, DC, D->isInstanceMethod(), in VisitObjCMethodDecl()
3629 D->isVariadic(), D->isPropertyAccessor(), D->isImplicit(), D->isDefined(), in VisitObjCMethodDecl()
3630 D->getImplementationControl(), D->hasRelatedResultType()); in VisitObjCMethodDecl()
3635 // Import the parameters in VisitObjCMethodDecl()
3637 for (auto *FromP : D->parameters()) { in VisitObjCMethodDecl()
3638 ParmVarDecl *ToP = cast_or_null<ParmVarDecl>(Importer.Import(FromP)); in VisitObjCMethodDecl()
3647 ToParams[I]->setOwningFunction(ToMethod); in VisitObjCMethodDecl()
3648 ToMethod->addDeclInternal(ToParams[I]); in VisitObjCMethodDecl()
3651 D->getSelectorLocs(SelLocs); in VisitObjCMethodDecl()
3652 ToMethod->setMethodParams(Importer.getToContext(), ToParams, SelLocs); in VisitObjCMethodDecl()
3654 ToMethod->setLexicalDeclContext(LexicalDC); in VisitObjCMethodDecl()
3656 LexicalDC->addDeclInternal(ToMethod); in VisitObjCMethodDecl()
3661 // Import the major distinguishing characteristics of a category. in VisitObjCTypeParamDecl()
3671 TypeSourceInfo *BoundInfo = Importer.Import(D->getTypeSourceInfo()); in VisitObjCTypeParamDecl()
3677 D->getVariance(), in VisitObjCTypeParamDecl()
3678 Importer.Import(D->getVarianceLoc()), in VisitObjCTypeParamDecl()
3679 D->getIndex(), in VisitObjCTypeParamDecl()
3680 Importer.Import(D->getLocation()), in VisitObjCTypeParamDecl()
3682 Importer.Import(D->getColonLoc()), in VisitObjCTypeParamDecl()
3685 Result->setLexicalDeclContext(LexicalDC); in VisitObjCTypeParamDecl()
3690 // Import the major distinguishing characteristics of a category. in VisitObjCCategoryDecl()
3701 = cast_or_null<ObjCInterfaceDecl>(Importer.Import(D->getClassInterface())); in VisitObjCCategoryDecl()
3707 = ToInterface->FindCategoryDeclaration(Name.getAsIdentifierInfo()); in VisitObjCCategoryDecl()
3711 Importer.Import(D->getAtStartLoc()), in VisitObjCCategoryDecl()
3713 Importer.Import(D->getCategoryNameLoc()), in VisitObjCCategoryDecl()
3717 Importer.Import(D->getIvarLBraceLoc()), in VisitObjCCategoryDecl()
3718 Importer.Import(D->getIvarRBraceLoc())); in VisitObjCCategoryDecl()
3719 ToCategory->setLexicalDeclContext(LexicalDC); in VisitObjCCategoryDecl()
3720 LexicalDC->addDeclInternal(ToCategory); in VisitObjCCategoryDecl()
3722 // Import the type parameter list after calling Imported, to avoid in VisitObjCCategoryDecl()
3724 ToCategory->setTypeParamList(ImportObjCTypeParamList( in VisitObjCCategoryDecl()
3725 D->getTypeParamList())); in VisitObjCCategoryDecl()
3727 // Import protocols in VisitObjCCategoryDecl()
3731 = D->protocol_loc_begin(); in VisitObjCCategoryDecl()
3732 for (ObjCCategoryDecl::protocol_iterator FromProto = D->protocol_begin(), in VisitObjCCategoryDecl()
3733 FromProtoEnd = D->protocol_end(); in VisitObjCCategoryDecl()
3737 = cast_or_null<ObjCProtocolDecl>(Importer.Import(*FromProto)); in VisitObjCCategoryDecl()
3741 ProtocolLocs.push_back(Importer.Import(*FromProtoLoc)); in VisitObjCCategoryDecl()
3745 ToCategory->setProtocolList(Protocols.data(), Protocols.size(), in VisitObjCCategoryDecl()
3752 // Import all of the members of this category. in VisitObjCCategoryDecl()
3755 // If we have an implementation, import it as well. in VisitObjCCategoryDecl()
3756 if (D->getImplementation()) { in VisitObjCCategoryDecl()
3759 Importer.Import(D->getImplementation())); in VisitObjCCategoryDecl()
3763 ToCategory->setImplementation(Impl); in VisitObjCCategoryDecl()
3772 if (To->getDefinition()) { in ImportDefinition()
3779 To->startDefinition(); in ImportDefinition()
3781 // Import protocols in ImportDefinition()
3785 FromProtoLoc = From->protocol_loc_begin(); in ImportDefinition()
3786 for (ObjCProtocolDecl::protocol_iterator FromProto = From->protocol_begin(), in ImportDefinition()
3787 FromProtoEnd = From->protocol_end(); in ImportDefinition()
3791 = cast_or_null<ObjCProtocolDecl>(Importer.Import(*FromProto)); in ImportDefinition()
3795 ProtocolLocs.push_back(Importer.Import(*FromProtoLoc)); in ImportDefinition()
3799 To->setProtocolList(Protocols.data(), Protocols.size(), in ImportDefinition()
3803 // Import all of the members of this protocol. in ImportDefinition()
3811 // from, but this particular declaration is not that definition, import the in VisitObjCProtocolDecl()
3813 ObjCProtocolDecl *Definition = D->getDefinition(); in VisitObjCProtocolDecl()
3815 Decl *ImportedDef = Importer.Import(Definition); in VisitObjCProtocolDecl()
3822 // Import the major distinguishing characteristics of a protocol. in VisitObjCProtocolDecl()
3834 DC->getRedeclContext()->localUncachedLookup(Name, FoundDecls); in VisitObjCProtocolDecl()
3836 if (!FoundDecls[I]->isInIdentifierNamespace(Decl::IDNS_ObjCProtocol)) in VisitObjCProtocolDecl()
3847 Importer.Import(D->getAtStartLoc()), in VisitObjCProtocolDecl()
3849 ToProto->setLexicalDeclContext(LexicalDC); in VisitObjCProtocolDecl()
3850 LexicalDC->addDeclInternal(ToProto); in VisitObjCProtocolDecl()
3855 if (D->isThisDeclarationADefinition() && ImportDefinition(D, ToProto)) in VisitObjCProtocolDecl()
3862 DeclContext *DC = Importer.ImportContext(D->getDeclContext()); in VisitLinkageSpecDecl()
3863 DeclContext *LexicalDC = Importer.ImportContext(D->getLexicalDeclContext()); in VisitLinkageSpecDecl()
3865 SourceLocation ExternLoc = Importer.Import(D->getExternLoc()); in VisitLinkageSpecDecl()
3866 SourceLocation LangLoc = Importer.Import(D->getLocation()); in VisitLinkageSpecDecl()
3868 bool HasBraces = D->hasBraces(); in VisitLinkageSpecDecl()
3875 D->getLanguage(), in VisitLinkageSpecDecl()
3879 SourceLocation RBraceLoc = Importer.Import(D->getRBraceLoc()); in VisitLinkageSpecDecl()
3880 ToLinkageSpec->setRBraceLoc(RBraceLoc); in VisitLinkageSpecDecl()
3883 ToLinkageSpec->setLexicalDeclContext(LexicalDC); in VisitLinkageSpecDecl()
3884 LexicalDC->addDeclInternal(ToLinkageSpec); in VisitLinkageSpecDecl()
3894 if (To->getDefinition()) { in ImportDefinition()
3896 ObjCInterfaceDecl *FromSuper = From->getSuperClass(); in ImportDefinition()
3898 FromSuper = cast_or_null<ObjCInterfaceDecl>(Importer.Import(FromSuper)); in ImportDefinition()
3903 ObjCInterfaceDecl *ToSuper = To->getSuperClass(); in ImportDefinition()
3906 Importer.ToDiag(To->getLocation(), in ImportDefinition()
3908 << To->getDeclName(); in ImportDefinition()
3910 Importer.ToDiag(To->getSuperClassLoc(), diag::note_odr_objc_superclass) in ImportDefinition()
3911 << To->getSuperClass()->getDeclName(); in ImportDefinition()
3913 Importer.ToDiag(To->getLocation(), in ImportDefinition()
3915 if (From->getSuperClass()) in ImportDefinition()
3916 Importer.FromDiag(From->getSuperClassLoc(), in ImportDefinition()
3918 << From->getSuperClass()->getDeclName(); in ImportDefinition()
3920 Importer.FromDiag(From->getLocation(), in ImportDefinition()
3930 To->startDefinition(); in ImportDefinition()
3932 // If this class has a superclass, import it. in ImportDefinition()
3933 if (From->getSuperClass()) { in ImportDefinition()
3934 TypeSourceInfo *SuperTInfo = Importer.Import(From->getSuperClassTInfo()); in ImportDefinition()
3938 To->setSuperClass(SuperTInfo); in ImportDefinition()
3941 // Import protocols in ImportDefinition()
3945 FromProtoLoc = From->protocol_loc_begin(); in ImportDefinition()
3947 for (ObjCInterfaceDecl::protocol_iterator FromProto = From->protocol_begin(), in ImportDefinition()
3948 FromProtoEnd = From->protocol_end(); in ImportDefinition()
3952 = cast_or_null<ObjCProtocolDecl>(Importer.Import(*FromProto)); in ImportDefinition()
3956 ProtocolLocs.push_back(Importer.Import(*FromProtoLoc)); in ImportDefinition()
3960 To->setProtocolList(Protocols.data(), Protocols.size(), in ImportDefinition()
3963 // Import categories. When the categories themselves are imported, they'll in ImportDefinition()
3965 for (auto *Cat : From->known_categories()) in ImportDefinition()
3966 Importer.Import(Cat); in ImportDefinition()
3968 // If we have an @implementation, import it as well. in ImportDefinition()
3969 if (From->getImplementation()) { in ImportDefinition()
3971 Importer.Import(From->getImplementation())); in ImportDefinition()
3975 To->setImplementation(Impl); in ImportDefinition()
3979 // Import all of the members of this class. in ImportDefinition()
3993 Importer.Import(fromTypeParam)); in ImportObjCTypeParamList()
4001 Importer.Import(list->getLAngleLoc()), in ImportObjCTypeParamList()
4003 Importer.Import(list->getRAngleLoc())); in ImportObjCTypeParamList()
4008 // but this particular declaration is not that definition, import the in VisitObjCInterfaceDecl()
4010 ObjCInterfaceDecl *Definition = D->getDefinition(); in VisitObjCInterfaceDecl()
4012 Decl *ImportedDef = Importer.Import(Definition); in VisitObjCInterfaceDecl()
4019 // Import the major distinguishing characteristics of an @interface. in VisitObjCInterfaceDecl()
4032 DC->getRedeclContext()->localUncachedLookup(Name, FoundDecls); in VisitObjCInterfaceDecl()
4034 if (!FoundDecls[I]->isInIdentifierNamespace(Decl::IDNS_Ordinary)) in VisitObjCInterfaceDecl()
4045 Importer.Import(D->getAtStartLoc()), in VisitObjCInterfaceDecl()
4049 D->isImplicitInterfaceDecl()); in VisitObjCInterfaceDecl()
4050 ToIface->setLexicalDeclContext(LexicalDC); in VisitObjCInterfaceDecl()
4051 LexicalDC->addDeclInternal(ToIface); in VisitObjCInterfaceDecl()
4054 // Import the type parameter list after calling Imported, to avoid in VisitObjCInterfaceDecl()
4056 ToIface->setTypeParamList(ImportObjCTypeParamList( in VisitObjCInterfaceDecl()
4057 D->getTypeParamListAsWritten())); in VisitObjCInterfaceDecl()
4059 if (D->isThisDeclarationADefinition() && ImportDefinition(D, ToIface)) in VisitObjCInterfaceDecl()
4067 Importer.Import(D->getCategoryDecl())); in VisitObjCCategoryImplDecl()
4071 ObjCCategoryImplDecl *ToImpl = Category->getImplementation(); in VisitObjCCategoryImplDecl()
4073 DeclContext *DC = Importer.ImportContext(D->getDeclContext()); in VisitObjCCategoryImplDecl()
4077 SourceLocation CategoryNameLoc = Importer.Import(D->getCategoryNameLoc()); in VisitObjCCategoryImplDecl()
4079 Importer.Import(D->getIdentifier()), in VisitObjCCategoryImplDecl()
4080 Category->getClassInterface(), in VisitObjCCategoryImplDecl()
4081 Importer.Import(D->getLocation()), in VisitObjCCategoryImplDecl()
4082 Importer.Import(D->getAtStartLoc()), in VisitObjCCategoryImplDecl()
4086 if (D->getDeclContext() != D->getLexicalDeclContext()) { in VisitObjCCategoryImplDecl()
4087 LexicalDC = Importer.ImportContext(D->getLexicalDeclContext()); in VisitObjCCategoryImplDecl()
4091 ToImpl->setLexicalDeclContext(LexicalDC); in VisitObjCCategoryImplDecl()
4094 LexicalDC->addDeclInternal(ToImpl); in VisitObjCCategoryImplDecl()
4095 Category->setImplementation(ToImpl); in VisitObjCCategoryImplDecl()
4106 Importer.Import(D->getClassInterface())); in VisitObjCImplementationDecl()
4110 // Import the superclass, if any. in VisitObjCImplementationDecl()
4112 if (D->getSuperClass()) { in VisitObjCImplementationDecl()
4114 Importer.Import(D->getSuperClass())); in VisitObjCImplementationDecl()
4119 ObjCImplementationDecl *Impl = Iface->getImplementation(); in VisitObjCImplementationDecl()
4124 Importer.ImportContext(D->getDeclContext()), in VisitObjCImplementationDecl()
4126 Importer.Import(D->getLocation()), in VisitObjCImplementationDecl()
4127 Importer.Import(D->getAtStartLoc()), in VisitObjCImplementationDecl()
4128 Importer.Import(D->getSuperClassLoc()), in VisitObjCImplementationDecl()
4129 Importer.Import(D->getIvarLBraceLoc()), in VisitObjCImplementationDecl()
4130 Importer.Import(D->getIvarRBraceLoc())); in VisitObjCImplementationDecl()
4132 if (D->getDeclContext() != D->getLexicalDeclContext()) { in VisitObjCImplementationDecl()
4134 = Importer.ImportContext(D->getLexicalDeclContext()); in VisitObjCImplementationDecl()
4137 Impl->setLexicalDeclContext(LexicalDC); in VisitObjCImplementationDecl()
4141 Iface->setImplementation(Impl); in VisitObjCImplementationDecl()
4142 Importer.Imported(D, Iface->getImplementation()); in VisitObjCImplementationDecl()
4144 Importer.Imported(D, Iface->getImplementation()); in VisitObjCImplementationDecl()
4147 if ((Super && !Impl->getSuperClass()) || in VisitObjCImplementationDecl()
4148 (!Super && Impl->getSuperClass()) || in VisitObjCImplementationDecl()
4149 (Super && Impl->getSuperClass() && in VisitObjCImplementationDecl()
4150 !declaresSameEntity(Super->getCanonicalDecl(), in VisitObjCImplementationDecl()
4151 Impl->getSuperClass()))) { in VisitObjCImplementationDecl()
4152 Importer.ToDiag(Impl->getLocation(), in VisitObjCImplementationDecl()
4154 << Iface->getDeclName(); in VisitObjCImplementationDecl()
4157 if (Impl->getSuperClass()) in VisitObjCImplementationDecl()
4158 Importer.ToDiag(Impl->getLocation(), in VisitObjCImplementationDecl()
4160 << Impl->getSuperClass()->getDeclName(); in VisitObjCImplementationDecl()
4162 Importer.ToDiag(Impl->getLocation(), in VisitObjCImplementationDecl()
4164 if (D->getSuperClass()) in VisitObjCImplementationDecl()
4165 Importer.FromDiag(D->getLocation(), in VisitObjCImplementationDecl()
4167 << D->getSuperClass()->getDeclName(); in VisitObjCImplementationDecl()
4169 Importer.FromDiag(D->getLocation(), in VisitObjCImplementationDecl()
4175 // Import all of the members of this @implementation. in VisitObjCImplementationDecl()
4182 // Import the major distinguishing characteristics of an @property. in VisitObjCPropertyDecl()
4194 DC->getRedeclContext()->localUncachedLookup(Name, FoundDecls); in VisitObjCPropertyDecl()
4199 if (!Importer.IsStructurallyEquivalent(D->getType(), in VisitObjCPropertyDecl()
4200 FoundProp->getType())) { in VisitObjCPropertyDecl()
4202 << Name << D->getType() << FoundProp->getType(); in VisitObjCPropertyDecl()
4203 Importer.ToDiag(FoundProp->getLocation(), diag::note_odr_value_here) in VisitObjCPropertyDecl()
4204 << FoundProp->getType(); in VisitObjCPropertyDecl()
4216 // Import the type. in VisitObjCPropertyDecl()
4217 TypeSourceInfo *TSI = Importer.Import(D->getTypeSourceInfo()); in VisitObjCPropertyDecl()
4225 Importer.Import(D->getAtLoc()), in VisitObjCPropertyDecl()
4226 Importer.Import(D->getLParenLoc()), in VisitObjCPropertyDecl()
4227 Importer.Import(D->getType()), in VisitObjCPropertyDecl()
4229 D->getPropertyImplementation()); in VisitObjCPropertyDecl()
4231 ToProperty->setLexicalDeclContext(LexicalDC); in VisitObjCPropertyDecl()
4232 LexicalDC->addDeclInternal(ToProperty); in VisitObjCPropertyDecl()
4234 ToProperty->setPropertyAttributes(D->getPropertyAttributes()); in VisitObjCPropertyDecl()
4235 ToProperty->setPropertyAttributesAsWritten( in VisitObjCPropertyDecl()
4236 D->getPropertyAttributesAsWritten()); in VisitObjCPropertyDecl()
4237 ToProperty->setGetterName(Importer.Import(D->getGetterName())); in VisitObjCPropertyDecl()
4238 ToProperty->setSetterName(Importer.Import(D->getSetterName())); in VisitObjCPropertyDecl()
4239 ToProperty->setGetterMethodDecl( in VisitObjCPropertyDecl()
4240 cast_or_null<ObjCMethodDecl>(Importer.Import(D->getGetterMethodDecl()))); in VisitObjCPropertyDecl()
4241 ToProperty->setSetterMethodDecl( in VisitObjCPropertyDecl()
4242 cast_or_null<ObjCMethodDecl>(Importer.Import(D->getSetterMethodDecl()))); in VisitObjCPropertyDecl()
4243 ToProperty->setPropertyIvarDecl( in VisitObjCPropertyDecl()
4244 cast_or_null<ObjCIvarDecl>(Importer.Import(D->getPropertyIvarDecl()))); in VisitObjCPropertyDecl()
4250 Importer.Import(D->getPropertyDecl())); in VisitObjCPropertyImplDecl()
4254 DeclContext *DC = Importer.ImportContext(D->getDeclContext()); in VisitObjCPropertyImplDecl()
4258 // Import the lexical declaration context. in VisitObjCPropertyImplDecl()
4260 if (D->getDeclContext() != D->getLexicalDeclContext()) { in VisitObjCPropertyImplDecl()
4261 LexicalDC = Importer.ImportContext(D->getLexicalDeclContext()); in VisitObjCPropertyImplDecl()
4270 // Import the ivar (for an @synthesize). in VisitObjCPropertyImplDecl()
4272 if (D->getPropertyIvarDecl()) { in VisitObjCPropertyImplDecl()
4274 Importer.Import(D->getPropertyIvarDecl())); in VisitObjCPropertyImplDecl()
4280 = InImpl->FindPropertyImplDecl(Property->getIdentifier(), in VisitObjCPropertyImplDecl()
4281 Property->getQueryKind()); in VisitObjCPropertyImplDecl()
4284 Importer.Import(D->getLocStart()), in VisitObjCPropertyImplDecl()
4285 Importer.Import(D->getLocation()), in VisitObjCPropertyImplDecl()
4287 D->getPropertyImplementation(), in VisitObjCPropertyImplDecl()
4289 Importer.Import(D->getPropertyIvarDeclLoc())); in VisitObjCPropertyImplDecl()
4290 ToImpl->setLexicalDeclContext(LexicalDC); in VisitObjCPropertyImplDecl()
4292 LexicalDC->addDeclInternal(ToImpl); in VisitObjCPropertyImplDecl()
4296 if (D->getPropertyImplementation() != ToImpl->getPropertyImplementation()) { in VisitObjCPropertyImplDecl()
4297 Importer.ToDiag(ToImpl->getLocation(), in VisitObjCPropertyImplDecl()
4299 << Property->getDeclName() in VisitObjCPropertyImplDecl()
4300 << (ToImpl->getPropertyImplementation() in VisitObjCPropertyImplDecl()
4302 Importer.FromDiag(D->getLocation(), in VisitObjCPropertyImplDecl()
4304 << D->getPropertyDecl()->getDeclName() in VisitObjCPropertyImplDecl()
4305 << (D->getPropertyImplementation() == ObjCPropertyImplDecl::Dynamic); in VisitObjCPropertyImplDecl()
4310 if (D->getPropertyImplementation() == ObjCPropertyImplDecl::Synthesize && in VisitObjCPropertyImplDecl()
4311 Ivar != ToImpl->getPropertyIvarDecl()) { in VisitObjCPropertyImplDecl()
4312 Importer.ToDiag(ToImpl->getPropertyIvarDeclLoc(), in VisitObjCPropertyImplDecl()
4314 << Property->getDeclName() in VisitObjCPropertyImplDecl()
4315 << ToImpl->getPropertyIvarDecl()->getDeclName() in VisitObjCPropertyImplDecl()
4316 << Ivar->getDeclName(); in VisitObjCPropertyImplDecl()
4317 Importer.FromDiag(D->getPropertyIvarDeclLoc(), in VisitObjCPropertyImplDecl()
4319 << D->getPropertyIvarDecl()->getDeclName(); in VisitObjCPropertyImplDecl()
4335 // FIXME: Import default argument. in VisitTemplateTypeParmDecl()
4338 Importer.Import(D->getLocStart()), in VisitTemplateTypeParmDecl()
4339 Importer.Import(D->getLocation()), in VisitTemplateTypeParmDecl()
4340 D->getDepth(), in VisitTemplateTypeParmDecl()
4341 D->getIndex(), in VisitTemplateTypeParmDecl()
4342 Importer.Import(D->getIdentifier()), in VisitTemplateTypeParmDecl()
4343 D->wasDeclaredWithTypename(), in VisitTemplateTypeParmDecl()
4344 D->isParameterPack()); in VisitTemplateTypeParmDecl()
4349 // Import the name of this declaration. in VisitNonTypeTemplateParmDecl()
4350 DeclarationName Name = Importer.Import(D->getDeclName()); in VisitNonTypeTemplateParmDecl()
4351 if (D->getDeclName() && !Name) in VisitNonTypeTemplateParmDecl()
4354 // Import the location of this declaration. in VisitNonTypeTemplateParmDecl()
4355 SourceLocation Loc = Importer.Import(D->getLocation()); in VisitNonTypeTemplateParmDecl()
4357 // Import the type of this declaration. in VisitNonTypeTemplateParmDecl()
4358 QualType T = Importer.Import(D->getType()); in VisitNonTypeTemplateParmDecl()
4362 // Import type-source information. in VisitNonTypeTemplateParmDecl()
4363 TypeSourceInfo *TInfo = Importer.Import(D->getTypeSourceInfo()); in VisitNonTypeTemplateParmDecl()
4364 if (D->getTypeSourceInfo() && !TInfo) in VisitNonTypeTemplateParmDecl()
4367 // FIXME: Import default argument. in VisitNonTypeTemplateParmDecl()
4371 Importer.Import(D->getInnerLocStart()), in VisitNonTypeTemplateParmDecl()
4372 Loc, D->getDepth(), D->getPosition(), in VisitNonTypeTemplateParmDecl()
4374 T, D->isParameterPack(), TInfo); in VisitNonTypeTemplateParmDecl()
4379 // Import the name of this declaration. in VisitTemplateTemplateParmDecl()
4380 DeclarationName Name = Importer.Import(D->getDeclName()); in VisitTemplateTemplateParmDecl()
4381 if (D->getDeclName() && !Name) in VisitTemplateTemplateParmDecl()
4384 // Import the location of this declaration. in VisitTemplateTemplateParmDecl()
4385 SourceLocation Loc = Importer.Import(D->getLocation()); in VisitTemplateTemplateParmDecl()
4387 // Import template parameters. in VisitTemplateTemplateParmDecl()
4389 = ImportTemplateParameterList(D->getTemplateParameters()); in VisitTemplateTemplateParmDecl()
4393 // FIXME: Import default argument. in VisitTemplateTemplateParmDecl()
4397 Loc, D->getDepth(), D->getPosition(), in VisitTemplateTemplateParmDecl()
4398 D->isParameterPack(), in VisitTemplateTemplateParmDecl()
4405 // but this particular declaration is not that definition, import the in VisitClassTemplateDecl()
4408 = cast_or_null<CXXRecordDecl>(D->getTemplatedDecl()->getDefinition()); in VisitClassTemplateDecl()
4409 if (Definition && Definition != D->getTemplatedDecl()) { in VisitClassTemplateDecl()
4411 = Importer.Import(Definition->getDescribedClassTemplate()); in VisitClassTemplateDecl()
4418 // Import the major distinguishing characteristics of this class template. in VisitClassTemplateDecl()
4429 if (!DC->isFunctionOrMethod()) { in VisitClassTemplateDecl()
4432 DC->getRedeclContext()->localUncachedLookup(Name, FoundDecls); in VisitClassTemplateDecl()
4434 if (!FoundDecls[I]->isInIdentifierNamespace(Decl::IDNS_Ordinary)) in VisitClassTemplateDecl()
4444 Importer.Imported(D->getTemplatedDecl(), in VisitClassTemplateDecl()
4445 FoundTemplate->getTemplatedDecl()); in VisitClassTemplateDecl()
4463 CXXRecordDecl *DTemplated = D->getTemplatedDecl(); in VisitClassTemplateDecl()
4468 Importer.Import(DTemplated)); in VisitClassTemplateDecl()
4472 // Resolve possible cyclic import. in VisitClassTemplateDecl()
4478 = ImportTemplateParameterList(D->getTemplateParameters()); in VisitClassTemplateDecl()
4486 D2Templated->setDescribedClassTemplate(D2); in VisitClassTemplateDecl()
4488 D2->setAccess(D->getAccess()); in VisitClassTemplateDecl()
4489 D2->setLexicalDeclContext(LexicalDC); in VisitClassTemplateDecl()
4490 LexicalDC->addDeclInternal(D2); in VisitClassTemplateDecl()
4496 if (DTemplated->isCompleteDefinition() && in VisitClassTemplateDecl()
4497 !D2Templated->isCompleteDefinition()) { in VisitClassTemplateDecl()
4498 // FIXME: Import definition! in VisitClassTemplateDecl()
4507 // but this particular declaration is not that definition, import the in VisitClassTemplateSpecializationDecl()
4509 TagDecl *Definition = D->getDefinition(); in VisitClassTemplateSpecializationDecl()
4511 Decl *ImportedDef = Importer.Import(Definition); in VisitClassTemplateSpecializationDecl()
4519 = cast_or_null<ClassTemplateDecl>(Importer.Import( in VisitClassTemplateSpecializationDecl()
4520 D->getSpecializedTemplate())); in VisitClassTemplateSpecializationDecl()
4524 // Import the context of this declaration. in VisitClassTemplateSpecializationDecl()
4525 DeclContext *DC = ClassTemplate->getDeclContext(); in VisitClassTemplateSpecializationDecl()
4530 if (D->getDeclContext() != D->getLexicalDeclContext()) { in VisitClassTemplateSpecializationDecl()
4531 LexicalDC = Importer.ImportContext(D->getLexicalDeclContext()); in VisitClassTemplateSpecializationDecl()
4536 // Import the location of this declaration. in VisitClassTemplateSpecializationDecl()
4537 SourceLocation StartLoc = Importer.Import(D->getLocStart()); in VisitClassTemplateSpecializationDecl()
4538 SourceLocation IdLoc = Importer.Import(D->getLocation()); in VisitClassTemplateSpecializationDecl()
4540 // Import template arguments. in VisitClassTemplateSpecializationDecl()
4542 if (ImportTemplateArguments(D->getTemplateArgs().data(), in VisitClassTemplateSpecializationDecl()
4543 D->getTemplateArgs().size(), in VisitClassTemplateSpecializationDecl()
4550 = ClassTemplate->findSpecialization(TemplateArgs, InsertPos); in VisitClassTemplateSpecializationDecl()
4557 if (RecordDecl *FoundDef = D2->getDefinition()) { in VisitClassTemplateSpecializationDecl()
4558 if (!D->isCompleteDefinition() || IsStructuralMatch(D, FoundDef)) { in VisitClassTemplateSpecializationDecl()
4568 D->getTagKind(), DC, in VisitClassTemplateSpecializationDecl()
4573 D2->setSpecializationKind(D->getSpecializationKind()); in VisitClassTemplateSpecializationDecl()
4576 ClassTemplate->AddSpecialization(D2, InsertPos); in VisitClassTemplateSpecializationDecl()
4578 // Import the qualifier, if any. in VisitClassTemplateSpecializationDecl()
4579 D2->setQualifierInfo(Importer.Import(D->getQualifierLoc())); in VisitClassTemplateSpecializationDecl()
4582 D2->setLexicalDeclContext(LexicalDC); in VisitClassTemplateSpecializationDecl()
4583 LexicalDC->addDeclInternal(D2); in VisitClassTemplateSpecializationDecl()
4587 if (D->isCompleteDefinition() && ImportDefinition(D, D2)) in VisitClassTemplateSpecializationDecl()
4596 // but this particular declaration is not that definition, import the in VisitVarTemplateDecl()
4599 cast_or_null<VarDecl>(D->getTemplatedDecl()->getDefinition()); in VisitVarTemplateDecl()
4600 if (Definition && Definition != D->getTemplatedDecl()) { in VisitVarTemplateDecl()
4601 Decl *ImportedDef = Importer.Import(Definition->getDescribedVarTemplate()); in VisitVarTemplateDecl()
4608 // Import the major distinguishing characteristics of this variable template. in VisitVarTemplateDecl()
4619 assert(!DC->isFunctionOrMethod() && in VisitVarTemplateDecl()
4623 DC->getRedeclContext()->localUncachedLookup(Name, FoundDecls); in VisitVarTemplateDecl()
4625 if (!FoundDecls[I]->isInIdentifierNamespace(Decl::IDNS_Ordinary)) in VisitVarTemplateDecl()
4632 Importer.Imported(D->getTemplatedDecl(), in VisitVarTemplateDecl()
4633 FoundTemplate->getTemplatedDecl()); in VisitVarTemplateDecl()
4650 VarDecl *DTemplated = D->getTemplatedDecl(); in VisitVarTemplateDecl()
4652 // Import the type. in VisitVarTemplateDecl()
4653 QualType T = Importer.Import(DTemplated->getType()); in VisitVarTemplateDecl()
4658 SourceLocation StartLoc = Importer.Import(DTemplated->getLocStart()); in VisitVarTemplateDecl()
4659 SourceLocation IdLoc = Importer.Import(DTemplated->getLocation()); in VisitVarTemplateDecl()
4660 TypeSourceInfo *TInfo = Importer.Import(DTemplated->getTypeSourceInfo()); in VisitVarTemplateDecl()
4663 TInfo, DTemplated->getStorageClass()); in VisitVarTemplateDecl()
4664 D2Templated->setAccess(DTemplated->getAccess()); in VisitVarTemplateDecl()
4665 D2Templated->setQualifierInfo(Importer.Import(DTemplated->getQualifierLoc())); in VisitVarTemplateDecl()
4666 D2Templated->setLexicalDeclContext(LexicalDC); in VisitVarTemplateDecl()
4669 // LexicalDC->addDeclInternal(D2Templated); in VisitVarTemplateDecl()
4677 ImportTemplateParameterList(D->getTemplateParameters()); in VisitVarTemplateDecl()
4683 D2Templated->setDescribedVarTemplate(D2); in VisitVarTemplateDecl()
4685 D2->setAccess(D->getAccess()); in VisitVarTemplateDecl()
4686 D2->setLexicalDeclContext(LexicalDC); in VisitVarTemplateDecl()
4687 LexicalDC->addDeclInternal(D2); in VisitVarTemplateDecl()
4693 if (DTemplated->isThisDeclarationADefinition() && in VisitVarTemplateDecl()
4694 !D2Templated->isThisDeclarationADefinition()) { in VisitVarTemplateDecl()
4695 // FIXME: Import definition! in VisitVarTemplateDecl()
4704 // but this particular declaration is not that definition, import the in VisitVarTemplateSpecializationDecl()
4706 VarDecl *Definition = D->getDefinition(); in VisitVarTemplateSpecializationDecl()
4708 Decl *ImportedDef = Importer.Import(Definition); in VisitVarTemplateSpecializationDecl()
4716 Importer.Import(D->getSpecializedTemplate())); in VisitVarTemplateSpecializationDecl()
4720 // Import the context of this declaration. in VisitVarTemplateSpecializationDecl()
4721 DeclContext *DC = VarTemplate->getDeclContext(); in VisitVarTemplateSpecializationDecl()
4726 if (D->getDeclContext() != D->getLexicalDeclContext()) { in VisitVarTemplateSpecializationDecl()
4727 LexicalDC = Importer.ImportContext(D->getLexicalDeclContext()); in VisitVarTemplateSpecializationDecl()
4732 // Import the location of this declaration. in VisitVarTemplateSpecializationDecl()
4733 SourceLocation StartLoc = Importer.Import(D->getLocStart()); in VisitVarTemplateSpecializationDecl()
4734 SourceLocation IdLoc = Importer.Import(D->getLocation()); in VisitVarTemplateSpecializationDecl()
4736 // Import template arguments. in VisitVarTemplateSpecializationDecl()
4738 if (ImportTemplateArguments(D->getTemplateArgs().data(), in VisitVarTemplateSpecializationDecl()
4739 D->getTemplateArgs().size(), TemplateArgs)) in VisitVarTemplateSpecializationDecl()
4744 VarTemplateSpecializationDecl *D2 = VarTemplate->findSpecialization( in VisitVarTemplateSpecializationDecl()
4752 if (VarDecl *FoundDef = D2->getDefinition()) { in VisitVarTemplateSpecializationDecl()
4753 if (!D->isThisDeclarationADefinition() || in VisitVarTemplateSpecializationDecl()
4763 // Import the type. in VisitVarTemplateSpecializationDecl()
4764 QualType T = Importer.Import(D->getType()); in VisitVarTemplateSpecializationDecl()
4767 TypeSourceInfo *TInfo = Importer.Import(D->getTypeSourceInfo()); in VisitVarTemplateSpecializationDecl()
4772 D->getStorageClass(), TemplateArgs); in VisitVarTemplateSpecializationDecl()
4773 D2->setSpecializationKind(D->getSpecializationKind()); in VisitVarTemplateSpecializationDecl()
4774 D2->setTemplateArgsInfo(D->getTemplateArgsInfo()); in VisitVarTemplateSpecializationDecl()
4777 VarTemplate->AddSpecialization(D2, InsertPos); in VisitVarTemplateSpecializationDecl()
4779 // Import the qualifier, if any. in VisitVarTemplateSpecializationDecl()
4780 D2->setQualifierInfo(Importer.Import(D->getQualifierLoc())); in VisitVarTemplateSpecializationDecl()
4783 D2->setLexicalDeclContext(LexicalDC); in VisitVarTemplateSpecializationDecl()
4784 LexicalDC->addDeclInternal(D2); in VisitVarTemplateSpecializationDecl()
4788 if (D->isThisDeclarationADefinition() && ImportDefinition(D, D2)) in VisitVarTemplateSpecializationDecl()
4794 //----------------------------------------------------------------------------
4795 // Import Statements
4796 //----------------------------------------------------------------------------
4801 size_t NumDecls = DG.end() - DG.begin(); in ImportDeclGroup()
4803 auto &_Importer = this->Importer; in ImportDeclGroup()
4805 [&_Importer](Decl *D) -> Decl * { in ImportDeclGroup()
4806 return _Importer.Import(D); in ImportDeclGroup()
4814 Importer.FromDiag(S->getLocStart(), diag::err_unsupported_ast_node) in VisitStmt()
4815 << S->getStmtClassName(); in VisitStmt()
4822 for (unsigned I = 0, E = S->getNumOutputs(); I != E; I++) { in VisitGCCAsmStmt()
4823 IdentifierInfo *ToII = Importer.Import(S->getOutputIdentifier(I)); in VisitGCCAsmStmt()
4828 for (unsigned I = 0, E = S->getNumInputs(); I != E; I++) { in VisitGCCAsmStmt()
4829 IdentifierInfo *ToII = Importer.Import(S->getInputIdentifier(I)); in VisitGCCAsmStmt()
4836 for (unsigned I = 0, E = S->getNumClobbers(); I != E; I++) { in VisitGCCAsmStmt()
4838 Importer.Import(S->getClobberStringLiteral(I))); in VisitGCCAsmStmt()
4845 for (unsigned I = 0, E = S->getNumOutputs(); I != E; I++) { in VisitGCCAsmStmt()
4847 Importer.Import(S->getOutputConstraintLiteral(I))); in VisitGCCAsmStmt()
4853 for (unsigned I = 0, E = S->getNumInputs(); I != E; I++) { in VisitGCCAsmStmt()
4855 Importer.Import(S->getInputConstraintLiteral(I))); in VisitGCCAsmStmt()
4861 SmallVector<Expr *, 4> Exprs(S->getNumOutputs() + S->getNumInputs()); in VisitGCCAsmStmt()
4862 if (ImportArrayChecked(S->begin_outputs(), S->end_outputs(), Exprs.begin())) in VisitGCCAsmStmt()
4865 if (ImportArrayChecked(S->begin_inputs(), S->end_inputs(), in VisitGCCAsmStmt()
4866 Exprs.begin() + S->getNumOutputs())) in VisitGCCAsmStmt()
4870 Importer.Import(S->getAsmString())); in VisitGCCAsmStmt()
4876 Importer.Import(S->getAsmLoc()), in VisitGCCAsmStmt()
4877 S->isSimple(), in VisitGCCAsmStmt()
4878 S->isVolatile(), in VisitGCCAsmStmt()
4879 S->getNumOutputs(), in VisitGCCAsmStmt()
4880 S->getNumInputs(), in VisitGCCAsmStmt()
4885 S->getNumClobbers(), in VisitGCCAsmStmt()
4887 Importer.Import(S->getRParenLoc())); in VisitGCCAsmStmt()
4891 DeclGroupRef ToDG = ImportDeclGroup(S->getDeclGroup()); in VisitDeclStmt()
4896 SourceLocation ToStartLoc = Importer.Import(S->getStartLoc()); in VisitDeclStmt()
4897 SourceLocation ToEndLoc = Importer.Import(S->getEndLoc()); in VisitDeclStmt()
4902 SourceLocation ToSemiLoc = Importer.Import(S->getSemiLoc()); in VisitNullStmt()
4904 S->hasLeadingEmptyMacro()); in VisitNullStmt()
4908 llvm::SmallVector<Stmt *, 8> ToStmts(S->size()); in VisitCompoundStmt()
4910 if (ImportArrayChecked(S->body_begin(), S->body_end(), ToStmts.begin())) in VisitCompoundStmt()
4913 SourceLocation ToLBraceLoc = Importer.Import(S->getLBracLoc()); in VisitCompoundStmt()
4914 SourceLocation ToRBraceLoc = Importer.Import(S->getRBracLoc()); in VisitCompoundStmt()
4921 Expr *ToLHS = Importer.Import(S->getLHS()); in VisitCaseStmt()
4924 Expr *ToRHS = Importer.Import(S->getRHS()); in VisitCaseStmt()
4925 if (!ToRHS && S->getRHS()) in VisitCaseStmt()
4927 SourceLocation ToCaseLoc = Importer.Import(S->getCaseLoc()); in VisitCaseStmt()
4928 SourceLocation ToEllipsisLoc = Importer.Import(S->getEllipsisLoc()); in VisitCaseStmt()
4929 SourceLocation ToColonLoc = Importer.Import(S->getColonLoc()); in VisitCaseStmt()
4936 SourceLocation ToDefaultLoc = Importer.Import(S->getDefaultLoc()); in VisitDefaultStmt()
4937 SourceLocation ToColonLoc = Importer.Import(S->getColonLoc()); in VisitDefaultStmt()
4938 Stmt *ToSubStmt = Importer.Import(S->getSubStmt()); in VisitDefaultStmt()
4939 if (!ToSubStmt && S->getSubStmt()) in VisitDefaultStmt()
4946 SourceLocation ToIdentLoc = Importer.Import(S->getIdentLoc()); in VisitLabelStmt()
4948 cast_or_null<LabelDecl>(Importer.Import(S->getDecl())); in VisitLabelStmt()
4949 if (!ToLabelDecl && S->getDecl()) in VisitLabelStmt()
4951 Stmt *ToSubStmt = Importer.Import(S->getSubStmt()); in VisitLabelStmt()
4952 if (!ToSubStmt && S->getSubStmt()) in VisitLabelStmt()
4959 SourceLocation ToAttrLoc = Importer.Import(S->getAttrLoc()); in VisitAttributedStmt()
4960 ArrayRef<const Attr*> FromAttrs(S->getAttrs()); in VisitAttributedStmt()
4964 [&_ToContext](const Attr *A) -> const Attr * { in VisitAttributedStmt()
4965 return A->clone(_ToContext); in VisitAttributedStmt()
4971 Stmt *ToSubStmt = Importer.Import(S->getSubStmt()); in VisitAttributedStmt()
4972 if (!ToSubStmt && S->getSubStmt()) in VisitAttributedStmt()
4979 SourceLocation ToIfLoc = Importer.Import(S->getIfLoc()); in VisitIfStmt()
4980 Stmt *ToInit = Importer.Import(S->getInit()); in VisitIfStmt()
4981 if (!ToInit && S->getInit()) in VisitIfStmt()
4984 if (VarDecl *FromConditionVariable = S->getConditionVariable()) { in VisitIfStmt()
4986 dyn_cast_or_null<VarDecl>(Importer.Import(FromConditionVariable)); in VisitIfStmt()
4990 Expr *ToCondition = Importer.Import(S->getCond()); in VisitIfStmt()
4991 if (!ToCondition && S->getCond()) in VisitIfStmt()
4993 Stmt *ToThenStmt = Importer.Import(S->getThen()); in VisitIfStmt()
4994 if (!ToThenStmt && S->getThen()) in VisitIfStmt()
4996 SourceLocation ToElseLoc = Importer.Import(S->getElseLoc()); in VisitIfStmt()
4997 Stmt *ToElseStmt = Importer.Import(S->getElse()); in VisitIfStmt()
4998 if (!ToElseStmt && S->getElse()) in VisitIfStmt()
5001 ToIfLoc, S->isConstexpr(), in VisitIfStmt()
5009 Stmt *ToInit = Importer.Import(S->getInit()); in VisitSwitchStmt()
5010 if (!ToInit && S->getInit()) in VisitSwitchStmt()
5013 if (VarDecl *FromConditionVariable = S->getConditionVariable()) { in VisitSwitchStmt()
5015 dyn_cast_or_null<VarDecl>(Importer.Import(FromConditionVariable)); in VisitSwitchStmt()
5019 Expr *ToCondition = Importer.Import(S->getCond()); in VisitSwitchStmt()
5020 if (!ToCondition && S->getCond()) in VisitSwitchStmt()
5025 Stmt *ToBody = Importer.Import(S->getBody()); in VisitSwitchStmt()
5026 if (!ToBody && S->getBody()) in VisitSwitchStmt()
5028 ToStmt->setBody(ToBody); in VisitSwitchStmt()
5029 ToStmt->setSwitchLoc(Importer.Import(S->getSwitchLoc())); in VisitSwitchStmt()
5030 // Now we have to re-chain the cases. in VisitSwitchStmt()
5032 for (SwitchCase *SC = S->getSwitchCaseList(); SC != nullptr; in VisitSwitchStmt()
5033 SC = SC->getNextSwitchCase()) { in VisitSwitchStmt()
5034 SwitchCase *ToSC = dyn_cast_or_null<SwitchCase>(Importer.Import(SC)); in VisitSwitchStmt()
5038 LastChainedSwitchCase->setNextSwitchCase(ToSC); in VisitSwitchStmt()
5040 ToStmt->setSwitchCaseList(ToSC); in VisitSwitchStmt()
5048 if (VarDecl *FromConditionVariable = S->getConditionVariable()) { in VisitWhileStmt()
5050 dyn_cast_or_null<VarDecl>(Importer.Import(FromConditionVariable)); in VisitWhileStmt()
5054 Expr *ToCondition = Importer.Import(S->getCond()); in VisitWhileStmt()
5055 if (!ToCondition && S->getCond()) in VisitWhileStmt()
5057 Stmt *ToBody = Importer.Import(S->getBody()); in VisitWhileStmt()
5058 if (!ToBody && S->getBody()) in VisitWhileStmt()
5060 SourceLocation ToWhileLoc = Importer.Import(S->getWhileLoc()); in VisitWhileStmt()
5068 Stmt *ToBody = Importer.Import(S->getBody()); in VisitDoStmt()
5069 if (!ToBody && S->getBody()) in VisitDoStmt()
5071 Expr *ToCondition = Importer.Import(S->getCond()); in VisitDoStmt()
5072 if (!ToCondition && S->getCond()) in VisitDoStmt()
5074 SourceLocation ToDoLoc = Importer.Import(S->getDoLoc()); in VisitDoStmt()
5075 SourceLocation ToWhileLoc = Importer.Import(S->getWhileLoc()); in VisitDoStmt()
5076 SourceLocation ToRParenLoc = Importer.Import(S->getRParenLoc()); in VisitDoStmt()
5083 Stmt *ToInit = Importer.Import(S->getInit()); in VisitForStmt()
5084 if (!ToInit && S->getInit()) in VisitForStmt()
5086 Expr *ToCondition = Importer.Import(S->getCond()); in VisitForStmt()
5087 if (!ToCondition && S->getCond()) in VisitForStmt()
5090 if (VarDecl *FromConditionVariable = S->getConditionVariable()) { in VisitForStmt()
5092 dyn_cast_or_null<VarDecl>(Importer.Import(FromConditionVariable)); in VisitForStmt()
5096 Expr *ToInc = Importer.Import(S->getInc()); in VisitForStmt()
5097 if (!ToInc && S->getInc()) in VisitForStmt()
5099 Stmt *ToBody = Importer.Import(S->getBody()); in VisitForStmt()
5100 if (!ToBody && S->getBody()) in VisitForStmt()
5102 SourceLocation ToForLoc = Importer.Import(S->getForLoc()); in VisitForStmt()
5103 SourceLocation ToLParenLoc = Importer.Import(S->getLParenLoc()); in VisitForStmt()
5104 SourceLocation ToRParenLoc = Importer.Import(S->getRParenLoc()); in VisitForStmt()
5115 if (LabelDecl *FromLabel = S->getLabel()) { in VisitGotoStmt()
5116 ToLabel = dyn_cast_or_null<LabelDecl>(Importer.Import(FromLabel)); in VisitGotoStmt()
5120 SourceLocation ToGotoLoc = Importer.Import(S->getGotoLoc()); in VisitGotoStmt()
5121 SourceLocation ToLabelLoc = Importer.Import(S->getLabelLoc()); in VisitGotoStmt()
5127 SourceLocation ToGotoLoc = Importer.Import(S->getGotoLoc()); in VisitIndirectGotoStmt()
5128 SourceLocation ToStarLoc = Importer.Import(S->getStarLoc()); in VisitIndirectGotoStmt()
5129 Expr *ToTarget = Importer.Import(S->getTarget()); in VisitIndirectGotoStmt()
5130 if (!ToTarget && S->getTarget()) in VisitIndirectGotoStmt()
5137 SourceLocation ToContinueLoc = Importer.Import(S->getContinueLoc()); in VisitContinueStmt()
5142 SourceLocation ToBreakLoc = Importer.Import(S->getBreakLoc()); in VisitBreakStmt()
5147 SourceLocation ToRetLoc = Importer.Import(S->getReturnLoc()); in VisitReturnStmt()
5148 Expr *ToRetExpr = Importer.Import(S->getRetValue()); in VisitReturnStmt()
5149 if (!ToRetExpr && S->getRetValue()) in VisitReturnStmt()
5151 VarDecl *NRVOCandidate = const_cast<VarDecl*>(S->getNRVOCandidate()); in VisitReturnStmt()
5152 VarDecl *ToNRVOCandidate = cast_or_null<VarDecl>(Importer.Import(NRVOCandidate)); in VisitReturnStmt()
5160 SourceLocation ToCatchLoc = Importer.Import(S->getCatchLoc()); in VisitCXXCatchStmt()
5162 if (VarDecl *FromExceptionDecl = S->getExceptionDecl()) { in VisitCXXCatchStmt()
5164 dyn_cast_or_null<VarDecl>(Importer.Import(FromExceptionDecl)); in VisitCXXCatchStmt()
5168 Stmt *ToHandlerBlock = Importer.Import(S->getHandlerBlock()); in VisitCXXCatchStmt()
5169 if (!ToHandlerBlock && S->getHandlerBlock()) in VisitCXXCatchStmt()
5177 SourceLocation ToTryLoc = Importer.Import(S->getTryLoc()); in VisitCXXTryStmt()
5178 Stmt *ToTryBlock = Importer.Import(S->getTryBlock()); in VisitCXXTryStmt()
5179 if (!ToTryBlock && S->getTryBlock()) in VisitCXXTryStmt()
5181 SmallVector<Stmt *, 1> ToHandlers(S->getNumHandlers()); in VisitCXXTryStmt()
5182 for (unsigned HI = 0, HE = S->getNumHandlers(); HI != HE; ++HI) { in VisitCXXTryStmt()
5183 CXXCatchStmt *FromHandler = S->getHandler(HI); in VisitCXXTryStmt()
5184 if (Stmt *ToHandler = Importer.Import(FromHandler)) in VisitCXXTryStmt()
5195 dyn_cast_or_null<DeclStmt>(Importer.Import(S->getRangeStmt())); in VisitCXXForRangeStmt()
5196 if (!ToRange && S->getRangeStmt()) in VisitCXXForRangeStmt()
5199 dyn_cast_or_null<DeclStmt>(Importer.Import(S->getBeginStmt())); in VisitCXXForRangeStmt()
5200 if (!ToBegin && S->getBeginStmt()) in VisitCXXForRangeStmt()
5203 dyn_cast_or_null<DeclStmt>(Importer.Import(S->getEndStmt())); in VisitCXXForRangeStmt()
5204 if (!ToEnd && S->getEndStmt()) in VisitCXXForRangeStmt()
5206 Expr *ToCond = Importer.Import(S->getCond()); in VisitCXXForRangeStmt()
5207 if (!ToCond && S->getCond()) in VisitCXXForRangeStmt()
5209 Expr *ToInc = Importer.Import(S->getInc()); in VisitCXXForRangeStmt()
5210 if (!ToInc && S->getInc()) in VisitCXXForRangeStmt()
5213 dyn_cast_or_null<DeclStmt>(Importer.Import(S->getLoopVarStmt())); in VisitCXXForRangeStmt()
5214 if (!ToLoopVar && S->getLoopVarStmt()) in VisitCXXForRangeStmt()
5216 Stmt *ToBody = Importer.Import(S->getBody()); in VisitCXXForRangeStmt()
5217 if (!ToBody && S->getBody()) in VisitCXXForRangeStmt()
5219 SourceLocation ToForLoc = Importer.Import(S->getForLoc()); in VisitCXXForRangeStmt()
5220 SourceLocation ToCoawaitLoc = Importer.Import(S->getCoawaitLoc()); in VisitCXXForRangeStmt()
5221 SourceLocation ToColonLoc = Importer.Import(S->getColonLoc()); in VisitCXXForRangeStmt()
5222 SourceLocation ToRParenLoc = Importer.Import(S->getRParenLoc()); in VisitCXXForRangeStmt()
5231 Stmt *ToElem = Importer.Import(S->getElement()); in VisitObjCForCollectionStmt()
5232 if (!ToElem && S->getElement()) in VisitObjCForCollectionStmt()
5234 Expr *ToCollect = Importer.Import(S->getCollection()); in VisitObjCForCollectionStmt()
5235 if (!ToCollect && S->getCollection()) in VisitObjCForCollectionStmt()
5237 Stmt *ToBody = Importer.Import(S->getBody()); in VisitObjCForCollectionStmt()
5238 if (!ToBody && S->getBody()) in VisitObjCForCollectionStmt()
5240 SourceLocation ToForLoc = Importer.Import(S->getForLoc()); in VisitObjCForCollectionStmt()
5241 SourceLocation ToRParenLoc = Importer.Import(S->getRParenLoc()); in VisitObjCForCollectionStmt()
5249 SourceLocation ToAtCatchLoc = Importer.Import(S->getAtCatchLoc()); in VisitObjCAtCatchStmt()
5250 SourceLocation ToRParenLoc = Importer.Import(S->getRParenLoc()); in VisitObjCAtCatchStmt()
5252 if (VarDecl *FromExceptionDecl = S->getCatchParamDecl()) { in VisitObjCAtCatchStmt()
5254 dyn_cast_or_null<VarDecl>(Importer.Import(FromExceptionDecl)); in VisitObjCAtCatchStmt()
5258 Stmt *ToBody = Importer.Import(S->getCatchBody()); in VisitObjCAtCatchStmt()
5259 if (!ToBody && S->getCatchBody()) in VisitObjCAtCatchStmt()
5268 SourceLocation ToAtFinallyLoc = Importer.Import(S->getAtFinallyLoc()); in VisitObjCAtFinallyStmt()
5269 Stmt *ToAtFinallyStmt = Importer.Import(S->getFinallyBody()); in VisitObjCAtFinallyStmt()
5270 if (!ToAtFinallyStmt && S->getFinallyBody()) in VisitObjCAtFinallyStmt()
5277 SourceLocation ToAtTryLoc = Importer.Import(S->getAtTryLoc()); in VisitObjCAtTryStmt()
5278 Stmt *ToAtTryStmt = Importer.Import(S->getTryBody()); in VisitObjCAtTryStmt()
5279 if (!ToAtTryStmt && S->getTryBody()) in VisitObjCAtTryStmt()
5281 SmallVector<Stmt *, 1> ToCatchStmts(S->getNumCatchStmts()); in VisitObjCAtTryStmt()
5282 for (unsigned CI = 0, CE = S->getNumCatchStmts(); CI != CE; ++CI) { in VisitObjCAtTryStmt()
5283 ObjCAtCatchStmt *FromCatchStmt = S->getCatchStmt(CI); in VisitObjCAtTryStmt()
5284 if (Stmt *ToCatchStmt = Importer.Import(FromCatchStmt)) in VisitObjCAtTryStmt()
5289 Stmt *ToAtFinallyStmt = Importer.Import(S->getFinallyStmt()); in VisitObjCAtTryStmt()
5290 if (!ToAtFinallyStmt && S->getFinallyStmt()) in VisitObjCAtTryStmt()
5301 Importer.Import(S->getAtSynchronizedLoc()); in VisitObjCAtSynchronizedStmt()
5302 Expr *ToSynchExpr = Importer.Import(S->getSynchExpr()); in VisitObjCAtSynchronizedStmt()
5303 if (!ToSynchExpr && S->getSynchExpr()) in VisitObjCAtSynchronizedStmt()
5305 Stmt *ToSynchBody = Importer.Import(S->getSynchBody()); in VisitObjCAtSynchronizedStmt()
5306 if (!ToSynchBody && S->getSynchBody()) in VisitObjCAtSynchronizedStmt()
5313 SourceLocation ToAtThrowLoc = Importer.Import(S->getThrowLoc()); in VisitObjCAtThrowStmt()
5314 Expr *ToThrow = Importer.Import(S->getThrowExpr()); in VisitObjCAtThrowStmt()
5315 if (!ToThrow && S->getThrowExpr()) in VisitObjCAtThrowStmt()
5322 SourceLocation ToAtLoc = Importer.Import(S->getAtLoc()); in VisitObjCAutoreleasePoolStmt()
5323 Stmt *ToSubStmt = Importer.Import(S->getSubStmt()); in VisitObjCAutoreleasePoolStmt()
5324 if (!ToSubStmt && S->getSubStmt()) in VisitObjCAutoreleasePoolStmt()
5330 //----------------------------------------------------------------------------
5331 // Import Expressions
5332 //----------------------------------------------------------------------------
5334 Importer.FromDiag(E->getLocStart(), diag::err_unsupported_ast_node) in VisitExpr()
5335 << E->getStmtClassName(); in VisitExpr()
5340 QualType T = Importer.Import(E->getType()); in VisitVAArgExpr()
5344 Expr *SubExpr = Importer.Import(E->getSubExpr()); in VisitVAArgExpr()
5345 if (!SubExpr && E->getSubExpr()) in VisitVAArgExpr()
5348 TypeSourceInfo *TInfo = Importer.Import(E->getWrittenTypeInfo()); in VisitVAArgExpr()
5353 Importer.Import(E->getBuiltinLoc()), SubExpr, TInfo, in VisitVAArgExpr()
5354 Importer.Import(E->getRParenLoc()), T, E->isMicrosoftABI()); in VisitVAArgExpr()
5359 QualType T = Importer.Import(E->getType()); in VisitGNUNullExpr()
5364 T, Importer.Import(E->getExprLoc())); in VisitGNUNullExpr()
5368 QualType T = Importer.Import(E->getType()); in VisitPredefinedExpr()
5373 Importer.Import(E->getFunctionName())); in VisitPredefinedExpr()
5374 if (!SL && E->getFunctionName()) in VisitPredefinedExpr()
5378 Importer.Import(E->getExprLoc()), T, E->getIdentType(), SL); in VisitPredefinedExpr()
5382 ValueDecl *ToD = cast_or_null<ValueDecl>(Importer.Import(E->getDecl())); in VisitDeclRefExpr()
5387 if (E->getDecl() != E->getFoundDecl()) { in VisitDeclRefExpr()
5388 FoundD = cast_or_null<NamedDecl>(Importer.Import(E->getFoundDecl())); in VisitDeclRefExpr()
5393 QualType T = Importer.Import(E->getType()); in VisitDeclRefExpr()
5398 Importer.Import(E->getQualifierLoc()), in VisitDeclRefExpr()
5399 Importer.Import(E->getTemplateKeywordLoc()), in VisitDeclRefExpr()
5401 E->refersToEnclosingVariableOrCapture(), in VisitDeclRefExpr()
5402 Importer.Import(E->getLocation()), in VisitDeclRefExpr()
5403 T, E->getValueKind(), in VisitDeclRefExpr()
5406 if (E->hadMultipleCandidates()) in VisitDeclRefExpr()
5407 DRE->setHadMultipleCandidates(true); in VisitDeclRefExpr()
5412 QualType T = Importer.Import(E->getType()); in VisitImplicitValueInitExpr()
5422 IdentifierInfo *ToFieldName = Importer.Import(D.getFieldName()); in ImportDesignator()
5423 // Caller checks for import error in ImportDesignator()
5424 return Designator(ToFieldName, Importer.Import(D.getDotLoc()), in ImportDesignator()
5425 Importer.Import(D.getFieldLoc())); in ImportDesignator()
5429 Importer.Import(D.getLBracketLoc()), in ImportDesignator()
5430 Importer.Import(D.getRBracketLoc())); in ImportDesignator()
5434 Importer.Import(D.getLBracketLoc()), in ImportDesignator()
5435 Importer.Import(D.getEllipsisLoc()), in ImportDesignator()
5436 Importer.Import(D.getRBracketLoc())); in ImportDesignator()
5441 Expr *Init = cast_or_null<Expr>(Importer.Import(DIE->getInit())); in VisitDesignatedInitExpr()
5445 SmallVector<Expr *, 4> IndexExprs(DIE->getNumSubExprs() - 1); in VisitDesignatedInitExpr()
5447 for (unsigned I = 1, E = DIE->getNumSubExprs(); I < E; I++) { in VisitDesignatedInitExpr()
5448 if (Expr *Arg = cast_or_null<Expr>(Importer.Import(DIE->getSubExpr(I)))) in VisitDesignatedInitExpr()
5449 IndexExprs[I - 1] = Arg; in VisitDesignatedInitExpr()
5454 SmallVector<Designator, 4> Designators(DIE->size()); in VisitDesignatedInitExpr()
5455 llvm::transform(DIE->designators(), Designators.begin(), in VisitDesignatedInitExpr()
5456 [this](const Designator &D) -> Designator { in VisitDesignatedInitExpr()
5460 for (const Designator &D : DIE->designators()) in VisitDesignatedInitExpr()
5466 IndexExprs, Importer.Import(DIE->getEqualOrColonLoc()), in VisitDesignatedInitExpr()
5467 DIE->usesGNUSyntax(), Init); in VisitDesignatedInitExpr()
5471 QualType T = Importer.Import(E->getType()); in VisitCXXNullPtrLiteralExpr()
5476 CXXNullPtrLiteralExpr(T, Importer.Import(E->getLocation())); in VisitCXXNullPtrLiteralExpr()
5480 QualType T = Importer.Import(E->getType()); in VisitIntegerLiteral()
5485 E->getValue(), T, in VisitIntegerLiteral()
5486 Importer.Import(E->getLocation())); in VisitIntegerLiteral()
5490 QualType T = Importer.Import(E->getType()); in VisitFloatingLiteral()
5495 E->getValue(), E->isExact(), T, in VisitFloatingLiteral()
5496 Importer.Import(E->getLocation())); in VisitFloatingLiteral()
5500 QualType T = Importer.Import(E->getType()); in VisitCharacterLiteral()
5504 return new (Importer.getToContext()) CharacterLiteral(E->getValue(), in VisitCharacterLiteral()
5505 E->getKind(), T, in VisitCharacterLiteral()
5506 Importer.Import(E->getLocation())); in VisitCharacterLiteral()
5510 QualType T = Importer.Import(E->getType()); in VisitStringLiteral()
5514 SmallVector<SourceLocation, 4> Locations(E->getNumConcatenated()); in VisitStringLiteral()
5515 ImportArray(E->tokloc_begin(), E->tokloc_end(), Locations.begin()); in VisitStringLiteral()
5517 return StringLiteral::Create(Importer.getToContext(), E->getBytes(), in VisitStringLiteral()
5518 E->getKind(), E->isPascal(), T, in VisitStringLiteral()
5523 QualType T = Importer.Import(E->getType()); in VisitCompoundLiteralExpr()
5527 TypeSourceInfo *TInfo = Importer.Import(E->getTypeSourceInfo()); in VisitCompoundLiteralExpr()
5531 Expr *Init = Importer.Import(E->getInitializer()); in VisitCompoundLiteralExpr()
5536 Importer.Import(E->getLParenLoc()), TInfo, T, E->getValueKind(), in VisitCompoundLiteralExpr()
5537 Init, E->isFileScope()); in VisitCompoundLiteralExpr()
5541 QualType T = Importer.Import(E->getType()); in VisitAtomicExpr()
5545 SmallVector<Expr *, 6> Exprs(E->getNumSubExprs()); in VisitAtomicExpr()
5547 E->getSubExprs(), E->getSubExprs() + E->getNumSubExprs(), in VisitAtomicExpr()
5552 Importer.Import(E->getBuiltinLoc()), Exprs, T, E->getOp(), in VisitAtomicExpr()
5553 Importer.Import(E->getRParenLoc())); in VisitAtomicExpr()
5557 QualType T = Importer.Import(E->getType()); in VisitAddrLabelExpr()
5561 LabelDecl *ToLabel = cast_or_null<LabelDecl>(Importer.Import(E->getLabel())); in VisitAddrLabelExpr()
5566 Importer.Import(E->getAmpAmpLoc()), Importer.Import(E->getLabelLoc()), in VisitAddrLabelExpr()
5571 Expr *SubExpr = Importer.Import(E->getSubExpr()); in VisitParenExpr()
5576 ParenExpr(Importer.Import(E->getLParen()), in VisitParenExpr()
5577 Importer.Import(E->getRParen()), in VisitParenExpr()
5582 SmallVector<Expr *, 4> Exprs(E->getNumExprs()); in VisitParenListExpr()
5584 E->getExprs(), E->getExprs() + E->getNumExprs(), Exprs.begin())) in VisitParenListExpr()
5588 Importer.getToContext(), Importer.Import(E->getLParenLoc()), in VisitParenListExpr()
5589 Exprs, Importer.Import(E->getLParenLoc())); in VisitParenListExpr()
5593 QualType T = Importer.Import(E->getType()); in VisitStmtExpr()
5598 Importer.Import(E->getSubStmt())); in VisitStmtExpr()
5599 if (!ToSubStmt && E->getSubStmt()) in VisitStmtExpr()
5603 Importer.Import(E->getLParenLoc()), Importer.Import(E->getRParenLoc())); in VisitStmtExpr()
5607 QualType T = Importer.Import(E->getType()); in VisitUnaryOperator()
5611 Expr *SubExpr = Importer.Import(E->getSubExpr()); in VisitUnaryOperator()
5615 return new (Importer.getToContext()) UnaryOperator(SubExpr, E->getOpcode(), in VisitUnaryOperator()
5616 T, E->getValueKind(), in VisitUnaryOperator()
5617 E->getObjectKind(), in VisitUnaryOperator()
5618 … Importer.Import(E->getOperatorLoc())); in VisitUnaryOperator()
5623 QualType ResultType = Importer.Import(E->getType()); in VisitUnaryExprOrTypeTraitExpr()
5625 if (E->isArgumentType()) { in VisitUnaryExprOrTypeTraitExpr()
5626 TypeSourceInfo *TInfo = Importer.Import(E->getArgumentTypeInfo()); in VisitUnaryExprOrTypeTraitExpr()
5630 return new (Importer.getToContext()) UnaryExprOrTypeTraitExpr(E->getKind(), in VisitUnaryExprOrTypeTraitExpr()
5632 Importer.Import(E->getOperatorLoc()), in VisitUnaryExprOrTypeTraitExpr()
5633 Importer.Import(E->getRParenLoc())); in VisitUnaryExprOrTypeTraitExpr()
5636 Expr *SubExpr = Importer.Import(E->getArgumentExpr()); in VisitUnaryExprOrTypeTraitExpr()
5640 return new (Importer.getToContext()) UnaryExprOrTypeTraitExpr(E->getKind(), in VisitUnaryExprOrTypeTraitExpr()
5642 Importer.Import(E->getOperatorLoc()), in VisitUnaryExprOrTypeTraitExpr()
5643 Importer.Import(E->getRParenLoc())); in VisitUnaryExprOrTypeTraitExpr()
5647 QualType T = Importer.Import(E->getType()); in VisitBinaryOperator()
5651 Expr *LHS = Importer.Import(E->getLHS()); in VisitBinaryOperator()
5655 Expr *RHS = Importer.Import(E->getRHS()); in VisitBinaryOperator()
5659 return new (Importer.getToContext()) BinaryOperator(LHS, RHS, E->getOpcode(), in VisitBinaryOperator()
5660 T, E->getValueKind(), in VisitBinaryOperator()
5661 E->getObjectKind(), in VisitBinaryOperator()
5662 Importer.Import(E->getOperatorLoc()), in VisitBinaryOperator()
5663 E->isFPContractable()); in VisitBinaryOperator()
5667 QualType T = Importer.Import(E->getType()); in VisitConditionalOperator()
5671 Expr *ToLHS = Importer.Import(E->getLHS()); in VisitConditionalOperator()
5675 Expr *ToRHS = Importer.Import(E->getRHS()); in VisitConditionalOperator()
5679 Expr *ToCond = Importer.Import(E->getCond()); in VisitConditionalOperator()
5684 ToCond, Importer.Import(E->getQuestionLoc()), in VisitConditionalOperator()
5685 ToLHS, Importer.Import(E->getColonLoc()), in VisitConditionalOperator()
5686 ToRHS, T, E->getValueKind(), E->getObjectKind()); in VisitConditionalOperator()
5691 QualType T = Importer.Import(E->getType()); in VisitBinaryConditionalOperator()
5695 Expr *Common = Importer.Import(E->getCommon()); in VisitBinaryConditionalOperator()
5699 Expr *Cond = Importer.Import(E->getCond()); in VisitBinaryConditionalOperator()
5704 Importer.Import(E->getOpaqueValue())); in VisitBinaryConditionalOperator()
5708 Expr *TrueExpr = Importer.Import(E->getTrueExpr()); in VisitBinaryConditionalOperator()
5712 Expr *FalseExpr = Importer.Import(E->getFalseExpr()); in VisitBinaryConditionalOperator()
5718 Importer.Import(E->getQuestionLoc()), Importer.Import(E->getColonLoc()), in VisitBinaryConditionalOperator()
5719 T, E->getValueKind(), E->getObjectKind()); in VisitBinaryConditionalOperator()
5723 QualType T = Importer.Import(E->getType()); in VisitOpaqueValueExpr()
5727 Expr *SourceExpr = Importer.Import(E->getSourceExpr()); in VisitOpaqueValueExpr()
5728 if (!SourceExpr && E->getSourceExpr()) in VisitOpaqueValueExpr()
5732 Importer.Import(E->getExprLoc()), T, E->getValueKind(), in VisitOpaqueValueExpr()
5733 E->getObjectKind(), SourceExpr); in VisitOpaqueValueExpr()
5737 QualType T = Importer.Import(E->getType()); in VisitCompoundAssignOperator()
5741 QualType CompLHSType = Importer.Import(E->getComputationLHSType()); in VisitCompoundAssignOperator()
5745 QualType CompResultType = Importer.Import(E->getComputationResultType()); in VisitCompoundAssignOperator()
5749 Expr *LHS = Importer.Import(E->getLHS()); in VisitCompoundAssignOperator()
5753 Expr *RHS = Importer.Import(E->getRHS()); in VisitCompoundAssignOperator()
5758 CompoundAssignOperator(LHS, RHS, E->getOpcode(), in VisitCompoundAssignOperator()
5759 T, E->getValueKind(), in VisitCompoundAssignOperator()
5760 E->getObjectKind(), in VisitCompoundAssignOperator()
5762 Importer.Import(E->getOperatorLoc()), in VisitCompoundAssignOperator()
5763 E->isFPContractable()); in VisitCompoundAssignOperator()
5767 if (E->path_empty()) return false; in ImportCastPath()
5769 // TODO: import cast paths in ImportCastPath()
5774 QualType T = Importer.Import(E->getType()); in VisitImplicitCastExpr()
5778 Expr *SubExpr = Importer.Import(E->getSubExpr()); in VisitImplicitCastExpr()
5786 return ImplicitCastExpr::Create(Importer.getToContext(), T, E->getCastKind(), in VisitImplicitCastExpr()
5787 SubExpr, &BasePath, E->getValueKind()); in VisitImplicitCastExpr()
5791 QualType T = Importer.Import(E->getType()); in VisitCStyleCastExpr()
5795 Expr *SubExpr = Importer.Import(E->getSubExpr()); in VisitCStyleCastExpr()
5799 TypeSourceInfo *TInfo = Importer.Import(E->getTypeInfoAsWritten()); in VisitCStyleCastExpr()
5800 if (!TInfo && E->getTypeInfoAsWritten()) in VisitCStyleCastExpr()
5808 E->getValueKind(), E->getCastKind(), in VisitCStyleCastExpr()
5810 Importer.Import(E->getLParenLoc()), in VisitCStyleCastExpr()
5811 Importer.Import(E->getRParenLoc())); in VisitCStyleCastExpr()
5815 QualType T = Importer.Import(E->getType()); in VisitCXXConstructExpr()
5820 dyn_cast_or_null<CXXConstructorDecl>(Importer.Import(E->getConstructor())); in VisitCXXConstructExpr()
5824 SmallVector<Expr *, 6> ToArgs(E->getNumArgs()); in VisitCXXConstructExpr()
5825 if (ImportArrayChecked(E->getArgs(), E->getArgs() + E->getNumArgs(), in VisitCXXConstructExpr()
5830 Importer.Import(E->getLocation()), in VisitCXXConstructExpr()
5831 ToCCD, E->isElidable(), in VisitCXXConstructExpr()
5832 ToArgs, E->hadMultipleCandidates(), in VisitCXXConstructExpr()
5833 E->isListInitialization(), in VisitCXXConstructExpr()
5834 E->isStdInitListInitialization(), in VisitCXXConstructExpr()
5835 E->requiresZeroInitialization(), in VisitCXXConstructExpr()
5836 E->getConstructionKind(), in VisitCXXConstructExpr()
5837 Importer.Import(E->getParenOrBraceRange())); in VisitCXXConstructExpr()
5841 QualType T = Importer.Import(E->getType()); in VisitCXXMemberCallExpr()
5845 Expr *ToFn = Importer.Import(E->getCallee()); in VisitCXXMemberCallExpr()
5849 SmallVector<Expr *, 4> ToArgs(E->getNumArgs()); in VisitCXXMemberCallExpr()
5851 if (ImportArrayChecked(E->arg_begin(), E->arg_end(), ToArgs.begin())) in VisitCXXMemberCallExpr()
5855 Importer.getToContext(), ToFn, ToArgs, T, E->getValueKind(), in VisitCXXMemberCallExpr()
5856 Importer.Import(E->getRParenLoc())); in VisitCXXMemberCallExpr()
5860 QualType T = Importer.Import(E->getType()); in VisitCXXThisExpr()
5865 CXXThisExpr(Importer.Import(E->getLocation()), T, E->isImplicit()); in VisitCXXThisExpr()
5869 QualType T = Importer.Import(E->getType()); in VisitCXXBoolLiteralExpr()
5874 CXXBoolLiteralExpr(E->getValue(), T, Importer.Import(E->getLocation())); in VisitCXXBoolLiteralExpr()
5879 QualType T = Importer.Import(E->getType()); in VisitMemberExpr()
5883 Expr *ToBase = Importer.Import(E->getBase()); in VisitMemberExpr()
5884 if (!ToBase && E->getBase()) in VisitMemberExpr()
5887 ValueDecl *ToMember = dyn_cast<ValueDecl>(Importer.Import(E->getMemberDecl())); in VisitMemberExpr()
5888 if (!ToMember && E->getMemberDecl()) in VisitMemberExpr()
5892 dyn_cast<NamedDecl>(Importer.Import(E->getFoundDecl().getDecl())), in VisitMemberExpr()
5893 E->getFoundDecl().getAccess()); in VisitMemberExpr()
5896 Importer.Import(E->getMemberNameInfo().getName()), in VisitMemberExpr()
5897 Importer.Import(E->getMemberNameInfo().getLoc())); in VisitMemberExpr()
5899 if (E->hasExplicitTemplateArgs()) { in VisitMemberExpr()
5904 E->isArrow(), in VisitMemberExpr()
5905 Importer.Import(E->getOperatorLoc()), in VisitMemberExpr()
5906 Importer.Import(E->getQualifierLoc()), in VisitMemberExpr()
5907 Importer.Import(E->getTemplateKeywordLoc()), in VisitMemberExpr()
5909 nullptr, T, E->getValueKind(), in VisitMemberExpr()
5910 E->getObjectKind()); in VisitMemberExpr()
5914 QualType T = Importer.Import(E->getType()); in VisitCallExpr()
5918 Expr *ToCallee = Importer.Import(E->getCallee()); in VisitCallExpr()
5919 if (!ToCallee && E->getCallee()) in VisitCallExpr()
5922 unsigned NumArgs = E->getNumArgs(); in VisitCallExpr()
5927 Expr *FromArg = E->getArg(ai); in VisitCallExpr()
5928 Expr *ToArg = Importer.Import(FromArg); in VisitCallExpr()
5942 llvm::makeArrayRef(ToArgs_Copied, NumArgs), T, E->getValueKind(), in VisitCallExpr()
5943 Importer.Import(E->getRParenLoc())); in VisitCallExpr()
5947 QualType T = Importer.Import(ILE->getType()); in VisitInitListExpr()
5951 llvm::SmallVector<Expr *, 4> Exprs(ILE->getNumInits()); in VisitInitListExpr()
5953 ILE->getInits(), ILE->getInits() + ILE->getNumInits(), Exprs.begin())) in VisitInitListExpr()
5958 ToCtx, Importer.Import(ILE->getLBraceLoc()), in VisitInitListExpr()
5959 Exprs, Importer.Import(ILE->getLBraceLoc())); in VisitInitListExpr()
5960 To->setType(T); in VisitInitListExpr()
5962 if (ILE->hasArrayFiller()) { in VisitInitListExpr()
5963 Expr *Filler = Importer.Import(ILE->getArrayFiller()); in VisitInitListExpr()
5966 To->setArrayFiller(Filler); in VisitInitListExpr()
5969 if (FieldDecl *FromFD = ILE->getInitializedFieldInUnion()) { in VisitInitListExpr()
5970 FieldDecl *ToFD = cast_or_null<FieldDecl>(Importer.Import(FromFD)); in VisitInitListExpr()
5973 To->setInitializedFieldInUnion(ToFD); in VisitInitListExpr()
5976 if (InitListExpr *SyntForm = ILE->getSyntacticForm()) { in VisitInitListExpr()
5978 Importer.Import(SyntForm)); in VisitInitListExpr()
5981 To->setSyntacticForm(ToSyntForm); in VisitInitListExpr()
5984 To->sawArrayRangeDesignator(ILE->hadArrayRangeDesignator()); in VisitInitListExpr()
5985 To->setValueDependent(ILE->isValueDependent()); in VisitInitListExpr()
5986 To->setInstantiationDependent(ILE->isInstantiationDependent()); in VisitInitListExpr()
5993 Importer.Import(DIE->getField())); in VisitCXXDefaultInitExpr()
5994 if (!ToField && DIE->getField()) in VisitCXXDefaultInitExpr()
5998 Importer.getToContext(), Importer.Import(DIE->getLocStart()), ToField); in VisitCXXDefaultInitExpr()
6002 QualType ToType = Importer.Import(E->getType()); in VisitCXXNamedCastExpr()
6003 if (ToType.isNull() && !E->getType().isNull()) in VisitCXXNamedCastExpr()
6005 ExprValueKind VK = E->getValueKind(); in VisitCXXNamedCastExpr()
6006 CastKind CK = E->getCastKind(); in VisitCXXNamedCastExpr()
6007 Expr *ToOp = Importer.Import(E->getSubExpr()); in VisitCXXNamedCastExpr()
6008 if (!ToOp && E->getSubExpr()) in VisitCXXNamedCastExpr()
6013 TypeSourceInfo *ToWritten = Importer.Import(E->getTypeInfoAsWritten()); in VisitCXXNamedCastExpr()
6014 SourceLocation ToOperatorLoc = Importer.Import(E->getOperatorLoc()); in VisitCXXNamedCastExpr()
6015 SourceLocation ToRParenLoc = Importer.Import(E->getRParenLoc()); in VisitCXXNamedCastExpr()
6016 SourceRange ToAngleBrackets = Importer.Import(E->getAngleBrackets()); in VisitCXXNamedCastExpr()
6048 QualType ASTImporter::Import(QualType FromT) { in Import() function in ASTImporter
6058 return ToContext.getQualifiedType(Pos->second, FromT.getLocalQualifiers()); in Import()
6060 // Import the type in Import()
6072 TypeSourceInfo *ASTImporter::Import(TypeSourceInfo *FromTSI) { in Import() function in ASTImporter
6078 QualType T = Import(FromTSI->getType()); in Import()
6083 Import(FromTSI->getTypeLoc().getLocStart())); in Import()
6089 Decl *ToD = Pos->second; in GetAlreadyImportedOrNull()
6097 Decl *ASTImporter::Import(Decl *FromD) { in Import() function in ASTImporter
6106 Decl *ToD = Pos->second; in Import()
6111 // Import the type in Import()
6121 if (FromTag->getTypedefNameForAnonDecl()) in Import()
6130 if ((*FromTag)->getTypedefNameForAnonDecl() == FromTypedef) { in Import()
6131 if (TagDecl *ToTag = cast_or_null<TagDecl>(Import(*FromTag))) { in Import()
6133 ToTag->setTypedefNameForAnonDecl(cast<TypedefNameDecl>(ToD)); in Import()
6148 DeclContext *ToDC = cast_or_null<DeclContext>(Import(cast<Decl>(FromDC))); in ImportContext()
6152 // When we're using a record/enum/Objective-C class/protocol as a context, we in ImportContext()
6156 if (ToRecord->isCompleteDefinition()) { in ImportContext()
6158 } else if (FromRecord->isCompleteDefinition()) { in ImportContext()
6166 if (ToEnum->isCompleteDefinition()) { in ImportContext()
6168 } else if (FromEnum->isCompleteDefinition()) { in ImportContext()
6176 if (ToClass->getDefinition()) { in ImportContext()
6178 } else if (ObjCInterfaceDecl *FromDef = FromClass->getDefinition()) { in ImportContext()
6186 if (ToProto->getDefinition()) { in ImportContext()
6188 } else if (ObjCProtocolDecl *FromDef = FromProto->getDefinition()) { in ImportContext()
6199 Expr *ASTImporter::Import(Expr *FromE) { in Import() function in ASTImporter
6203 return cast_or_null<Expr>(Import(cast<Stmt>(FromE))); in Import()
6206 Stmt *ASTImporter::Import(Stmt *FromS) { in Import() function in ASTImporter
6213 return Pos->second; in Import()
6215 // Import the type in Import()
6226 NestedNameSpecifier *ASTImporter::Import(NestedNameSpecifier *FromNNS) { in Import() function in ASTImporter
6230 NestedNameSpecifier *prefix = Import(FromNNS->getPrefix()); in Import()
6232 switch (FromNNS->getKind()) { in Import()
6234 if (IdentifierInfo *II = Import(FromNNS->getAsIdentifier())) { in Import()
6241 cast<NamespaceDecl>(Import(FromNNS->getAsNamespace()))) { in Import()
6248 cast<NamespaceAliasDecl>(Import(FromNNS->getAsNamespaceAlias()))) { in Import()
6258 cast<CXXRecordDecl>(Import(FromNNS->getAsRecordDecl()))) { in Import()
6265 QualType T = Import(QualType(FromNNS->getAsType(), 0u)); in Import()
6267 bool bTemplate = FromNNS->getKind() == in Import()
6279 NestedNameSpecifierLoc ASTImporter::Import(NestedNameSpecifierLoc FromNNS) { in Import() function in ASTImporter
6284 TemplateName ASTImporter::Import(TemplateName From) { in Import() function in ASTImporter
6288 = cast_or_null<TemplateDecl>(Import(From.getAsTemplateDecl()))) in Import()
6296 for (OverloadedTemplateStorage::iterator I = FromStorage->begin(), in Import()
6297 E = FromStorage->end(); in Import()
6299 if (NamedDecl *To = cast_or_null<NamedDecl>(Import(*I))) in Import()
6310 NestedNameSpecifier *Qualifier = Import(QTN->getQualifier()); in Import()
6315 = cast_or_null<TemplateDecl>(Import(From.getAsTemplateDecl()))) in Import()
6317 QTN->hasTemplateKeyword(), in Import()
6325 NestedNameSpecifier *Qualifier = Import(DTN->getQualifier()); in Import()
6329 if (DTN->isIdentifier()) { in Import()
6331 Import(DTN->getIdentifier())); in Import()
6334 return ToContext.getDependentTemplateName(Qualifier, DTN->getOperator()); in Import()
6341 = cast_or_null<TemplateTemplateParmDecl>(Import(subst->getParameter())); in Import()
6345 TemplateName replacement = Import(subst->getReplacement()); in Import()
6356 Import(SubstPack->getParameterPack())); in Import()
6362 = Importer.ImportTemplateArgument(SubstPack->getArgumentPack()); in Import()
6373 SourceLocation ASTImporter::Import(SourceLocation FromLoc) { in Import() function in ASTImporter
6380 // don't have to import macro expansions. in Import()
6381 // FIXME: Import macro expansions! in Import()
6385 FileID ToFileID = Import(Decomposed.first); in Import()
6393 SourceRange ASTImporter::Import(SourceRange FromRange) { in Import() function in ASTImporter
6394 return SourceRange(Import(FromRange.getBegin()), Import(FromRange.getEnd())); in Import()
6397 FileID ASTImporter::Import(FileID FromID) { in Import() function in ASTImporter
6401 return Pos->second; in Import()
6409 SourceLocation ToIncludeLoc = Import(FromSLoc.getFile().getIncludeLoc()); in Import()
6414 if (Cache->OrigEntry && Cache->OrigEntry->getDir()) { in Import()
6417 // FIXME: We definitely want to re-use the existing MemoryBuffer, rather in Import()
6419 const FileEntry *Entry = ToFileManager.getFile(Cache->OrigEntry->getName()); in Import()
6425 // FIXME: We want to re-use the existing MemoryBuffer! in Import()
6427 FromBuf = Cache->getBuffer(FromContext.getDiagnostics(), FromSM); in Import()
6429 = llvm::MemoryBuffer::getMemBufferCopy(FromBuf->getBuffer(), in Import()
6430 FromBuf->getBufferIdentifier()); in Import()
6440 CXXCtorInitializer *ASTImporter::Import(CXXCtorInitializer *From) { in Import() function in ASTImporter
6441 Expr *ToExpr = Import(From->getInit()); in Import()
6442 if (!ToExpr && From->getInit()) in Import()
6445 if (From->isBaseInitializer()) { in Import()
6446 TypeSourceInfo *ToTInfo = Import(From->getTypeSourceInfo()); in Import()
6447 if (!ToTInfo && From->getTypeSourceInfo()) in Import()
6451 ToContext, ToTInfo, From->isBaseVirtual(), Import(From->getLParenLoc()), in Import()
6452 ToExpr, Import(From->getRParenLoc()), in Import()
6453 From->isPackExpansion() ? Import(From->getEllipsisLoc()) in Import()
6455 } else if (From->isMemberInitializer()) { in Import()
6457 llvm::cast_or_null<FieldDecl>(Import(From->getMember())); in Import()
6458 if (!ToField && From->getMember()) in Import()
6462 ToContext, ToField, Import(From->getMemberLocation()), in Import()
6463 Import(From->getLParenLoc()), ToExpr, Import(From->getRParenLoc())); in Import()
6464 } else if (From->isIndirectMemberInitializer()) { in Import()
6466 Import(From->getIndirectMember())); in Import()
6467 if (!ToIField && From->getIndirectMember()) in Import()
6471 ToContext, ToIField, Import(From->getMemberLocation()), in Import()
6472 Import(From->getLParenLoc()), ToExpr, Import(From->getRParenLoc())); in Import()
6473 } else if (From->isDelegatingInitializer()) { in Import()
6474 TypeSourceInfo *ToTInfo = Import(From->getTypeSourceInfo()); in Import()
6475 if (!ToTInfo && From->getTypeSourceInfo()) in Import()
6479 CXXCtorInitializer(ToContext, ToTInfo, Import(From->getLParenLoc()), in Import()
6480 ToExpr, Import(From->getRParenLoc())); in Import()
6481 } else if (unsigned NumArrayIndices = From->getNumArrayIndices()) { in Import()
6483 llvm::cast_or_null<FieldDecl>(Import(From->getMember())); in Import()
6484 if (!ToField && From->getMember()) in Import()
6491 dyn_cast_or_null<VarDecl>(Import(From->getArrayIndex(AII))); in Import()
6492 if (!ToArrayIndex && From->getArrayIndex(AII)) in Import()
6497 ToContext, ToField, Import(From->getMemberLocation()), in Import()
6498 Import(From->getLParenLoc()), ToExpr, Import(From->getRParenLoc()), in Import()
6507 Decl *To = Import(From); in ImportDefinition()
6515 if (!ToRecord->getDefinition()) { in ImportDefinition()
6523 if (!ToEnum->getDefinition()) { in ImportDefinition()
6531 if (!ToIFace->getDefinition()) { in ImportDefinition()
6539 if (!ToProto->getDefinition()) { in ImportDefinition()
6550 DeclarationName ASTImporter::Import(DeclarationName FromName) { in Import() function in ASTImporter
6556 return Import(FromName.getAsIdentifierInfo()); in Import()
6561 return Import(FromName.getObjCSelector()); in Import()
6564 QualType T = Import(FromName.getCXXNameType()); in Import()
6573 QualType T = Import(FromName.getCXXNameType()); in Import()
6582 QualType T = Import(FromName.getCXXNameType()); in Import()
6596 Import(FromName.getCXXLiteralIdentifier())); in Import()
6606 IdentifierInfo *ASTImporter::Import(const IdentifierInfo *FromId) { in Import() function in ASTImporter
6610 IdentifierInfo *ToId = &ToContext.Idents.get(FromId->getName()); in Import()
6612 if (!ToId->getBuiltinID() && FromId->getBuiltinID()) in Import()
6613 ToId->setBuiltinID(FromId->getBuiltinID()); in Import()
6618 Selector ASTImporter::Import(Selector FromSel) { in Import() function in ASTImporter
6623 Idents.push_back(Import(FromSel.getIdentifierInfoForSlot(0))); in Import()
6625 Idents.push_back(Import(FromSel.getIdentifierInfoForSlot(I))); in Import()
6655 if (!ID->getDefinition()) in CompleteDecl()
6656 ID->startDefinition(); in CompleteDecl()
6659 if (!PD->getDefinition()) in CompleteDecl()
6660 PD->startDefinition(); in CompleteDecl()
6663 if (!TD->getDefinition() && !TD->isBeingDefined()) { in CompleteDecl()
6664 TD->startDefinition(); in CompleteDecl()
6665 TD->setCompleteDefinition(true); in CompleteDecl()
6674 if (From->hasAttrs()) { in Imported()
6675 for (Attr *FromAttr : From->getAttrs()) in Imported()
6676 To->addAttr(FromAttr->clone(To->getASTContext())); in Imported()
6678 if (From->isUsed()) { in Imported()
6679 To->setIsUsed(); in Imported()
6681 if (From->isImplicit()) { in Imported()
6682 To->setImplicit(); in Imported()
6692 if (Pos != ImportedTypes.end() && ToContext.hasSameType(Import(From), To)) in IsStructurallyEquivalent()