56 #include "llvm/ADT/APSInt.h" 57 #include "llvm/ADT/ArrayRef.h" 58 #include "llvm/ADT/DenseMap.h" 59 #include "llvm/ADT/None.h" 60 #include "llvm/ADT/Optional.h" 61 #include "llvm/ADT/STLExtras.h" 62 #include "llvm/ADT/SmallVector.h" 63 #include "llvm/Support/Casting.h" 64 #include "llvm/Support/ErrorHandling.h" 65 #include "llvm/Support/MemoryBuffer.h" 70 #include <type_traits> 75 using llvm::make_error;
88 return "NameConflict";
90 return "UnsupportedConstruct";
92 return "Unknown error";
94 llvm_unreachable(
"Invalid error code.");
95 return "Invalid error code.";
103 llvm_unreachable(
"Function not implemented.");
114 Redecls.push_back(R);
117 std::reverse(Redecls.begin(), Redecls.end());
122 if (
auto *FD = dyn_cast<FunctionDecl>(D))
123 return getCanonicalForwardRedeclChain<FunctionDecl>(FD);
124 if (
auto *VD = dyn_cast<VarDecl>(D))
125 return getCanonicalForwardRedeclChain<VarDecl>(VD);
126 if (
auto *TD = dyn_cast<TagDecl>(D))
127 return getCanonicalForwardRedeclChain<TagDecl>(TD);
128 llvm_unreachable(
"Bad declaration kind");
144 return llvm::make_error<ImportError>();
145 return Error::success();
153 return llvm::make_error<ImportError>();
154 return Error::success();
159 public StmtVisitor<ASTNodeImporter, ExpectedStmt> {
163 template <
typename ImportT>
164 LLVM_NODISCARD
Error importInto(ImportT &To,
const ImportT &From) {
169 template <
typename ImportT>
170 LLVM_NODISCARD
Error importInto(ImportT *&To, ImportT *From) {
171 auto ToI = Importer.
Import(From);
173 return make_error<ImportError>();
174 To = cast_or_null<ImportT>(ToI);
175 return Error::success();
186 template <
typename T>
188 auto *To = Importer.
Import(From);
190 return make_error<ImportError>();
191 return cast_or_null<T>(To);
199 template <
typename T>
201 return import(
const_cast<T *
>(From));
205 template <
typename T>
207 T To = Importer.
Import(From);
209 if (To == DefaultT && !(From == DefaultT))
210 return make_error<ImportError>();
218 importSeq(
const T &From) {
221 return ToOrErr.takeError();
222 return std::make_tuple<T>(std::move(*ToOrErr));
229 template <
class THead,
class... TTail>
230 Expected<std::tuple<THead, TTail...>>
231 importSeq(
const THead &FromHead,
const TTail &...FromTail) {
234 return ToHeadOrErr.takeError();
235 Expected<std::tuple<TTail...>> ToTailOrErr = importSeq(FromTail...);
237 return ToTailOrErr.takeError();
238 return std::tuple_cat(*ToHeadOrErr, *ToTailOrErr);
242 template <
typename ToDeclT>
struct CallOverloadedCreateFun {
243 template <
typename... Args>
244 auto operator()(Args &&... args)
256 template <
typename ToDeclT,
typename FromDeclT,
typename... Args>
257 LLVM_NODISCARD
bool GetImportedOrCreateDecl(ToDeclT *&ToD, FromDeclT *FromD,
262 CallOverloadedCreateFun<ToDeclT> OC;
263 return GetImportedOrCreateSpecialDecl(ToD, OC, FromD,
264 std::forward<Args>(args)...);
271 template <
typename NewDeclT,
typename ToDeclT,
typename FromDeclT,
273 LLVM_NODISCARD
bool GetImportedOrCreateDecl(ToDeclT *&ToD, FromDeclT *FromD,
275 CallOverloadedCreateFun<NewDeclT> OC;
276 return GetImportedOrCreateSpecialDecl(ToD, OC, FromD,
277 std::forward<Args>(args)...);
281 template <
typename ToDeclT,
typename CreateFunT,
typename FromDeclT,
284 GetImportedOrCreateSpecialDecl(ToDeclT *&ToD, CreateFunT CreateFun,
285 FromDeclT *FromD, Args &&... args) {
294 ToD = CreateFun(std::forward<Args>(args)...);
297 Importer.AddToLookupTable(ToD);
298 InitializeImportedDecl(FromD, ToD);
302 void InitializeImportedDecl(
Decl *FromD,
Decl *ToD) {
369 Error ImportDeclParts(
372 Error ImportDefinitionIfNeeded(
Decl *FromD,
Decl *ToD =
nullptr);
373 Error ImportDeclarationNameLoc(
376 Error ImportDeclContext(
398 return IDK == IDK_Everything ||
403 Error ImportDefinition(
406 Error ImportDefinition(
409 Error ImportDefinition(
412 Error ImportDefinition(
417 Error ImportTemplateArguments(
423 template <
typename InContainerTy>
424 Error ImportTemplateArgumentListInfo(
427 template<
typename InContainerTy>
428 Error ImportTemplateArgumentListInfo(
434 std::tuple<FunctionTemplateDecl *, TemplateArgsTy>;
436 ImportFunctionTemplateWithTemplateArgsFromSpecialization(
441 bool IsStructuralMatch(
Decl *From,
Decl *To,
bool Complain);
443 bool Complain =
true);
445 bool Complain =
true);
618 template<
typename IIter,
typename OIter>
621 for (; Ibegin != Iend; ++Ibegin, ++Obegin) {
624 return ToOrErr.takeError();
627 return Error::success();
634 template<
typename InContainerTy,
typename OutContainerTy>
636 const InContainerTy &InContainer, OutContainerTy &OutContainer) {
637 return ImportArrayChecked(
638 InContainer.begin(), InContainer.end(), OutContainer.begin());
641 template<
typename InContainerTy,
typename OIter>
643 return ImportArrayChecked(InContainer.begin(), InContainer.end(), Obegin);
657 return make_error<ImportError>();
661 template <
typename InContainerTy>
665 auto ToLAngleLocOrErr =
import(FromLAngleLoc);
666 if (!ToLAngleLocOrErr)
667 return ToLAngleLocOrErr.takeError();
668 auto ToRAngleLocOrErr =
import(FromRAngleLoc);
669 if (!ToRAngleLocOrErr)
670 return ToRAngleLocOrErr.takeError();
673 if (
auto Err = ImportTemplateArgumentListInfo(Container, ToTAInfo))
676 return Error::success();
680 Error ASTNodeImporter::ImportTemplateArgumentListInfo<TemplateArgumentListInfo>(
682 return ImportTemplateArgumentListInfo(
683 From.getLAngleLoc(), From.getRAngleLoc(), From.arguments(),
Result);
691 return ImportTemplateArgumentListInfo(
692 From.LAngleLoc, From.RAngleLoc, From.arguments(),
Result);
704 if (
Error Err = importInto(std::get<0>(Result), FTSInfo->getTemplate()))
705 return std::move(Err);
708 auto TemplArgs = FTSInfo->TemplateArguments->asArray();
709 if (
Error Err = ImportTemplateArguments(TemplArgs.data(), TemplArgs.size(),
711 return std::move(Err);
720 if (
Error Err = ImportContainerChecked(*From, To))
721 return std::move(Err);
724 if (!ToRequiresClause)
725 return ToRequiresClause.takeError();
728 if (!ToTemplateLocOrErr)
729 return ToTemplateLocOrErr.takeError();
731 if (!ToLAngleLocOrErr)
732 return ToLAngleLocOrErr.takeError();
734 if (!ToRAngleLocOrErr)
735 return ToRAngleLocOrErr.takeError();
738 Importer.getToContext(),
756 return ToTypeOrErr.takeError();
763 return ToTypeOrErr.takeError();
770 return ToOrErr.takeError();
773 return ToTypeOrErr.takeError();
780 return ToTypeOrErr.takeError();
786 if (!ToTemplateOrErr)
787 return ToTemplateOrErr.takeError();
795 if (!ToTemplateOrErr)
796 return ToTemplateOrErr.takeError();
806 return ToExpr.takeError();
811 if (
Error Err = ImportTemplateArguments(
813 return std::move(Err);
816 llvm::makeArrayRef(ToPack).copy(Importer.getToContext()));
820 llvm_unreachable(
"Invalid template argument kind");
828 return ArgOrErr.takeError();
837 return E.takeError();
843 return TSIOrErr.takeError();
845 auto ToTemplateQualifierLocOrErr =
847 if (!ToTemplateQualifierLocOrErr)
848 return ToTemplateQualifierLocOrErr.takeError();
850 if (!ToTemplateNameLocOrErr)
851 return ToTemplateNameLocOrErr.takeError();
852 auto ToTemplateEllipsisLocOrErr =
854 if (!ToTemplateEllipsisLocOrErr)
855 return ToTemplateEllipsisLocOrErr.takeError();
858 *ToTemplateQualifierLocOrErr,
859 *ToTemplateNameLocOrErr,
860 *ToTemplateEllipsisLocOrErr);
870 size_t NumDecls = DG.
end() - DG.
begin();
872 ToDecls.reserve(NumDecls);
873 for (
Decl *FromD : DG) {
874 if (
auto ToDOrErr =
import(FromD))
875 ToDecls.push_back(*ToDOrErr);
877 return ToDOrErr.takeError();
892 return ToDotLocOrErr.takeError();
895 if (!ToFieldLocOrErr)
896 return ToFieldLocOrErr.takeError();
898 return Designator(ToFieldName, *ToDotLocOrErr, *ToFieldLocOrErr);
902 if (!ToLBracketLocOrErr)
903 return ToLBracketLocOrErr.takeError();
906 if (!ToRBracketLocOrErr)
907 return ToRBracketLocOrErr.takeError();
911 *ToLBracketLocOrErr, *ToRBracketLocOrErr);
914 if (!ToEllipsisLocOrErr)
915 return ToEllipsisLocOrErr.takeError();
920 *ToRBracketLocOrErr);
930 return VarOrErr.takeError();
935 return LocationOrErr.takeError();
940 return std::move(Err);
953 using namespace clang;
956 Importer.FromDiag(
SourceLocation(), diag::err_unsupported_ast_node)
963 if (!UnderlyingTypeOrErr)
964 return UnderlyingTypeOrErr.takeError();
966 return Importer.getToContext().getAtomicType(*UnderlyingTypeOrErr);
971 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ 972 case BuiltinType::Id: \ 973 return Importer.getToContext().SingletonId; 974 #include "clang/Basic/OpenCLImageTypes.def" 975 #define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \ 976 case BuiltinType::Id: \ 977 return Importer.getToContext().Id##Ty; 978 #include "clang/Basic/OpenCLExtensionTypes.def" 979 #define SHARED_SINGLETON_TYPE(Expansion) 980 #define BUILTIN_TYPE(Id, SingletonId) \ 981 case BuiltinType::Id: return Importer.getToContext().SingletonId; 982 #include "clang/AST/BuiltinTypes.def" 990 case BuiltinType::Char_U:
994 if (Importer.getToContext().getLangOpts().CharIsSigned)
995 return Importer.getToContext().UnsignedCharTy;
997 return Importer.getToContext().CharTy;
999 case BuiltinType::Char_S:
1003 if (!Importer.getToContext().getLangOpts().CharIsSigned)
1004 return Importer.getToContext().SignedCharTy;
1006 return Importer.getToContext().CharTy;
1008 case BuiltinType::WChar_S:
1009 case BuiltinType::WChar_U:
1012 return Importer.getToContext().WCharTy;
1015 llvm_unreachable(
"Invalid BuiltinType Kind!");
1020 if (!ToOriginalTypeOrErr)
1021 return ToOriginalTypeOrErr.takeError();
1023 return Importer.getToContext().getDecayedType(*ToOriginalTypeOrErr);
1028 if (!ToElementTypeOrErr)
1029 return ToElementTypeOrErr.takeError();
1031 return Importer.getToContext().getComplexType(*ToElementTypeOrErr);
1036 if (!ToPointeeTypeOrErr)
1037 return ToPointeeTypeOrErr.takeError();
1039 return Importer.getToContext().getPointerType(*ToPointeeTypeOrErr);
1045 if (!ToPointeeTypeOrErr)
1046 return ToPointeeTypeOrErr.takeError();
1048 return Importer.getToContext().getBlockPointerType(*ToPointeeTypeOrErr);
1055 if (!ToPointeeTypeOrErr)
1056 return ToPointeeTypeOrErr.takeError();
1058 return Importer.getToContext().getLValueReferenceType(*ToPointeeTypeOrErr);
1065 if (!ToPointeeTypeOrErr)
1066 return ToPointeeTypeOrErr.takeError();
1068 return Importer.getToContext().getRValueReferenceType(*ToPointeeTypeOrErr);
1075 if (!ToPointeeTypeOrErr)
1076 return ToPointeeTypeOrErr.takeError();
1079 if (!ClassTypeOrErr)
1080 return ClassTypeOrErr.takeError();
1082 return Importer.getToContext().getMemberPointerType(
1083 *ToPointeeTypeOrErr, (*ClassTypeOrErr).getTypePtr());
1089 if (!ToElementTypeOrErr)
1090 return ToElementTypeOrErr.takeError();
1092 return Importer.getToContext().getConstantArrayType(*ToElementTypeOrErr,
1101 if (!ToElementTypeOrErr)
1102 return ToElementTypeOrErr.takeError();
1104 return Importer.getToContext().getIncompleteArrayType(*ToElementTypeOrErr,
1114 if (
auto Imp = importSeq(
1116 std::tie(ToElementType, ToSizeExpr, ToBracketsRange) = *Imp;
1118 return Imp.takeError();
1120 return Importer.getToContext().getVariableArrayType(
1130 if (
auto Imp = importSeq(
1132 std::tie(ToElementType, ToSizeExpr, ToBracketsRange) = *Imp;
1134 return Imp.takeError();
1138 return Importer.getToContext().getDependentSizedArrayType(
1145 if (!ToElementTypeOrErr)
1146 return ToElementTypeOrErr.takeError();
1148 return Importer.getToContext().getVectorType(*ToElementTypeOrErr,
1155 if (!ToElementTypeOrErr)
1156 return ToElementTypeOrErr.takeError();
1158 return Importer.getToContext().getExtVectorType(*ToElementTypeOrErr,
1167 if (!ToReturnTypeOrErr)
1168 return ToReturnTypeOrErr.takeError();
1170 return Importer.getToContext().getFunctionNoProtoType(*ToReturnTypeOrErr,
1177 if (!ToReturnTypeOrErr)
1178 return ToReturnTypeOrErr.takeError();
1185 return TyOrErr.takeError();
1186 ArgTypes.push_back(*TyOrErr);
1194 return TyOrErr.takeError();
1195 ExceptionTypes.push_back(*TyOrErr);
1201 auto Imp = importSeq(
1206 return Imp.takeError();
1220 return Importer.getToContext().getFunctionType(
1221 *ToReturnTypeOrErr, ArgTypes, ToEPI);
1229 std::tie(ToD, ToPrevD) = *Imp;
1231 return Imp.takeError();
1233 return Importer.getToContext().getTypeDeclType(
1234 ToD, cast_or_null<TypeDecl>(ToPrevD));
1239 if (!ToInnerTypeOrErr)
1240 return ToInnerTypeOrErr.takeError();
1242 return Importer.getToContext().getParenType(*ToInnerTypeOrErr);
1248 return ToDeclOrErr.takeError();
1250 return Importer.getToContext().getTypeDeclType(*ToDeclOrErr);
1256 return ToExprOrErr.takeError();
1258 return Importer.getToContext().getTypeOfExprType(*ToExprOrErr);
1263 if (!ToUnderlyingTypeOrErr)
1264 return ToUnderlyingTypeOrErr.takeError();
1266 return Importer.getToContext().getTypeOfType(*ToUnderlyingTypeOrErr);
1273 return ToExprOrErr.takeError();
1276 if (!ToUnderlyingTypeOrErr)
1277 return ToUnderlyingTypeOrErr.takeError();
1279 return Importer.getToContext().getDecltypeType(
1280 *ToExprOrErr, *ToUnderlyingTypeOrErr);
1286 if (!ToBaseTypeOrErr)
1287 return ToBaseTypeOrErr.takeError();
1290 if (!ToUnderlyingTypeOrErr)
1291 return ToUnderlyingTypeOrErr.takeError();
1293 return Importer.getToContext().getUnaryTransformType(
1294 *ToBaseTypeOrErr, *ToUnderlyingTypeOrErr, T->
getUTTKind());
1300 if (!ToDeducedTypeOrErr)
1301 return ToDeducedTypeOrErr.takeError();
1303 return Importer.getToContext().getAutoType(*ToDeducedTypeOrErr,
1312 return ToDeclOrErr.takeError();
1315 if (!ToInjTypeOrErr)
1316 return ToInjTypeOrErr.takeError();
1333 return ToDeclOrErr.takeError();
1335 return Importer.getToContext().getTagDeclType(*ToDeclOrErr);
1341 return ToDeclOrErr.takeError();
1343 return Importer.getToContext().getTagDeclType(*ToDeclOrErr);
1348 if (!ToModifiedTypeOrErr)
1349 return ToModifiedTypeOrErr.takeError();
1351 if (!ToEquivalentTypeOrErr)
1352 return ToEquivalentTypeOrErr.takeError();
1354 return Importer.getToContext().getAttributedType(T->
getAttrKind(),
1355 *ToModifiedTypeOrErr, *ToEquivalentTypeOrErr);
1362 return ToDeclOrErr.takeError();
1364 return Importer.getToContext().getTemplateTypeParmType(
1372 return ReplacedOrErr.takeError();
1374 cast<TemplateTypeParmType>((*ReplacedOrErr).getTypePtr());
1377 if (!ToReplacementTypeOrErr)
1378 return ToReplacementTypeOrErr.takeError();
1380 return Importer.getToContext().getSubstTemplateTypeParmType(
1381 Replaced, (*ToReplacementTypeOrErr).getCanonicalType());
1387 if (!ToTemplateOrErr)
1388 return ToTemplateOrErr.takeError();
1391 if (
Error Err = ImportTemplateArguments(
1393 return std::move(Err);
1396 if (!
QualType(T, 0).isCanonical()) {
1400 ToCanonType = *TyOrErr;
1402 return TyOrErr.takeError();
1404 return Importer.getToContext().getTemplateSpecializationType(*ToTemplateOrErr,
1412 if (!ToQualifierOrErr)
1413 return ToQualifierOrErr.takeError();
1416 if (!ToNamedTypeOrErr)
1417 return ToNamedTypeOrErr.takeError();
1420 if (!ToOwnedTagDeclOrErr)
1421 return ToOwnedTagDeclOrErr.takeError();
1423 return Importer.getToContext().getElaboratedType(T->
getKeyword(),
1426 *ToOwnedTagDeclOrErr);
1432 if (!ToPatternOrErr)
1433 return ToPatternOrErr.takeError();
1435 return Importer.getToContext().getPackExpansionType(*ToPatternOrErr,
1442 if (!ToQualifierOrErr)
1443 return ToQualifierOrErr.takeError();
1449 if (
Error Err = ImportTemplateArguments(
1451 return std::move(Err);
1453 return Importer.getToContext().getDependentTemplateSpecializationType(
1454 T->
getKeyword(), *ToQualifierOrErr, ToName, ToPack);
1460 if (!ToQualifierOrErr)
1461 return ToQualifierOrErr.takeError();
1470 return TyOrErr.takeError();
1473 return Importer.getToContext().getDependentNameType(T->
getKeyword(),
1482 return ToDeclOrErr.takeError();
1484 return Importer.getToContext().getObjCInterfaceType(*ToDeclOrErr);
1489 if (!ToBaseTypeOrErr)
1490 return ToBaseTypeOrErr.takeError();
1495 TypeArgs.push_back(*TyOrErr);
1497 return TyOrErr.takeError();
1501 for (
auto *
P : T->
quals()) {
1503 Protocols.push_back(*ProtocolOrErr);
1505 return ProtocolOrErr.takeError();
1509 return Importer.getToContext().getObjCObjectType(*ToBaseTypeOrErr, TypeArgs,
1517 if (!ToPointeeTypeOrErr)
1518 return ToPointeeTypeOrErr.takeError();
1520 return Importer.getToContext().getObjCObjectPointerType(*ToPointeeTypeOrErr);
1533 if (isa<RecordDecl>(D) && (FunDecl = dyn_cast<FunctionDecl>(OrigDC)) &&
1535 auto getLeafPointeeType = [](
const Type *T) {
1536 while (T->isPointerType() || T->isArrayType()) {
1537 T = T->getPointeeOrArrayElementType();
1543 getLeafPointeeType(
P->getType().getCanonicalType().getTypePtr());
1545 if (RT && RT->getDecl() == D) {
1546 Importer.FromDiag(D->
getLocation(), diag::err_unsupported_ast_node)
1554 if (
Error Err = ImportDeclContext(D, DC, LexicalDC))
1565 ToD = cast_or_null<NamedDecl>(Importer.GetAlreadyImportedOrNull(D));
1570 return Error::success();
1575 return Error::success();
1578 if (
Error Err = importInto(ToD, FromD))
1581 if (
RecordDecl *FromRecord = dyn_cast<RecordDecl>(FromD)) {
1582 if (
RecordDecl *ToRecord = cast<RecordDecl>(ToD)) {
1583 if (FromRecord->getDefinition() && FromRecord->isCompleteDefinition() &&
1584 !ToRecord->getDefinition()) {
1585 if (
Error Err = ImportDefinition(FromRecord, ToRecord))
1589 return Error::success();
1592 if (
EnumDecl *FromEnum = dyn_cast<EnumDecl>(FromD)) {
1593 if (
EnumDecl *ToEnum = cast<EnumDecl>(ToD)) {
1594 if (FromEnum->getDefinition() && !ToEnum->getDefinition()) {
1595 if (
Error Err = ImportDefinition(FromEnum, ToEnum))
1599 return Error::success();
1602 return Error::success();
1617 return Error::success();
1623 return ToRangeOrErr.takeError();
1624 return Error::success();
1630 return LocOrErr.takeError();
1631 return Error::success();
1639 return ToTInfoOrErr.takeError();
1640 return Error::success();
1643 llvm_unreachable(
"Unknown name kind.");
1648 if (Importer.isMinimalImport() && !ForceImport) {
1649 auto ToDCOrErr = Importer.ImportContext(FromDC);
1650 return ToDCOrErr.takeError();
1653 for (
auto *From : FromDC->
decls()) {
1658 consumeError(ImportedOrErr.takeError());
1661 return Error::success();
1666 auto ToDCOrErr = Importer.ImportContext(FromD->
getDeclContext());
1668 return ToDCOrErr.takeError();
1672 auto ToLexicalDCOrErr = Importer.ImportContext(
1674 if (!ToLexicalDCOrErr)
1675 return ToLexicalDCOrErr.takeError();
1676 ToLexicalDC = *ToLexicalDCOrErr;
1680 return Error::success();
1686 "Import implicit methods to or from non-definition");
1689 if (FromM->isImplicit()) {
1692 return ToMOrErr.takeError();
1695 return Error::success();
1701 Decl *ToTypedef = Importer.
Import(FromTypedef);
1703 return make_error<ImportError>();
1711 return Error::success();
1717 if (Kind == IDK_Everything)
1718 return ImportDeclContext(From,
true);
1720 return Error::success();
1731 if (ToCXX && FromCXX && ToCXX->dataPtr() && FromCXX->dataPtr()) {
1733 struct CXXRecordDecl::DefinitionData &ToData = ToCXX->data();
1734 struct CXXRecordDecl::DefinitionData &FromData = FromCXX->data();
1735 ToData.UserDeclaredConstructor = FromData.UserDeclaredConstructor;
1736 ToData.UserDeclaredSpecialMembers = FromData.UserDeclaredSpecialMembers;
1737 ToData.Aggregate = FromData.Aggregate;
1738 ToData.PlainOldData = FromData.PlainOldData;
1739 ToData.Empty = FromData.Empty;
1740 ToData.Polymorphic = FromData.Polymorphic;
1741 ToData.Abstract = FromData.Abstract;
1742 ToData.IsStandardLayout = FromData.IsStandardLayout;
1743 ToData.IsCXX11StandardLayout = FromData.IsCXX11StandardLayout;
1744 ToData.HasBasesWithFields = FromData.HasBasesWithFields;
1745 ToData.HasBasesWithNonStaticDataMembers =
1746 FromData.HasBasesWithNonStaticDataMembers;
1747 ToData.HasPrivateFields = FromData.HasPrivateFields;
1748 ToData.HasProtectedFields = FromData.HasProtectedFields;
1749 ToData.HasPublicFields = FromData.HasPublicFields;
1750 ToData.HasMutableFields = FromData.HasMutableFields;
1751 ToData.HasVariantMembers = FromData.HasVariantMembers;
1752 ToData.HasOnlyCMembers = FromData.HasOnlyCMembers;
1753 ToData.HasInClassInitializer = FromData.HasInClassInitializer;
1754 ToData.HasUninitializedReferenceMember
1755 = FromData.HasUninitializedReferenceMember;
1756 ToData.HasUninitializedFields = FromData.HasUninitializedFields;
1757 ToData.HasInheritedConstructor = FromData.HasInheritedConstructor;
1758 ToData.HasInheritedAssignment = FromData.HasInheritedAssignment;
1759 ToData.NeedOverloadResolutionForCopyConstructor
1760 = FromData.NeedOverloadResolutionForCopyConstructor;
1761 ToData.NeedOverloadResolutionForMoveConstructor
1762 = FromData.NeedOverloadResolutionForMoveConstructor;
1763 ToData.NeedOverloadResolutionForMoveAssignment
1764 = FromData.NeedOverloadResolutionForMoveAssignment;
1765 ToData.NeedOverloadResolutionForDestructor
1766 = FromData.NeedOverloadResolutionForDestructor;
1767 ToData.DefaultedCopyConstructorIsDeleted
1768 = FromData.DefaultedCopyConstructorIsDeleted;
1769 ToData.DefaultedMoveConstructorIsDeleted
1770 = FromData.DefaultedMoveConstructorIsDeleted;
1771 ToData.DefaultedMoveAssignmentIsDeleted
1772 = FromData.DefaultedMoveAssignmentIsDeleted;
1773 ToData.DefaultedDestructorIsDeleted = FromData.DefaultedDestructorIsDeleted;
1774 ToData.HasTrivialSpecialMembers = FromData.HasTrivialSpecialMembers;
1775 ToData.HasIrrelevantDestructor = FromData.HasIrrelevantDestructor;
1776 ToData.HasConstexprNonCopyMoveConstructor
1777 = FromData.HasConstexprNonCopyMoveConstructor;
1778 ToData.HasDefaultedDefaultConstructor
1779 = FromData.HasDefaultedDefaultConstructor;
1780 ToData.DefaultedDefaultConstructorIsConstexpr
1781 = FromData.DefaultedDefaultConstructorIsConstexpr;
1782 ToData.HasConstexprDefaultConstructor
1783 = FromData.HasConstexprDefaultConstructor;
1784 ToData.HasNonLiteralTypeFieldsOrBases
1785 = FromData.HasNonLiteralTypeFieldsOrBases;
1787 ToData.UserProvidedDefaultConstructor
1788 = FromData.UserProvidedDefaultConstructor;
1789 ToData.DeclaredSpecialMembers = FromData.DeclaredSpecialMembers;
1790 ToData.ImplicitCopyConstructorCanHaveConstParamForVBase
1791 = FromData.ImplicitCopyConstructorCanHaveConstParamForVBase;
1792 ToData.ImplicitCopyConstructorCanHaveConstParamForNonVBase
1793 = FromData.ImplicitCopyConstructorCanHaveConstParamForNonVBase;
1794 ToData.ImplicitCopyAssignmentHasConstParam
1795 = FromData.ImplicitCopyAssignmentHasConstParam;
1796 ToData.HasDeclaredCopyConstructorWithConstParam
1797 = FromData.HasDeclaredCopyConstructorWithConstParam;
1798 ToData.HasDeclaredCopyAssignmentWithConstParam
1799 = FromData.HasDeclaredCopyAssignmentWithConstParam;
1802 for (
const auto &Base1 : FromCXX->bases()) {
1805 return TyOrErr.takeError();
1808 if (Base1.isPackExpansion()) {
1809 if (
ExpectedSLoc LocOrErr =
import(Base1.getEllipsisLoc()))
1810 EllipsisLoc = *LocOrErr;
1812 return LocOrErr.takeError();
1817 ImportDefinitionIfNeeded(Base1.getType()->getAsCXXRecordDecl()))
1820 auto RangeOrErr =
import(Base1.getSourceRange());
1822 return RangeOrErr.takeError();
1824 auto TSIOrErr =
import(Base1.getTypeSourceInfo());
1826 return TSIOrErr.takeError();
1832 Base1.isBaseOfClass(),
1833 Base1.getAccessSpecifierAsWritten(),
1838 ToCXX->setBases(Bases.data(), Bases.size());
1841 if (shouldForceImportDeclContext(Kind))
1842 if (
Error Err = ImportDeclContext(From,
true))
1846 return Error::success();
1851 return Error::success();
1855 return Error::success();
1859 return ToInitOrErr.takeError();
1869 return Error::success();
1875 if (Kind == IDK_Everything)
1876 return ImportDeclContext(From,
true);
1877 return Error::success();
1886 import(Importer.getFromContext().getTypeDeclType(From));
1888 return ToTypeOrErr.takeError();
1891 if (!ToPromotionTypeOrErr)
1892 return ToPromotionTypeOrErr.takeError();
1894 if (shouldForceImportDeclContext(Kind))
1895 if (
Error Err = ImportDeclContext(From,
true))
1903 return Error::success();
1910 if (
Error Err = ImportContainerChecked(*Params, ToParams))
1911 return std::move(Err);
1913 Expr *ToRequiresClause;
1915 if (
Error Err = importInto(ToRequiresClause, R))
1916 return std::move(Err);
1918 ToRequiresClause =
nullptr;
1922 if (!ToTemplateLocOrErr)
1923 return ToTemplateLocOrErr.takeError();
1924 auto ToLAngleLocOrErr =
import(Params->
getLAngleLoc());
1925 if (!ToLAngleLocOrErr)
1926 return ToLAngleLocOrErr.takeError();
1927 auto ToRAngleLocOrErr =
import(Params->
getRAngleLoc());
1928 if (!ToRAngleLocOrErr)
1929 return ToRAngleLocOrErr.takeError();
1932 Importer.getToContext(),
1933 *ToTemplateLocOrErr,
1943 for (
unsigned I = 0; I != NumFromArgs; ++I) {
1944 if (
auto ToOrErr =
import(FromArgs[I]))
1945 ToArgs.push_back(*ToOrErr);
1947 return ToOrErr.takeError();
1950 return Error::success();
1956 return import(From);
1959 template <
typename InContainerTy>
1962 for (
const auto &FromLoc : Container) {
1963 if (
auto ToLocOrErr =
import(FromLoc))
1966 return ToLocOrErr.takeError();
1968 return Error::success();
1979 Importer.getFromContext(), Importer.getToContext(),
1989 Decl *ToOrigin = Importer.GetOriginalDecl(ToRecord);
1991 auto *ToOriginRecord = dyn_cast<
RecordDecl>(ToOrigin);
1993 ToRecord = ToOriginRecord;
1998 Importer.getNonEquivalentDecls(),
2007 Importer.getFromContext(), Importer.getToContext(),
2015 Importer.getFromContext(), Importer.getToContext(),
2023 Importer.getFromContext(), Importer.getToContext(),
2031 Importer.getFromContext(), Importer.getToContext(),
2039 const llvm::APSInt &FromVal = FromEC->
getInitVal();
2040 const llvm::APSInt &ToVal = ToEC->
getInitVal();
2042 return FromVal.isSigned() == ToVal.isSigned() &&
2043 FromVal.getBitWidth() == ToVal.getBitWidth() &&
2050 Importer.getToContext(),
2051 Importer.getNonEquivalentDecls(),
2059 Importer.getToContext(),
2060 Importer.getNonEquivalentDecls(),
2066 Importer.FromDiag(D->
getLocation(), diag::err_unsupported_ast_node)
2072 Importer.FromDiag(D->
getLocation(), diag::err_unsupported_ast_node)
2080 if (
Error Err = ImportDeclContext(D, DC, LexicalDC))
2081 return std::move(Err);
2086 return LocOrErr.takeError();
2089 if (GetImportedOrCreateDecl(ToD, D, Importer.getToContext(), DC, *LocOrErr))
2101 Importer.MapImported(D, ToD);
2109 return LocOrErr.takeError();
2112 return ColonLocOrErr.takeError();
2117 return DCOrErr.takeError();
2121 if (GetImportedOrCreateDecl(ToD, D, Importer.getToContext(), D->
getAccess(),
2122 DC, *LocOrErr, *ColonLocOrErr))
2136 return DCOrErr.takeError();
2143 if (
auto Imp = importSeq(
2145 std::tie(ToLocation, ToAssertExpr, ToMessage, ToRParenLoc) = *Imp;
2147 return Imp.takeError();
2150 if (GetImportedOrCreateDecl(
2151 ToD, D, Importer.getToContext(), DC, ToLocation, ToAssertExpr, ToMessage,
2166 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
2167 return std::move(Err);
2176 if (
auto *TU = dyn_cast<TranslationUnitDecl>(DC))
2179 MergeWithNamespace = cast<NamespaceDecl>(DC)->getAnonymousNamespace();
2182 auto FoundDecls = Importer.findDeclsInToCtx(DC, Name);
2183 for (
auto *FoundDecl : FoundDecls) {
2187 if (
auto *FoundNS = dyn_cast<NamespaceDecl>(FoundDecl)) {
2188 MergeWithNamespace = FoundNS;
2189 ConflictingDecls.clear();
2193 ConflictingDecls.push_back(FoundDecl);
2196 if (!ConflictingDecls.empty()) {
2198 ConflictingDecls.data(),
2199 ConflictingDecls.size());
2207 return BeginLocOrErr.takeError();
2212 if (GetImportedOrCreateDecl(
2213 ToNamespace, D, Importer.getToContext(), DC, D->
isInline(),
2223 if (
auto *TU = dyn_cast<TranslationUnitDecl>(DC))
2224 TU->setAnonymousNamespace(ToNamespace);
2226 cast<NamespaceDecl>(DC)->setAnonymousNamespace(ToNamespace);
2229 Importer.MapImported(D, ToNamespace);
2231 if (
Error Err = ImportDeclContext(D))
2232 return std::move(Err);
2243 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, LookupD, Loc))
2244 return std::move(Err);
2253 if (
auto Imp = importSeq(
2257 ToNamespaceLoc, ToAliasLoc, ToQualifierLoc, ToTargetNameLoc,
2258 ToNamespace) = *Imp;
2260 return Imp.takeError();
2264 if (GetImportedOrCreateDecl(
2265 ToD, D, Importer.getToContext(), DC, ToNamespaceLoc, ToAliasLoc,
2266 ToIdentifier, ToQualifierLoc, ToTargetNameLoc, ToNamespace))
2282 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
2283 return std::move(Err);
2293 auto FoundDecls = Importer.findDeclsInToCtx(DC, Name);
2294 for (
auto *FoundDecl : FoundDecls) {
2297 if (
auto *FoundTypedef = dyn_cast<TypedefNameDecl>(FoundDecl)) {
2299 QualType FoundUT = FoundTypedef->getUnderlyingType();
2300 if (Importer.IsStructurallyEquivalent(FromUT, FoundUT)) {
2304 return Importer.MapImported(D, FoundTypedef);
2310 ConflictingDecls.push_back(FoundDecl);
2313 if (!ConflictingDecls.empty()) {
2314 Name = Importer.HandleNameConflict(Name, DC, IDNS,
2315 ConflictingDecls.data(),
2316 ConflictingDecls.size());
2325 if (
auto Imp = importSeq(
2327 std::tie(ToUnderlyingType, ToTypeSourceInfo, ToBeginLoc) = *Imp;
2329 return Imp.takeError();
2335 if (GetImportedOrCreateDecl<TypeAliasDecl>(
2336 ToTypedef, D, Importer.getToContext(), DC, ToBeginLoc, Loc,
2339 }
else if (GetImportedOrCreateDecl<TypedefDecl>(
2340 ToTypedef, D, Importer.getToContext(), DC, ToBeginLoc, Loc,
2348 TypeAliasDecl *FromAlias = IsAlias ? cast<TypeAliasDecl>(D) :
nullptr;
2356 return VisitTypedefNameDecl(D,
false);
2360 return VisitTypedefNameDecl(D,
true);
2370 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, FoundD, Loc))
2371 return std::move(Err);
2381 auto FoundDecls = Importer.findDeclsInToCtx(DC, Name);
2382 for (
auto *FoundDecl : FoundDecls) {
2385 if (
auto *FoundAlias = dyn_cast<TypeAliasTemplateDecl>(FoundDecl))
2386 return Importer.MapImported(D, FoundAlias);
2387 ConflictingDecls.push_back(FoundDecl);
2390 if (!ConflictingDecls.empty()) {
2391 Name = Importer.HandleNameConflict(Name, DC, IDNS,
2392 ConflictingDecls.data(),
2393 ConflictingDecls.size());
2402 std::tie(ToTemplateParameters, ToTemplatedDecl) = *Imp;
2404 return Imp.takeError();
2407 if (GetImportedOrCreateDecl(ToAlias, D, Importer.getToContext(), DC, Loc,
2408 Name, ToTemplateParameters, ToTemplatedDecl))
2425 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
2426 return std::move(Err);
2436 return BeginLocOrErr.takeError();
2437 if (GetImportedOrCreateDecl(ToLabel, D, Importer.getToContext(), DC, Loc,
2442 if (GetImportedOrCreateDecl(ToLabel, D, Importer.getToContext(), DC, Loc,
2450 return ToStmtOrErr.takeError();
2452 ToLabel->setStmt(*ToStmtOrErr);
2453 ToLabel->setLexicalDeclContext(LexicalDC);
2464 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
2465 return std::move(Err);
2473 if (
Error Err = importInto(
2475 return std::move(Err);
2477 }
else if (Importer.getToContext().getLangOpts().CPlusPlus)
2484 Importer.findDeclsInToCtx(DC, SearchName);
2485 for (
auto *FoundDecl : FoundDecls) {
2489 if (
auto *Typedef = dyn_cast<TypedefNameDecl>(FoundDecl)) {
2490 if (
const auto *Tag = Typedef->getUnderlyingType()->getAs<
TagType>())
2491 FoundDecl = Tag->getDecl();
2494 if (
auto *FoundEnum = dyn_cast<EnumDecl>(FoundDecl)) {
2495 if (IsStructuralMatch(D, FoundEnum))
2496 return Importer.MapImported(D, FoundEnum);
2499 ConflictingDecls.push_back(FoundDecl);
2502 if (!ConflictingDecls.empty()) {
2503 Name = Importer.HandleNameConflict(Name, DC, IDNS,
2504 ConflictingDecls.data(),
2505 ConflictingDecls.size());
2514 if (
auto Imp = importSeq(
2516 std::tie(ToBeginLoc, ToQualifierLoc, ToIntegerType) = *Imp;
2518 return Imp.takeError();
2522 if (GetImportedOrCreateDecl(
2523 D2, D, Importer.getToContext(), DC, ToBeginLoc,
2536 if (
Error Err = ImportDefinition(D, D2))
2537 return std::move(Err);
2543 bool IsFriendTemplate =
false;
2544 if (
auto *DCXX = dyn_cast<CXXRecordDecl>(D)) {
2546 DCXX->getDescribedClassTemplate() &&
2547 DCXX->getDescribedClassTemplate()->getFriendObjectKind() !=
2555 if (Definition && Definition != D &&
2557 !IsFriendTemplate &&
2565 if (!ImportedDefOrErr)
2566 return ImportedDefOrErr.takeError();
2568 return Importer.MapImported(D, *ImportedDefOrErr);
2576 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
2577 return std::move(Err);
2585 if (
Error Err = importInto(
2587 return std::move(Err);
2589 }
else if (Importer.getToContext().getLangOpts().CPlusPlus)
2597 Importer.findDeclsInToCtx(DC, SearchName);
2598 if (!FoundDecls.empty()) {
2604 for (
auto *FoundDecl : FoundDecls) {
2608 Decl *Found = FoundDecl;
2609 if (
auto *Typedef = dyn_cast<TypedefNameDecl>(Found)) {
2610 if (
const auto *Tag = Typedef->getUnderlyingType()->getAs<
TagType>())
2611 Found = Tag->getDecl();
2614 if (
auto *FoundRecord = dyn_cast<RecordDecl>(Found)) {
2625 if (!IsStructuralMatch(D, FoundRecord,
false))
2628 if (IsStructuralMatch(D, FoundRecord)) {
2633 Importer.MapImported(D, FoundDef);
2634 if (
const auto *DCXX = dyn_cast<CXXRecordDecl>(D)) {
2636 assert(FoundCXX &&
"Record type mismatch");
2638 if (!Importer.isMinimalImport())
2641 if (
Error Err = ImportImplicitMethods(DCXX, FoundCXX))
2642 return std::move(Err);
2650 ConflictingDecls.push_back(FoundDecl);
2653 if (!ConflictingDecls.empty() && SearchName) {
2654 Name = Importer.HandleNameConflict(Name, DC, IDNS,
2655 ConflictingDecls.data(),
2656 ConflictingDecls.size());
2664 return BeginLocOrErr.takeError();
2669 if (
auto *DCXX = dyn_cast<CXXRecordDecl>(D)) {
2670 if (DCXX->isLambda()) {
2671 auto TInfoOrErr =
import(DCXX->getLambdaTypeInfo());
2673 return TInfoOrErr.takeError();
2674 if (GetImportedOrCreateSpecialDecl(
2676 DC, *TInfoOrErr, Loc, DCXX->isDependentLambda(),
2677 DCXX->isGenericLambda(), DCXX->getLambdaCaptureDefault()))
2679 ExpectedDecl CDeclOrErr =
import(DCXX->getLambdaContextDecl());
2681 return CDeclOrErr.takeError();
2683 }
else if (DCXX->isInjectedClassName()) {
2686 const bool DelayTypeCreation =
true;
2687 if (GetImportedOrCreateDecl(
2688 D2CXX, D, Importer.getToContext(), D->
getTagKind(), DC,
2690 cast_or_null<CXXRecordDecl>(PrevDecl), DelayTypeCreation))
2692 Importer.getToContext().getTypeDeclType(
2693 D2CXX, dyn_cast<CXXRecordDecl>(DC));
2695 if (GetImportedOrCreateDecl(D2CXX, D, Importer.getToContext(),
2698 cast_or_null<CXXRecordDecl>(PrevDecl)))
2705 if (!DCXX->getDescribedClassTemplate() || DCXX->isImplicit())
2712 DCXX->getDescribedClassTemplate()) {
2714 if (
Error Err = importInto(ToDescribed, FromDescribed))
2715 return std::move(Err);
2717 if (!DCXX->isInjectedClassName() && !IsFriendTemplate) {
2727 if (Record && Record->isInjectedClassName()) {
2735 for (
auto *R : Redecls) {
2736 auto *RI = cast<CXXRecordDecl>(R);
2737 RI->setTypeForDecl(
nullptr);
2741 Importer.getToContext().getInjectedClassNameType(
2747 Importer.getToContext().getTypeDeclType(Injected, D2CXX);
2751 DCXX->getMemberSpecializationInfo()) {
2753 MemberInfo->getTemplateSpecializationKind();
2759 return ToInstOrErr.takeError();
2762 import(MemberInfo->getPointOfInstantiation()))
2766 return POIOrErr.takeError();
2770 if (GetImportedOrCreateDecl(D2, D, Importer.getToContext(),
2781 return QualifierLocOrErr.takeError();
2787 if (
Error Err = ImportDefinition(D, D2, IDK_Default))
2788 return std::move(Err);
2799 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
2800 return std::move(Err);
2809 auto FoundDecls = Importer.findDeclsInToCtx(DC, Name);
2810 for (
auto *FoundDecl : FoundDecls) {
2814 if (
auto *FoundEnumConstant = dyn_cast<EnumConstantDecl>(FoundDecl)) {
2815 if (IsStructuralMatch(D, FoundEnumConstant))
2816 return Importer.MapImported(D, FoundEnumConstant);
2819 ConflictingDecls.push_back(FoundDecl);
2822 if (!ConflictingDecls.empty()) {
2823 Name = Importer.HandleNameConflict(Name, DC, IDNS,
2824 ConflictingDecls.data(),
2825 ConflictingDecls.size());
2833 return TypeOrErr.takeError();
2837 return InitOrErr.takeError();
2840 if (GetImportedOrCreateDecl(
2841 ToEnumerator, D, Importer.getToContext(), cast<EnumDecl>(DC), Loc,
2843 return ToEnumerator;
2848 return ToEnumerator;
2856 return Error::success();
2863 ToFD->setInstantiationOfMemberFunction(*InstFDOrErr, TSK);
2865 return InstFDOrErr.takeError();
2871 return POIOrErr.takeError();
2873 return Error::success();
2877 auto FunctionAndArgsOrErr =
2878 ImportFunctionTemplateWithTemplateArgsFromSpecialization(FromFD);
2879 if (!FunctionAndArgsOrErr)
2880 return FunctionAndArgsOrErr.takeError();
2883 Importer.getToContext(), std::get<1>(*FunctionAndArgsOrErr));
2887 const auto *FromTAArgsAsWritten = FTSInfo->TemplateArgumentsAsWritten;
2888 if (FromTAArgsAsWritten)
2889 if (
Error Err = ImportTemplateArgumentListInfo(
2890 *FromTAArgsAsWritten, ToTAInfo))
2893 ExpectedSLoc POIOrErr =
import(FTSInfo->getPointOfInstantiation());
2895 return POIOrErr.takeError();
2898 ToFD->setFunctionTemplateSpecialization(
2899 std::get<0>(*FunctionAndArgsOrErr), ToTAList,
nullptr,
2900 TSK, FromTAArgsAsWritten ? &ToTAInfo :
nullptr, *POIOrErr);
2901 return Error::success();
2907 unsigned NumTemplates = FromInfo->getNumTemplates();
2908 for (
unsigned I = 0; I < NumTemplates; I++) {
2910 import(FromInfo->getTemplate(I)))
2911 TemplDecls.
addDecl(*ToFTDOrErr);
2913 return ToFTDOrErr.takeError();
2918 if (
Error Err = ImportTemplateArgumentListInfo(
2919 FromInfo->getLAngleLoc(), FromInfo->getRAngleLoc(),
2921 FromInfo->getTemplateArgs(), FromInfo->getNumTemplateArgs()),
2926 TemplDecls, ToTAInfo);
2927 return Error::success();
2930 llvm_unreachable(
"All cases should be covered!");
2935 auto FunctionAndArgsOrErr =
2936 ImportFunctionTemplateWithTemplateArgsFromSpecialization(FromFD);
2937 if (!FunctionAndArgsOrErr)
2938 return FunctionAndArgsOrErr.takeError();
2942 std::tie(Template, ToTemplArgs) = *FunctionAndArgsOrErr;
2943 void *InsertPos =
nullptr;
2951 auto RedeclIt = Redecls.begin();
2954 for (; RedeclIt != Redecls.end() && *RedeclIt != D; ++RedeclIt) {
2957 return ToRedeclOrErr.takeError();
2959 assert(*RedeclIt == D);
2966 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
2967 return std::move(Err);
2981 auto FoundFunctionOrErr = FindFunctionTemplateSpecialization(D);
2982 if (!FoundFunctionOrErr)
2983 return FoundFunctionOrErr.takeError();
2984 if (
FunctionDecl *FoundFunction = *FoundFunctionOrErr) {
2986 return Importer.MapImported(D, FoundFunction);
2987 FoundByLookup = FoundFunction;
2995 auto FoundDecls = Importer.findDeclsInToCtx(DC, Name);
2996 for (
auto *FoundDecl : FoundDecls) {
3000 if (
auto *FoundFunction = dyn_cast<FunctionDecl>(FoundDecl)) {
3001 if (FoundFunction->hasExternalFormalLinkage() &&
3003 if (IsStructuralMatch(D, FoundFunction)) {
3006 FoundFunction->hasBody(Definition)) {
3007 return Importer.MapImported(
3008 D, const_cast<FunctionDecl *>(Definition));
3010 FoundByLookup = FoundFunction;
3018 if (Importer.getToContext().getLangOpts().CPlusPlus)
3022 Importer.ToDiag(Loc, diag::err_odr_function_type_inconsistent)
3023 << Name << D->
getType() << FoundFunction->getType();
3024 Importer.ToDiag(FoundFunction->getLocation(),
3025 diag::note_odr_value_here)
3026 << FoundFunction->getType();
3030 ConflictingDecls.push_back(FoundDecl);
3033 if (!ConflictingDecls.empty()) {
3034 Name = Importer.HandleNameConflict(Name, DC, IDNS,
3035 ConflictingDecls.data(),
3036 ConflictingDecls.size());
3045 return std::move(Err);
3048 bool usedDifferentExceptionSpec =
false;
3060 FromTy = Importer.getFromContext().getFunctionType(
3061 FromFPT->getReturnType(), FromFPT->getParamTypes(), DefaultEPI);
3062 usedDifferentExceptionSpec =
true;
3070 if (
auto Imp = importSeq(
3073 std::tie(T, TInfo, ToInnerLocStart, ToQualifierLoc, ToEndLoc) = *Imp;
3075 return Imp.takeError();
3081 Parameters.push_back(*ToPOrErr);
3083 return ToPOrErr.takeError();
3088 if (
auto *FromConstructor = dyn_cast<CXXConstructorDecl>(D)) {
3089 if (GetImportedOrCreateDecl<CXXConstructorDecl>(
3090 ToFunction, D, Importer.getToContext(), cast<CXXRecordDecl>(DC),
3091 ToInnerLocStart, NameInfo, T, TInfo,
3092 FromConstructor->isExplicit(),
3095 }
else if (isa<CXXDestructorDecl>(D)) {
3096 if (GetImportedOrCreateDecl<CXXDestructorDecl>(
3097 ToFunction, D, Importer.getToContext(), cast<CXXRecordDecl>(DC),
3102 dyn_cast<CXXConversionDecl>(D)) {
3103 if (GetImportedOrCreateDecl<CXXConversionDecl>(
3104 ToFunction, D, Importer.getToContext(), cast<CXXRecordDecl>(DC),
3108 }
else if (
auto *Method = dyn_cast<CXXMethodDecl>(D)) {
3109 if (GetImportedOrCreateDecl<CXXMethodDecl>(
3110 ToFunction, D, Importer.getToContext(), cast<CXXRecordDecl>(DC),
3111 ToInnerLocStart, NameInfo, T, TInfo, Method->getStorageClass(),
3115 if (GetImportedOrCreateDecl(ToFunction, D, Importer.getToContext(), DC,
3116 ToInnerLocStart, NameInfo, T, TInfo,
3123 if (FoundByLookup) {
3130 if (
auto *FromConstructor = dyn_cast<CXXConstructorDecl>(D)) {
3131 if (
unsigned NumInitializers = FromConstructor->getNumCtorInitializers()) {
3134 if (
Error Err = ImportContainerChecked(
3135 FromConstructor->inits(), CtorInitializers))
3136 return std::move(Err);
3139 std::copy(CtorInitializers.begin(), CtorInitializers.end(), Memory);
3140 auto *ToCtor = cast<CXXConstructorDecl>(ToFunction);
3141 ToCtor->setCtorInitializers(Memory);
3142 ToCtor->setNumCtorInitializers(NumInitializers);
3155 for (
auto *Param : Parameters) {
3156 Param->setOwningFunction(ToFunction);
3159 ToFunction->setParams(Parameters);
3166 for (
unsigned I = 0, N = Parameters.size(); I != N; ++I)
3167 ProtoLoc.setParam(I, Parameters[I]);
3171 if (usedDifferentExceptionSpec) {
3174 ToFunction->
setType(*TyOrErr);
3176 return TyOrErr.takeError();
3181 auto ToFTOrErr =
import(FromFT);
3183 return ToFTOrErr.takeError();
3189 ToFunction->
setBody(*ToBodyOrErr);
3191 return ToBodyOrErr.takeError();
3198 if (
Error Err = ImportTemplateInformation(D, ToFunction))
3199 return std::move(Err);
3215 if (LexicalDC != DC && IsFriend) {
3219 if (
auto *FromCXXMethod = dyn_cast<CXXMethodDecl>(D))
3220 ImportOverrides(cast<CXXMethodDecl>(ToFunction), FromCXXMethod);
3223 for (++RedeclIt; RedeclIt != Redecls.end(); ++RedeclIt) {
3226 return ToRedeclOrErr.takeError();
3233 return VisitFunctionDecl(D);
3237 return VisitCXXMethodDecl(D);
3241 return VisitCXXMethodDecl(D);
3245 return VisitCXXMethodDecl(D);
3254 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
3255 return std::move(Err);
3260 auto FoundDecls = Importer.findDeclsInToCtx(DC, Name);
3261 for (
auto *FoundDecl : FoundDecls) {
3262 if (
FieldDecl *FoundField = dyn_cast<FieldDecl>(FoundDecl)) {
3269 if (Importer.IsStructurallyEquivalent(D->
getType(),
3270 FoundField->getType())) {
3271 Importer.MapImported(D, FoundField);
3278 if (FoundField->hasInClassInitializer() &&
3279 !FoundField->getInClassInitializer()) {
3280 if (
ExpectedExpr ToInitializerOrErr =
import(FromInitializer))
3281 FoundField->setInClassInitializer(*ToInitializerOrErr);
3286 consumeError(ToInitializerOrErr.takeError());
3295 Importer.ToDiag(Loc, diag::err_odr_field_type_inconsistent)
3296 << Name << D->
getType() << FoundField->getType();
3297 Importer.ToDiag(FoundField->getLocation(), diag::note_odr_value_here)
3298 << FoundField->getType();
3308 Expr *ToInitializer;
3309 if (
auto Imp = importSeq(
3313 ToType, ToTInfo, ToBitWidth, ToInnerLocStart, ToInitializer) = *Imp;
3315 return Imp.takeError();
3318 if (GetImportedOrCreateDecl(ToField, D, Importer.getToContext(), DC,
3320 ToType, ToTInfo, ToBitWidth, D->
isMutable(),
3339 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
3340 return std::move(Err);
3345 auto FoundDecls = Importer.findDeclsInToCtx(DC, Name);
3346 for (
unsigned I = 0, N = FoundDecls.size(); I != N; ++I) {
3347 if (
auto *FoundField = dyn_cast<IndirectFieldDecl>(FoundDecls[I])) {
3354 if (Importer.IsStructurallyEquivalent(D->
getType(),
3355 FoundField->getType(),
3357 Importer.MapImported(D, FoundField);
3362 if (!Name && I < N-1)
3366 Importer.ToDiag(Loc, diag::err_odr_field_type_inconsistent)
3367 << Name << D->
getType() << FoundField->getType();
3368 Importer.ToDiag(FoundField->getLocation(), diag::note_odr_value_here)
3369 << FoundField->getType();
3376 auto TypeOrErr =
import(D->
getType());
3378 return TypeOrErr.takeError();
3384 for (
auto *PI : D->
chain())
3386 NamedChain[i++] = *ToD;
3388 return ToD.takeError();
3392 if (GetImportedOrCreateDecl(ToIndirectField, D, Importer.getToContext(), DC,
3395 return ToIndirectField;
3403 return ToIndirectField;
3409 if (
Error Err = ImportDeclContext(D, DC, LexicalDC))
3410 return std::move(Err);
3414 auto *RD = cast<CXXRecordDecl>(DC);
3415 FriendDecl *ImportedFriend = RD->getFirstFriend();
3417 while (ImportedFriend) {
3418 if (D->
getFriendDecl() && ImportedFriend->getFriendDecl()) {
3419 if (IsStructuralMatch(D->
getFriendDecl(), ImportedFriend->getFriendDecl(),
3421 return Importer.MapImported(D, ImportedFriend);
3423 }
else if (D->
getFriendType() && ImportedFriend->getFriendType()) {
3424 if (Importer.IsStructurallyEquivalent(
3426 ImportedFriend->getFriendType()->getType(),
true))
3427 return Importer.MapImported(D, ImportedFriend);
3429 ImportedFriend = ImportedFriend->getNextFriend();
3436 if (
Error Err = importInto(ToFriendD, FriendD))
3437 return std::move(Err);
3448 return TSIOrErr.takeError();
3453 for (
unsigned I = 0; I < D->NumTPLists; I++) {
3454 if (
auto ListOrErr = ImportTemplateParameterList(FromTPLists[I]))
3455 ToTPLists[I] = *ListOrErr;
3457 return ListOrErr.takeError();
3462 return LocationOrErr.takeError();
3464 if (!FriendLocOrErr)
3465 return FriendLocOrErr.takeError();
3468 if (GetImportedOrCreateDecl(FrD, D, Importer.getToContext(), DC,
3469 *LocationOrErr, ToFU,
3470 *FriendLocOrErr, ToTPLists))
3485 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
3486 return std::move(Err);
3491 auto FoundDecls = Importer.findDeclsInToCtx(DC, Name);
3492 for (
auto *FoundDecl : FoundDecls) {
3493 if (
ObjCIvarDecl *FoundIvar = dyn_cast<ObjCIvarDecl>(FoundDecl)) {
3494 if (Importer.IsStructurallyEquivalent(D->
getType(),
3495 FoundIvar->getType())) {
3496 Importer.MapImported(D, FoundIvar);
3500 Importer.ToDiag(Loc, diag::err_odr_ivar_type_inconsistent)
3501 << Name << D->
getType() << FoundIvar->getType();
3502 Importer.ToDiag(FoundIvar->getLocation(), diag::note_odr_value_here)
3503 << FoundIvar->getType();
3513 if (
auto Imp = importSeq(
3515 std::tie(ToType, ToTypeSourceInfo, ToBitWidth, ToInnerLocStart) = *Imp;
3517 return Imp.takeError();
3520 if (GetImportedOrCreateDecl(
3521 ToIvar, D, Importer.getToContext(), cast<ObjCContainerDecl>(DC),
3523 ToType, ToTypeSourceInfo,
3535 auto RedeclIt = Redecls.begin();
3538 for (; RedeclIt != Redecls.end() && *RedeclIt != D; ++RedeclIt) {
3541 return RedeclOrErr.takeError();
3543 assert(*RedeclIt == D);
3550 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
3551 return std::move(Err);
3557 VarDecl *FoundByLookup =
nullptr;
3561 auto FoundDecls = Importer.findDeclsInToCtx(DC, Name);
3562 for (
auto *FoundDecl : FoundDecls) {
3566 if (
auto *FoundVar = dyn_cast<VarDecl>(FoundDecl)) {
3568 if (FoundVar->hasExternalFormalLinkage() &&
3570 if (Importer.IsStructurallyEquivalent(D->
getType(),
3571 FoundVar->getType())) {
3579 return Importer.MapImported(D, FoundDef);
3583 const VarDecl *FoundDInit =
nullptr;
3584 if (D->
getInit() && FoundVar->getAnyInitializer(FoundDInit))
3586 return Importer.MapImported(D, const_cast<VarDecl*>(FoundDInit));
3588 FoundByLookup = FoundVar;
3593 = Importer.getToContext().getAsArrayType(FoundVar->getType());
3595 = Importer.getToContext().getAsArrayType(D->
getType());
3596 if (FoundArray && TArray) {
3597 if (isa<IncompleteArrayType>(FoundArray) &&
3598 isa<ConstantArrayType>(TArray)) {
3600 if (
auto TyOrErr =
import(D->
getType()))
3601 FoundVar->setType(*TyOrErr);
3603 return TyOrErr.takeError();
3605 FoundByLookup = FoundVar;
3607 }
else if (isa<IncompleteArrayType>(TArray) &&
3608 isa<ConstantArrayType>(FoundArray)) {
3609 FoundByLookup = FoundVar;
3614 Importer.ToDiag(Loc, diag::err_odr_variable_type_inconsistent)
3615 << Name << D->
getType() << FoundVar->getType();
3616 Importer.ToDiag(FoundVar->getLocation(), diag::note_odr_value_here)
3617 << FoundVar->getType();
3621 ConflictingDecls.push_back(FoundDecl);
3624 if (!ConflictingDecls.empty()) {
3625 Name = Importer.HandleNameConflict(Name, DC, IDNS,
3626 ConflictingDecls.data(),
3627 ConflictingDecls.size());
3637 if (
auto Imp = importSeq(
3640 std::tie(ToType, ToTypeSourceInfo, ToInnerLocStart, ToQualifierLoc) = *Imp;
3642 return Imp.takeError();
3646 if (GetImportedOrCreateDecl(ToVar, D, Importer.getToContext(), DC,
3647 ToInnerLocStart, Loc,
3649 ToType, ToTypeSourceInfo,
3657 if (FoundByLookup) {
3662 if (
Error Err = ImportInitializer(D, ToVar))
3663 return std::move(Err);
3674 for (++RedeclIt; RedeclIt != Redecls.end(); ++RedeclIt) {
3677 return RedeclOrErr.takeError();
3686 DeclContext *DC = Importer.getToContext().getTranslationUnitDecl();
3692 std::tie(ToDeclName, ToLocation, ToType) = *Imp;
3694 return Imp.takeError();
3698 if (GetImportedOrCreateDecl(ToParm, D, Importer.getToContext(), DC,
3708 DeclContext *DC = Importer.getToContext().getTranslationUnitDecl();
3714 if (
auto Imp = importSeq(
3718 ToDeclName, ToLocation, ToType, ToInnerLocStart,
3719 ToTypeSourceInfo) = *Imp;
3721 return Imp.takeError();
3724 if (GetImportedOrCreateDecl(ToParm, D, Importer.getToContext(), DC,
3725 ToInnerLocStart, ToLocation,
3739 return ToDefArgOrErr.takeError();
3746 return ToDefArgOrErr.takeError();
3766 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
3767 return std::move(Err);
3771 auto FoundDecls = Importer.findDeclsInToCtx(DC, Name);
3772 for (
auto *FoundDecl : FoundDecls) {
3773 if (
auto *FoundMethod = dyn_cast<ObjCMethodDecl>(FoundDecl)) {
3779 FoundMethod->getReturnType())) {
3780 Importer.ToDiag(Loc, diag::err_odr_objc_method_result_type_inconsistent)
3782 << FoundMethod->getReturnType();
3783 Importer.ToDiag(FoundMethod->getLocation(),
3784 diag::note_odr_objc_method_here)
3791 if (D->
param_size() != FoundMethod->param_size()) {
3792 Importer.ToDiag(Loc, diag::err_odr_objc_method_num_params_inconsistent)
3794 << D->
param_size() << FoundMethod->param_size();
3795 Importer.ToDiag(FoundMethod->getLocation(),
3796 diag::note_odr_objc_method_here)
3804 PEnd = D->
param_end(), FoundP = FoundMethod->param_begin();
3805 P != PEnd; ++
P, ++FoundP) {
3806 if (!Importer.IsStructurallyEquivalent((*P)->getType(),
3807 (*FoundP)->getType())) {
3808 Importer.FromDiag((*P)->getLocation(),
3809 diag::err_odr_objc_method_param_type_inconsistent)
3811 << (*P)->getType() << (*FoundP)->getType();
3812 Importer.ToDiag((*FoundP)->getLocation(), diag::note_odr_value_here)
3813 << (*FoundP)->getType();
3821 if (D->
isVariadic() != FoundMethod->isVariadic()) {
3822 Importer.ToDiag(Loc, diag::err_odr_objc_method_variadic_inconsistent)
3824 Importer.ToDiag(FoundMethod->getLocation(),
3825 diag::note_odr_objc_method_here)
3832 return Importer.MapImported(D, FoundMethod);
3839 if (
auto Imp = importSeq(
3841 std::tie(ToEndLoc, ToReturnType, ToReturnTypeSourceInfo) = *Imp;
3843 return Imp.takeError();
3846 if (GetImportedOrCreateDecl(
3847 ToMethod, D, Importer.getToContext(), Loc,
3861 ToParams.push_back(*ToPOrErr);
3863 return ToPOrErr.takeError();
3867 for (
auto *ToParam : ToParams) {
3868 ToParam->setOwningFunction(ToMethod);
3875 if (
Error Err = ImportContainerChecked(FromSelLocs, ToSelLocs))
3876 return std::move(Err);
3878 ToMethod->
setMethodParams(Importer.getToContext(), ToParams, ToSelLocs);
3891 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
3892 return std::move(Err);
3898 if (
auto Imp = importSeq(
3901 std::tie(ToVarianceLoc, ToLocation, ToColonLoc, ToTypeSourceInfo) = *Imp;
3903 return Imp.takeError();
3906 if (GetImportedOrCreateDecl(
3907 Result, D, Importer.getToContext(), DC, D->
getVariance(),
3910 ToColonLoc, ToTypeSourceInfo))
3923 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
3924 return std::move(Err);
3930 return std::move(Err);
3939 if (
auto Imp = importSeq(
3943 ToAtStartLoc, ToCategoryNameLoc,
3944 ToIvarLBraceLoc, ToIvarRBraceLoc) = *Imp;
3946 return Imp.takeError();
3948 if (GetImportedOrCreateDecl(ToCategory, D, Importer.getToContext(), DC,
3964 return PListOrErr.takeError();
3973 FromProto != FromProtoEnd;
3974 ++FromProto, ++FromProtoLoc) {
3976 Protocols.push_back(*ToProtoOrErr);
3978 return ToProtoOrErr.takeError();
3980 if (
ExpectedSLoc ToProtoLocOrErr =
import(*FromProtoLoc))
3981 ProtocolLocs.push_back(*ToProtoLocOrErr);
3983 return ToProtoLocOrErr.takeError();
3988 ProtocolLocs.data(), Importer.getToContext());
3991 Importer.MapImported(D, ToCategory);
3995 if (
Error Err = ImportDeclContext(D))
3996 return std::move(Err);
4004 return ToImplOrErr.takeError();
4013 if (shouldForceImportDeclContext(Kind))
4014 if (
Error Err = ImportDeclContext(From))
4016 return Error::success();
4029 FromProto != FromProtoEnd;
4030 ++FromProto, ++FromProtoLoc) {
4032 Protocols.push_back(*ToProtoOrErr);
4034 return ToProtoOrErr.takeError();
4036 if (
ExpectedSLoc ToProtoLocOrErr =
import(*FromProtoLoc))
4037 ProtocolLocs.push_back(*ToProtoLocOrErr);
4039 return ToProtoLocOrErr.takeError();
4045 ProtocolLocs.data(), Importer.getToContext());
4047 if (shouldForceImportDeclContext(Kind)) {
4049 if (
Error Err = ImportDeclContext(From,
true))
4052 return Error::success();
4060 if (Definition && Definition != D) {
4061 if (
ExpectedDecl ImportedDefOrErr =
import(Definition))
4062 return Importer.MapImported(D, *ImportedDefOrErr);
4064 return ImportedDefOrErr.takeError();
4072 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
4073 return std::move(Err);
4078 auto FoundDecls = Importer.findDeclsInToCtx(DC, Name);
4079 for (
auto *FoundDecl : FoundDecls) {
4083 if ((MergeWithProtocol = dyn_cast<ObjCProtocolDecl>(FoundDecl)))
4090 if (!ToAtBeginLocOrErr)
4091 return ToAtBeginLocOrErr.takeError();
4093 if (GetImportedOrCreateDecl(ToProto, D, Importer.getToContext(), DC,
4102 Importer.MapImported(D, ToProto);
4105 if (
Error Err = ImportDefinition(D, ToProto))
4106 return std::move(Err);
4113 if (
Error Err = ImportDeclContext(D, DC, LexicalDC))
4114 return std::move(Err);
4117 if (!ExternLocOrErr)
4118 return ExternLocOrErr.takeError();
4122 return LangLocOrErr.takeError();
4127 if (GetImportedOrCreateDecl(ToLinkageSpec, D, Importer.getToContext(), DC,
4128 *ExternLocOrErr, *LangLocOrErr,
4130 return ToLinkageSpec;
4134 if (!RBraceLocOrErr)
4135 return RBraceLocOrErr.takeError();
4142 return ToLinkageSpec;
4150 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
4151 return std::move(Err);
4157 if (
auto Imp = importSeq(
4159 std::tie(ToLoc, ToUsingLoc, ToQualifierLoc) = *Imp;
4161 return Imp.takeError();
4165 return std::move(Err);
4168 if (GetImportedOrCreateDecl(ToUsing, D, Importer.getToContext(), DC,
4169 ToUsingLoc, ToQualifierLoc, NameInfo,
4177 Importer.getFromContext().getInstantiatedFromUsingDecl(D)) {
4179 Importer.getToContext().setInstantiatedFromUsingDecl(
4180 ToUsing, *ToPatternOrErr);
4182 return ToPatternOrErr.takeError();
4191 return ToShadowOrErr.takeError();
4201 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
4202 return std::move(Err);
4208 return ToUsingOrErr.takeError();
4212 return ToTargetOrErr.takeError();
4215 if (GetImportedOrCreateDecl(ToShadow, D, Importer.getToContext(), DC, Loc,
4216 *ToUsingOrErr, *ToTargetOrErr))
4223 Importer.getFromContext().getInstantiatedFromUsingShadowDecl(D)) {
4225 Importer.getToContext().setInstantiatedFromUsingShadowDecl(
4226 ToShadow, *ToPatternOrErr);
4230 return ToPatternOrErr.takeError();
4243 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
4244 return std::move(Err);
4249 if (!ToComAncestorOrErr)
4250 return ToComAncestorOrErr.takeError();
4253 SourceLocation ToUsingLoc, ToNamespaceKeyLocation, ToIdentLocation;
4255 if (
auto Imp = importSeq(
4260 ToNominatedNamespace, ToUsingLoc, ToNamespaceKeyLocation,
4261 ToQualifierLoc, ToIdentLocation) = *Imp;
4263 return Imp.takeError();
4266 if (GetImportedOrCreateDecl(ToUsingDir, D, Importer.getToContext(), DC,
4268 ToNamespaceKeyLocation,
4271 ToNominatedNamespace, *ToComAncestorOrErr))
4286 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
4287 return std::move(Err);
4293 if (
auto Imp = importSeq(
4296 std::tie(ToLoc, ToUsingLoc, ToQualifierLoc, ToEllipsisLoc) = *Imp;
4298 return Imp.takeError();
4302 return std::move(Err);
4305 if (GetImportedOrCreateDecl(ToUsingValue, D, Importer.getToContext(), DC,
4306 ToUsingLoc, ToQualifierLoc, NameInfo,
4308 return ToUsingValue;
4314 return ToUsingValue;
4323 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
4324 return std::move(Err);
4330 if (
auto Imp = importSeq(
4333 std::tie(ToUsingLoc, ToTypenameLoc, ToQualifierLoc, ToEllipsisLoc) = *Imp;
4335 return Imp.takeError();
4338 if (GetImportedOrCreateDecl(ToUsing, D, Importer.getToContext(), DC,
4339 ToUsingLoc, ToTypenameLoc,
4340 ToQualifierLoc, Loc, Name, ToEllipsisLoc))
4357 if (
auto FromSuperOrErr =
import(FromSuper))
4358 FromSuper = *FromSuperOrErr;
4360 return FromSuperOrErr.takeError();
4364 if ((
bool)FromSuper != (
bool)ToSuper ||
4367 diag::err_odr_objc_superclass_inconsistent)
4374 diag::note_odr_objc_missing_superclass);
4377 diag::note_odr_objc_superclass)
4381 diag::note_odr_objc_missing_superclass);
4384 if (shouldForceImportDeclContext(Kind))
4385 if (
Error Err = ImportDeclContext(From))
4387 return Error::success();
4398 return SuperTInfoOrErr.takeError();
4409 FromProto != FromProtoEnd;
4410 ++FromProto, ++FromProtoLoc) {
4412 Protocols.push_back(*ToProtoOrErr);
4414 return ToProtoOrErr.takeError();
4416 if (
ExpectedSLoc ToProtoLocOrErr =
import(*FromProtoLoc))
4417 ProtocolLocs.push_back(*ToProtoLocOrErr);
4419 return ToProtoLocOrErr.takeError();
4425 ProtocolLocs.data(), Importer.getToContext());
4430 auto ToCatOrErr =
import(Cat);
4432 return ToCatOrErr.takeError();
4441 return ToImplOrErr.takeError();
4444 if (shouldForceImportDeclContext(Kind)) {
4446 if (
Error Err = ImportDeclContext(From,
true))
4449 return Error::success();
4458 for (
auto *fromTypeParam : *list) {
4459 if (
auto toTypeParamOrErr =
import(fromTypeParam))
4460 toTypeParams.push_back(*toTypeParamOrErr);
4462 return toTypeParamOrErr.takeError();
4465 auto LAngleLocOrErr =
import(list->getLAngleLoc());
4466 if (!LAngleLocOrErr)
4467 return LAngleLocOrErr.takeError();
4469 auto RAngleLocOrErr =
import(list->getRAngleLoc());
4470 if (!RAngleLocOrErr)
4471 return RAngleLocOrErr.takeError();
4484 if (Definition && Definition != D) {
4485 if (
ExpectedDecl ImportedDefOrErr =
import(Definition))
4486 return Importer.MapImported(D, *ImportedDefOrErr);
4488 return ImportedDefOrErr.takeError();
4496 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
4497 return std::move(Err);
4503 auto FoundDecls = Importer.findDeclsInToCtx(DC, Name);
4504 for (
auto *FoundDecl : FoundDecls) {
4508 if ((MergeWithIface = dyn_cast<ObjCInterfaceDecl>(FoundDecl)))
4516 if (!AtBeginLocOrErr)
4517 return AtBeginLocOrErr.takeError();
4519 if (GetImportedOrCreateDecl(
4520 ToIface, D, Importer.getToContext(), DC,
4528 Importer.MapImported(D, ToIface);
4531 if (
auto ToPListOrErr =
4535 return ToPListOrErr.takeError();
4538 if (
Error Err = ImportDefinition(D, ToIface))
4539 return std::move(Err);
4548 return std::move(Err);
4553 if (
Error Err = ImportDeclContext(D, DC, LexicalDC))
4554 return std::move(Err);
4557 if (
auto Imp = importSeq(
4559 std::tie(ToLocation, ToAtStartLoc, ToCategoryNameLoc) = *Imp;
4561 return Imp.takeError();
4563 if (GetImportedOrCreateDecl(
4564 ToImpl, D, Importer.getToContext(), DC,
4566 ToLocation, ToAtStartLoc, ToCategoryNameLoc))
4574 Importer.MapImported(D, ToImpl);
4575 if (
Error Err = ImportDeclContext(D))
4576 return std::move(Err);
4586 return std::move(Err);
4591 return std::move(Err);
4598 if (
Error Err = ImportDeclContext(D, DC, LexicalDC))
4599 return std::move(Err);
4603 if (
auto Imp = importSeq(
4607 ToLocation, ToAtStartLoc, ToSuperClassLoc,
4608 ToIvarLBraceLoc, ToIvarRBraceLoc) = *Imp;
4610 return Imp.takeError();
4612 if (GetImportedOrCreateDecl(Impl, D, Importer.getToContext(),
4624 Iface->setImplementation(Impl);
4625 Importer.MapImported(D, Iface->getImplementation());
4636 diag::err_odr_objc_superclass_inconsistent)
4642 diag::note_odr_objc_superclass)
4646 diag::note_odr_objc_missing_superclass);
4649 diag::note_odr_objc_superclass)
4653 diag::note_odr_objc_missing_superclass);
4660 if (
Error Err = ImportDeclContext(D))
4661 return std::move(Err);
4672 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
4673 return std::move(Err);
4678 auto FoundDecls = Importer.findDeclsInToCtx(DC, Name);
4679 for (
auto *FoundDecl : FoundDecls) {
4680 if (
auto *FoundProp = dyn_cast<ObjCPropertyDecl>(FoundDecl)) {
4682 if (!Importer.IsStructurallyEquivalent(D->
getType(),
4683 FoundProp->getType())) {
4684 Importer.ToDiag(Loc, diag::err_odr_objc_property_type_inconsistent)
4685 << Name << D->
getType() << FoundProp->getType();
4686 Importer.ToDiag(FoundProp->getLocation(), diag::note_odr_value_here)
4687 << FoundProp->getType();
4695 Importer.MapImported(D, FoundProp);
4703 if (
auto Imp = importSeq(
4705 std::tie(ToType, ToTypeSourceInfo, ToAtLoc, ToLParenLoc) = *Imp;
4707 return Imp.takeError();
4711 if (GetImportedOrCreateDecl(
4712 ToProperty, D, Importer.getToContext(), DC, Loc,
4714 ToLParenLoc, ToType,
4718 Selector ToGetterName, ToSetterName;
4722 if (
auto Imp = importSeq(
4728 ToGetterName, ToSetterName,
4729 ToGetterNameLoc, ToSetterNameLoc,
4730 ToGetterMethodDecl, ToSetterMethodDecl,
4731 ToPropertyIvarDecl) = *Imp;
4733 return Imp.takeError();
4753 return std::move(Err);
4756 if (
Error Err = ImportDeclContext(D, DC, LexicalDC))
4757 return std::move(Err);
4759 auto *InImpl = cast<ObjCImplDecl>(LexicalDC);
4764 return std::move(Err);
4771 if (
auto Imp = importSeq(
4773 std::tie(ToBeginLoc, ToLocation, ToPropertyIvarDeclLoc) = *Imp;
4775 return Imp.takeError();
4777 if (GetImportedOrCreateDecl(ToImpl, D, Importer.getToContext(), DC,
4781 ToPropertyIvarDeclLoc))
4791 diag::err_odr_objc_property_impl_kind_inconsistent)
4796 diag::note_odr_objc_property_impl_kind)
4807 diag::err_odr_objc_synthesize_ivar_inconsistent)
4810 << Ivar->getDeclName();
4812 diag::note_odr_objc_synthesize_ivar_here)
4819 Importer.MapImported(D, ToImpl);
4835 return BeginLocOrErr.takeError();
4839 return LocationOrErr.takeError();
4842 (void)GetImportedOrCreateDecl(
4843 ToD, D, Importer.getToContext(),
4845 *BeginLocOrErr, *LocationOrErr,
4857 if (
auto Imp = importSeq(
4861 ToDeclName, ToLocation, ToType, ToTypeSourceInfo,
4862 ToInnerLocStart) = *Imp;
4864 return Imp.takeError();
4869 (void)GetImportedOrCreateDecl(
4870 ToD, D, Importer.getToContext(),
4872 ToInnerLocStart, ToLocation, D->
getDepth(),
4883 return NameOrErr.takeError();
4888 return LocationOrErr.takeError();
4891 auto TemplateParamsOrErr = ImportTemplateParameterList(
4893 if (!TemplateParamsOrErr)
4894 return TemplateParamsOrErr.takeError();
4899 (void)GetImportedOrCreateDecl(
4900 ToD, D, Importer.getToContext(),
4903 (*NameOrErr).getAsIdentifierInfo(),
4904 *TemplateParamsOrErr);
4912 if (!ToTemplatedDef)
4916 return TemplateWithDef;
4926 if (Definition && Definition != D && !IsFriend) {
4927 if (
ExpectedDecl ImportedDefOrErr =
import(Definition))
4928 return Importer.MapImported(D, *ImportedDefOrErr);
4930 return ImportedDefOrErr.takeError();
4938 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
4939 return std::move(Err);
4948 auto FoundDecls = Importer.findDeclsInToCtx(DC, Name);
4949 for (
auto *FoundDecl : FoundDecls) {
4954 Decl *Found = FoundDecl;
4956 if (FoundTemplate) {
4958 if (IsStructuralMatch(D, FoundTemplate)) {
4961 return Importer.MapImported(D, TemplateWithDef);
4963 FoundByLookup = FoundTemplate;
4968 ConflictingDecls.push_back(FoundDecl);
4971 if (!ConflictingDecls.empty()) {
4973 ConflictingDecls.data(),
4974 ConflictingDecls.size());
4985 if (
Error Err = importInto(ToTemplated, FromTemplated))
4986 return std::move(Err);
4989 auto TemplateParamsOrErr = ImportTemplateParameterList(
4991 if (!TemplateParamsOrErr)
4992 return TemplateParamsOrErr.takeError();
4995 if (GetImportedOrCreateDecl(D2, D, Importer.getToContext(), DC, Loc, Name,
4996 *TemplateParamsOrErr, ToTemplated))
5009 if (FoundByLookup) {
5024 if (ToTemplated != PrevTemplated)
5031 if (LexicalDC != DC && IsFriend)
5034 if (FromTemplated->isCompleteDefinition() &&
5048 if (Definition && Definition != D) {
5049 if (
ExpectedDecl ImportedDefOrErr =
import(Definition))
5050 return Importer.MapImported(D, *ImportedDefOrErr);
5052 return ImportedDefOrErr.takeError();
5057 return std::move(Err);
5061 if (
Error Err = ImportDeclContext(D, DC, LexicalDC))
5062 return std::move(Err);
5066 if (
Error Err = ImportTemplateArguments(
5068 return std::move(Err);
5071 void *InsertPos =
nullptr;
5086 return Importer.MapImported(D, FoundDef);
5089 if (IsStructuralMatch(D, FoundDef)) {
5091 Importer.MapImported(D, FoundDef);
5095 for (
auto *FromField : D->
fields()) {
5096 auto ToOrErr =
import(FromField);
5099 consumeError(ToOrErr.takeError());
5105 auto ToOrErr =
import(FromM);
5108 consumeError(ToOrErr.takeError());
5126 return BeginLocOrErr.takeError();
5129 return IdLocOrErr.takeError();
5135 if (
Error Err = ImportTemplateArgumentListInfo(ASTTemplateArgs, ToTAInfo))
5136 return std::move(Err);
5139 if (
Error Err = importInto(
5141 return std::move(Err);
5144 auto ToTPListOrErr = ImportTemplateParameterList(
5147 return ToTPListOrErr.takeError();
5149 if (GetImportedOrCreateDecl<ClassTemplatePartialSpecializationDecl>(
5150 D2, D, Importer.getToContext(), D->
getTagKind(), DC,
5151 *BeginLocOrErr, *IdLocOrErr, *ToTPListOrErr, ClassTemplate,
5152 llvm::makeArrayRef(TemplateArgs.data(), TemplateArgs.size()),
5153 ToTAInfo, CanonInjType,
5154 cast_or_null<ClassTemplatePartialSpecializationDecl>(PrevDecl)))
5159 if (!ClassTemplate->findPartialSpecialization(TemplateArgs, InsertPos))
5161 ClassTemplate->AddPartialSpecialization(
5162 cast<ClassTemplatePartialSpecializationDecl>(D2), InsertPos);
5165 if (GetImportedOrCreateDecl(
5166 D2, D, Importer.getToContext(), D->
getTagKind(), DC,
5167 *BeginLocOrErr, *IdLocOrErr, ClassTemplate, TemplateArgs,
5173 if (!ClassTemplate->findSpecialization(TemplateArgs, InsertPos))
5175 ClassTemplate->AddSpecialization(D2, InsertPos);
5184 return LocOrErr.takeError();
5187 if (
auto TInfoOrErr =
import(TSI))
5190 return TInfoOrErr.takeError();
5195 return LocOrErr.takeError();
5200 return LocOrErr.takeError();
5207 return POIOrErr.takeError();
5221 if (
Error Err = ImportDefinition(D, D2))
5222 return std::move(Err);
5236 Definition->getDescribedVarTemplate()))
5237 return Importer.MapImported(D, *ImportedDefOrErr);
5239 return ImportedDefOrErr.takeError();
5247 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
5248 return std::move(Err);
5254 "Variable templates cannot be declared at function scope");
5256 auto FoundDecls = Importer.findDeclsInToCtx(DC, Name);
5257 for (
auto *FoundDecl : FoundDecls) {
5261 Decl *Found = FoundDecl;
5262 if (
VarTemplateDecl *FoundTemplate = dyn_cast<VarTemplateDecl>(Found)) {
5263 if (IsStructuralMatch(D, FoundTemplate)) {
5266 FoundTemplate->getTemplatedDecl());
5267 return Importer.MapImported(D, FoundTemplate);
5271 ConflictingDecls.push_back(FoundDecl);
5274 if (!ConflictingDecls.empty()) {
5276 ConflictingDecls.data(),
5277 ConflictingDecls.size());
5289 ExpectedType TypeOrErr =
import(DTemplated->getType());
5291 return TypeOrErr.takeError();
5295 if (
Error Err = importInto(ToTemplated, DTemplated))
5296 return std::move(Err);
5299 auto TemplateParamsOrErr = ImportTemplateParameterList(
5301 if (!TemplateParamsOrErr)
5302 return TemplateParamsOrErr.takeError();
5305 if (GetImportedOrCreateDecl(ToVarTD, D, Importer.getToContext(), DC, Loc,
5306 Name, *TemplateParamsOrErr, ToTemplated))
5315 if (DTemplated->isThisDeclarationADefinition() &&
5329 if (Definition && Definition != D) {
5330 if (
ExpectedDecl ImportedDefOrErr =
import(Definition))
5331 return Importer.MapImported(D, *ImportedDefOrErr);
5333 return ImportedDefOrErr.takeError();
5338 return std::move(Err);
5342 if (
Error Err = ImportDeclContext(D, DC, LexicalDC))
5343 return std::move(Err);
5348 return BeginLocOrErr.takeError();
5352 return IdLocOrErr.takeError();
5356 if (
Error Err = ImportTemplateArguments(
5358 return std::move(Err);
5361 void *InsertPos =
nullptr;
5363 TemplateArgs, InsertPos);
5372 IsStructuralMatch(D, FoundDef)) {
5376 return Importer.MapImported(D, FoundDef);
5383 return std::move(Err);
5387 return TInfoOrErr.takeError();
5390 if (
Error Err = ImportTemplateArgumentListInfo(
5392 return std::move(Err);
5396 if (
auto *FromPartial = dyn_cast<PartVarSpecDecl>(D)) {
5399 const auto *FromTAArgsAsWritten = FromPartial->getTemplateArgsAsWritten();
5401 if (
Error Err = ImportTemplateArgumentListInfo(
5402 *FromTAArgsAsWritten, ArgInfos))
5403 return std::move(Err);
5405 auto ToTPListOrErr = ImportTemplateParameterList(
5406 FromPartial->getTemplateParameters());
5408 return ToTPListOrErr.takeError();
5410 PartVarSpecDecl *ToPartial;
5411 if (GetImportedOrCreateDecl(ToPartial, D, Importer.getToContext(), DC,
5412 *BeginLocOrErr, *IdLocOrErr, *ToTPListOrErr,
5413 VarTemplate, T, *TInfoOrErr,
5418 FromPartial->getInstantiatedFromMember()))
5419 ToPartial->setInstantiatedFromMember(*ToInstOrErr);
5421 return ToInstOrErr.takeError();
5423 if (FromPartial->isMemberSpecialization())
5424 ToPartial->setMemberSpecialization();
5429 if (GetImportedOrCreateDecl(D2, D, Importer.getToContext(), DC,
5430 *BeginLocOrErr, *IdLocOrErr, VarTemplate,
5440 return POIOrErr.takeError();
5453 return LocOrErr.takeError();
5465 if (
Error Err = ImportInitializer(D, D2))
5466 return std::move(Err);
5478 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
5479 return std::move(Err);
5488 auto FoundDecls = Importer.findDeclsInToCtx(DC, Name);
5489 for (
auto *FoundDecl : FoundDecls) {
5493 if (
auto *FoundFunction =
5494 dyn_cast<FunctionTemplateDecl>(FoundDecl)) {
5495 if (FoundFunction->hasExternalFormalLinkage() &&
5497 if (IsStructuralMatch(D, FoundFunction)) {
5498 Importer.MapImported(D, FoundFunction);
5500 return FoundFunction;
5508 auto ParamsOrErr = ImportTemplateParameterList(
5511 return ParamsOrErr.takeError();
5515 return std::move(Err);
5518 if (GetImportedOrCreateDecl(ToFunc, D, Importer.getToContext(), DC, Loc, Name,
5519 *ParamsOrErr, TemplatedFD))
5535 Importer.FromDiag(S->
getBeginLoc(), diag::err_unsupported_ast_node)
5547 Names.push_back(ToII);
5550 for (
unsigned I = 0, E = S->
getNumInputs(); I != E; I++) {
5554 Names.push_back(ToII);
5560 Clobbers.push_back(*ClobberOrErr);
5562 return ClobberOrErr.takeError();
5569 Constraints.push_back(*OutputOrErr);
5571 return OutputOrErr.takeError();
5574 for (
unsigned I = 0, E = S->
getNumInputs(); I != E; I++) {
5576 Constraints.push_back(*InputOrErr);
5578 return InputOrErr.takeError();
5582 if (
Error Err = ImportContainerChecked(S->
outputs(), Exprs))
5583 return std::move(Err);
5585 if (
Error Err = ImportArrayChecked(
5587 return std::move(Err);
5591 return AsmLocOrErr.takeError();
5594 return AsmStrOrErr.takeError();
5596 if (!RParenLocOrErr)
5597 return RParenLocOrErr.takeError();
5599 return new (Importer.getToContext())
GCCAsmStmt(
5600 Importer.getToContext(),
5618 return Imp.takeError();
5622 std::tie(ToDG, ToBeginLoc, ToEndLoc) = *Imp;
5624 return new (Importer.getToContext())
DeclStmt(ToDG, ToBeginLoc, ToEndLoc);
5629 if (!ToSemiLocOrErr)
5630 return ToSemiLocOrErr.takeError();
5631 return new (Importer.getToContext())
NullStmt(
5638 if (
Error Err = ImportContainerChecked(S->
body(), ToStmts))
5639 return std::move(Err);
5642 if (!ToLBracLocOrErr)
5643 return ToLBracLocOrErr.takeError();
5646 if (!ToRBracLocOrErr)
5647 return ToRBracLocOrErr.takeError();
5650 Importer.getToContext(), ToStmts,
5651 *ToLBracLocOrErr, *ToRBracLocOrErr);
5655 auto Imp = importSeq(
5659 return Imp.takeError();
5661 Expr *ToLHS, *ToRHS;
5664 std::tie(ToLHS, ToRHS, ToSubStmt, ToCaseLoc, ToEllipsisLoc, ToColonLoc) =
5668 ToCaseLoc, ToEllipsisLoc, ToColonLoc);
5677 return Imp.takeError();
5681 std::tie(ToDefaultLoc, ToColonLoc, ToSubStmt) = *Imp;
5684 ToDefaultLoc, ToColonLoc, ToSubStmt);
5690 return Imp.takeError();
5695 std::tie(ToIdentLoc, ToLabelDecl, ToSubStmt) = *Imp;
5697 return new (Importer.getToContext())
LabelStmt(
5698 ToIdentLoc, ToLabelDecl, ToSubStmt);
5703 if (!ToAttrLocOrErr)
5704 return ToAttrLocOrErr.takeError();
5707 if (
Error Err = ImportContainerChecked(FromAttrs, ToAttrs))
5708 return std::move(Err);
5710 if (!ToSubStmtOrErr)
5711 return ToSubStmtOrErr.takeError();
5714 Importer.getToContext(), *ToAttrLocOrErr, ToAttrs, *ToSubStmtOrErr);
5718 auto Imp = importSeq(
5722 return Imp.takeError();
5725 Stmt *ToInit, *ToThen, *ToElse;
5729 ToIfLoc, ToInit, ToConditionVariable, ToCond, ToThen, ToElseLoc, ToElse) =
5733 ToInit, ToConditionVariable, ToCond, ToThen, ToElseLoc,
5738 auto Imp = importSeq(
5742 return Imp.takeError();
5744 Stmt *ToInit, *ToBody;
5748 std::tie(ToInit, ToConditionVariable, ToCond, ToBody, ToSwitchLoc) = *Imp;
5751 ToConditionVariable, ToCond);
5753 ToStmt->setSwitchLoc(ToSwitchLoc);
5761 return ToSCOrErr.takeError();
5762 if (LastChainedSwitchCase)
5765 ToStmt->setSwitchCaseList(*ToSCOrErr);
5766 LastChainedSwitchCase = *ToSCOrErr;
5773 auto Imp = importSeq(
5776 return Imp.takeError();
5782 std::tie(ToConditionVariable, ToCond, ToBody, ToWhileLoc) = *Imp;
5785 ToBody, ToWhileLoc);
5789 auto Imp = importSeq(
5793 return Imp.takeError();
5798 std::tie(ToBody, ToCond, ToDoLoc, ToWhileLoc, ToRParenLoc) = *Imp;
5800 return new (Importer.getToContext())
DoStmt(
5801 ToBody, ToCond, ToDoLoc, ToWhileLoc, ToRParenLoc);
5805 auto Imp = importSeq(
5809 return Imp.takeError();
5812 Expr *ToCond, *ToInc;
5817 ToInit, ToCond, ToConditionVariable, ToInc, ToBody, ToForLoc,
5818 ToLParenLoc, ToRParenLoc) = *Imp;
5820 return new (Importer.getToContext())
ForStmt(
5821 Importer.getToContext(),
5822 ToInit, ToCond, ToConditionVariable, ToInc, ToBody, ToForLoc, ToLParenLoc,
5829 return Imp.takeError();
5833 std::tie(ToLabel, ToGotoLoc, ToLabelLoc) = *Imp;
5835 return new (Importer.getToContext())
GotoStmt(
5836 ToLabel, ToGotoLoc, ToLabelLoc);
5842 return Imp.takeError();
5846 std::tie(ToGotoLoc, ToStarLoc, ToTarget) = *Imp;
5849 ToGotoLoc, ToStarLoc, ToTarget);
5854 if (!ToContinueLocOrErr)
5855 return ToContinueLocOrErr.takeError();
5856 return new (Importer.getToContext())
ContinueStmt(*ToContinueLocOrErr);
5861 if (!ToBreakLocOrErr)
5862 return ToBreakLocOrErr.takeError();
5863 return new (Importer.getToContext())
BreakStmt(*ToBreakLocOrErr);
5867 auto Imp = importSeq(
5870 return Imp.takeError();
5874 const VarDecl *ToNRVOCandidate;
5875 std::tie(ToReturnLoc, ToRetValue, ToNRVOCandidate) = *Imp;
5882 auto Imp = importSeq(
5885 return Imp.takeError();
5889 Stmt *ToHandlerBlock;
5890 std::tie(ToCatchLoc, ToExceptionDecl, ToHandlerBlock) = *Imp;
5893 ToCatchLoc, ToExceptionDecl, ToHandlerBlock);
5899 return ToTryLocOrErr.takeError();
5902 if (!ToTryBlockOrErr)
5903 return ToTryBlockOrErr.takeError();
5906 for (
unsigned HI = 0, HE = S->
getNumHandlers(); HI != HE; ++HI) {
5908 if (
auto ToHandlerOrErr =
import(FromHandler))
5909 ToHandlers[HI] = *ToHandlerOrErr;
5911 return ToHandlerOrErr.takeError();
5915 Importer.getToContext(), *ToTryLocOrErr,*ToTryBlockOrErr, ToHandlers);
5919 auto Imp1 = importSeq(
5923 return Imp1.takeError();
5924 auto Imp2 = importSeq(
5927 return Imp2.takeError();
5929 DeclStmt *ToRangeStmt, *ToBeginStmt, *ToEndStmt, *ToLoopVarStmt;
5930 Expr *ToCond, *ToInc;
5931 Stmt *ToInit, *ToBody;
5933 ToInit, ToRangeStmt, ToBeginStmt, ToEndStmt, ToCond, ToInc, ToLoopVarStmt,
5936 std::tie(ToForLoc, ToCoawaitLoc, ToColonLoc, ToRParenLoc) = *Imp2;
5939 ToInit, ToRangeStmt, ToBeginStmt, ToEndStmt, ToCond, ToInc, ToLoopVarStmt,
5940 ToBody, ToForLoc, ToCoawaitLoc, ToColonLoc, ToRParenLoc);
5945 auto Imp = importSeq(
5949 return Imp.takeError();
5951 Stmt *ToElement, *ToBody;
5954 std::tie(ToElement, ToCollection, ToBody, ToForLoc, ToRParenLoc) = *Imp;
5964 auto Imp = importSeq(
5968 return Imp.takeError();
5973 std::tie(ToAtCatchLoc, ToRParenLoc, ToCatchParamDecl, ToCatchBody) = *Imp;
5976 ToAtCatchLoc, ToRParenLoc, ToCatchParamDecl, ToCatchBody);
5981 if (!ToAtFinallyLocOrErr)
5982 return ToAtFinallyLocOrErr.takeError();
5984 if (!ToAtFinallyStmtOrErr)
5985 return ToAtFinallyStmtOrErr.takeError();
5987 *ToAtFinallyStmtOrErr);
5991 auto Imp = importSeq(
5994 return Imp.takeError();
5997 Stmt *ToTryBody, *ToFinallyStmt;
5998 std::tie(ToAtTryLoc, ToTryBody, ToFinallyStmt) = *Imp;
6003 if (
ExpectedStmt ToCatchStmtOrErr =
import(FromCatchStmt))
6004 ToCatchStmts[CI] = *ToCatchStmtOrErr;
6006 return ToCatchStmtOrErr.takeError();
6010 ToAtTryLoc, ToTryBody,
6011 ToCatchStmts.begin(), ToCatchStmts.size(),
6017 auto Imp = importSeq(
6020 return Imp.takeError();
6025 std::tie(ToAtSynchronizedLoc, ToSynchExpr, ToSynchBody) = *Imp;
6028 ToAtSynchronizedLoc, ToSynchExpr, ToSynchBody);
6033 if (!ToThrowLocOrErr)
6034 return ToThrowLocOrErr.takeError();
6036 if (!ToThrowExprOrErr)
6037 return ToThrowExprOrErr.takeError();
6039 *ToThrowLocOrErr, *ToThrowExprOrErr);
6046 return ToAtLocOrErr.takeError();
6048 if (!ToSubStmtOrErr)
6049 return ToSubStmtOrErr.takeError();
6058 Importer.FromDiag(E->
getBeginLoc(), diag::err_unsupported_ast_node)
6064 auto Imp = importSeq(
6068 return Imp.takeError();
6074 std::tie(ToBuiltinLoc, ToSubExpr, ToWrittenTypeInfo, ToRParenLoc, ToType) =
6077 return new (Importer.getToContext())
VAArgExpr(
6078 ToBuiltinLoc, ToSubExpr, ToWrittenTypeInfo, ToRParenLoc, ToType,
6086 return TypeOrErr.takeError();
6090 return BeginLocOrErr.takeError();
6092 return new (Importer.getToContext())
GNUNullExpr(*TypeOrErr, *BeginLocOrErr);
6096 auto Imp = importSeq(
6099 return Imp.takeError();
6104 std::tie(ToBeginLoc, ToType, ToFunctionName) = *Imp;
6111 auto Imp = importSeq(
6115 return Imp.takeError();
6121 std::tie(ToQualifierLoc, ToTemplateKeywordLoc, ToDecl, ToLocation, ToType) =
6128 return FoundDOrErr.takeError();
6129 ToFoundD = *FoundDOrErr;
6137 return std::move(Err);
6138 ToResInfo = &ToTAInfo;
6142 Importer.getToContext(), ToQualifierLoc, ToTemplateKeywordLoc, ToDecl,
6153 return TypeOrErr.takeError();
6161 return ToInitOrErr.takeError();
6164 if (!ToEqualOrColonLocOrErr)
6165 return ToEqualOrColonLocOrErr.takeError();
6171 ToIndexExprs[I - 1] = *ToArgOrErr;
6173 return ToArgOrErr.takeError();
6178 return std::move(Err);
6181 Importer.getToContext(), ToDesignators,
6182 ToIndexExprs, *ToEqualOrColonLocOrErr,
6190 return ToTypeOrErr.takeError();
6193 if (!ToLocationOrErr)
6194 return ToLocationOrErr.takeError();
6197 *ToTypeOrErr, *ToLocationOrErr);
6203 return ToTypeOrErr.takeError();
6206 if (!ToLocationOrErr)
6207 return ToLocationOrErr.takeError();
6210 Importer.getToContext(), E->
getValue(), *ToTypeOrErr, *ToLocationOrErr);
6217 return ToTypeOrErr.takeError();
6220 if (!ToLocationOrErr)
6221 return ToLocationOrErr.takeError();
6225 *ToTypeOrErr, *ToLocationOrErr);
6229 auto ToTypeOrErr =
import(E->
getType());
6231 return ToTypeOrErr.takeError();
6234 if (!ToSubExprOrErr)
6235 return ToSubExprOrErr.takeError();
6238 *ToSubExprOrErr, *ToTypeOrErr);
6244 return ToTypeOrErr.takeError();
6247 if (!ToLocationOrErr)
6248 return ToLocationOrErr.takeError();
6257 return ToTypeOrErr.takeError();
6260 if (
Error Err = ImportArrayChecked(
6262 return std::move(Err);
6266 *ToTypeOrErr, ToLocations.data(), ToLocations.size());
6270 auto Imp = importSeq(
6274 return Imp.takeError();
6279 Expr *ToInitializer;
6280 std::tie(ToLParenLoc, ToTypeSourceInfo, ToType, ToInitializer) = *Imp;
6283 ToLParenLoc, ToTypeSourceInfo, ToType, E->
getValueKind(),
6288 auto Imp = importSeq(
6291 return Imp.takeError();
6295 std::tie(ToBuiltinLoc, ToType, ToRParenLoc) = *Imp;
6298 if (
Error Err = ImportArrayChecked(
6301 return std::move(Err);
6303 return new (Importer.getToContext())
AtomicExpr(
6304 ToBuiltinLoc, ToExprs, ToType, E->
getOp(), ToRParenLoc);
6308 auto Imp = importSeq(
6311 return Imp.takeError();
6316 std::tie(ToAmpAmpLoc, ToLabelLoc, ToLabel, ToType) = *Imp;
6319 ToAmpAmpLoc, ToLabelLoc, ToLabel, ToType);
6325 return Imp.takeError();
6328 std::tie(ToSubExpr) = *Imp;
6336 return Imp.takeError();
6340 std::tie(ToLParen, ToRParen, ToSubExpr) = *Imp;
6342 return new (Importer.getToContext())
6343 ParenExpr(ToLParen, ToRParen, ToSubExpr);
6348 if (
Error Err = ImportContainerChecked(E->
exprs(), ToExprs))
6349 return std::move(Err);
6352 if (!ToLParenLocOrErr)
6353 return ToLParenLocOrErr.takeError();
6356 if (!ToRParenLocOrErr)
6357 return ToRParenLocOrErr.takeError();
6360 ToExprs, *ToRParenLocOrErr);
6364 auto Imp = importSeq(
6367 return Imp.takeError();
6372 std::tie(ToSubStmt, ToType, ToLParenLoc, ToRParenLoc) = *Imp;
6374 return new (Importer.getToContext())
StmtExpr(
6375 ToSubStmt, ToType, ToLParenLoc, ToRParenLoc);
6379 auto Imp = importSeq(
6382 return Imp.takeError();
6387 std::tie(ToSubExpr, ToType, ToOperatorLoc) = *Imp;
6398 return Imp.takeError();
6402 std::tie(ToType, ToOperatorLoc, ToRParenLoc) = *Imp;
6407 if (!ToArgumentTypeInfoOrErr)
6408 return ToArgumentTypeInfoOrErr.takeError();
6411 E->
getKind(), *ToArgumentTypeInfoOrErr, ToType, ToOperatorLoc,
6416 if (!ToArgumentExprOrErr)
6417 return ToArgumentExprOrErr.takeError();
6420 E->
getKind(), *ToArgumentExprOrErr, ToType, ToOperatorLoc, ToRParenLoc);
6424 auto Imp = importSeq(
6427 return Imp.takeError();
6429 Expr *ToLHS, *ToRHS;
6432 std::tie(ToLHS, ToRHS, ToType, ToOperatorLoc) = *Imp;
6440 auto Imp = importSeq(
6444 return Imp.takeError();
6446 Expr *ToCond, *ToLHS, *ToRHS;
6449 std::tie(ToCond, ToQuestionLoc, ToLHS, ToColonLoc, ToRHS, ToType) = *Imp;
6452 ToCond, ToQuestionLoc, ToLHS, ToColonLoc, ToRHS, ToType,
6458 auto Imp = importSeq(
6462 return Imp.takeError();
6464 Expr *ToCommon, *ToCond, *ToTrueExpr, *ToFalseExpr;
6469 ToCommon, ToOpaqueValue, ToCond, ToTrueExpr, ToFalseExpr, ToQuestionLoc,
6470 ToColonLoc, ToType) = *Imp;
6473 ToCommon, ToOpaqueValue, ToCond, ToTrueExpr, ToFalseExpr,
6479 auto Imp = importSeq(
6483 return Imp.takeError();
6487 Expr *ToDimensionExpression;
6490 ToBeginLoc, ToQueriedTypeSourceInfo, ToDimensionExpression, ToEndLoc,
6495 ToDimensionExpression, ToEndLoc, ToType);
6499 auto Imp = importSeq(
6502 return Imp.takeError();
6505 Expr *ToQueriedExpression;
6507 std::tie(ToBeginLoc, ToQueriedExpression, ToEndLoc, ToType) = *Imp;
6515 auto Imp = importSeq(
6518 return Imp.takeError();
6523 std::tie(ToLocation, ToType, ToSourceExpr) = *Imp;
6530 auto Imp = importSeq(
6533 return Imp.takeError();
6535 Expr *ToLHS, *ToRHS;
6538 std::tie(ToLHS, ToRHS, ToType, ToRBracketLoc) = *Imp;
6547 auto Imp = importSeq(
6551 return Imp.takeError();
6553 Expr *ToLHS, *ToRHS;
6554 QualType ToType, ToComputationLHSType, ToComputationResultType;
6556 std::tie(ToLHS, ToRHS, ToType, ToComputationLHSType, ToComputationResultType,
6557 ToOperatorLoc) = *Imp;
6561 E->
getObjectKind(), ToComputationLHSType, ToComputationResultType,
6569 if (
auto SpecOrErr =
import(*I))
6570 Path.push_back(*SpecOrErr);
6572 return SpecOrErr.takeError();
6580 return ToTypeOrErr.takeError();
6583 if (!ToSubExprOrErr)
6584 return ToSubExprOrErr.takeError();
6587 if (!ToBasePathOrErr)
6588 return ToBasePathOrErr.takeError();
6591 Importer.getToContext(), *ToTypeOrErr, E->
getCastKind(), *ToSubExprOrErr,
6596 auto Imp1 = importSeq(
6599 return Imp1.takeError();
6604 std::tie(ToType, ToSubExpr, ToTypeInfoAsWritten) = *Imp1;
6607 if (!ToBasePathOrErr)
6608 return ToBasePathOrErr.takeError();
6612 case Stmt::CStyleCastExprClass: {
6613 auto *CCE = cast<CStyleCastExpr>(E);
6614 ExpectedSLoc ToLParenLocOrErr =
import(CCE->getLParenLoc());
6615 if (!ToLParenLocOrErr)
6616 return ToLParenLocOrErr.takeError();
6617 ExpectedSLoc ToRParenLocOrErr =
import(CCE->getRParenLoc());
6618 if (!ToRParenLocOrErr)
6619 return ToRParenLocOrErr.takeError();
6622 ToSubExpr, ToBasePath, ToTypeInfoAsWritten, *ToLParenLocOrErr,
6626 case Stmt::CXXFunctionalCastExprClass: {
6627 auto *FCE = cast<CXXFunctionalCastExpr>(E);
6628 ExpectedSLoc ToLParenLocOrErr =
import(FCE->getLParenLoc());
6629 if (!ToLParenLocOrErr)
6630 return ToLParenLocOrErr.takeError();
6631 ExpectedSLoc ToRParenLocOrErr =
import(FCE->getRParenLoc());
6632 if (!ToRParenLocOrErr)
6633 return ToRParenLocOrErr.takeError();
6635 Importer.getToContext(), ToType, E->
getValueKind(), ToTypeInfoAsWritten,
6636 E->
getCastKind(), ToSubExpr, ToBasePath, *ToLParenLocOrErr,
6640 case Stmt::ObjCBridgedCastExprClass: {
6641 auto *OCE = cast<ObjCBridgedCastExpr>(E);
6642 ExpectedSLoc ToLParenLocOrErr =
import(OCE->getLParenLoc());
6643 if (!ToLParenLocOrErr)
6644 return ToLParenLocOrErr.takeError();
6645 ExpectedSLoc ToBridgeKeywordLocOrErr =
import(OCE->getBridgeKeywordLoc());
6646 if (!ToBridgeKeywordLocOrErr)
6647 return ToBridgeKeywordLocOrErr.takeError();
6649 *ToLParenLocOrErr, OCE->getBridgeKind(), E->
getCastKind(),
6650 *ToBridgeKeywordLocOrErr, ToTypeInfoAsWritten, ToSubExpr);
6653 llvm_unreachable(
"Cast expression of unsupported type!");
6667 return Imp.takeError();
6668 std::tie(ToBeginLoc, ToEndLoc) = *Imp;
6677 auto ToBSOrErr =
import(FromNode.
getBase());
6679 return ToBSOrErr.takeError();
6684 auto ToFieldOrErr =
import(FromNode.
getField());
6686 return ToFieldOrErr.takeError();
6687 ToNodes.push_back(
OffsetOfNode(ToBeginLoc, *ToFieldOrErr, ToEndLoc));
6692 ToNodes.push_back(
OffsetOfNode(ToBeginLoc, ToII, ToEndLoc));
6701 if (!ToIndexExprOrErr)
6702 return ToIndexExprOrErr.takeError();
6703 ToExprs[I] = *ToIndexExprOrErr;
6706 auto Imp = importSeq(
6710 return Imp.takeError();
6715 std::tie(ToType, ToTypeSourceInfo, ToOperatorLoc, ToRParenLoc) = *Imp;
6718 Importer.getToContext(), ToType, ToOperatorLoc, ToTypeSourceInfo, ToNodes,
6719 ToExprs, ToRParenLoc);
6723 auto Imp = importSeq(
6726 return Imp.takeError();
6731 std::tie(ToType, ToOperand, ToBeginLoc, ToEndLoc) = *Imp;
6740 ToType, ToOperand, ToCanThrow, ToBeginLoc, ToEndLoc);
6746 return Imp.takeError();
6751 std::tie(ToSubExpr, ToType, ToThrowLoc) = *Imp;
6759 if (!ToUsedLocOrErr)
6760 return ToUsedLocOrErr.takeError();
6762 auto ToParamOrErr =
import(E->
getParam());
6764 return ToParamOrErr.takeError();
6767 Importer.getToContext(), *ToUsedLocOrErr, *ToParamOrErr);
6772 auto Imp = importSeq(
6775 return Imp.takeError();
6780 std::tie(ToType, ToTypeSourceInfo, ToRParenLoc) = *Imp;
6783 ToType, ToTypeSourceInfo, ToRParenLoc);
6789 if (!ToSubExprOrErr)
6790 return ToSubExprOrErr.takeError();
6794 return ToDtorOrErr.takeError();
6803 auto Imp = importSeq(
6807 return Imp.takeError();
6813 std::tie(ToConstructor, ToType, ToTypeSourceInfo, ToParenOrBraceRange) = *Imp;
6817 return std::move(Err);
6820 Importer.getToContext(), ToConstructor, ToType, ToTypeSourceInfo, ToArgs,
6828 auto Imp = importSeq(
6831 return Imp.takeError();
6834 Expr *ToTemporaryExpr;
6836 std::tie(ToType, ToTemporaryExpr, ToExtendingDecl) = *Imp;
6847 auto Imp = importSeq(
6850 return Imp.takeError();
6855 std::tie(ToType, ToPattern, ToEllipsisLoc) = *Imp;
6862 auto Imp = importSeq(
6865 return Imp.takeError();
6869 std::tie(ToOperatorLoc, ToPack, ToPackLoc, ToRParenLoc) = *Imp;
6877 if (
Error Err = ImportTemplateArguments(
6880 ToPartialArguments))
6881 return std::move(Err);
6885 Importer.getToContext(), ToOperatorLoc, ToPack, ToPackLoc, ToRParenLoc,
6886 Length, ToPartialArguments);
6891 auto Imp = importSeq(
6897 return Imp.takeError();
6900 SourceRange ToTypeIdParens, ToSourceRange, ToDirectInitRange;
6901 Expr *ToArraySize, *ToInitializer;
6905 ToOperatorNew, ToOperatorDelete, ToTypeIdParens, ToArraySize, ToInitializer,
6906 ToType, ToAllocatedTypeSourceInfo, ToSourceRange, ToDirectInitRange) = *Imp;
6911 return std::move(Err);
6914 Importer.getToContext(), E->
isGlobalNew(), ToOperatorNew,
6917 ToInitializer, ToType, ToAllocatedTypeSourceInfo, ToSourceRange,
6922 auto Imp = importSeq(
6925 return Imp.takeError();
6931 std::tie(ToType, ToOperatorDelete, ToArgument, ToBeginLoc) = *Imp;
6940 auto Imp = importSeq(
6944 return Imp.takeError();
6950 std::tie(ToType, ToLocation, ToConstructor, ToParenOrBraceRange) = *Imp;
6954 return std::move(Err);
6957 Importer.getToContext(), ToType, ToLocation, ToConstructor,
6961 ToParenOrBraceRange);
6966 if (!ToSubExprOrErr)
6967 return ToSubExprOrErr.takeError();
6971 return std::move(Err);
6979 auto Imp = importSeq(
6982 return Imp.takeError();
6987 std::tie(ToCallee, ToType, ToRParenLoc) = *Imp;
6991 return std::move(Err);
7000 return ToTypeOrErr.takeError();
7003 if (!ToLocationOrErr)
7004 return ToLocationOrErr.takeError();
7007 *ToLocationOrErr, *ToTypeOrErr, E->
isImplicit());
7013 return ToTypeOrErr.takeError();
7016 if (!ToLocationOrErr)
7017 return ToLocationOrErr.takeError();
7020 E->
getValue(), *ToTypeOrErr, *ToLocationOrErr);
7024 auto Imp1 = importSeq(
7028 return Imp1.takeError();
7036 ToBase, ToOperatorLoc, ToQualifierLoc, ToTemplateKeywordLoc, ToMemberDecl,
7039 auto Imp2 = importSeq(
7043 return Imp2.takeError();
7047 std::tie(ToDecl, ToName, ToLoc, ToLAngleLoc, ToRAngleLoc) = *Imp2;
7060 Importer.getToContext(), ToBase, E->
isArrow(), ToOperatorLoc,
7061 ToQualifierLoc, ToTemplateKeywordLoc, ToMemberDecl, ToFoundDecl,
7067 auto Imp = importSeq(
7071 return Imp.takeError();
7078 ToBase, ToOperatorLoc, ToQualifierLoc, ToScopeTypeInfo, ToColonColonLoc,
7085 if (!ToDestroyedTypeLocOrErr)
7086 return ToDestroyedTypeLocOrErr.takeError();
7092 return ToTIOrErr.takeError();
7096 Importer.getToContext(), ToBase, E->
isArrow(), ToOperatorLoc,
7097 ToQualifierLoc, ToScopeTypeInfo, ToColonColonLoc, ToTildeLoc, Storage);
7102 auto Imp = importSeq(
7106 return Imp.takeError();
7111 NamedDecl *ToFirstQualifierFoundInScope;
7113 ToType, ToOperatorLoc, ToQualifierLoc, ToTemplateKeywordLoc,
7114 ToFirstQualifierFoundInScope) = *Imp;
7116 Expr *ToBase =
nullptr;
7119 ToBase = *ToBaseOrErr;
7121 return ToBaseOrErr.takeError();
7126 if (
Error Err = ImportTemplateArgumentListInfo(
7129 return std::move(Err);
7130 ResInfo = &ToTAInfo;
7134 if (!ToMemberNameInfoOrErr)
7135 return ToMemberNameInfoOrErr.takeError();
7137 std::get<0>(*ToMemberNameInfoOrErr), std::get<1>(*ToMemberNameInfoOrErr));
7139 if (
Error Err = ImportDeclarationNameLoc(
7141 return std::move(Err);
7144 Importer.getToContext(), ToBase, ToType, E->
isArrow(), ToOperatorLoc,
7145 ToQualifierLoc, ToTemplateKeywordLoc, ToFirstQualifierFoundInScope,
7146 ToMemberNameInfo, ResInfo);
7151 auto Imp = importSeq(
7155 return Imp.takeError();
7158 SourceLocation ToTemplateKeywordLoc, ToExprLoc, ToLAngleLoc, ToRAngleLoc;
7161 ToQualifierLoc, ToTemplateKeywordLoc, ToDeclName, ToExprLoc,
7162 ToLAngleLoc, ToRAngleLoc) = *Imp;
7166 return std::move(Err);
7173 return std::move(Err);
7174 ResInfo = &ToTAInfo;
7178 Importer.getToContext(), ToQualifierLoc, ToTemplateKeywordLoc,
7179 ToNameInfo, ResInfo);
7184 auto Imp = importSeq(
7187 return Imp.takeError();
7191 std::tie(ToLParenLoc, ToRParenLoc, ToTypeSourceInfo) = *Imp;
7196 return std::move(Err);
7199 Importer.getToContext(), ToTypeSourceInfo, ToLParenLoc,
7200 llvm::makeArrayRef(ToArgs), ToRParenLoc);
7206 if (!ToNamingClassOrErr)
7207 return ToNamingClassOrErr.takeError();
7210 if (!ToQualifierLocOrErr)
7211 return ToQualifierLocOrErr.takeError();
7214 if (!ToNameInfoOrErr)
7215 return ToNameInfoOrErr.takeError();
7217 std::get<0>(*ToNameInfoOrErr), std::get<1>(*ToNameInfoOrErr));
7220 return std::move(Err);
7223 for (
auto *D : E->
decls())
7224 if (
auto ToDOrErr =
import(D))
7225 ToDecls.
addDecl(cast<NamedDecl>(*ToDOrErr));
7227 return ToDOrErr.takeError();
7231 if (
Error Err = ImportTemplateArgumentListInfo(
7234 return std::move(Err);
7237 if (!ToTemplateKeywordLocOrErr)
7238 return ToTemplateKeywordLocOrErr.takeError();
7241 Importer.getToContext(), *ToNamingClassOrErr, *ToQualifierLocOrErr,
7242 *ToTemplateKeywordLocOrErr, ToNameInfo, E->
requiresADL(), &ToTAInfo,
7247 Importer.getToContext(), *ToNamingClassOrErr, *ToQualifierLocOrErr,
7254 auto Imp1 = importSeq(
7258 return Imp1.takeError();
7263 std::tie(ToType, ToOperatorLoc, ToQualifierLoc, ToTemplateKeywordLoc) = *Imp1;
7267 return Imp2.takeError();
7271 return std::move(Err);
7275 if (
auto ToDOrErr =
import(D))
7276 ToDecls.
addDecl(cast<NamedDecl>(*ToDOrErr));
7278 return ToDOrErr.takeError();
7285 return std::move(Err);
7286 ResInfo = &ToTAInfo;
7289 Expr *ToBase =
nullptr;
7292 ToBase = *ToBaseOrErr;
7294 return ToBaseOrErr.takeError();
7299 E->
isArrow(), ToOperatorLoc, ToQualifierLoc, ToTemplateKeywordLoc,
7300 ToNameInfo, ResInfo, ToDecls.
begin(), ToDecls.
end());
7306 return Imp.takeError();
7311 std::tie(ToCallee, ToType, ToRParenLoc) = *Imp;
7316 return std::move(Err);
7318 if (
const auto *OCE = dyn_cast<CXXOperatorCallExpr>(E)) {
7320 Importer.getToContext(), OCE->getOperator(), ToCallee, ToArgs, ToType,
7321 OCE->getValueKind(), ToRParenLoc, OCE->getFPFeatures(),
7322 OCE->getADLCallKind());
7332 auto ToClassOrErr =
import(FromClass);
7334 return ToClassOrErr.takeError();
7341 for (
auto FromField : FromClass->
fields()) {
7342 auto ToFieldOrErr =
import(FromField);
7344 return ToFieldOrErr.takeError();
7350 return ToCallOpOrErr.takeError();
7356 for (
const auto &FromCapture : E->
captures()) {
7357 if (
auto ToCaptureOrErr =
import(FromCapture))
7358 ToCaptures.push_back(*ToCaptureOrErr);
7360 return ToCaptureOrErr.takeError();
7365 return std::move(Err);
7367 auto Imp = importSeq(
7370 return Imp.takeError();
7374 std::tie(ToIntroducerRange, ToCaptureDefaultLoc, ToEndLoc) = *Imp;
7377 Importer.getToContext(), ToClass, ToIntroducerRange,
7387 return Imp.takeError();
7391 std::tie(ToLBraceLoc, ToRBraceLoc, ToType) = *Imp;
7394 if (
Error Err = ImportContainerChecked(E->
inits(), ToExprs))
7395 return std::move(Err);
7399 ToCtx, ToLBraceLoc, ToExprs, ToRBraceLoc);
7406 return ToFillerOrErr.takeError();
7410 if (
auto ToFDOrErr =
import(FromFD))
7413 return ToFDOrErr.takeError();
7417 if (
auto ToSyntFormOrErr =
import(SyntForm))
7420 return ToSyntFormOrErr.takeError();
7434 return ToTypeOrErr.takeError();
7437 if (!ToSubExprOrErr)
7438 return ToSubExprOrErr.takeError();
7441 *ToTypeOrErr, *ToSubExprOrErr);
7448 return Imp.takeError();
7453 std::tie(ToLocation, ToType, ToConstructor) = *Imp;
7463 return Imp.takeError();
7466 Expr *ToCommonExpr, *ToSubExpr;
7467 std::tie(ToType, ToCommonExpr, ToSubExpr) = *Imp;
7470 ToType, ToCommonExpr, ToSubExpr);
7476 return ToTypeOrErr.takeError();
7482 if (!ToBeginLocOrErr)
7483 return ToBeginLocOrErr.takeError();
7485 auto ToFieldOrErr =
import(E->
getField());
7487 return ToFieldOrErr.takeError();
7490 Importer.getToContext(), *ToBeginLocOrErr, *ToFieldOrErr);
7494 auto Imp = importSeq(
7498 return Imp.takeError();
7506 ToType, ToSubExpr, ToTypeInfoAsWritten, ToOperatorLoc, ToRParenLoc,
7507 ToAngleBrackets) = *Imp;
7511 auto ToBasePathOrErr = ImportCastPath(E);
7512 if (!ToBasePathOrErr)
7513 return ToBasePathOrErr.takeError();
7515 if (isa<CXXStaticCastExpr>(E)) {
7517 Importer.getToContext(), ToType, VK, CK, ToSubExpr, &(*ToBasePathOrErr),
7518 ToTypeInfoAsWritten, ToOperatorLoc, ToRParenLoc, ToAngleBrackets);
7519 }
else if (isa<CXXDynamicCastExpr>(E)) {
7521 Importer.getToContext(), ToType, VK, CK, ToSubExpr, &(*ToBasePathOrErr),
7522 ToTypeInfoAsWritten, ToOperatorLoc, ToRParenLoc, ToAngleBrackets);
7523 }
else if (isa<CXXReinterpretCastExpr>(E)) {
7525 Importer.getToContext(), ToType, VK, CK, ToSubExpr, &(*ToBasePathOrErr),
7526 ToTypeInfoAsWritten, ToOperatorLoc, ToRParenLoc, ToAngleBrackets);
7527 }
else if (isa<CXXConstCastExpr>(E)) {
7529 Importer.getToContext(), ToType, VK, ToSubExpr, ToTypeInfoAsWritten,
7530 ToOperatorLoc, ToRParenLoc, ToAngleBrackets);
7532 llvm_unreachable(
"Unknown cast type");
7533 return make_error<ImportError>();
7539 auto Imp = importSeq(
7542 return Imp.takeError();
7547 Expr *ToReplacement;
7548 std::tie(ToType, ToExprLoc, ToParameter, ToReplacement) = *Imp;
7551 ToType, E->
getValueKind(), ToExprLoc, ToParameter, ToReplacement);
7555 auto Imp = importSeq(
7558 return Imp.takeError();
7562 std::tie(ToType, ToBeginLoc, ToEndLoc) = *Imp;
7565 if (
Error Err = ImportContainerChecked(E->
getArgs(), ToArgs))
7566 return std::move(Err);
7573 Importer.getToContext(), ToType, ToBeginLoc, E->
getTrait(), ToArgs,
7580 return ToTypeOrErr.takeError();
7583 if (!ToSourceRangeOrErr)
7584 return ToSourceRangeOrErr.takeError();
7589 *ToTypeOrErr, *ToTSIOrErr, *ToSourceRangeOrErr);
7591 return ToTSIOrErr.takeError();
7595 if (!ToExprOperandOrErr)
7596 return ToExprOperandOrErr.takeError();
7599 *ToTypeOrErr, *ToExprOperandOrErr, *ToSourceRangeOrErr);
7605 if (
auto ImportedOrErr =
import(FromOverriddenMethod))
7607 (*ImportedOrErr)->getCanonicalDecl()));
7609 consumeError(ImportedOrErr.takeError());
7617 : LookupTable(LookupTable), ToContext(ToContext), FromContext(FromContext),
7618 ToFileManager(ToFileManager), FromFileManager(FromFileManager),
7630 return make_error<ImportError>();
7635 assert(F && (isa<FieldDecl>(*F) || isa<IndirectFieldDecl>(*F)) &&
7636 "Try to get field index for non-field.");
7643 for (
const auto *D : Owner->decls()) {
7647 if (isa<FieldDecl>(*D) || isa<IndirectFieldDecl>(*D))
7651 llvm_unreachable(
"Field was not found in its parent context.");
7668 LookupTable->
lookup(ReDC, Name);
7669 return FoundDeclsTy(LookupResult.begin(), LookupResult.end());
7679 void ASTImporter::AddToLookupTable(
Decl *ToD) {
7681 if (
auto *ToND = dyn_cast<NamedDecl>(ToD))
7682 LookupTable->add(ToND);
7692 llvm::DenseMap<const Type *, const Type *>::iterator Pos
7693 = ImportedTypes.find(FromTy);
7694 if (Pos != ImportedTypes.end())
7701 llvm::consumeError(ToTOrErr.takeError());
7706 ImportedTypes[FromTy] = (*ToTOrErr).getTypePtr();
7713 if (!ToTSI && FromTSI)
7714 return llvm::make_error<ImportError>();
7735 Attr *ToAttr = FromAttr->
clone(ToContext);
7742 auto Pos = ImportedDecls.find(FromD);
7743 if (Pos != ImportedDecls.end())
7752 return llvm::make_error<ImportError>();
7772 llvm::consumeError(ToDOrErr.takeError());
7780 AddToLookupTable(ToD);
7793 auto *ToDC = cast_or_null<DeclContext>(
Import(cast<Decl>(FromDC)));
7799 if (
auto *ToRecord = dyn_cast<RecordDecl>(ToDC)) {
7800 auto *FromRecord = cast<RecordDecl>(FromDC);
7801 if (ToRecord->isCompleteDefinition()) {
7803 }
else if (FromRecord->isCompleteDefinition()) {
7806 return std::move(Err);
7810 }
else if (
auto *ToEnum = dyn_cast<EnumDecl>(ToDC)) {
7811 auto *FromEnum = cast<EnumDecl>(FromDC);
7812 if (ToEnum->isCompleteDefinition()) {
7814 }
else if (FromEnum->isCompleteDefinition()) {
7817 return std::move(Err);
7821 }
else if (
auto *ToClass = dyn_cast<ObjCInterfaceDecl>(ToDC)) {
7822 auto *FromClass = cast<ObjCInterfaceDecl>(FromDC);
7823 if (ToClass->getDefinition()) {
7828 return std::move(Err);
7832 }
else if (
auto *ToProto = dyn_cast<ObjCProtocolDecl>(ToDC)) {
7833 auto *FromProto = cast<ObjCProtocolDecl>(FromDC);
7834 if (ToProto->getDefinition()) {
7839 return std::move(Err);
7851 return llvm::make_error<ImportError>();
7858 return cast_or_null<Expr>(
Import(cast<Stmt>(FromE)));
7864 return llvm::make_error<ImportError>();
7872 llvm::DenseMap<Stmt *, Stmt *>::iterator Pos = ImportedStmts.find(FromS);
7873 if (Pos != ImportedStmts.end())
7880 llvm::consumeError(ToSOrErr.takeError());
7884 if (
auto *ToE = dyn_cast<Expr>(*ToSOrErr)) {
7885 auto *FromE = cast<Expr>(FromS);
7888 ToE->setValueKind(FromE->getValueKind());
7889 ToE->setObjectKind(FromE->getObjectKind());
7890 ToE->setTypeDependent(FromE->isTypeDependent());
7891 ToE->setValueDependent(FromE->isValueDependent());
7892 ToE->setInstantiationDependent(FromE->isInstantiationDependent());
7893 ToE->setContainsUnexpandedParameterPack(
7894 FromE->containsUnexpandedParameterPack());
7898 ImportedStmts[FromS] = *ToSOrErr;
7905 if (!ToNNS && FromNNS)
7906 return llvm::make_error<ImportError>();
7950 bool bTemplate = FromNNS->
getKind() ==
7959 llvm_unreachable(
"Invalid nested name specifier kind");
7975 NestedNames.push_back(NNS);
7981 while (!NestedNames.empty()) {
7982 NNS = NestedNames.pop_back_val();
8041 return llvm::make_error<ImportError>();
8047 if (
auto *ToTemplate =
8056 for (
auto *I : *FromStorage) {
8057 if (
auto *To = cast_or_null<NamedDecl>(
Import(I)))
8072 if (
auto *ToTemplate =
8104 if (replacement.
isNull())
8114 cast_or_null<TemplateTemplateParmDecl>(
8123 llvm::consumeError(ArgPack.takeError());
8131 llvm_unreachable(
"Invalid template name kind");
8137 return llvm::make_error<ImportError>();
8165 return llvm::make_error<ImportError>();
8169 llvm::DenseMap<FileID, FileID>::iterator Pos = ImportedFileIDs.find(FromID);
8170 if (Pos != ImportedFileIDs.end())
8183 unsigned TokenLen = FromSM.getFileIDSize(FromID);
8198 if (Cache->OrigEntry && Cache->OrigEntry->getDir()) {
8204 ToFileManager.
getFile(Cache->OrigEntry->getName());
8211 const llvm::MemoryBuffer *FromBuf =
8213 std::unique_ptr<llvm::MemoryBuffer> ToBuf =
8214 llvm::MemoryBuffer::getMemBufferCopy(FromBuf->getBuffer(),
8215 FromBuf->getBufferIdentifier());
8221 ImportedFileIDs[FromID] = ToID;
8229 return llvm::make_error<ImportError>();
8234 if (!ToExpr && From->
getInit())
8256 auto *ToIField = cast_or_null<IndirectFieldDecl>(
8269 return new (ToContext)
8281 return llvm::make_error<ImportError>();
8285 auto Pos = ImportedCXXBaseSpecifiers.find(BaseSpec);
8286 if (Pos != ImportedCXXBaseSpecifiers.end())
8295 ImportedCXXBaseSpecifiers[BaseSpec] =
Imported;
8302 return llvm::make_error<ImportError>();
8304 if (
auto *FromDC = cast<DeclContext>(From)) {
8307 if (
auto *ToRecord = dyn_cast<RecordDecl>(To)) {
8308 if (!ToRecord->getDefinition()) {
8310 cast<RecordDecl>(FromDC), ToRecord,
8315 if (
auto *ToEnum = dyn_cast<EnumDecl>(To)) {
8316 if (!ToEnum->getDefinition()) {
8322 if (
auto *ToIFace = dyn_cast<ObjCInterfaceDecl>(To)) {
8323 if (!ToIFace->getDefinition()) {
8325 cast<ObjCInterfaceDecl>(FromDC), ToIFace,
8330 if (
auto *ToProto = dyn_cast<ObjCProtocolDecl>(To)) {
8331 if (!ToProto->getDefinition()) {
8333 cast<ObjCProtocolDecl>(FromDC), ToProto,
8341 return Error::success();
8346 llvm::consumeError(std::move(Err));
8351 if (!ToName && FromName)
8352 return llvm::make_error<ImportError>();
8387 auto *Template = cast_or_null<TemplateDecl>(
8416 llvm_unreachable(
"Invalid DeclarationName Kind!");
8434 return llvm::make_error<ImportError>();
8443 for (
unsigned I = 1, N = FromSel.
getNumArgs(); I < N; ++I)
8452 unsigned NumDecls) {
8457 if (LastDiagFromFrom)
8460 LastDiagFromFrom =
false;
8465 if (!LastDiagFromFrom)
8468 LastDiagFromFrom =
true;
8473 if (
auto *
ID = dyn_cast<ObjCInterfaceDecl>(D)) {
8474 if (!
ID->getDefinition())
8475 ID->startDefinition();
8477 else if (
auto *PD = dyn_cast<ObjCProtocolDecl>(D)) {
8478 if (!PD->getDefinition())
8479 PD->startDefinition();
8481 else if (
auto *TD = dyn_cast<TagDecl>(D)) {
8482 if (!TD->getDefinition() && !TD->isBeingDefined()) {
8483 TD->startDefinition();
8484 TD->setCompleteDefinition(
true);
8488 assert(0 &&
"CompleteDecl called on a Decl that can't be completed");
8493 llvm::DenseMap<Decl *, Decl *>::iterator Pos = ImportedDecls.find(From);
8494 assert((Pos == ImportedDecls.end() || Pos->second == To) &&
8495 "Try to import an already imported Decl");
8496 if (Pos != ImportedDecls.end())
8498 ImportedDecls[From] = To;
8504 llvm::DenseMap<const Type *, const Type *>::iterator Pos
SourceLocation getRParenLoc() const
LLVM_NODISCARD llvm::Error ImportDefinition_New(Decl *From)
Import the definition of the given declaration, including all of the declarations it contains...
ExpectedStmt VisitNullStmt(NullStmt *S)
const Expr * getSubExpr() const
bool isBaseInitializer() const
Determine whether this initializer is initializing a base class.
bool hasArrayFiller() const
Return true if this is an array initializer and its array "filler" has been set.
SourceLocation getLoc() const
getLoc - Returns the main location of the declaration name.
Represents a single C99 designator.
SourceLocation getGetterNameLoc() const
TemplateTemplateParmDecl * getParameterPack() const
Retrieve the template template parameter pack being substituted.
QualType getPattern() const
Retrieve the pattern of this pack expansion, which is the type that will be repeatedly instantiated w...
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
SourceLocation getRBracLoc() const
Defines the clang::ASTContext interface.
QualType getDeducedType() const
Get the type deduced for this placeholder type, or null if it's either not been deduced or was deduce...
static CXXDefaultInitExpr * Create(const ASTContext &Ctx, SourceLocation Loc, FieldDecl *Field)
Field is the non-static data member whose default initializer is used by this expression.
IdentifierInfo * getInputIdentifier(unsigned i) const
Represents a type that was referred to using an elaborated type keyword, e.g., struct S...
void setScopeInfo(unsigned scopeDepth, unsigned parameterIndex)
ObjCPropertyQueryKind getQueryKind() const
SourceLocation getRParenLoc() const
VarDecl * getCapturedVar() const
Retrieve the declaration of the local variable being captured.
NamedDecl * getTargetDecl() const
Gets the underlying declaration which has been brought into the local scope.
The null pointer literal (C++11 [lex.nullptr])
const CXXDestructorDecl * getDestructor() const
SourceLocation getLAngleLoc() const
Retrieve the location of the left angle bracket starting the explicit template argument list followin...
This represents a GCC inline-assembly statement extension.
void setImplicit(bool I=true)
Represents a function declaration or definition.
SourceLocation getForLoc() const
NamedDecl * getFoundDecl()
Get the NamedDecl through which this reference occurred.
ExpectedDecl VisitLinkageSpecDecl(LinkageSpecDecl *D)
bool isImplicit() const
Determine whether this was an implicit capture (not written between the square brackets introducing t...
void localUncachedLookup(DeclarationName Name, SmallVectorImpl< NamedDecl *> &Results)
A simplistic name lookup mechanism that performs name lookup into this declaration context without co...
ExpectedStmt VisitOpaqueValueExpr(OpaqueValueExpr *E)
Expr * getInit() const
Get the initializer.
bool isKindOfTypeAsWritten() const
Whether this is a "__kindof" type as written.
bool hasExplicitTemplateArgs() const
Determines whether this expression had explicit template arguments.
unsigned getNumInputs() const
ExpectedStmt VisitExpr(Expr *E)
SourceLocation getRParenLoc() const
void setArrayFiller(Expr *filler)
Smart pointer class that efficiently represents Objective-C method names.
This is a discriminated union of FileInfo and ExpansionInfo.
SourceLocation getForLoc() const
void setAnonymousStructOrUnion(bool Anon)
PointerType - C99 6.7.5.1 - Pointer Declarators.
ArrayRef< QualType > getTypeArgsAsWritten() const
Retrieve the type arguments of this object type as they were written.
QualType getPointeeType() const
llvm::iterator_range< arg_iterator > placement_arguments()
SourceLocation getUsedLocation() const
Retrieve the location where this default argument was actually used.
Represents the dependent type named by a dependently-scoped typename using declaration, e.g.
bool hasTemplateKeyword() const
Whether the template name was prefixed by the "template" keyword.
Stores the type being destroyed by a pseudo-destructor expression.
A (possibly-)qualified type.
uint64_t getValue() const
SourceLocation getBeginLoc() const
Expected< ObjCTypeParamList * > ImportObjCTypeParamList(ObjCTypeParamList *list)
ExpectedDecl VisitObjCIvarDecl(ObjCIvarDecl *D)
ArrayRef< TemplateArgumentLoc > template_arguments() const
const char * getDeclKindName() const
StringKind getKind() const
ExpectedType VisitElaboratedType(const ElaboratedType *T)
ExpectedDecl VisitUsingDecl(UsingDecl *D)
OverloadedOperatorKind getOperator() const
Return the overloaded operator to which this template name refers.
bool isThisDeclarationADefinition() const
Returns whether this template declaration defines the primary class pattern.
ValueDecl * getMemberDecl() const
Retrieve the member declaration to which this expression refers.
void setTemplateKeywordLoc(SourceLocation Loc)
Sets the location of the template keyword.
unsigned param_size() const
Error ImportArrayChecked(IIter Ibegin, IIter Iend, OIter Obegin)
ObjCInterfaceDecl * getClassInterface()
QualType getInjectedSpecializationType() const
NestedNameSpecifier * getQualifier() const
Return the nested name specifier that qualifies this name.
Implements support for file system lookup, file system caching, and directory search management...
SourceRange getCXXOperatorNameRange() const
getCXXOperatorNameRange - Gets the range of the operator name (without the operator keyword)...
void startDefinition()
Starts the definition of this Objective-C class, taking it from a forward declaration (@class) to a d...
SourceLocation getSpellingLoc() const
SourceLocation getEllipsisLoc() const
Get the location of the ... in a case statement of the form LHS ... RHS.
SourceLocation getLParen() const
Get the location of the left parentheses '('.
const Expr * getSubExpr() const
SourceLocation getEllipsisLoc() const
Get the location of the ellipsis if this is a pack expansion.
static ClassTemplateDecl * getDefinition(ClassTemplateDecl *D)
SourceLocation getLParenLoc() const
ExpectedDecl VisitVarTemplateDecl(VarTemplateDecl *D)
SourceRange getSourceRange() const LLVM_READONLY
Retrieve the source range covering the entirety of this nested-name-specifier.
bool isThisDeclarationADefinition() const
Determine whether this particular declaration of this class is actually also a definition.
Defines the clang::FileManager interface and associated types.
ObjCIvarDecl * getPropertyIvarDecl() const
bool isObjCMethodParameter() const
FunctionDecl * findSpecialization(ArrayRef< TemplateArgument > Args, void *&InsertPos)
Return the specialization with the provided arguments if it exists, otherwise return the insertion po...
A type trait used in the implementation of various C++11 and Library TR1 trait templates.
CompoundStmt * getSubStmt()
InClassInitStyle getInClassInitStyle() const
Get the kind of (C++11) default member initializer that this field has.
Expr * getUnderlyingExpr() const
SourceLocation getRParenLoc() const
bool hasExplicitResultType() const
Whether this lambda had its result type explicitly specified.
bool isThrownVariableInScope() const
Determines whether the variable thrown by this expression (if any!) is within the innermost try block...
Stmt - This represents one statement.
unsigned getNumArgs() const
getNumArgs - Return the number of actual arguments to this call.
Expr * getDimensionExpression() const
const ObjCAtFinallyStmt * getFinallyStmt() const
Retrieve the @finally statement, if any.
Expr * getBitWidth() const
void setPreviousDecl(decl_type *PrevDecl)
Set the previous declaration.
CXXCatchStmt * getHandler(unsigned i)
bool IsICE
Whether this statement is an integral constant expression, or in C++11, whether the statement is a co...
bool isArrayFormAsWritten() const
ExpectedDecl VisitTypeAliasDecl(TypeAliasDecl *D)
IfStmt - This represents an if/then/else.
ClassTemplateSpecializationDecl * findSpecialization(ArrayRef< TemplateArgument > Args, void *&InsertPos)
Return the specialization with the provided arguments if it exists, otherwise return the insertion po...
VarDecl * getTemplatedDecl() const
Get the underlying variable declarations of the template.
SourceLocation getLAngleLoc() const
Retrieve the location of the left angle bracket starting the explicit template argument list followin...
SourceLocation getOperatorLoc() const
getOperatorLoc - Return the location of the operator.
SourceLocation getLocation() const
ExpectedDecl VisitTypeAliasTemplateDecl(TypeAliasTemplateDecl *D)
ExpectedStmt VisitObjCAtTryStmt(ObjCAtTryStmt *S)
An instance of this object exists for each enum constant that is defined.
static CXXDynamicCastExpr * Create(const ASTContext &Context, QualType T, ExprValueKind VK, CastKind Kind, Expr *Op, const CXXCastPath *Path, TypeSourceInfo *Written, SourceLocation L, SourceLocation RParenLoc, SourceRange AngleBrackets)
SourceLocation getSuperClassLoc() const
Retrieve the starting location of the superclass.
StorageClass getStorageClass() const
Returns the storage class as written in the source.
static UnresolvedMemberExpr * Create(const ASTContext &Context, bool HasUnresolvedUsing, Expr *Base, QualType BaseType, bool IsArrow, SourceLocation OperatorLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, const DeclarationNameInfo &MemberNameInfo, const TemplateArgumentListInfo *TemplateArgs, UnresolvedSetIterator Begin, UnresolvedSetIterator End)
void setTypedefNameForAnonDecl(TypedefNameDecl *TDD)
Represents the declaration of a typedef-name via the 'typedef' type specifier.
C Language Family Type Representation.
unsigned getNumOutputs() const
Defines the SourceManager interface.
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in...
bool isConstexpr() const
Whether this is a (C++11) constexpr function or constexpr constructor.
ExpectedDecl VisitParmVarDecl(ParmVarDecl *D)
ExpectedStmt VisitUnresolvedMemberExpr(UnresolvedMemberExpr *E)
bool isExpansionTokenRange() const
Represents a qualified type name for which the type name is dependent.
SourceLocation getRBracketLoc() const
The template argument is an expression, and we've not resolved it to one of the other forms yet...
ArrayRef< CleanupObject > getObjects() const
unsigned size() const
Retrieve the number of template arguments in this template argument list.
const StringLiteral * getAsmString() const
NestedNameSpecifier * getQualifier() const
Retrieve the qualification on this type.
TypeSourceInfo * getTypeSourceInfo() const
bool isInitICE() const
Determines whether the initializer is an integral constant expression, or in C++11, whether the initializer is a constant expression.
ExpectedStmt VisitDoStmt(DoStmt *S)
ExpectedStmt VisitExpressionTraitExpr(ExpressionTraitExpr *E)
QualType getQualifiedType(SplitQualType split) const
Un-split a SplitQualType.
Decl - This represents one declaration (or definition), e.g.
void setRangeEnd(SourceLocation E)
bool hasLeadingEmptyMacro() const
Stmt * getHandlerBlock() const
ExpectedStmt VisitBinaryConditionalOperator(BinaryConditionalOperator *E)
ExpectedDecl VisitRecordDecl(RecordDecl *D)
llvm::APFloat getValue() const
SourceLocation getBeginLoc() const LLVM_READONLY
ExpectedStmt VisitBreakStmt(BreakStmt *S)
Represents the index of the current element of an array being initialized by an ArrayInitLoopExpr.
FunctionDecl * getOperatorNew() const
ExpectedStmt VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt *S)
ExpectedStmt VisitVAArgExpr(VAArgExpr *E)
VarDecl * getDefinition(ASTContext &)
Get the real (not just tentative) definition for this declaration.
bool isVirtual() const
Determines whether the base class is a virtual base class (or not).
Selector getObjCSelector() const
Get the Objective-C selector stored in this declaration name.
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
NestedNameSpecifier * getPrefix() const
Return the prefix of this nested name specifier.
const Expr * getSubExpr() const
Defines the C++ template declaration subclasses.
OverloadedOperatorKind getCXXOverloadedOperator() const
If this name is the name of an overloadable operator in C++ (e.g., operator+), retrieve the kind of o...
ExpectedStmt VisitCXXNullPtrLiteralExpr(CXXNullPtrLiteralExpr *E)
Represents a C++11 auto or C++14 decltype(auto) type.
unsigned getNumSubExprs() const
Retrieve the total number of subexpressions in this designated initializer expression, including the actual initialized value and any expressions that occur within array and array-range designators.
SourceLocation getIdentLoc() const
void setPure(bool P=true)
ExpectedStmt VisitLabelStmt(LabelStmt *S)
Represents an attribute applied to a statement.
bool hasWrittenPrototype() const
Whether this function has a written prototype.
ParenExpr - This represents a parethesized expression, e.g.
known_categories_range known_categories() const
Decl * getPreviousDecl()
Retrieve the previous declaration that declares the same entity as this declaration, or NULL if there is no previous declaration.
NamedDecl * getDecl() const
ExpectedStmt VisitParenListExpr(ParenListExpr *E)
Error ImportTemplateInformation(FunctionDecl *FromFD, FunctionDecl *ToFD)
SourceLocation getColonLoc() const
The location of the colon following the access specifier.
The base class of the type hierarchy.
Represents an empty-declaration.
ExpectedStmt VisitStmt(Stmt *S)
Represents Objective-C's @throw statement.
bool requiresZeroInitialization() const
Whether this construction first requires zero-initialization before the initializer is called...
ExpectedStmt VisitDefaultStmt(DefaultStmt *S)
Each ExpansionInfo encodes the expansion location - where the token was ultimately expanded...
DiagnosticsEngine & getDiagnostics() const
ExpectedType VisitUnresolvedUsingType(const UnresolvedUsingType *T)
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.
bool hasExplicitTemplateArgs() const
Determines whether this declaration reference was followed by an explicit template argument list...
SourceLocation getLocation() const
Represents an array type, per C99 6.7.5.2 - Array Declarators.
Declaration of a variable template.
SourceLocation getRParenLoc() const
The template argument is a declaration that was provided for a pointer, reference, or pointer to member non-type template parameter.
Represent a C++ namespace.
ExpectedStmt VisitAttributedStmt(AttributedStmt *S)
Represents a call to a C++ constructor.
SourceLocation getBeginLoc() const LLVM_READONLY
Expected< TemplateParameterList * > ImportTemplateParameterList(TemplateParameterList *Params)
RetTy Visit(const Type *T)
Performs the operation associated with this visitor object.
TypeSourceInfo * getTypeInfoAsWritten() const
getTypeInfoAsWritten - Returns the type source info for the type that this expression is casting to...
protocol_iterator protocol_begin() const
FPOptions getFPFeatures() const
An Embarcadero array type trait, as used in the implementation of __array_rank and __array_extent...
void setSpecializationKind(TemplateSpecializationKind TSK)
virtual void completeDefinition()
Note that the definition of this type is now complete.
SourceLocation getEndLoc() const LLVM_READONLY
ExpectedDecl VisitNonTypeTemplateParmDecl(NonTypeTemplateParmDecl *D)
A container of type source information.
RefQualifierKind RefQualifier
ExpectedStmt VisitExprWithCleanups(ExprWithCleanups *E)
QualType getValueType() const
Gets the type contained by this atomic type, i.e.
bool isEmpty() const
Evaluates true when this declaration name is empty.
ExpectedStmt VisitFloatingLiteral(FloatingLiteral *E)
static AttributedStmt * Create(const ASTContext &C, SourceLocation Loc, ArrayRef< const Attr *> Attrs, Stmt *SubStmt)
IdentKind getIdentKind() const
ExpectedType VisitDependentTemplateSpecializationType(const DependentTemplateSpecializationType *T)
SourceLocation getBeginLoc() const LLVM_READONLY
SourceLocation getGotoLoc() const
void setTemplateArgsInfo(const TemplateArgumentListInfo &ArgsInfo)
ExpectedDecl VisitFieldDecl(FieldDecl *D)
static CXXFunctionalCastExpr * Create(const ASTContext &Context, QualType T, ExprValueKind VK, TypeSourceInfo *Written, CastKind Kind, Expr *Op, const CXXCastPath *Path, SourceLocation LPLoc, SourceLocation RPLoc)
SourceLocation getOperatorLoc() const
Determine the location of the 'sizeof' keyword.
SourceLocation getRParenLoc() const
const Expr * getAnyInitializer() const
Get the initializer for this variable, no matter which declaration it is attached to...
SourceLocation getColonLoc() const
Retrieve the location of the ':' separating the type parameter name from the explicitly-specified bou...
bool isPackExpansion() const
Determine whether this capture is a pack expansion, which captures a function parameter pack...
Not supported node or case.
Describes the capture of a variable or of this, or of a C++1y init-capture.
param_const_iterator param_end() const
TemplateTypeParmDecl * getDecl() const
Represents a C++ constructor within a class.
Represents a prvalue temporary that is written into memory so that a reference can bind to it...
A template template parameter that has been substituted for some other template name.
ExpectedType VisitComplexType(const ComplexType *T)
bool isVirtualAsWritten() const
Whether this function is marked as virtual explicitly.
ExpectedDecl VisitNamespaceAliasDecl(NamespaceAliasDecl *D)
SourceLocation getLocalBeginLoc() const
Retrieve the location of the beginning of this component of the nested-name-specifier.
bool isPackExpansion() const
Determine whether this initializer is a pack expansion.
SourceLocation getTargetNameLoc() const
Returns the location of the identifier in the named namespace.
QualType getElementType() const
bool isCompleteDefinition() const
Return true if this decl has its body fully specified.
const Expr * getSubExpr() const
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
static CXXOperatorCallExpr * Create(const ASTContext &Ctx, OverloadedOperatorKind OpKind, Expr *Fn, ArrayRef< Expr *> Args, QualType Ty, ExprValueKind VK, SourceLocation OperatorLoc, FPOptions FPFeatures, ADLCallKind UsesADL=NotADL)
ExpectedStmt VisitImplicitCastExpr(ImplicitCastExpr *E)
const IdentifierInfo * getIdentifier() const
Returns the identifier to which this template name refers.
SourceLocation getCoawaitLoc() const
std::tuple< FunctionTemplateDecl *, TemplateArgsTy > FunctionTemplateAndArgsTy
Expr * getIndexExpr(unsigned Idx)
bool isIndirectMemberInitializer() const
An identifier, stored as an IdentifierInfo*.
SourceLocation getBeginLoc() const LLVM_READONLY
unsigned getDepth() const
Get the nesting depth of the template parameter.
FriendDecl - Represents the declaration of a friend entity, which can be a function, a type, or a templated function or type.
Expected< CXXCastPath > ImportCastPath(CastExpr *E)
static CXXConstructExpr * Create(const ASTContext &Ctx, QualType Ty, SourceLocation Loc, CXXConstructorDecl *Ctor, bool Elidable, ArrayRef< Expr *> Args, bool HadMultipleCandidates, bool ListInitialization, bool StdInitListInitialization, bool ZeroInitialization, ConstructionKind ConstructKind, SourceRange ParenOrBraceRange)
Create a C++ construction expression.
Represents a variable declaration or definition.
ExpectedType VisitIncompleteArrayType(const IncompleteArrayType *T)
void setImplementation(ObjCCategoryImplDecl *ImplD)
const VarDecl * getNRVOCandidate() const
Retrieve the variable that might be used for the named return value optimization. ...
SourceLocation getLParenLoc() const
static NestedNameSpecifier * Create(const ASTContext &Context, NestedNameSpecifier *Prefix, IdentifierInfo *II)
Builds a specifier combining a prefix and an identifier.
ExpectedType VisitTypeOfType(const TypeOfType *T)
ExpectedDecl VisitLabelDecl(LabelDecl *D)
CompoundLiteralExpr - [C99 6.5.2.5].
ExpectedDecl VisitImplicitParamDecl(ImplicitParamDecl *D)
void setCXXLiteralOperatorNameLoc(SourceLocation Loc)
setCXXLiteralOperatorNameLoc - Sets the location of the literal operator name (not the operator keywo...
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation getOperatorLoc() const
Retrieve the location of the '.' or '->' operator.
bool isFixed() const
Returns true if this is an Objective-C, C++11, or Microsoft-style enumeration with a fixed underlying...
OpaqueValueExpr * getCommonExpr() const
Get the common subexpression shared by all initializations (the source array).
const T * getAs() const
Member-template getAs<specific type>'.
bool hasDefaultArg() const
Determines whether this parameter has a default argument, either parsed or not.
ObjCCategoryImplDecl * getImplementation() const
ExpectedType VisitAtomicType(const AtomicType *T)
unsigned getNumArgs() const
Determine the number of arguments to this type trait.
Represents an empty template argument, e.g., one that has not been deduced.
SourceLocation getExternLoc() const
Gets the location of the extern keyword, if present.
Extra information about a function prototype.
SourceRange getSourceRange() const
bool hasInheritedDefaultArg() const
decl_range decls() const
decls_begin/decls_end - Iterate over the declarations stored in this context.
ExpectedType VisitRValueReferenceType(const RValueReferenceType *T)
SourceLocation getColonLoc() const
QualifiedTemplateName * getAsQualifiedTemplateName() const
Retrieve the underlying qualified template name structure, if any.
Represents a variable template specialization, which refers to a variable template with a given set o...
ObjCMethodDecl - Represents an instance or class method declaration.
SourceLocation getPointOfInstantiation() const
Get the point of instantiation (if any), or null if none.
SourceLocation getLAngleLoc() const
ExpectedType VisitObjCObjectType(const ObjCObjectType *T)
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>".
A namespace, stored as a NamespaceDecl*.
DeclarationName getName() const
Gets the name looked up.
DiagnosticBuilder ToDiag(SourceLocation Loc, unsigned DiagID)
Report a diagnostic in the "to" context.
Implicit construction of a std::initializer_list<T> object from an array temporary within list-initia...
llvm::PointerUnion< NamedDecl *, TypeSourceInfo * > FriendUnion
SourceLocation getIfLoc() const
Stores a list of template parameters for a TemplateDecl and its derived classes.
unsigned getNumPlacementArgs() const
TypeSourceInfo * getArgumentTypeInfo() const
bool isMemberInitializer() const
Determine whether this initializer is initializing a non-static data member.
bool requiresADL() const
True if this declaration should be extended by argument-dependent lookup.
TemplateName getSubstTemplateTemplateParm(TemplateTemplateParmDecl *param, TemplateName replacement) const
Defines the Objective-C statement AST node classes.
SourceLocation getEllipsisLoc() const
unsigned getNumExpressions() const
SourceLocation getLocation() const
Retrieve the location of the literal.
SpecifierKind getKind() const
Determine what kind of nested name specifier is stored.
CXXConstructorDecl * getConstructor() const
Get the constructor that this expression will call.
QualType Import(QualType FromT)
A C++ throw-expression (C++ [except.throw]).
Expr * getExprOperand() const
Represents an expression – generally a full-expression – that introduces cleanups to be run at the ...
Represents a parameter to a function.
Represents the result of substituting a type for a template type parameter.
static CXXTemporaryObjectExpr * Create(const ASTContext &Ctx, CXXConstructorDecl *Cons, QualType Ty, TypeSourceInfo *TSI, ArrayRef< Expr *> Args, SourceRange ParenOrBraceRange, bool HadMultipleCandidates, bool ListInitialization, bool StdInitListInitialization, bool ZeroInitialization)
DeclarationNameInfo getNameInfo() const
Defines the clang::Expr interface and subclasses for C++ expressions.
SourceLocation getRParenLoc() const
QualType getIntegralType() const
Retrieve the type of the integral value.
CXXRecordDecl * getLambdaClass() const
Retrieve the class that corresponds to the lambda.
const ObjCInterfaceDecl * getSuperClass() const
ExpectedDecl VisitFunctionTemplateDecl(FunctionTemplateDecl *D)
SubstTemplateTemplateParmStorage * getAsSubstTemplateTemplateParm() const
Retrieve the substituted template template parameter, if known.
const Stmt * getSubStmt() const
void setTemplateSpecializationKind(TemplateSpecializationKind TSK)
Set the kind of specialization or template instantiation this is.
const char * getStmtClassName() const
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
SourceLocation getRParenLoc() const
Retrieve the location of the closing parenthesis.
LabelStmt - Represents a label, which has a substatement.
ExpectedStmt VisitForStmt(ForStmt *S)
static CXXUnresolvedConstructExpr * Create(const ASTContext &Context, TypeSourceInfo *Type, SourceLocation LParenLoc, ArrayRef< Expr *> Args, SourceLocation RParenLoc)
ExpectedStmt VisitCompoundStmt(CompoundStmt *S)
SourceLocation getDotLoc() const
Represents a struct/union/class.
Represents a C99 designated initializer expression.
LanguageIDs getLanguage() const
Return the language specified by this linkage specification.
ExpectedDecl VisitUnresolvedUsingTypenameDecl(UnresolvedUsingTypenameDecl *D)
SourceLocation getVarianceLoc() const
Retrieve the location of the variance keyword.
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the class template specialization.
virtual DeclarationName HandleNameConflict(DeclarationName Name, DeclContext *DC, unsigned IDNS, NamedDecl **Decls, unsigned NumDecls)
Cope with a name conflict when importing a declaration into the given context.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
Provides common interface for the Decls that can be redeclared.
QualType getOriginalType() const
TypeSourceInfo * getScopeTypeInfo() const
Retrieve the scope type in a qualified pseudo-destructor expression.
FunctionType::ExtInfo ExtInfo
One of these records is kept for each identifier that is lexed.
Represents a class template specialization, which refers to a class template with a given set of temp...
void setIntegerType(QualType T)
Set the underlying integer type.
Expr * GetTemporaryExpr() const
Retrieve the temporary-generating subexpression whose value will be materialized into a glvalue...
TypeSourceInfo * getFriendType() const
If this friend declaration names an (untemplated but possibly dependent) type, return the type; other...
unsigned getDepth() const
Retrieve the depth of the template parameter.
SourceLocation getTildeLoc() const
Retrieve the location of the '~'.
FieldDecl * getField() const
For a field offsetof node, returns the field.
DiagnosticBuilder FromDiag(SourceLocation Loc, unsigned DiagID)
Report a diagnostic in the "from" context.
SourceLocation getRParenLoc() const
ExpectedDecl VisitDecl(Decl *D)
StringLiteral * getMessage()
bool cleanupsHaveSideEffects() const
QualType getComputationResultType() const
bool isArrayRangeDesignator() const
SourceLocation getIvarLBraceLoc() const
Represents a class type in Objective C.
SourceLocation getRParen() const
Get the location of the right parentheses ')'.
QualType getPointeeType() const
Expr * getAsExpr() const
Retrieve the template argument as an expression.
void setUninstantiatedDefaultArg(Expr *arg)
CXXRecordDecl * getPreviousDecl()
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
A C++ nested-name-specifier augmented with source location information.
Expr * getInit() const
Retrieve the initializer value.
bool isInline() const
Returns true if this is an inline namespace declaration.
Represents a dependent template name that cannot be resolved prior to template instantiation.
TemplateSpecializationKind getSpecializationKind() const
Determine the kind of specialization that this declaration represents.
bool CheckedICE
Whether we already checked whether this statement was an integral constant expression.
NamespaceDecl * getNamespace()
Retrieve the namespace declaration aliased by this directive.
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
TemplateDecl * getAsTemplateDecl() const
Retrieve the underlying template declaration that this template name refers to, if known...
RecordDecl * getDefinition() const
Returns the RecordDecl that actually defines this struct/union/class.
SourceLocation getBeginLoc() const LLVM_READONLY
field_range fields() const
SourceLocation getAmpAmpLoc() const
SourceLocation getBeginLoc() const LLVM_READONLY
ExpectedStmt VisitCXXThisExpr(CXXThisExpr *E)
NameKind getNameKind() const
Determine what kind of name this is.
SourceLocation getEndLoc() const
Represents a member of a struct/union/class.
TemplateName getTemplateName() const
Retrieve the name of the template that we are specializing.
const Type * getAsType() const
Retrieve the type stored in this nested name specifier.
void setTypeParamList(ObjCTypeParamList *TPL)
Set the type parameters of this class.
TypeSourceInfo * getTypeSourceInfo() const
Returns the declarator information for a base class or delegating initializer.
protocol_iterator protocol_begin() const
SubstTemplateTemplateParmPackStorage * getAsSubstTemplateTemplateParmPack() const
Retrieve the substituted template template parameter pack, if known.
Expr * getBase()
Retrieve the base object of this member expressions, e.g., the x in x.m.
const llvm::APSInt & getInitVal() const
Defines the ExceptionSpecificationType enumeration and various utility functions. ...
ExpectedStmt VisitCXXTypeidExpr(CXXTypeidExpr *E)
SourceLocation getBeginLoc() const LLVM_READONLY
This declaration is a friend function.
NonTypeTemplateParmDecl * getParameter() const
const DeclarationNameInfo & getNameInfo() const
Gets the full name info.
static DesignatedInitExpr * Create(const ASTContext &C, llvm::ArrayRef< Designator > Designators, ArrayRef< Expr *> IndexExprs, SourceLocation EqualOrColonLoc, bool GNUSyntax, Expr *Init)
unsigned getFunctionScopeIndex() const
Returns the index of this parameter in its prototype or method scope.
bool isArrayDesignator() const
One instance of this struct is kept for every file loaded or used.
unsigned getArrayExprIndex() const
For an array element node, returns the index into the array of expressions.
SourceLocation getLabelLoc() const
void startDefinition()
Starts the definition of this tag declaration.
bool hasExplicitTemplateArgs() const
Determines whether the member name was followed by an explicit template argument list.
ExpectedDecl VisitObjCMethodDecl(ObjCMethodDecl *D)
static TemplateArgumentList * CreateCopy(ASTContext &Context, ArrayRef< TemplateArgument > Args)
Create a new template argument list that copies the given set of template arguments.
void setSuperClass(TypeSourceInfo *superClass)
CXXMethodDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
SourceLocation getRBraceLoc() const
SourceLocation getOperatorLoc() const
GNUNullExpr - Implements the GNU __null extension, which is a name for a null pointer constant that h...
Optional< unsigned > getNumTemplateExpansions() const
Retrieve the number of expansions that a template template argument expansion will produce...
ObjCMethodDecl * getSetterMethodDecl() const
NamedDecl * getFriendDecl() const
If this friend declaration doesn't name a type, return the inner declaration.
ObjCTypeParamList * getTypeParamListAsWritten() const
Retrieve the type parameters written on this particular declaration of the class. ...
TagDecl * getOwnedTagDecl() const
Return the (re)declaration of this type owned by this occurrence of this type, or nullptr if there is...
bool isInIdentifierNamespace(unsigned NS) const
unsigned getPosition() const
Get the position of the template parameter within its parameter list.
static DeclRefExpr * Create(const ASTContext &Context, NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, ValueDecl *D, bool RefersToEnclosingVariableOrCapture, SourceLocation NameLoc, QualType T, ExprValueKind VK, NamedDecl *FoundD=nullptr, const TemplateArgumentListInfo *TemplateArgs=nullptr)
ExpectedStmt VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *E)
TemplateName getOverloadedTemplateName(UnresolvedSetIterator Begin, UnresolvedSetIterator End) const
Retrieve the template name that corresponds to a non-empty lookup.
Expr * getSourceExpr() const
The source expression of an opaque value expression is the expression which originally generated the ...
ExpectedStmt VisitArrayTypeTraitExpr(ArrayTypeTraitExpr *E)
Represents a C++ member access expression for which lookup produced a set of overloaded functions...
protocol_iterator protocol_end() const
ExpectedStmt VisitWhileStmt(WhileStmt *S)
ExpectedStmt VisitCXXThrowExpr(CXXThrowExpr *E)
ExpectedType VisitDecayedType(const DecayedType *T)
const DeclGroupRef getDeclGroup() const
Represents an access specifier followed by colon ':'.
SourceLocation getBeginLoc() const LLVM_READONLY
void startDefinition()
Starts the definition of this Objective-C protocol.
ExpectedDecl VisitVarTemplateSpecializationDecl(VarTemplateSpecializationDecl *D)
SourceLocation getQuestionLoc() const
void addShadowDecl(UsingShadowDecl *S)
static CXXRecordDecl * CreateLambda(const ASTContext &C, DeclContext *DC, TypeSourceInfo *Info, SourceLocation Loc, bool DependentLambda, bool IsGeneric, LambdaCaptureDefault CaptureDefault)
SourceLocation getTemplateLoc() const
ExpectedStmt VisitCXXNewExpr(CXXNewExpr *E)
TemplateName getReplacement() const
ExpectedStmt VisitUnaryOperator(UnaryOperator *E)
LambdaCaptureDefault getCaptureDefault() const
Determine the default capture kind for this lambda.
unsigned getIndex() const
Retrieve the index into its type parameter list.
ArrayRef< TemplateArgumentLoc > template_arguments() const
QualType getParamTypeForDecl() const
bool hasExplicitTemplateArgs() const
Determines whether this lookup had explicit template arguments.
Qualifiers getLocalQualifiers() const
Retrieve the set of qualifiers local to this particular QualType instance, not including any qualifie...
bool hadArrayRangeDesignator() const
SourceLocation getCatchLoc() const
ExpectedStmt VisitCXXStdInitializerListExpr(CXXStdInitializerListExpr *E)
ArrayRef< ParmVarDecl * > parameters() const
ExpectedStmt VisitArrayInitLoopExpr(ArrayInitLoopExpr *E)
Represents Objective-C's @catch statement.
SourceLocation getComposedLoc(FileID FID, unsigned Offset) const
Form a SourceLocation from a FileID and Offset pair.
ExpectedStmt VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *E)
SourceLocation getBeginLoc() const
TypeAliasDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
IndirectGotoStmt - This represents an indirect goto.
SourceLocation getMemberLoc() const
ExpectedDecl VisitVarDecl(VarDecl *D)
static ParenListExpr * Create(const ASTContext &Ctx, SourceLocation LParenLoc, ArrayRef< Expr *> Exprs, SourceLocation RParenLoc)
Create a paren list.
Describes an C or C++ initializer list.
A C++ typeid expression (C++ [expr.typeid]), which gets the type_info that corresponds to the supplie...
Represents a C++ using-declaration.
SourceLocation getIvarRBraceLoc() const
An rvalue reference type, per C++11 [dcl.ref].
CXXRecordDecl * getAsRecordDecl() const
Retrieve the record declaration stored in this nested name specifier.
UnresolvedUsingTypenameDecl * getDecl() const
IdentifierInfo * getAsIdentifier() const
Retrieve the identifier stored in this nested name specifier.
SourceLocation getEndLoc() const
ExpectedDecl VisitTypedefDecl(TypedefDecl *D)
void completeDefinition() override
Indicates that the definition of this class is now complete.
ForStmt - This represents a 'for (init;cond;inc)' stmt.
Represents the results of name lookup.
A qualified template name, where the qualification is kept to describe the source code as written...
unsigned getFirstExprIndex() const
static IfStmt * Create(const ASTContext &Ctx, SourceLocation IL, bool IsConstexpr, Stmt *Init, VarDecl *Var, Expr *Cond, Stmt *Then, SourceLocation EL=SourceLocation(), Stmt *Else=nullptr)
Create an IfStmt.
Stmt * getBody(const FunctionDecl *&Definition) const
Retrieve the body (definition) of the function.
FunctionDecl * getOperatorDelete() const
static DeclAccessPair make(NamedDecl *D, AccessSpecifier AS)
bool isElidable() const
Whether this construction is elidable.
Expr * getOperand() const
const Expr * getThrowExpr() const
Error ImportDefinition(RecordDecl *From, RecordDecl *To, ImportDefinitionKind Kind=IDK_Default)
bool isBaseVirtual() const
Returns whether the base is virtual or not.
ExpectedStmt VisitInitListExpr(InitListExpr *E)
TagKind getTagKind() const
Namespaces, declared with 'namespace foo {}'.
void setCXXOperatorNameRange(SourceRange R)
setCXXOperatorNameRange - Sets the range of the operator name (without the operator keyword)...
A convenient class for passing around template argument information.
bool isKNRPromoted() const
True if the value passed to this parameter must undergo K&R-style default argument promotion: ...
ExpectedType VisitPointerType(const PointerType *T)
const FileInfo & getFile() const
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the variable template specialization.
void setRange(SourceRange R)
bool doesUsualArrayDeleteWantSize() const
Answers whether the usual array deallocation function for the allocated type expects the size of the ...
LabelDecl * getDecl() const
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
SourceLocation getLBracLoc() const
FunctionTemplateDecl * getDescribedFunctionTemplate() const
Retrieves the function template that is described by this function declaration.
ArrayRef< NamedDecl * > chain() const
SourceLocation getRParenLoc() const
QualType getNullPtrType() const
Retrieve the type for null non-type template argument.
Expr * getInitializer()
The initializer of this new-expression.
ExprValueKind getValueKind() const
getValueKind - The value kind that this expression produces.
path_iterator path_begin()
static CaseStmt * Create(const ASTContext &Ctx, Expr *lhs, Expr *rhs, SourceLocation caseLoc, SourceLocation ellipsisLoc, SourceLocation colonLoc)
Build a case statement.
SourceLocation getTemplateKeywordLoc() const
Retrieve the location of the template keyword preceding this name, if any.
ExpectedDecl VisitEnumDecl(EnumDecl *D)
PropertyAttributeKind getPropertyAttributes() const
NamespaceAliasDecl * getAsNamespaceAlias() const
Retrieve the namespace alias stored in this nested name specifier.
ExpectedDecl VisitAccessSpecDecl(AccessSpecDecl *D)
ExpectedStmt VisitSubstNonTypeTemplateParmExpr(SubstNonTypeTemplateParmExpr *E)
SourceLocation getBeginLoc() const LLVM_READONLY
Error ImportDeclContext(DeclContext *FromDC, bool ForceImport=false)
Represents a typeof (or typeof) expression (a GCC extension).
A builtin binary operation expression such as "x + y" or "x <= y".
Expected< FunctionDecl * > FindFunctionTemplateSpecialization(FunctionDecl *FromFD)
ExpectedStmt VisitObjCAtFinallyStmt(ObjCAtFinallyStmt *S)
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier (with source-location information) that qualifies the name of this...
unsigned getNumPositiveBits() const
Returns the width in bits required to store all the non-negative enumerators of this enum...
bool constructsVBase() const
Determine whether this constructor is actually constructing a base class (rather than a complete obje...
ExpectedType VisitUnaryTransformType(const UnaryTransformType *T)
void setLambdaMangling(unsigned ManglingNumber, Decl *ContextDecl)
Set the mangling number and context declaration for a lambda class.
tokloc_iterator tokloc_end() const
ExpectedStmt VisitSwitchStmt(SwitchStmt *S)
static CompoundStmt * Create(const ASTContext &C, ArrayRef< Stmt *> Stmts, SourceLocation LB, SourceLocation RB)
ExpectedStmt VisitExplicitCastExpr(ExplicitCastExpr *E)
ExpectedStmt VisitArraySubscriptExpr(ArraySubscriptExpr *E)
SourceLocation getThrowLoc() const
const StringLiteral * getInputConstraintLiteral(unsigned i) const
const Type * getClass() const
CXXForRangeStmt - This represents C++0x [stmt.ranged]'s ranged for statement, represented as 'for (ra...
ExpectedType VisitFunctionProtoType(const FunctionProtoType *T)
Error ImportInitializer(VarDecl *From, VarDecl *To)
CXXRecordDecl * getDecl() const
bool isConstexpr() const
Whether this variable is (C++11) constexpr.
FunctionTemplateSpecializationInfo * getTemplateSpecializationInfo() const
If this function is actually a function template specialization, retrieve information about this func...
VarTemplateDecl * getSpecializedTemplate() const
Retrieve the template that this specialization specializes.
ObjCProtocolDecl * getDefinition()
Retrieve the definition of this protocol, if any.
SourceLocation getEqualOrColonLoc() const
Retrieve the location of the '=' that precedes the initializer value itself, if present.
SourceLocation getRAngleLoc() const
Retrieve the location of the right angle bracket ending the explicit template argument list following...
void setSpecializationKind(TemplateSpecializationKind TSK)
Expr * getSizeExpr() const
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
ExpectedStmt VisitOffsetOfExpr(OffsetOfExpr *OE)
const TemplateArgument * getArgs() const
Retrieve the template arguments.
SourceLocation getLocalEndLoc() const
Retrieve the location of the end of this component of the nested-name-specifier.
ExpectedStmt VisitGNUNullExpr(GNUNullExpr *E)
bool declaresSameEntity(const Decl *D1, const Decl *D2)
Determine whether two declarations declare the same entity.
CaseStmt - Represent a case statement.
bool hasUnparsedDefaultArg() const
Determines whether this parameter has a default argument that has not yet been parsed.
SourceLocation getContinueLoc() const
const Expr * getInitExpr() const
SourceLocation getPropertyIvarDeclLoc() const
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
FieldDecl * getField()
Get the field whose initializer will be used.
Helper class for OffsetOfExpr.
SourceLocation getExternLoc() const
Represents an Objective-C protocol declaration.
Represents binding an expression to a temporary.
bool IsStructurallyEquivalent(QualType From, QualType To, bool Complain=true)
Determine whether the given types are structurally equivalent.
ExpectedStmt VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E)
StringLiteral * getClobberStringLiteral(unsigned i)
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC)...
TemplateTemplateParmDecl * getParameter() const
SourceLocation getBuiltinLoc() const
CXXTemporary * getTemporary()
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
CXXRecordDecl * getNamingClass()
Gets the 'naming class' (in the sense of C++0x [class.access.base]p5) of the lookup.
ExpectedStmt VisitCXXCatchStmt(CXXCatchStmt *S)
static IntegerLiteral * Create(const ASTContext &C, const llvm::APInt &V, QualType type, SourceLocation l)
Returns a new integer literal with value 'V' and type 'type'.
NestedNameSpecifierLoc getQualifierLoc() const
If the name was qualified, retrieves the nested-name-specifier that precedes the name, with source-location information.
void setProtocolList(ObjCProtocolDecl *const *List, unsigned Num, const SourceLocation *Locs, ASTContext &C)
setProtocolList - Set the list of protocols that this interface implements.
ExpectedStmt VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E)
PropertyControl getPropertyImplementation() const
const TemplateArgument * data() const
Retrieve a pointer to the template argument list.
DeclarationName getDeclName() const
Retrieve the name that this expression refers to.
FunctionDecl * getInstantiatedFromMemberFunction() const
If this function is an instantiation of a member function of a class template specialization, retrieves the function from which it was instantiated.
void log(raw_ostream &OS) const override
ExpectedDecl VisitStaticAssertDecl(StaticAssertDecl *D)
Represents a C++ member access expression where the actual member referenced could not be resolved be...
ExpectedStmt VisitReturnStmt(ReturnStmt *S)
Represents an ObjC class declaration.
VarDecl * getConditionVariable() const
Retrieve the variable declared in this "for" statement, if any.
FieldDecl * getMember() const
If this is a member initializer, returns the declaration of the non-static data member being initiali...
ExpectedStmt VisitMaterializeTemporaryExpr(MaterializeTemporaryExpr *E)
Represents a linkage specification.
SourceLocation getOperatorLoc() const
getOperatorLoc - Return the location of the operator.
QualType getReturnType() const
SourceLocation getIncludeLoc() const
CXXRecordDecl * getTemplatedDecl() const
Get the underlying class declarations of the template.
bool isParameterPack() const
Whether this template template parameter is a template parameter pack.
static UnresolvedLookupExpr * Create(const ASTContext &Context, CXXRecordDecl *NamingClass, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, bool RequiresADL, bool Overloaded, UnresolvedSetIterator Begin, UnresolvedSetIterator End)
FunctionDecl * SourceDecl
The function whose exception specification this is, for EST_Unevaluated and EST_Uninstantiated.
ExpectedStmt VisitLambdaExpr(LambdaExpr *LE)
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this function is an instantiation of a member function of a class template specialization, retrieves the member specialization information.
TypeSourceInfo * getTypeSourceInfo() const
ExpectedType VisitDependentSizedArrayType(const DependentSizedArrayType *T)
Expr * getSizeExpr() const
A default argument (C++ [dcl.fct.default]).
bool isMacroArgExpansion() const
void setMethodParams(ASTContext &C, ArrayRef< ParmVarDecl *> Params, ArrayRef< SourceLocation > SelLocs=llvm::None)
Sets the method's parameters and selector source locations.
QualType getPointeeTypeAsWritten() const
SourceLocation getAtStartLoc() const
ExpectedStmt VisitParenExpr(ParenExpr *E)
Import the default subset of the definition, which might be nothing (if minimal import is set) or mig...
void addDeclInternal(Decl *D)
Add the declaration D into this context, but suppress searches for external declarations with the sam...
ExpectedDecl VisitClassTemplateDecl(ClassTemplateDecl *D)
ASTContext & getToContext() const
Retrieve the context that AST nodes are being imported into.
bool isAnonymousStructOrUnion() const
Whether this is an anonymous struct or union.
NamedDecl * getFirstQualifierFoundInScope() const
Retrieve the first part of the nested-name-specifier that was found in the scope of the member access...
Represents the this expression in C++.
ASTImporter(ASTContext &ToContext, FileManager &ToFileManager, ASTContext &FromContext, FileManager &FromFileManager, bool MinimalImport, ASTImporterLookupTable *LookupTable=nullptr)
ExpectedStmt VisitIfStmt(IfStmt *S)
ExpectedDecl VisitObjCImplementationDecl(ObjCImplementationDecl *D)
SourceLocation getRParenLoc() const
Retrieve the location of the right parentheses (')') that follows the argument list.
TypeSourceInfo * getAllocatedTypeSourceInfo() const
NestedNameSpecifierLoc getQualifierLoc() const
If the member name was qualified, retrieves the nested-name-specifier that precedes the member name...
Class that aids in the construction of nested-name-specifiers along with source-location information ...
SourceLocation getRParenLoc() const
TypeSourceInfo * getQueriedTypeSourceInfo() const
SourceLocation getTemplateEllipsisLoc() const
void getSelectorLocs(SmallVectorImpl< SourceLocation > &SelLocs) const
const ObjCAtCatchStmt * getCatchStmt(unsigned I) const
Retrieve a @catch statement.
Represents a K&R-style 'int foo()' function, which has no information available about its arguments...
ObjCPropertyImplDecl - Represents implementation declaration of a property in a class or category imp...
SourceLocation getEllipsisLoc() const
Decl * MapImported(Decl *From, Decl *To)
Store and assign the imported declaration to its counterpart.
bool hasBraces() const
Determines whether this linkage specification had braces in its syntactic form.
ExpectedStmt VisitCXXDeleteExpr(CXXDeleteExpr *E)
const FileEntry * getFile(StringRef Filename, bool OpenFile=false, bool CacheFailure=true)
Lookup, cache, and verify the specified file (real or virtual).
void completeDefinition(QualType NewType, QualType PromotionType, unsigned NumPositiveBits, unsigned NumNegativeBits)
When created, the EnumDecl corresponds to a forward-declared enum.
ConditionalOperator - The ?: ternary operator.
QualType getBaseType() const
Gets the base type of this object type.
const ValueDecl * getExtendingDecl() const
Get the declaration which triggered the lifetime-extension of this temporary, if any.
TypeSourceInfo * getTypeSourceInfo() const
bool isStdInitListInitialization() const
Whether this constructor call was written as list-initialization, but was interpreted as forming a st...
RecordDecl * getMostRecentDecl()
CXXRecordDecl * getMostRecentDecl()
Represents a C++ pseudo-destructor (C++ [expr.pseudo]).
Represents the declaration of a typedef-name via a C++11 alias-declaration.
A little helper class used to produce diagnostics.
CompoundStmt - This represents a group of statements like { stmt stmt }.
ExpectedStmt VisitDesignatedInitExpr(DesignatedInitExpr *E)
void AddSpecialization(VarTemplateSpecializationDecl *D, void *InsertPos)
Insert the specified specialization knowing that it is not already in.
Represents a prototype with parameter type info, e.g.
bool isFileVarDecl() const
Returns true for file scoped variable declaration.
bool isMicrosoftABI() const
Returns whether this is really a Win64 ABI va_arg expression.
ExpectedDecl VisitImportDecl(ImportDecl *D)
ExpectedType VisitTypeOfExprType(const TypeOfExprType *T)
friend class ASTNodeImporter
This declaration is a C++ operator declared in a non-class context.
CXXConstructorDecl * getConstructor() const
Get the constructor that this expression will (ultimately) call.
QualType getComputationLHSType() const
SourceLocation getTypenameLoc() const
Returns the source location of the 'typename' keyword.
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine whether this particular class is a specialization or instantiation of a class template or m...
CastKind
CastKind - The kind of operation required for a conversion.
QualType getPromotionType() const
Return the integer type that enumerators should promote to.
bool isDelegatingInitializer() const
Determine whether this initializer is creating a delegating constructor.
static ImplicitCastExpr * Create(const ASTContext &Context, QualType T, CastKind Kind, Expr *Operand, const CXXCastPath *BasePath, ExprValueKind Cat)
ExpectedStmt VisitCXXUnresolvedConstructExpr(CXXUnresolvedConstructExpr *E)
DeclarationNameTable DeclarationNames
A dependent template name that has not been resolved to a template (or set of templates).
SourceLocation getBeginLoc() const LLVM_READONLY
ExpectedStmt VisitUnresolvedLookupExpr(UnresolvedLookupExpr *E)
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand...
bool isParameterPack() const
Whether this parameter is a non-type template parameter pack.
SourceLocation getTryLoc() const
SourceLocation getLocation() const
SourceLocation getLocation() const
void setTypeParamList(ObjCTypeParamList *TPL)
Set the type parameters of this category.
SourceLocation getEndLoc() const LLVM_READONLY
ArrayRef< TypeSourceInfo * > getArgs() const
Retrieve the argument types.
ConstantExpr - An expression that occurs in a constant context.
ImportDefinitionKind
What we should import from the definition.
static CXXDefaultArgExpr * Create(const ASTContext &C, SourceLocation Loc, ParmVarDecl *Param)
Represents a call to the builtin function __builtin_va_arg.
TypeSourceInfo * getTrivialTypeSourceInfo(QualType T, SourceLocation Loc=SourceLocation()) const
Allocate a TypeSourceInfo where all locations have been initialized to a given location, which defaults to the empty location.
ValueDecl * getAsDecl() const
Retrieve the declaration for a declaration non-type template argument.
TypeSourceInfo * getTypeSourceInfo() const
ExpectedStmt VisitGCCAsmStmt(GCCAsmStmt *S)
SourceLocation getLabelLoc() const
void setInClassInitializer(Expr *Init)
Set the C++11 in-class initializer for this member.
This declaration is a friend class.
bool isImplicitAccess() const
True if this is an implicit access, i.e.
SourceLocation getThrowLoc() const LLVM_READONLY
CharacteristicKind getFileCharacteristic() const
Return whether this is a system header or not.
static unsigned getNumSubExprs(AtomicOp Op)
Determine the number of arguments the specified atomic builtin should have.
unsigned getValue() const
static NestedNameSpecifier * SuperSpecifier(const ASTContext &Context, CXXRecordDecl *RD)
Returns the nested name specifier representing the __super scope for the given CXXRecordDecl.
ExpectedStmt VisitCompoundLiteralExpr(CompoundLiteralExpr *E)
Represents an array type in C++ whose size is a value-dependent expression.
SourceLocation getDestroyedTypeLoc() const
Retrieve the starting location of the type being destroyed.
SourceLocation getBeginLoc() const
Get the begin source location.
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
static StringLiteral * Create(const ASTContext &Ctx, StringRef Str, StringKind Kind, bool Pascal, QualType Ty, const SourceLocation *Loc, unsigned NumConcatenated)
This is the "fully general" constructor that allows representation of strings formed from multiple co...
An expression "T()" which creates a value-initialized rvalue of type T, which is a non-class type...
ADLCallKind getADLCallKind() const
SourceLocation getOperatorLoc() const
Retrieve the location of the '->' or '.' operator.
QualType getInjectedSpecializationType() const
Retrieves the injected specialization type for this partial specialization.
QualType getElementType() const
static CallExpr * Create(const ASTContext &Ctx, Expr *Fn, ArrayRef< Expr *> Args, QualType Ty, ExprValueKind VK, SourceLocation RParenLoc, unsigned MinNumArgs=0, ADLCallKind UsesADL=NotADL)
Create a call expression.
Error ImportTemplateArgumentListInfo(const InContainerTy &Container, TemplateArgumentListInfo &ToTAInfo)
void setGetterMethodDecl(ObjCMethodDecl *gDecl)
bool isInlineSpecified() const
Determine whether the "inline" keyword was specified for this function.
QualType getCXXNameType() const
If this name is one of the C++ names (of a constructor, destructor, or conversion function)...
ExpectedType VisitInjectedClassNameType(const InjectedClassNameType *T)
unsigned getNumArgs() const
Retrieve the number of template arguments.
unsigned getFunctionScopeDepth() const
llvm::MutableArrayRef< Designator > designators()
NamespaceDecl * getAsNamespace() const
Retrieve the namespace stored in this nested name specifier.
DeclAccessPair getFoundDecl() const
Retrieves the declaration found by lookup.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
This represents one expression.
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
Defines the clang::LangOptions interface.
SourceLocation getElseLoc() const
static TypeTraitExpr * Create(const ASTContext &C, QualType T, SourceLocation Loc, TypeTrait Kind, ArrayRef< TypeSourceInfo *> Args, SourceLocation RParenLoc, bool Value)
Create a new type trait expression.
unsigned getChainingSize() const
SourceLocation getAliasLoc() const
Returns the location of the alias name, i.e.
ExprValueKind
The categorization of expression values, currently following the C++11 scheme.
Selector getSetterName() const
SourceLocation getCaptureDefaultLoc() const
Retrieve the location of this lambda's capture-default, if any.
IdentifierInfo * getFieldName() const
For a field or identifier offsetof node, returns the name of the field.
CXXBaseSpecifier * getBase() const
For a base class node, returns the base specifier.
bool isArrow() const
Determine whether this member expression used the '->' operator; otherwise, it used the '...
bool isScopedUsingClassTag() const
Returns true if this is a C++11 scoped enumeration.
TypeSourceInfo * getSuperClassTInfo() const
Declaration of a template type parameter.
void setSetterMethodDecl(ObjCMethodDecl *gDecl)
SourceLocation getDefaultLoc() const
unsigned getIndex() const
FileID createFileID(const FileEntry *SourceFile, SourceLocation IncludePos, SrcMgr::CharacteristicKind FileCharacter, int LoadedID=0, unsigned LoadedOffset=0)
Create a new FileID that represents the specified file being #included from the specified IncludePosi...
bool isImplicitAccess() const
True if this is an implicit access, i.e., one in which the member being accessed was not written in t...
SourceLocation getWhileLoc() const
TypeSourceInfo * getTypeSourceInfo() const
DeclarationNameInfo getNameInfo() const
unsigned getPackLength() const
Retrieve the length of the parameter pack.
void setSyntacticForm(InitListExpr *Init)
ExpectedDecl VisitNamespaceDecl(NamespaceDecl *D)
Represents a C++ functional cast expression that builds a temporary object.
The template argument is a null pointer or null pointer to member that was provided for a non-type te...
ExpectedType VisitObjCInterfaceType(const ObjCInterfaceType *T)
SourceLocation getLocation() const
T getAs() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
Represents a C++ destructor within a class.
bool hasRelatedResultType() const
Determine whether this method has a result type that is related to the message receiver's type...
SourceLocation createMacroArgExpansionLoc(SourceLocation Loc, SourceLocation ExpansionLoc, unsigned TokLength)
Return a new SourceLocation that encodes the fact that a token from SpellingLoc should actually be re...
VarDecl * getExceptionDecl() const
IdentifierInfo * getDestroyedTypeIdentifier() const
In a dependent pseudo-destructor expression for which we do not have full type information on the des...
bool isFieldDesignator() const
unsigned getNumInits() const
bool isThisDeclarationADefinition() const
Determine whether this particular declaration is also the definition.
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
Expr * getSubExpr() const
Get the initializer to use for each array element.
SourceLocation getBeginLoc() const
void setRBraceLoc(SourceLocation L)
const char * getTypeClassName() const
LookupResult lookup(DeclContext *DC, DeclarationName Name) const
static CXXStaticCastExpr * Create(const ASTContext &Context, QualType T, ExprValueKind VK, CastKind K, Expr *Op, const CXXCastPath *Path, TypeSourceInfo *Written, SourceLocation L, SourceLocation RParenLoc, SourceRange AngleBrackets)
ExpectedDecl VisitObjCCategoryImplDecl(ObjCCategoryImplDecl *D)
bool isArrow() const
Determine whether this pseudo-destructor expression was written using an '->' (otherwise, it used a '.
ClassTemplateDecl * getSpecializedTemplate() const
Retrieve the template that this specialization specializes.
overridden_method_range overridden_methods() const
ExpectedStmt VisitGotoStmt(GotoStmt *S)
const CompoundStmt * getSynchBody() const
DeclContext * getDeclContext()
SourceLocation getLParenLoc() const
A structure for storing the information associated with a substituted template template parameter...
CXXRecordDecl * getDefinition() const
ExpectedType VisitTypedefType(const TypedefType *T)
lookup_result noload_lookup(DeclarationName Name)
Find the declarations with the given name that are visible within this context; don't attempt to retr...
const IdentifierInfo * getIdentifier() const
Retrieve the type named by the typename specifier as an identifier.
Represents Objective-C's @synchronized statement.
ObjCInterfaceDecl * getSuperClass() const
static CXXDependentScopeMemberExpr * Create(const ASTContext &Ctx, Expr *Base, QualType BaseType, bool IsArrow, SourceLocation OperatorLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, NamedDecl *FirstQualifierFoundInScope, DeclarationNameInfo MemberNameInfo, const TemplateArgumentListInfo *TemplateArgs)
TypeSourceInfo * getNamedTypeInfo() const
getNamedTypeInfo - Returns the source type info associated to the name.
TypeSourceInfo * getTypeSourceInfo() const
NestedNameSpecifierLoc getPrefix() const
Return the prefix of this nested-name-specifier.
static ObjCTypeParamList * create(ASTContext &ctx, SourceLocation lAngleLoc, ArrayRef< ObjCTypeParamDecl *> typeParams, SourceLocation rAngleLoc)
Create a new Objective-C type parameter list.
unsigned size() const
Returns the number of designators in this initializer.
Represents an expression that computes the length of a parameter pack.
ExpectedStmt VisitCXXDefaultArgExpr(CXXDefaultArgExpr *E)
CXXTryStmt - A C++ try block, including all handlers.
StorageClass getStorageClass() const
Returns the storage class as written in the source.
SourceLocation getAtTryLoc() const
Retrieve the location of the @ in the @try.
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
bool refersToEnclosingVariableOrCapture() const
Does this DeclRefExpr refer to an enclosing local or a captured variable?
static FloatingLiteral * Create(const ASTContext &C, const llvm::APFloat &V, bool isexact, QualType Type, SourceLocation L)
Represents a C++ template name within the type system.
Represents the type decltype(expr) (C++11).
ArrayTypeTrait getTrait() const
EnumDecl * getDefinition() const
Defines the clang::TypeLoc interface and its subclasses.
bool isIdentifier() const
Determine whether this template name refers to an identifier.
A namespace alias, stored as a NamespaceAliasDecl*.
ParmVarDecl *const * param_iterator
llvm::Expected< QualType > Import_New(QualType FromT)
Import the given type from the "from" context into the "to" context.
protocol_loc_iterator protocol_loc_begin() const
bool containsDeclAndLoad(Decl *D) const
Checks whether a declaration is in this context.
DependentFunctionTemplateSpecializationInfo * getDependentSpecializationInfo() const
llvm::SmallVector< Decl *, 2 > getCanonicalForwardRedeclChain(Decl *D)
ArrayRef< Expr * > inits()
ExpectedStmt VisitArrayInitIndexExpr(ArrayInitIndexExpr *E)
IdentifierInfo * getAsIdentifierInfo() const
Retrieve the IdentifierInfo * stored in this declaration name, or null if this declaration name isn't...
void setImplementation(ObjCImplementationDecl *ImplD)
void setConstexpr(bool IC)
SourceRange getAngleBrackets() const LLVM_READONLY
ExpectedStmt VisitIntegerLiteral(IntegerLiteral *E)
ExpectedDecl VisitCXXConversionDecl(CXXConversionDecl *D)
Kind getKind() const
Determine what kind of offsetof node this is.
SourceLocation getLAngleLoc() const
Retrieve the location of the left angle bracket starting the explicit template argument list followin...
bool hasBody(const FunctionDecl *&Definition) const
Returns true if the function has a body.
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
bool isFunctionOrMethod() const
std::error_code convertToErrorCode() const override
ExpectedDecl VisitObjCProtocolDecl(ObjCProtocolDecl *D)
ExpectedStmt VisitTypeTraitExpr(TypeTraitExpr *E)
static LambdaExpr * Create(const ASTContext &C, CXXRecordDecl *Class, SourceRange IntroducerRange, LambdaCaptureDefault CaptureDefault, SourceLocation CaptureDefaultLoc, ArrayRef< LambdaCapture > Captures, bool ExplicitParams, bool ExplicitResultType, ArrayRef< Expr *> CaptureInits, SourceLocation ClosingBrace, bool ContainsUnexpandedParameterPack)
Construct a new lambda expression.
SourceLocation getSwitchLoc() const
Declaration of an alias template.
LabelDecl * getLabel() const
const Stmt * getTryBody() const
Retrieve the @try body.
static PredefinedExpr * Create(const ASTContext &Ctx, SourceLocation L, QualType FNTy, IdentKind IK, StringLiteral *SL)
Create a PredefinedExpr.
ReturnStmt - This represents a return, optionally of an expression: return; return 4;...
void setPointOfInstantiation(SourceLocation Loc)
SourceLocation getDoLoc() const
SwitchCase * getSwitchCaseList()
SourceLocation getAtLoc() const
SourceLocation getLBracketLoc() const
SourceLocation getRBracketLoc() const
SourceLocation getEnd() const
UnaryOperator - This represents the unary-expression's (except sizeof and alignof), the postinc/postdec operators from postfix-expression, and various extensions.
bool isInstanceMethod() const
Represents a GCC generic vector type.
ArraySizeModifier getSizeModifier() const
bool usesGNUSyntax() const
Determines whether this designated initializer used the deprecated GNU syntax for designated initiali...
SourceLocation getEndLoc() const LLVM_READONLY
ExpectedStmt VisitObjCAtCatchStmt(ObjCAtCatchStmt *S)
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this class is an instantiation of a member class of a class template specialization, retrieves the member specialization information.
An lvalue reference type, per C++11 [dcl.ref].
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
static WhileStmt * Create(const ASTContext &Ctx, VarDecl *Var, Expr *Cond, Stmt *Body, SourceLocation WL)
Create a while statement.
Represents a reference to a non-type template parameter that has been substituted with a template arg...
bool isBaseOfClass() const
Determine whether this base class is a base of a class declared with the 'class' keyword (vs...
const OffsetOfNode & getComponent(unsigned Idx) const
unsigned getNumArgs() const
Expr * getTrueExpr() const
getTrueExpr - Return the subexpression which will be evaluated if the condition evaluates to true; th...
SourceLocation getTemplateKeywordLoc() const
Retrieve the location of the template keyword preceding this name, if any.
ExpectedStmt VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *E)
void setDescribedClassTemplate(ClassTemplateDecl *Template)
SourceLocation getRParenLoc() const
Represents a C++ conversion function within a class.
ExpectedStmt VisitCXXDefaultInitExpr(CXXDefaultInitExpr *E)
The result type of a method or function.
bool isTrivial() const
Whether this function is "trivial" in some specialized C++ senses.
SourceLocation getForLoc() const
const Expr * getSubExpr() const
SourceLocation getBeginLoc() const LLVM_READONLY
const Expr * getSubExpr() const
SourceLocation getPackLoc() const
Determine the location of the parameter pack.
CXXMethodDecl * getCallOperator() const
Retrieve the function call operator associated with this lambda expression.
ExpectedStmt VisitStringLiteral(StringLiteral *E)
bool isNull() const
Return true if this QualType doesn't point to a type yet.
A type, stored as a Type*.
Expr * getLHS()
An array access can be written A[4] or 4[A] (both are equivalent).
bool hadMultipleCandidates() const
Returns true if this expression refers to a function that was resolved from an overloaded set having ...
SourceLocation getEndLoc() const LLVM_READONLY
ExpectedStmt VisitCXXNamedCastExpr(CXXNamedCastExpr *E)
const ExpansionInfo & getExpansion() const
ImaginaryLiteral - We support imaginary integer and floating point literals, like "1...
static TemplateParameterList * Create(const ASTContext &C, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ArrayRef< NamedDecl *> Params, SourceLocation RAngleLoc, Expr *RequiresClause)
FriendObjectKind getFriendObjectKind() const
Determines whether this declaration is the object of a friend declaration and, if so...
Expr * getUnderlyingExpr() const
decl_type * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
ExpectedStmt VisitIndirectGotoStmt(IndirectGotoStmt *S)
ExpectedStmt VisitCXXConstructExpr(CXXConstructExpr *E)
ObjCProtocolList::iterator protocol_iterator
ExprObjectKind getObjectKind() const
getObjectKind - The object kind that this expression produces.
DoStmt - This represents a 'do/while' stmt.
SourceLocation getOperatorLoc() const
Retrieve the location of the '->' or '.' operator.
unsigned getBuiltinID() const
Return a value indicating whether this is a builtin function.
TypeSourceInfo * getAsTypeSourceInfo() const
ExpectedStmt VisitCharacterLiteral(CharacterLiteral *E)
SourceLocation getLParenLoc() const
Retrieve the location of the left parentheses ('(') that precedes the argument list.
TypeSourceInfo * getReturnTypeSourceInfo() const
RecordDecl * getDecl() const
bool capturesVariable() const
Determine whether this capture handles a variable.
SpecifierKind
The kind of specifier that completes this nested name specifier.
const DeclarationNameInfo & getNameInfo() const
Retrieve the name that this expression refers to.
ExpectedStmt VisitPredefinedExpr(PredefinedExpr *E)
NestedNameSpecifierLoc getTemplateQualifierLoc() const
ExpectedStmt VisitCompoundAssignOperator(CompoundAssignOperator *E)
SourceLocation getExpansionLocEnd() const
SourceLocation getUsingLoc() const
Return the location of the using keyword.
void setTypeForDecl(const Type *TD)
NestedNameSpecifier * getQualifier() const
Return the nested name specifier that qualifies this name.
A template template parameter pack that has been substituted for a template template argument pack...
CanThrowResult
Possible results from evaluation of a noexcept expression.
SourceLocation getUsingLoc() const
Returns the source location of the 'using' keyword.
Error ImportContainerChecked(const InContainerTy &InContainer, OutContainerTy &OutContainer)
static SwitchStmt * Create(const ASTContext &Ctx, Stmt *Init, VarDecl *Var, Expr *Cond)
Create a switch statement.
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class...
OverloadedTemplateStorage * getAsOverloadedTemplate() const
Retrieve the underlying, overloaded function template.
void makeDeclVisibleInContext(NamedDecl *D)
Makes a declaration visible within this context.
TemplateName getDependentTemplateName(NestedNameSpecifier *NNS, const IdentifierInfo *Name) const
Retrieve the template name that represents a dependent template name such as MetaFun::template apply...
SourceLocation getLParenLoc() const
SelectorTable & Selectors
ExpectedDecl VisitCXXConstructorDecl(CXXConstructorDecl *D)
static CXXConstCastExpr * Create(const ASTContext &Context, QualType T, ExprValueKind VK, Expr *Op, TypeSourceInfo *WrittenTy, SourceLocation L, SourceLocation RParenLoc, SourceRange AngleBrackets)
static CXXBindTemporaryExpr * Create(const ASTContext &C, CXXTemporary *Temp, Expr *SubExpr)
A field in a dependent type, known only by its name.
ExpectedStmt VisitPackExpansionExpr(PackExpansionExpr *E)
QualType getCanonicalType() const
Represents a call to an inherited base class constructor from an inheriting constructor.
ExpectedDecl VisitEmptyDecl(EmptyDecl *D)
ExpressionTrait getTrait() const
ExceptionSpecificationType Type
The kind of exception specification this is.
TypeLoc IgnoreParens() const
param_type_range param_types() const
IdentifierInfo * getIdentifierInfoForSlot(unsigned argIndex) const
Retrieve the identifier at a given position in the selector.
ElaboratedTypeKeyword getKeyword() const
ExtProtoInfo getExtProtoInfo() const
const ContentCache * getContentCache() const
static CXXNewExpr * Create(const ASTContext &Ctx, bool IsGlobalNew, FunctionDecl *OperatorNew, FunctionDecl *OperatorDelete, bool ShouldPassAlignment, bool UsualArrayDeleteWantsSize, ArrayRef< Expr *> PlacementArgs, SourceRange TypeIdParens, Expr *ArraySize, InitializationStyle InitializationStyle, Expr *Initializer, QualType Ty, TypeSourceInfo *AllocatedTypeInfo, SourceRange Range, SourceRange DirectInitRange)
Create a c++ new expression.
void setKNRPromoted(bool promoted)
SourceLocation getEllipsisLoc() const
Retrieve the location of the ellipsis for a capture that is a pack expansion.
SourceLocation getEndLoc() const LLVM_READONLY
SourceLocation getNameLoc() const
Gets the location of the name.
bool inheritedFromVBase() const
Determine whether the inherited constructor is inherited from a virtual base of the object we constru...
SourceLocation getRAngleLoc() const
Retrieve the location of the right angle bracket ending the explicit template argument list following...
StringLiteral * getFunctionName()
unsigned getNumExprs() const
Return the number of expressions in this paren list.
ExpectedStmt VisitUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr *E)
ExpectedType VisitRecordType(const RecordType *T)
void MakeSuper(ASTContext &Context, CXXRecordDecl *RD, SourceLocation SuperLoc, SourceLocation ColonColonLoc)
Turns this (empty) nested-name-specifier into '__super' nested-name-specifier.
bool isParameterPack() const
Returns whether this is a parameter pack.
FunctionDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
Encodes a location in the source.
bool getSynthesize() const
ObjCInterfaceDecl * getDecl() const
Get the declaration of this interface.
Sugar for parentheses used when specifying types.
SourceLocation getEndLoc() const LLVM_READONLY
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
QualType getReturnType() const
bool isPure() const
Whether this virtual function is pure, i.e.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums...
SourceLocation getOperatorLoc() const
ObjCProtocolList::iterator protocol_iterator
const Stmt * getCatchBody() const
static DependentScopeDeclRefExpr * Create(const ASTContext &Context, NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs)
unsigned getNumHandlers() const
SourceLocation createExpansionLoc(SourceLocation Loc, SourceLocation ExpansionLocStart, SourceLocation ExpansionLocEnd, unsigned TokLength, bool ExpansionIsTokenRange=true, int LoadedID=0, unsigned LoadedOffset=0)
Return a new SourceLocation that encodes the fact that a token from SpellingLoc should actually be re...
Expr * getSubExpr() const
SourceLocation getSuperClassLoc() const
Represents a C++ temporary.
bool hasExplicitTemplateArgs() const
Determines whether this member expression actually had a C++ template argument list explicitly specif...
Represents typeof(type), a GCC extension.
Interfaces are the core concept in Objective-C for object oriented design.
SourceLocation getRAngleLoc() const
Retrieve the location of the right angle bracket ending the explicit template argument list following...
Attr * clone(ASTContext &C) const
NestedNameSpecifierLoc getQualifierLoc() const
Retrieves the nested-name-specifier that qualifies the type name, with source-location information...
SourceLocation getNamespaceKeyLocation() const
Returns the location of the namespace keyword.
ExpectedDecl VisitUnresolvedUsingValueDecl(UnresolvedUsingValueDecl *D)
bool hasUnresolvedUsing() const
Determine whether the lookup results contain an unresolved using declaration.
CastKind getCastKind() const
ObjCTypeParamList * getTypeParamList() const
Retrieve the type parameter list associated with this category or extension.
Expr * getSubExpr(unsigned Idx) const
A structure for storing an already-substituted template template parameter pack.
ExpectedStmt VisitObjCAutoreleasePoolStmt(ObjCAutoreleasePoolStmt *S)
SourceLocation getOperatorLoc() const
Retrieve the location of the cast operator keyword, e.g., static_cast.
ExpectedStmt VisitDeclStmt(DeclStmt *S)
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)"...
void setExternLoc(SourceLocation Loc)
Sets the location of the extern keyword.
ExpectedType VisitSubstTemplateTypeParmType(const SubstTemplateTypeParmType *T)
bool wasDeclaredWithTypename() const
Whether this template type parameter was declared with the 'typename' keyword.
DeclarationName getName() const
getName - Returns the embedded declaration name.
static ConstantExpr * Create(const ASTContext &Context, Expr *E)
Represents the declaration of a struct/union/class/enum.
SourceLocation getUsingLoc() const
Return the source location of the 'using' keyword.
SourceLocation getEllipsisLoc() const
Retrieve the location of the ellipsis that describes this pack expansion.
static SizeOfPackExpr * Create(ASTContext &Context, SourceLocation OperatorLoc, NamedDecl *Pack, SourceLocation PackLoc, SourceLocation RParenLoc, Optional< unsigned > Length=None, ArrayRef< TemplateArgument > PartialArgs=None)
SourceLocation getCategoryNameLoc() const
Represents a call to a member function that may be written either with member call syntax (e...
TypeAliasTemplateDecl * getDescribedAliasTemplate() const
ASTContext & getASTContext() const LLVM_READONLY
llvm::iterator_range< capture_init_iterator > capture_inits()
Retrieve the initialization expressions for this lambda's captures.
static Error setTypedefNameForAnonDecl(TagDecl *From, TagDecl *To, ASTImporter &Importer)
ObjCCategoryDecl * getCategoryDecl() const
QualType getElementType() const
DeclStmt - Adaptor class for mixing declarations with statements and expressions. ...
ExpectedType VisitAutoType(const AutoType *T)
Represents the declaration of a label.
void setPropertyAttributesAsWritten(PropertyAttributeKind PRVal)
SourceLocation getEndLoc() const LLVM_READONLY
Represents a dependent using declaration which was not marked with typename.
Cached information about one file (either on disk or in the virtual file system). ...
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
Expr * getInClassInitializer() const
Get the C++11 default member initializer for this member, or null if one has not been set...
ExpectedDecl VisitIndirectFieldDecl(IndirectFieldDecl *D)
static OffsetOfExpr * Create(const ASTContext &C, QualType type, SourceLocation OperatorLoc, TypeSourceInfo *tsi, ArrayRef< OffsetOfNode > comps, ArrayRef< Expr *> exprs, SourceLocation RParenLoc)
Represents a static or instance method of a struct/union/class.
static ExprWithCleanups * Create(const ASTContext &C, EmptyShell empty, unsigned numObjects)
SourceLocation getFriendLoc() const
Retrieves the location of the 'friend' keyword.
bool shouldForceImportDeclContext(ImportDefinitionKind IDK)
StmtVisitor - This class implements a simple visitor for Stmt subclasses.
bool canOverflow() const
Returns true if the unary operator can cause an overflow.
SourceLocation getRParenLoc() const
Expr * getRequiresClause()
The constraint-expression of the associated requires-clause.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
void addOverriddenMethod(const CXXMethodDecl *MD)
SourceLocation getIdentLocation() const
Returns the location of this using declaration's identifier.
void setProtocolList(ObjCProtocolDecl *const *List, unsigned Num, const SourceLocation *Locs, ASTContext &C)
setProtocolList - Set the list of protocols that this interface implements.
void MakeGlobal(ASTContext &Context, SourceLocation ColonColonLoc)
Turn this (empty) nested-name-specifier into the global nested-name-specifier '::'.
bool isBoundToLvalueReference() const
Determine whether this materialized temporary is bound to an lvalue reference; otherwise, it's bound to an rvalue reference.
bool isParameterPack() const
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name of the namespace, with source-location inf...
ExpectedType VisitTemplateSpecializationType(const TemplateSpecializationType *T)
ExpectedDecl VisitCXXMethodDecl(CXXMethodDecl *D)
ObjCCategoryDecl - Represents a category declaration.
unsigned pack_size() const
The number of template arguments in the given template argument pack.
QualType getInjectedClassNameSpecialization()
Retrieve the template specialization type of the injected-class-name for this class template...
QualType getEquivalentType() const
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load, __atomic_store, and __atomic_compare_exchange_*, for the similarly-named C++11 instructions, and __c11 variants for <stdatomic.h>, and corresponding __opencl_atomic_* for OpenCL 2.0.
unsigned capture_size() const
Determine the number of captures in this lambda.
UnaryExprOrTypeTrait getKind() const
TemplateSpecializationKind getSpecializationKind() const
Determine the kind of specialization that this declaration represents.
bool hasExternalLexicalStorage() const
Whether this DeclContext has external storage containing additional declarations that are lexically i...
bool isScoped() const
Returns true if this is a C++11 scoped enumeration.
void addDecl(NamedDecl *D)
bool isValueDependent() const
isValueDependent - Determines whether this expression is value-dependent (C++ [temp.dep.constexpr]).
const TemplateArgumentListInfo & getTemplateArgsInfo() const
QualType getInnerType() const
SourceLocation getLParenLoc() const
SourceLocation getGotoLoc() const
SourceLocation getAtFinallyLoc() const
AccessSpecifier getAccess() const
ExpectedStmt VisitCXXDependentScopeMemberExpr(CXXDependentScopeMemberExpr *E)
void setPointOfInstantiation(SourceLocation Loc)
StructuralEquivalenceKind
Whether to perform a normal or minimal equivalence check.
bool isMinimalImport() const
Whether the importer will perform a minimal import, creating to-be-completed forward declarations whe...
ClassTemplateDecl * getMostRecentDecl()
const StringLiteral * getOutputConstraintLiteral(unsigned i) const
ExpectedStmt VisitContinueStmt(ContinueStmt *S)
Represents one property declaration in an Objective-C interface.
void setProtocolList(ObjCProtocolDecl *const *List, unsigned Num, const SourceLocation *Locs, ASTContext &C)
setProtocolList - Set the list of protocols that this interface implements.
ASTNodeImporter(ASTImporter &Importer)
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
ExpectedDecl VisitObjCPropertyDecl(ObjCPropertyDecl *D)
ExpectedDecl VisitEnumConstantDecl(EnumConstantDecl *D)
NestedNameSpecifier * getQualifier() const
Retrieve the qualification on this type.
SourceLocation getAtCatchLoc() const
ExpectedType VisitParenType(const ParenType *T)
A simple visitor class that helps create declaration visitors.
CharacterKind getKind() const
bool hasUninstantiatedDefaultArg() const
ExpectedDecl VisitClassTemplateSpecializationDecl(ClassTemplateSpecializationDecl *D)
AutoTypeKeyword getKeyword() const
bool isUsed(bool CheckUsedAttr=true) const
Whether any (re-)declaration of the entity was used, meaning that a definition is required...
virtual Decl * Imported(Decl *From, Decl *To)
Subclasses can override this function to observe all of the From -> To declaration mappings as they a...
TypeSourceInfo * getTypeAsWritten() const
Gets the type of this specialization as it was written by the user, if it was so written.
An expression trait intrinsic.
SourceLocation getRAngleLoc() const
SourceLocation getMemberLocation() const
bool isImplicitInterfaceDecl() const
isImplicitInterfaceDecl - check that this is an implicitly declared ObjCInterfaceDecl node...
EnumDecl * getDecl() const
ArrayRef< Expr * > exprs()
DeclarationNameInfo getNameInfo() const
ExpectedType VisitExtVectorType(const ExtVectorType *T)
Represents a C++11 static_assert declaration.
VarDecl * getConditionVariable()
Retrieve the variable declared in this "switch" statement, if any.
Naming ambiguity (likely ODR violation).
SourceLocation getExpansionLocStart() const
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
SourceRange getBracketsRange() const
bool isArgumentType() const
ArrayRef< TemplateArgumentLoc > template_arguments() const
ObjCImplementationDecl * getImplementation() const
SourceLocation getRBraceLoc() const
Optional< unsigned > getNumExpansions() const
Retrieve the number of expansions that this pack expansion will generate, if known.
Expr * getArrayFiller()
If this initializer list initializes an array with more elements than there are initializers in the l...
TypeSourceInfo * getTypeSourceInfo() const
Retrieves the type and source location of the base class.
SourceLocation getStarLoc() const
void setHasInheritedDefaultArg(bool I=true)
bool passAlignment() const
Indicates whether the required alignment should be implicitly passed to the allocation function...
void sawArrayRangeDesignator(bool ARD=true)
DependentTemplateName * getAsDependentTemplateName() const
Retrieve the underlying dependent template name structure, if any.
void addArgument(const TemplateArgumentLoc &Loc)
static CXXReinterpretCastExpr * Create(const ASTContext &Context, QualType T, ExprValueKind VK, CastKind Kind, Expr *Op, const CXXCastPath *Path, TypeSourceInfo *WrittenTy, SourceLocation L, SourceLocation RParenLoc, SourceRange AngleBrackets)
FunctionDecl * getOperatorDelete() const
SourceLocation getBeginLoc() const LLVM_READONLY
SourceLocation getTemplateKeywordLoc() const
Retrieve the location of the template keyword preceding this name, if any.
SourceLocation getIvarLBraceLoc() const
static MemberExpr * Create(const ASTContext &C, Expr *base, bool isarrow, SourceLocation OperatorLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, ValueDecl *memberdecl, DeclAccessPair founddecl, DeclarationNameInfo MemberNameInfo, const TemplateArgumentListInfo *targs, QualType ty, ExprValueKind VK, ExprObjectKind OK)
Describes a module import declaration, which makes the contents of the named module visible in the cu...
Represents a pointer type decayed from an array or function type.
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
The injected class name of a C++ class template or class template partial specialization.
ExpectedType VisitBuiltinType(const BuiltinType *T)
A qualified reference to a name whose declaration cannot yet be resolved.
void setVirtualAsWritten(bool V)
State that this function is marked as virtual explicitly.
ExpectedType VisitEnumType(const EnumType *T)
const Expr * getInitializer() const
ExpectedStmt VisitDeclRefExpr(DeclRefExpr *E)
Represents a pack expansion of types.
InitializationStyle getInitializationStyle() const
The kind of initializer this new-expression has.
CompoundAssignOperator - For compound assignments (e.g.
SourceLocation getLocation() const LLVM_READONLY
Defines various enumerations that describe declaration and type specifiers.
A POD class for pairing a NamedDecl* with an access specifier.
ObjCDeclQualifier getObjCDeclQualifier() const
ExpectedStmt VisitImaginaryLiteral(ImaginaryLiteral *E)
StringRef getName() const
Return the actual identifier string.
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier (with source-location information) that qualifies the name of this...
ExpectedStmt VisitImplicitValueInitExpr(ImplicitValueInitExpr *E)
ArrayRef< TemplateArgument > getPartialArguments() const
Get.
Error ImportArrayChecked(const InContainerTy &InContainer, OIter Obegin)
void updateFlags(const Decl *From, Decl *To)
SourceRange getRange() const
ExpectedStmt VisitCXXForRangeStmt(CXXForRangeStmt *S)
Error ImportTemplateArguments(const TemplateArgument *FromArgs, unsigned NumFromArgs, SmallVectorImpl< TemplateArgument > &ToArgs)
AddrLabelExpr - The GNU address of label extension, representing &&label.
An Objective-C "bridged" cast expression, which casts between Objective-C pointers and C pointers...
Base class for declarations which introduce a typedef-name.
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
Represents a template argument.
OpaqueValueExpr * getOpaqueValue() const
getOpaqueValue - Return the opaque value placeholder.
LabelStmt * getStmt() const
unsigned getManglingNumber() const
TypeSourceInfo * getDestroyedTypeInfo() const
Retrieve the source location information for the type being destroyed.
Expected< FunctionTemplateAndArgsTy > ImportFunctionTemplateWithTemplateArgsFromSpecialization(FunctionDecl *FromFD)
llvm::Expected< DeclContext * > ImportContext(DeclContext *FromDC)
Import the given declaration context from the "from" AST context into the "to" AST context...
static DeclGroupRef Create(ASTContext &C, Decl **Decls, unsigned NumDecls)
SourceLocation getTemplateKeywordLoc() const
Gets the location of the template keyword, if present.
Represents a template name that was expressed as a qualified name.
Expr * getFalseExpr() const
getFalseExpr - Return the subexpression which will be evaluated if the condnition evaluates to false;...
protocol_iterator protocol_end() const
NullStmt - This is the null statement ";": C99 6.8.3p3.
const ObjCInterfaceDecl * getClassInterface() const
bool isTypeOperand() const
NamespaceDecl * getNominatedNamespace()
Returns the namespace nominated by this using-directive.
virtual void CompleteDecl(Decl *D)
Called for ObjCInterfaceDecl, ObjCProtocolDecl, and TagDecl.
SourceLocation getLocation() const
bool isNull() const
Determine whether this template name is NULL.
Dataflow Directional Tag Classes.
void setDescribedAliasTemplate(TypeAliasTemplateDecl *TAT)
void setExtendingDecl(const ValueDecl *ExtendedBy, unsigned ManglingNumber)
TemplateName getSubstTemplateTemplateParmPack(TemplateTemplateParmDecl *Param, const TemplateArgument &ArgPack) const
NestedNameSpecifier * getNestedNameSpecifier() const
Retrieve the nested-name-specifier to which this instance refers.
bool isValid() const
Return true if this is a valid SourceLocation object.
ExpectedType VisitVectorType(const VectorType *T)
tokloc_iterator tokloc_begin() const
ExpectedStmt VisitCallExpr(CallExpr *E)
ExtInfo getExtInfo() const
VarDecl * getConditionVariable()
Retrieve the variable declared in this "while" statement, if any.
const TemplateArgument & getArgument() const
[C99 6.4.2.2] - A predefined identifier such as func.
DeclarationNameInfo getMemberNameInfo() const
Retrieve the member declaration name info.
void setGetterName(Selector Sel, SourceLocation Loc=SourceLocation())
NestedNameSpecifier * getQualifier() const
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
ExpectedStmt VisitAtomicExpr(AtomicExpr *E)
Represents a delete expression for memory deallocation and destructor calls, e.g. ...
SourceLocation getTemplateNameLoc() const
IdentifierInfo * getOutputIdentifier(unsigned i) const
PropertyAttributeKind getPropertyAttributesAsWritten() const
Kind getPropertyImplementation() const
ExpectedDecl VisitTranslationUnitDecl(TranslationUnitDecl *D)
bool isInitKnownICE() const
Determines whether it is already known whether the initializer is an integral constant expression or ...
const Stmt * getFinallyBody() const
The template argument is a pack expansion of a template name that was provided for a template templat...
SourceLocation getAtLoc() const
ExpectedStmt VisitAddrLabelExpr(AddrLabelExpr *E)
const TemplateArgument * getArgs() const
Retrieve the template arguments.
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template instantiation this function represents.
ArrayRef< const Attr * > getAttrs() const
static ReturnStmt * Create(const ASTContext &Ctx, SourceLocation RL, Expr *E, const VarDecl *NRVOCandidate)
Create a return statement.
Represents a field injected from an anonymous union/struct into the parent scope. ...
Decl * GetAlreadyImportedOrNull(const Decl *FromD) const
Return the copy of the given declaration in the "to" context if it has already been imported from the...
QualType getUnderlyingType() const
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name of the namespace, with source-location inf...
ExpectedStmt VisitBinaryOperator(BinaryOperator *E)
DeclContext * getCommonAncestor()
Returns the common ancestor context of this using-directive and its nominated namespace.
TypeSourceInfo * getTypeSourceInfo() const
Retrieve the type source information for the type being constructed.
AccessSpecifier getAccess() const
const Expr * getInit() const
ObjCInterfaceDecl * getDefinition()
Retrieve the definition of this class, or NULL if this class has been forward-declared (with @class) ...
QualType getUnderlyingType() const
bool isExplicitInstantiationOrSpecialization() const
True if this declaration is an explicit specialization, explicit instantiation declaration, or explicit instantiation definition.
LambdaCaptureKind getCaptureKind() const
Determine the kind of capture.
IdentifierNamespace
IdentifierNamespace - The different namespaces in which declarations may appear.
ExpectedType VisitType(const Type *T)
unsigned getIndex() const
Retrieve the index of the template parameter.
LLVM_NODISCARD llvm::Error importInto(ImportT &To, const ImportT &From)
Import the given object, returns the result.
DeclarationName getMember() const
Retrieve the name of the member that this expression refers to.
SourceLocation getLBraceLoc() const
Represents a dependent using declaration which was marked with typename.
SourceLocation getSemiLoc() const
The name of a declaration.
StmtClass getStmtClass() const
VectorKind getVectorKind() const
Represents the declaration of an Objective-C type parameter.
ArrayRef< QualType > exceptions() const
SourceRange getIntroducerRange() const
Retrieve the source range covering the lambda introducer, which contains the explicit capture list su...
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
void setDependentTemplateSpecialization(ASTContext &Context, const UnresolvedSetImpl &Templates, const TemplateArgumentListInfo &TemplateArgs)
Specifies that this function declaration is actually a dependent function template specialization...
Represents a C++11 pack expansion that produces a sequence of expressions.
bool isListInitialization() const
Whether this constructor call was written as list-initialization.
CXXRecordDecl * getInstantiatedFromMemberClass() const
If this record is an instantiation of a member class, retrieves the member class from which it was in...
ExpectedType VisitConstantArrayType(const ConstantArrayType *T)
Error ImportImplicitMethods(const CXXRecordDecl *From, CXXRecordDecl *To)
const Expr * getSynchExpr() const
A pointer to member type per C++ 8.3.3 - Pointers to members.
ExpectedDecl VisitObjCCategoryDecl(ObjCCategoryDecl *D)
TemplateSpecializationKind
Describes the kind of template specialization that a particular template specialization declaration r...
ExpectedStmt VisitCXXNoexceptExpr(CXXNoexceptExpr *E)
ExpectedStmt VisitConstantExpr(ConstantExpr *E)
ExplicitCastExpr - An explicit cast written in the source code.
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspnd...
Tags, declared with 'struct foo;' and referenced with 'struct foo'.
void setInitializedFieldInUnion(FieldDecl *FD)
A type that was preceded by the 'template' keyword, stored as a Type*.
ExternalASTSource * getExternalSource() const
Retrieve a pointer to the external AST source associated with this AST context, if any...
pack_iterator pack_begin() const
Iterator referencing the first argument of a template argument pack.
const TemplateTypeParmType * getReplacedParameter() const
Gets the template parameter that was substituted for.
SourceLocation getSetterNameLoc() const
ExpectedDecl VisitObjCPropertyImplDecl(ObjCPropertyImplDecl *D)
VarTemplateSpecializationDecl * findSpecialization(ArrayRef< TemplateArgument > Args, void *&InsertPos)
Return the specialization with the provided arguments if it exists, otherwise return the insertion po...
ExpectedStmt VisitCXXInheritedCtorInitExpr(CXXInheritedCtorInitExpr *E)
void setObjectOfFriendDecl(bool PerformFriendInjection=false)
Changes the namespace of this declaration to reflect that it's the object of a friend declaration...
TypeSourceInfo * getTypeOperandSourceInfo() const
Retrieve source information for the type operand.
llvm::APInt getValue() const
QualType getModifiedType() const
LabelDecl * getLabel() const
Represents a pointer to an Objective C object.
Represents a C++11 noexcept expression (C++ [expr.unary.noexcept]).
SwitchStmt - This represents a 'switch' stmt.
UsingDecl * getUsingDecl() const
Gets the using declaration to which this declaration is tied.
bool IsEquivalent(Decl *D1, Decl *D2)
Determine whether the two declarations are structurally equivalent.
SourceLocation getColonColonLoc() const
Retrieve the location of the '::' in a qualified pseudo-destructor expression.
SourceLocation getFieldLoc() const
void ImportOverrides(CXXMethodDecl *ToMethod, CXXMethodDecl *FromMethod)
SourceLocation getBeginLoc() const
FileID getFileID(SourceLocation SpellingLoc) const
Return the FileID for a SourceLocation.
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source location information.
SourceLocation getRParenLoc() const
FunctionDecl * SourceTemplate
The function template whose exception specification this is instantiated from, for EST_Uninstantiated...
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
Complex values, per C99 6.2.5p11.
Location wrapper for a TemplateArgument.
void setIsUsed()
Set whether the declaration is used, in the sense of odr-use.
unsigned getIndexTypeCVRQualifiers() const
unsigned getNumArgs() const
Retrieve the number of template arguments.
void setUnparsedDefaultArg()
Specify that this parameter has an unparsed default argument.
Expr * getUninstantiatedDefaultArg()
void setQualifierInfo(NestedNameSpecifierLoc QualifierLoc)
Imports selected nodes from one AST context into another context, merging AST nodes where appropriate...
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
QualType getCanonicalTypeInternal() const
Represents Objective-C's collection statement.
Represents a C++ base or member initializer.
unsigned getNumObjects() const
IndirectFieldDecl * getIndirectMember() const
void setQualifierInfo(NestedNameSpecifierLoc QualifierLoc)
SourceLocation getLocation() const
Retrieve the location of this expression.
SourceLocation getRParenLoc() const
Determine the location of the right parenthesis.
Selector getSelector(unsigned NumArgs, IdentifierInfo **IIV)
Can create any sort of selector.
bool IsStructuralMatch(Decl *From, Decl *To, bool Complain)
static CStyleCastExpr * Create(const ASTContext &Context, QualType T, ExprValueKind VK, CastKind K, Expr *Op, const CXXCastPath *BasePath, TypeSourceInfo *WrittenTy, SourceLocation L, SourceLocation R)
ExpectedType VisitAttributedType(const AttributedType *T)
An implicit indirection through a C++ base class, when the field found is in a base class...
const llvm::APInt & getSize() const
Expr * getCond() const
getCond - Return the condition expression; this is defined in terms of the opaque value...
protocol_iterator protocol_begin() const
Expr * getReplacement() const
void setBuiltinID(unsigned ID)
TypeSourceInfo * getTypeSourceInfo() const
bool doesUsualArrayDeleteWantSize() const
Answers whether the usual array deallocation function for the allocated type expects the size of the ...
ExtVectorType - Extended vector type.
ExpectedDecl VisitTemplateTemplateParmDecl(TemplateTemplateParmDecl *D)
SourceRange getDirectInitRange() const
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the member name, with source location information...
virtual void CompleteType(TagDecl *Tag)
Gives the external AST source an opportunity to complete an incomplete type.
param_const_iterator param_begin() const
SourceRange getBracketsRange() const
DeclContext * getRedeclContext()
getRedeclContext - Retrieve the context in which an entity conflicts with other entities of the same ...
bool hasSameType(QualType T1, QualType T2) const
Determine whether the given types T1 and T2 are equivalent.
ObjCInterfaceDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this Objective-C class.
StringRef getBytes() const
Allow access to clients that need the byte representation, such as ASTWriterStmt::VisitStringLiteral(...
Represents Objective-C's @finally statement.
The template argument is a type.
QualType getUnderlyingType() const
ExpectedDecl VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D)
void setInstantiationOfMemberClass(CXXRecordDecl *RD, TemplateSpecializationKind TSK)
Specify that this record is an instantiation of the member class RD.
void setSetterName(Selector Sel, SourceLocation Loc=SourceLocation())
The template argument is actually a parameter pack.
bool isArrow() const
Determine whether this member expression used the '->' operator; otherwise, it used the '...
SourceLocation getColonLoc() const
Represents a base class of a C++ class.
bool hasTypename() const
Return true if the using declaration has 'typename'.
void setNamedTypeInfo(TypeSourceInfo *TInfo)
setNamedTypeInfo - Sets the source type info associated to the name.
unsigned getNumClobbers() const
SourceLocation getRParenLoc() const
static llvm::Optional< unsigned > getFieldIndex(Decl *F)
Determine the index of a field in its parent record.
ArrayRef< QualType > Exceptions
Explicitly-specified list of exception types.
SourceManager & getSourceManager()
void setObjCMethodScopeInfo(unsigned parameterIndex)
bool isIncompleteType(NamedDecl **Def=nullptr) const
Types are partitioned into 3 broad categories (C99 6.2.5p1): object types, function types...
bool isPartiallySubstituted() const
Determine whether this represents a partially-substituted sizeof...
ExpectedStmt VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *E)
DeclStmt * getRangeStmt()
unsigned arg_size() const
Retrieve the number of arguments.
ImplementationControl getImplementationControl() const
Error ImportDefinitionIfNeeded(Decl *FromD, Decl *ToD=nullptr)
llvm::iterator_range< decls_iterator > decls() const
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
SourceLocation getAsmLoc() const
GotoStmt - This represents a direct goto.
void ImportDefinition(Decl *From)
ExpectedDecl VisitObjCInterfaceDecl(ObjCInterfaceDecl *D)
A use of a default initializer in a constructor or in aggregate initialization.
void setHadMultipleCandidates(bool V=true)
Sets the flag telling whether this expression refers to a function that was resolved from an overload...
A template argument list.
ExpectedType VisitLValueReferenceType(const LValueReferenceType *T)
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
ExpectedStmt VisitConditionalOperator(ConditionalOperator *E)
SourceLocation getLAngleLoc() const
Retrieve the location of the left angle bracket starting the explicit template argument list followin...
SourceLocation getCXXLiteralOperatorNameLoc() const
getCXXLiteralOperatorNameLoc - Returns the location of the literal operator name (not the operator ke...
ClassTemplateDecl * getDescribedClassTemplate() const
Retrieves the class template that is described by this class declaration.
TypedefNameDecl * getDecl() const
const SwitchCase * getNextSwitchCase() const
ExpectedDecl VisitCXXDestructorDecl(CXXDestructorDecl *D)
Expr * NoexceptExpr
Noexcept expression, if this is a computed noexcept specification.
ArrayRef< TemplateArgumentLoc > template_arguments() const
ExpectedType VisitObjCObjectPointerType(const ObjCObjectPointerType *T)
ArgKind getKind() const
Return the kind of stored template argument.
shadow_range shadows() const
unsigned getDepth() const
An attributed type is a type to which a type attribute has been applied.
static CXXMemberCallExpr * Create(const ASTContext &Ctx, Expr *Fn, ArrayRef< Expr *> Args, QualType Ty, ExprValueKind VK, SourceLocation RP, unsigned MinNumArgs=0)
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
ExpectedStmt VisitObjCForCollectionStmt(ObjCForCollectionStmt *S)
TemplateDecl * getCXXDeductionGuideTemplate() const
If this name is the name of a C++ deduction guide, return the template associated with that name...
VarDecl * getConditionVariable()
Retrieve the variable declared in this "if" statement, if any.
TranslationUnitDecl * getTranslationUnitDecl() const
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
SourceLocation getWhileLoc() const
Defines the clang::SourceLocation class and associated facilities.
SourceLocation getCategoryNameLoc() const
NestedNameSpecifierLoc getWithLocInContext(ASTContext &Context) const
Retrieve a nested-name-specifier with location information, copied into the given AST context...
TypedefNameDecl * getTypedefNameForAnonDecl() const
void setDefaultArg(Expr *defarg)
bool isMutable() const
Determines whether this field is mutable (C++ only).
bool isThisDeclarationADefinition() const
Return true if this declaration is a completion definition of the type.
Represents a C++ struct/union/class.
Represents a template specialization type whose template cannot be resolved, e.g. ...
ContinueStmt - This represents a continue.
ExpectedType VisitFunctionNoProtoType(const FunctionNoProtoType *T)
Represents a loop initializing the elements of an array.
The template argument is a template name that was provided for a template template parameter...
void setDescribedVarTemplate(VarTemplateDecl *Template)
ExpectedType VisitVariableArrayType(const VariableArrayType *T)
static CXXTryStmt * Create(const ASTContext &C, SourceLocation tryLoc, Stmt *tryBlock, ArrayRef< Stmt *> handlers)
SourceLocation getColonLoc() const
Represents a C array with an unspecified size.
TemplateArgumentLocInfo getLocInfo() const
SourceLocation getEllipsisLoc() const
For a pack expansion, determine the location of the ellipsis.
SourceLocation getAttrLoc() const
static CXXTemporary * Create(const ASTContext &C, const CXXDestructorDecl *Destructor)
BinaryConditionalOperator - The GNU extension to the conditional operator which allows the middle ope...
CXXCatchStmt - This represents a C++ catch block.
SourceLocation getRParenLoc() const
ExpectedStmt VisitCXXMemberCallExpr(CXXMemberCallExpr *E)
unsigned getNumNegativeBits() const
Returns the width in bits required to store all the negative enumerators of this enum.
ObjCIvarDecl - Represents an ObjC instance variable.
ObjCIvarDecl * getPropertyIvarDecl() const
Provides information a specialization of a member of a class template, which may be a member function...
QualType getNamedType() const
Retrieve the type named by the qualified-id.
WhileStmt - This represents a 'while' stmt.
A structure for storing the information associated with an overloaded template name.
static StructuralEquivalenceKind getStructuralEquivalenceKind(const ASTImporter &Importer)
SourceRange getParenOrBraceRange() const
ClassTemplatePartialSpecializationDecl * findPartialSpecialization(ArrayRef< TemplateArgument > Args, void *&InsertPos)
Return the partial specialization with the provided arguments if it exists, otherwise return the inse...
ExpectedType VisitPackExpansionType(const PackExpansionType *T)
ExpectedStmt VisitSizeOfPackExpr(SizeOfPackExpr *E)
unsigned getNumConcatenated() const
getNumConcatenated - Get the number of string literal tokens that were concatenated in translation ph...
bool isNull() const
Determine whether this is the empty selector.
QualType getReplacementType() const
Gets the type that was substituted for the template parameter.
Location information for a TemplateArgument.
bool containsUnexpandedParameterPack() const
Whether this expression contains an unexpanded parameter pack (for C++11 variadic templates)...
Declaration of a class template.
SourceLocation getAtSynchronizedLoc() const
Stores a list of Objective-C type parameters for a parameterized class or a category/extension thereo...
This class is used for builtin types like 'int'.
Optional< unsigned > getNumExpansions() const
Determine the number of expansions that will be produced when this pack expansion is instantiated...
CompoundStmt * getTryBlock()
SourceLocation getBreakLoc() const
ExpectedDecl VisitFunctionDecl(FunctionDecl *D)
SourceLocation getCaseLoc() const
capture_range captures() const
Retrieve this lambda's captures.
void setPropertyAttributes(PropertyAttributeKind PRVal)
Represents Objective-C's @try ... @catch ... @finally statement.
protocol_iterator protocol_end() const
bool isGlobalDelete() const
SourceLocation getLocation() const
Retrieve the source location of the capture.
unsigned getNumCatchStmts() const
Retrieve the number of @catch statements in this try-catch-finally block.
Expr * getBase() const
Retrieve the base object of this member expressions, e.g., the x in x.m.
StringLiteral - This represents a string literal expression, e.g.
bool hasExplicitParameters() const
Determine whether this lambda has an explicit parameter list vs.
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Expected< TemplateArgument > ImportTemplateArgument(const TemplateArgument &From)
ExpectedStmt VisitStmtExpr(StmtExpr *E)
ExpectedDecl VisitFriendDecl(FriendDecl *D)
SourceRange getTypeIdParens() const
QualType getIntegerType() const
Return the integer type this enum decl corresponds to.
Expr * getPattern()
Retrieve the pattern of the pack expansion.
bool doesThisDeclarationHaveABody() const
Returns whether this specific declaration of the function has a body.
void setDescribedFunctionTemplate(FunctionTemplateDecl *Template)
ExpectedDecl VisitObjCTypeParamDecl(ObjCTypeParamDecl *D)
Import only the bare bones needed to establish a valid DeclContext.
SourceLocation getEllipsisLoc() const
Get the location of the ellipsis if this is a pack expansion.
Abstract class common to all of the C++ "named"/"keyword" casts.
unsigned getNumElements() const
SourceLocation getRAngleLoc() const
Retrieve the location of the right angle bracket ending the explicit template argument list following...
ExpectedDecl VisitUsingDirectiveDecl(UsingDirectiveDecl *D)
void setNextSwitchCase(SwitchCase *SC)
decl_type * getMostRecentDecl()
Returns the most recent (re)declaration of this declaration.
The top declaration context.
unsigned getNumComponents() const
const ParmVarDecl * getParam() const
QualType getAsType() const
Retrieve the type for a type template argument.
A reference to a declared variable, function, enum, etc.
Represents a type template specialization; the template must be a class template, a type alias templa...
ObjCPropertyDecl * getPropertyDecl() const
ObjCTypeParamVariance getVariance() const
Determine the variance of this type parameter.
NestedNameSpecifierLoc getQualifierLoc() const
Fetches the nested-name qualifier with source-location information, if one was given.
BreakStmt - This represents a break.
TemplatedKind getTemplatedKind() const
What kind of templated function this is.
void Extend(ASTContext &Context, SourceLocation TemplateKWLoc, TypeLoc TL, SourceLocation ColonColonLoc)
Extend the current nested-name-specifier by another nested-name-specifier component of the form 'type...
std::string toString() const
ExpectedStmt VisitCaseStmt(CaseStmt *S)
SourceLocation getUsingLoc() const
Returns the source location of the 'using' keyword.
const VarDecl * getCatchParamDecl() const
ExpectedType VisitMemberPointerType(const MemberPointerType *T)
ExpectedType VisitTemplateTypeParmType(const TemplateTypeParmType *T)
SourceLocation getLocation() const
void setObjCDeclQualifier(ObjCDeclQualifier QTVal)
FieldDecl * getInitializedFieldInUnion()
If this initializes a union, specifies which field in the union to initialize.
SourceLocation getTemplateKeywordLoc() const
Retrieve the location of the template keyword preceding the member name, if any.
DefinitionKind isThisDeclarationADefinition(ASTContext &) const
Check whether this declaration is a definition.
bool hadMultipleCandidates() const
Whether the referred constructor was resolved from an overloaded set having size greater than 1...
NamespaceDecl * getAnonymousNamespace() const
Retrieve the anonymous namespace nested inside this namespace, if any.
SourceLocation getNamespaceLoc() const
Returns the location of the namespace keyword.
static DeclarationName getUsingDirectiveName()
Returns the name for all C++ using-directives.
DeclStmt * getLoopVarStmt()
IdentifierInfo * getCXXLiteralIdentifier() const
If this name is the name of a literal operator, retrieve the identifier associated with it...
AccessSpecifier getAccessSpecifierAsWritten() const
Retrieves the access specifier as written in the source code (which may mean that no access specifier...
TemplateArgument getArgumentPack() const
Retrieve the template template argument pack with which this parameter was substituted.
unsigned getNumArgs() const
Return the number of arguments to the constructor call.
protocol_loc_iterator protocol_loc_begin() const
Error ImportDeclParts(NamedDecl *D, DeclContext *&DC, DeclContext *&LexicalDC, DeclarationName &Name, NamedDecl *&ToD, SourceLocation &Loc)
A set of overloaded template declarations.
Error ImportDeclarationNameLoc(const DeclarationNameInfo &From, DeclarationNameInfo &To)
A trivial tuple used to represent a source range.
void setLexicalDeclContext(DeclContext *DC)
ObjCMethodDecl * getGetterMethodDecl() const
This represents a decl that may have a name.
SourceLocation getTemplateKeywordLoc() const
Retrieve the location of the template keyword preceding the member name, if any.
A boolean literal, per ([C++ lex.bool] Boolean literals).
ExpectedStmt VisitObjCAtThrowStmt(ObjCAtThrowStmt *S)
OffsetOfExpr - [C99 7.17] - This represents an expression of the form offsetof(record-type, member-designator).
protocol_loc_iterator protocol_loc_begin() const
void setAccess(AccessSpecifier AS)
Represents a C array with a specified size that is not an integer-constant-expression.
Expr * getQueriedExpression() const
Represents a C++ namespace alias.
SourceLocation getBuiltinLoc() const
SourceRange getSourceRange() const LLVM_READONLY
Retrieves the source range that contains the entire base specifier.
TemplateName getAsTemplate() const
Retrieve the template name for a template name argument.
AccessControl getAccessControl() const
SourceLocation getIvarRBraceLoc() const
Expr * getCommon() const
getCommon - Return the common expression, written to the left of the condition.
bool isPropertyAccessor() const
TypeSourceInfo * getWrittenTypeInfo() const
Selector getGetterName() const
ImplicitParamKind getParameterKind() const
Returns the implicit parameter kind.
Represents C++ using-directive.
DeclStmt * getBeginStmt()
SourceLocation getLParenLoc() const
SourceLocation getPointOfInstantiation() const
Retrieve the first point of instantiation of this member.
ExpectedType VisitDependentNameType(const DependentNameType *T)
void setTypeAsWritten(TypeSourceInfo *T)
Sets the type of this specialization as it was written by the user.
SourceLocation getPointOfInstantiation() const
Get the point of instantiation (if any), or null if none.
void setPointOfInstantiation(SourceLocation POI)
Set the first point of instantiation.
The global specifier '::'. There is no stored value.
ObjCProtocolList::iterator protocol_iterator
TemplateName getAsTemplateOrTemplatePattern() const
Retrieve the template argument as a template name; if the argument is a pack expansion, return the pattern as a template name.
ExpectedStmt VisitCXXTryStmt(CXXTryStmt *S)
void setType(QualType newType)
SourceLocation getBegin() const
TranslationUnitDecl * getTranslationUnitDecl()
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
Get the template arguments as written.
SourceLocation getRParenLoc() const
Return the location of the right parentheses.
ExpectedStmt VisitMemberExpr(MemberExpr *E)
SourceLocation getInnerLocStart() const
Return start of source range ignoring outer template declarations.
NamedDecl * getPack() const
Retrieve the parameter pack.
Represents Objective-C's @autoreleasepool Statement.
ExpectedDecl VisitTypedefNameDecl(TypedefNameDecl *D, bool IsAlias)
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration...
IdentifierInfo * getFieldName() const
This class handles loading and caching of source files into memory.
Represents the canonical version of C arrays with a specified constant size.
ExceptionSpecInfo ExceptionSpec
InitListExpr * getSyntacticForm() const
Declaration of a template function.
void setPropertyIvarDecl(ObjCIvarDecl *Ivar)
Represents an implicitly-generated value initialization of an object of a given type.
static ObjCAtTryStmt * Create(const ASTContext &Context, SourceLocation atTryLoc, Stmt *atTryStmt, Stmt **CatchStmts, unsigned NumCatchStmts, Stmt *atFinallyStmt)
SourceLocation getReturnLoc() const
TemplateName getQualifiedTemplateName(NestedNameSpecifier *NNS, bool TemplateKeyword, TemplateDecl *Template) const
Retrieve the template name that represents a qualified template name such as std::vector.
Attr - This represents one attribute.
SourceLocation getLocation() const
QualType getPointeeType() const
Represents a shadow declaration introduced into a scope by a (resolved) using declaration.
ExpectedType VisitDecltypeType(const DecltypeType *T)
QualType getType() const
Return the type wrapped by this type source info.
TypeTrait getTrait() const
Determine which type trait this expression uses.
A single template declaration.
bool isBeingDefined() const
Return true if this decl is currently being defined.
SourceLocation getOperatorLoc() const
ExpectedDecl VisitUsingShadowDecl(UsingShadowDecl *D)
std::pair< FileID, unsigned > getDecomposedLoc(SourceLocation Loc) const
Decompose the specified location into a raw FileID + Offset pair.
Defines the LambdaCapture class.
const DeclarationNameInfo & getMemberNameInfo() const
Retrieve the name of the member that this expression refers to.
ArrayRef< ParmVarDecl * > parameters() const
EvaluatedStmt * ensureEvaluatedStmt() const
Convert the initializer for this declaration to the elaborated EvaluatedStmt form, which contains extra information on the evaluated value of the initializer.
const IdentifierInfo * getIdentifier() const
static OMPLinearClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, OpenMPLinearClauseKind Modifier, SourceLocation ModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef< Expr *> VL, ArrayRef< Expr *> PL, ArrayRef< Expr *> IL, Expr *Step, Expr *CalcStep, Stmt *PreInit, Expr *PostUpdate)
Creates clause with a list of variables VL and a linear step Step.
bool hasExternalFormalLinkage() const
True if this decl has external linkage.
ConstructionKind getConstructionKind() const
Determine whether this constructor is actually constructing a base class (rather than a complete obje...
ObjCCategoryDecl * FindCategoryDeclaration(IdentifierInfo *CategoryId) const
FindCategoryDeclaration - Finds category declaration in the list of categories for this class and ret...
ExpectedType VisitBlockPointerType(const BlockPointerType *T)
Structure used to store a statement, the constant value to which it was evaluated (if any)...
QualType getPointeeType() const
Gets the type pointed to by this ObjC pointer.
method_range methods() const
static NestedNameSpecifier * GlobalSpecifier(const ASTContext &Context)
Returns the nested name specifier representing the global scope.
bool isOverloaded() const
True if this lookup is overloaded.
void notePriorDiagnosticFrom(const DiagnosticsEngine &Other)
Note that the prior diagnostic was emitted by some other DiagnosticsEngine, and we may be attaching a...