55 #include "llvm/ADT/APSInt.h" 56 #include "llvm/ADT/ArrayRef.h" 57 #include "llvm/ADT/DenseMap.h" 58 #include "llvm/ADT/None.h" 59 #include "llvm/ADT/Optional.h" 60 #include "llvm/ADT/ScopeExit.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");
140 public StmtVisitor<ASTNodeImporter, ExpectedStmt> {
144 template <
typename ImportT>
145 LLVM_NODISCARD
Error importInto(ImportT &To,
const ImportT &From) {
150 template <
typename ImportT>
151 LLVM_NODISCARD
Error importInto(ImportT *&To, ImportT *From) {
152 auto ToOrErr = Importer.
Import(From);
154 To = cast_or_null<ImportT>(*ToOrErr);
155 return ToOrErr.takeError();
160 template <
typename T>
162 auto ToOrErr = Importer.
Import(From);
164 return ToOrErr.takeError();
165 return cast_or_null<T>(*ToOrErr);
168 template <
typename T>
170 return import(
const_cast<T *
>(From));
174 template <
typename T>
176 return Importer.
Import(From);
184 return import(*From);
189 importSeq(
const T &From) {
192 return ToOrErr.takeError();
193 return std::make_tuple<T>(std::move(*ToOrErr));
200 template <
class THead,
class... TTail>
201 Expected<std::tuple<THead, TTail...>>
202 importSeq(
const THead &FromHead,
const TTail &...FromTail) {
205 return ToHeadOrErr.takeError();
206 Expected<std::tuple<TTail...>> ToTailOrErr = importSeq(FromTail...);
208 return ToTailOrErr.takeError();
209 return std::tuple_cat(*ToHeadOrErr, *ToTailOrErr);
213 template <
typename ToDeclT>
struct CallOverloadedCreateFun {
214 template <
typename... Args>
215 auto operator()(Args &&... args)
227 template <
typename ToDeclT,
typename FromDeclT,
typename... Args>
228 LLVM_NODISCARD
bool GetImportedOrCreateDecl(ToDeclT *&ToD, FromDeclT *FromD,
233 CallOverloadedCreateFun<ToDeclT> OC;
234 return GetImportedOrCreateSpecialDecl(ToD, OC, FromD,
235 std::forward<Args>(args)...);
242 template <
typename NewDeclT,
typename ToDeclT,
typename FromDeclT,
244 LLVM_NODISCARD
bool GetImportedOrCreateDecl(ToDeclT *&ToD, FromDeclT *FromD,
246 CallOverloadedCreateFun<NewDeclT> OC;
247 return GetImportedOrCreateSpecialDecl(ToD, OC, FromD,
248 std::forward<Args>(args)...);
252 template <
typename ToDeclT,
typename CreateFunT,
typename FromDeclT,
255 GetImportedOrCreateSpecialDecl(ToDeclT *&ToD, CreateFunT CreateFun,
256 FromDeclT *FromD, Args &&... args) {
264 ToD = CreateFun(std::forward<Args>(args)...);
267 InitializeImportedDecl(FromD, ToD);
271 void InitializeImportedDecl(
Decl *FromD,
Decl *ToD) {
277 auto ToAttrOrErr =
import(FromAttr);
281 llvm::consumeError(ToAttrOrErr.takeError());
294 FoundFunction->
hasBody(Definition))
295 return Importer.
MapImported(D, const_cast<FunctionDecl *>(Definition));
355 Error ImportDeclParts(
358 Error ImportDefinitionIfNeeded(
Decl *FromD,
Decl *ToD =
nullptr);
359 Error ImportDeclarationNameLoc(
362 Error ImportDeclContext(
384 return IDK == IDK_Everything ||
389 Error ImportDefinition(
392 Error ImportDefinition(
395 Error ImportDefinition(
398 Error ImportDefinition(
401 Error ImportTemplateArguments(
407 template <
typename InContainerTy>
408 Error ImportTemplateArgumentListInfo(
411 template<
typename InContainerTy>
412 Error ImportTemplateArgumentListInfo(
418 std::tuple<FunctionTemplateDecl *, TemplateArgsTy>;
420 ImportFunctionTemplateWithTemplateArgsFromSpecialization(
429 template <
typename T>
430 bool hasSameVisibilityContext(T *Found, T *From);
432 bool IsStructuralMatch(
Decl *From,
Decl *To,
bool Complain);
434 bool Complain =
true);
436 bool Complain =
true);
610 template<
typename IIter,
typename OIter>
613 for (; Ibegin != Iend; ++Ibegin, ++Obegin) {
616 return ToOrErr.takeError();
619 return Error::success();
626 template<
typename InContainerTy,
typename OutContainerTy>
628 const InContainerTy &InContainer, OutContainerTy &OutContainer) {
629 return ImportArrayChecked(
630 InContainer.begin(), InContainer.end(), OutContainer.begin());
633 template<
typename InContainerTy,
typename OIter>
635 return ImportArrayChecked(InContainer.begin(), InContainer.end(), Obegin);
644 template <
typename InContainerTy>
648 auto ToLAngleLocOrErr =
import(FromLAngleLoc);
649 if (!ToLAngleLocOrErr)
650 return ToLAngleLocOrErr.takeError();
651 auto ToRAngleLocOrErr =
import(FromRAngleLoc);
652 if (!ToRAngleLocOrErr)
653 return ToRAngleLocOrErr.takeError();
656 if (
auto Err = ImportTemplateArgumentListInfo(Container, ToTAInfo))
659 return Error::success();
663 Error ASTNodeImporter::ImportTemplateArgumentListInfo<TemplateArgumentListInfo>(
665 return ImportTemplateArgumentListInfo(
666 From.getLAngleLoc(), From.getRAngleLoc(), From.arguments(),
Result);
674 return ImportTemplateArgumentListInfo(
675 From.LAngleLoc, From.RAngleLoc, From.arguments(),
Result);
687 if (
Error Err = importInto(std::get<0>(Result), FTSInfo->getTemplate()))
688 return std::move(Err);
691 auto TemplArgs = FTSInfo->TemplateArguments->asArray();
692 if (
Error Err = ImportTemplateArguments(TemplArgs.data(), TemplArgs.size(),
694 return std::move(Err);
703 if (
Error Err = ImportContainerChecked(*From, To))
704 return std::move(Err);
707 if (!ToRequiresClause)
708 return ToRequiresClause.takeError();
711 if (!ToTemplateLocOrErr)
712 return ToTemplateLocOrErr.takeError();
714 if (!ToLAngleLocOrErr)
715 return ToLAngleLocOrErr.takeError();
717 if (!ToRAngleLocOrErr)
718 return ToRAngleLocOrErr.takeError();
721 Importer.getToContext(),
739 return ToTypeOrErr.takeError();
746 return ToTypeOrErr.takeError();
753 return ToOrErr.takeError();
756 return ToTypeOrErr.takeError();
763 return ToTypeOrErr.takeError();
769 if (!ToTemplateOrErr)
770 return ToTemplateOrErr.takeError();
778 if (!ToTemplateOrErr)
779 return ToTemplateOrErr.takeError();
789 return ToExpr.takeError();
794 if (
Error Err = ImportTemplateArguments(
796 return std::move(Err);
799 llvm::makeArrayRef(ToPack).copy(Importer.getToContext()));
803 llvm_unreachable(
"Invalid template argument kind");
811 return ArgOrErr.takeError();
820 return E.takeError();
826 return TSIOrErr.takeError();
828 auto ToTemplateQualifierLocOrErr =
830 if (!ToTemplateQualifierLocOrErr)
831 return ToTemplateQualifierLocOrErr.takeError();
833 if (!ToTemplateNameLocOrErr)
834 return ToTemplateNameLocOrErr.takeError();
835 auto ToTemplateEllipsisLocOrErr =
837 if (!ToTemplateEllipsisLocOrErr)
838 return ToTemplateEllipsisLocOrErr.takeError();
841 *ToTemplateQualifierLocOrErr,
842 *ToTemplateNameLocOrErr,
843 *ToTemplateEllipsisLocOrErr);
853 size_t NumDecls = DG.
end() - DG.
begin();
855 ToDecls.reserve(NumDecls);
856 for (
Decl *FromD : DG) {
857 if (
auto ToDOrErr =
import(FromD))
858 ToDecls.push_back(*ToDOrErr);
860 return ToDOrErr.takeError();
875 return ToDotLocOrErr.takeError();
878 if (!ToFieldLocOrErr)
879 return ToFieldLocOrErr.takeError();
881 return Designator(ToFieldName, *ToDotLocOrErr, *ToFieldLocOrErr);
885 if (!ToLBracketLocOrErr)
886 return ToLBracketLocOrErr.takeError();
889 if (!ToRBracketLocOrErr)
890 return ToRBracketLocOrErr.takeError();
894 *ToLBracketLocOrErr, *ToRBracketLocOrErr);
897 if (!ToEllipsisLocOrErr)
898 return ToEllipsisLocOrErr.takeError();
903 *ToRBracketLocOrErr);
913 return VarOrErr.takeError();
918 return LocationOrErr.takeError();
923 return std::move(Err);
936 using namespace clang;
939 Importer.FromDiag(
SourceLocation(), diag::err_unsupported_ast_node)
946 if (!UnderlyingTypeOrErr)
947 return UnderlyingTypeOrErr.takeError();
949 return Importer.getToContext().getAtomicType(*UnderlyingTypeOrErr);
954 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ 955 case BuiltinType::Id: \ 956 return Importer.getToContext().SingletonId; 957 #include "clang/Basic/OpenCLImageTypes.def" 958 #define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \ 959 case BuiltinType::Id: \ 960 return Importer.getToContext().Id##Ty; 961 #include "clang/Basic/OpenCLExtensionTypes.def" 962 #define SHARED_SINGLETON_TYPE(Expansion) 963 #define BUILTIN_TYPE(Id, SingletonId) \ 964 case BuiltinType::Id: return Importer.getToContext().SingletonId; 965 #include "clang/AST/BuiltinTypes.def" 973 case BuiltinType::Char_U:
977 if (Importer.getToContext().getLangOpts().CharIsSigned)
978 return Importer.getToContext().UnsignedCharTy;
980 return Importer.getToContext().CharTy;
982 case BuiltinType::Char_S:
986 if (!Importer.getToContext().getLangOpts().CharIsSigned)
987 return Importer.getToContext().SignedCharTy;
989 return Importer.getToContext().CharTy;
991 case BuiltinType::WChar_S:
992 case BuiltinType::WChar_U:
995 return Importer.getToContext().WCharTy;
998 llvm_unreachable(
"Invalid BuiltinType Kind!");
1003 if (!ToOriginalTypeOrErr)
1004 return ToOriginalTypeOrErr.takeError();
1006 return Importer.getToContext().getDecayedType(*ToOriginalTypeOrErr);
1011 if (!ToElementTypeOrErr)
1012 return ToElementTypeOrErr.takeError();
1014 return Importer.getToContext().getComplexType(*ToElementTypeOrErr);
1019 if (!ToPointeeTypeOrErr)
1020 return ToPointeeTypeOrErr.takeError();
1022 return Importer.getToContext().getPointerType(*ToPointeeTypeOrErr);
1028 if (!ToPointeeTypeOrErr)
1029 return ToPointeeTypeOrErr.takeError();
1031 return Importer.getToContext().getBlockPointerType(*ToPointeeTypeOrErr);
1038 if (!ToPointeeTypeOrErr)
1039 return ToPointeeTypeOrErr.takeError();
1041 return Importer.getToContext().getLValueReferenceType(*ToPointeeTypeOrErr);
1048 if (!ToPointeeTypeOrErr)
1049 return ToPointeeTypeOrErr.takeError();
1051 return Importer.getToContext().getRValueReferenceType(*ToPointeeTypeOrErr);
1058 if (!ToPointeeTypeOrErr)
1059 return ToPointeeTypeOrErr.takeError();
1062 if (!ClassTypeOrErr)
1063 return ClassTypeOrErr.takeError();
1065 return Importer.getToContext().getMemberPointerType(
1066 *ToPointeeTypeOrErr, (*ClassTypeOrErr).getTypePtr());
1072 if (!ToElementTypeOrErr)
1073 return ToElementTypeOrErr.takeError();
1075 return Importer.getToContext().getConstantArrayType(*ToElementTypeOrErr,
1084 if (!ToElementTypeOrErr)
1085 return ToElementTypeOrErr.takeError();
1087 return Importer.getToContext().getIncompleteArrayType(*ToElementTypeOrErr,
1097 if (
auto Imp = importSeq(
1099 std::tie(ToElementType, ToSizeExpr, ToBracketsRange) = *Imp;
1101 return Imp.takeError();
1103 return Importer.getToContext().getVariableArrayType(
1113 if (
auto Imp = importSeq(
1115 std::tie(ToElementType, ToSizeExpr, ToBracketsRange) = *Imp;
1117 return Imp.takeError();
1121 return Importer.getToContext().getDependentSizedArrayType(
1128 if (!ToElementTypeOrErr)
1129 return ToElementTypeOrErr.takeError();
1131 return Importer.getToContext().getVectorType(*ToElementTypeOrErr,
1138 if (!ToElementTypeOrErr)
1139 return ToElementTypeOrErr.takeError();
1141 return Importer.getToContext().getExtVectorType(*ToElementTypeOrErr,
1150 if (!ToReturnTypeOrErr)
1151 return ToReturnTypeOrErr.takeError();
1153 return Importer.getToContext().getFunctionNoProtoType(*ToReturnTypeOrErr,
1160 if (!ToReturnTypeOrErr)
1161 return ToReturnTypeOrErr.takeError();
1168 return TyOrErr.takeError();
1169 ArgTypes.push_back(*TyOrErr);
1177 return TyOrErr.takeError();
1178 ExceptionTypes.push_back(*TyOrErr);
1184 auto Imp = importSeq(
1189 return Imp.takeError();
1203 return Importer.getToContext().getFunctionType(
1204 *ToReturnTypeOrErr, ArgTypes, ToEPI);
1212 std::tie(ToD, ToPrevD) = *Imp;
1214 return Imp.takeError();
1216 return Importer.getToContext().getTypeDeclType(
1217 ToD, cast_or_null<TypeDecl>(ToPrevD));
1222 if (!ToInnerTypeOrErr)
1223 return ToInnerTypeOrErr.takeError();
1225 return Importer.getToContext().getParenType(*ToInnerTypeOrErr);
1231 return ToDeclOrErr.takeError();
1233 return Importer.getToContext().getTypeDeclType(*ToDeclOrErr);
1239 return ToExprOrErr.takeError();
1241 return Importer.getToContext().getTypeOfExprType(*ToExprOrErr);
1246 if (!ToUnderlyingTypeOrErr)
1247 return ToUnderlyingTypeOrErr.takeError();
1249 return Importer.getToContext().getTypeOfType(*ToUnderlyingTypeOrErr);
1256 return ToExprOrErr.takeError();
1259 if (!ToUnderlyingTypeOrErr)
1260 return ToUnderlyingTypeOrErr.takeError();
1262 return Importer.getToContext().getDecltypeType(
1263 *ToExprOrErr, *ToUnderlyingTypeOrErr);
1269 if (!ToBaseTypeOrErr)
1270 return ToBaseTypeOrErr.takeError();
1273 if (!ToUnderlyingTypeOrErr)
1274 return ToUnderlyingTypeOrErr.takeError();
1276 return Importer.getToContext().getUnaryTransformType(
1277 *ToBaseTypeOrErr, *ToUnderlyingTypeOrErr, T->
getUTTKind());
1283 if (!ToDeducedTypeOrErr)
1284 return ToDeducedTypeOrErr.takeError();
1286 return Importer.getToContext().getAutoType(*ToDeducedTypeOrErr,
1295 return ToDeclOrErr.takeError();
1298 if (!ToInjTypeOrErr)
1299 return ToInjTypeOrErr.takeError();
1316 return ToDeclOrErr.takeError();
1318 return Importer.getToContext().getTagDeclType(*ToDeclOrErr);
1324 return ToDeclOrErr.takeError();
1326 return Importer.getToContext().getTagDeclType(*ToDeclOrErr);
1331 if (!ToModifiedTypeOrErr)
1332 return ToModifiedTypeOrErr.takeError();
1334 if (!ToEquivalentTypeOrErr)
1335 return ToEquivalentTypeOrErr.takeError();
1337 return Importer.getToContext().getAttributedType(T->
getAttrKind(),
1338 *ToModifiedTypeOrErr, *ToEquivalentTypeOrErr);
1345 return ToDeclOrErr.takeError();
1347 return Importer.getToContext().getTemplateTypeParmType(
1355 return ReplacedOrErr.takeError();
1357 cast<TemplateTypeParmType>((*ReplacedOrErr).getTypePtr());
1360 if (!ToReplacementTypeOrErr)
1361 return ToReplacementTypeOrErr.takeError();
1363 return Importer.getToContext().getSubstTemplateTypeParmType(
1364 Replaced, (*ToReplacementTypeOrErr).getCanonicalType());
1370 if (!ToTemplateOrErr)
1371 return ToTemplateOrErr.takeError();
1374 if (
Error Err = ImportTemplateArguments(
1376 return std::move(Err);
1379 if (!
QualType(T, 0).isCanonical()) {
1383 ToCanonType = *TyOrErr;
1385 return TyOrErr.takeError();
1387 return Importer.getToContext().getTemplateSpecializationType(*ToTemplateOrErr,
1395 if (!ToQualifierOrErr)
1396 return ToQualifierOrErr.takeError();
1399 if (!ToNamedTypeOrErr)
1400 return ToNamedTypeOrErr.takeError();
1403 if (!ToOwnedTagDeclOrErr)
1404 return ToOwnedTagDeclOrErr.takeError();
1406 return Importer.getToContext().getElaboratedType(T->
getKeyword(),
1409 *ToOwnedTagDeclOrErr);
1415 if (!ToPatternOrErr)
1416 return ToPatternOrErr.takeError();
1418 return Importer.getToContext().getPackExpansionType(*ToPatternOrErr,
1425 if (!ToQualifierOrErr)
1426 return ToQualifierOrErr.takeError();
1432 if (
Error Err = ImportTemplateArguments(
1434 return std::move(Err);
1436 return Importer.getToContext().getDependentTemplateSpecializationType(
1437 T->
getKeyword(), *ToQualifierOrErr, ToName, ToPack);
1443 if (!ToQualifierOrErr)
1444 return ToQualifierOrErr.takeError();
1453 return TyOrErr.takeError();
1456 return Importer.getToContext().getDependentNameType(T->
getKeyword(),
1465 return ToDeclOrErr.takeError();
1467 return Importer.getToContext().getObjCInterfaceType(*ToDeclOrErr);
1472 if (!ToBaseTypeOrErr)
1473 return ToBaseTypeOrErr.takeError();
1478 TypeArgs.push_back(*TyOrErr);
1480 return TyOrErr.takeError();
1484 for (
auto *
P : T->
quals()) {
1486 Protocols.push_back(*ProtocolOrErr);
1488 return ProtocolOrErr.takeError();
1492 return Importer.getToContext().getObjCObjectType(*ToBaseTypeOrErr, TypeArgs,
1500 if (!ToPointeeTypeOrErr)
1501 return ToPointeeTypeOrErr.takeError();
1503 return Importer.getToContext().getObjCObjectPointerType(*ToPointeeTypeOrErr);
1516 if (isa<RecordDecl>(D) && (FunDecl = dyn_cast<FunctionDecl>(OrigDC)) &&
1518 auto getLeafPointeeType = [](
const Type *T) {
1519 while (T->isPointerType() || T->isArrayType()) {
1520 T = T->getPointeeOrArrayElementType();
1526 getLeafPointeeType(
P->getType().getCanonicalType().getTypePtr());
1528 if (RT && RT->getDecl() == D) {
1529 Importer.FromDiag(D->
getLocation(), diag::err_unsupported_ast_node)
1537 if (
Error Err = ImportDeclContext(D, DC, LexicalDC))
1548 ToD = cast_or_null<NamedDecl>(Importer.GetAlreadyImportedOrNull(D));
1553 return Error::success();
1558 return Error::success();
1561 if (
Error Err = importInto(ToD, FromD))
1564 if (
RecordDecl *FromRecord = dyn_cast<RecordDecl>(FromD)) {
1565 if (
RecordDecl *ToRecord = cast<RecordDecl>(ToD)) {
1566 if (FromRecord->getDefinition() && FromRecord->isCompleteDefinition() &&
1567 !ToRecord->getDefinition()) {
1568 if (
Error Err = ImportDefinition(FromRecord, ToRecord))
1572 return Error::success();
1575 if (
EnumDecl *FromEnum = dyn_cast<EnumDecl>(FromD)) {
1576 if (
EnumDecl *ToEnum = cast<EnumDecl>(ToD)) {
1577 if (FromEnum->getDefinition() && !ToEnum->getDefinition()) {
1578 if (
Error Err = ImportDefinition(FromEnum, ToEnum))
1582 return Error::success();
1585 return Error::success();
1600 return Error::success();
1606 return ToRangeOrErr.takeError();
1607 return Error::success();
1613 return LocOrErr.takeError();
1614 return Error::success();
1622 return ToTInfoOrErr.takeError();
1623 return Error::success();
1626 llvm_unreachable(
"Unknown name kind.");
1631 if (Importer.isMinimalImport() && !ForceImport) {
1632 auto ToDCOrErr = Importer.ImportContext(FromDC);
1633 return ToDCOrErr.takeError();
1645 bool AccumulateChildErrors = isa<TagDecl>(FromDC);
1647 Error ChildErrors = Error::success();
1649 for (
auto *From : FromDC->
decls()) {
1651 if (!ImportedOrErr) {
1652 if (AccumulateChildErrors)
1654 joinErrors(std::move(ChildErrors), ImportedOrErr.takeError());
1656 consumeError(ImportedOrErr.takeError());
1665 auto ToDCOrErr = Importer.ImportContext(FromD->
getDeclContext());
1667 return ToDCOrErr.takeError();
1671 auto ToLexicalDCOrErr = Importer.ImportContext(
1673 if (!ToLexicalDCOrErr)
1674 return ToLexicalDCOrErr.takeError();
1675 ToLexicalDC = *ToLexicalDCOrErr;
1679 return Error::success();
1685 "Import implicit methods to or from non-definition");
1688 if (FromM->isImplicit()) {
1691 return ToMOrErr.takeError();
1694 return Error::success();
1703 return ToTypedefOrErr.takeError();
1705 return Error::success();
1710 auto DefinitionCompleter = [To]() {
1722 if (Kind == IDK_Everything ||
1727 (To->
isLambda() && shouldForceImportDeclContext(Kind))) {
1731 DefinitionCompleter();
1735 return Error::success();
1742 auto DefinitionCompleterScopeExit =
1743 llvm::make_scope_exit(DefinitionCompleter);
1751 if (ToCXX && FromCXX && ToCXX->dataPtr() && FromCXX->dataPtr()) {
1753 struct CXXRecordDecl::DefinitionData &ToData = ToCXX->data();
1754 struct CXXRecordDecl::DefinitionData &FromData = FromCXX->data();
1755 ToData.UserDeclaredConstructor = FromData.UserDeclaredConstructor;
1756 ToData.UserDeclaredSpecialMembers = FromData.UserDeclaredSpecialMembers;
1757 ToData.Aggregate = FromData.Aggregate;
1758 ToData.PlainOldData = FromData.PlainOldData;
1759 ToData.Empty = FromData.Empty;
1760 ToData.Polymorphic = FromData.Polymorphic;
1761 ToData.Abstract = FromData.Abstract;
1762 ToData.IsStandardLayout = FromData.IsStandardLayout;
1763 ToData.IsCXX11StandardLayout = FromData.IsCXX11StandardLayout;
1764 ToData.HasBasesWithFields = FromData.HasBasesWithFields;
1765 ToData.HasBasesWithNonStaticDataMembers =
1766 FromData.HasBasesWithNonStaticDataMembers;
1767 ToData.HasPrivateFields = FromData.HasPrivateFields;
1768 ToData.HasProtectedFields = FromData.HasProtectedFields;
1769 ToData.HasPublicFields = FromData.HasPublicFields;
1770 ToData.HasMutableFields = FromData.HasMutableFields;
1771 ToData.HasVariantMembers = FromData.HasVariantMembers;
1772 ToData.HasOnlyCMembers = FromData.HasOnlyCMembers;
1773 ToData.HasInClassInitializer = FromData.HasInClassInitializer;
1774 ToData.HasUninitializedReferenceMember
1775 = FromData.HasUninitializedReferenceMember;
1776 ToData.HasUninitializedFields = FromData.HasUninitializedFields;
1777 ToData.HasInheritedConstructor = FromData.HasInheritedConstructor;
1778 ToData.HasInheritedAssignment = FromData.HasInheritedAssignment;
1779 ToData.NeedOverloadResolutionForCopyConstructor
1780 = FromData.NeedOverloadResolutionForCopyConstructor;
1781 ToData.NeedOverloadResolutionForMoveConstructor
1782 = FromData.NeedOverloadResolutionForMoveConstructor;
1783 ToData.NeedOverloadResolutionForMoveAssignment
1784 = FromData.NeedOverloadResolutionForMoveAssignment;
1785 ToData.NeedOverloadResolutionForDestructor
1786 = FromData.NeedOverloadResolutionForDestructor;
1787 ToData.DefaultedCopyConstructorIsDeleted
1788 = FromData.DefaultedCopyConstructorIsDeleted;
1789 ToData.DefaultedMoveConstructorIsDeleted
1790 = FromData.DefaultedMoveConstructorIsDeleted;
1791 ToData.DefaultedMoveAssignmentIsDeleted
1792 = FromData.DefaultedMoveAssignmentIsDeleted;
1793 ToData.DefaultedDestructorIsDeleted = FromData.DefaultedDestructorIsDeleted;
1794 ToData.HasTrivialSpecialMembers = FromData.HasTrivialSpecialMembers;
1795 ToData.HasIrrelevantDestructor = FromData.HasIrrelevantDestructor;
1796 ToData.HasConstexprNonCopyMoveConstructor
1797 = FromData.HasConstexprNonCopyMoveConstructor;
1798 ToData.HasDefaultedDefaultConstructor
1799 = FromData.HasDefaultedDefaultConstructor;
1800 ToData.DefaultedDefaultConstructorIsConstexpr
1801 = FromData.DefaultedDefaultConstructorIsConstexpr;
1802 ToData.HasConstexprDefaultConstructor
1803 = FromData.HasConstexprDefaultConstructor;
1804 ToData.HasNonLiteralTypeFieldsOrBases
1805 = FromData.HasNonLiteralTypeFieldsOrBases;
1807 ToData.UserProvidedDefaultConstructor
1808 = FromData.UserProvidedDefaultConstructor;
1809 ToData.DeclaredSpecialMembers = FromData.DeclaredSpecialMembers;
1810 ToData.ImplicitCopyConstructorCanHaveConstParamForVBase
1811 = FromData.ImplicitCopyConstructorCanHaveConstParamForVBase;
1812 ToData.ImplicitCopyConstructorCanHaveConstParamForNonVBase
1813 = FromData.ImplicitCopyConstructorCanHaveConstParamForNonVBase;
1814 ToData.ImplicitCopyAssignmentHasConstParam
1815 = FromData.ImplicitCopyAssignmentHasConstParam;
1816 ToData.HasDeclaredCopyConstructorWithConstParam
1817 = FromData.HasDeclaredCopyConstructorWithConstParam;
1818 ToData.HasDeclaredCopyAssignmentWithConstParam
1819 = FromData.HasDeclaredCopyAssignmentWithConstParam;
1822 ToCXX->setArgPassingRestrictions(FromCXX->getArgPassingRestrictions());
1825 for (
const auto &Base1 : FromCXX->bases()) {
1828 return TyOrErr.takeError();
1831 if (Base1.isPackExpansion()) {
1832 if (
ExpectedSLoc LocOrErr =
import(Base1.getEllipsisLoc()))
1833 EllipsisLoc = *LocOrErr;
1835 return LocOrErr.takeError();
1840 ImportDefinitionIfNeeded(Base1.getType()->getAsCXXRecordDecl()))
1843 auto RangeOrErr =
import(Base1.getSourceRange());
1845 return RangeOrErr.takeError();
1847 auto TSIOrErr =
import(Base1.getTypeSourceInfo());
1849 return TSIOrErr.takeError();
1855 Base1.isBaseOfClass(),
1856 Base1.getAccessSpecifierAsWritten(),
1861 ToCXX->setBases(Bases.data(), Bases.size());
1864 if (shouldForceImportDeclContext(Kind))
1865 if (
Error Err = ImportDeclContext(From,
true))
1868 return Error::success();
1873 return Error::success();
1877 return Error::success();
1881 return ToInitOrErr.takeError();
1891 return Error::success();
1897 if (Kind == IDK_Everything)
1898 return ImportDeclContext(From,
true);
1899 return Error::success();
1908 import(Importer.getFromContext().getTypeDeclType(From));
1910 return ToTypeOrErr.takeError();
1913 if (!ToPromotionTypeOrErr)
1914 return ToPromotionTypeOrErr.takeError();
1916 if (shouldForceImportDeclContext(Kind))
1917 if (
Error Err = ImportDeclContext(From,
true))
1925 return Error::success();
1931 for (
unsigned I = 0; I != NumFromArgs; ++I) {
1932 if (
auto ToOrErr =
import(FromArgs[I]))
1933 ToArgs.push_back(*ToOrErr);
1935 return ToOrErr.takeError();
1938 return Error::success();
1944 return import(From);
1947 template <
typename InContainerTy>
1950 for (
const auto &FromLoc : Container) {
1951 if (
auto ToLocOrErr =
import(FromLoc))
1954 return ToLocOrErr.takeError();
1956 return Error::success();
1967 Importer.getFromContext(), Importer.getToContext(),
1977 Decl *ToOrigin = Importer.GetOriginalDecl(ToRecord);
1979 auto *ToOriginRecord = dyn_cast<
RecordDecl>(ToOrigin);
1981 ToRecord = ToOriginRecord;
1986 Importer.getNonEquivalentDecls(),
1995 Importer.getFromContext(), Importer.getToContext(),
2004 if (
Decl *ToOrigin = Importer.GetOriginalDecl(ToEnum))
2005 if (
auto *ToOriginEnum = dyn_cast<EnumDecl>(ToOrigin))
2006 ToEnum = ToOriginEnum;
2009 Importer.getFromContext(), Importer.getToContext(),
2017 Importer.getFromContext(), Importer.getToContext(),
2025 Importer.getFromContext(), Importer.getToContext(),
2033 const llvm::APSInt &FromVal = FromEC->
getInitVal();
2034 const llvm::APSInt &ToVal = ToEC->
getInitVal();
2036 return FromVal.isSigned() == ToVal.isSigned() &&
2037 FromVal.getBitWidth() == ToVal.getBitWidth() &&
2044 Importer.getToContext(),
2045 Importer.getNonEquivalentDecls(),
2053 Importer.getToContext(),
2054 Importer.getNonEquivalentDecls(),
2060 Importer.FromDiag(D->
getLocation(), diag::err_unsupported_ast_node)
2066 Importer.FromDiag(D->
getLocation(), diag::err_unsupported_ast_node)
2074 if (
Error Err = ImportDeclContext(D, DC, LexicalDC))
2075 return std::move(Err);
2080 return LocOrErr.takeError();
2083 if (GetImportedOrCreateDecl(ToD, D, Importer.getToContext(), DC, *LocOrErr))
2095 Importer.MapImported(D, ToD);
2103 return LocOrErr.takeError();
2106 return ColonLocOrErr.takeError();
2111 return DCOrErr.takeError();
2115 if (GetImportedOrCreateDecl(ToD, D, Importer.getToContext(), D->
getAccess(),
2116 DC, *LocOrErr, *ColonLocOrErr))
2130 return DCOrErr.takeError();
2137 if (
auto Imp = importSeq(
2139 std::tie(ToLocation, ToAssertExpr, ToMessage, ToRParenLoc) = *Imp;
2141 return Imp.takeError();
2144 if (GetImportedOrCreateDecl(
2145 ToD, D, Importer.getToContext(), DC, ToLocation, ToAssertExpr, ToMessage,
2160 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
2161 return std::move(Err);
2170 if (
auto *TU = dyn_cast<TranslationUnitDecl>(DC))
2173 MergeWithNamespace = cast<NamespaceDecl>(DC)->getAnonymousNamespace();
2176 auto FoundDecls = Importer.findDeclsInToCtx(DC, Name);
2177 for (
auto *FoundDecl : FoundDecls) {
2181 if (
auto *FoundNS = dyn_cast<NamespaceDecl>(FoundDecl)) {
2182 MergeWithNamespace = FoundNS;
2183 ConflictingDecls.clear();
2187 ConflictingDecls.push_back(FoundDecl);
2190 if (!ConflictingDecls.empty()) {
2192 ConflictingDecls.data(),
2193 ConflictingDecls.size());
2201 return BeginLocOrErr.takeError();
2206 if (GetImportedOrCreateDecl(
2207 ToNamespace, D, Importer.getToContext(), DC, D->
isInline(),
2217 if (
auto *TU = dyn_cast<TranslationUnitDecl>(DC))
2218 TU->setAnonymousNamespace(ToNamespace);
2220 cast<NamespaceDecl>(DC)->setAnonymousNamespace(ToNamespace);
2223 Importer.MapImported(D, ToNamespace);
2225 if (
Error Err = ImportDeclContext(D))
2226 return std::move(Err);
2237 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, LookupD, Loc))
2238 return std::move(Err);
2247 if (
auto Imp = importSeq(
2251 ToNamespaceLoc, ToAliasLoc, ToQualifierLoc, ToTargetNameLoc,
2252 ToNamespace) = *Imp;
2254 return Imp.takeError();
2258 if (GetImportedOrCreateDecl(
2259 ToD, D, Importer.getToContext(), DC, ToNamespaceLoc, ToAliasLoc,
2260 ToIdentifier, ToQualifierLoc, ToTargetNameLoc, ToNamespace))
2276 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
2277 return std::move(Err);
2287 auto FoundDecls = Importer.findDeclsInToCtx(DC, Name);
2288 for (
auto *FoundDecl : FoundDecls) {
2291 if (
auto *FoundTypedef = dyn_cast<TypedefNameDecl>(FoundDecl)) {
2293 QualType FoundUT = FoundTypedef->getUnderlyingType();
2294 if (Importer.IsStructurallyEquivalent(FromUT, FoundUT)) {
2298 return Importer.MapImported(D, FoundTypedef);
2305 ConflictingDecls.push_back(FoundDecl);
2308 if (!ConflictingDecls.empty()) {
2309 Name = Importer.HandleNameConflict(Name, DC, IDNS,
2310 ConflictingDecls.data(),
2311 ConflictingDecls.size());
2320 if (
auto Imp = importSeq(
2322 std::tie(ToUnderlyingType, ToTypeSourceInfo, ToBeginLoc) = *Imp;
2324 return Imp.takeError();
2330 if (GetImportedOrCreateDecl<TypeAliasDecl>(
2331 ToTypedef, D, Importer.getToContext(), DC, ToBeginLoc, Loc,
2334 }
else if (GetImportedOrCreateDecl<TypedefDecl>(
2335 ToTypedef, D, Importer.getToContext(), DC, ToBeginLoc, Loc,
2343 TypeAliasDecl *FromAlias = IsAlias ? cast<TypeAliasDecl>(D) :
nullptr;
2351 return VisitTypedefNameDecl(D,
false);
2355 return VisitTypedefNameDecl(D,
true);
2365 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, FoundD, Loc))
2366 return std::move(Err);
2376 auto FoundDecls = Importer.findDeclsInToCtx(DC, Name);
2377 for (
auto *FoundDecl : FoundDecls) {
2380 if (
auto *FoundAlias = dyn_cast<TypeAliasTemplateDecl>(FoundDecl))
2381 return Importer.MapImported(D, FoundAlias);
2382 ConflictingDecls.push_back(FoundDecl);
2385 if (!ConflictingDecls.empty()) {
2386 Name = Importer.HandleNameConflict(Name, DC, IDNS,
2387 ConflictingDecls.data(),
2388 ConflictingDecls.size());
2397 std::tie(ToTemplateParameters, ToTemplatedDecl) = *Imp;
2399 return Imp.takeError();
2402 if (GetImportedOrCreateDecl(ToAlias, D, Importer.getToContext(), DC, Loc,
2403 Name, ToTemplateParameters, ToTemplatedDecl))
2420 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
2421 return std::move(Err);
2431 return BeginLocOrErr.takeError();
2432 if (GetImportedOrCreateDecl(ToLabel, D, Importer.getToContext(), DC, Loc,
2437 if (GetImportedOrCreateDecl(ToLabel, D, Importer.getToContext(), DC, Loc,
2445 return ToStmtOrErr.takeError();
2447 ToLabel->setStmt(*ToStmtOrErr);
2448 ToLabel->setLexicalDeclContext(LexicalDC);
2459 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
2460 return std::move(Err);
2468 if (
Error Err = importInto(
2470 return std::move(Err);
2472 }
else if (Importer.getToContext().getLangOpts().CPlusPlus)
2479 Importer.findDeclsInToCtx(DC, SearchName);
2480 for (
auto *FoundDecl : FoundDecls) {
2484 if (
auto *Typedef = dyn_cast<TypedefNameDecl>(FoundDecl)) {
2485 if (
const auto *Tag = Typedef->getUnderlyingType()->getAs<
TagType>())
2486 FoundDecl = Tag->getDecl();
2489 if (
auto *FoundEnum = dyn_cast<EnumDecl>(FoundDecl)) {
2490 if (!hasSameVisibilityContext(FoundEnum, D))
2492 if (IsStructuralMatch(D, FoundEnum))
2493 return Importer.MapImported(D, FoundEnum);
2496 ConflictingDecls.push_back(FoundDecl);
2499 if (!ConflictingDecls.empty()) {
2500 Name = Importer.HandleNameConflict(SearchName, DC, IDNS,
2501 ConflictingDecls.data(),
2502 ConflictingDecls.size());
2511 if (
auto Imp = importSeq(
2513 std::tie(ToBeginLoc, ToQualifierLoc, ToIntegerType) = *Imp;
2515 return Imp.takeError();
2519 if (GetImportedOrCreateDecl(
2520 D2, D, Importer.getToContext(), DC, ToBeginLoc,
2533 if (
Error Err = ImportDefinition(D, D2))
2534 return std::move(Err);
2540 bool IsFriendTemplate =
false;
2541 if (
auto *DCXX = dyn_cast<CXXRecordDecl>(D)) {
2543 DCXX->getDescribedClassTemplate() &&
2544 DCXX->getDescribedClassTemplate()->getFriendObjectKind() !=
2553 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
2554 return std::move(Err);
2562 if (
Error Err = importInto(
2564 return std::move(Err);
2566 }
else if (Importer.getToContext().getLangOpts().CPlusPlus)
2574 Importer.findDeclsInToCtx(DC, SearchName);
2575 if (!FoundDecls.empty()) {
2582 for (
auto *FoundDecl : FoundDecls) {
2586 Decl *Found = FoundDecl;
2587 if (
auto *Typedef = dyn_cast<TypedefNameDecl>(Found)) {
2588 if (
const auto *Tag = Typedef->getUnderlyingType()->getAs<
TagType>())
2589 Found = Tag->getDecl();
2592 if (
auto *FoundRecord = dyn_cast<RecordDecl>(Found)) {
2603 if (!IsStructuralMatch(D, FoundRecord,
false))
2606 if (!hasSameVisibilityContext(FoundRecord, D))
2609 if (IsStructuralMatch(D, FoundRecord)) {
2614 Importer.MapImported(D, FoundDef);
2615 if (
const auto *DCXX = dyn_cast<CXXRecordDecl>(D)) {
2617 assert(FoundCXX &&
"Record type mismatch");
2619 if (!Importer.isMinimalImport())
2622 if (
Error Err = ImportImplicitMethods(DCXX, FoundCXX))
2623 return std::move(Err);
2631 ConflictingDecls.push_back(FoundDecl);
2634 if (!ConflictingDecls.empty() && SearchName) {
2635 Name = Importer.HandleNameConflict(SearchName, DC, IDNS,
2636 ConflictingDecls.data(),
2637 ConflictingDecls.size());
2645 return BeginLocOrErr.takeError();
2650 if (
auto *DCXX = dyn_cast<CXXRecordDecl>(D)) {
2651 if (DCXX->isLambda()) {
2652 auto TInfoOrErr =
import(DCXX->getLambdaTypeInfo());
2654 return TInfoOrErr.takeError();
2655 if (GetImportedOrCreateSpecialDecl(
2657 DC, *TInfoOrErr, Loc, DCXX->isDependentLambda(),
2658 DCXX->isGenericLambda(), DCXX->getLambdaCaptureDefault()))
2660 ExpectedDecl CDeclOrErr =
import(DCXX->getLambdaContextDecl());
2662 return CDeclOrErr.takeError();
2664 }
else if (DCXX->isInjectedClassName()) {
2667 const bool DelayTypeCreation =
true;
2668 if (GetImportedOrCreateDecl(
2669 D2CXX, D, Importer.getToContext(), D->
getTagKind(), DC,
2671 cast_or_null<CXXRecordDecl>(PrevDecl), DelayTypeCreation))
2673 Importer.getToContext().getTypeDeclType(
2674 D2CXX, dyn_cast<CXXRecordDecl>(DC));
2676 if (GetImportedOrCreateDecl(D2CXX, D, Importer.getToContext(),
2679 cast_or_null<CXXRecordDecl>(PrevDecl)))
2686 if (!DCXX->getDescribedClassTemplate() || DCXX->isImplicit())
2693 DCXX->getDescribedClassTemplate()) {
2695 if (
Error Err = importInto(ToDescribed, FromDescribed))
2696 return std::move(Err);
2698 if (!DCXX->isInjectedClassName() && !IsFriendTemplate) {
2708 if (Record && Record->isInjectedClassName()) {
2716 for (
auto *R : Redecls) {
2717 auto *RI = cast<CXXRecordDecl>(R);
2718 RI->setTypeForDecl(
nullptr);
2722 Importer.getToContext().getInjectedClassNameType(
2728 Importer.getToContext().getTypeDeclType(Injected, D2CXX);
2732 DCXX->getMemberSpecializationInfo()) {
2734 MemberInfo->getTemplateSpecializationKind();
2740 return ToInstOrErr.takeError();
2743 import(MemberInfo->getPointOfInstantiation()))
2747 return POIOrErr.takeError();
2751 if (GetImportedOrCreateDecl(D2, D, Importer.getToContext(),
2762 return QualifierLocOrErr.takeError();
2768 if (
Error Err = ImportDefinition(D, D2, IDK_Default))
2769 return std::move(Err);
2780 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
2781 return std::move(Err);
2790 auto FoundDecls = Importer.findDeclsInToCtx(DC, Name);
2791 for (
auto *FoundDecl : FoundDecls) {
2795 if (
auto *FoundEnumConstant = dyn_cast<EnumConstantDecl>(FoundDecl)) {
2796 if (IsStructuralMatch(D, FoundEnumConstant))
2797 return Importer.MapImported(D, FoundEnumConstant);
2800 ConflictingDecls.push_back(FoundDecl);
2803 if (!ConflictingDecls.empty()) {
2804 Name = Importer.HandleNameConflict(Name, DC, IDNS,
2805 ConflictingDecls.data(),
2806 ConflictingDecls.size());
2814 return TypeOrErr.takeError();
2818 return InitOrErr.takeError();
2821 if (GetImportedOrCreateDecl(
2822 ToEnumerator, D, Importer.getToContext(), cast<EnumDecl>(DC), Loc,
2824 return ToEnumerator;
2829 return ToEnumerator;
2836 return Error::success();
2838 for (
unsigned int I = 0; I < Num; ++I)
2841 ToTPLists[I] = *ToTPListOrErr;
2843 return ToTPListOrErr.takeError();
2845 return Error::success();
2853 return Error::success();
2860 ToFD->setInstantiationOfMemberFunction(*InstFDOrErr, TSK);
2862 return InstFDOrErr.takeError();
2868 return POIOrErr.takeError();
2870 return Error::success();
2874 auto FunctionAndArgsOrErr =
2875 ImportFunctionTemplateWithTemplateArgsFromSpecialization(FromFD);
2876 if (!FunctionAndArgsOrErr)
2877 return FunctionAndArgsOrErr.takeError();
2880 Importer.getToContext(), std::get<1>(*FunctionAndArgsOrErr));
2884 const auto *FromTAArgsAsWritten = FTSInfo->TemplateArgumentsAsWritten;
2885 if (FromTAArgsAsWritten)
2886 if (
Error Err = ImportTemplateArgumentListInfo(
2887 *FromTAArgsAsWritten, ToTAInfo))
2890 ExpectedSLoc POIOrErr =
import(FTSInfo->getPointOfInstantiation());
2892 return POIOrErr.takeError();
2894 if (
Error Err = ImportTemplateParameterLists(FromFD, ToFD))
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;
2954 return ToBodyOrErr.takeError();
2956 return Error::success();
2959 template <
typename T>
2961 if (From->hasExternalFormalLinkage())
2962 return Found->hasExternalFormalLinkage();
2963 if (Importer.GetFromTU(Found) != From->getTranslationUnitDecl())
2965 if (From->isInAnonymousNamespace())
2966 return Found->isInAnonymousNamespace();
2968 return !Found->isInAnonymousNamespace() &&
2969 !Found->hasExternalFormalLinkage();
2975 auto RedeclIt = Redecls.begin();
2978 for (; RedeclIt != Redecls.end() && *RedeclIt != D; ++RedeclIt) {
2981 return ToRedeclOrErr.takeError();
2983 assert(*RedeclIt == D);
2990 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
2991 return std::move(Err);
3005 auto FoundFunctionOrErr = FindFunctionTemplateSpecialization(D);
3006 if (!FoundFunctionOrErr)
3007 return FoundFunctionOrErr.takeError();
3008 if (
FunctionDecl *FoundFunction = *FoundFunctionOrErr) {
3009 if (
Decl *Def = FindAndMapDefinition(D, FoundFunction))
3011 FoundByLookup = FoundFunction;
3019 auto FoundDecls = Importer.findDeclsInToCtx(DC, Name);
3020 for (
auto *FoundDecl : FoundDecls) {
3024 if (
auto *FoundFunction = dyn_cast<FunctionDecl>(FoundDecl)) {
3025 if (!hasSameVisibilityContext(FoundFunction, D))
3028 if (IsStructuralMatch(D, FoundFunction)) {
3029 if (
Decl *Def = FindAndMapDefinition(D, FoundFunction))
3031 FoundByLookup = FoundFunction;
3038 if (Importer.getToContext().getLangOpts().CPlusPlus)
3042 Importer.ToDiag(Loc, diag::warn_odr_function_type_inconsistent)
3043 << Name << D->
getType() << FoundFunction->getType();
3044 Importer.ToDiag(FoundFunction->getLocation(), diag::note_odr_value_here)
3045 << FoundFunction->getType();
3048 ConflictingDecls.push_back(FoundDecl);
3051 if (!ConflictingDecls.empty()) {
3052 Name = Importer.HandleNameConflict(Name, DC, IDNS,
3053 ConflictingDecls.data(),
3054 ConflictingDecls.size());
3066 if (FoundByLookup) {
3067 if (isa<CXXMethodDecl>(FoundByLookup)) {
3070 return Importer.MapImported(D, FoundByLookup);
3082 return std::move(Err);
3085 bool usedDifferentExceptionSpec =
false;
3097 FromTy = Importer.getFromContext().getFunctionType(
3098 FromFPT->getReturnType(), FromFPT->getParamTypes(), DefaultEPI);
3099 usedDifferentExceptionSpec =
true;
3107 if (
auto Imp = importSeq(
3110 std::tie(T, TInfo, ToInnerLocStart, ToQualifierLoc, ToEndLoc) = *Imp;
3112 return Imp.takeError();
3118 Parameters.push_back(*ToPOrErr);
3120 return ToPOrErr.takeError();
3125 if (
auto *FromConstructor = dyn_cast<CXXConstructorDecl>(D)) {
3126 Expr *ExplicitExpr =
nullptr;
3127 if (FromConstructor->getExplicitSpecifier().getExpr()) {
3128 auto Imp = importSeq(FromConstructor->getExplicitSpecifier().getExpr());
3130 return Imp.takeError();
3131 std::tie(ExplicitExpr) = *Imp;
3133 if (GetImportedOrCreateDecl<CXXConstructorDecl>(
3134 ToFunction, D, Importer.getToContext(), cast<CXXRecordDecl>(DC),
3135 ToInnerLocStart, NameInfo, T, TInfo,
3138 FromConstructor->getExplicitSpecifier().getKind()),
3144 importSeq(const_cast<FunctionDecl *>(FromDtor->getOperatorDelete()),
3145 FromDtor->getOperatorDeleteThisArg());
3148 return Imp.takeError();
3152 std::tie(ToOperatorDelete, ToThisArg) = *Imp;
3154 if (GetImportedOrCreateDecl<CXXDestructorDecl>(
3155 ToFunction, D, Importer.getToContext(), cast<CXXRecordDecl>(DC),
3164 dyn_cast<CXXConversionDecl>(D)) {
3165 Expr *ExplicitExpr =
nullptr;
3166 if (FromConversion->getExplicitSpecifier().getExpr()) {
3167 auto Imp = importSeq(FromConversion->getExplicitSpecifier().getExpr());
3169 return Imp.takeError();
3170 std::tie(ExplicitExpr) = *Imp;
3172 if (GetImportedOrCreateDecl<CXXConversionDecl>(
3173 ToFunction, D, Importer.getToContext(), cast<CXXRecordDecl>(DC),
3176 FromConversion->getExplicitSpecifier().getKind()),
3179 }
else if (
auto *Method = dyn_cast<CXXMethodDecl>(D)) {
3180 if (GetImportedOrCreateDecl<CXXMethodDecl>(
3181 ToFunction, D, Importer.getToContext(), cast<CXXRecordDecl>(DC),
3182 ToInnerLocStart, NameInfo, T, TInfo, Method->getStorageClass(),
3187 if (GetImportedOrCreateDecl(
3188 ToFunction, D, Importer.getToContext(), DC, ToInnerLocStart,
3195 if (FoundByLookup) {
3207 if (
auto *FromConstructor = dyn_cast<CXXConstructorDecl>(D)) {
3208 if (
unsigned NumInitializers = FromConstructor->getNumCtorInitializers()) {
3211 if (
Error Err = ImportContainerChecked(
3212 FromConstructor->inits(), CtorInitializers))
3213 return std::move(Err);
3216 std::copy(CtorInitializers.begin(), CtorInitializers.end(), Memory);
3217 auto *ToCtor = cast<CXXConstructorDecl>(ToFunction);
3218 ToCtor->setCtorInitializers(Memory);
3219 ToCtor->setNumCtorInitializers(NumInitializers);
3232 for (
auto *Param : Parameters) {
3233 Param->setOwningFunction(ToFunction);
3236 ToFunction->setParams(Parameters);
3243 for (
unsigned I = 0, N = Parameters.size(); I != N; ++I)
3244 ProtoLoc.setParam(I, Parameters[I]);
3248 if (usedDifferentExceptionSpec) {
3251 ToFunction->
setType(*TyOrErr);
3253 return TyOrErr.takeError();
3258 auto ToFTOrErr =
import(FromFT);
3260 return ToFTOrErr.takeError();
3264 Error Err = ImportFunctionDeclBody(D, ToFunction);
3267 return std::move(Err);
3273 if (
Error Err = ImportTemplateInformation(D, ToFunction))
3274 return std::move(Err);
3290 if (LexicalDC != DC && IsFriend) {
3294 if (
auto *FromCXXMethod = dyn_cast<CXXMethodDecl>(D))
3295 ImportOverrides(cast<CXXMethodDecl>(ToFunction), FromCXXMethod);
3298 for (++RedeclIt; RedeclIt != Redecls.end(); ++RedeclIt) {
3301 return ToRedeclOrErr.takeError();
3308 return VisitFunctionDecl(D);
3312 return VisitCXXMethodDecl(D);
3316 return VisitCXXMethodDecl(D);
3320 return VisitCXXMethodDecl(D);
3329 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
3330 return std::move(Err);
3335 auto FoundDecls = Importer.findDeclsInToCtx(DC, Name);
3336 for (
auto *FoundDecl : FoundDecls) {
3337 if (
FieldDecl *FoundField = dyn_cast<FieldDecl>(FoundDecl)) {
3344 if (Importer.IsStructurallyEquivalent(D->
getType(),
3345 FoundField->getType())) {
3346 Importer.MapImported(D, FoundField);
3353 if (FoundField->hasInClassInitializer() &&
3354 !FoundField->getInClassInitializer()) {
3355 if (
ExpectedExpr ToInitializerOrErr =
import(FromInitializer))
3356 FoundField->setInClassInitializer(*ToInitializerOrErr);
3361 consumeError(ToInitializerOrErr.takeError());
3370 Importer.ToDiag(Loc, diag::warn_odr_field_type_inconsistent)
3371 << Name << D->
getType() << FoundField->getType();
3372 Importer.ToDiag(FoundField->getLocation(), diag::note_odr_value_here)
3373 << FoundField->getType();
3383 Expr *ToInitializer;
3384 if (
auto Imp = importSeq(
3388 ToType, ToTInfo, ToBitWidth, ToInnerLocStart, ToInitializer) = *Imp;
3390 return Imp.takeError();
3393 if (GetImportedOrCreateDecl(ToField, D, Importer.getToContext(), DC,
3395 ToType, ToTInfo, ToBitWidth, D->
isMutable(),
3414 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
3415 return std::move(Err);
3420 auto FoundDecls = Importer.findDeclsInToCtx(DC, Name);
3421 for (
unsigned I = 0, N = FoundDecls.size(); I != N; ++I) {
3422 if (
auto *FoundField = dyn_cast<IndirectFieldDecl>(FoundDecls[I])) {
3429 if (Importer.IsStructurallyEquivalent(D->
getType(),
3430 FoundField->getType(),
3432 Importer.MapImported(D, FoundField);
3437 if (!Name && I < N-1)
3441 Importer.ToDiag(Loc, diag::warn_odr_field_type_inconsistent)
3442 << Name << D->
getType() << FoundField->getType();
3443 Importer.ToDiag(FoundField->getLocation(), diag::note_odr_value_here)
3444 << FoundField->getType();
3451 auto TypeOrErr =
import(D->
getType());
3453 return TypeOrErr.takeError();
3459 for (
auto *PI : D->
chain())
3461 NamedChain[i++] = *ToD;
3463 return ToD.takeError();
3467 if (GetImportedOrCreateDecl(ToIndirectField, D, Importer.getToContext(), DC,
3470 return ToIndirectField;
3475 return ToIndirectField;
3481 if (
Error Err = ImportDeclContext(D, DC, LexicalDC))
3482 return std::move(Err);
3486 auto *RD = cast<CXXRecordDecl>(DC);
3487 FriendDecl *ImportedFriend = RD->getFirstFriend();
3489 while (ImportedFriend) {
3490 if (D->
getFriendDecl() && ImportedFriend->getFriendDecl()) {
3491 if (IsStructuralMatch(D->
getFriendDecl(), ImportedFriend->getFriendDecl(),
3493 return Importer.MapImported(D, ImportedFriend);
3495 }
else if (D->
getFriendType() && ImportedFriend->getFriendType()) {
3496 if (Importer.IsStructurallyEquivalent(
3498 ImportedFriend->getFriendType()->getType(),
true))
3499 return Importer.MapImported(D, ImportedFriend);
3501 ImportedFriend = ImportedFriend->getNextFriend();
3508 if (
Error Err = importInto(ToFriendD, FriendD))
3509 return std::move(Err);
3520 return TSIOrErr.takeError();
3525 for (
unsigned I = 0; I < D->NumTPLists; I++) {
3526 if (
auto ListOrErr =
import(FromTPLists[I]))
3527 ToTPLists[I] = *ListOrErr;
3529 return ListOrErr.takeError();
3534 return LocationOrErr.takeError();
3536 if (!FriendLocOrErr)
3537 return FriendLocOrErr.takeError();
3540 if (GetImportedOrCreateDecl(FrD, D, Importer.getToContext(), DC,
3541 *LocationOrErr, ToFU,
3542 *FriendLocOrErr, ToTPLists))
3557 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
3558 return std::move(Err);
3563 auto FoundDecls = Importer.findDeclsInToCtx(DC, Name);
3564 for (
auto *FoundDecl : FoundDecls) {
3565 if (
ObjCIvarDecl *FoundIvar = dyn_cast<ObjCIvarDecl>(FoundDecl)) {
3566 if (Importer.IsStructurallyEquivalent(D->
getType(),
3567 FoundIvar->getType())) {
3568 Importer.MapImported(D, FoundIvar);
3572 Importer.ToDiag(Loc, diag::warn_odr_ivar_type_inconsistent)
3573 << Name << D->
getType() << FoundIvar->getType();
3574 Importer.ToDiag(FoundIvar->getLocation(), diag::note_odr_value_here)
3575 << FoundIvar->getType();
3585 if (
auto Imp = importSeq(
3587 std::tie(ToType, ToTypeSourceInfo, ToBitWidth, ToInnerLocStart) = *Imp;
3589 return Imp.takeError();
3592 if (GetImportedOrCreateDecl(
3593 ToIvar, D, Importer.getToContext(), cast<ObjCContainerDecl>(DC),
3595 ToType, ToTypeSourceInfo,
3607 auto RedeclIt = Redecls.begin();
3610 for (; RedeclIt != Redecls.end() && *RedeclIt != D; ++RedeclIt) {
3613 return RedeclOrErr.takeError();
3615 assert(*RedeclIt == D);
3622 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
3623 return std::move(Err);
3629 VarDecl *FoundByLookup =
nullptr;
3633 auto FoundDecls = Importer.findDeclsInToCtx(DC, Name);
3634 for (
auto *FoundDecl : FoundDecls) {
3638 if (
auto *FoundVar = dyn_cast<VarDecl>(FoundDecl)) {
3639 if (!hasSameVisibilityContext(FoundVar, D))
3641 if (Importer.IsStructurallyEquivalent(D->
getType(),
3642 FoundVar->getType())) {
3650 return Importer.MapImported(D, FoundDef);
3654 const VarDecl *FoundDInit =
nullptr;
3655 if (D->
getInit() && FoundVar->getAnyInitializer(FoundDInit))
3657 return Importer.MapImported(D, const_cast<VarDecl*>(FoundDInit));
3659 FoundByLookup = FoundVar;
3664 = Importer.getToContext().getAsArrayType(FoundVar->getType());
3666 = Importer.getToContext().getAsArrayType(D->
getType());
3667 if (FoundArray && TArray) {
3668 if (isa<IncompleteArrayType>(FoundArray) &&
3669 isa<ConstantArrayType>(TArray)) {
3671 if (
auto TyOrErr =
import(D->
getType()))
3672 FoundVar->setType(*TyOrErr);
3674 return TyOrErr.takeError();
3676 FoundByLookup = FoundVar;
3678 }
else if (isa<IncompleteArrayType>(TArray) &&
3679 isa<ConstantArrayType>(FoundArray)) {
3680 FoundByLookup = FoundVar;
3685 Importer.ToDiag(Loc, diag::warn_odr_variable_type_inconsistent)
3686 << Name << D->
getType() << FoundVar->getType();
3687 Importer.ToDiag(FoundVar->getLocation(), diag::note_odr_value_here)
3688 << FoundVar->getType();
3691 ConflictingDecls.push_back(FoundDecl);
3694 if (!ConflictingDecls.empty()) {
3695 Name = Importer.HandleNameConflict(Name, DC, IDNS,
3696 ConflictingDecls.data(),
3697 ConflictingDecls.size());
3707 if (
auto Imp = importSeq(
3710 std::tie(ToType, ToTypeSourceInfo, ToInnerLocStart, ToQualifierLoc) = *Imp;
3712 return Imp.takeError();
3716 if (GetImportedOrCreateDecl(ToVar, D, Importer.getToContext(), DC,
3717 ToInnerLocStart, Loc,
3719 ToType, ToTypeSourceInfo,
3727 if (FoundByLookup) {
3732 if (
Error Err = ImportInitializer(D, ToVar))
3733 return std::move(Err);
3744 for (++RedeclIt; RedeclIt != Redecls.end(); ++RedeclIt) {
3747 return RedeclOrErr.takeError();
3756 DeclContext *DC = Importer.getToContext().getTranslationUnitDecl();
3762 std::tie(ToDeclName, ToLocation, ToType) = *Imp;
3764 return Imp.takeError();
3768 if (GetImportedOrCreateDecl(ToParm, D, Importer.getToContext(), DC,
3778 DeclContext *DC = Importer.getToContext().getTranslationUnitDecl();
3784 if (
auto Imp = importSeq(
3788 ToDeclName, ToLocation, ToType, ToInnerLocStart,
3789 ToTypeSourceInfo) = *Imp;
3791 return Imp.takeError();
3794 if (GetImportedOrCreateDecl(ToParm, D, Importer.getToContext(), DC,
3795 ToInnerLocStart, ToLocation,
3809 return ToDefArgOrErr.takeError();
3816 return ToDefArgOrErr.takeError();
3836 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
3837 return std::move(Err);
3841 auto FoundDecls = Importer.findDeclsInToCtx(DC, Name);
3842 for (
auto *FoundDecl : FoundDecls) {
3843 if (
auto *FoundMethod = dyn_cast<ObjCMethodDecl>(FoundDecl)) {
3849 FoundMethod->getReturnType())) {
3850 Importer.ToDiag(Loc, diag::warn_odr_objc_method_result_type_inconsistent)
3852 << FoundMethod->getReturnType();
3853 Importer.ToDiag(FoundMethod->getLocation(),
3854 diag::note_odr_objc_method_here)
3861 if (D->
param_size() != FoundMethod->param_size()) {
3862 Importer.ToDiag(Loc, diag::warn_odr_objc_method_num_params_inconsistent)
3864 << D->
param_size() << FoundMethod->param_size();
3865 Importer.ToDiag(FoundMethod->getLocation(),
3866 diag::note_odr_objc_method_here)
3874 PEnd = D->
param_end(), FoundP = FoundMethod->param_begin();
3875 P != PEnd; ++
P, ++FoundP) {
3876 if (!Importer.IsStructurallyEquivalent((*P)->getType(),
3877 (*FoundP)->getType())) {
3878 Importer.FromDiag((*P)->getLocation(),
3879 diag::warn_odr_objc_method_param_type_inconsistent)
3881 << (*P)->getType() << (*FoundP)->getType();
3882 Importer.ToDiag((*FoundP)->getLocation(), diag::note_odr_value_here)
3883 << (*FoundP)->getType();
3891 if (D->
isVariadic() != FoundMethod->isVariadic()) {
3892 Importer.ToDiag(Loc, diag::warn_odr_objc_method_variadic_inconsistent)
3894 Importer.ToDiag(FoundMethod->getLocation(),
3895 diag::note_odr_objc_method_here)
3902 return Importer.MapImported(D, FoundMethod);
3909 if (
auto Imp = importSeq(
3911 std::tie(ToEndLoc, ToReturnType, ToReturnTypeSourceInfo) = *Imp;
3913 return Imp.takeError();
3916 if (GetImportedOrCreateDecl(
3917 ToMethod, D, Importer.getToContext(), Loc,
3931 ToParams.push_back(*ToPOrErr);
3933 return ToPOrErr.takeError();
3937 for (
auto *ToParam : ToParams) {
3938 ToParam->setOwningFunction(ToMethod);
3945 if (
Error Err = ImportContainerChecked(FromSelLocs, ToSelLocs))
3946 return std::move(Err);
3948 ToMethod->
setMethodParams(Importer.getToContext(), ToParams, ToSelLocs);
3961 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
3962 return std::move(Err);
3968 if (
auto Imp = importSeq(
3971 std::tie(ToVarianceLoc, ToLocation, ToColonLoc, ToTypeSourceInfo) = *Imp;
3973 return Imp.takeError();
3976 if (GetImportedOrCreateDecl(
3977 Result, D, Importer.getToContext(), DC, D->
getVariance(),
3980 ToColonLoc, ToTypeSourceInfo))
3993 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
3994 return std::move(Err);
4000 return std::move(Err);
4009 if (
auto Imp = importSeq(
4013 ToAtStartLoc, ToCategoryNameLoc,
4014 ToIvarLBraceLoc, ToIvarRBraceLoc) = *Imp;
4016 return Imp.takeError();
4018 if (GetImportedOrCreateDecl(ToCategory, D, Importer.getToContext(), DC,
4034 return PListOrErr.takeError();
4043 FromProto != FromProtoEnd;
4044 ++FromProto, ++FromProtoLoc) {
4046 Protocols.push_back(*ToProtoOrErr);
4048 return ToProtoOrErr.takeError();
4050 if (
ExpectedSLoc ToProtoLocOrErr =
import(*FromProtoLoc))
4051 ProtocolLocs.push_back(*ToProtoLocOrErr);
4053 return ToProtoLocOrErr.takeError();
4058 ProtocolLocs.data(), Importer.getToContext());
4061 Importer.MapImported(D, ToCategory);
4065 if (
Error Err = ImportDeclContext(D))
4066 return std::move(Err);
4074 return ToImplOrErr.takeError();
4083 if (shouldForceImportDeclContext(Kind))
4084 if (
Error Err = ImportDeclContext(From))
4086 return Error::success();
4099 FromProto != FromProtoEnd;
4100 ++FromProto, ++FromProtoLoc) {
4102 Protocols.push_back(*ToProtoOrErr);
4104 return ToProtoOrErr.takeError();
4106 if (
ExpectedSLoc ToProtoLocOrErr =
import(*FromProtoLoc))
4107 ProtocolLocs.push_back(*ToProtoLocOrErr);
4109 return ToProtoLocOrErr.takeError();
4115 ProtocolLocs.data(), Importer.getToContext());
4117 if (shouldForceImportDeclContext(Kind)) {
4119 if (
Error Err = ImportDeclContext(From,
true))
4122 return Error::success();
4130 if (Definition && Definition != D) {
4131 if (
ExpectedDecl ImportedDefOrErr =
import(Definition))
4132 return Importer.MapImported(D, *ImportedDefOrErr);
4134 return ImportedDefOrErr.takeError();
4142 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
4143 return std::move(Err);
4148 auto FoundDecls = Importer.findDeclsInToCtx(DC, Name);
4149 for (
auto *FoundDecl : FoundDecls) {
4153 if ((MergeWithProtocol = dyn_cast<ObjCProtocolDecl>(FoundDecl)))
4160 if (!ToAtBeginLocOrErr)
4161 return ToAtBeginLocOrErr.takeError();
4163 if (GetImportedOrCreateDecl(ToProto, D, Importer.getToContext(), DC,
4172 Importer.MapImported(D, ToProto);
4175 if (
Error Err = ImportDefinition(D, ToProto))
4176 return std::move(Err);
4183 if (
Error Err = ImportDeclContext(D, DC, LexicalDC))
4184 return std::move(Err);
4187 if (!ExternLocOrErr)
4188 return ExternLocOrErr.takeError();
4192 return LangLocOrErr.takeError();
4197 if (GetImportedOrCreateDecl(ToLinkageSpec, D, Importer.getToContext(), DC,
4198 *ExternLocOrErr, *LangLocOrErr,
4200 return ToLinkageSpec;
4204 if (!RBraceLocOrErr)
4205 return RBraceLocOrErr.takeError();
4212 return ToLinkageSpec;
4220 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
4221 return std::move(Err);
4227 if (
auto Imp = importSeq(
4229 std::tie(ToLoc, ToUsingLoc, ToQualifierLoc) = *Imp;
4231 return Imp.takeError();
4235 return std::move(Err);
4238 if (GetImportedOrCreateDecl(ToUsing, D, Importer.getToContext(), DC,
4239 ToUsingLoc, ToQualifierLoc, NameInfo,
4247 Importer.getFromContext().getInstantiatedFromUsingDecl(D)) {
4249 Importer.getToContext().setInstantiatedFromUsingDecl(
4250 ToUsing, *ToPatternOrErr);
4252 return ToPatternOrErr.takeError();
4261 return ToShadowOrErr.takeError();
4271 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
4272 return std::move(Err);
4278 return ToUsingOrErr.takeError();
4282 return ToTargetOrErr.takeError();
4285 if (GetImportedOrCreateDecl(ToShadow, D, Importer.getToContext(), DC, Loc,
4286 *ToUsingOrErr, *ToTargetOrErr))
4293 Importer.getFromContext().getInstantiatedFromUsingShadowDecl(D)) {
4295 Importer.getToContext().setInstantiatedFromUsingShadowDecl(
4296 ToShadow, *ToPatternOrErr);
4300 return ToPatternOrErr.takeError();
4313 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
4314 return std::move(Err);
4319 if (!ToComAncestorOrErr)
4320 return ToComAncestorOrErr.takeError();
4323 SourceLocation ToUsingLoc, ToNamespaceKeyLocation, ToIdentLocation;
4325 if (
auto Imp = importSeq(
4330 ToNominatedNamespace, ToUsingLoc, ToNamespaceKeyLocation,
4331 ToQualifierLoc, ToIdentLocation) = *Imp;
4333 return Imp.takeError();
4336 if (GetImportedOrCreateDecl(ToUsingDir, D, Importer.getToContext(), DC,
4338 ToNamespaceKeyLocation,
4341 ToNominatedNamespace, *ToComAncestorOrErr))
4356 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
4357 return std::move(Err);
4363 if (
auto Imp = importSeq(
4366 std::tie(ToLoc, ToUsingLoc, ToQualifierLoc, ToEllipsisLoc) = *Imp;
4368 return Imp.takeError();
4372 return std::move(Err);
4375 if (GetImportedOrCreateDecl(ToUsingValue, D, Importer.getToContext(), DC,
4376 ToUsingLoc, ToQualifierLoc, NameInfo,
4378 return ToUsingValue;
4384 return ToUsingValue;
4393 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
4394 return std::move(Err);
4400 if (
auto Imp = importSeq(
4403 std::tie(ToUsingLoc, ToTypenameLoc, ToQualifierLoc, ToEllipsisLoc) = *Imp;
4405 return Imp.takeError();
4408 if (GetImportedOrCreateDecl(ToUsing, D, Importer.getToContext(), DC,
4409 ToUsingLoc, ToTypenameLoc,
4410 ToQualifierLoc, Loc, Name, ToEllipsisLoc))
4427 if (
auto FromSuperOrErr =
import(FromSuper))
4428 FromSuper = *FromSuperOrErr;
4430 return FromSuperOrErr.takeError();
4434 if ((
bool)FromSuper != (
bool)ToSuper ||
4437 diag::warn_odr_objc_superclass_inconsistent)
4444 diag::note_odr_objc_missing_superclass);
4447 diag::note_odr_objc_superclass)
4451 diag::note_odr_objc_missing_superclass);
4454 if (shouldForceImportDeclContext(Kind))
4455 if (
Error Err = ImportDeclContext(From))
4457 return Error::success();
4468 return SuperTInfoOrErr.takeError();
4479 FromProto != FromProtoEnd;
4480 ++FromProto, ++FromProtoLoc) {
4482 Protocols.push_back(*ToProtoOrErr);
4484 return ToProtoOrErr.takeError();
4486 if (
ExpectedSLoc ToProtoLocOrErr =
import(*FromProtoLoc))
4487 ProtocolLocs.push_back(*ToProtoLocOrErr);
4489 return ToProtoLocOrErr.takeError();
4495 ProtocolLocs.data(), Importer.getToContext());
4500 auto ToCatOrErr =
import(Cat);
4502 return ToCatOrErr.takeError();
4511 return ToImplOrErr.takeError();
4514 if (shouldForceImportDeclContext(Kind)) {
4516 if (
Error Err = ImportDeclContext(From,
true))
4519 return Error::success();
4528 for (
auto *fromTypeParam : *list) {
4529 if (
auto toTypeParamOrErr =
import(fromTypeParam))
4530 toTypeParams.push_back(*toTypeParamOrErr);
4532 return toTypeParamOrErr.takeError();
4535 auto LAngleLocOrErr =
import(list->getLAngleLoc());
4536 if (!LAngleLocOrErr)
4537 return LAngleLocOrErr.takeError();
4539 auto RAngleLocOrErr =
import(list->getRAngleLoc());
4540 if (!RAngleLocOrErr)
4541 return RAngleLocOrErr.takeError();
4554 if (Definition && Definition != D) {
4555 if (
ExpectedDecl ImportedDefOrErr =
import(Definition))
4556 return Importer.MapImported(D, *ImportedDefOrErr);
4558 return ImportedDefOrErr.takeError();
4566 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
4567 return std::move(Err);
4573 auto FoundDecls = Importer.findDeclsInToCtx(DC, Name);
4574 for (
auto *FoundDecl : FoundDecls) {
4578 if ((MergeWithIface = dyn_cast<ObjCInterfaceDecl>(FoundDecl)))
4586 if (!AtBeginLocOrErr)
4587 return AtBeginLocOrErr.takeError();
4589 if (GetImportedOrCreateDecl(
4590 ToIface, D, Importer.getToContext(), DC,
4598 Importer.MapImported(D, ToIface);
4601 if (
auto ToPListOrErr =
4605 return ToPListOrErr.takeError();
4608 if (
Error Err = ImportDefinition(D, ToIface))
4609 return std::move(Err);
4618 return std::move(Err);
4623 if (
Error Err = ImportDeclContext(D, DC, LexicalDC))
4624 return std::move(Err);
4627 if (
auto Imp = importSeq(
4629 std::tie(ToLocation, ToAtStartLoc, ToCategoryNameLoc) = *Imp;
4631 return Imp.takeError();
4633 if (GetImportedOrCreateDecl(
4634 ToImpl, D, Importer.getToContext(), DC,
4636 ToLocation, ToAtStartLoc, ToCategoryNameLoc))
4644 Importer.MapImported(D, ToImpl);
4645 if (
Error Err = ImportDeclContext(D))
4646 return std::move(Err);
4656 return std::move(Err);
4661 return std::move(Err);
4668 if (
Error Err = ImportDeclContext(D, DC, LexicalDC))
4669 return std::move(Err);
4673 if (
auto Imp = importSeq(
4677 ToLocation, ToAtStartLoc, ToSuperClassLoc,
4678 ToIvarLBraceLoc, ToIvarRBraceLoc) = *Imp;
4680 return Imp.takeError();
4682 if (GetImportedOrCreateDecl(Impl, D, Importer.getToContext(),
4694 Iface->setImplementation(Impl);
4695 Importer.MapImported(D, Iface->getImplementation());
4706 diag::warn_odr_objc_superclass_inconsistent)
4712 diag::note_odr_objc_superclass)
4716 diag::note_odr_objc_missing_superclass);
4719 diag::note_odr_objc_superclass)
4723 diag::note_odr_objc_missing_superclass);
4730 if (
Error Err = ImportDeclContext(D))
4731 return std::move(Err);
4742 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
4743 return std::move(Err);
4748 auto FoundDecls = Importer.findDeclsInToCtx(DC, Name);
4749 for (
auto *FoundDecl : FoundDecls) {
4750 if (
auto *FoundProp = dyn_cast<ObjCPropertyDecl>(FoundDecl)) {
4752 if (!Importer.IsStructurallyEquivalent(D->
getType(),
4753 FoundProp->getType())) {
4754 Importer.ToDiag(Loc, diag::warn_odr_objc_property_type_inconsistent)
4755 << Name << D->
getType() << FoundProp->getType();
4756 Importer.ToDiag(FoundProp->getLocation(), diag::note_odr_value_here)
4757 << FoundProp->getType();
4765 Importer.MapImported(D, FoundProp);
4773 if (
auto Imp = importSeq(
4775 std::tie(ToType, ToTypeSourceInfo, ToAtLoc, ToLParenLoc) = *Imp;
4777 return Imp.takeError();
4781 if (GetImportedOrCreateDecl(
4782 ToProperty, D, Importer.getToContext(), DC, Loc,
4784 ToLParenLoc, ToType,
4788 Selector ToGetterName, ToSetterName;
4792 if (
auto Imp = importSeq(
4798 ToGetterName, ToSetterName,
4799 ToGetterNameLoc, ToSetterNameLoc,
4800 ToGetterMethodDecl, ToSetterMethodDecl,
4801 ToPropertyIvarDecl) = *Imp;
4803 return Imp.takeError();
4823 return std::move(Err);
4826 if (
Error Err = ImportDeclContext(D, DC, LexicalDC))
4827 return std::move(Err);
4829 auto *InImpl = cast<ObjCImplDecl>(LexicalDC);
4834 return std::move(Err);
4841 if (
auto Imp = importSeq(
4843 std::tie(ToBeginLoc, ToLocation, ToPropertyIvarDeclLoc) = *Imp;
4845 return Imp.takeError();
4847 if (GetImportedOrCreateDecl(ToImpl, D, Importer.getToContext(), DC,
4851 ToPropertyIvarDeclLoc))
4861 diag::warn_odr_objc_property_impl_kind_inconsistent)
4866 diag::note_odr_objc_property_impl_kind)
4877 diag::warn_odr_objc_synthesize_ivar_inconsistent)
4880 << Ivar->getDeclName();
4882 diag::note_odr_objc_synthesize_ivar_here)
4889 Importer.MapImported(D, ToImpl);
4905 return BeginLocOrErr.takeError();
4909 return LocationOrErr.takeError();
4912 (void)GetImportedOrCreateDecl(
4913 ToD, D, Importer.getToContext(),
4915 *BeginLocOrErr, *LocationOrErr,
4927 if (
auto Imp = importSeq(
4931 ToDeclName, ToLocation, ToType, ToTypeSourceInfo,
4932 ToInnerLocStart) = *Imp;
4934 return Imp.takeError();
4939 (void)GetImportedOrCreateDecl(
4940 ToD, D, Importer.getToContext(),
4942 ToInnerLocStart, ToLocation, D->
getDepth(),
4953 return NameOrErr.takeError();
4958 return LocationOrErr.takeError();
4962 if (!TemplateParamsOrErr)
4963 return TemplateParamsOrErr.takeError();
4968 (void)GetImportedOrCreateDecl(
4969 ToD, D, Importer.getToContext(),
4972 (*NameOrErr).getAsIdentifierInfo(),
4973 *TemplateParamsOrErr);
4980 assert(D->getTemplatedDecl() &&
"Should be called on templates only");
4981 auto *ToTemplatedDef = D->getTemplatedDecl()->getDefinition();
4982 if (!ToTemplatedDef)
4984 auto *TemplateWithDef = ToTemplatedDef->getDescribedTemplate();
4985 return cast_or_null<T>(TemplateWithDef);
4996 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
4997 return std::move(Err);
5006 auto FoundDecls = Importer.findDeclsInToCtx(DC, Name);
5007 for (
auto *FoundDecl : FoundDecls) {
5012 Decl *Found = FoundDecl;
5014 if (FoundTemplate) {
5016 if (IsStructuralMatch(D, FoundTemplate)) {
5020 return Importer.MapImported(D, TemplateWithDef);
5022 FoundByLookup = FoundTemplate;
5027 ConflictingDecls.push_back(FoundDecl);
5030 if (!ConflictingDecls.empty()) {
5032 ConflictingDecls.data(),
5033 ConflictingDecls.size());
5044 if (
Error Err = importInto(ToTemplated, FromTemplated))
5045 return std::move(Err);
5049 if (!TemplateParamsOrErr)
5050 return TemplateParamsOrErr.takeError();
5053 if (GetImportedOrCreateDecl(D2, D, Importer.getToContext(), DC, Loc, Name,
5054 *TemplateParamsOrErr, ToTemplated))
5067 if (FoundByLookup) {
5081 "Found decl must have its templated decl set");
5084 if (ToTemplated != PrevTemplated)
5091 if (LexicalDC != DC && IsFriend)
5094 if (FromTemplated->isCompleteDefinition() &&
5106 return std::move(Err);
5110 if (
Error Err = ImportDeclContext(D, DC, LexicalDC))
5111 return std::move(Err);
5115 if (
Error Err = ImportTemplateArguments(
5117 return std::move(Err);
5120 void *InsertPos =
nullptr;
5131 if (IsStructuralMatch(D, PrevDecl)) {
5136 for (
auto *FromField : D->
fields()) {
5137 auto ToOrErr =
import(FromField);
5139 return ToOrErr.takeError();
5145 auto ToOrErr =
import(FromM);
5147 return ToOrErr.takeError();
5166 return BeginLocOrErr.takeError();
5169 return IdLocOrErr.takeError();
5177 if (
Error Err = ImportTemplateArgumentListInfo(ASTTemplateArgs, ToTAInfo))
5178 return std::move(Err);
5181 if (
Error Err = importInto(
5183 return std::move(Err);
5188 return ToTPListOrErr.takeError();
5190 if (GetImportedOrCreateDecl<ClassTemplatePartialSpecializationDecl>(
5191 D2, D, Importer.getToContext(), D->
getTagKind(), DC,
5192 *BeginLocOrErr, *IdLocOrErr, *ToTPListOrErr, ClassTemplate,
5193 llvm::makeArrayRef(TemplateArgs.data(), TemplateArgs.size()),
5194 ToTAInfo, CanonInjType,
5195 cast_or_null<ClassTemplatePartialSpecializationDecl>(PrevDecl)))
5200 if (!ClassTemplate->findPartialSpecialization(TemplateArgs, InsertPos))
5202 ClassTemplate->AddPartialSpecialization(
5203 cast<ClassTemplatePartialSpecializationDecl>(D2), InsertPos);
5206 if (GetImportedOrCreateDecl(
5207 D2, D, Importer.getToContext(), D->
getTagKind(), DC,
5208 *BeginLocOrErr, *IdLocOrErr, ClassTemplate, TemplateArgs,
5214 if (!ClassTemplate->findSpecialization(TemplateArgs, InsertPos))
5216 ClassTemplate->AddSpecialization(D2, InsertPos);
5233 return LocOrErr.takeError();
5236 if (
auto TInfoOrErr =
import(TSI))
5239 return TInfoOrErr.takeError();
5244 return LocOrErr.takeError();
5249 return LocOrErr.takeError();
5256 return POIOrErr.takeError();
5262 if (
Error Err = ImportDefinition(D, D2))
5263 return std::move(Err);
5277 Definition->getDescribedVarTemplate()))
5278 return Importer.MapImported(D, *ImportedDefOrErr);
5280 return ImportedDefOrErr.takeError();
5288 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
5289 return std::move(Err);
5295 "Variable templates cannot be declared at function scope");
5297 auto FoundDecls = Importer.findDeclsInToCtx(DC, Name);
5298 for (
auto *FoundDecl : FoundDecls) {
5302 Decl *Found = FoundDecl;
5303 if (
VarTemplateDecl *FoundTemplate = dyn_cast<VarTemplateDecl>(Found)) {
5304 if (IsStructuralMatch(D, FoundTemplate)) {
5307 FoundTemplate->getTemplatedDecl());
5308 return Importer.MapImported(D, FoundTemplate);
5312 ConflictingDecls.push_back(FoundDecl);
5315 if (!ConflictingDecls.empty()) {
5317 ConflictingDecls.data(),
5318 ConflictingDecls.size());
5330 ExpectedType TypeOrErr =
import(DTemplated->getType());
5332 return TypeOrErr.takeError();
5336 if (
Error Err = importInto(ToTemplated, DTemplated))
5337 return std::move(Err);
5341 if (!TemplateParamsOrErr)
5342 return TemplateParamsOrErr.takeError();
5345 if (GetImportedOrCreateDecl(ToVarTD, D, Importer.getToContext(), DC, Loc,
5346 Name, *TemplateParamsOrErr, ToTemplated))
5355 if (DTemplated->isThisDeclarationADefinition() &&
5369 if (Definition && Definition != D) {
5370 if (
ExpectedDecl ImportedDefOrErr =
import(Definition))
5371 return Importer.MapImported(D, *ImportedDefOrErr);
5373 return ImportedDefOrErr.takeError();
5378 return std::move(Err);
5382 if (
Error Err = ImportDeclContext(D, DC, LexicalDC))
5383 return std::move(Err);
5388 return BeginLocOrErr.takeError();
5392 return IdLocOrErr.takeError();
5396 if (
Error Err = ImportTemplateArguments(
5398 return std::move(Err);
5401 void *InsertPos =
nullptr;
5403 TemplateArgs, InsertPos);
5412 IsStructuralMatch(D, FoundDef)) {
5416 return Importer.MapImported(D, FoundDef);
5423 return std::move(Err);
5427 return TInfoOrErr.takeError();
5430 if (
Error Err = ImportTemplateArgumentListInfo(
5432 return std::move(Err);
5436 if (
auto *FromPartial = dyn_cast<PartVarSpecDecl>(D)) {
5439 const auto *FromTAArgsAsWritten = FromPartial->getTemplateArgsAsWritten();
5441 if (
Error Err = ImportTemplateArgumentListInfo(
5442 *FromTAArgsAsWritten, ArgInfos))
5443 return std::move(Err);
5445 auto ToTPListOrErr =
import(FromPartial->getTemplateParameters());
5447 return ToTPListOrErr.takeError();
5449 PartVarSpecDecl *ToPartial;
5450 if (GetImportedOrCreateDecl(ToPartial, D, Importer.getToContext(), DC,
5451 *BeginLocOrErr, *IdLocOrErr, *ToTPListOrErr,
5452 VarTemplate, T, *TInfoOrErr,
5457 FromPartial->getInstantiatedFromMember()))
5458 ToPartial->setInstantiatedFromMember(*ToInstOrErr);
5460 return ToInstOrErr.takeError();
5462 if (FromPartial->isMemberSpecialization())
5463 ToPartial->setMemberSpecialization();
5468 if (GetImportedOrCreateDecl(D2, D, Importer.getToContext(), DC,
5469 *BeginLocOrErr, *IdLocOrErr, VarTemplate,
5479 return POIOrErr.takeError();
5492 return LocOrErr.takeError();
5504 if (
Error Err = ImportInitializer(D, D2))
5505 return std::move(Err);
5517 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
5518 return std::move(Err);
5530 auto FoundDecls = Importer.findDeclsInToCtx(DC, Name);
5531 for (
auto *FoundDecl : FoundDecls) {
5535 if (
auto *FoundTemplate = dyn_cast<FunctionTemplateDecl>(FoundDecl)) {
5536 if (FoundTemplate->hasExternalFormalLinkage() &&
5538 if (IsStructuralMatch(D, FoundTemplate)) {
5542 return Importer.MapImported(D, TemplateWithDef);
5544 FoundByLookup = FoundTemplate;
5555 return ParamsOrErr.takeError();
5559 return std::move(Err);
5562 if (GetImportedOrCreateDecl(ToFunc, D, Importer.getToContext(), DC, Loc, Name,
5563 *ParamsOrErr, TemplatedFD))
5572 if (FoundByLookup) {
5577 "Found decl must have its templated decl set");
5578 auto *PrevTemplated =
5580 if (TemplatedFD != PrevTemplated)
5594 Importer.FromDiag(S->
getBeginLoc(), diag::err_unsupported_ast_node)
5601 if (Importer.returnWithErrorInTest())
5608 Names.push_back(ToII);
5611 for (
unsigned I = 0, E = S->
getNumInputs(); I != E; I++) {
5615 Names.push_back(ToII);
5621 Clobbers.push_back(*ClobberOrErr);
5623 return ClobberOrErr.takeError();
5630 Constraints.push_back(*OutputOrErr);
5632 return OutputOrErr.takeError();
5635 for (
unsigned I = 0, E = S->
getNumInputs(); I != E; I++) {
5637 Constraints.push_back(*InputOrErr);
5639 return InputOrErr.takeError();
5644 if (
Error Err = ImportContainerChecked(S->
outputs(), Exprs))
5645 return std::move(Err);
5649 return std::move(Err);
5651 if (
Error Err = ImportArrayChecked(
5653 return std::move(Err);
5657 return AsmLocOrErr.takeError();
5660 return AsmStrOrErr.takeError();
5662 if (!RParenLocOrErr)
5663 return RParenLocOrErr.takeError();
5665 return new (Importer.getToContext())
GCCAsmStmt(
5666 Importer.getToContext(),
5685 return Imp.takeError();
5689 std::tie(ToDG, ToBeginLoc, ToEndLoc) = *Imp;
5691 return new (Importer.getToContext())
DeclStmt(ToDG, ToBeginLoc, ToEndLoc);
5696 if (!ToSemiLocOrErr)
5697 return ToSemiLocOrErr.takeError();
5698 return new (Importer.getToContext())
NullStmt(
5705 if (
Error Err = ImportContainerChecked(S->
body(), ToStmts))
5706 return std::move(Err);
5709 if (!ToLBracLocOrErr)
5710 return ToLBracLocOrErr.takeError();
5713 if (!ToRBracLocOrErr)
5714 return ToRBracLocOrErr.takeError();
5717 Importer.getToContext(), ToStmts,
5718 *ToLBracLocOrErr, *ToRBracLocOrErr);
5722 auto Imp = importSeq(
5726 return Imp.takeError();
5728 Expr *ToLHS, *ToRHS;
5731 std::tie(ToLHS, ToRHS, ToSubStmt, ToCaseLoc, ToEllipsisLoc, ToColonLoc) =
5735 ToCaseLoc, ToEllipsisLoc, ToColonLoc);
5744 return Imp.takeError();
5748 std::tie(ToDefaultLoc, ToColonLoc, ToSubStmt) = *Imp;
5751 ToDefaultLoc, ToColonLoc, ToSubStmt);
5757 return Imp.takeError();
5762 std::tie(ToIdentLoc, ToLabelDecl, ToSubStmt) = *Imp;
5764 return new (Importer.getToContext())
LabelStmt(
5765 ToIdentLoc, ToLabelDecl, ToSubStmt);
5770 if (!ToAttrLocOrErr)
5771 return ToAttrLocOrErr.takeError();
5774 if (
Error Err = ImportContainerChecked(FromAttrs, ToAttrs))
5775 return std::move(Err);
5777 if (!ToSubStmtOrErr)
5778 return ToSubStmtOrErr.takeError();
5781 Importer.getToContext(), *ToAttrLocOrErr, ToAttrs, *ToSubStmtOrErr);
5785 auto Imp = importSeq(
5789 return Imp.takeError();
5792 Stmt *ToInit, *ToThen, *ToElse;
5796 ToIfLoc, ToInit, ToConditionVariable, ToCond, ToThen, ToElseLoc, ToElse) =
5800 ToInit, ToConditionVariable, ToCond, ToThen, ToElseLoc,
5805 auto Imp = importSeq(
5809 return Imp.takeError();
5811 Stmt *ToInit, *ToBody;
5815 std::tie(ToInit, ToConditionVariable, ToCond, ToBody, ToSwitchLoc) = *Imp;
5818 ToConditionVariable, ToCond);
5820 ToStmt->setSwitchLoc(ToSwitchLoc);
5828 return ToSCOrErr.takeError();
5829 if (LastChainedSwitchCase)
5832 ToStmt->setSwitchCaseList(*ToSCOrErr);
5833 LastChainedSwitchCase = *ToSCOrErr;
5840 auto Imp = importSeq(
5843 return Imp.takeError();
5849 std::tie(ToConditionVariable, ToCond, ToBody, ToWhileLoc) = *Imp;
5852 ToBody, ToWhileLoc);
5856 auto Imp = importSeq(
5860 return Imp.takeError();
5865 std::tie(ToBody, ToCond, ToDoLoc, ToWhileLoc, ToRParenLoc) = *Imp;
5867 return new (Importer.getToContext())
DoStmt(
5868 ToBody, ToCond, ToDoLoc, ToWhileLoc, ToRParenLoc);
5872 auto Imp = importSeq(
5876 return Imp.takeError();
5879 Expr *ToCond, *ToInc;
5884 ToInit, ToCond, ToConditionVariable, ToInc, ToBody, ToForLoc,
5885 ToLParenLoc, ToRParenLoc) = *Imp;
5887 return new (Importer.getToContext())
ForStmt(
5888 Importer.getToContext(),
5889 ToInit, ToCond, ToConditionVariable, ToInc, ToBody, ToForLoc, ToLParenLoc,
5896 return Imp.takeError();
5900 std::tie(ToLabel, ToGotoLoc, ToLabelLoc) = *Imp;
5902 return new (Importer.getToContext())
GotoStmt(
5903 ToLabel, ToGotoLoc, ToLabelLoc);
5909 return Imp.takeError();
5913 std::tie(ToGotoLoc, ToStarLoc, ToTarget) = *Imp;
5916 ToGotoLoc, ToStarLoc, ToTarget);
5921 if (!ToContinueLocOrErr)
5922 return ToContinueLocOrErr.takeError();
5923 return new (Importer.getToContext())
ContinueStmt(*ToContinueLocOrErr);
5928 if (!ToBreakLocOrErr)
5929 return ToBreakLocOrErr.takeError();
5930 return new (Importer.getToContext())
BreakStmt(*ToBreakLocOrErr);
5934 auto Imp = importSeq(
5937 return Imp.takeError();
5941 const VarDecl *ToNRVOCandidate;
5942 std::tie(ToReturnLoc, ToRetValue, ToNRVOCandidate) = *Imp;
5949 auto Imp = importSeq(
5952 return Imp.takeError();
5956 Stmt *ToHandlerBlock;
5957 std::tie(ToCatchLoc, ToExceptionDecl, ToHandlerBlock) = *Imp;
5960 ToCatchLoc, ToExceptionDecl, ToHandlerBlock);
5966 return ToTryLocOrErr.takeError();
5969 if (!ToTryBlockOrErr)
5970 return ToTryBlockOrErr.takeError();
5973 for (
unsigned HI = 0, HE = S->
getNumHandlers(); HI != HE; ++HI) {
5975 if (
auto ToHandlerOrErr =
import(FromHandler))
5976 ToHandlers[HI] = *ToHandlerOrErr;
5978 return ToHandlerOrErr.takeError();
5982 Importer.getToContext(), *ToTryLocOrErr,*ToTryBlockOrErr, ToHandlers);
5986 auto Imp1 = importSeq(
5990 return Imp1.takeError();
5991 auto Imp2 = importSeq(
5994 return Imp2.takeError();
5996 DeclStmt *ToRangeStmt, *ToBeginStmt, *ToEndStmt, *ToLoopVarStmt;
5997 Expr *ToCond, *ToInc;
5998 Stmt *ToInit, *ToBody;
6000 ToInit, ToRangeStmt, ToBeginStmt, ToEndStmt, ToCond, ToInc, ToLoopVarStmt,
6003 std::tie(ToForLoc, ToCoawaitLoc, ToColonLoc, ToRParenLoc) = *Imp2;
6006 ToInit, ToRangeStmt, ToBeginStmt, ToEndStmt, ToCond, ToInc, ToLoopVarStmt,
6007 ToBody, ToForLoc, ToCoawaitLoc, ToColonLoc, ToRParenLoc);
6012 auto Imp = importSeq(
6016 return Imp.takeError();
6018 Stmt *ToElement, *ToBody;
6021 std::tie(ToElement, ToCollection, ToBody, ToForLoc, ToRParenLoc) = *Imp;
6031 auto Imp = importSeq(
6035 return Imp.takeError();
6040 std::tie(ToAtCatchLoc, ToRParenLoc, ToCatchParamDecl, ToCatchBody) = *Imp;
6043 ToAtCatchLoc, ToRParenLoc, ToCatchParamDecl, ToCatchBody);
6048 if (!ToAtFinallyLocOrErr)
6049 return ToAtFinallyLocOrErr.takeError();
6051 if (!ToAtFinallyStmtOrErr)
6052 return ToAtFinallyStmtOrErr.takeError();
6054 *ToAtFinallyStmtOrErr);
6058 auto Imp = importSeq(
6061 return Imp.takeError();
6064 Stmt *ToTryBody, *ToFinallyStmt;
6065 std::tie(ToAtTryLoc, ToTryBody, ToFinallyStmt) = *Imp;
6070 if (
ExpectedStmt ToCatchStmtOrErr =
import(FromCatchStmt))
6071 ToCatchStmts[CI] = *ToCatchStmtOrErr;
6073 return ToCatchStmtOrErr.takeError();
6077 ToAtTryLoc, ToTryBody,
6078 ToCatchStmts.begin(), ToCatchStmts.size(),
6084 auto Imp = importSeq(
6087 return Imp.takeError();
6092 std::tie(ToAtSynchronizedLoc, ToSynchExpr, ToSynchBody) = *Imp;
6095 ToAtSynchronizedLoc, ToSynchExpr, ToSynchBody);
6100 if (!ToThrowLocOrErr)
6101 return ToThrowLocOrErr.takeError();
6103 if (!ToThrowExprOrErr)
6104 return ToThrowExprOrErr.takeError();
6106 *ToThrowLocOrErr, *ToThrowExprOrErr);
6113 return ToAtLocOrErr.takeError();
6115 if (!ToSubStmtOrErr)
6116 return ToSubStmtOrErr.takeError();
6125 Importer.FromDiag(E->
getBeginLoc(), diag::err_unsupported_ast_node)
6131 auto Imp = importSeq(
6135 return Imp.takeError();
6141 std::tie(ToBuiltinLoc, ToSubExpr, ToWrittenTypeInfo, ToRParenLoc, ToType) =
6144 return new (Importer.getToContext())
VAArgExpr(
6145 ToBuiltinLoc, ToSubExpr, ToWrittenTypeInfo, ToRParenLoc, ToType,
6153 return Imp.takeError();
6160 std::tie(ToCond, ToLHS, ToRHS, ToBuiltinLoc, ToRParenLoc, ToType) = *Imp;
6172 return new (Importer.getToContext())
6173 ChooseExpr(ToBuiltinLoc, ToCond, ToLHS, ToRHS, ToType, VK, OK,
6174 ToRParenLoc, CondIsTrue, TypeDependent, ValueDependent);
6180 return TypeOrErr.takeError();
6184 return BeginLocOrErr.takeError();
6186 return new (Importer.getToContext())
GNUNullExpr(*TypeOrErr, *BeginLocOrErr);
6190 auto Imp = importSeq(
6193 return Imp.takeError();
6198 std::tie(ToBeginLoc, ToType, ToFunctionName) = *Imp;
6205 auto Imp = importSeq(
6209 return Imp.takeError();
6215 std::tie(ToQualifierLoc, ToTemplateKeywordLoc, ToDecl, ToLocation, ToType) =
6222 return FoundDOrErr.takeError();
6223 ToFoundD = *FoundDOrErr;
6231 return std::move(Err);
6232 ToResInfo = &ToTAInfo;
6236 Importer.getToContext(), ToQualifierLoc, ToTemplateKeywordLoc, ToDecl,
6247 return TypeOrErr.takeError();
6255 return ToInitOrErr.takeError();
6258 if (!ToEqualOrColonLocOrErr)
6259 return ToEqualOrColonLocOrErr.takeError();
6265 ToIndexExprs[I - 1] = *ToArgOrErr;
6267 return ToArgOrErr.takeError();
6272 return std::move(Err);
6275 Importer.getToContext(), ToDesignators,
6276 ToIndexExprs, *ToEqualOrColonLocOrErr,
6284 return ToTypeOrErr.takeError();
6287 if (!ToLocationOrErr)
6288 return ToLocationOrErr.takeError();
6291 *ToTypeOrErr, *ToLocationOrErr);
6297 return ToTypeOrErr.takeError();
6300 if (!ToLocationOrErr)
6301 return ToLocationOrErr.takeError();
6304 Importer.getToContext(), E->
getValue(), *ToTypeOrErr, *ToLocationOrErr);
6311 return ToTypeOrErr.takeError();
6314 if (!ToLocationOrErr)
6315 return ToLocationOrErr.takeError();
6319 *ToTypeOrErr, *ToLocationOrErr);
6323 auto ToTypeOrErr =
import(E->
getType());
6325 return ToTypeOrErr.takeError();
6328 if (!ToSubExprOrErr)
6329 return ToSubExprOrErr.takeError();
6332 *ToSubExprOrErr, *ToTypeOrErr);
6338 return ToTypeOrErr.takeError();
6341 if (!ToLocationOrErr)
6342 return ToLocationOrErr.takeError();
6351 return ToTypeOrErr.takeError();
6354 if (
Error Err = ImportArrayChecked(
6356 return std::move(Err);
6360 *ToTypeOrErr, ToLocations.data(), ToLocations.size());
6364 auto Imp = importSeq(
6368 return Imp.takeError();
6373 Expr *ToInitializer;
6374 std::tie(ToLParenLoc, ToTypeSourceInfo, ToType, ToInitializer) = *Imp;
6377 ToLParenLoc, ToTypeSourceInfo, ToType, E->
getValueKind(),
6382 auto Imp = importSeq(
6385 return Imp.takeError();
6389 std::tie(ToBuiltinLoc, ToType, ToRParenLoc) = *Imp;
6392 if (
Error Err = ImportArrayChecked(
6395 return std::move(Err);
6397 return new (Importer.getToContext())
AtomicExpr(
6398 ToBuiltinLoc, ToExprs, ToType, E->
getOp(), ToRParenLoc);
6402 auto Imp = importSeq(
6405 return Imp.takeError();
6410 std::tie(ToAmpAmpLoc, ToLabelLoc, ToLabel, ToType) = *Imp;
6413 ToAmpAmpLoc, ToLabelLoc, ToLabel, ToType);
6419 return Imp.takeError();
6422 std::tie(ToSubExpr) = *Imp;
6437 return Imp.takeError();
6441 std::tie(ToLParen, ToRParen, ToSubExpr) = *Imp;
6443 return new (Importer.getToContext())
6444 ParenExpr(ToLParen, ToRParen, ToSubExpr);
6449 if (
Error Err = ImportContainerChecked(E->
exprs(), ToExprs))
6450 return std::move(Err);
6453 if (!ToLParenLocOrErr)
6454 return ToLParenLocOrErr.takeError();
6457 if (!ToRParenLocOrErr)
6458 return ToRParenLocOrErr.takeError();
6461 ToExprs, *ToRParenLocOrErr);
6465 auto Imp = importSeq(
6468 return Imp.takeError();
6473 std::tie(ToSubStmt, ToType, ToLParenLoc, ToRParenLoc) = *Imp;
6475 return new (Importer.getToContext())
StmtExpr(
6476 ToSubStmt, ToType, ToLParenLoc, ToRParenLoc);
6480 auto Imp = importSeq(
6483 return Imp.takeError();
6488 std::tie(ToSubExpr, ToType, ToOperatorLoc) = *Imp;
6499 return Imp.takeError();
6503 std::tie(ToType, ToOperatorLoc, ToRParenLoc) = *Imp;
6508 if (!ToArgumentTypeInfoOrErr)
6509 return ToArgumentTypeInfoOrErr.takeError();
6512 E->
getKind(), *ToArgumentTypeInfoOrErr, ToType, ToOperatorLoc,
6517 if (!ToArgumentExprOrErr)
6518 return ToArgumentExprOrErr.takeError();
6521 E->
getKind(), *ToArgumentExprOrErr, ToType, ToOperatorLoc, ToRParenLoc);
6525 auto Imp = importSeq(
6528 return Imp.takeError();
6530 Expr *ToLHS, *ToRHS;
6533 std::tie(ToLHS, ToRHS, ToType, ToOperatorLoc) = *Imp;
6541 auto Imp = importSeq(
6545 return Imp.takeError();
6547 Expr *ToCond, *ToLHS, *ToRHS;
6550 std::tie(ToCond, ToQuestionLoc, ToLHS, ToColonLoc, ToRHS, ToType) = *Imp;
6553 ToCond, ToQuestionLoc, ToLHS, ToColonLoc, ToRHS, ToType,
6559 auto Imp = importSeq(
6563 return Imp.takeError();
6565 Expr *ToCommon, *ToCond, *ToTrueExpr, *ToFalseExpr;
6570 ToCommon, ToOpaqueValue, ToCond, ToTrueExpr, ToFalseExpr, ToQuestionLoc,
6571 ToColonLoc, ToType) = *Imp;
6574 ToCommon, ToOpaqueValue, ToCond, ToTrueExpr, ToFalseExpr,
6580 auto Imp = importSeq(
6584 return Imp.takeError();
6588 Expr *ToDimensionExpression;
6591 ToBeginLoc, ToQueriedTypeSourceInfo, ToDimensionExpression, ToEndLoc,
6596 ToDimensionExpression, ToEndLoc, ToType);
6600 auto Imp = importSeq(
6603 return Imp.takeError();
6606 Expr *ToQueriedExpression;
6608 std::tie(ToBeginLoc, ToQueriedExpression, ToEndLoc, ToType) = *Imp;
6616 auto Imp = importSeq(
6619 return Imp.takeError();
6624 std::tie(ToLocation, ToType, ToSourceExpr) = *Imp;
6631 auto Imp = importSeq(
6634 return Imp.takeError();
6636 Expr *ToLHS, *ToRHS;
6639 std::tie(ToLHS, ToRHS, ToType, ToRBracketLoc) = *Imp;
6648 auto Imp = importSeq(
6652 return Imp.takeError();
6654 Expr *ToLHS, *ToRHS;
6655 QualType ToType, ToComputationLHSType, ToComputationResultType;
6657 std::tie(ToLHS, ToRHS, ToType, ToComputationLHSType, ToComputationResultType,
6658 ToOperatorLoc) = *Imp;
6662 E->
getObjectKind(), ToComputationLHSType, ToComputationResultType,
6670 if (
auto SpecOrErr =
import(*I))
6671 Path.push_back(*SpecOrErr);
6673 return SpecOrErr.takeError();
6681 return ToTypeOrErr.takeError();
6684 if (!ToSubExprOrErr)
6685 return ToSubExprOrErr.takeError();
6688 if (!ToBasePathOrErr)
6689 return ToBasePathOrErr.takeError();
6692 Importer.getToContext(), *ToTypeOrErr, E->
getCastKind(), *ToSubExprOrErr,
6697 auto Imp1 = importSeq(
6700 return Imp1.takeError();
6705 std::tie(ToType, ToSubExpr, ToTypeInfoAsWritten) = *Imp1;
6708 if (!ToBasePathOrErr)
6709 return ToBasePathOrErr.takeError();
6713 case Stmt::CStyleCastExprClass: {
6714 auto *CCE = cast<CStyleCastExpr>(E);
6715 ExpectedSLoc ToLParenLocOrErr =
import(CCE->getLParenLoc());
6716 if (!ToLParenLocOrErr)
6717 return ToLParenLocOrErr.takeError();
6718 ExpectedSLoc ToRParenLocOrErr =
import(CCE->getRParenLoc());
6719 if (!ToRParenLocOrErr)
6720 return ToRParenLocOrErr.takeError();
6723 ToSubExpr, ToBasePath, ToTypeInfoAsWritten, *ToLParenLocOrErr,
6727 case Stmt::CXXFunctionalCastExprClass: {
6728 auto *FCE = cast<CXXFunctionalCastExpr>(E);
6729 ExpectedSLoc ToLParenLocOrErr =
import(FCE->getLParenLoc());
6730 if (!ToLParenLocOrErr)
6731 return ToLParenLocOrErr.takeError();
6732 ExpectedSLoc ToRParenLocOrErr =
import(FCE->getRParenLoc());
6733 if (!ToRParenLocOrErr)
6734 return ToRParenLocOrErr.takeError();
6736 Importer.getToContext(), ToType, E->
getValueKind(), ToTypeInfoAsWritten,
6737 E->
getCastKind(), ToSubExpr, ToBasePath, *ToLParenLocOrErr,
6741 case Stmt::ObjCBridgedCastExprClass: {
6742 auto *OCE = cast<ObjCBridgedCastExpr>(E);
6743 ExpectedSLoc ToLParenLocOrErr =
import(OCE->getLParenLoc());
6744 if (!ToLParenLocOrErr)
6745 return ToLParenLocOrErr.takeError();
6746 ExpectedSLoc ToBridgeKeywordLocOrErr =
import(OCE->getBridgeKeywordLoc());
6747 if (!ToBridgeKeywordLocOrErr)
6748 return ToBridgeKeywordLocOrErr.takeError();
6750 *ToLParenLocOrErr, OCE->getBridgeKind(), E->
getCastKind(),
6751 *ToBridgeKeywordLocOrErr, ToTypeInfoAsWritten, ToSubExpr);
6754 llvm_unreachable(
"Cast expression of unsupported type!");
6768 return Imp.takeError();
6769 std::tie(ToBeginLoc, ToEndLoc) = *Imp;
6778 auto ToBSOrErr =
import(FromNode.
getBase());
6780 return ToBSOrErr.takeError();
6785 auto ToFieldOrErr =
import(FromNode.
getField());
6787 return ToFieldOrErr.takeError();
6788 ToNodes.push_back(
OffsetOfNode(ToBeginLoc, *ToFieldOrErr, ToEndLoc));
6793 ToNodes.push_back(
OffsetOfNode(ToBeginLoc, ToII, ToEndLoc));
6802 if (!ToIndexExprOrErr)
6803 return ToIndexExprOrErr.takeError();
6804 ToExprs[I] = *ToIndexExprOrErr;
6807 auto Imp = importSeq(
6811 return Imp.takeError();
6816 std::tie(ToType, ToTypeSourceInfo, ToOperatorLoc, ToRParenLoc) = *Imp;
6819 Importer.getToContext(), ToType, ToOperatorLoc, ToTypeSourceInfo, ToNodes,
6820 ToExprs, ToRParenLoc);
6824 auto Imp = importSeq(
6827 return Imp.takeError();
6832 std::tie(ToType, ToOperand, ToBeginLoc, ToEndLoc) = *Imp;
6841 ToType, ToOperand, ToCanThrow, ToBeginLoc, ToEndLoc);
6847 return Imp.takeError();
6852 std::tie(ToSubExpr, ToType, ToThrowLoc) = *Imp;
6860 if (!ToUsedLocOrErr)
6861 return ToUsedLocOrErr.takeError();
6863 auto ToParamOrErr =
import(E->
getParam());
6865 return ToParamOrErr.takeError();
6867 auto UsedContextOrErr = Importer.ImportContext(E->
getUsedContext());
6868 if (!UsedContextOrErr)
6869 return UsedContextOrErr.takeError();
6872 Importer.getToContext(), *ToUsedLocOrErr, *ToParamOrErr, *UsedContextOrErr);
6877 auto Imp = importSeq(
6880 return Imp.takeError();
6885 std::tie(ToType, ToTypeSourceInfo, ToRParenLoc) = *Imp;
6888 ToType, ToTypeSourceInfo, ToRParenLoc);
6894 if (!ToSubExprOrErr)
6895 return ToSubExprOrErr.takeError();
6899 return ToDtorOrErr.takeError();
6908 auto Imp = importSeq(
6912 return Imp.takeError();
6918 std::tie(ToConstructor, ToType, ToTypeSourceInfo, ToParenOrBraceRange) = *Imp;
6922 return std::move(Err);
6925 Importer.getToContext(), ToConstructor, ToType, ToTypeSourceInfo, ToArgs,
6933 auto Imp = importSeq(
6936 return Imp.takeError();
6939 Expr *ToTemporaryExpr;
6941 std::tie(ToType, ToTemporaryExpr, ToExtendingDecl) = *Imp;
6952 auto Imp = importSeq(
6955 return Imp.takeError();
6960 std::tie(ToType, ToPattern, ToEllipsisLoc) = *Imp;
6967 auto Imp = importSeq(
6970 return Imp.takeError();
6974 std::tie(ToOperatorLoc, ToPack, ToPackLoc, ToRParenLoc) = *Imp;
6982 if (
Error Err = ImportTemplateArguments(
6985 ToPartialArguments))
6986 return std::move(Err);
6990 Importer.getToContext(), ToOperatorLoc, ToPack, ToPackLoc, ToRParenLoc,
6991 Length, ToPartialArguments);
6996 auto Imp = importSeq(
7002 return Imp.takeError();
7005 SourceRange ToTypeIdParens, ToSourceRange, ToDirectInitRange;
7007 Expr *ToInitializer;
7011 ToOperatorNew, ToOperatorDelete, ToTypeIdParens, ToArraySize, ToInitializer,
7012 ToType, ToAllocatedTypeSourceInfo, ToSourceRange, ToDirectInitRange) = *Imp;
7017 return std::move(Err);
7020 Importer.getToContext(), E->
isGlobalNew(), ToOperatorNew,
7023 ToInitializer, ToType, ToAllocatedTypeSourceInfo, ToSourceRange,
7028 auto Imp = importSeq(
7031 return Imp.takeError();
7037 std::tie(ToType, ToOperatorDelete, ToArgument, ToBeginLoc) = *Imp;
7046 auto Imp = importSeq(
7050 return Imp.takeError();
7056 std::tie(ToType, ToLocation, ToConstructor, ToParenOrBraceRange) = *Imp;
7060 return std::move(Err);
7063 Importer.getToContext(), ToType, ToLocation, ToConstructor,
7067 ToParenOrBraceRange);
7072 if (!ToSubExprOrErr)
7073 return ToSubExprOrErr.takeError();
7077 return std::move(Err);
7085 auto Imp = importSeq(
7088 return Imp.takeError();
7093 std::tie(ToCallee, ToType, ToRParenLoc) = *Imp;
7097 return std::move(Err);
7106 return ToTypeOrErr.takeError();
7109 if (!ToLocationOrErr)
7110 return ToLocationOrErr.takeError();
7113 *ToLocationOrErr, *ToTypeOrErr, E->
isImplicit());
7119 return ToTypeOrErr.takeError();
7122 if (!ToLocationOrErr)
7123 return ToLocationOrErr.takeError();
7126 E->
getValue(), *ToTypeOrErr, *ToLocationOrErr);
7130 auto Imp1 = importSeq(
7134 return Imp1.takeError();
7142 ToBase, ToOperatorLoc, ToQualifierLoc, ToTemplateKeywordLoc, ToMemberDecl,
7145 auto Imp2 = importSeq(
7149 return Imp2.takeError();
7153 std::tie(ToDecl, ToName, ToLoc, ToLAngleLoc, ToRAngleLoc) = *Imp2;
7165 return std::move(Err);
7166 ResInfo = &ToTAInfo;
7170 ToOperatorLoc, ToQualifierLoc, ToTemplateKeywordLoc,
7171 ToMemberDecl, ToFoundDecl, ToMemberNameInfo,
7178 auto Imp = importSeq(
7182 return Imp.takeError();
7189 ToBase, ToOperatorLoc, ToQualifierLoc, ToScopeTypeInfo, ToColonColonLoc,
7196 if (!ToDestroyedTypeLocOrErr)
7197 return ToDestroyedTypeLocOrErr.takeError();
7203 return ToTIOrErr.takeError();
7207 Importer.getToContext(), ToBase, E->
isArrow(), ToOperatorLoc,
7208 ToQualifierLoc, ToScopeTypeInfo, ToColonColonLoc, ToTildeLoc, Storage);
7213 auto Imp = importSeq(
7217 return Imp.takeError();
7222 NamedDecl *ToFirstQualifierFoundInScope;
7224 ToType, ToOperatorLoc, ToQualifierLoc, ToTemplateKeywordLoc,
7225 ToFirstQualifierFoundInScope) = *Imp;
7227 Expr *ToBase =
nullptr;
7230 ToBase = *ToBaseOrErr;
7232 return ToBaseOrErr.takeError();
7237 if (
Error Err = ImportTemplateArgumentListInfo(
7240 return std::move(Err);
7241 ResInfo = &ToTAInfo;
7245 if (!ToMemberNameInfoOrErr)
7246 return ToMemberNameInfoOrErr.takeError();
7248 std::get<0>(*ToMemberNameInfoOrErr), std::get<1>(*ToMemberNameInfoOrErr));
7250 if (
Error Err = ImportDeclarationNameLoc(
7252 return std::move(Err);
7255 Importer.getToContext(), ToBase, ToType, E->
isArrow(), ToOperatorLoc,
7256 ToQualifierLoc, ToTemplateKeywordLoc, ToFirstQualifierFoundInScope,
7257 ToMemberNameInfo, ResInfo);
7262 auto Imp = importSeq(
7266 return Imp.takeError();
7269 SourceLocation ToTemplateKeywordLoc, ToExprLoc, ToLAngleLoc, ToRAngleLoc;
7272 ToQualifierLoc, ToTemplateKeywordLoc, ToDeclName, ToExprLoc,
7273 ToLAngleLoc, ToRAngleLoc) = *Imp;
7277 return std::move(Err);
7284 return std::move(Err);
7285 ResInfo = &ToTAInfo;
7289 Importer.getToContext(), ToQualifierLoc, ToTemplateKeywordLoc,
7290 ToNameInfo, ResInfo);
7295 auto Imp = importSeq(
7298 return Imp.takeError();
7302 std::tie(ToLParenLoc, ToRParenLoc, ToTypeSourceInfo) = *Imp;
7307 return std::move(Err);
7310 Importer.getToContext(), ToTypeSourceInfo, ToLParenLoc,
7311 llvm::makeArrayRef(ToArgs), ToRParenLoc);
7317 if (!ToNamingClassOrErr)
7318 return ToNamingClassOrErr.takeError();
7321 if (!ToQualifierLocOrErr)
7322 return ToQualifierLocOrErr.takeError();
7325 if (!ToNameInfoOrErr)
7326 return ToNameInfoOrErr.takeError();
7328 std::get<0>(*ToNameInfoOrErr), std::get<1>(*ToNameInfoOrErr));
7331 return std::move(Err);
7334 for (
auto *D : E->
decls())
7335 if (
auto ToDOrErr =
import(D))
7336 ToDecls.
addDecl(cast<NamedDecl>(*ToDOrErr));
7338 return ToDOrErr.takeError();
7342 if (
Error Err = ImportTemplateArgumentListInfo(
7345 return std::move(Err);
7348 if (!ToTemplateKeywordLocOrErr)
7349 return ToTemplateKeywordLocOrErr.takeError();
7352 Importer.getToContext(), *ToNamingClassOrErr, *ToQualifierLocOrErr,
7353 *ToTemplateKeywordLocOrErr, ToNameInfo, E->
requiresADL(), &ToTAInfo,
7358 Importer.getToContext(), *ToNamingClassOrErr, *ToQualifierLocOrErr,
7365 auto Imp1 = importSeq(
7369 return Imp1.takeError();
7374 std::tie(ToType, ToOperatorLoc, ToQualifierLoc, ToTemplateKeywordLoc) = *Imp1;
7378 return Imp2.takeError();
7382 return std::move(Err);
7386 if (
auto ToDOrErr =
import(D))
7387 ToDecls.
addDecl(cast<NamedDecl>(*ToDOrErr));
7389 return ToDOrErr.takeError();
7396 return std::move(Err);
7397 ResInfo = &ToTAInfo;
7400 Expr *ToBase =
nullptr;
7403 ToBase = *ToBaseOrErr;
7405 return ToBaseOrErr.takeError();
7410 E->
isArrow(), ToOperatorLoc, ToQualifierLoc, ToTemplateKeywordLoc,
7411 ToNameInfo, ResInfo, ToDecls.
begin(), ToDecls.
end());
7417 return Imp.takeError();
7422 std::tie(ToCallee, ToType, ToRParenLoc) = *Imp;
7427 return std::move(Err);
7429 if (
const auto *OCE = dyn_cast<CXXOperatorCallExpr>(E)) {
7431 Importer.getToContext(), OCE->getOperator(), ToCallee, ToArgs, ToType,
7432 OCE->getValueKind(), ToRParenLoc, OCE->getFPFeatures(),
7433 OCE->getADLCallKind());
7443 auto ToClassOrErr =
import(FromClass);
7445 return ToClassOrErr.takeError();
7450 return ToCallOpOrErr.takeError();
7454 for (
const auto &FromCapture : E->
captures()) {
7455 if (
auto ToCaptureOrErr =
import(FromCapture))
7456 ToCaptures.push_back(*ToCaptureOrErr);
7458 return ToCaptureOrErr.takeError();
7463 return std::move(Err);
7465 auto Imp = importSeq(
7468 return Imp.takeError();
7472 std::tie(ToIntroducerRange, ToCaptureDefaultLoc, ToEndLoc) = *Imp;
7475 Importer.getToContext(), ToClass, ToIntroducerRange,
7485 return Imp.takeError();
7489 std::tie(ToLBraceLoc, ToRBraceLoc, ToType) = *Imp;
7492 if (
Error Err = ImportContainerChecked(E->
inits(), ToExprs))
7493 return std::move(Err);
7497 ToCtx, ToLBraceLoc, ToExprs, ToRBraceLoc);
7504 return ToFillerOrErr.takeError();
7508 if (
auto ToFDOrErr =
import(FromFD))
7511 return ToFDOrErr.takeError();
7515 if (
auto ToSyntFormOrErr =
import(SyntForm))
7518 return ToSyntFormOrErr.takeError();
7532 return ToTypeOrErr.takeError();
7535 if (!ToSubExprOrErr)
7536 return ToSubExprOrErr.takeError();
7539 *ToTypeOrErr, *ToSubExprOrErr);
7546 return Imp.takeError();
7551 std::tie(ToLocation, ToType, ToConstructor) = *Imp;
7561 return Imp.takeError();
7564 Expr *ToCommonExpr, *ToSubExpr;
7565 std::tie(ToType, ToCommonExpr, ToSubExpr) = *Imp;
7568 ToType, ToCommonExpr, ToSubExpr);
7574 return ToTypeOrErr.takeError();
7580 if (!ToBeginLocOrErr)
7581 return ToBeginLocOrErr.takeError();
7583 auto ToFieldOrErr =
import(E->
getField());
7585 return ToFieldOrErr.takeError();
7587 auto UsedContextOrErr = Importer.ImportContext(E->
getUsedContext());
7588 if (!UsedContextOrErr)
7589 return UsedContextOrErr.takeError();
7592 Importer.getToContext(), *ToBeginLocOrErr, *ToFieldOrErr, *UsedContextOrErr);
7596 auto Imp = importSeq(
7600 return Imp.takeError();
7608 ToType, ToSubExpr, ToTypeInfoAsWritten, ToOperatorLoc, ToRParenLoc,
7609 ToAngleBrackets) = *Imp;
7613 auto ToBasePathOrErr = ImportCastPath(E);
7614 if (!ToBasePathOrErr)
7615 return ToBasePathOrErr.takeError();
7617 if (isa<CXXStaticCastExpr>(E)) {
7619 Importer.getToContext(), ToType, VK, CK, ToSubExpr, &(*ToBasePathOrErr),
7620 ToTypeInfoAsWritten, ToOperatorLoc, ToRParenLoc, ToAngleBrackets);
7621 }
else if (isa<CXXDynamicCastExpr>(E)) {
7623 Importer.getToContext(), ToType, VK, CK, ToSubExpr, &(*ToBasePathOrErr),
7624 ToTypeInfoAsWritten, ToOperatorLoc, ToRParenLoc, ToAngleBrackets);
7625 }
else if (isa<CXXReinterpretCastExpr>(E)) {
7627 Importer.getToContext(), ToType, VK, CK, ToSubExpr, &(*ToBasePathOrErr),
7628 ToTypeInfoAsWritten, ToOperatorLoc, ToRParenLoc, ToAngleBrackets);
7629 }
else if (isa<CXXConstCastExpr>(E)) {
7631 Importer.getToContext(), ToType, VK, ToSubExpr, ToTypeInfoAsWritten,
7632 ToOperatorLoc, ToRParenLoc, ToAngleBrackets);
7634 llvm_unreachable(
"Unknown cast type");
7635 return make_error<ImportError>();
7641 auto Imp = importSeq(
7644 return Imp.takeError();
7649 Expr *ToReplacement;
7650 std::tie(ToType, ToExprLoc, ToParameter, ToReplacement) = *Imp;
7653 ToType, E->
getValueKind(), ToExprLoc, ToParameter, ToReplacement);
7657 auto Imp = importSeq(
7660 return Imp.takeError();
7664 std::tie(ToType, ToBeginLoc, ToEndLoc) = *Imp;
7667 if (
Error Err = ImportContainerChecked(E->
getArgs(), ToArgs))
7668 return std::move(Err);
7675 Importer.getToContext(), ToType, ToBeginLoc, E->
getTrait(), ToArgs,
7682 return ToTypeOrErr.takeError();
7685 if (!ToSourceRangeOrErr)
7686 return ToSourceRangeOrErr.takeError();
7691 *ToTypeOrErr, *ToTSIOrErr, *ToSourceRangeOrErr);
7693 return ToTSIOrErr.takeError();
7697 if (!ToExprOperandOrErr)
7698 return ToExprOperandOrErr.takeError();
7701 *ToTypeOrErr, *ToExprOperandOrErr, *ToSourceRangeOrErr);
7707 if (
auto ImportedOrErr =
import(FromOverriddenMethod))
7709 (*ImportedOrErr)->getCanonicalDecl()));
7711 consumeError(ImportedOrErr.takeError());
7718 std::shared_ptr<ASTImporterSharedState> SharedState)
7719 : SharedState(SharedState), ToContext(ToContext), FromContext(FromContext),
7720 ToFileManager(ToFileManager), FromFileManager(FromFileManager),
7725 this->SharedState = std::make_shared<ASTImporterSharedState>();
7735 assert(F && (isa<FieldDecl>(*F) || isa<IndirectFieldDecl>(*F)) &&
7736 "Try to get field index for non-field.");
7743 for (
const auto *D : Owner->decls()) {
7747 if (isa<FieldDecl>(*D) || isa<IndirectFieldDecl>(*D))
7751 llvm_unreachable(
"Field was not found in its parent context.");
7766 if (SharedState->getLookupTable()) {
7768 SharedState->getLookupTable()->lookup(ReDC, Name);
7769 return FoundDeclsTy(LookupResult.begin(), LookupResult.end());
7789 void ASTImporter::AddToLookupTable(
Decl *ToD) {
7790 SharedState->addDeclToLookup(ToD);
7796 return Importer.
Visit(FromD);
7810 llvm::DenseMap<const Type *, const Type *>::iterator Pos
7811 = ImportedTypes.find(FromTy);
7812 if (Pos != ImportedTypes.end())
7819 return ToTOrErr.takeError();
7822 ImportedTypes[FromTy] = (*ToTOrErr).getTypePtr();
7835 return TOrErr.takeError();
7838 return BeginLocOrErr.takeError();
7844 Attr *ToAttr = FromAttr->
clone(ToContext);
7848 return ToRangeOrErr.takeError();
7854 auto Pos = ImportedDecls.find(FromD);
7855 if (Pos != ImportedDecls.end())
7862 auto FromDPos = ImportedFromDecls.find(ToD);
7863 if (FromDPos == ImportedFromDecls.end())
7865 return FromDPos->second->getTranslationUnitDecl();
7873 ImportPath.
push(FromD);
7874 auto ImportPathBuilder =
7875 llvm::make_scope_exit([
this]() { ImportPath.
pop(); });
7880 return make_error<ImportError>(*
Error);
7886 if (
auto Error = SharedState->getImportDeclErrorIfAny(ToD)) {
7888 return make_error<ImportError>(*Error);
7905 auto Pos = ImportedDecls.find(FromD);
7906 if (Pos != ImportedDecls.end()) {
7909 auto *ToD = Pos->second;
7910 ImportedDecls.erase(Pos);
7922 auto PosF = ImportedFromDecls.find(ToD);
7923 if (PosF != ImportedFromDecls.end()) {
7924 SharedState->removeDeclFromLookup(ToD);
7925 ImportedFromDecls.erase(PosF);
7937 handleAllErrors(ToDOrErr.takeError(),
7941 if (Pos != ImportedDecls.end())
7942 SharedState->setImportDeclError(Pos->second, ErrOut);
7946 for (
const auto &Path : SavedImportPaths[FromD])
7947 for (
Decl *FromDi : Path) {
7951 auto Ii = ImportedDecls.find(FromDi);
7952 if (Ii != ImportedDecls.end())
7953 SharedState->setImportDeclError(Ii->second, ErrOut);
7957 SavedImportPaths[FromD].clear();
7960 return make_error<ImportError>(ErrOut);
7972 return make_error<ImportError>(*Err);
7978 if (
auto Error = SharedState->getImportDeclErrorIfAny(ToD)) {
7980 return make_error<ImportError>(*Error);
7984 assert(ImportedDecls.count(FromD) != 0 &&
"Missing call to MapImported?");
7990 SavedImportPaths[FromD].clear();
8000 return ToDCOrErr.takeError();
8001 auto *ToDC = cast<DeclContext>(*ToDCOrErr);
8005 if (
auto *ToRecord = dyn_cast<RecordDecl>(ToDC)) {
8006 auto *FromRecord = cast<RecordDecl>(FromDC);
8007 if (ToRecord->isCompleteDefinition()) {
8009 }
else if (FromRecord->isCompleteDefinition()) {
8012 return std::move(Err);
8016 }
else if (
auto *ToEnum = dyn_cast<EnumDecl>(ToDC)) {
8017 auto *FromEnum = cast<EnumDecl>(FromDC);
8018 if (ToEnum->isCompleteDefinition()) {
8020 }
else if (FromEnum->isCompleteDefinition()) {
8023 return std::move(Err);
8027 }
else if (
auto *ToClass = dyn_cast<ObjCInterfaceDecl>(ToDC)) {
8028 auto *FromClass = cast<ObjCInterfaceDecl>(FromDC);
8029 if (ToClass->getDefinition()) {
8034 return std::move(Err);
8038 }
else if (
auto *ToProto = dyn_cast<ObjCProtocolDecl>(ToDC)) {
8039 auto *FromProto = cast<ObjCProtocolDecl>(FromDC);
8040 if (ToProto->getDefinition()) {
8045 return std::move(Err);
8056 return cast_or_null<Expr>(*ToSOrErr);
8058 return ToSOrErr.takeError();
8066 llvm::DenseMap<Stmt *, Stmt *>::iterator Pos = ImportedStmts.find(FromS);
8067 if (Pos != ImportedStmts.end())
8076 if (
auto *ToE = dyn_cast<Expr>(*ToSOrErr)) {
8077 auto *FromE = cast<Expr>(FromS);
8080 ToE->setValueKind(FromE->getValueKind());
8081 ToE->setObjectKind(FromE->getObjectKind());
8082 ToE->setTypeDependent(FromE->isTypeDependent());
8083 ToE->setValueDependent(FromE->isValueDependent());
8084 ToE->setInstantiationDependent(FromE->isInstantiationDependent());
8085 ToE->setContainsUnexpandedParameterPack(
8086 FromE->containsUnexpandedParameterPack());
8090 ImportedStmts[FromS] = *ToSOrErr;
8101 return std::move(Err);
8105 assert(FromNNS->
getAsIdentifier() &&
"NNS should contain identifier.");
8112 cast<NamespaceDecl>(*NSOrErr));
8114 return NSOrErr.takeError();
8119 cast<NamespaceAliasDecl>(*NSADOrErr));
8121 return NSADOrErr.takeError();
8129 cast<CXXRecordDecl>(*RDOrErr));
8131 return RDOrErr.takeError();
8140 TyOrErr->getTypePtr());
8142 return TyOrErr.takeError();
8146 llvm_unreachable(
"Invalid nested name specifier kind");
8158 NestedNames.push_back(NNS);
8164 while (!NestedNames.empty()) {
8165 NNS = NestedNames.pop_back_val();
8168 return std::move(Err);
8175 return std::move(Err);
8179 return std::move(Err);
8195 ToLocalBeginLoc, ToLocalEndLoc);
8202 return std::move(Err);
8216 if (!ToSourceRangeOrErr)
8217 return ToSourceRangeOrErr.takeError();
8220 ToSourceRangeOrErr->getBegin(),
8221 ToSourceRangeOrErr->getEnd());
8233 return TemplateName(cast<TemplateDecl>(*ToTemplateOrErr));
8235 return ToTemplateOrErr.takeError();
8240 for (
auto *I : *FromStorage) {
8241 if (
auto ToOrErr =
Import(I))
8242 ToTemplates.
addDecl(cast<NamedDecl>(*ToOrErr));
8244 return ToOrErr.takeError();
8254 return DeclNameOrErr.takeError();
8261 if (!QualifierOrErr)
8262 return QualifierOrErr.takeError();
8267 cast<TemplateDecl>(*ToTemplateOrErr));
8269 return ToTemplateOrErr.takeError();
8275 if (!QualifierOrErr)
8276 return QualifierOrErr.takeError();
8292 return ParamOrErr.takeError();
8295 if (!ReplacementOrErr)
8296 return ReplacementOrErr.takeError();
8299 cast<TemplateTemplateParmDecl>(*ParamOrErr), *ReplacementOrErr);
8307 return ParamOrErr.takeError();
8313 return ArgPackOrErr.takeError();
8316 cast<TemplateTemplateParmDecl>(*ParamOrErr), *ArgPackOrErr);
8320 llvm_unreachable(
"Invalid template name kind");
8333 return ToFileIDOrErr.takeError();
8341 return std::move(Err);
8343 return std::move(Err);
8349 llvm::DenseMap<FileID, FileID>::iterator Pos = ImportedFileIDs.find(FromID);
8350 if (Pos != ImportedFileIDs.end())
8363 return ToSpLoc.takeError();
8366 return ToExLocS.takeError();
8367 unsigned TokenLen = FromSM.getFileIDSize(FromID);
8376 return ToExLocE.takeError();
8386 return ToIncludeLoc.takeError();
8406 bool Invalid =
true;
8407 const llvm::MemoryBuffer *FromBuf = Cache->
getBuffer(
8409 if (!FromBuf || Invalid)
8413 std::unique_ptr<llvm::MemoryBuffer> ToBuf =
8414 llvm::MemoryBuffer::getMemBufferCopy(FromBuf->getBuffer(),
8415 FromBuf->getBufferIdentifier());
8421 assert(ToID.
isValid() &&
"Unexpected invalid fileID was created.");
8423 ImportedFileIDs[FromID] = ToID;
8430 return ToExprOrErr.takeError();
8433 if (!LParenLocOrErr)
8434 return LParenLocOrErr.takeError();
8437 if (!RParenLocOrErr)
8438 return RParenLocOrErr.takeError();
8443 return ToTInfoOrErr.takeError();
8448 return std::move(Err);
8451 ToContext, *ToTInfoOrErr, From->
isBaseVirtual(), *LParenLocOrErr,
8452 *ToExprOrErr, *RParenLocOrErr, EllipsisLoc);
8456 return ToFieldOrErr.takeError();
8459 if (!MemberLocOrErr)
8460 return MemberLocOrErr.takeError();
8463 ToContext, cast_or_null<FieldDecl>(*ToFieldOrErr), *MemberLocOrErr,
8464 *LParenLocOrErr, *ToExprOrErr, *RParenLocOrErr);
8468 return ToIFieldOrErr.takeError();
8471 if (!MemberLocOrErr)
8472 return MemberLocOrErr.takeError();
8475 ToContext, cast_or_null<IndirectFieldDecl>(*ToIFieldOrErr),
8476 *MemberLocOrErr, *LParenLocOrErr, *ToExprOrErr, *RParenLocOrErr);
8480 return ToTInfoOrErr.takeError();
8482 return new (ToContext)
8484 *ToExprOrErr, *RParenLocOrErr);
8487 return make_error<ImportError>();
8493 auto Pos = ImportedCXXBaseSpecifiers.find(BaseSpec);
8494 if (Pos != ImportedCXXBaseSpecifiers.end())
8499 return ToSourceRange.takeError();
8502 return ToTSI.takeError();
8505 return ToEllipsisLoc.takeError();
8509 ImportedCXXBaseSpecifiers[BaseSpec] =
Imported;
8516 return ToOrErr.takeError();
8517 Decl *To = *ToOrErr;
8519 auto *FromDC = cast<DeclContext>(From);
8522 if (
auto *ToRecord = dyn_cast<RecordDecl>(To)) {
8523 if (!ToRecord->getDefinition()) {
8524 return Importer.ImportDefinition(
8525 cast<RecordDecl>(FromDC), ToRecord,
8530 if (
auto *ToEnum = dyn_cast<EnumDecl>(To)) {
8531 if (!ToEnum->getDefinition()) {
8532 return Importer.ImportDefinition(
8537 if (
auto *ToIFace = dyn_cast<ObjCInterfaceDecl>(To)) {
8538 if (!ToIFace->getDefinition()) {
8539 return Importer.ImportDefinition(
8540 cast<ObjCInterfaceDecl>(FromDC), ToIFace,
8545 if (
auto *ToProto = dyn_cast<ObjCProtocolDecl>(To)) {
8546 if (!ToProto->getDefinition()) {
8547 return Importer.ImportDefinition(
8548 cast<ObjCProtocolDecl>(FromDC), ToProto,
8553 return Importer.ImportDeclContext(FromDC,
true);
8570 return ToSelOrErr.takeError();
8577 return ToTyOrErr.takeError();
8585 return ToTyOrErr.takeError();
8591 cast<TemplateDecl>(*ToTemplateOrErr));
8593 return ToTemplateOrErr.takeError();
8601 return ToTyOrErr.takeError();
8617 llvm_unreachable(
"Invalid DeclarationName Kind!");
8638 for (
unsigned I = 1, N = FromSel.
getNumArgs(); I < N; ++I)
8647 unsigned NumDecls) {
8652 if (LastDiagFromFrom)
8655 LastDiagFromFrom =
false;
8660 if (!LastDiagFromFrom)
8663 LastDiagFromFrom =
true;
8668 if (
auto *
ID = dyn_cast<ObjCInterfaceDecl>(D)) {
8669 if (!
ID->getDefinition())
8670 ID->startDefinition();
8672 else if (
auto *PD = dyn_cast<ObjCProtocolDecl>(D)) {
8673 if (!PD->getDefinition())
8674 PD->startDefinition();
8676 else if (
auto *TD = dyn_cast<TagDecl>(D)) {
8677 if (!TD->getDefinition() && !TD->isBeingDefined()) {
8678 TD->startDefinition();
8679 TD->setCompleteDefinition(
true);
8683 assert(0 &&
"CompleteDecl called on a Decl that can't be completed");
8688 llvm::DenseMap<Decl *, Decl *>::iterator Pos = ImportedDecls.find(From);
8689 assert((Pos == ImportedDecls.end() || Pos->second == To) &&
8690 "Try to import an already imported Decl");
8691 if (Pos != ImportedDecls.end())
8693 ImportedDecls[From] = To;
8696 ImportedFromDecls[To] = From;
8697 AddToLookupTable(To);
8703 auto Pos = ImportDeclErrors.find(FromD);
8704 if (Pos != ImportDeclErrors.end())
8711 auto InsertRes = ImportDeclErrors.insert({From, Error});
8715 assert(InsertRes.second || InsertRes.first->second.Error == Error.
Error);
8720 llvm::DenseMap<const Type *, const Type *>::iterator Pos =
8722 if (Pos != ImportedTypes.end()) {
8727 llvm::consumeError(ToFromOrErr.takeError());
8734 return Ctx.IsEquivalent(From, To);
SourceLocation getRParenLoc() const
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
virtual Expected< Decl * > ImportImpl(Decl *From)
Can be overwritten by subclasses to implement their own import logic.
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...
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
const FileEntry * OrigEntry
Reference to the file entry representing this ContentCache.
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.
void setCompleteDefinition(bool V=true)
True if this decl has its body fully specified.
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.
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...
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
DeclarationName getDeclName() const
Get the name of the template.
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
VecTy copyCycleAtBack() const
Returns the copy of the cycle.
ExpectedDecl VisitNonTypeTemplateParmDecl(NonTypeTemplateParmDecl *D)
const llvm::MemoryBuffer * getBuffer(DiagnosticsEngine &Diag, const SourceManager &SM, SourceLocation Loc=SourceLocation(), bool *Invalid=nullptr) const
Returns the memory buffer for the associated content.
A container of type source information.
RefQualifierKind RefQualifier
ExpectedStmt VisitExprWithCleanups(ExprWithCleanups *E)
Store information needed for an explicit specifier.
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.
TranslationUnitDecl * GetFromTU(Decl *ToD)
Return the translation unit from where the declaration was imported.
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.
static CXXDefaultInitExpr * Create(const ASTContext &Ctx, SourceLocation Loc, FieldDecl *Field, DeclContext *UsedContext)
Field is the non-static data member whose default initializer is used by this expression.
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.
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.
SourceLocation getBuiltinLoc() const
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)
bool hasSameVisibilityContext(T *Found, T *From)
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.
The results of name lookup within a DeclContext.
bool CheckedICE
Whether we already checked whether this statement was an integral constant expression.
NamespaceDecl * getNamespace()
Retrieve the namespace declaration aliased by this directive.
ConstexprSpecKind getConstexprKind() const
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.
ExpectedStmt VisitChooseExpr(ChooseExpr *E)
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.
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.
LLVM_NODISCARD llvm::Error ImportDefinition(Decl *From)
Import the definition of the given declaration, including all of the declarations it contains...
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
Optional< Expr * > getArraySize()
IdentifierInfo * getAsIdentifier() const
Retrieve the identifier stored in this nested name specifier.
SourceLocation getEndLoc() const
ExpectedDecl VisitTypedefDecl(TypedefDecl *D)
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...
An unqualified-id that has been assumed to name a function template that will be found by ADL...
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)
ArrayRef< TemplateArgumentLoc > template_arguments() const
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.
bool isTypeDependent() const
isTypeDependent - Determines whether this expression is type-dependent (C++ [temp.dep.expr]), which means that its type could change from one template instantiation to the next.
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...
static MemberExpr * Create(const ASTContext &C, Expr *Base, bool IsArrow, SourceLocation OperatorLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, ValueDecl *MemberDecl, DeclAccessPair FoundDecl, DeclarationNameInfo MemberNameInfo, const TemplateArgumentListInfo *TemplateArgs, QualType T, ExprValueKind VK, ExprObjectKind OK, NonOdrUseReason NOUR)
Represents the this expression in C++.
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.
static auto getTemplateDefinition(T *D) -> T *
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...
Represents a ValueDecl that came out of a declarator.
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 and optionally the result of evaluatin...
ImportDefinitionKind
What we should import from the definition.
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)
NonOdrUseReason isNonOdrUse() const
Is this expression a non-odr-use reference, and if so, why? This is only meaningful if the named memb...
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
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
static ConstantExpr * Create(const ASTContext &Context, Expr *E, const APValue &Result)
ExpectedStmt VisitGotoStmt(GotoStmt *S)
TemplateParameterList * getTemplateParameterList(unsigned index) const
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
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.
void setOperatorDelete(FunctionDecl *OD, Expr *ThisArg)
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.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
ExpectedStmt VisitStringLiteral(StringLiteral *E)
A type, stored as a Type*.
const DeclContext * getUsedContext() const
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)
APValue getAPValueResult() const
SourceLocation getLParenLoc() const
Retrieve the location of the left parentheses ('(') that precedes the argument list.
TypeSourceInfo * getReturnTypeSourceInfo() const
RecordDecl * getDecl() const
const DirectoryEntry * getDir() const
Return the directory the file lives in.
bool capturesVariable() const
Determine whether this capture handles a variable.
void RegisterImportedDecl(Decl *FromD, Decl *ToD)
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 declarations that this template name refers to...
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
decl_type * getPreviousDecl()
Return the previous declaration of this declaration or NULL if this is the first declaration.
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
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)
Error ImportTemplateParameterLists(const DeclaratorDecl *FromD, DeclaratorDecl *ToD)
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
StringRef getName() 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.
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)
void setTemplateParameterListsInfo(ASTContext &Context, ArrayRef< TemplateParameterList *> TPLists)
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...
ExprObjectKind
A further classification of the kind of object referenced by an l-value or x-value.
ExpectedDecl VisitIndirectFieldDecl(IndirectFieldDecl *D)
bool isWrittenInBuiltinFile(SourceLocation Loc) const
Returns whether Loc is located in a <built-in> file.
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.
bool isLambda() const
Determine whether this record is a class describing a lambda function object.
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.
virtual void Imported(Decl *From, Decl *To)
Subclasses can override this function to observe all of the From -> To declaration mappings as they a...
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.
llvm::Expected< QualType > Import(QualType FromT)
Import the given type from the "from" context into the "to" context.
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...
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
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...
NonOdrUseReason isNonOdrUse() const
Is this expression a non-odr-use reference, and if so, why?
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
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...
bool hasCycleAtBack() const
Returns true if the last element can be found earlier in the path.
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.
ASTImporter(ASTContext &ToContext, FileManager &ToFileManager, ASTContext &FromContext, FileManager &FromFileManager, bool MinimalImport, std::shared_ptr< ASTImporterSharedState > SharedState=nullptr)
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)
unsigned getNumTemplateParameterLists() const
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...
TemplateName getAssumedTemplateName(DeclarationName Name) const
Retrieve a template name representing an unqualified-id that has been assumed to name a template for ...
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
void setImportDeclError(Decl *From, ImportError Error)
Mark (newly) imported declaration with error.
Expr * getCond() const
getCond - Return the condition expression; this is defined in terms of the opaque value...
protocol_iterator protocol_begin() const
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, NonOdrUseReason NOUR=NOUR_None)
SourceLocation getRParenLoc() 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
AssumedTemplateStorage * getAsAssumedTemplateName() const
Retrieve information on a name that has been assumed to be a template-name in order to permit a call ...
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.
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...
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.
ChooseExpr - GNU builtin-in function __builtin_choose_expr.
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...
A structure for storing the information associated with a name that has been assumed to be a template...
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...
const DeclContext * getUsedContext() const
CompoundStmt * getTryBlock()
SourceLocation getBreakLoc() const
ExpectedDecl VisitFunctionDecl(FunctionDecl *D)
TypeLoc getTypeLoc() const
For a nested-name-specifier that refers to a type, retrieve the type with source-location information...
SourceLocation getCaseLoc() const
capture_range captures() const
Retrieve this lambda's captures.
void setPropertyAttributes(PropertyAttributeKind PRVal)
static CXXDefaultArgExpr * Create(const ASTContext &C, SourceLocation Loc, ParmVarDecl *Param, DeclContext *UsedContext)
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
llvm::Optional< ImportError > getImportDeclErrorIfAny(Decl *FromD) const
Return if import of the given declaration has failed and if yes the kind of the problem.
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)
unsigned getNumLabels() const
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 isConditionDependent() const
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
APValue::ValueKind getResultAPValueKind() const
SourceRange getSourceRange() const LLVM_READONLY
Retrieves the source range that contains the entire base specifier.
Error ImportFunctionDeclBody(FunctionDecl *FromFD, FunctionDecl *ToFD)
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.
bool isConditionTrue() const
isConditionTrue - Return whether the condition is true (i.e.
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
static CXXNewExpr * Create(const ASTContext &Ctx, bool IsGlobalNew, FunctionDecl *OperatorNew, FunctionDecl *OperatorDelete, bool ShouldPassAlignment, bool UsualArrayDeleteWantsSize, ArrayRef< Expr *> PlacementArgs, SourceRange TypeIdParens, Optional< Expr *> ArraySize, InitializationStyle InitializationStyle, Expr *Initializer, QualType Ty, TypeSourceInfo *AllocatedTypeInfo, SourceRange Range, SourceRange DirectInitRange)
Create a c++ new expression.
bool isThisDeclarationADefinition() const
Returns whether this template declaration defines the primary pattern.
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.
FunctionTemplateDecl * getMostRecentDecl()
void notePriorDiagnosticFrom(const DiagnosticsEngine &Other)
Note that the prior diagnostic was emitted by some other DiagnosticsEngine, and we may be attaching a...