llvm::make_error;
89 return "NameConflict";
91 return "UnsupportedConstruct";
93 return "Unknown error";
95llvm_unreachable(
"Invalid error code.");
96 return "Invalid error code.";
102llvm_unreachable(
"Function not implemented.");
111 for(
auto*R :
D->getFirstDecl()->
redecls()) {
112 if(R !=
D->getFirstDecl())
113Redecls.push_back(R);
115Redecls.push_back(
D->getFirstDecl());
116std::reverse(Redecls.begin(), Redecls.end());
121 if(
auto*FD = dyn_cast<FunctionDecl>(
D))
122 returngetCanonicalForwardRedeclChain<FunctionDecl>(FD);
123 if(
auto*VD = dyn_cast<VarDecl>(
D))
124 returngetCanonicalForwardRedeclChain<VarDecl>(VD);
125 if(
auto*TD = dyn_cast<TagDecl>(
D))
126 returngetCanonicalForwardRedeclChain<TagDecl>(TD);
127llvm_unreachable(
"Bad declaration kind");
148 bool constIgnoreChildErrors;
152: FromDC(FromDC), IgnoreChildErrors(!
isa<
TagDecl>(FromDC)) {}
155IgnoreChildErrors(!
isa<
TagDecl>(FromD)) {}
162 if(ChildErr && !IgnoreChildErrors)
163ResultErr = joinErrors(std::move(ResultErr), std::move(ChildErr));
165consumeError(std::move(ChildErr));
171 if(!IgnoreChildErrors || !FromDC)
178 public DeclVisitor<ASTNodeImporter, ExpectedDecl>,
179 public StmtVisitor<ASTNodeImporter, ExpectedStmt> {
183 template<
typenameImportT>
184[[nodiscard]] Error importInto(ImportT &To,
constImportT &From) {
189 template<
typenameImportT>
190[[nodiscard]] Error importInto(ImportT *&To, ImportT *From) {
191 autoToOrErr = Importer.
Import(From);
193To = cast_or_null<ImportT>(*ToOrErr);
194 returnToOrErr.takeError();
199 template<
typenameT>
200 auto import(
T*From)
203 autoToOrErr = Importer.
Import(From);
205 returnToOrErr.takeError();
206 returncast_or_null<T>(*ToOrErr);
209 template<
typenameT>
210 auto import(
const T*From) {
211 return import(
const_cast<T*
>(From));
215 template<
typenameT>
217 returnImporter.
Import(From);
221 template<
typenameT>
225 return import(*From);
232 template<
typenameToDeclT>
structCallOverloadedCreateFun {
233 template<
typename... Args>
decltype(
auto)
operator()(Args &&... args) {
234 returnToDeclT::Create(std::forward<Args>(args)...);
244 template<
typenameToDeclT,
typenameFromDeclT,
typename... Args>
245[[nodiscard]]
boolGetImportedOrCreateDecl(ToDeclT *&ToD, FromDeclT *FromD,
250CallOverloadedCreateFun<ToDeclT> OC;
251 returnGetImportedOrCreateSpecialDecl(ToD, OC, FromD,
252std::forward<Args>(args)...);
259 template<
typenameNewDeclT,
typenameToDeclT,
typenameFromDeclT,
261[[nodiscard]]
boolGetImportedOrCreateDecl(ToDeclT *&ToD, FromDeclT *FromD,
263CallOverloadedCreateFun<NewDeclT> OC;
264 returnGetImportedOrCreateSpecialDecl(ToD, OC, FromD,
265std::forward<Args>(args)...);
269 template<
typenameToDeclT,
typenameCreateFunT,
typenameFromDeclT,
272GetImportedOrCreateSpecialDecl(ToDeclT *&ToD, CreateFunT CreateFun,
273FromDeclT *FromD, Args &&...args) {
281ToD = CreateFun(std::forward<Args>(args)...);
284Importer.SharedState->markAsNewDecl(ToD);
285InitializeImportedDecl(FromD, ToD);
289 voidInitializeImportedDecl(
Decl*FromD,
Decl*ToD) {
293 if(FromD->isImplicit())
301 if(
D->doesThisDeclarationHaveABody() &&
307 voidaddDeclToContexts(
Decl*FromD,
Decl*ToD) {
312 if(!FromD->getDescribedTemplate() &&
319 DeclContext*FromLexicalDC = FromD->getLexicalDeclContext();
323 boolVisible =
false;
336 if(
auto*FromNamed = dyn_cast<NamedDecl>(FromD)) {
337 auto*ToNamed = cast<NamedDecl>(ToD);
339FromDC->
lookup(FromNamed->getDeclName());
340 if(llvm::is_contained(FromLookup, FromNamed))
357updateLookupTableForTemplateParameters(
361 template<
typenameTemplateParmDeclT>
362Error importTemplateParameterDefaultArgument(
constTemplateParmDeclT *
D,
363TemplateParmDeclT *ToD) {
364 if(
D->hasDefaultArgument()) {
365 if(
D->defaultArgumentWasInherited()) {
367 import(
D->getDefaultArgStorage().getInheritedFrom());
368 if(!ToInheritedFromOrErr)
369 returnToInheritedFromOrErr.takeError();
370TemplateParmDeclT *ToInheritedFrom = *ToInheritedFromOrErr;
371 if(!ToInheritedFrom->hasDefaultArgument()) {
375 import(
D->getDefaultArgStorage()
377->getDefaultArgument());
378 if(!ToInheritedDefaultArgOrErr)
379 returnToInheritedDefaultArgOrErr.takeError();
380ToInheritedFrom->setDefaultArgument(Importer.
getToContext(),
381*ToInheritedDefaultArgOrErr);
383ToD->setInheritedDefaultArgument(ToD->getASTContext(),
387 import(
D->getDefaultArgument());
388 if(!ToDefaultArgOrErr)
389 returnToDefaultArgOrErr.takeError();
392 if(!ToD->hasDefaultArgument())
397 returnError::success();
409#define TYPE(Class, Base) \ 410 ExpectedType Visit##Class##Type(const Class##Type *T); 411#include "clang/AST/TypeNodes.inc" 469 template<
typenameInContainerTy>
473 template<
typenameInContainerTy>
480std::tuple<FunctionTemplateDecl *, TemplateArgsTy>;
485 template<
typenameDeclTy>
498 template<
typenameT>
502 boolIgnoreTemplateParmDepth =
false);
694Err = MaybeVal.takeError();
700 template<
typenameIIter,
typenameOIter>
702 usingItemT = std::remove_reference_t<
decltype(*Obegin)>;
703 for(; Ibegin != Iend; ++Ibegin, ++Obegin) {
706 returnToOrErr.takeError();
709 returnError::success();
716 template<
typenameInContainerTy,
typenameOutContainerTy>
718 constInContainerTy &InContainer, OutContainerTy &OutContainer) {
720InContainer.begin(), InContainer.end(), OutContainer.begin());
723 template<
typenameInContainerTy,
typenameOIter>
740template<
typenameInContainerTy>
744 autoToLAngleLocOrErr =
import(FromLAngleLoc);
745 if(!ToLAngleLocOrErr)
746 returnToLAngleLocOrErr.takeError();
747 autoToRAngleLocOrErr =
import(FromRAngleLoc);
748 if(!ToRAngleLocOrErr)
749 returnToRAngleLocOrErr.takeError();
755 returnError::success();
759Error ASTNodeImporter::ImportTemplateArgumentListInfo<TemplateArgumentListInfo>(
770 returnImportTemplateArgumentListInfo(
771From.LAngleLoc, From.RAngleLoc, From.arguments(),
Result);
783 if(Error Err = importInto(std::get<0>(
Result), FTSInfo->getTemplate()))
784 returnstd::move(Err);
789 returnstd::move(Err);
799 returnstd::move(Err);
802 if(!ToRequiresClause)
803 returnToRequiresClause.takeError();
806 if(!ToTemplateLocOrErr)
807 returnToTemplateLocOrErr.takeError();
808 autoToLAngleLocOrErr =
import(From->
getLAngleLoc());
809 if(!ToLAngleLocOrErr)
810 returnToLAngleLocOrErr.takeError();
811 autoToRAngleLocOrErr =
import(From->
getRAngleLoc());
812 if(!ToRAngleLocOrErr)
813 returnToRAngleLocOrErr.takeError();
834 returnToTypeOrErr.takeError();
842 returnToTypeOrErr.takeError();
849 returnToOrErr.takeError();
852 returnToTypeOrErr.takeError();
853 return TemplateArgument(dyn_cast<ValueDecl>((*ToOrErr)->getCanonicalDecl()),
860 returnToTypeOrErr.takeError();
868 returnToTypeOrErr.takeError();
871 returnToValueOrErr.takeError();
878 if(!ToTemplateOrErr)
879 returnToTemplateOrErr.takeError();
887 if(!ToTemplateOrErr)
888 returnToTemplateOrErr.takeError();
898 returnToExpr.takeError();
904 returnstd::move(Err);
911llvm_unreachable(
"Invalid template argument kind");
919 returnArgOrErr.takeError();
928 return E.takeError();
934 returnTSIOrErr.takeError();
936 autoToTemplateQualifierLocOrErr =
938 if(!ToTemplateQualifierLocOrErr)
939 returnToTemplateQualifierLocOrErr.takeError();
941 if(!ToTemplateNameLocOrErr)
942 returnToTemplateNameLocOrErr.takeError();
943 autoToTemplateEllipsisLocOrErr =
945 if(!ToTemplateEllipsisLocOrErr)
946 returnToTemplateEllipsisLocOrErr.takeError();
948Importer.
getToContext(), *ToTemplateQualifierLocOrErr,
949*ToTemplateNameLocOrErr, *ToTemplateEllipsisLocOrErr);
959 size_tNumDecls = DG.
end() - DG.
begin();
961ToDecls.reserve(NumDecls);
962 for(
Decl*FromD : DG) {
963 if(
autoToDOrErr =
import(FromD))
964ToDecls.push_back(*ToDOrErr);
966 returnToDOrErr.takeError();
976 if(
D.isFieldDesignator()) {
981 returnToDotLocOrErr.takeError();
984 if(!ToFieldLocOrErr)
985 returnToFieldLocOrErr.takeError();
988ToFieldName, *ToDotLocOrErr, *ToFieldLocOrErr);
991 ExpectedSLocToLBracketLocOrErr =
import(
D.getLBracketLoc());
992 if(!ToLBracketLocOrErr)
993 returnToLBracketLocOrErr.takeError();
995 ExpectedSLocToRBracketLocOrErr =
import(
D.getRBracketLoc());
996 if(!ToRBracketLocOrErr)
997 returnToRBracketLocOrErr.takeError();
999 if(
D.isArrayDesignator())
1001*ToLBracketLocOrErr,
1002*ToRBracketLocOrErr);
1004 ExpectedSLocToEllipsisLocOrErr =
import(
D.getEllipsisLoc());
1005 if(!ToEllipsisLocOrErr)
1006 returnToEllipsisLocOrErr.takeError();
1008assert(
D.isArrayRangeDesignator());
1010 D.getArrayIndex(), *ToLBracketLocOrErr, *ToEllipsisLocOrErr,
1011*ToRBracketLocOrErr);
1016Error Err = Error::success();
1019 autoToConceptNameLoc =
1025 returnstd::move(Err);
1028 if(ASTTemplateArgs)
1030 returnstd::move(Err);
1048 returnVarOrErr.takeError();
1051 autoLocationOrErr =
import(From.
getLocation());
1053 returnLocationOrErr.takeError();
1057 if(Error Err = importInto(EllipsisLoc, From.
getEllipsisLoc()))
1058 returnstd::move(Err);
1065template<
typenameT>
1067 if(
Found->getLinkageInternal() != From->getLinkageInternal())
1070 if(From->hasExternalFormalLinkage())
1071 return Found->hasExternalFormalLinkage();
1074 if(From->isInAnonymousNamespace())
1075 return Found->isInAnonymousNamespace();
1077 return!
Found->isInAnonymousNamespace() &&
1078!
Found->hasExternalFormalLinkage();
1098using namespace clang;
1107 ExpectedTypeUnderlyingTypeOrErr =
import(
T->getValueType());
1108 if(!UnderlyingTypeOrErr)
1109 returnUnderlyingTypeOrErr.takeError();
1115 switch(
T->getKind()) {
1116#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ 1117 case BuiltinType::Id: \ 1118 return Importer.getToContext().SingletonId; 1119#include "clang/Basic/OpenCLImageTypes.def" 1120#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \ 1121 case BuiltinType::Id: \ 1122 return Importer.getToContext().Id##Ty; 1123#include "clang/Basic/OpenCLExtensionTypes.def" 1124#define SVE_TYPE(Name, Id, SingletonId) \ 1125 case BuiltinType::Id: \ 1126 return Importer.getToContext().SingletonId; 1127#include "clang/Basic/AArch64SVEACLETypes.def" 1128#define PPC_VECTOR_TYPE(Name, Id, Size) \ 1129 case BuiltinType::Id: \ 1130 return Importer.getToContext().Id##Ty; 1131#include "clang/Basic/PPCTypes.def" 1132#define RVV_TYPE(Name, Id, SingletonId) \ 1133 case BuiltinType::Id: \ 1134 return Importer.getToContext().SingletonId; 1135#include "clang/Basic/RISCVVTypes.def" 1136#define WASM_TYPE(Name, Id, SingletonId) \ 1137 case BuiltinType::Id: \ 1138 return Importer.getToContext().SingletonId; 1139#include "clang/Basic/WebAssemblyReferenceTypes.def" 1140#define AMDGPU_TYPE(Name, Id, SingletonId, Width, Align) \ 1141 case BuiltinType::Id: \ 1142 return Importer.getToContext().SingletonId; 1143#include "clang/Basic/AMDGPUTypes.def" 1144#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) \ 1145 case BuiltinType::Id: \ 1146 return Importer.getToContext().SingletonId; 1147#include "clang/Basic/HLSLIntangibleTypes.def" 1148#define SHARED_SINGLETON_TYPE(Expansion) 1149#define BUILTIN_TYPE(Id, SingletonId) \ 1150 case BuiltinType::Id: return Importer.getToContext().SingletonId; 1151#include "clang/AST/BuiltinTypes.def" 1159 caseBuiltinType::Char_U:
1168 caseBuiltinType::Char_S:
1177 caseBuiltinType::WChar_S:
1178 caseBuiltinType::WChar_U:
1184llvm_unreachable(
"Invalid BuiltinType Kind!");
1188 ExpectedTypeToOriginalTypeOrErr =
import(
T->getOriginalType());
1189 if(!ToOriginalTypeOrErr)
1190 returnToOriginalTypeOrErr.takeError();
1196 ExpectedTypeToElementTypeOrErr =
import(
T->getElementType());
1197 if(!ToElementTypeOrErr)
1198 returnToElementTypeOrErr.takeError();
1205 if(!ToPointeeTypeOrErr)
1206 returnToPointeeTypeOrErr.takeError();
1214 if(!ToPointeeTypeOrErr)
1215 returnToPointeeTypeOrErr.takeError();
1223 ExpectedTypeToPointeeTypeOrErr =
import(
T->getPointeeTypeAsWritten());
1224 if(!ToPointeeTypeOrErr)
1225 returnToPointeeTypeOrErr.takeError();
1233 ExpectedTypeToPointeeTypeOrErr =
import(
T->getPointeeTypeAsWritten());
1234 if(!ToPointeeTypeOrErr)
1235 returnToPointeeTypeOrErr.takeError();
1244 if(!ToPointeeTypeOrErr)
1245 returnToPointeeTypeOrErr.takeError();
1248 if(!ClassTypeOrErr)
1249 returnClassTypeOrErr.takeError();
1257 ErrorErr = Error::success();
1261 returnstd::move(Err);
1264ToElementType,
T->getSize(), ToSizeExpr,
T->getSizeModifier(),
1265 T->getIndexTypeCVRQualifiers());
1270 ExpectedTypeToArrayTypeOrErr = VisitConstantArrayType(
T);
1271 if(!ToArrayTypeOrErr)
1272 returnToArrayTypeOrErr.takeError();
1279 ExpectedTypeToElementTypeOrErr =
import(
T->getElementType());
1280 if(!ToElementTypeOrErr)
1281 returnToElementTypeOrErr.takeError();
1284 T->getSizeModifier(),
1285 T->getIndexTypeCVRQualifiers());
1290 ErrorErr = Error::success();
1295 returnstd::move(Err);
1297ToElementType, ToSizeExpr,
T->getSizeModifier(),
1298 T->getIndexTypeCVRQualifiers(), ToBracketsRange);
1301ExpectedTypeASTNodeImporter::VisitDependentSizedArrayType(
1303 ErrorErr = Error::success();
1308 returnstd::move(Err);
1313ToElementType, ToSizeExpr,
T->getSizeModifier(),
1314 T->getIndexTypeCVRQualifiers(), ToBracketsRange);
1317ExpectedTypeASTNodeImporter::VisitDependentSizedExtVectorType(
1319 ErrorErr = Error::success();
1324 returnstd::move(Err);
1326ToElementType, ToSizeExpr, ToAttrLoc);
1330 ExpectedTypeToElementTypeOrErr =
import(
T->getElementType());
1331 if(!ToElementTypeOrErr)
1332 returnToElementTypeOrErr.takeError();
1335 T->getNumElements(),
1336 T->getVectorKind());
1340 ExpectedTypeToElementTypeOrErr =
import(
T->getElementType());
1341 if(!ToElementTypeOrErr)
1342 returnToElementTypeOrErr.takeError();
1345 T->getNumElements());
1353 if(!ToReturnTypeOrErr)
1354 returnToReturnTypeOrErr.takeError();
1363 if(!ToReturnTypeOrErr)
1364 returnToReturnTypeOrErr.takeError();
1371 returnTyOrErr.takeError();
1372ArgTypes.push_back(*TyOrErr);
1380 returnTyOrErr.takeError();
1381ExceptionTypes.push_back(*TyOrErr);
1385 ErrorErr = Error::success();
1402 returnstd::move(Err);
1405*ToReturnTypeOrErr, ArgTypes, ToEPI);
1410 ErrorErr = Error::success();
1412 autoToPrevD =
importChecked(Err,
T->getDecl()->getPreviousDecl());
1414 returnstd::move(Err);
1417ToD, cast_or_null<TypeDecl>(ToPrevD));
1421 ExpectedTypeToInnerTypeOrErr =
import(
T->getInnerType());
1422 if(!ToInnerTypeOrErr)
1423 returnToInnerTypeOrErr.takeError();
1433 returnPattern.takeError();
1436 returnIndex.takeError();
1443 returnToDeclOrErr.takeError();
1450 if(!ToUnderlyingTypeOrErr)
1451 returnToUnderlyingTypeOrErr.takeError();
1457 ExpectedExprToExprOrErr =
import(
T->getUnderlyingExpr());
1459 returnToExprOrErr.takeError();
1464 ExpectedTypeToUnderlyingTypeOrErr =
import(
T->getUnmodifiedType());
1465 if(!ToUnderlyingTypeOrErr)
1466 returnToUnderlyingTypeOrErr.takeError();
1474 returnFoundOrErr.takeError();
1476 if(!UnderlyingOrErr)
1477 returnUnderlyingOrErr.takeError();
1484 ExpectedExprToExprOrErr =
import(
T->getUnderlyingExpr());
1486 returnToExprOrErr.takeError();
1488 ExpectedTypeToUnderlyingTypeOrErr =
import(
T->getUnderlyingType());
1489 if(!ToUnderlyingTypeOrErr)
1490 returnToUnderlyingTypeOrErr.takeError();
1493*ToExprOrErr, *ToUnderlyingTypeOrErr);
1499 if(!ToBaseTypeOrErr)
1500 returnToBaseTypeOrErr.takeError();
1502 ExpectedTypeToUnderlyingTypeOrErr =
import(
T->getUnderlyingType());
1503 if(!ToUnderlyingTypeOrErr)
1504 returnToUnderlyingTypeOrErr.takeError();
1507*ToBaseTypeOrErr, *ToUnderlyingTypeOrErr,
T->getUTTKind());
1512 ExpectedTypeToDeducedTypeOrErr =
import(
T->getDeducedType());
1513 if(!ToDeducedTypeOrErr)
1514 returnToDeducedTypeOrErr.takeError();
1516 ExpectedDeclToTypeConstraintConcept =
import(
T->getTypeConstraintConcept());
1517 if(!ToTypeConstraintConcept)
1518 returnToTypeConstraintConcept.takeError();
1523 returnstd::move(Err);
1526*ToDeducedTypeOrErr,
T->getKeyword(),
false,
1527 false, cast_or_null<ConceptDecl>(*ToTypeConstraintConcept),
1531ExpectedTypeASTNodeImporter::VisitDeducedTemplateSpecializationType(
1535 if(!ToTemplateNameOrErr)
1536 returnToTemplateNameOrErr.takeError();
1537 ExpectedTypeToDeducedTypeOrErr =
import(
T->getDeducedType());
1538 if(!ToDeducedTypeOrErr)
1539 returnToDeducedTypeOrErr.takeError();
1545ExpectedTypeASTNodeImporter::VisitInjectedClassNameType(
1549 returnToDeclOrErr.takeError();
1553 const Type*Ty = (*ToDeclOrErr)->getTypeForDecl();
1554assert(isa_and_nonnull<InjectedClassNameType>(Ty));
1561 returnToDeclOrErr.takeError();
1569 returnToDeclOrErr.takeError();
1575 ExpectedTypeToModifiedTypeOrErr =
import(
T->getModifiedType());
1576 if(!ToModifiedTypeOrErr)
1577 returnToModifiedTypeOrErr.takeError();
1578 ExpectedTypeToEquivalentTypeOrErr =
import(
T->getEquivalentType());
1579 if(!ToEquivalentTypeOrErr)
1580 returnToEquivalentTypeOrErr.takeError();
1583 T->getAttrKind(), *ToModifiedTypeOrErr, *ToEquivalentTypeOrErr,
1590 if(!ToWrappedTypeOrErr)
1591 returnToWrappedTypeOrErr.takeError();
1593 ErrorErr = Error::success();
1600 returnToDeclOrErr.takeError();
1601CoupledDecls.emplace_back(*ToDeclOrErr, TI.isDeref());
1605*ToWrappedTypeOrErr, CountExpr,
T->isCountInBytes(),
T->isOrNull(),
1606 ArrayRef(CoupledDecls.data(), CoupledDecls.size()));
1609ExpectedTypeASTNodeImporter::VisitTemplateTypeParmType(
1613 returnToDeclOrErr.takeError();
1616 T->getDepth(),
T->getIndex(),
T->isParameterPack(), *ToDeclOrErr);
1619ExpectedTypeASTNodeImporter::VisitSubstTemplateTypeParmType(
1623 returnReplacedOrErr.takeError();
1625 ExpectedTypeToReplacementTypeOrErr =
import(
T->getReplacementType());
1626 if(!ToReplacementTypeOrErr)
1627 returnToReplacementTypeOrErr.takeError();
1630*ToReplacementTypeOrErr, *ReplacedOrErr,
T->getIndex(),
T->getPackIndex(),
1631 T->getSubstitutionFlag());
1634ExpectedTypeASTNodeImporter::VisitSubstTemplateTypeParmPackType(
1638 returnReplacedOrErr.takeError();
1641 if(!ToArgumentPack)
1642 returnToArgumentPack.takeError();
1645*ReplacedOrErr,
T->getIndex(),
T->getFinal(), *ToArgumentPack);
1648ExpectedTypeASTNodeImporter::VisitTemplateSpecializationType(
1650 autoToTemplateOrErr =
import(
T->getTemplateName());
1651 if(!ToTemplateOrErr)
1652 returnToTemplateOrErr.takeError();
1657 returnstd::move(Err);
1664ToCanonType = *TyOrErr;
1666 returnTyOrErr.takeError();
1675 autoToQualifierOrErr =
import(
T->getQualifier());
1676 if(!ToQualifierOrErr)
1677 returnToQualifierOrErr.takeError();
1679 ExpectedTypeToNamedTypeOrErr =
import(
T->getNamedType());
1680 if(!ToNamedTypeOrErr)
1681 returnToNamedTypeOrErr.takeError();
1684 if(!ToOwnedTagDeclOrErr)
1685 returnToOwnedTagDeclOrErr.takeError();
1690*ToOwnedTagDeclOrErr);
1696 if(!ToPatternOrErr)
1697 returnToPatternOrErr.takeError();
1700 T->getNumExpansions(),
1704ExpectedTypeASTNodeImporter::VisitDependentTemplateSpecializationType(
1706 autoToQualifierOrErr =
import(
T->getQualifier());
1707 if(!ToQualifierOrErr)
1708 returnToQualifierOrErr.takeError();
1713ToPack.reserve(
T->template_arguments().size());
1715 returnstd::move(Err);
1718 T->getKeyword(), *ToQualifierOrErr, ToName, ToPack);
1723 autoToQualifierOrErr =
import(
T->getQualifier());
1724 if(!ToQualifierOrErr)
1725 returnToQualifierOrErr.takeError();
1734 returnTyOrErr.takeError();
1746 returnToDeclOrErr.takeError();
1753 if(!ToBaseTypeOrErr)
1754 returnToBaseTypeOrErr.takeError();
1757 for(
autoTypeArg :
T->getTypeArgsAsWritten()) {
1759TypeArgs.push_back(*TyOrErr);
1761 returnTyOrErr.takeError();
1765 for(
auto*
P:
T->quals()) {
1767Protocols.push_back(*ProtocolOrErr);
1769 returnProtocolOrErr.takeError();
1775 T->isKindOfTypeAsWritten());
1781 if(!ToPointeeTypeOrErr)
1782 returnToPointeeTypeOrErr.takeError();
1789 ExpectedTypeToUnderlyingTypeOrErr =
import(
T->getUnderlyingType());
1790 if(!ToUnderlyingTypeOrErr)
1791 returnToUnderlyingTypeOrErr.takeError();
1799 ErrorErr = Error::success();
1800 QualTypeToOriginalType = importChecked(Err,
T->getOriginalType());
1801 QualTypeToAdjustedType = importChecked(Err,
T->getAdjustedType());
1803 returnstd::move(Err);
1805 returnImporter.getToContext().getAdjustedType(ToOriginalType,
1810 returnImporter.getToContext().getBitIntType(
T->isUnsigned(),
1814ExpectedTypeclang::ASTNodeImporter::VisitBTFTagAttributedType(
1816 ErrorErr = Error::success();
1817 constBTFTypeTagAttr *ToBTFAttr = importChecked(Err,
T->getAttr());
1818 QualTypeToWrappedType = importChecked(Err,
T->getWrappedType());
1820 returnstd::move(Err);
1822 returnImporter.getToContext().getBTFTagAttributedType(ToBTFAttr,
1826ExpectedTypeclang::ASTNodeImporter::VisitHLSLAttributedResourceType(
1828 ErrorErr = Error::success();
1830 QualTypeToWrappedType = importChecked(Err,
T->getWrappedType());
1831 QualTypeToContainedType = importChecked(Err,
T->getContainedType());
1833 returnstd::move(Err);
1835 returnImporter.getToContext().getHLSLAttributedResourceType(
1836ToWrappedType, ToContainedType, ToAttrs);
1839ExpectedTypeclang::ASTNodeImporter::VisitConstantMatrixType(
1841 ExpectedTypeToElementTypeOrErr =
import(
T->getElementType());
1842 if(!ToElementTypeOrErr)
1843 returnToElementTypeOrErr.takeError();
1845 returnImporter.getToContext().getConstantMatrixType(
1846*ToElementTypeOrErr,
T->getNumRows(),
T->getNumColumns());
1849ExpectedTypeclang::ASTNodeImporter::VisitDependentAddressSpaceType(
1851 ErrorErr = Error::success();
1853 Expr*ToAddrSpaceExpr = importChecked(Err,
T->getAddrSpaceExpr());
1856 returnstd::move(Err);
1858 returnImporter.getToContext().getDependentAddressSpaceType(
1859ToPointeeType, ToAddrSpaceExpr, ToAttrLoc);
1862ExpectedTypeclang::ASTNodeImporter::VisitDependentBitIntType(
1864 ExpectedExprToNumBitsExprOrErr =
import(
T->getNumBitsExpr());
1865 if(!ToNumBitsExprOrErr)
1866 returnToNumBitsExprOrErr.takeError();
1867 returnImporter.getToContext().getDependentBitIntType(
T->isUnsigned(),
1868*ToNumBitsExprOrErr);
1871ExpectedTypeclang::ASTNodeImporter::VisitDependentSizedMatrixType(
1873 ErrorErr = Error::success();
1874 QualTypeToElementType = importChecked(Err,
T->getElementType());
1875 Expr*ToRowExpr = importChecked(Err,
T->getRowExpr());
1876 Expr*ToColumnExpr = importChecked(Err,
T->getColumnExpr());
1879 returnstd::move(Err);
1881 returnImporter.getToContext().getDependentSizedMatrixType(
1882ToElementType, ToRowExpr, ToColumnExpr, ToAttrLoc);
1885ExpectedTypeclang::ASTNodeImporter::VisitDependentVectorType(
1887 ErrorErr = Error::success();
1888 QualTypeToElementType = importChecked(Err,
T->getElementType());
1889 Expr*ToSizeExpr = importChecked(Err,
T->getSizeExpr());
1892 returnstd::move(Err);
1894 returnImporter.getToContext().getDependentVectorType(
1895ToElementType, ToSizeExpr, ToAttrLoc,
T->getVectorKind());
1898ExpectedTypeclang::ASTNodeImporter::VisitObjCTypeParamType(
1902 returnToDeclOrErr.takeError();
1907 if(!ToProtocolOrErr)
1908 returnToProtocolOrErr.takeError();
1909ToProtocols.push_back(*ToProtocolOrErr);
1912 returnImporter.getToContext().getObjCTypeParamType(*ToDeclOrErr,
1917 ExpectedTypeToElementTypeOrErr =
import(
T->getElementType());
1918 if(!ToElementTypeOrErr)
1919 returnToElementTypeOrErr.takeError();
1922 if(
T->isReadOnly())
1942 if(isa<RecordDecl>(
D) && (FunDecl = dyn_cast<FunctionDecl>(OrigDC)) &&
1944 autogetLeafPointeeType = [](
const Type*
T) {
1952getLeafPointeeType(
P->getType().getCanonicalType().getTypePtr());
1953 auto*RT = dyn_cast<RecordType>(LeafT);
1954 if(RT && RT->getDecl() ==
D) {
1967 if(Error Err = importInto(Name,
D->getDeclName()))
1979 returnError::success();
1986 if(Error Err = importInto(Name,
D->getDeclName()))
1998 returnError::success();
2003 returnError::success();
2006 if(Error Err = importInto(ToD, FromD))
2009 if(
RecordDecl*FromRecord = dyn_cast<RecordDecl>(FromD)) {
2010 if(
RecordDecl*ToRecord = cast<RecordDecl>(ToD)) {
2011 if(FromRecord->getDefinition() && FromRecord->isCompleteDefinition() &&
2012!ToRecord->getDefinition()) {
2017 returnError::success();
2020 if(
EnumDecl*FromEnum = dyn_cast<EnumDecl>(FromD)) {
2021 if(
EnumDecl*ToEnum = cast<EnumDecl>(ToD)) {
2022 if(FromEnum->getDefinition() && !ToEnum->getDefinition()) {
2027 returnError::success();
2030 returnError::success();
2045 returnError::success();
2051 returnToRangeOrErr.takeError();
2052 returnError::success();
2058 returnLocOrErr.takeError();
2059 returnError::success();
2067 returnToTInfoOrErr.takeError();
2068 returnError::success();
2071llvm_unreachable(
"Unknown name kind.");
2078 returnToDCOrErr.takeError();
2092 autoMightNeedReordering = [](
const Decl*
D) {
2093 returnisa<FieldDecl>(
D) || isa<IndirectFieldDecl>(
D) || isa<FriendDecl>(
D);
2097Error ChildErrors = Error::success();
2098 for(
auto*From : FromDC->
decls()) {
2099 if(!MightNeedReordering(From))
2108 if(!ImportedOrErr) {
2110ImportedOrErr.takeError());
2113 FieldDecl*FieldFrom = dyn_cast_or_null<FieldDecl>(From);
2114 Decl*ImportedDecl = *ImportedOrErr;
2115 FieldDecl*FieldTo = dyn_cast_or_null<FieldDecl>(ImportedDecl);
2116 if(FieldFrom && FieldTo) {
2148consumeError(std::move(ChildErrors));
2149 returnToDCOrErr.takeError();
2152 if(
const auto*FromRD = dyn_cast<RecordDecl>(FromDC)) {
2156 for(
auto*
D: FromRD->decls()) {
2157 if(!MightNeedReordering(
D))
2160assert(
D&&
"DC contains a null decl");
2163assert(ToDC == ToD->getLexicalDeclContext() && ToDC->
containsDecl(ToD));
2175 for(
auto*From : FromDC->
decls()) {
2176 if(MightNeedReordering(From))
2182ImportedOrErr.takeError());
2202 if(!FromRecordDecl || !ToRecordDecl) {
2206 if(RecordFrom && RecordTo) {
2207FromRecordDecl = RecordFrom->
getDecl();
2208ToRecordDecl = RecordTo->getDecl();
2212 if(FromRecordDecl && ToRecordDecl) {
2218 returnError::success();
2225 returnToDCOrErr.takeError();
2231 if(!ToLexicalDCOrErr)
2232 returnToLexicalDCOrErr.takeError();
2233ToLexicalDC = *ToLexicalDCOrErr;
2237 returnError::success();
2243 "Import implicit methods to or from non-definition");
2246 if(FromM->isImplicit()) {
2249 returnToMOrErr.takeError();
2252 returnError::success();
2261 returnToTypedefOrErr.takeError();
2263 returnError::success();
2268 autoDefinitionCompleter = [To]() {
2287 auto*FromCXXRD = cast<CXXRecordDecl>(From);
2289ToCaptures.reserve(FromCXXRD->capture_size());
2290 for(
const auto&FromCapture : FromCXXRD->captures()) {
2291 if(
autoToCaptureOrErr =
import(FromCapture))
2292ToCaptures.push_back(*ToCaptureOrErr);
2294 returnToCaptureOrErr.takeError();
2296cast<CXXRecordDecl>(To)->setCaptures(Importer.
getToContext(),
2303DefinitionCompleter();
2307 returnError::success();
2322 autoDefinitionCompleterScopeExit =
2323llvm::make_scope_exit(DefinitionCompleter);
2329 auto*ToCXX = dyn_cast<CXXRecordDecl>(To);
2330 auto*FromCXX = dyn_cast<CXXRecordDecl>(From);
2331 if(ToCXX && FromCXX && ToCXX->dataPtr() && FromCXX->dataPtr()) {
2333 structCXXRecordDecl::DefinitionData &ToData = ToCXX->data();
2334 structCXXRecordDecl::DefinitionData &FromData = FromCXX->data();
2336 #define FIELD(Name, Width, Merge) \ 2337 ToData.Name = FromData.Name; 2338 #include "clang/AST/CXXRecordDeclDefinitionBits.def" 2341ToCXX->setArgPassingRestrictions(FromCXX->getArgPassingRestrictions());
2344 for(
const auto&Base1 : FromCXX->bases()) {
2347 returnTyOrErr.takeError();
2350 if(Base1.isPackExpansion()) {
2351 if(
ExpectedSLocLocOrErr =
import(Base1.getEllipsisLoc()))
2352EllipsisLoc = *LocOrErr;
2354 returnLocOrErr.takeError();
2362 autoRangeOrErr =
import(Base1.getSourceRange());
2364 returnRangeOrErr.takeError();
2366 autoTSIOrErr =
import(Base1.getTypeSourceInfo());
2368 returnTSIOrErr.takeError();
2374Base1.isBaseOfClass(),
2375Base1.getAccessSpecifierAsWritten(),
2380ToCXX->setBases(Bases.data(), Bases.size());
2388 returnError::success();
2393 returnError::success();
2397 returnError::success();
2401 returnToInitOrErr.takeError();
2412 returnError::success();
2420 returnError::success();
2431 returnToTypeOrErr.takeError();
2434 if(!ToPromotionTypeOrErr)
2435 returnToPromotionTypeOrErr.takeError();
2446 returnError::success();
2452 for(
const auto&Arg : FromArgs) {
2453 if(
autoToOrErr =
import(Arg))
2454ToArgs.push_back(*ToOrErr);
2456 returnToOrErr.takeError();
2459 returnError::success();
2465 return import(From);
2468template<
typenameInContainerTy>
2471 for(
const auto&FromLoc : Container) {
2472 if(
autoToLocOrErr =
import(FromLoc))
2475 returnToLocOrErr.takeError();
2477 returnError::success();
2487 boolIgnoreTemplateParmDepth) {
2498 false, Complain,
false,
2499IgnoreTemplateParmDepth);
2500 returnCtx.IsEquivalent(From, To);
2519 returnstd::move(Err);
2524 returnLocOrErr.takeError();
2527 if(GetImportedOrCreateDecl(ToD,
D, Importer.
getToContext(), DC, *LocOrErr))
2550 returnstd::move(Err);
2556Name.getAsIdentifierInfo(),
D->getType()))
2559Error Err = Error::success();
2564 returnstd::move(Err);
2568addDeclToContexts(
D, ToD);
2576 returnLocOrErr.takeError();
2577 autoColonLocOrErr =
import(
D->getColonLoc());
2579 returnColonLocOrErr.takeError();
2584 returnDCOrErr.takeError();
2589DC, *LocOrErr, *ColonLocOrErr))
2603 returnDCOrErr.takeError();
2607Error Err = Error::success();
2613 returnstd::move(Err);
2616 if(GetImportedOrCreateDecl(
2617ToD,
D, Importer.
getToContext(), DC, ToLocation, ToAssertExpr, ToMessage,
2618ToRParenLoc,
D->isFailed()))
2633 returnstd::move(Err);
2642 if(
auto*TU = dyn_cast<TranslationUnitDecl>(DC))
2648 autoFoundDecls = Importer.findDeclsInToCtx(DC, Name);
2649 for(
auto*FoundDecl : FoundDecls) {
2653 if(
auto*FoundNS = dyn_cast<NamespaceDecl>(FoundDecl)) {
2654MergeWithNamespace = FoundNS;
2655ConflictingDecls.clear();
2659ConflictingDecls.push_back(FoundDecl);
2662 if(!ConflictingDecls.empty()) {
2665ConflictingDecls.size());
2667Name = NameOrErr.get();
2669 returnNameOrErr.takeError();
2675 returnBeginLocOrErr.takeError();
2677 if(!RBraceLocOrErr)
2678 returnRBraceLocOrErr.takeError();
2683 if(GetImportedOrCreateDecl(ToNamespace,
D, Importer.
getToContext(), DC,
2684 D->isInline(), *BeginLocOrErr,
Loc,
2685Name.getAsIdentifierInfo(),
2686 nullptr,
D->isNested()))
2695 if(
auto*TU = dyn_cast<TranslationUnitDecl>(DC))
2696TU->setAnonymousNamespace(ToNamespace);
2698cast<NamespaceDecl>(DC)->setAnonymousNamespace(ToNamespace);
2704 returnstd::move(Err);
2716 returnstd::move(Err);
2722Error Err = Error::success();
2723 autoToNamespaceLoc =
importChecked(Err,
D->getNamespaceLoc());
2725 autoToQualifierLoc =
importChecked(Err,
D->getQualifierLoc());
2726 autoToTargetNameLoc =
importChecked(Err,
D->getTargetNameLoc());
2729 returnstd::move(Err);
2734 if(GetImportedOrCreateDecl(
2735ToD,
D, Importer.
getToContext(), DC, ToNamespaceLoc, ToAliasLoc,
2736ToIdentifier, ToQualifierLoc, ToTargetNameLoc, ToNamespace))
2754 returnstd::move(Err);
2773 autoFoundDecls = Importer.findDeclsInToCtx(DC, Name);
2774 for(
auto*FoundDecl : FoundDecls) {
2777 if(
auto*FoundTypedef = dyn_cast<TypedefNameDecl>(FoundDecl)) {
2781 QualTypeFromUT =
D->getUnderlyingType();
2782 QualTypeFoundUT = FoundTypedef->getUnderlyingType();
2796 if(FromR && FoundR &&
2807ConflictingDecls.push_back(FoundDecl);
2812 if(!ConflictingDecls.empty()) {
2814Name, DC, IDNS, ConflictingDecls.data(), ConflictingDecls.size());
2816Name = NameOrErr.get();
2818 returnNameOrErr.takeError();
2822Error Err = Error::success();
2824 autoToTypeSourceInfo =
importChecked(Err,
D->getTypeSourceInfo());
2827 returnstd::move(Err);
2834 if(GetImportedOrCreateDecl<TypeAliasDecl>(
2836Name.getAsIdentifierInfo(), ToTypeSourceInfo))
2838}
else if(GetImportedOrCreateDecl<TypedefDecl>(
2840Name.getAsIdentifierInfo(), ToTypeSourceInfo))
2845 returnstd::move(Err);
2849Importer.AddToLookupTable(ToTypedef);
2854 TypeAliasDecl*FromAlias = IsAlias ? cast<TypeAliasDecl>(
D) :
nullptr;
2877 returnstd::move(Err);
2887 autoFoundDecls = Importer.findDeclsInToCtx(DC, Name);
2888 for(
auto*FoundDecl : FoundDecls) {
2891 if(
auto*FoundAlias = dyn_cast<TypeAliasTemplateDecl>(FoundDecl)) {
2894ConflictingDecls.push_back(FoundDecl);
2898 if(!ConflictingDecls.empty()) {
2900Name, DC, IDNS, ConflictingDecls.data(), ConflictingDecls.size());
2902Name = NameOrErr.get();
2904 returnNameOrErr.takeError();
2908Error Err = Error::success();
2909 autoToTemplateParameters =
importChecked(Err,
D->getTemplateParameters());
2910 autoToTemplatedDecl =
importChecked(Err,
D->getTemplatedDecl());
2912 returnstd::move(Err);
2915 if(GetImportedOrCreateDecl(ToAlias,
D, Importer.
getToContext(), DC,
Loc,
2916Name, ToTemplateParameters, ToTemplatedDecl))
2919ToTemplatedDecl->setDescribedAliasTemplate(ToAlias);
2925updateLookupTableForTemplateParameters(*ToTemplateParameters);
2936 returnstd::move(Err);
2943 if(
D->isGnuLocal()) {
2946 returnBeginLocOrErr.takeError();
2947 if(GetImportedOrCreateDecl(ToLabel,
D, Importer.
getToContext(), DC,
Loc,
2948Name.getAsIdentifierInfo(), *BeginLocOrErr))
2952 if(GetImportedOrCreateDecl(ToLabel,
D, Importer.
getToContext(), DC,
Loc,
2953Name.getAsIdentifierInfo()))
2960 returnToStmtOrErr.takeError();
2962ToLabel->
setStmt(*ToStmtOrErr);
2975 returnstd::move(Err);
2982 if(!SearchName &&
D->getTypedefNameForAnonDecl()) {
2983 if(Error Err = importInto(
2984SearchName,
D->getTypedefNameForAnonDecl()->getDeclName()))
2985 returnstd::move(Err);
2995Importer.findDeclsInToCtx(DC, SearchName);
2996 for(
auto*FoundDecl : FoundDecls) {
3000 if(
auto*Typedef = dyn_cast<TypedefNameDecl>(FoundDecl)) {
3001 if(
const auto*Tag = Typedef->getUnderlyingType()->getAs<
TagType>())
3002FoundDecl = Tag->getDecl();
3005 if(
auto*FoundEnum = dyn_cast<EnumDecl>(FoundDecl)) {
3010 if(
D->isThisDeclarationADefinition() && FoundDef)
3015ConflictingDecls.push_back(FoundDecl);
3024 if(SearchName && !ConflictingDecls.empty()) {
3026SearchName, DC, IDNS, ConflictingDecls.data(),
3027ConflictingDecls.size());
3029Name = NameOrErr.get();
3031 returnNameOrErr.takeError();
3035Error Err = Error::success();
3037 autoToQualifierLoc =
importChecked(Err,
D->getQualifierLoc());
3041 returnstd::move(Err);
3045 if(GetImportedOrCreateDecl(
3047 Loc, Name.getAsIdentifierInfo(), PrevDecl,
D->isScoped(),
3048 D->isScopedUsingClassTag(),
D->isFixed()))
3056addDeclToContexts(
D, D2);
3060 EnumDecl*FromInst =
D->getInstantiatedFromMemberEnum();
3062D2->setInstantiationOfMemberEnum(*ToInstOrErr, SK);
3064 returnToInstOrErr.takeError();
3065 if(
ExpectedSLocPOIOrErr =
import(MemberInfo->getPointOfInstantiation()))
3068 returnPOIOrErr.takeError();
3072 if(
D->isCompleteDefinition())
3074 returnstd::move(Err);
3080 boolIsFriendTemplate =
false;
3081 if(
auto*DCXX = dyn_cast<CXXRecordDecl>(
D)) {
3083DCXX->getDescribedClassTemplate() &&
3084DCXX->getDescribedClassTemplate()->getFriendObjectKind() !=
3089 DeclContext*DC =
nullptr, *LexicalDC =
nullptr;
3094 returnstd::move(Err);
3101 if(!SearchName &&
D->getTypedefNameForAnonDecl()) {
3102 if(Error Err = importInto(
3103SearchName,
D->getTypedefNameForAnonDecl()->getDeclName()))
3104 returnstd::move(Err);
3111 boolDependentFriend = IsFriendTemplate && IsDependentContext;
3118Importer.findDeclsInToCtx(DC, SearchName);
3119 if(!FoundDecls.empty()) {
3122 if(
D->hasExternalLexicalStorage() && !
D->isCompleteDefinition())
3126 for(
auto*FoundDecl : FoundDecls) {
3131 if(
auto*Typedef = dyn_cast<TypedefNameDecl>(
Found)) {
3132 if(
const auto*Tag = Typedef->getUnderlyingType()->getAs<
TagType>())
3133 Found= Tag->getDecl();
3136 if(
auto*FoundRecord = dyn_cast<RecordDecl>(
Found)) {
3155 if(
D->isThisDeclarationADefinition() && FoundDef) {
3159 if(
const auto*DCXX = dyn_cast<CXXRecordDecl>(
D)) {
3160 auto*FoundCXX = dyn_cast<CXXRecordDecl>(FoundDef);
3161assert(FoundCXX &&
"Record type mismatch");
3167 returnstd::move(Err);
3174ConflictingDecls.push_back(FoundDecl);
3178 if(!ConflictingDecls.empty() && SearchName) {
3180SearchName, DC, IDNS, ConflictingDecls.data(),
3181ConflictingDecls.size());
3183Name = NameOrErr.get();
3185 returnNameOrErr.takeError();
3191 returnBeginLocOrErr.takeError();
3196 if(
auto*DCXX = dyn_cast<CXXRecordDecl>(
D)) {
3197 if(DCXX->isLambda()) {
3198 autoTInfoOrErr =
import(DCXX->getLambdaTypeInfo());
3200 returnTInfoOrErr.takeError();
3201 if(GetImportedOrCreateSpecialDecl(
3203DC, *TInfoOrErr,
Loc, DCXX->getLambdaDependencyKind(),
3204DCXX->isGenericLambda(), DCXX->getLambdaCaptureDefault()))
3209 returnCDeclOrErr.takeError();
3212}
else if(DCXX->isInjectedClassName()) {
3215 const boolDelayTypeCreation =
true;
3216 if(GetImportedOrCreateDecl(
3218*BeginLocOrErr,
Loc, Name.getAsIdentifierInfo(),
3219cast_or_null<CXXRecordDecl>(PrevDecl), DelayTypeCreation))
3222D2CXX, dyn_cast<CXXRecordDecl>(DC));
3224 if(GetImportedOrCreateDecl(D2CXX,
D, Importer.
getToContext(),
3225 D->getTagKind(), DC, *BeginLocOrErr,
Loc,
3226Name.getAsIdentifierInfo(),
3227cast_or_null<CXXRecordDecl>(PrevDecl)))
3234addDeclToContexts(
D, D2);
3237DCXX->getDescribedClassTemplate()) {
3239 if(Error Err = importInto(ToDescribed, FromDescribed))
3240 returnstd::move(Err);
3242 if(!DCXX->isInjectedClassName() && !IsFriendTemplate) {
3262 const Type*FrontTy =
3263cast<CXXRecordDecl>(Redecls.front())->getTypeForDecl();
3266InjSpec = InjTy->getInjectedSpecializationType();
3269 for(
auto*R : Redecls) {
3270 auto*RI = cast<CXXRecordDecl>(R);
3271 if(R != Redecls.front() ||
3272!isa<InjectedClassNameType>(RI->getTypeForDecl()))
3273RI->setTypeForDecl(
nullptr);
3288DCXX->getMemberSpecializationInfo()) {
3290MemberInfo->getTemplateSpecializationKind();
3296 returnToInstOrErr.takeError();
3299 import(MemberInfo->getPointOfInstantiation()))
3303 returnPOIOrErr.takeError();
3307 if(GetImportedOrCreateDecl(D2,
D, Importer.
getToContext(),
3308 D->getTagKind(), DC, *BeginLocOrErr,
Loc,
3309Name.getAsIdentifierInfo(), PrevDecl))
3312addDeclToContexts(
D, D2);
3315 if(
autoBraceRangeOrErr =
import(
D->getBraceRange()))
3318 returnBraceRangeOrErr.takeError();
3319 if(
autoQualifierLocOrErr =
import(
D->getQualifierLoc()))
3322 returnQualifierLocOrErr.takeError();
3324 if(
D->isAnonymousStructOrUnion())
3327 if(
D->isCompleteDefinition())
3329 returnstd::move(Err);
3341 returnstd::move(Err);
3350 autoFoundDecls = Importer.findDeclsInToCtx(DC, Name);
3351 for(
auto*FoundDecl : FoundDecls) {
3355 if(
auto*FoundEnumConstant = dyn_cast<EnumConstantDecl>(FoundDecl)) {
3358ConflictingDecls.push_back(FoundDecl);
3362 if(!ConflictingDecls.empty()) {
3364Name, DC, IDNS, ConflictingDecls.data(), ConflictingDecls.size());
3366Name = NameOrErr.get();
3368 returnNameOrErr.takeError();
3374 returnTypeOrErr.takeError();
3378 returnInitOrErr.takeError();
3381 if(GetImportedOrCreateDecl(
3383Name.getAsIdentifierInfo(), *TypeOrErr, *InitOrErr,
D->getInitVal()))
3384 returnToEnumerator;
3389 returnToEnumerator;
3392template<
typenameDeclTy>
3395 unsigned int Num= FromD->getNumTemplateParameterLists();
3397 returnError::success();
3399 for(
unsigned intI = 0; I <
Num; ++I)
3401 import(FromD->getTemplateParameterList(I)))
3402ToTPLists[I] = *ToTPListOrErr;
3404 returnToTPListOrErr.takeError();
3405ToD->setTemplateParameterListsInfo(Importer.ToContext, ToTPLists);
3406 returnError::success();
3414 returnError::success();
3420 returnError::success();
3426ToFD->setInstantiationOfMemberFunction(*InstFDOrErr, TSK);
3428 returnInstFDOrErr.takeError();
3434 returnPOIOrErr.takeError();
3436 returnError::success();
3440 autoFunctionAndArgsOrErr =
3442 if(!FunctionAndArgsOrErr)
3443 returnFunctionAndArgsOrErr.takeError();
3446Importer.
getToContext(), std::get<1>(*FunctionAndArgsOrErr));
3450 const auto*FromTAArgsAsWritten = FTSInfo->TemplateArgumentsAsWritten;
3451 if(FromTAArgsAsWritten)
3453*FromTAArgsAsWritten, ToTAInfo))
3456 ExpectedSLocPOIOrErr =
import(FTSInfo->getPointOfInstantiation());
3458 returnPOIOrErr.takeError();
3464ToFD->setFunctionTemplateSpecialization(
3465std::get<0>(*FunctionAndArgsOrErr), ToTAList,
nullptr,
3466TSK, FromTAArgsAsWritten ? &ToTAInfo :
nullptr, *POIOrErr);
3467 returnError::success();
3475Candidates.
addDecl(*ToFTDOrErr);
3477 returnToFTDOrErr.takeError();
3482 const auto*FromTAArgsAsWritten = FromInfo->TemplateArgumentsAsWritten;
3483 if(FromTAArgsAsWritten)
3490FromTAArgsAsWritten ? &ToTAInfo :
nullptr);
3491 returnError::success();
3494llvm_unreachable(
"All cases should be covered!");
3499 autoFunctionAndArgsOrErr =
3501 if(!FunctionAndArgsOrErr)
3502 returnFunctionAndArgsOrErr.takeError();
3506std::tie(Template, ToTemplArgs) = *FunctionAndArgsOrErr;
3507 void*InsertPos =
nullptr;
3516ToFD->
setBody(*ToBodyOrErr);
3518 returnToBodyOrErr.takeError();
3520 returnError::success();
3529assert(DCi &&
"Declaration should have a context");
3543ToProcess.push_back(S);
3544 while(!ToProcess.empty()) {
3545 const Stmt*CurrentS = ToProcess.pop_back_val();
3547 if(
const auto*DeclRef = dyn_cast<DeclRefExpr>(CurrentS)) {
3548 if(
const Decl*
D= DeclRef->getDecl())
3551}
else if(
const auto*
E=
3552dyn_cast_or_null<SubstNonTypeTemplateParmExpr>(CurrentS)) {
3553 if(
const Decl*
D=
E->getAssociatedDecl())
3586classIsTypeDeclaredInsideVisitor
3587:
public TypeVisitor<IsTypeDeclaredInsideVisitor, std::optional<bool>> {
3589IsTypeDeclaredInsideVisitor(
const FunctionDecl*ParentDC)
3590: ParentDC(ParentDC) {}
3596 if(std::optional<bool> Res = Visit(
T.getTypePtr()))
3599 T.getSingleStepDesugaredType(ParentDC->getParentASTContext());
3601 if(std::optional<bool> Res = Visit(DsT.
getTypePtr()))
3604DsT =
T.getSingleStepDesugaredType(ParentDC->getParentASTContext());
3609std::optional<bool> VisitTagType(
const TagType*
T) {
3610 if(
auto*Spec = dyn_cast<ClassTemplateSpecializationDecl>(
T->getDecl()))
3611 for(
const auto&Arg : Spec->getTemplateArgs().asArray())
3612 if(checkTemplateArgument(Arg))
3617std::optional<bool> VisitPointerType(
const PointerType*
T) {
3621std::optional<bool> VisitReferenceType(
const ReferenceType*
T) {
3622 returnCheckType(
T->getPointeeTypeAsWritten());
3625std::optional<bool> VisitTypedefType(
const TypedefType*
T) {
3631std::optional<bool> VisitUsingType(
const UsingType*
T) {
3632 if(
T->getFoundDecl() &&
3641 for(
const auto&Arg :
T->template_arguments())
3642 if(checkTemplateArgument(Arg))
3649 returnCheckType(
T->getBaseType());
3664 returnCheckType(
T->getElementType());
3669 "Variable array should not occur in deduced return type of a function");
3673llvm_unreachable(
"Incomplete array should not occur in deduced return type " 3678llvm_unreachable(
"Dependent array should not occur in deduced return type " 3705 if(checkTemplateArgument(PackArg))
3717llvm_unreachable(
"Unknown TemplateArgument::ArgKind enum");
3727assert(FromFPT &&
"Must be called on FunctionProtoType");
3729 autoIsCXX11Lambda = [&]() {
3730 if(Importer.FromContext.
getLangOpts().CPlusPlus14)
3736 QualTypeRetT = FromFPT->getReturnType();
3737 if(isa<AutoType>(RetT.
getTypePtr()) || IsCXX11Lambda()) {
3739IsTypeDeclaredInsideVisitor Visitor(Def ? Def :
D);
3740 returnVisitor.CheckType(RetT);
3757 autoRedeclIt = Redecls.begin();
3760 for(; RedeclIt != Redecls.end() && *RedeclIt !=
D; ++RedeclIt) {
3763 returnToRedeclOrErr.takeError();
3765assert(*RedeclIt ==
D);
3773 returnstd::move(Err);
3785 if(
D->getTemplatedKind() ==
3788 if(!FoundFunctionOrErr)
3789 returnFoundFunctionOrErr.takeError();
3790 if(
FunctionDecl*FoundFunction = *FoundFunctionOrErr) {
3791 if(
Decl*Def = FindAndMapDefinition(
D, FoundFunction))
3793FoundByLookup = FoundFunction;
3801 autoFoundDecls = Importer.findDeclsInToCtx(DC, Name);
3802 for(
auto*FoundDecl : FoundDecls) {
3806 if(
auto*FoundFunction = dyn_cast<FunctionDecl>(FoundDecl)) {
3811 if(
Decl*Def = FindAndMapDefinition(
D, FoundFunction))
3813FoundByLookup = FoundFunction;
3824Importer.
ToDiag(
Loc, diag::warn_odr_function_type_inconsistent)
3825<< Name <<
D->getType() << FoundFunction->getType();
3826Importer.
ToDiag(FoundFunction->getLocation(), diag::note_odr_value_here)
3827<< FoundFunction->getType();
3828ConflictingDecls.push_back(FoundDecl);
3832 if(!ConflictingDecls.empty()) {
3834Name, DC, IDNS, ConflictingDecls.data(), ConflictingDecls.size());
3836Name = NameOrErr.get();
3838 returnNameOrErr.takeError();
3848 if(FoundByLookup) {
3849 if(isa<CXXMethodDecl>(FoundByLookup)) {
3851 if(!
D->doesThisDeclarationHaveABody()) {
3853 D->getDescribedFunctionTemplate()) {
3858 "Templated function mapped to non-templated?");
3874 returnstd::move(Err);
3885 boolUsedDifferentProtoType =
false;
3887 QualTypeFromReturnTy = FromFPT->getReturnType();
3895UsedDifferentProtoType =
true;
3906FromEPI = DefaultEPI;
3907UsedDifferentProtoType =
true;
3910FromReturnTy, FromFPT->getParamTypes(), FromEPI);
3915Error Err = Error::success();
3918 autoToInnerLocStart =
importChecked(Err,
D->getInnerLocStart());
3921 autoToQualifierLoc =
importChecked(Err,
D->getQualifierLoc());
3922 autoTrailingRequiresClause =
3925 returnstd::move(Err);
3929 for(
auto*
P:
D->parameters()) {
3931Parameters.push_back(*ToPOrErr);
3933 returnToPOrErr.takeError();
3938 if(
auto*FromConstructor = dyn_cast<CXXConstructorDecl>(
D)) {
3940importExplicitSpecifier(Err, FromConstructor->getExplicitSpecifier());
3942 returnstd::move(Err);
3944 if(FromConstructor->isInheritingConstructor()) {
3946 import(FromConstructor->getInheritedConstructor());
3947 if(!ImportedInheritedCtor)
3948 returnImportedInheritedCtor.takeError();
3949ToInheritedConstructor = *ImportedInheritedCtor;
3951 if(GetImportedOrCreateDecl<CXXConstructorDecl>(
3952ToFunction,
D, Importer.
getToContext(), cast<CXXRecordDecl>(DC),
3953ToInnerLocStart, NameInfo,
T, TInfo, ESpec,
D->UsesFPIntrin(),
3954 D->isInlineSpecified(),
D->
isImplicit(),
D->getConstexprKind(),
3955ToInheritedConstructor, TrailingRequiresClause))
3959Error Err = Error::success();
3961Err,
const_cast<FunctionDecl*
>(FromDtor->getOperatorDelete()));
3962 autoToThisArg =
importChecked(Err, FromDtor->getOperatorDeleteThisArg());
3964 returnstd::move(Err);
3966 if(GetImportedOrCreateDecl<CXXDestructorDecl>(
3967ToFunction,
D, Importer.
getToContext(), cast<CXXRecordDecl>(DC),
3968ToInnerLocStart, NameInfo,
T, TInfo,
D->UsesFPIntrin(),
3969 D->isInlineSpecified(),
D->
isImplicit(),
D->getConstexprKind(),
3970TrailingRequiresClause))
3977dyn_cast<CXXConversionDecl>(
D)) {
3979importExplicitSpecifier(Err, FromConversion->getExplicitSpecifier());
3981 returnstd::move(Err);
3982 if(GetImportedOrCreateDecl<CXXConversionDecl>(
3983ToFunction,
D, Importer.
getToContext(), cast<CXXRecordDecl>(DC),
3984ToInnerLocStart, NameInfo,
T, TInfo,
D->UsesFPIntrin(),
3985 D->isInlineSpecified(), ESpec,
D->getConstexprKind(),
3988}
else if(
auto*Method = dyn_cast<CXXMethodDecl>(
D)) {
3989 if(GetImportedOrCreateDecl<CXXMethodDecl>(
3990ToFunction,
D, Importer.
getToContext(), cast<CXXRecordDecl>(DC),
3991ToInnerLocStart, NameInfo,
T, TInfo, Method->getStorageClass(),
3992Method->UsesFPIntrin(), Method->isInlineSpecified(),
3995}
else if(
auto*Guide = dyn_cast<CXXDeductionGuideDecl>(
D)) {
3997importExplicitSpecifier(Err, Guide->getExplicitSpecifier());
4003 returnstd::move(Err);
4004 if(GetImportedOrCreateDecl<CXXDeductionGuideDecl>(
4005ToFunction,
D, Importer.
getToContext(), DC, ToInnerLocStart, ESpec,
4006NameInfo,
T, TInfo, ToEndLoc, Ctor,
4007Guide->getDeductionCandidateKind(), TrailingRequiresClause,
4011 if(GetImportedOrCreateDecl(
4012ToFunction,
D, Importer.
getToContext(), DC, ToInnerLocStart,
4013NameInfo,
T, TInfo,
D->getStorageClass(),
D->UsesFPIntrin(),
4014 D->isInlineSpecified(),
D->hasWrittenPrototype(),
4015 D->getConstexprKind(), TrailingRequiresClause))
4020 if(FoundByLookup) {
4033 autoImported =
import(Msg);
4035 returnImported.takeError();
4049 D->FriendConstraintRefersToEnclosingTemplate());
4059 for(
auto*Param : Parameters) {
4060Param->setOwningFunction(ToFunction);
4065ToFunction->setParams(Parameters);
4070 if(
autoProtoLoc =
4072 for(
unsignedI = 0, N = Parameters.size(); I != N; ++I)
4073ProtoLoc.setParam(I, Parameters[I]);
4079 autoToFTOrErr =
import(FromFT);
4081 returnToFTOrErr.takeError();
4085 if(
auto*FromConstructor = dyn_cast<CXXConstructorDecl>(
D)) {
4086 if(
unsignedNumInitializers = FromConstructor->getNumCtorInitializers()) {
4090FromConstructor->inits(), CtorInitializers))
4091 returnstd::move(Err);
4094std::copy(CtorInitializers.begin(), CtorInitializers.end(), Memory);
4095 auto*ToCtor = cast<CXXConstructorDecl>(ToFunction);
4096ToCtor->setCtorInitializers(Memory);
4097ToCtor->setNumCtorInitializers(NumInitializers);
4103 returnstd::move(Err);
4105 if(
auto*FromCXXMethod = dyn_cast<CXXMethodDecl>(
D))
4108 returnstd::move(Err);
4110 if(
D->doesThisDeclarationHaveABody()) {
4114 returnstd::move(Err);
4118 if(UsedDifferentProtoType) {
4120ToFunction->
setType(*TyOrErr);
4122 returnTyOrErr.takeError();
4126 returnTSIOrErr.takeError();
4131addDeclToContexts(
D, ToFunction);
4134 for(++RedeclIt; RedeclIt != Redecls.end(); ++RedeclIt) {
4137 returnToRedeclOrErr.takeError();
4171 returnstd::move(Err);
4176 autoFoundDecls = Importer.findDeclsInToCtx(DC, Name);
4177 for(
auto*FoundDecl : FoundDecls) {
4178 if(
FieldDecl*FoundField = dyn_cast<FieldDecl>(FoundDecl)) {
4186FoundField->getType())) {
4194 if(
Expr*FromInitializer =
D->getInClassInitializer()) {
4195 if(
ExpectedExprToInitializerOrErr =
import(FromInitializer)) {
4198assert(FoundField->hasInClassInitializer() &&
4199 "Field should have an in-class initializer if it has an " 4200 "expression for it.");
4201 if(!FoundField->getInClassInitializer())
4202FoundField->setInClassInitializer(*ToInitializerOrErr);
4204 returnToInitializerOrErr.takeError();
4211Importer.
ToDiag(
Loc, diag::warn_odr_field_type_inconsistent)
4212<< Name <<
D->getType() << FoundField->getType();
4213Importer.
ToDiag(FoundField->getLocation(), diag::note_odr_value_here)
4214<< FoundField->getType();
4220Error Err = Error::success();
4224 autoToInnerLocStart =
importChecked(Err,
D->getInnerLocStart());
4226 returnstd::move(Err);
4227 const Type*ToCapturedVLAType =
nullptr;
4229ToCapturedVLAType, cast_or_null<Type>(
D->getCapturedVLAType())))
4230 returnstd::move(Err);
4233 if(GetImportedOrCreateDecl(ToField,
D, Importer.
getToContext(), DC,
4234ToInnerLocStart,
Loc, Name.getAsIdentifierInfo(),
4235ToType, ToTInfo, ToBitWidth,
D->isMutable(),
4236 D->getInClassInitStyle()))
4242 if(ToCapturedVLAType)
4247 autoToInitializer =
importChecked(Err,
D->getInClassInitializer());
4249 returnstd::move(Err);
4250 if(ToInitializer) {
4252 if(AlreadyImported)
4253assert(ToInitializer == AlreadyImported &&
4254 "Duplicate import of in-class initializer.");
4269 returnstd::move(Err);
4274 autoFoundDecls = Importer.findDeclsInToCtx(DC, Name);
4275 for(
unsignedI = 0, N = FoundDecls.size(); I != N; ++I) {
4276 if(
auto*FoundField = dyn_cast<IndirectFieldDecl>(FoundDecls[I])) {
4284FoundField->getType(),
4291 if(!Name && I < N-1)
4295Importer.
ToDiag(
Loc, diag::warn_odr_field_type_inconsistent)
4296<< Name <<
D->getType() << FoundField->getType();
4297Importer.
ToDiag(FoundField->getLocation(), diag::note_odr_value_here)
4298<< FoundField->getType();
4305 autoTypeOrErr =
import(
D->getType());
4307 returnTypeOrErr.takeError();
4313 for(
auto*PI :
D->chain())
4315NamedChain[i++] = *ToD;
4317 returnToD.takeError();
4321 if(GetImportedOrCreateDecl(ToIndirectField,
D, Importer.
getToContext(), DC,
4322 Loc, Name.getAsIdentifierInfo(), *TypeOrErr, CH))
4324 returnToIndirectField;
4329 returnToIndirectField;
4354 returnCtx.IsEquivalent(FD1, FD2);
4359 unsigned intFriendCount = 0;
4360std::optional<unsigned int> FriendPosition;
4363 for(
FriendDecl*FoundFriend : RD->friends()) {
4364 if(FoundFriend == FD) {
4365FriendPosition = FriendCount;
4372assert(FriendPosition &&
"Friend decl not found in own parent.");
4374 return{FriendCount, *FriendPosition};
4381 returnstd::move(Err);
4386 const auto*RD = cast<CXXRecordDecl>(DC);
4388 for(
FriendDecl*ImportedFriend : RD->friends())
4390ImportedEquivalentFriends.push_back(ImportedFriend);
4395assert(ImportedEquivalentFriends.size() <= CountAndPosition.
TotalCount&&
4396 "Class with non-matching friends is imported, ODR check wrong?");
4397 if(ImportedEquivalentFriends.size() == CountAndPosition.
TotalCount)
4399 D, ImportedEquivalentFriends[CountAndPosition.
IndexOfDecl]);
4404 if(
NamedDecl*FriendD =
D->getFriendDecl()) {
4406 if(Error Err = importInto(ToFriendD, FriendD))
4407 returnstd::move(Err);
4415 if(
autoTSIOrErr =
import(
D->getFriendType()))
4418 returnTSIOrErr.takeError();
4423 for(
unsignedI = 0; I <
D->NumTPLists; I++) {
4424 if(
autoListOrErr =
import(FromTPLists[I]))
4425ToTPLists[I] = *ListOrErr;
4427 returnListOrErr.takeError();
4432 returnLocationOrErr.takeError();
4433 autoFriendLocOrErr =
import(
D->getFriendLoc());
4434 if(!FriendLocOrErr)
4435 returnFriendLocOrErr.takeError();
4436 autoEllipsisLocOrErr =
import(
D->getEllipsisLoc());
4437 if(!EllipsisLocOrErr)
4438 returnEllipsisLocOrErr.takeError();
4441 if(GetImportedOrCreateDecl(FrD,
D, Importer.
getToContext(), DC,
4442*LocationOrErr, ToFU, *FriendLocOrErr,
4443*EllipsisLocOrErr, ToTPLists))
4459 returnstd::move(Err);
4464 autoFoundDecls = Importer.findDeclsInToCtx(DC, Name);
4465 for(
auto*FoundDecl : FoundDecls) {
4466 if(
ObjCIvarDecl*FoundIvar = dyn_cast<ObjCIvarDecl>(FoundDecl)) {
4468FoundIvar->getType())) {
4473Importer.
ToDiag(
Loc, diag::warn_odr_ivar_type_inconsistent)
4474<< Name <<
D->getType() << FoundIvar->getType();
4475Importer.
ToDiag(FoundIvar->getLocation(), diag::note_odr_value_here)
4476<< FoundIvar->getType();
4482Error Err = Error::success();
4484 autoToTypeSourceInfo =
importChecked(Err,
D->getTypeSourceInfo());
4486 autoToInnerLocStart =
importChecked(Err,
D->getInnerLocStart());
4488 returnstd::move(Err);
4491 if(GetImportedOrCreateDecl(
4492ToIvar,
D, Importer.
getToContext(), cast<ObjCContainerDecl>(DC),
4493ToInnerLocStart,
Loc, Name.getAsIdentifierInfo(),
4494ToType, ToTypeSourceInfo,
4495 D->getAccessControl(),ToBitWidth,
D->getSynthesize()))
4506 autoRedeclIt = Redecls.begin();
4509 for(; RedeclIt != Redecls.end() && *RedeclIt !=
D; ++RedeclIt) {
4512 returnRedeclOrErr.takeError();
4514assert(*RedeclIt ==
D);
4522 returnstd::move(Err);
4528 VarDecl*FoundByLookup =
nullptr;
4529 if(
D->isFileVarDecl()) {
4532 autoFoundDecls = Importer.findDeclsInToCtx(DC, Name);
4533 for(
auto*FoundDecl : FoundDecls) {
4537 if(
auto*FoundVar = dyn_cast<VarDecl>(FoundDecl)) {
4541FoundVar->getType())) {
4546 if(
D->isThisDeclarationADefinition() && FoundDef)
4553 const VarDecl*FoundDInit =
nullptr;
4554 if(
D->getInit() && FoundVar->getAnyInitializer(FoundDInit))
4558FoundByLookup = FoundVar;
4566 if(FoundArray && TArray) {
4567 if(isa<IncompleteArrayType>(FoundArray) &&
4568isa<ConstantArrayType>(TArray)) {
4570 if(
autoTyOrErr =
import(
D->getType()))
4571FoundVar->setType(*TyOrErr);
4573 returnTyOrErr.takeError();
4575FoundByLookup = FoundVar;
4577}
else if(isa<IncompleteArrayType>(TArray) &&
4578isa<ConstantArrayType>(FoundArray)) {
4579FoundByLookup = FoundVar;
4584Importer.
ToDiag(
Loc, diag::warn_odr_variable_type_inconsistent)
4585<< Name <<
D->getType() << FoundVar->getType();
4586Importer.
ToDiag(FoundVar->getLocation(), diag::note_odr_value_here)
4587<< FoundVar->getType();
4588ConflictingDecls.push_back(FoundDecl);
4592 if(!ConflictingDecls.empty()) {
4594Name, DC, IDNS, ConflictingDecls.data(), ConflictingDecls.size());
4596Name = NameOrErr.get();
4598 returnNameOrErr.takeError();
4602Error Err = Error::success();
4604 autoToTypeSourceInfo =
importChecked(Err,
D->getTypeSourceInfo());
4605 autoToInnerLocStart =
importChecked(Err,
D->getInnerLocStart());
4606 autoToQualifierLoc =
importChecked(Err,
D->getQualifierLoc());
4608 returnstd::move(Err);
4611 if(
auto*FromDecomp = dyn_cast<DecompositionDecl>(
D)) {
4615 returnstd::move(Err);
4617 if(GetImportedOrCreateDecl(
4618ToDecomp, FromDecomp, Importer.
getToContext(), DC, ToInnerLocStart,
4619 Loc, ToType, ToTypeSourceInfo,
D->getStorageClass(),
Bindings))
4624 if(GetImportedOrCreateDecl(ToVar,
D, Importer.
getToContext(), DC,
4625ToInnerLocStart,
Loc,
4626Name.getAsIdentifierInfo(), ToType,
4627ToTypeSourceInfo,
D->getStorageClass()))
4635 if(
D->isInlineSpecified())
4637 if(
D->isInline())
4640 if(FoundByLookup) {
4646 if(
D->getDescribedVarTemplate()) {
4647 autoToVTOrErr =
import(
D->getDescribedVarTemplate());
4649 returnToVTOrErr.takeError();
4652 VarDecl*FromInst =
D->getInstantiatedFromStaticDataMember();
4656 returnToInstOrErr.takeError();
4657 if(
ExpectedSLocPOIOrErr =
import(MSI->getPointOfInstantiation()))
4660 returnPOIOrErr.takeError();
4664 returnstd::move(Err);
4666 if(
D->isConstexpr())
4669addDeclToContexts(
D, ToVar);
4672 for(++RedeclIt; RedeclIt != Redecls.end(); ++RedeclIt) {
4675 returnRedeclOrErr.takeError();
4686Error Err = Error::success();
4691 returnstd::move(Err);
4695 if(GetImportedOrCreateDecl(ToParm,
D, Importer.
getToContext(), DC,
4696ToLocation, ToDeclName.getAsIdentifierInfo(),
4697ToType,
D->getParameterKind()))
4708 returnLocOrErr.takeError();
4717 returnToDefArgOrErr.takeError();
4721 if(
autoToDefArgOrErr =
import(FromParam->
getDefaultArg()))
4724 returnToDefArgOrErr.takeError();
4727 returnError::success();
4732Error Err = Error::success();
4737 returnstd::move(Err);
4746Error Err = Error::success();
4749 autoToInnerLocStart =
importChecked(Err,
D->getInnerLocStart());
4751 autoToTypeSourceInfo =
importChecked(Err,
D->getTypeSourceInfo());
4753 returnstd::move(Err);
4756 if(GetImportedOrCreateDecl(ToParm,
D, Importer.
getToContext(), DC,
4757ToInnerLocStart, ToLocation,
4758ToDeclName.getAsIdentifierInfo(), ToType,
4759ToTypeSourceInfo,
D->getStorageClass(),
4767 returnstd::move(Err);
4769 if(
D->isObjCMethodParameter()) {
4774 D->getFunctionScopeIndex());
4787 returnstd::move(Err);
4791 autoFoundDecls = Importer.findDeclsInToCtx(DC, Name);
4792 for(
auto*FoundDecl : FoundDecls) {
4793 if(
auto*FoundMethod = dyn_cast<ObjCMethodDecl>(FoundDecl)) {
4794 if(FoundMethod->isInstanceMethod() !=
D->isInstanceMethod())
4799FoundMethod->getReturnType())) {
4800Importer.
ToDiag(
Loc, diag::warn_odr_objc_method_result_type_inconsistent)
4801<<
D->isInstanceMethod() << Name <<
D->getReturnType()
4802<< FoundMethod->getReturnType();
4803Importer.
ToDiag(FoundMethod->getLocation(),
4804diag::note_odr_objc_method_here)
4805<<
D->isInstanceMethod() << Name;
4811 if(
D->param_size() != FoundMethod->param_size()) {
4812Importer.
ToDiag(
Loc, diag::warn_odr_objc_method_num_params_inconsistent)
4813<<
D->isInstanceMethod() << Name
4814<<
D->param_size() << FoundMethod->param_size();
4815Importer.
ToDiag(FoundMethod->getLocation(),
4816diag::note_odr_objc_method_here)
4817<<
D->isInstanceMethod() << Name;
4824PEnd =
D->param_end(), FoundP = FoundMethod->param_begin();
4825 P!= PEnd; ++
P, ++FoundP) {
4827(*FoundP)->getType())) {
4828Importer.
FromDiag((*P)->getLocation(),
4829diag::warn_odr_objc_method_param_type_inconsistent)
4830<<
D->isInstanceMethod() << Name
4831<< (*P)->getType() << (*FoundP)->getType();
4832Importer.
ToDiag((*FoundP)->getLocation(), diag::note_odr_value_here)
4833<< (*FoundP)->getType();
4841 if(
D->isVariadic() != FoundMethod->isVariadic()) {
4842Importer.
ToDiag(
Loc, diag::warn_odr_objc_method_variadic_inconsistent)
4843<<
D->isInstanceMethod() << Name;
4844Importer.
ToDiag(FoundMethod->getLocation(),
4845diag::note_odr_objc_method_here)
4846<<
D->isInstanceMethod() << Name;
4856Error Err = Error::success();
4859 autoToReturnTypeSourceInfo =
4862 returnstd::move(Err);
4865 if(GetImportedOrCreateDecl(
4867Name.getObjCSelector(), ToReturnType, ToReturnTypeSourceInfo, DC,
4868 D->isInstanceMethod(),
D->isVariadic(),
D->isPropertyAccessor(),
4869 D->isSynthesizedAccessorStub(),
D->
isImplicit(),
D->isDefined(),
4870 D->getImplementationControl(),
D->hasRelatedResultType()))
4878 for(
auto*FromP :
D->parameters()) {
4880ToParams.push_back(*ToPOrErr);
4882 returnToPOrErr.takeError();
4886 for(
auto*ToParam : ToParams) {
4887ToParam->setOwningFunction(ToMethod);
4892 D->getSelectorLocs(FromSelLocs);
4895 returnstd::move(Err);
4905 if(
D->getSelfDecl())
4919 returnstd::move(Err);
4923Error Err = Error::success();
4927 autoToTypeSourceInfo =
importChecked(Err,
D->getTypeSourceInfo());
4929 returnstd::move(Err);
4932 if(GetImportedOrCreateDecl(
4934ToVarianceLoc,
D->getIndex(),
4935ToLocation, Name.getAsIdentifierInfo(),
4936ToColonLoc, ToTypeSourceInfo))
4942 returnstd::move(Err);
4943 Result->setTypeForDecl(ToTypeForDecl);
4944 Result->setLexicalDeclContext(LexicalDC);
4955 returnstd::move(Err);
4960 if(Error Err = importInto(ToInterface,
D->getClassInterface()))
4961 returnstd::move(Err);
4969Error Err = Error::success();
4971 autoToCategoryNameLoc =
importChecked(Err,
D->getCategoryNameLoc());
4972 autoToIvarLBraceLoc =
importChecked(Err,
D->getIvarLBraceLoc());
4973 autoToIvarRBraceLoc =
importChecked(Err,
D->getIvarRBraceLoc());
4975 returnstd::move(Err);
4977 if(GetImportedOrCreateDecl(ToCategory,
D, Importer.
getToContext(), DC,
4980Name.getAsIdentifierInfo(), ToInterface,
4993 returnPListOrErr.takeError();
4999=
D->protocol_loc_begin();
5001FromProtoEnd =
D->protocol_end();
5002FromProto != FromProtoEnd;
5003++FromProto, ++FromProtoLoc) {
5005Protocols.push_back(*ToProtoOrErr);
5007 returnToProtoOrErr.takeError();
5009 if(
ExpectedSLocToProtoLocOrErr =
import(*FromProtoLoc))
5010ProtocolLocs.push_back(*ToProtoLocOrErr);
5012 returnToProtoLocOrErr.takeError();
5025 returnstd::move(Err);
5028 if(
D->getImplementation()) {
5030 import(
D->getImplementation()))
5033 returnToImplOrErr.takeError();
5045 returnError::success();
5058FromProto != FromProtoEnd;
5059++FromProto, ++FromProtoLoc) {
5061Protocols.push_back(*ToProtoOrErr);
5063 returnToProtoOrErr.takeError();
5065 if(
ExpectedSLocToProtoLocOrErr =
import(*FromProtoLoc))
5066ProtocolLocs.push_back(*ToProtoLocOrErr);
5068 returnToProtoLocOrErr.takeError();
5081 returnError::success();
5093 returnImportedDefOrErr.takeError();
5102 returnstd::move(Err);
5107 autoFoundDecls = Importer.findDeclsInToCtx(DC, Name);
5108 for(
auto*FoundDecl : FoundDecls) {
5112 if((MergeWithProtocol = dyn_cast<ObjCProtocolDecl>(FoundDecl)))
5118 autoToAtBeginLocOrErr =
import(
D->getAtStartLoc());
5119 if(!ToAtBeginLocOrErr)
5120 returnToAtBeginLocOrErr.takeError();
5122 if(GetImportedOrCreateDecl(ToProto,
D, Importer.
getToContext(), DC,
5123Name.getAsIdentifierInfo(),
Loc,
5133 if(
D->isThisDeclarationADefinition())
5135 returnstd::move(Err);
5143 returnstd::move(Err);
5146 if(!ExternLocOrErr)
5147 returnExternLocOrErr.takeError();
5151 returnLangLocOrErr.takeError();
5153 boolHasBraces =
D->hasBraces();
5156 if(GetImportedOrCreateDecl(ToLinkageSpec,
D, Importer.
getToContext(), DC,
5157*ExternLocOrErr, *LangLocOrErr,
5158 D->getLanguage(), HasBraces))
5159 returnToLinkageSpec;
5163 if(!RBraceLocOrErr)
5164 returnRBraceLocOrErr.takeError();
5171 returnToLinkageSpec;
5182 returnToShadowOrErr.takeError();
5193 returnstd::move(Err);
5197Error Err = Error::success();
5200 autoToQualifierLoc =
importChecked(Err,
D->getQualifierLoc());
5202 returnstd::move(Err);
5206 returnstd::move(Err);
5209 if(GetImportedOrCreateDecl(ToUsing,
D, Importer.
getToContext(), DC,
5210ToUsingLoc, ToQualifierLoc, NameInfo,
5221ToUsing, *ToPatternOrErr);
5223 returnToPatternOrErr.takeError();
5235 returnstd::move(Err);
5239Error Err = Error::success();
5245 returnstd::move(Err);
5248 if(GetImportedOrCreateDecl(ToUsingEnum,
D, Importer.
getToContext(), DC,
5249ToUsingLoc, ToEnumLoc, ToNameLoc, ToEnumType))
5261 returnToPatternOrErr.takeError();
5273 returnstd::move(Err);
5278 if(!ToIntroducerOrErr)
5279 returnToIntroducerOrErr.takeError();
5283 returnToTargetOrErr.takeError();
5286 if(
auto*FromConstructorUsingShadow =
5287dyn_cast<ConstructorUsingShadowDecl>(
D)) {
5288Error Err = Error::success();
5290Err, FromConstructorUsingShadow->getNominatedBaseClassShadowDecl());
5292 returnstd::move(Err);
5298 if(GetImportedOrCreateDecl<ConstructorUsingShadowDecl>(
5300cast<UsingDecl>(*ToIntroducerOrErr),
5301Nominated ? Nominated : *ToTargetOrErr,
5302FromConstructorUsingShadow->constructsVirtualBase()))
5305 if(GetImportedOrCreateDecl(ToShadow,
D, Importer.
getToContext(), DC,
Loc,
5306Name, *ToIntroducerOrErr, *ToTargetOrErr))
5317ToShadow, *ToPatternOrErr);
5321 returnToPatternOrErr.takeError();
5335 returnstd::move(Err);
5339 autoToComAncestorOrErr = Importer.
ImportContext(
D->getCommonAncestor());
5340 if(!ToComAncestorOrErr)
5341 returnToComAncestorOrErr.takeError();
5343Error Err = Error::success();
5344 autoToNominatedNamespace =
importChecked(Err,
D->getNominatedNamespace());
5346 autoToNamespaceKeyLocation =
5348 autoToQualifierLoc =
importChecked(Err,
D->getQualifierLoc());
5349 autoToIdentLocation =
importChecked(Err,
D->getIdentLocation());
5351 returnstd::move(Err);
5354 if(GetImportedOrCreateDecl(ToUsingDir,
D, Importer.
getToContext(), DC,
5356ToNamespaceKeyLocation,
5359ToNominatedNamespace, *ToComAncestorOrErr))
5374 returnstd::move(Err);
5378 autoToInstantiatedFromUsingOrErr =
5379Importer.
Import(
D->getInstantiatedFromUsingDecl());
5380 if(!ToInstantiatedFromUsingOrErr)
5381 returnToInstantiatedFromUsingOrErr.takeError();
5384 returnstd::move(Err);
5387 if(GetImportedOrCreateDecl(ToUsingPack,
D, Importer.
getToContext(), DC,
5388cast<NamedDecl>(*ToInstantiatedFromUsingOrErr),
5392addDeclToContexts(
D, ToUsingPack);
5404 returnstd::move(Err);
5408Error Err = Error::success();
5411 autoToQualifierLoc =
importChecked(Err,
D->getQualifierLoc());
5414 returnstd::move(Err);
5418 returnstd::move(Err);
5421 if(GetImportedOrCreateDecl(ToUsingValue,
D, Importer.
getToContext(), DC,
5422ToUsingLoc, ToQualifierLoc, NameInfo,
5424 returnToUsingValue;
5430 returnToUsingValue;
5440 returnstd::move(Err);
5444Error Err = Error::success();
5447 autoToQualifierLoc =
importChecked(Err,
D->getQualifierLoc());
5450 returnstd::move(Err);
5453 if(GetImportedOrCreateDecl(ToUsing,
D, Importer.
getToContext(), DC,
5454ToUsingLoc, ToTypenameLoc,
5455ToQualifierLoc,
Loc, Name, ToEllipsisLoc))
5466 Decl* ToD =
nullptr;
5467 switch(
D->getBuiltinTemplateKind()) {
5478assert(ToD &&
"BuiltinTemplateDecl of unsupported kind!");
5489 if(
autoFromSuperOrErr =
import(FromSuper))
5490FromSuper = *FromSuperOrErr;
5492 returnFromSuperOrErr.takeError();
5496 if((
bool)FromSuper != (
bool)ToSuper ||
5499diag::warn_odr_objc_superclass_inconsistent)
5506diag::note_odr_objc_missing_superclass);
5509diag::note_odr_objc_superclass)
5513diag::note_odr_objc_missing_superclass);
5519 returnError::success();
5530 returnSuperTInfoOrErr.takeError();
5541FromProto != FromProtoEnd;
5542++FromProto, ++FromProtoLoc) {
5544Protocols.push_back(*ToProtoOrErr);
5546 returnToProtoOrErr.takeError();
5548 if(
ExpectedSLocToProtoLocOrErr =
import(*FromProtoLoc))
5549ProtocolLocs.push_back(*ToProtoLocOrErr);
5551 returnToProtoLocOrErr.takeError();
5562 autoToCatOrErr =
import(Cat);
5564 returnToCatOrErr.takeError();
5573 returnToImplOrErr.takeError();
5580 returnError::success();
5589 for(
auto*fromTypeParam : *list) {
5590 if(
autotoTypeParamOrErr =
import(fromTypeParam))
5591toTypeParams.push_back(*toTypeParamOrErr);
5593 returntoTypeParamOrErr.takeError();
5597 if(!LAngleLocOrErr)
5598 returnLAngleLocOrErr.takeError();
5601 if(!RAngleLocOrErr)
5602 returnRAngleLocOrErr.takeError();
5619 returnImportedDefOrErr.takeError();
5628 returnstd::move(Err);
5634 autoFoundDecls = Importer.findDeclsInToCtx(DC, Name);
5635 for(
auto*FoundDecl : FoundDecls) {
5639 if((MergeWithIface = dyn_cast<ObjCInterfaceDecl>(FoundDecl)))
5646 ExpectedSLocAtBeginLocOrErr =
import(
D->getAtStartLoc());
5647 if(!AtBeginLocOrErr)
5648 returnAtBeginLocOrErr.takeError();
5650 if(GetImportedOrCreateDecl(
5652*AtBeginLocOrErr, Name.getAsIdentifierInfo(),
5654 nullptr,
Loc,
D->isImplicitInterfaceDecl()))
5662 if(
autoToPListOrErr =
5666 returnToPListOrErr.takeError();
5668 if(
D->isThisDeclarationADefinition())
5670 returnstd::move(Err);
5678 if(Error Err = importInto(
Category,
D->getCategoryDecl()))
5679 returnstd::move(Err);
5685 returnstd::move(Err);
5687Error Err = Error::success();
5690 autoToCategoryNameLoc =
importChecked(Err,
D->getCategoryNameLoc());
5692 returnstd::move(Err);
5694 if(GetImportedOrCreateDecl(
5696Importer.
Import(
D->getIdentifier()),
Category->getClassInterface(),
5697ToLocation, ToAtStartLoc, ToCategoryNameLoc))
5702 Category->setImplementation(ToImpl);
5707 returnstd::move(Err);
5716 if(Error Err = importInto(Iface,
D->getClassInterface()))
5717 returnstd::move(Err);
5721 if(Error Err = importInto(Super,
D->getSuperClass()))
5722 returnstd::move(Err);
5730 returnstd::move(Err);
5732Error Err = Error::success();
5735 autoToSuperClassLoc =
importChecked(Err,
D->getSuperClassLoc());
5736 autoToIvarLBraceLoc =
importChecked(Err,
D->getIvarLBraceLoc());
5737 autoToIvarRBraceLoc =
importChecked(Err,
D->getIvarRBraceLoc());
5739 returnstd::move(Err);
5741 if(GetImportedOrCreateDecl(Impl,
D, Importer.
getToContext(),
5765diag::warn_odr_objc_superclass_inconsistent)
5771diag::note_odr_objc_superclass)
5775diag::note_odr_objc_missing_superclass);
5776 if(
D->getSuperClass())
5778diag::note_odr_objc_superclass)
5779<<
D->getSuperClass()->getDeclName();
5782diag::note_odr_objc_missing_superclass);
5790 returnstd::move(Err);
5802 returnstd::move(Err);
5807 autoFoundDecls = Importer.findDeclsInToCtx(DC, Name);
5808 for(
auto*FoundDecl : FoundDecls) {
5809 if(
auto*FoundProp = dyn_cast<ObjCPropertyDecl>(FoundDecl)) {
5812 if(FoundProp->isInstanceProperty() !=
D->isInstanceProperty())
5817FoundProp->getType())) {
5818Importer.
ToDiag(
Loc, diag::warn_odr_objc_property_type_inconsistent)
5819<< Name <<
D->getType() << FoundProp->getType();
5820Importer.
ToDiag(FoundProp->getLocation(), diag::note_odr_value_here)
5821<< FoundProp->getType();
5834Error Err = Error::success();
5836 autoToTypeSourceInfo =
importChecked(Err,
D->getTypeSourceInfo());
5840 returnstd::move(Err);
5844 if(GetImportedOrCreateDecl(
5846Name.getAsIdentifierInfo(), ToAtLoc,
5847ToLParenLoc, ToType,
5848ToTypeSourceInfo,
D->getPropertyImplementation()))
5853 autoToGetterNameLoc =
importChecked(Err,
D->getGetterNameLoc());
5854 autoToSetterNameLoc =
importChecked(Err,
D->getSetterNameLoc());
5855 autoToGetterMethodDecl =
importChecked(Err,
D->getGetterMethodDecl());
5856 autoToSetterMethodDecl =
importChecked(Err,
D->getSetterMethodDecl());
5857 autoToPropertyIvarDecl =
importChecked(Err,
D->getPropertyIvarDecl());
5859 returnstd::move(Err);
5866 D->getPropertyAttributesAsWritten());
5878 if(Error Err = importInto(
Property,
D->getPropertyDecl()))
5879 returnstd::move(Err);
5883 returnstd::move(Err);
5885 auto*InImpl = cast<ObjCImplDecl>(LexicalDC);
5889 if(Error Err = importInto(Ivar,
D->getPropertyIvarDecl()))
5890 returnstd::move(Err);
5893= InImpl->FindPropertyImplDecl(
Property->getIdentifier(),
5897Error Err = Error::success();
5900 autoToPropertyIvarDeclLoc =
5903 returnstd::move(Err);
5905 if(GetImportedOrCreateDecl(ToImpl,
D, Importer.
getToContext(), DC,
5908 D->getPropertyImplementation(), Ivar,
5909ToPropertyIvarDeclLoc))
5919diag::warn_odr_objc_property_impl_kind_inconsistent)
5924diag::note_odr_objc_property_impl_kind)
5925<<
D->getPropertyDecl()->getDeclName()
5935diag::warn_odr_objc_synthesize_ivar_inconsistent)
5939Importer.
FromDiag(
D->getPropertyIvarDeclLoc(),
5940diag::note_odr_objc_synthesize_ivar_here)
5941<<
D->getPropertyIvarDecl()->getDeclName();
5961 returnBeginLocOrErr.takeError();
5965 returnLocationOrErr.takeError();
5968 if(GetImportedOrCreateDecl(
5971*BeginLocOrErr, *LocationOrErr,
5972 D->getDepth(),
D->getIndex(), Importer.
Import(
D->getIdentifier()),
5974 D->hasTypeConstraint()))
5980Error Err = Error::success();
5981 autoToConceptRef =
importChecked(Err, TC->getConceptReference());
5982 autoToIDC =
importChecked(Err, TC->getImmediatelyDeclaredConstraint());
5984 returnstd::move(Err);
5989 if(Error Err = importTemplateParameterDefaultArgument(
D, ToD))
5998Error Err = Error::success();
6002 autoToTypeSourceInfo =
importChecked(Err,
D->getTypeSourceInfo());
6003 autoToInnerLocStart =
importChecked(Err,
D->getInnerLocStart());
6005 returnstd::move(Err);
6008 if(GetImportedOrCreateDecl(ToD,
D, Importer.
getToContext(),
6010ToInnerLocStart, ToLocation,
D->getDepth(),
6012ToDeclName.getAsIdentifierInfo(), ToType,
6016Err = importTemplateParameterDefaultArgument(
D, ToD);
6026 autoNameOrErr =
import(
D->getDeclName());
6028 returnNameOrErr.takeError();
6033 returnLocationOrErr.takeError();
6036 autoTemplateParamsOrErr =
import(
D->getTemplateParameters());
6037 if(!TemplateParamsOrErr)
6038 returnTemplateParamsOrErr.takeError();
6041 if(GetImportedOrCreateDecl(
6045(*NameOrErr).getAsIdentifierInfo(),
D->wasDeclaredWithTypename(),
6046*TemplateParamsOrErr))
6049 if(Error Err = importTemplateParameterDefaultArgument(
D, ToD))
6058assert(
D->getTemplatedDecl() &&
"Should be called on templates only");
6059 auto*ToTemplatedDef =
D->getTemplatedDecl()->getDefinition();
6060 if(!ToTemplatedDef)
6063 returncast_or_null<T>(TemplateWithDef);
6074 returnstd::move(Err);
6088 boolDependentFriend = IsDependentFriend(
D);
6095 autoFoundDecls = Importer.findDeclsInToCtx(DC, Name);
6096 for(
auto*FoundDecl : FoundDecls) {
6101 auto*FoundTemplate = dyn_cast<ClassTemplateDecl>(FoundDecl);
6102 if(FoundTemplate) {
6107 boolIgnoreTemplateParmDepth =
6111IgnoreTemplateParmDepth)) {
6112 if(DependentFriend || IsDependentFriend(FoundTemplate))
6117 if(
D->isThisDeclarationADefinition() && TemplateWithDef)
6120FoundByLookup = FoundTemplate;
6138ConflictingDecls.push_back(FoundDecl);
6142 if(!ConflictingDecls.empty()) {
6145ConflictingDecls.size());
6147Name = NameOrErr.get();
6149 returnNameOrErr.takeError();
6155 autoTemplateParamsOrErr =
import(
D->getTemplateParameters());
6156 if(!TemplateParamsOrErr)
6157 returnTemplateParamsOrErr.takeError();
6161 if(Error Err = importInto(ToTemplated, FromTemplated))
6162 returnstd::move(Err);
6166 if(GetImportedOrCreateDecl(D2,
D, Importer.
getToContext(), DC,
Loc, Name,
6167*TemplateParamsOrErr, ToTemplated))
6175addDeclToContexts(
D, D2);
6176updateLookupTableForTemplateParameters(**TemplateParamsOrErr);
6178 if(FoundByLookup) {
6192 "Found decl must have its templated decl set");
6195 if(ToTemplated != PrevTemplated)
6208 if(Error Err = importInto(ClassTemplate,
D->getSpecializedTemplate()))
6209 returnstd::move(Err);
6214 returnstd::move(Err);
6220 returnstd::move(Err);
6223 void*InsertPos =
nullptr;
6226dyn_cast<ClassTemplatePartialSpecializationDecl>(
D);
6234 returnToTPListOrErr.takeError();
6235ToTPList = *ToTPListOrErr;
6245 if(
D->isThisDeclarationADefinition() && PrevDefinition) {
6249 for(
auto*FromField :
D->fields()) {
6250 autoToOrErr =
import(FromField);
6252 returnToOrErr.takeError();
6258 autoToOrErr =
import(FromM);
6260 returnToOrErr.takeError();
6268 returnPrevDefinition;
6279 returnBeginLocOrErr.takeError();
6282 returnIdLocOrErr.takeError();
6286 if(
const auto*ASTTemplateArgs =
D->getTemplateArgsAsWritten()) {
6288 returnstd::move(Err);
6295 if(Error Err = importInto(
6297 returnstd::move(Err);
6300 if(GetImportedOrCreateDecl<ClassTemplatePartialSpecializationDecl>(
6301D2,
D, Importer.
getToContext(),
D->getTagKind(), DC, *BeginLocOrErr,
6302*IdLocOrErr, ToTPList, ClassTemplate,
6305cast_or_null<ClassTemplatePartialSpecializationDecl>(PrevDecl)))
6310 auto*PartSpec2 = cast<ClassTemplatePartialSpecializationDecl>(D2);
6317PartSpec2->setInstantiatedFromMember(*ToInstOrErr);
6319 returnToInstOrErr.takeError();
6321updateLookupTableForTemplateParameters(*ToTPList);
6323 if(GetImportedOrCreateDecl(
6325*BeginLocOrErr, *IdLocOrErr, ClassTemplate, TemplateArgs,
6346 if(
autoBraceRangeOrErr =
import(
D->getBraceRange()))
6349 returnBraceRangeOrErr.takeError();
6352 returnstd::move(Err);
6355 if(
autoLocOrErr =
import(
D->getQualifierLoc()))
6358 returnLocOrErr.takeError();
6360 if(
D->getTemplateArgsAsWritten())
6363 if(
autoLocOrErr =
import(
D->getTemplateKeywordLoc()))
6366 returnLocOrErr.takeError();
6368 if(
autoLocOrErr =
import(
D->getExternKeywordLoc()))
6371 returnLocOrErr.takeError();
6373 if(
D->getPointOfInstantiation().isValid()) {
6374 if(
autoPOIOrErr =
import(
D->getPointOfInstantiation()))
6377 returnPOIOrErr.takeError();
6382 if(
auto P=
D->getInstantiatedFrom()) {
6383 if(
auto*CTD = dyn_cast<ClassTemplateDecl *>(
P)) {
6384 if(
autoCTDorErr =
import(CTD))
6387 auto*CTPSD = cast<ClassTemplatePartialSpecializationDecl *>(
P);
6388 autoCTPSDOrErr =
import(CTPSD);
6390 returnCTPSDOrErr.takeError();
6393 for(
unsignedI = 0; I < DArgs.
size(); ++I) {
6395 if(
autoArgOrErr =
import(DArg))
6396D2ArgsVec[I] = *ArgOrErr;
6398 returnArgOrErr.takeError();
6406 if(
D->isCompleteDefinition())
6408 returnstd::move(Err);
6420 returnstd::move(Err);
6426 "Variable templates cannot be declared at function scope");
6429 autoFoundDecls = Importer.findDeclsInToCtx(DC, Name);
6431 for(
auto*FoundDecl : FoundDecls) {
6435 if(
VarTemplateDecl*FoundTemplate = dyn_cast<VarTemplateDecl>(FoundDecl)) {
6438 D->getTemplatedDecl()))
6445assert(FoundTemplate->getDeclContext()->isRecord() &&
6446 "Member variable template imported as non-member, " 6447 "inconsistent imported AST?");
6450 if(!
D->isThisDeclarationADefinition())
6453 if(FoundDef &&
D->isThisDeclarationADefinition())
6456FoundByLookup = FoundTemplate;
6459ConflictingDecls.push_back(FoundDecl);
6463 if(!ConflictingDecls.empty()) {
6466ConflictingDecls.size());
6468Name = NameOrErr.get();
6470 returnNameOrErr.takeError();
6473 VarDecl*DTemplated =
D->getTemplatedDecl();
6479 returnTypeOrErr.takeError();
6483 if(Error Err = importInto(ToTemplated, DTemplated))
6484 returnstd::move(Err);
6487 autoTemplateParamsOrErr =
import(
D->getTemplateParameters());
6488 if(!TemplateParamsOrErr)
6489 returnTemplateParamsOrErr.takeError();
6492 if(GetImportedOrCreateDecl(ToVarTD,
D, Importer.
getToContext(), DC,
Loc,
6493Name, *TemplateParamsOrErr, ToTemplated))
6502updateLookupTableForTemplateParameters(**TemplateParamsOrErr);
6504 if(FoundByLookup) {
6508 auto*PrevTemplated =
6510 if(ToTemplated != PrevTemplated)
6525 autoRedeclIt = Redecls.begin();
6528 for(; RedeclIt != Redecls.end() && *RedeclIt !=
D; ++RedeclIt) {
6531 returnRedeclOrErr.takeError();
6533assert(*RedeclIt ==
D);
6536 if(Error Err = importInto(VarTemplate,
D->getSpecializedTemplate()))
6537 returnstd::move(Err);
6542 returnstd::move(Err);
6547 returnBeginLocOrErr.takeError();
6551 returnIdLocOrErr.takeError();
6557 returnstd::move(Err);
6560 void*InsertPos =
nullptr;
6563 if(FoundSpecialization) {
6571 "Member variable template specialization imported as non-member, " 6572 "inconsistent imported AST?");
6575 if(!
D->isThisDeclarationADefinition())
6576 returnImporter.
MapImported(
D, FoundSpecialization);
6580 if(FoundDef &&
D->isThisDeclarationADefinition())
6591 if(
const auto*Args =
D->getTemplateArgsAsWritten()) {
6593 returnstd::move(Err);
6598 if(
auto*FromPartial = dyn_cast<PartVarSpecDecl>(
D)) {
6599 autoToTPListOrErr =
import(FromPartial->getTemplateParameters());
6601 returnToTPListOrErr.takeError();
6603PartVarSpecDecl *ToPartial;
6604 if(GetImportedOrCreateDecl(ToPartial,
D, Importer.
getToContext(), DC,
6605*BeginLocOrErr, *IdLocOrErr, *ToTPListOrErr,
6606VarTemplate,
QualType(),
nullptr,
6607 D->getStorageClass(), TemplateArgs))
6611 import(FromPartial->getInstantiatedFromMember()))
6614 returnToInstOrErr.takeError();
6616 if(FromPartial->isMemberSpecialization())
6617ToPartial->setMemberSpecialization();
6625 if(GetImportedOrCreateDecl(D2,
D, Importer.
getToContext(), DC,
6626*BeginLocOrErr, *IdLocOrErr, VarTemplate,
6627 QualType(),
nullptr,
D->getStorageClass(),
6638 if(Error Err = importInto(
T,
D->getType()))
6639 returnstd::move(Err);
6642 autoTInfoOrErr =
import(
D->getTypeSourceInfo());
6644 returnTInfoOrErr.takeError();
6647 if(
D->getPointOfInstantiation().isValid()) {
6648 if(
ExpectedSLocPOIOrErr =
import(
D->getPointOfInstantiation()))
6651 returnPOIOrErr.takeError();
6656 if(
D->getTemplateArgsAsWritten())
6659 if(
autoLocOrErr =
import(
D->getQualifierLoc()))
6662 returnLocOrErr.takeError();
6664 if(
D->isConstexpr())
6670 returnstd::move(Err);
6672 if(FoundSpecialization)
6675addDeclToContexts(
D, D2);
6678 for(++RedeclIt; RedeclIt != Redecls.end(); ++RedeclIt) {
6681 returnRedeclOrErr.takeError();
6695 returnstd::move(Err);
6707 autoFoundDecls = Importer.findDeclsInToCtx(DC, Name);
6708 for(
auto*FoundDecl : FoundDecls) {
6712 if(
auto*FoundTemplate = dyn_cast<FunctionTemplateDecl>(FoundDecl)) {
6718 if(
D->isThisDeclarationADefinition() && TemplateWithDef)
6721FoundByLookup = FoundTemplate;
6729 autoParamsOrErr =
import(
D->getTemplateParameters());
6731 returnParamsOrErr.takeError();
6735 if(Error Err = importInto(TemplatedFD,
D->getTemplatedDecl()))
6736 returnstd::move(Err);
6753OldParamDC.reserve(Params->
size());
6754llvm::transform(*Params, std::back_inserter(OldParamDC),
6758 if(GetImportedOrCreateDecl(ToFunc,
D, Importer.
getToContext(), DC,
Loc, Name,
6759Params, TemplatedFD))
6773ToFunc->setLexicalDeclContext(LexicalDC);
6774addDeclToContexts(
D, ToFunc);
6777 if(
LT&& !OldParamDC.empty()) {
6778 for(
unsigned intI = 0; I < OldParamDC.size(); ++I)
6782 if(FoundByLookup) {
6787 "Found decl must have its templated decl set");
6788 auto*PrevTemplated =
6790 if(TemplatedFD != PrevTemplated)
6793ToFunc->setPreviousDecl(Recent);
6804Importer.
FromDiag(S->getBeginLoc(), diag::err_unsupported_ast_node)
6805<< S->getStmtClassName();
6814 for(
unsignedI = 0,
E= S->getNumOutputs(); I !=
E; I++) {
6818Names.push_back(ToII);
6821 for(
unsignedI = 0,
E= S->getNumInputs(); I !=
E; I++) {
6825Names.push_back(ToII);
6829 for(
unsignedI = 0,
E= S->getNumClobbers(); I !=
E; I++) {
6830 if(
autoClobberOrErr =
import(S->getClobberStringLiteral(I)))
6831Clobbers.push_back(*ClobberOrErr);
6833 returnClobberOrErr.takeError();
6838 for(
unsignedI = 0,
E= S->getNumOutputs(); I !=
E; I++) {
6839 if(
autoOutputOrErr =
import(S->getOutputConstraintLiteral(I)))
6840Constraints.push_back(*OutputOrErr);
6842 returnOutputOrErr.takeError();
6845 for(
unsignedI = 0,
E= S->getNumInputs(); I !=
E; I++) {
6846 if(
autoInputOrErr =
import(S->getInputConstraintLiteral(I)))
6847Constraints.push_back(*InputOrErr);
6849 returnInputOrErr.takeError();
6855 returnstd::move(Err);
6859 returnstd::move(Err);
6862S->labels(), Exprs.begin() + S->getNumOutputs() + S->getNumInputs()))
6863 returnstd::move(Err);
6867 returnAsmLocOrErr.takeError();
6868 autoAsmStrOrErr =
import(S->getAsmString());
6870 returnAsmStrOrErr.takeError();
6871 ExpectedSLocRParenLocOrErr =
import(S->getRParenLoc());
6872 if(!RParenLocOrErr)
6873 returnRParenLocOrErr.takeError();
6886S->getNumClobbers(),
6894Error Err = Error::success();
6899 returnstd::move(Err);
6904 ExpectedSLocToSemiLocOrErr =
import(S->getSemiLoc());
6905 if(!ToSemiLocOrErr)
6906 returnToSemiLocOrErr.takeError();
6908*ToSemiLocOrErr, S->hasLeadingEmptyMacro());
6915 returnstd::move(Err);
6917 ExpectedSLocToLBracLocOrErr =
import(S->getLBracLoc());
6918 if(!ToLBracLocOrErr)
6919 returnToLBracLocOrErr.takeError();
6921 ExpectedSLocToRBracLocOrErr =
import(S->getRBracLoc());
6922 if(!ToRBracLocOrErr)
6923 returnToRBracLocOrErr.takeError();
6928*ToLBracLocOrErr, *ToRBracLocOrErr);
6933Error Err = Error::success();
6938 autoToEllipsisLoc =
importChecked(Err, S->getEllipsisLoc());
6941 returnstd::move(Err);
6944ToCaseLoc, ToEllipsisLoc, ToColonLoc);
6945ToStmt->setSubStmt(ToSubStmt);
6952Error Err = Error::success();
6953 autoToDefaultLoc =
importChecked(Err, S->getDefaultLoc());
6957 returnstd::move(Err);
6960ToDefaultLoc, ToColonLoc, ToSubStmt);
6965Error Err = Error::success();
6970 returnstd::move(Err);
6973ToIdentLoc, ToLabelDecl, ToSubStmt);
6978 if(!ToAttrLocOrErr)
6979 returnToAttrLocOrErr.takeError();
6983 returnstd::move(Err);
6984 ExpectedStmtToSubStmtOrErr =
import(S->getSubStmt());
6985 if(!ToSubStmtOrErr)
6986 returnToSubStmtOrErr.takeError();
6989Importer.
getToContext(), *ToAttrLocOrErr, ToAttrs, *ToSubStmtOrErr);
6994Error Err = Error::success();
6997 autoToConditionVariable =
importChecked(Err, S->getConditionVariable());
7005 returnstd::move(Err);
7008ToInit, ToConditionVariable, ToCond, ToLParenLoc,
7009ToRParenLoc, ToThen, ToElseLoc, ToElse);
7014Error Err = Error::success();
7016 autoToConditionVariable =
importChecked(Err, S->getConditionVariable());
7023 returnstd::move(Err);
7027ToCond, ToLParenLoc, ToRParenLoc);
7028ToStmt->setBody(ToBody);
7029ToStmt->setSwitchLoc(ToSwitchLoc);
7032 SwitchCase*LastChainedSwitchCase =
nullptr;
7033 for(
SwitchCase*SC = S->getSwitchCaseList(); SC !=
nullptr;
7034SC = SC->getNextSwitchCase()) {
7037 returnToSCOrErr.takeError();
7038 if(LastChainedSwitchCase)
7041ToStmt->setSwitchCaseList(*ToSCOrErr);
7042LastChainedSwitchCase = *ToSCOrErr;
7050Error Err = Error::success();
7051 autoToConditionVariable =
importChecked(Err, S->getConditionVariable());
7058 returnstd::move(Err);
7061ToBody, ToWhileLoc, ToLParenLoc, ToRParenLoc);
7066Error Err = Error::success();
7073 returnstd::move(Err);
7076ToBody, ToCond, ToDoLoc, ToWhileLoc, ToRParenLoc);
7081Error Err = Error::success();
7084 autoToConditionVariable =
importChecked(Err, S->getConditionVariable());
7091 returnstd::move(Err);
7095ToInit, ToCond, ToConditionVariable, ToInc, ToBody, ToForLoc, ToLParenLoc,
7101Error Err = Error::success();
7106 returnstd::move(Err);
7109ToLabel, ToGotoLoc, ToLabelLoc);
7114Error Err = Error::success();
7119 returnstd::move(Err);
7122ToGotoLoc, ToStarLoc, ToTarget);
7126 ExpectedSLocToContinueLocOrErr =
import(S->getContinueLoc());
7127 if(!ToContinueLocOrErr)
7128 returnToContinueLocOrErr.takeError();
7133 autoToBreakLocOrErr =
import(S->getBreakLoc());
7134 if(!ToBreakLocOrErr)
7135 returnToBreakLocOrErr.takeError();
7141Error Err = Error::success();
7144 autoToNRVOCandidate =
importChecked(Err, S->getNRVOCandidate());
7146 returnstd::move(Err);
7154Error Err = Error::success();
7156 autoToExceptionDecl =
importChecked(Err, S->getExceptionDecl());
7157 autoToHandlerBlock =
importChecked(Err, S->getHandlerBlock());
7159 returnstd::move(Err);
7162ToCatchLoc, ToExceptionDecl, ToHandlerBlock);
7168 returnToTryLocOrErr.takeError();
7170 ExpectedStmtToTryBlockOrErr =
import(S->getTryBlock());
7171 if(!ToTryBlockOrErr)
7172 returnToTryBlockOrErr.takeError();
7175 for(
unsignedHI = 0, HE = S->getNumHandlers(); HI != HE; ++HI) {
7177 if(
autoToHandlerOrErr =
import(FromHandler))
7178ToHandlers[HI] = *ToHandlerOrErr;
7180 returnToHandlerOrErr.takeError();
7184cast<CompoundStmt>(*ToTryBlockOrErr), ToHandlers);
7189Error Err = Error::success();
7196 autoToLoopVarStmt =
importChecked(Err, S->getLoopVarStmt());
7199 autoToCoawaitLoc =
importChecked(Err, S->getCoawaitLoc());
7203 returnstd::move(Err);
7206ToInit, ToRangeStmt, ToBeginStmt, ToEndStmt, ToCond, ToInc, ToLoopVarStmt,
7207ToBody, ToForLoc, ToCoawaitLoc, ToColonLoc, ToRParenLoc);
7212Error Err = Error::success();
7214 autoToCollection =
importChecked(Err, S->getCollection());
7219 returnstd::move(Err);
7230Error Err = Error::success();
7231 autoToAtCatchLoc =
importChecked(Err, S->getAtCatchLoc());
7233 autoToCatchParamDecl =
importChecked(Err, S->getCatchParamDecl());
7236 returnstd::move(Err);
7239ToAtCatchLoc, ToRParenLoc, ToCatchParamDecl, ToCatchBody);
7243 ExpectedSLocToAtFinallyLocOrErr =
import(S->getAtFinallyLoc());
7244 if(!ToAtFinallyLocOrErr)
7245 returnToAtFinallyLocOrErr.takeError();
7246 ExpectedStmtToAtFinallyStmtOrErr =
import(S->getFinallyBody());
7247 if(!ToAtFinallyStmtOrErr)
7248 returnToAtFinallyStmtOrErr.takeError();
7250*ToAtFinallyStmtOrErr);
7255Error Err = Error::success();
7258 autoToFinallyStmt =
importChecked(Err, S->getFinallyStmt());
7260 returnstd::move(Err);
7263 for(
unsignedCI = 0, CE = S->getNumCatchStmts(); CI != CE; ++CI) {
7265 if(
ExpectedStmtToCatchStmtOrErr =
import(FromCatchStmt))
7266ToCatchStmts[CI] = *ToCatchStmtOrErr;
7268 returnToCatchStmtOrErr.takeError();
7272ToAtTryLoc, ToTryBody,
7273ToCatchStmts.begin(), ToCatchStmts.size(),
7280Error Err = Error::success();
7281 autoToAtSynchronizedLoc =
importChecked(Err, S->getAtSynchronizedLoc());
7285 returnstd::move(Err);
7288ToAtSynchronizedLoc, ToSynchExpr, ToSynchBody);
7292 ExpectedSLocToThrowLocOrErr =
import(S->getThrowLoc());
7293 if(!ToThrowLocOrErr)
7294 returnToThrowLocOrErr.takeError();
7295 ExpectedExprToThrowExprOrErr =
import(S->getThrowExpr());
7296 if(!ToThrowExprOrErr)
7297 returnToThrowExprOrErr.takeError();
7299*ToThrowLocOrErr, *ToThrowExprOrErr);
7306 returnToAtLocOrErr.takeError();
7307 ExpectedStmtToSubStmtOrErr =
import(S->getSubStmt());
7308 if(!ToSubStmtOrErr)
7309 returnToSubStmtOrErr.takeError();
7324Error Err = Error::success();
7329 returnstd::move(Err);
7330 autoParentContextOrErr = Importer.
ImportContext(
E->getParentContext());
7331 if(!ParentContextOrErr)
7332 returnParentContextOrErr.takeError();
7336RParenLoc, *ParentContextOrErr);
7341Error Err = Error::success();
7344 autoToWrittenTypeInfo =
importChecked(Err,
E->getWrittenTypeInfo());
7348 returnstd::move(Err);
7351ToBuiltinLoc, ToSubExpr, ToWrittenTypeInfo, ToRParenLoc, ToType,
7352 E->isMicrosoftABI());
7357Error Err = Error::success();
7365 returnstd::move(Err);
7372 boolCondIsTrue = !
E->isConditionDependent() &&
E->isConditionTrue();
7375 ChooseExpr(ToBuiltinLoc, ToCond, ToLHS, ToRHS, ToType, VK, OK,
7376ToRParenLoc, CondIsTrue);
7380Error Err = Error::success();
7387 returnstd::move(Err);
7395Error Err = Error::success();
7399 const unsignedNumSubExprs =
E->getNumSubExprs();
7403ToSubExprs.resize(NumSubExprs);
7406 returnstd::move(Err);
7409Importer.
getToContext(), ToSubExprs, ToType, ToBeginLoc, ToRParenLoc);
7415 returnTypeOrErr.takeError();
7419 returnBeginLocOrErr.takeError();
7426Error Err = Error::success();
7428 Expr*ToControllingExpr =
nullptr;
7430 if(
E->isExprPredicate())
7431ToControllingExpr =
importChecked(Err,
E->getControllingExpr());
7433ToControllingType =
importChecked(Err,
E->getControllingType());
7434assert((ToControllingExpr || ToControllingType) &&
7435 "Either the controlling expr or type must be nonnull");
7439 returnstd::move(Err);
7444 returnstd::move(Err);
7449 returnstd::move(Err);
7452 if(
E->isResultDependent()) {
7453 if(ToControllingExpr) {
7455ToCtx, ToGenericLoc, ToControllingExpr,
llvm::ArrayRef(ToAssocTypes),
7460ToCtx, ToGenericLoc, ToControllingType,
llvm::ArrayRef(ToAssocTypes),
7465 if(ToControllingExpr) {
7467ToCtx, ToGenericLoc, ToControllingExpr,
llvm::ArrayRef(ToAssocTypes),
7472ToCtx, ToGenericLoc, ToControllingType,
llvm::ArrayRef(ToAssocTypes),
7479Error Err = Error::success();
7482 autoToFunctionName =
importChecked(Err,
E->getFunctionName());
7484 returnstd::move(Err);
7487 E->getIdentKind(),
E->isTransparent(),
7493Error Err = Error::success();
7494 autoToQualifierLoc =
importChecked(Err,
E->getQualifierLoc());
7495 autoToTemplateKeywordLoc =
importChecked(Err,
E->getTemplateKeywordLoc());
7500 returnstd::move(Err);
7503 if(
E->getDecl() !=
E->getFoundDecl()) {
7504 autoFoundDOrErr =
import(
E->getFoundDecl());
7506 returnFoundDOrErr.takeError();
7507ToFoundD = *FoundDOrErr;
7512 if(
E->hasExplicitTemplateArgs()) {
7515 E->template_arguments(), ToTAInfo))
7516 returnstd::move(Err);
7517ToResInfo = &ToTAInfo;
7521Importer.
getToContext(), ToQualifierLoc, ToTemplateKeywordLoc, ToDecl,
7522 E->refersToEnclosingVariableOrCapture(), ToLocation, ToType,
7524 if(
E->hadMultipleCandidates())
7525ToE->setHadMultipleCandidates(
true);
7526ToE->setIsImmediateEscalating(
E->isImmediateEscalating());
7533 returnTypeOrErr.takeError();
7541 returnToInitOrErr.takeError();
7543 ExpectedSLocToEqualOrColonLocOrErr =
import(
E->getEqualOrColonLoc());
7544 if(!ToEqualOrColonLocOrErr)
7545 returnToEqualOrColonLocOrErr.takeError();
7549 for(
unsignedI = 1, N =
E->getNumSubExprs(); I < N; I++) {
7551ToIndexExprs[I - 1] = *ToArgOrErr;
7553 returnToArgOrErr.takeError();
7558 returnstd::move(Err);
7562ToIndexExprs, *ToEqualOrColonLocOrErr,
7563 E->usesGNUSyntax(), *ToInitOrErr);
7570 returnToTypeOrErr.takeError();
7573 if(!ToLocationOrErr)
7574 returnToLocationOrErr.takeError();
7577*ToTypeOrErr, *ToLocationOrErr);
7583 returnToTypeOrErr.takeError();
7586 if(!ToLocationOrErr)
7587 returnToLocationOrErr.takeError();
7590Importer.
getToContext(),
E->getValue(), *ToTypeOrErr, *ToLocationOrErr);
7597 returnToTypeOrErr.takeError();
7600 if(!ToLocationOrErr)
7601 returnToLocationOrErr.takeError();
7605*ToTypeOrErr, *ToLocationOrErr);
7609 autoToTypeOrErr =
import(
E->
getType());
7611 returnToTypeOrErr.takeError();
7614 if(!ToSubExprOrErr)
7615 returnToSubExprOrErr.takeError();
7618*ToSubExprOrErr, *ToTypeOrErr);
7622 autoToTypeOrErr =
import(
E->
getType());
7624 returnToTypeOrErr.takeError();
7627 if(!ToLocationOrErr)
7628 returnToLocationOrErr.takeError();
7631Importer.
getToContext(),
E->getValue(), *ToTypeOrErr, *ToLocationOrErr,
7638 returnToTypeOrErr.takeError();
7641 if(!ToLocationOrErr)
7642 returnToLocationOrErr.takeError();
7645 E->getValue(),
E->getKind(), *ToTypeOrErr, *ToLocationOrErr);
7651 returnToTypeOrErr.takeError();
7655 E->tokloc_begin(),
E->tokloc_end(), ToLocations.begin()))
7656 returnstd::move(Err);
7659Importer.
getToContext(),
E->getBytes(),
E->getKind(),
E->isPascal(),
7660*ToTypeOrErr, ToLocations.data(), ToLocations.size());
7665Error Err = Error::success();
7667 autoToTypeSourceInfo =
importChecked(Err,
E->getTypeSourceInfo());
7671 returnstd::move(Err);
7674ToLParenLoc, ToTypeSourceInfo, ToType,
E->
getValueKind(),
7675ToInitializer,
E->isFileScope());
7680Error Err = Error::success();
7685 returnstd::move(Err);
7689 E->getSubExprs(),
E->getSubExprs() +
E->getNumSubExprs(),
7691 returnstd::move(Err);
7695ToBuiltinLoc, ToExprs, ToType,
E->getOp(), ToRParenLoc);
7699Error Err = Error::success();
7705 returnstd::move(Err);
7708ToAmpAmpLoc, ToLabelLoc, ToLabel, ToType);
7711Error Err = Error::success();
7715 returnstd::move(Err);
7720Error Err = Error::success();
7725 returnstd::move(Err);
7728 ParenExpr(ToLParen, ToRParen, ToSubExpr);
7734 returnstd::move(Err);
7736 ExpectedSLocToLParenLocOrErr =
import(
E->getLParenLoc());
7737 if(!ToLParenLocOrErr)
7738 returnToLParenLocOrErr.takeError();
7740 ExpectedSLocToRParenLocOrErr =
import(
E->getRParenLoc());
7741 if(!ToRParenLocOrErr)
7742 returnToRParenLocOrErr.takeError();
7745ToExprs, *ToRParenLocOrErr);
7749Error Err = Error::success();
7755 returnstd::move(Err);
7758 StmtExpr(ToSubStmt, ToType, ToLParenLoc, ToRParenLoc,
7759 E->getTemplateDepth());
7763Error Err = Error::success();
7768 returnstd::move(Err);
7771 E->hasStoredFPFeatures());
7772UO->setType(ToType);
7773UO->setSubExpr(ToSubExpr);
7774UO->setOpcode(
E->getOpcode());
7775UO->setOperatorLoc(ToOperatorLoc);
7776UO->setCanOverflow(
E->canOverflow());
7777 if(
E->hasStoredFPFeatures())
7778UO->setStoredFPFeatures(
E->getStoredFPFeatures());
7786Error Err = Error::success();
7791 returnstd::move(Err);
7793 if(
E->isArgumentType()) {
7795 import(
E->getArgumentTypeInfo());
7796 if(!ToArgumentTypeInfoOrErr)
7797 returnToArgumentTypeInfoOrErr.takeError();
7800 E->getKind(), *ToArgumentTypeInfoOrErr, ToType, ToOperatorLoc,
7804 ExpectedExprToArgumentExprOrErr =
import(
E->getArgumentExpr());
7805 if(!ToArgumentExprOrErr)
7806 returnToArgumentExprOrErr.takeError();
7809 E->getKind(), *ToArgumentExprOrErr, ToType, ToOperatorLoc, ToRParenLoc);
7813Error Err = Error::success();
7819 returnstd::move(Err);
7822Importer.
getToContext(), ToLHS, ToRHS,
E->getOpcode(), ToType,
7824 E->getFPFeatures());
7828Error Err = Error::success();
7836 returnstd::move(Err);
7839ToCond, ToQuestionLoc, ToLHS, ToColonLoc, ToRHS, ToType,
7845Error Err = Error::success();
7855 returnstd::move(Err);
7858ToCommon, ToOpaqueValue, ToCond, ToTrueExpr, ToFalseExpr,
7865Error Err = Error::success();
7866 autoToSemanticForm =
importChecked(Err,
E->getSemanticForm());
7868 returnstd::move(Err);
7875Error Err = Error::success();
7877 autoToQueriedTypeSourceInfo =
7879 autoToDimensionExpression =
importChecked(Err,
E->getDimensionExpression());
7883 returnstd::move(Err);
7886ToBeginLoc,
E->getTrait(), ToQueriedTypeSourceInfo,
E->getValue(),
7887ToDimensionExpression, ToEndLoc, ToType);
7891Error Err = Error::success();
7893 autoToQueriedExpression =
importChecked(Err,
E->getQueriedExpression());
7897 returnstd::move(Err);
7900ToBeginLoc,
E->getTrait(), ToQueriedExpression,
E->getValue(),
7905Error Err = Error::success();
7910 returnstd::move(Err);
7917Error Err = Error::success();
7923 returnstd::move(Err);
7932Error Err = Error::success();
7936 autoToComputationLHSType =
importChecked(Err,
E->getComputationLHSType());
7937 autoToComputationResultType =
7941 returnstd::move(Err);
7944Importer.
getToContext(), ToLHS, ToRHS,
E->getOpcode(), ToType,
7946 E->getFPFeatures(),
7947ToComputationLHSType, ToComputationResultType);
7954 if(
autoSpecOrErr =
import(*I))
7955 Path.push_back(*SpecOrErr);
7957 returnSpecOrErr.takeError();
7965 returnToTypeOrErr.takeError();
7968 if(!ToSubExprOrErr)
7969 returnToSubExprOrErr.takeError();
7972 if(!ToBasePathOrErr)
7973 returnToBasePathOrErr.takeError();
7976Importer.
getToContext(), *ToTypeOrErr,
E->getCastKind(), *ToSubExprOrErr,
7981Error Err = Error::success();
7984 autoToTypeInfoAsWritten =
importChecked(Err,
E->getTypeInfoAsWritten());
7986 returnstd::move(Err);
7989 if(!ToBasePathOrErr)
7990 returnToBasePathOrErr.takeError();
7994 caseStmt::CStyleCastExprClass: {
7995 auto*CCE = cast<CStyleCastExpr>(
E);
7996 ExpectedSLocToLParenLocOrErr =
import(CCE->getLParenLoc());
7997 if(!ToLParenLocOrErr)
7998 returnToLParenLocOrErr.takeError();
7999 ExpectedSLocToRParenLocOrErr =
import(CCE->getRParenLoc());
8000 if(!ToRParenLocOrErr)
8001 returnToRParenLocOrErr.takeError();
8004ToSubExpr, ToBasePath, CCE->getFPFeatures(), ToTypeInfoAsWritten,
8005*ToLParenLocOrErr, *ToRParenLocOrErr);
8008 caseStmt::CXXFunctionalCastExprClass: {
8009 auto*FCE = cast<CXXFunctionalCastExpr>(
E);
8010 ExpectedSLocToLParenLocOrErr =
import(FCE->getLParenLoc());
8011 if(!ToLParenLocOrErr)
8012 returnToLParenLocOrErr.takeError();
8013 ExpectedSLocToRParenLocOrErr =
import(FCE->getRParenLoc());
8014 if(!ToRParenLocOrErr)
8015 returnToRParenLocOrErr.takeError();
8018 E->getCastKind(), ToSubExpr, ToBasePath, FCE->getFPFeatures(),
8019*ToLParenLocOrErr, *ToRParenLocOrErr);
8022 caseStmt::ObjCBridgedCastExprClass: {
8023 auto*OCE = cast<ObjCBridgedCastExpr>(
E);
8024 ExpectedSLocToLParenLocOrErr =
import(OCE->getLParenLoc());
8025 if(!ToLParenLocOrErr)
8026 returnToLParenLocOrErr.takeError();
8027 ExpectedSLocToBridgeKeywordLocOrErr =
import(OCE->getBridgeKeywordLoc());
8028 if(!ToBridgeKeywordLocOrErr)
8029 returnToBridgeKeywordLocOrErr.takeError();
8031*ToLParenLocOrErr, OCE->getBridgeKind(),
E->getCastKind(),
8032*ToBridgeKeywordLocOrErr, ToTypeInfoAsWritten, ToSubExpr);
8034 caseStmt::BuiltinBitCastExprClass: {
8035 auto*BBC = cast<BuiltinBitCastExpr>(
E);
8036 ExpectedSLocToKWLocOrErr =
import(BBC->getBeginLoc());
8038 returnToKWLocOrErr.takeError();
8039 ExpectedSLocToRParenLocOrErr =
import(BBC->getEndLoc());
8040 if(!ToRParenLocOrErr)
8041 returnToRParenLocOrErr.takeError();
8044ToTypeInfoAsWritten, *ToKWLocOrErr, *ToRParenLocOrErr);
8047llvm_unreachable(
"Cast expression of unsupported type!");
8054 for(
intI = 0, N =
E->getNumComponents(); I < N; ++I) {
8060Error Err = Error::success();
8064 returnstd::move(Err);
8067 switch(FromNode.
getKind()) {
8073 autoToBSOrErr =
import(FromNode.
getBase());
8075 returnToBSOrErr.takeError();
8080 autoToFieldOrErr =
import(FromNode.
getField());
8082 returnToFieldOrErr.takeError();
8083ToNodes.push_back(
OffsetOfNode(ToBeginLoc, *ToFieldOrErr, ToEndLoc));
8088ToNodes.push_back(
OffsetOfNode(ToBeginLoc, ToII, ToEndLoc));
8095 for(
intI = 0, N =
E->getNumExpressions(); I < N; ++I) {
8096 ExpectedExprToIndexExprOrErr =
import(
E->getIndexExpr(I));
8097 if(!ToIndexExprOrErr)
8098 returnToIndexExprOrErr.takeError();
8099ToExprs[I] = *ToIndexExprOrErr;
8102Error Err = Error::success();
8104 autoToTypeSourceInfo =
importChecked(Err,
E->getTypeSourceInfo());
8108 returnstd::move(Err);
8111Importer.
getToContext(), ToType, ToOperatorLoc, ToTypeSourceInfo, ToNodes,
8112ToExprs, ToRParenLoc);
8116Error Err = Error::success();
8122 returnstd::move(Err);
8131ToType, ToOperand, ToCanThrow, ToBeginLoc, ToEndLoc);
8135Error Err = Error::success();
8140 returnstd::move(Err);
8143ToSubExpr, ToType, ToThrowLoc,
E->isThrownVariableInScope());
8147 ExpectedSLocToUsedLocOrErr =
import(
E->getUsedLocation());
8148 if(!ToUsedLocOrErr)
8149 returnToUsedLocOrErr.takeError();
8151 autoToParamOrErr =
import(
E->getParam());
8153 returnToParamOrErr.takeError();
8155 autoUsedContextOrErr = Importer.
ImportContext(
E->getUsedContext());
8156 if(!UsedContextOrErr)
8157 returnUsedContextOrErr.takeError();
8167std::optional<ParmVarDecl *> FromParam =
8169assert(FromParam &&
"ParmVarDecl was not imported?");
8172 returnstd::move(Err);
8174 Expr*RewrittenInit =
nullptr;
8175 if(
E->hasRewrittenInit()) {
8178 returnExprOrErr.takeError();
8179RewrittenInit = ExprOrErr.get();
8182*ToParamOrErr, RewrittenInit,
8188Error Err = Error::success();
8190 autoToTypeSourceInfo =
importChecked(Err,
E->getTypeSourceInfo());
8193 returnstd::move(Err);
8196ToType, ToTypeSourceInfo, ToRParenLoc);
8202 if(!ToSubExprOrErr)
8203 returnToSubExprOrErr.takeError();
8205 autoToDtorOrErr =
import(
E->getTemporary()->getDestructor());
8207 returnToDtorOrErr.takeError();
8217Error Err = Error::success();
8220 autoToTypeSourceInfo =
importChecked(Err,
E->getTypeSourceInfo());
8221 autoToParenOrBraceRange =
importChecked(Err,
E->getParenOrBraceRange());
8223 returnstd::move(Err);
8227 returnstd::move(Err);
8230Importer.
getToContext(), ToConstructor, ToType, ToTypeSourceInfo, ToArgs,
8231ToParenOrBraceRange,
E->hadMultipleCandidates(),
8232 E->isListInitialization(),
E->isStdInitListInitialization(),
8233 E->requiresZeroInitialization());
8240 returnstd::move(Err);
8242Error Err = Error::success();
8244 autoExtendingDecl =
importChecked(Err,
D->getExtendingDecl());
8246 returnstd::move(Err);
8250 if(GetImportedOrCreateDecl(To,
D, Temporary, ExtendingDecl,
8251 D->getManglingNumber()))
8261Error Err = Error::success();
8264Err,
E->getLifetimeExtendedTemporaryDecl() ?
nullptr:
E->getSubExpr());
8265 autoToMaterializedDecl =
8268 returnstd::move(Err);
8270 if(!ToTemporaryExpr)
8271ToTemporaryExpr = cast<Expr>(ToMaterializedDecl->getTemporaryExpr());
8274ToType, ToTemporaryExpr,
E->isBoundToLvalueReference(),
8275ToMaterializedDecl);
8281Error Err = Error::success();
8286 returnstd::move(Err);
8289ToType, ToPattern, ToEllipsisLoc,
E->getNumExpansions());
8293Error Err = Error::success();
8299 returnstd::move(Err);
8301std::optional<unsigned> Length;
8303Length =
E->getPackLength();
8306 if(
E->isPartiallySubstituted()) {
8308ToPartialArguments))
8309 returnstd::move(Err);
8313Importer.
getToContext(), ToOperatorLoc, ToPack, ToPackLoc, ToRParenLoc,
8314Length, ToPartialArguments);
8319Error Err = Error::success();
8321 autoToOperatorDelete =
importChecked(Err,
E->getOperatorDelete());
8322 autoToTypeIdParens =
importChecked(Err,
E->getTypeIdParens());
8326 autoToAllocatedTypeSourceInfo =
8329 autoToDirectInitRange =
importChecked(Err,
E->getDirectInitRange());
8331 returnstd::move(Err);
8336 returnstd::move(Err);
8339Importer.
getToContext(),
E->isGlobalNew(), ToOperatorNew,
8340ToOperatorDelete,
E->passAlignment(),
E->doesUsualArrayDeleteWantSize(),
8341ToPlacementArgs, ToTypeIdParens, ToArraySize,
E->getInitializationStyle(),
8342ToInitializer, ToType, ToAllocatedTypeSourceInfo, ToSourceRange,
8347Error Err = Error::success();
8349 autoToOperatorDelete =
importChecked(Err,
E->getOperatorDelete());
8353 returnstd::move(Err);
8356ToType,
E->isGlobalDelete(),
E->isArrayForm(),
E->isArrayFormAsWritten(),
8357 E->doesUsualArrayDeleteWantSize(), ToOperatorDelete, ToArgument,
8362Error Err = Error::success();
8366 autoToParenOrBraceRange =
importChecked(Err,
E->getParenOrBraceRange());
8368 returnstd::move(Err);
8372 returnstd::move(Err);
8375Importer.
getToContext(), ToType, ToLocation, ToConstructor,
8376 E->isElidable(), ToArgs,
E->hadMultipleCandidates(),
8377 E->isListInitialization(),
E->isStdInitListInitialization(),
8378 E->requiresZeroInitialization(),
E->getConstructionKind(),
8379ToParenOrBraceRange);
8386 if(!ToSubExprOrErr)
8387 returnToSubExprOrErr.takeError();
8391 returnstd::move(Err);
8394Importer.
getToContext(), *ToSubExprOrErr,
E->cleanupsHaveSideEffects(),
8399Error Err = Error::success();
8404 returnstd::move(Err);
8408 returnstd::move(Err);
8412 E->getFPFeatures());
8418 returnToTypeOrErr.takeError();
8421 if(!ToLocationOrErr)
8422 returnToLocationOrErr.takeError();
8425*ToTypeOrErr,
E->isImplicit());
8431 returnToTypeOrErr.takeError();
8434 if(!ToLocationOrErr)
8435 returnToLocationOrErr.takeError();
8438*ToTypeOrErr, *ToLocationOrErr);
8442Error Err = Error::success();
8445 autoToQualifierLoc =
importChecked(Err,
E->getQualifierLoc());
8446 autoToTemplateKeywordLoc =
importChecked(Err,
E->getTemplateKeywordLoc());
8450 autoToName =
importChecked(Err,
E->getMemberNameInfo().getName());
8451 autoToLoc =
importChecked(Err,
E->getMemberNameInfo().getLoc());
8453 returnstd::move(Err);
8461 if(
E->hasExplicitTemplateArgs()) {
8464 E->template_arguments(), ToTAInfo))
8465 returnstd::move(Err);
8466ResInfo = &ToTAInfo;
8470ToOperatorLoc, ToQualifierLoc, ToTemplateKeywordLoc,
8471ToMemberDecl, ToFoundDecl, ToMemberNameInfo,
8478Error Err = Error::success();
8481 autoToQualifierLoc =
importChecked(Err,
E->getQualifierLoc());
8482 autoToScopeTypeInfo =
importChecked(Err,
E->getScopeTypeInfo());
8483 autoToColonColonLoc =
importChecked(Err,
E->getColonColonLoc());
8486 returnstd::move(Err);
8489 if(
const IdentifierInfo*FromII =
E->getDestroyedTypeIdentifier()) {
8491 ExpectedSLocToDestroyedTypeLocOrErr =
import(
E->getDestroyedTypeLoc());
8492 if(!ToDestroyedTypeLocOrErr)
8493 returnToDestroyedTypeLocOrErr.takeError();
8496 if(
autoToTIOrErr =
import(
E->getDestroyedTypeInfo()))
8499 returnToTIOrErr.takeError();
8503Importer.
getToContext(), ToBase,
E->isArrow(), ToOperatorLoc,
8504ToQualifierLoc, ToScopeTypeInfo, ToColonColonLoc, ToTildeLoc, Storage);
8509Error Err = Error::success();
8512 autoToQualifierLoc =
importChecked(Err,
E->getQualifierLoc());
8513 autoToTemplateKeywordLoc =
importChecked(Err,
E->getTemplateKeywordLoc());
8514 autoToFirstQualifierFoundInScope =
8517 returnstd::move(Err);
8519 Expr*ToBase =
nullptr;
8520 if(!
E->isImplicitAccess()) {
8522ToBase = *ToBaseOrErr;
8524 returnToBaseOrErr.takeError();
8529 if(
E->hasExplicitTemplateArgs()) {
8532 E->template_arguments(), ToTAInfo))
8533 returnstd::move(Err);
8534ResInfo = &ToTAInfo;
8539 returnstd::move(Err);
8545 returnstd::move(Err);
8548Importer.
getToContext(), ToBase, ToType,
E->isArrow(), ToOperatorLoc,
8549ToQualifierLoc, ToTemplateKeywordLoc, ToFirstQualifierFoundInScope,
8550ToMemberNameInfo, ResInfo);
8555Error Err = Error::success();
8556 autoToQualifierLoc =
importChecked(Err,
E->getQualifierLoc());
8557 autoToTemplateKeywordLoc =
importChecked(Err,
E->getTemplateKeywordLoc());
8559 autoToNameLoc =
importChecked(Err,
E->getNameInfo().getLoc());
8563 returnstd::move(Err);
8567 returnstd::move(Err);
8571 if(
E->hasExplicitTemplateArgs()) {
8574 returnstd::move(Err);
8575ResInfo = &ToTAInfo;
8579Importer.
getToContext(), ToQualifierLoc, ToTemplateKeywordLoc,
8580ToNameInfo, ResInfo);
8585Error Err = Error::success();
8589 autoToTypeSourceInfo =
importChecked(Err,
E->getTypeSourceInfo());
8591 returnstd::move(Err);
8596 returnstd::move(Err);
8599Importer.
getToContext(), ToType, ToTypeSourceInfo, ToLParenLoc,
8606 if(!ToNamingClassOrErr)
8607 returnToNamingClassOrErr.takeError();
8609 autoToQualifierLocOrErr =
import(
E->getQualifierLoc());
8610 if(!ToQualifierLocOrErr)
8611 returnToQualifierLocOrErr.takeError();
8613Error Err = Error::success();
8617 returnstd::move(Err);
8622 returnstd::move(Err);
8625 for(
auto*
D:
E->decls())
8626 if(
autoToDOrErr =
import(
D))
8627ToDecls.
addDecl(cast<NamedDecl>(*ToDOrErr));
8629 returnToDOrErr.takeError();
8631 if(
E->hasExplicitTemplateArgs()) {
8634 E->getLAngleLoc(),
E->getRAngleLoc(),
E->template_arguments(),
8636 returnstd::move(Err);
8638 ExpectedSLocToTemplateKeywordLocOrErr =
import(
E->getTemplateKeywordLoc());
8639 if(!ToTemplateKeywordLocOrErr)
8640 returnToTemplateKeywordLocOrErr.takeError();
8642 const boolKnownDependent =
8644ExprDependence::TypeValue;
8646Importer.
getToContext(), *ToNamingClassOrErr, *ToQualifierLocOrErr,
8647*ToTemplateKeywordLocOrErr, ToNameInfo,
E->requiresADL(), &ToTAInfo,
8648ToDecls.
begin(), ToDecls.
end(), KnownDependent,
8653Importer.
getToContext(), *ToNamingClassOrErr, *ToQualifierLocOrErr,
8654ToNameInfo,
E->requiresADL(), ToDecls.
begin(), ToDecls.
end(),
8661Error Err = Error::success();
8664 autoToQualifierLoc =
importChecked(Err,
E->getQualifierLoc());
8665 autoToTemplateKeywordLoc =
importChecked(Err,
E->getTemplateKeywordLoc());
8669 returnstd::move(Err);
8674 returnstd::move(Err);
8677 for(
Decl*
D:
E->decls())
8678 if(
autoToDOrErr =
import(
D))
8679ToDecls.
addDecl(cast<NamedDecl>(*ToDOrErr));
8681 returnToDOrErr.takeError();
8685 if(
E->hasExplicitTemplateArgs()) {
8687 E->copyTemplateArgumentsInto(FromTAInfo);
8689 returnstd::move(Err);
8690ResInfo = &ToTAInfo;
8693 Expr*ToBase =
nullptr;
8694 if(!
E->isImplicitAccess()) {
8696ToBase = *ToBaseOrErr;
8698 returnToBaseOrErr.takeError();
8702Importer.
getToContext(),
E->hasUnresolvedUsing(), ToBase, ToType,
8703 E->isArrow(), ToOperatorLoc, ToQualifierLoc, ToTemplateKeywordLoc,
8704ToNameInfo, ResInfo, ToDecls.
begin(), ToDecls.
end());
8708Error Err = Error::success();
8713 returnstd::move(Err);
8715 unsignedNumArgs =
E->getNumArgs();
8718 returnstd::move(Err);
8720 if(
const auto*OCE = dyn_cast<CXXOperatorCallExpr>(
E)) {
8722Importer.
getToContext(), OCE->getOperator(), ToCallee, ToArgs, ToType,
8723OCE->getValueKind(), ToRParenLoc, OCE->getFPFeatures(),
8724OCE->getADLCallKind());
87290,
E->getADLCallKind());
8734 autoToClassOrErr =
import(FromClass);
8736 returnToClassOrErr.takeError();
8739 autoToCallOpOrErr =
import(
E->getCallOperator());
8741 returnToCallOpOrErr.takeError();
8745 returnstd::move(Err);
8747Error Err = Error::success();
8748 autoToIntroducerRange =
importChecked(Err,
E->getIntroducerRange());
8749 autoToCaptureDefaultLoc =
importChecked(Err,
E->getCaptureDefaultLoc());
8752 returnstd::move(Err);
8755 E->getCaptureDefault(), ToCaptureDefaultLoc,
8756 E->hasExplicitParameters(),
8757 E->hasExplicitResultType(), ToCaptureInits,
8763Error Err = Error::success();
8768 returnstd::move(Err);
8772 returnstd::move(Err);
8776ToCtx, ToLBraceLoc, ToExprs, ToRBraceLoc);
8779 if(
E->hasArrayFiller()) {
8780 if(
ExpectedExprToFillerOrErr =
import(
E->getArrayFiller()))
8783 returnToFillerOrErr.takeError();
8786 if(
FieldDecl*FromFD =
E->getInitializedFieldInUnion()) {
8787 if(
autoToFDOrErr =
import(FromFD))
8790 returnToFDOrErr.takeError();
8794 if(
autoToSyntFormOrErr =
import(SyntForm))
8797 returnToSyntFormOrErr.takeError();
8811 returnToTypeOrErr.takeError();
8814 if(!ToSubExprOrErr)
8815 returnToSubExprOrErr.takeError();
8818*ToTypeOrErr, *ToSubExprOrErr);
8823Error Err = Error::success();
8828 returnstd::move(Err);
8831ToLocation, ToType, ToConstructor,
E->constructsVBase(),
8832 E->inheritedFromVBase());
8836Error Err = Error::success();
8841 returnstd::move(Err);
8844ToType, ToCommonExpr, ToSubExpr);
8850 returnToTypeOrErr.takeError();
8856 if(!ToBeginLocOrErr)
8857 returnToBeginLocOrErr.takeError();
8859 autoToFieldOrErr =
import(
E->getField());
8861 returnToFieldOrErr.takeError();
8863 autoUsedContextOrErr = Importer.
ImportContext(
E->getUsedContext());
8864 if(!UsedContextOrErr)
8865 returnUsedContextOrErr.takeError();
8869 "Field should have in-class initializer if there is a default init " 8870 "expression that uses it.");
8875 autoToInClassInitializerOrErr =
8876 import(
E->getField()->getInClassInitializer());
8877 if(!ToInClassInitializerOrErr)
8878 returnToInClassInitializerOrErr.takeError();
8882 Expr*RewrittenInit =
nullptr;
8883 if(
E->hasRewrittenInit()) {
8886 returnExprOrErr.takeError();
8887RewrittenInit = ExprOrErr.get();
8891ToField, *UsedContextOrErr, RewrittenInit);
8895Error Err = Error::success();
8898 autoToTypeInfoAsWritten =
importChecked(Err,
E->getTypeInfoAsWritten());
8901 autoToAngleBrackets =
importChecked(Err,
E->getAngleBrackets());
8903 returnstd::move(Err);
8908 if(!ToBasePathOrErr)
8909 returnToBasePathOrErr.takeError();
8911 if(
autoCCE = dyn_cast<CXXStaticCastExpr>(
E)) {
8913Importer.
getToContext(), ToType, VK, CK, ToSubExpr, &(*ToBasePathOrErr),
8914ToTypeInfoAsWritten, CCE->getFPFeatures(), ToOperatorLoc, ToRParenLoc,
8916}
else if(isa<CXXDynamicCastExpr>(
E)) {
8918Importer.
getToContext(), ToType, VK, CK, ToSubExpr, &(*ToBasePathOrErr),
8919ToTypeInfoAsWritten, ToOperatorLoc, ToRParenLoc, ToAngleBrackets);
8920}
else if(isa<CXXReinterpretCastExpr>(
E)) {
8922Importer.
getToContext(), ToType, VK, CK, ToSubExpr, &(*ToBasePathOrErr),
8923ToTypeInfoAsWritten, ToOperatorLoc, ToRParenLoc, ToAngleBrackets);
8924}
else if(isa<CXXConstCastExpr>(
E)) {
8926Importer.
getToContext(), ToType, VK, ToSubExpr, ToTypeInfoAsWritten,
8927ToOperatorLoc, ToRParenLoc, ToAngleBrackets);
8929llvm_unreachable(
"Unknown cast type");
8930 returnmake_error<ASTImportError>();
8936Error Err = Error::success();
8939 autoToAssociatedDecl =
importChecked(Err,
E->getAssociatedDecl());
8942 returnstd::move(Err);
8945ToType,
E->
getValueKind(), ToExprLoc, ToReplacement, ToAssociatedDecl,
8946 E->getIndex(),
E->getPackIndex(),
E->isReferenceParameter());
8950Error Err = Error::success();
8955 returnstd::move(Err);
8959 returnstd::move(Err);
8966Importer.
getToContext(), ToType, ToBeginLoc,
E->getTrait(), ToArgs,
8973 returnToTypeOrErr.takeError();
8976 if(!ToSourceRangeOrErr)
8977 returnToSourceRangeOrErr.takeError();
8979 if(
E->isTypeOperand()) {
8980 if(
autoToTSIOrErr =
import(
E->getTypeOperandSourceInfo()))
8982*ToTypeOrErr, *ToTSIOrErr, *ToSourceRangeOrErr);
8984 returnToTSIOrErr.takeError();
8987 ExpectedExprToExprOperandOrErr =
import(
E->getExprOperand());
8988 if(!ToExprOperandOrErr)
8989 returnToExprOperandOrErr.takeError();
8992*ToTypeOrErr, *ToExprOperandOrErr, *ToSourceRangeOrErr);
8996Error Err = Error::success();
9007 returnstd::move(Err);
9010 CXXFoldExpr(ToType, ToCallee, ToLParenLoc, ToLHS,
E->getOperator(),
9011ToEllipsisLoc, ToRHS, ToRParenLoc,
E->getNumExpansions());
9016Error ImportErrors = Error::success();
9018 if(
autoImportedOrErr =
import(FromOverriddenMethod))
9020(*ImportedOrErr)->getCanonicalDecl()));
9023joinErrors(std::move(ImportErrors), ImportedOrErr.takeError());
9025 returnImportErrors;
9031std::shared_ptr<ASTImporterSharedState> SharedState)
9032: SharedState(SharedState), ToContext(ToContext), FromContext(FromContext),
9033ToFileManager(ToFileManager), FromFileManager(FromFileManager),
9038this->SharedState = std::make_shared<ASTImporterSharedState>();
9048assert(F && (isa<FieldDecl>(*F) || isa<IndirectFieldDecl>(*F)) &&
9049 "Try to get field index for non-field.");
9053 returnstd::nullopt;
9056 for(
const auto*
D: Owner->decls()) {
9060 if(isa<FieldDecl>(*
D) || isa<IndirectFieldDecl>(*
D))
9064llvm_unreachable(
"Field was not found in its parent context.");
9066 returnstd::nullopt;
9079 if(SharedState->getLookupTable()) {
9086getCanonicalForwardRedeclChain<NamespaceDecl>(
9087dyn_cast<NamespaceDecl>(ReDC));
9088 for(
auto*
D: NSChain) {
9090SharedState->getLookupTable()->lookup(dyn_cast<NamespaceDecl>(
D),
9097SharedState->getLookupTable()->lookup(ReDC, Name);
9102FoundDeclsTy
Result(NoloadLookupResult.
begin(), NoloadLookupResult.
end());
9119voidASTImporter::AddToLookupTable(
Decl*ToD) {
9120SharedState->addDeclToLookup(ToD);
9126 returnImporter.
Visit(FromD);
9150llvm::DenseMap<const Type *, const Type *>::iterator Pos =
9151ImportedTypes.find(FromT);
9152 if(Pos != ImportedTypes.end())
9159 returnToTOrErr.takeError();
9162ImportedTypes[FromT] = ToTOrErr->getTypePtr();
9164 returnToTOrErr->getTypePtr();
9173 returnToTyOrErr.takeError();
9186 returnTOrErr.takeError();
9189 returnBeginLocOrErr.takeError();
9198template<
typenameT>
structAttrArgImporter {
9199AttrArgImporter(
constAttrArgImporter<T> &) =
delete;
9200AttrArgImporter(AttrArgImporter<T> &&) =
default;
9201AttrArgImporter<T> &operator=(
constAttrArgImporter<T> &) =
delete;
9202AttrArgImporter<T> &operator=(AttrArgImporter<T> &&) =
default;
9205: To(I.importChecked(Err, From)) {}
9207 const T&value() {
returnTo; }
9218template<
typenameT>
structAttrArgArrayImporter {
9219AttrArgArrayImporter(
constAttrArgArrayImporter<T> &) =
delete;
9220AttrArgArrayImporter(AttrArgArrayImporter<T> &&) =
default;
9221AttrArgArrayImporter<T> &operator=(
constAttrArgArrayImporter<T> &) =
delete;
9222AttrArgArrayImporter<T> &operator=(AttrArgArrayImporter<T> &&) =
default;
9225 constllvm::iterator_range<T *> &From,
9226 unsignedArraySize) {
9229To.reserve(ArraySize);
9233 T*value() {
returnTo.data(); }
9240 ErrorErr{Error::success()};
9241 Attr*ToAttr =
nullptr;
9246AttrImporter(
ASTImporter&I) : Importer(I), NImporter(I) {}
9249 template<
typenameT>
T*castAttrAs() {
returncast<T>(ToAttr); }
9250 template<
typenameT>
const T*castAttrAs()
const{
returncast<T>(ToAttr); }
9255 template<
classT> AttrArgImporter<T> importArg(
const T&From) {
9256 returnAttrArgImporter<T>(NImporter, Err, From);
9262 template<
typenameT>
9263AttrArgArrayImporter<T> importArrayArg(
constllvm::iterator_range<T *> &From,
9264 unsignedArraySize) {
9265 returnAttrArgArrayImporter<T>(NImporter, Err, From, ArraySize);
9276 template<
typename T,
typename... Arg>
9277 voidimportAttr(
const T*FromAttr, Arg &&...ImportedArg) {
9278 static_assert(std::is_base_of<Attr, T>::value,
9279 "T should be subclass of Attr.");
9280assert(!ToAttr &&
"Use one AttrImporter to import one Attribute object.");
9284Importer.
Import(FromAttr->getScopeName());
9294FromAttr->getParsedKind(), FromAttr->getForm());
9298std::forward<Arg>(ImportedArg)..., ToI);
9302 if(
auto*ToInheritableAttr = dyn_cast<InheritableAttr>(ToAttr))
9303ToInheritableAttr->setInherited(FromAttr->isInherited());
9309 voidcloneAttr(
const Attr*FromAttr) {
9310assert(!ToAttr &&
"Use one AttrImporter to import one Attribute object.");
9324 returnstd::move(Err);
9325assert(ToAttr &&
"Attribute should be created.");
9332AttrImporter AI(*
this);
9335 switch(FromAttr->
getKind()) {
9336 caseattr::Aligned: {
9337 auto*From = cast<AlignedAttr>(FromAttr);
9338 if(From->isAlignmentExpr())
9339AI.importAttr(From,
true, AI.importArg(From->getAlignmentExpr()).value());
9341AI.importAttr(From,
false,
9342AI.importArg(From->getAlignmentType()).value());
9346 caseattr::AlignValue: {
9347 auto*From = cast<AlignValueAttr>(FromAttr);
9348AI.importAttr(From, AI.importArg(From->getAlignment()).value());
9352 caseattr::Format: {
9353 const auto*From = cast<FormatAttr>(FromAttr);
9354AI.importAttr(From,
Import(From->getType()), From->getFormatIdx(),
9355From->getFirstArg());
9359 caseattr::EnableIf: {
9360 const auto*From = cast<EnableIfAttr>(FromAttr);
9361AI.importAttr(From, AI.importArg(From->getCond()).value(),
9362From->getMessage());
9366 caseattr::AssertCapability: {
9367 const auto*From = cast<AssertCapabilityAttr>(FromAttr);
9369AI.importArrayArg(From->args(), From->args_size()).value(),
9373 caseattr::AcquireCapability: {
9374 const auto*From = cast<AcquireCapabilityAttr>(FromAttr);
9376AI.importArrayArg(From->args(), From->args_size()).value(),
9380 caseattr::TryAcquireCapability: {
9381 const auto*From = cast<TryAcquireCapabilityAttr>(FromAttr);
9382AI.importAttr(From, AI.importArg(From->getSuccessValue()).value(),
9383AI.importArrayArg(From->args(), From->args_size()).value(),
9387 caseattr::ReleaseCapability: {
9388 const auto*From = cast<ReleaseCapabilityAttr>(FromAttr);
9390AI.importArrayArg(From->args(), From->args_size()).value(),
9394 caseattr::RequiresCapability: {
9395 const auto*From = cast<RequiresCapabilityAttr>(FromAttr);
9397AI.importArrayArg(From->args(), From->args_size()).value(),
9401 caseattr::GuardedBy: {
9402 const auto*From = cast<GuardedByAttr>(FromAttr);
9403AI.importAttr(From, AI.importArg(From->getArg()).value());
9406 caseattr::PtGuardedBy: {
9407 const auto*From = cast<PtGuardedByAttr>(FromAttr);
9408AI.importAttr(From, AI.importArg(From->getArg()).value());
9411 caseattr::AcquiredAfter: {
9412 const auto*From = cast<AcquiredAfterAttr>(FromAttr);
9414AI.importArrayArg(From->args(), From->args_size()).value(),
9418 caseattr::AcquiredBefore: {
9419 const auto*From = cast<AcquiredBeforeAttr>(FromAttr);
9421AI.importArrayArg(From->args(), From->args_size()).value(),
9425 caseattr::AssertExclusiveLock: {
9426 const auto*From = cast<AssertExclusiveLockAttr>(FromAttr);
9428AI.importArrayArg(From->args(), From->args_size()).value(),
9432 caseattr::AssertSharedLock: {
9433 const auto*From = cast<AssertSharedLockAttr>(FromAttr);
9435AI.importArrayArg(From->args(), From->args_size()).value(),
9439 caseattr::ExclusiveTrylockFunction: {
9440 const auto*From = cast<ExclusiveTrylockFunctionAttr>(FromAttr);
9441AI.importAttr(From, AI.importArg(From->getSuccessValue()).value(),
9442AI.importArrayArg(From->args(), From->args_size()).value(),
9446 caseattr::SharedTrylockFunction: {
9447 const auto*From = cast<SharedTrylockFunctionAttr>(FromAttr);
9448AI.importAttr(From, AI.importArg(From->getSuccessValue()).value(),
9449AI.importArrayArg(From->args(), From->args_size()).value(),
9453 caseattr::LockReturned: {
9454 const auto*From = cast<LockReturnedAttr>(FromAttr);
9455AI.importAttr(From, AI.importArg(From->getArg()).value());
9458 caseattr::LocksExcluded: {
9459 const auto*From = cast<LocksExcludedAttr>(FromAttr);
9461AI.importArrayArg(From->args(), From->args_size()).value(),
9469AI.cloneAttr(FromAttr);
9474 returnstd::move(AI).getResult();
9478 returnImportedDecls.lookup(FromD);
9482 autoFromDPos = ImportedFromDecls.find(ToD);
9483 if(FromDPos == ImportedFromDecls.end())
9485 returnFromDPos->second->getTranslationUnitDecl();
9493ImportPath.
push(FromD);
9494 autoImportPathBuilder =
9495llvm::make_scope_exit([
this]() { ImportPath.
pop(); });
9500 returnmake_error<ASTImportError>(*Error);
9506 if(
autoError = SharedState->getImportDeclErrorIfAny(ToD)) {
9508 returnmake_error<ASTImportError>(*Error);
9525 autoPos = ImportedDecls.find(FromD);
9526 if(Pos != ImportedDecls.end()) {
9529 auto*ToD = Pos->second;
9530ImportedDecls.erase(Pos);
9542 autoPosF = ImportedFromDecls.find(ToD);
9543 if(PosF != ImportedFromDecls.end()) {
9548SharedState->removeDeclFromLookup(ToD);
9549ImportedFromDecls.erase(PosF);
9561handleAllErrors(ToDOrErr.takeError(),
9565 if(Pos != ImportedDecls.end())
9566SharedState->setImportDeclError(Pos->second, ErrOut);
9570 for(
const auto&
Path: SavedImportPaths[FromD]) {
9573 Decl*PrevFromDi = FromD;
9576 if(FromDi == FromD)
9583PrevFromDi = FromDi;
9587 autoIi = ImportedDecls.find(FromDi);
9588 if(Ii != ImportedDecls.end())
9589SharedState->setImportDeclError(Ii->second, ErrOut);
9594SavedImportPaths.erase(FromD);
9597 returnmake_error<ASTImportError>(ErrOut);
9609 returnmake_error<ASTImportError>(*Err);
9615 if(
autoError = SharedState->getImportDeclErrorIfAny(ToD)) {
9617 returnmake_error<ASTImportError>(*Error);
9620assert(ImportedDecls.count(FromD) != 0 &&
"Missing call to MapImported?");
9624 autoToAttrOrErr =
Import(FromAttr);
9628 returnToAttrOrErr.takeError();
9635SavedImportPaths.erase(FromD);
9650 returnToDCOrErr.takeError();
9651 auto*ToDC = cast<DeclContext>(*ToDCOrErr);
9655 if(
auto*ToRecord = dyn_cast<RecordDecl>(ToDC)) {
9656 auto*FromRecord = cast<RecordDecl>(FromDC);
9657 if(ToRecord->isCompleteDefinition())
9665 if(FromRecord->getASTContext().getExternalSource() &&
9666!FromRecord->isCompleteDefinition())
9667FromRecord->getASTContext().getExternalSource()->CompleteType(FromRecord);
9669 if(FromRecord->isCompleteDefinition())
9672 returnstd::move(Err);
9673}
else if(
auto*ToEnum = dyn_cast<EnumDecl>(ToDC)) {
9674 auto*FromEnum = cast<EnumDecl>(FromDC);
9675 if(ToEnum->isCompleteDefinition()) {
9677}
else if(FromEnum->isCompleteDefinition()) {
9680 returnstd::move(Err);
9684}
else if(
auto*ToClass = dyn_cast<ObjCInterfaceDecl>(ToDC)) {
9685 auto*FromClass = cast<ObjCInterfaceDecl>(FromDC);
9686 if(ToClass->getDefinition()) {
9691 returnstd::move(Err);
9695}
else if(
auto*ToProto = dyn_cast<ObjCProtocolDecl>(ToDC)) {
9696 auto*FromProto = cast<ObjCProtocolDecl>(FromDC);
9697 if(ToProto->getDefinition()) {
9702 returnstd::move(Err);
9713 returncast_or_null<Expr>(*ToSOrErr);
9715 returnToSOrErr.takeError();
9723llvm::DenseMap<Stmt *, Stmt *>::iterator Pos = ImportedStmts.find(FromS);
9724 if(Pos != ImportedStmts.end())
9733 if(
auto*ToE = dyn_cast<Expr>(*ToSOrErr)) {
9734 auto*FromE = cast<Expr>(FromS);
9737ToE->setValueKind(FromE->getValueKind());
9738ToE->setObjectKind(FromE->getObjectKind());
9739ToE->setDependence(FromE->getDependence());
9743ImportedStmts[FromS] = *ToSOrErr;
9754 returnstd::move(Err);
9756 switch(FromNNS->
getKind()) {
9758assert(FromNNS->
getAsIdentifier() &&
"NNS should contain identifier.");
9765cast<NamespaceDecl>(*NSOrErr));
9767 returnNSOrErr.takeError();
9772cast<NamespaceAliasDecl>(*NSADOrErr));
9774 returnNSADOrErr.takeError();
9782cast<CXXRecordDecl>(*RDOrErr));
9784 returnRDOrErr.takeError();
9794 returnTyOrErr.takeError();
9798llvm_unreachable(
"Invalid nested name specifier kind");
9810NestedNames.push_back(NNS);
9816 while(!NestedNames.empty()) {
9817NNS = NestedNames.pop_back_val();
9820 returnstd::move(Err);
9827 returnstd::move(Err);
9831 returnstd::move(Err);
9847ToLocalBeginLoc, ToLocalEndLoc);
9854 returnstd::move(Err);
9874 if(!ToSourceRangeOrErr)
9875 returnToSourceRangeOrErr.takeError();
9878ToSourceRangeOrErr->getBegin(),
9879ToSourceRangeOrErr->getEnd());
9891 return TemplateName(cast<TemplateDecl>((*ToTemplateOrErr)->getCanonicalDecl()));
9893 returnToTemplateOrErr.takeError();
9898 for(
auto*I : *FromStorage) {
9899 if(
autoToOrErr =
Import(I))
9900ToTemplates.
addDecl(cast<NamedDecl>(*ToOrErr));
9902 returnToOrErr.takeError();
9905ToTemplates.
end());
9912 returnDeclNameOrErr.takeError();
9919 if(!QualifierOrErr)
9920 returnQualifierOrErr.takeError();
9923 returnTNOrErr.takeError();
9931 if(!QualifierOrErr)
9932 returnQualifierOrErr.takeError();
9947 if(!ReplacementOrErr)
9948 returnReplacementOrErr.takeError();
9951 if(!AssociatedDeclOrErr)
9952 returnAssociatedDeclOrErr.takeError();
9955*ReplacementOrErr, *AssociatedDeclOrErr, Subst->
getIndex(),
9966 returnArgPackOrErr.takeError();
9969 if(!AssociatedDeclOrErr)
9970 returnAssociatedDeclOrErr.takeError();
9973*ArgPackOrErr, *AssociatedDeclOrErr, SubstPack->
getIndex(),
9979 returnUsingOrError.takeError();
9980 return TemplateName(cast<UsingShadowDecl>(*UsingOrError));
9983llvm_unreachable(
"Unexpected DeducedTemplate");
9986llvm_unreachable(
"Invalid template name kind");
9996std::pair<FileID, unsigned> Decomposed = FromSM.
getDecomposedLoc(FromLoc);
9999 returnToFileIDOrErr.takeError();
10001 returnToSM.
getComposedLoc(*ToFileIDOrErr, Decomposed.second);
10007 returnstd::move(Err);
10009 returnstd::move(Err);
10015llvm::DenseMap<FileID, FileID>::iterator Pos = ImportedFileIDs.find(FromID);
10016 if(Pos != ImportedFileIDs.end())
10017 returnPos->second;
10029 returnToSpLoc.takeError();
10032 returnToExLocS.takeError();
10042 returnToExLocE.takeError();
10048 if(!IsBuiltin && !
Cache->BufferOverridden) {
10052 returnToIncludeLoc.takeError();
10063 if(
Cache->OrigEntry &&
Cache->OrigEntry->getDir()) {
10074ToID = ToSM.
createFileID(*Entry, ToIncludeLocOrFakeLoc,
10081std::optional<llvm::MemoryBufferRef> FromBuf =
10087std::unique_ptr<llvm::MemoryBuffer> ToBuf =
10088llvm::MemoryBuffer::getMemBufferCopy(FromBuf->getBuffer(),
10089FromBuf->getBufferIdentifier());
10095assert(ToID.
isValid() &&
"Unexpected invalid fileID was created.");
10097ImportedFileIDs[FromID] = ToID;
10104 returnToExprOrErr.takeError();
10107 if(!LParenLocOrErr)
10108 returnLParenLocOrErr.takeError();
10111 if(!RParenLocOrErr)
10112 returnRParenLocOrErr.takeError();
10117 returnToTInfoOrErr.takeError();
10122 returnstd::move(Err);
10125ToContext, *ToTInfoOrErr, From->
isBaseVirtual(), *LParenLocOrErr,
10126*ToExprOrErr, *RParenLocOrErr, EllipsisLoc);
10130 returnToFieldOrErr.takeError();
10133 if(!MemberLocOrErr)
10134 returnMemberLocOrErr.takeError();
10137ToContext, cast_or_null<FieldDecl>(*ToFieldOrErr), *MemberLocOrErr,
10138*LParenLocOrErr, *ToExprOrErr, *RParenLocOrErr);
10141 if(!ToIFieldOrErr)
10142 returnToIFieldOrErr.takeError();
10145 if(!MemberLocOrErr)
10146 returnMemberLocOrErr.takeError();
10149ToContext, cast_or_null<IndirectFieldDecl>(*ToIFieldOrErr),
10150*MemberLocOrErr, *LParenLocOrErr, *ToExprOrErr, *RParenLocOrErr);
10154 returnToTInfoOrErr.takeError();
10156 return new(ToContext)
10158*ToExprOrErr, *RParenLocOrErr);
10161 returnmake_error<ASTImportError>();
10167 autoPos = ImportedCXXBaseSpecifiers.find(BaseSpec);
10168 if(Pos != ImportedCXXBaseSpecifiers.end())
10169 returnPos->second;
10172 if(!ToSourceRange)
10173 returnToSourceRange.takeError();
10176 returnToTSI.takeError();
10178 if(!ToEllipsisLoc)
10179 returnToEllipsisLoc.takeError();
10183ImportedCXXBaseSpecifiers[BaseSpec] =
Imported;
10195 returnToOrErr.takeError();
10196 Decl*To = *ToOrErr;
10198 auto*FromDC = cast<DeclContext>(From);
10201 if(
auto*ToRecord = dyn_cast<RecordDecl>(To)) {
10202 if(!ToRecord->getDefinition()) {
10204cast<RecordDecl>(FromDC), ToRecord,
10209 if(
auto*ToEnum = dyn_cast<EnumDecl>(To)) {
10210 if(!ToEnum->getDefinition()) {
10216 if(
auto*ToIFace = dyn_cast<ObjCInterfaceDecl>(To)) {
10217 if(!ToIFace->getDefinition()) {
10219cast<ObjCInterfaceDecl>(FromDC), ToIFace,
10224 if(
auto*ToProto = dyn_cast<ObjCProtocolDecl>(To)) {
10225 if(!ToProto->getDefinition()) {
10227cast<ObjCProtocolDecl>(FromDC), ToProto,
10249 returnToSelOrErr.takeError();
10256 returnToTyOrErr.takeError();
10264 returnToTyOrErr.takeError();
10270cast<TemplateDecl>(*ToTemplateOrErr));
10272 returnToTemplateOrErr.takeError();
10280 returnToTyOrErr.takeError();
10296llvm_unreachable(
"Invalid DeclarationName Kind!");
10317 for(
unsignedI = 1, N = FromSel.
getNumArgs(); I < N; ++I)
10325llvm::Error Err = llvm::Error::success();
10326 autoImportLoop = [&](
const APValue*From,
APValue*To,
unsignedSize) {
10327 for(
unsignedIdx = 0; Idx < Size; Idx++) {
10332 switch(FromValue.
getKind()) {
10346ImportLoop(((
constAPValue::Vec *)(
const char*)&FromValue.Data)->Elts,
10353ImportLoop(((
constAPValue::Arr *)(
const char*)&FromValue.Data)->Elts,
10354((
constAPValue::Arr *)(
const char*)&
Result.Data)->Elts,
10361((
constAPValue::StructData *)(
const char*)&FromValue.Data)->Elts,
10362((
constAPValue::StructData *)(
const char*)&
Result.Data)->Elts,
10370 returnstd::move(Err);
10371 Result.setUnion(cast<FieldDecl>(ImpFDecl), ImpValue);
10375 Result.MakeAddrLabelDiff();
10379 returnstd::move(Err);
10380 Result.setAddrLabelDiff(cast<AddrLabelExpr>(ImpLHS),
10381cast<AddrLabelExpr>(ImpRHS));
10385 const Decl*ImpMemPtrDecl =
10388 returnstd::move(Err);
10390 Result.setMemberPointerUninit(
10391cast<const ValueDecl>(ImpMemPtrDecl),
10395 Result.getMemberPointerPath();
10400 returnstd::move(Err);
10410 "in C++20 dynamic allocation are transient so they shouldn't " 10411 "appear in the AST");
10413 if(
const auto*
E=
10418 returnstd::move(Err);
10428 returnstd::move(Err);
10440 returnstd::move(Err);
10454 for(
unsignedLoopIdx = 0; LoopIdx < PathLength; LoopIdx++) {
10457FromPath[LoopIdx].getAsBaseOrMember().getPointer();
10460 returnstd::move(Err);
10461 if(
auto*RD = dyn_cast<CXXRecordDecl>(
FromDecl))
10464FromElemTy = cast<ValueDecl>(
FromDecl)->getType();
10466ImpDecl, FromPath[LoopIdx].getAsBaseOrMember().getInt()));
10471FromPath[LoopIdx].getAsArrayIndex());
10479 returnstd::move(Err);
10487 unsignedNumDecls) {
10497 if(LastDiagFromFrom)
10500LastDiagFromFrom =
false;
10505 if(!LastDiagFromFrom)
10508LastDiagFromFrom =
true;
10513 if(
auto*ID = dyn_cast<ObjCInterfaceDecl>(
D)) {
10514 if(!ID->getDefinition())
10515ID->startDefinition();
10517 else if(
auto*PD = dyn_cast<ObjCProtocolDecl>(
D)) {
10518 if(!PD->getDefinition())
10519PD->startDefinition();
10521 else if(
auto*TD = dyn_cast<TagDecl>(
D)) {
10522 if(!TD->getDefinition() && !TD->isBeingDefined()) {
10523TD->startDefinition();
10524TD->setCompleteDefinition(
true);
10528assert(0 &&
"CompleteDecl called on a Decl that can't be completed");
10533llvm::DenseMap<Decl *, Decl *>::iterator Pos = ImportedDecls.find(From);
10534assert((Pos == ImportedDecls.end() || Pos->second == To) &&
10535 "Try to import an already imported Decl");
10536 if(Pos != ImportedDecls.end())
10537 returnPos->second;
10538ImportedDecls[From] = To;
10541ImportedFromDecls[To] = From;
10546AddToLookupTable(To);
10550std::optional<ASTImportError>
10552 autoPos = ImportDeclErrors.find(FromD);
10553 if(Pos != ImportDeclErrors.end())
10554 returnPos->second;
10556 returnstd::nullopt;
10560 autoInsertRes = ImportDeclErrors.insert({From, Error});
10564assert(InsertRes.second || InsertRes.first->second.Error == Error.Error);
10569llvm::DenseMap<const Type *, const Type *>::iterator Pos =
10571 if(Pos != ImportedTypes.end()) {
10576llvm::consumeError(ToFromOrErr.takeError());
10583 returnCtx.IsEquivalent(From, To);
Defines the clang::ASTContext interface.
ASTImporterLookupTable & LT
static FriendCountAndPosition getFriendCountAndPosition(ASTImporter &Importer, FriendDecl *FD)
static bool IsEquivalentFriend(ASTImporter &Importer, FriendDecl *FD1, FriendDecl *FD2)
static auto getTemplateDefinition(T *D) -> T *
static bool isAncestorDeclContextOf(const DeclContext *DC, const Decl *D)
static Error setTypedefNameForAnonDecl(TagDecl *From, TagDecl *To, ASTImporter &Importer)
static StructuralEquivalenceKind getStructuralEquivalenceKind(const ASTImporter &Importer)
This file provides some common utility functions for processing Lambda related AST Constructs.
Defines enum values for all the target-independent builtin functions.
enum clang::sema::@1704::IndirectLocalPathEntry::EntryKind Kind
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Defines the C++ template declaration subclasses.
Defines the ExceptionSpecificationType enumeration and various utility functions.
Defines the clang::Expr interface and subclasses for C++ expressions.
Defines the clang::FileManager interface and associated types.
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines the LambdaCapture class.
Defines the clang::LangOptions interface.
llvm::MachO::Record Record
llvm::SmallVector< std::pair< const MemRegion *, SVal >, 4 > Bindings
Defines the clang::SourceLocation class and associated facilities.
Defines the SourceManager interface.
Defines various enumerations that describe declaration and type specifiers.
Defines the Objective-C statement AST node classes.
Defines the clang::TypeLoc interface and its subclasses.
C Language Family Type Representation.
const NamedDecl * FromDecl
unsigned getVersion() const
QualType getTypeInfoType() const
static LValueBase getTypeInfo(TypeInfoLValue LV, QualType TypeInfo)
unsigned getCallIndex() const
A non-discriminated union of a base, field, or array index.
static LValuePathEntry ArrayIndex(uint64_t Index)
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...
const LValueBase getLValueBase() const
ArrayRef< LValuePathEntry > getLValuePath() const
const FieldDecl * getUnionField() const
unsigned getStructNumFields() const
llvm::PointerIntPair< const Decl *, 1, bool > BaseOrMemberType
A FieldDecl or CXXRecordDecl, along with a flag indicating whether we mean a virtual or non-virtual b...
ValueKind getKind() const
bool isLValueOnePastTheEnd() const
bool isMemberPointerToDerivedMember() const
unsigned getArrayInitializedElts() const
unsigned getStructNumBases() const
bool hasLValuePath() const
const ValueDecl * getMemberPointerDecl() const
APValue & getUnionValue()
const AddrLabelExpr * getAddrLabelDiffRHS() const
CharUnits & getLValueOffset()
unsigned getVectorLength() const
ArrayRef< const CXXRecordDecl * > getMemberPointerPath() const
unsigned getArraySize() const
@ Indeterminate
This object has an indeterminate value (C++ [basic.indet]).
@ None
There is no such object (it's outside its lifetime).
bool isNullPointer() const
const AddrLabelExpr * getAddrLabelDiffLHS() const
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
QualType getUsingType(const UsingShadowDecl *Found, QualType Underlying) const
SourceManager & getSourceManager()
TranslationUnitDecl * getTranslationUnitDecl() const
QualType getAtomicType(QualType T) const
Return the uniqued reference to the atomic type for the specified type.
QualType getParenType(QualType NamedType) const
QualType getRValueReferenceType(QualType T) const
Return the uniqued reference to the type for an rvalue reference to the specified type.
BuiltinTemplateDecl * getBuiltinCommonTypeDecl() const
BuiltinTemplateDecl * getMakeIntegerSeqDecl() const
void setInstantiatedFromUsingDecl(NamedDecl *Inst, NamedDecl *Pattern)
Remember that the using decl Inst is an instantiation of the using decl Pattern of a class template.
QualType getAutoType(QualType DeducedType, AutoTypeKeyword Keyword, bool IsDependent, bool IsPack=false, ConceptDecl *TypeConstraintConcept=nullptr, ArrayRef< TemplateArgument > TypeConstraintArgs={}) const
C++11 deduced auto type.
QualType getDependentTemplateSpecializationType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, const IdentifierInfo *Name, ArrayRef< TemplateArgumentLoc > Args) const
QualType getObjCInterfaceType(const ObjCInterfaceDecl *Decl, ObjCInterfaceDecl *PrevDecl=nullptr) const
getObjCInterfaceType - Return the unique reference to the type for the specified ObjC interface decl.
QualType getBlockPointerType(QualType T) const
Return the uniqued reference to the type for a block of the specified type.
QualType getTagDeclType(const TagDecl *Decl) const
Return the unique reference to the type for the specified TagDecl (struct/union/class/enum) decl.
QualType getMemberPointerType(QualType T, const Type *Cls) const
Return the uniqued reference to the type for a member pointer to the specified type in the specified ...
NamedDecl * getInstantiatedFromUsingDecl(NamedDecl *Inst)
If the given using decl Inst is an instantiation of another (possibly unresolved) using decl,...
DeclarationNameTable DeclarationNames
QualType getAttributedType(attr::Kind attrKind, QualType modifiedType, QualType equivalentType, const Attr *attr=nullptr) const
QualType getTemplateSpecializationType(TemplateName T, ArrayRef< TemplateArgument > Args, QualType Canon=QualType()) const
QualType getRecordType(const RecordDecl *Decl) const
QualType getInjectedClassNameType(CXXRecordDecl *Decl, QualType TST) const
getInjectedClassNameType - Return the unique reference to the injected class name type for the specif...
QualType getVariableArrayType(QualType EltTy, Expr *NumElts, ArraySizeModifier ASM, unsigned IndexTypeQuals, SourceRange Brackets) const
Return a non-unique reference to the type for a variable array of the specified element type.
QualType getFunctionNoProtoType(QualType ResultTy, const FunctionType::ExtInfo &Info) const
Return a K&R style C function type like 'int()'.
QualType getArrayParameterType(QualType Ty) const
Return the uniqued reference to a specified array parameter type from the original array type.
QualType getCountAttributedType(QualType T, Expr *CountExpr, bool CountInBytes, bool OrNull, ArrayRef< TypeCoupledDeclRefInfo > DependentDecls) const
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
bool hasSameType(QualType T1, QualType T2) const
Determine whether the given types T1 and T2 are equivalent.
void setInstantiatedFromUsingShadowDecl(UsingShadowDecl *Inst, UsingShadowDecl *Pattern)
TemplateName getQualifiedTemplateName(NestedNameSpecifier *NNS, bool TemplateKeyword, TemplateName Template) const
Retrieve the template name that represents a qualified template name such as std::vector.
QualType getVectorType(QualType VectorType, unsigned NumElts, VectorKind VecKind) const
Return the unique reference to a vector type of the specified element type and size.
QualType getReadPipeType(QualType T) const
Return a read_only pipe type for the specified type.
QualType getSubstTemplateTypeParmType(QualType Replacement, Decl *AssociatedDecl, unsigned Index, std::optional< unsigned > PackIndex, SubstTemplateTypeParmTypeFlag Flag=SubstTemplateTypeParmTypeFlag::None) const
Retrieve a substitution-result type.
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
QualType getLValueReferenceType(QualType T, bool SpelledAsLValue=true) const
Return the uniqued reference to the type for an lvalue reference to the specified type.
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
TemplateName getSubstTemplateTemplateParm(TemplateName replacement, Decl *AssociatedDecl, unsigned Index, std::optional< unsigned > PackIndex) const
QualType getConstantArrayType(QualType EltTy, const llvm::APInt &ArySize, const Expr *SizeExpr, ArraySizeModifier ASM, unsigned IndexTypeQuals) const
Return the unique reference to the type for a constant array of the specified element type.
const LangOptions & getLangOpts() const
SelectorTable & Selectors
QualType getMacroQualifiedType(QualType UnderlyingTy, const IdentifierInfo *MacroII) const
QualType getDecayedType(QualType T) const
Return the uniqued reference to the decayed version of the given type.
void setInstantiatedFromUsingEnumDecl(UsingEnumDecl *Inst, UsingEnumDecl *Pattern)
Remember that the using enum decl Inst is an instantiation of the using enum decl Pattern of a class ...
UsingEnumDecl * getInstantiatedFromUsingEnumDecl(UsingEnumDecl *Inst)
If the given using-enum decl Inst is an instantiation of another using-enum decl, return it.
QualType getDeducedTemplateSpecializationType(TemplateName Template, QualType DeducedType, bool IsDependent) const
C++17 deduced class template specialization type.
QualType getTemplateTypeParmType(unsigned Depth, unsigned Index, bool ParameterPack, TemplateTypeParmDecl *ParmDecl=nullptr) const
Retrieve the template type parameter type for a template parameter or parameter pack with the given d...
TypeSourceInfo * getTrivialTypeSourceInfo(QualType T, SourceLocation Loc=SourceLocation()) const
Allocate a TypeSourceInfo where all locations have been initialized to a given location,...
QualType getSubstTemplateTypeParmPackType(Decl *AssociatedDecl, unsigned Index, bool Final, const TemplateArgument &ArgPack)
Retrieve a.
QualType getQualifiedType(SplitQualType split) const
Un-split a SplitQualType.
QualType getElaboratedType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, QualType NamedType, TagDecl *OwnedTagDecl=nullptr) const
QualType getObjCObjectPointerType(QualType OIT) const
Return a ObjCObjectPointerType type for the given ObjCObjectType.
QualType getPackExpansionType(QualType Pattern, std::optional< unsigned > NumExpansions, bool ExpectPackInType=true) const
Form a pack expansion type with the given pattern.
QualType getObjCObjectType(QualType Base, ObjCProtocolDecl *const *Protocols, unsigned NumProtocols) const
Legacy interface: cannot provide type arguments or __kindof.
QualType getDependentSizedArrayType(QualType EltTy, Expr *NumElts, ArraySizeModifier ASM, unsigned IndexTypeQuals, SourceRange Brackets) const
Return a non-unique reference to the type for a dependently-sized array of the specified element type...
UsingShadowDecl * getInstantiatedFromUsingShadowDecl(UsingShadowDecl *Inst)
const ArrayType * getAsArrayType(QualType T) const
Type Query functions.
QualType getWritePipeType(QualType T) const
Return a write_only pipe type for the specified type.
CanQualType UnsignedCharTy
TemplateName getDependentTemplateName(NestedNameSpecifier *NNS, const IdentifierInfo *Name) const
Retrieve the template name that represents a dependent template name such as MetaFun::template apply.
QualType getFunctionType(QualType ResultTy, ArrayRef< QualType > Args, const FunctionProtoType::ExtProtoInfo &EPI) const
Return a normal function type with a typed argument list.
QualType getDependentNameType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, const IdentifierInfo *Name, QualType Canon=QualType()) const
QualType getPackIndexingType(QualType Pattern, Expr *IndexExpr, bool FullySubstituted=false, ArrayRef< QualType > Expansions={}, int Index=-1) const
QualType getUnaryTransformType(QualType BaseType, QualType UnderlyingType, UnaryTransformType::UTTKind UKind) const
Unary type transforms.
QualType getComplexType(QualType T) const
Return the uniqued reference to the type for a complex number with the specified element type.
DiagnosticsEngine & getDiagnostics() const
QualType getExtVectorType(QualType VectorType, unsigned NumElts) const
Return the unique reference to an extended vector type of the specified element type and size.
TemplateName getOverloadedTemplateName(UnresolvedSetIterator Begin, UnresolvedSetIterator End) const
Retrieve the template name that corresponds to a non-empty lookup.
TemplateName getSubstTemplateTemplateParmPack(const TemplateArgument &ArgPack, Decl *AssociatedDecl, unsigned Index, bool Final) const
ExternalASTSource * getExternalSource() const
Retrieve a pointer to the external AST source associated with this AST context, if any.
BuiltinTemplateDecl * getTypePackElementDecl() const
QualType getTypeOfType(QualType QT, TypeOfKind Kind) const
getTypeOfType - Unlike many "get<Type>" functions, we don't unique TypeOfType nodes.
QualType getDecltypeType(Expr *e, QualType UnderlyingType) const
C++11 decltype.
QualType getTypedefType(const TypedefNameDecl *Decl, QualType Underlying=QualType()) const
Return the unique reference to the type for the specified typedef-name decl.
unsigned char getFixedPointScale(QualType Ty) const
QualType getIncompleteArrayType(QualType EltTy, ArraySizeModifier ASM, unsigned IndexTypeQuals) const
Return a unique reference to the type for an incomplete array of the specified element type.
QualType getDependentSizedExtVectorType(QualType VectorType, Expr *SizeExpr, SourceLocation AttrLoc) const
TemplateName getAssumedTemplateName(DeclarationName Name) const
Retrieve a template name representing an unqualified-id that has been assumed to name a template for ...
QualType getTypeOfExprType(Expr *E, TypeOfKind Kind) const
C23 feature and GCC extension.
std::error_code convertToErrorCode() const override
void log(llvm::raw_ostream &OS) const override
std::string toString() const
@ Unknown
Not supported node or case.
@ UnsupportedConstruct
Naming ambiguity (likely ODR violation).
void update(NamedDecl *ND, DeclContext *OldDC)
void updateForced(NamedDecl *ND, DeclContext *OldDC)
bool hasCycleAtBack() const
Returns true if the last element can be found earlier in the path.
VecTy copyCycleAtBack() const
Returns the copy of the cycle.
Imports selected nodes from one AST context into another context, merging AST nodes where appropriate...
ASTContext & getFromContext() const
Retrieve the context that AST nodes are being imported from.
NonEquivalentDeclSet & getNonEquivalentDecls()
Return the set of declarations that we know are not equivalent.
ASTContext & getToContext() const
Retrieve the context that AST nodes are being imported into.
DiagnosticBuilder ToDiag(SourceLocation Loc, unsigned DiagID)
Report a diagnostic in the "to" context.
Decl * MapImported(Decl *From, Decl *To)
Store and assign the imported declaration to its counterpart.
llvm::DenseSet< std::tuple< Decl *, Decl *, int > > NonEquivalentDeclSet
TranslationUnitDecl * GetFromTU(Decl *ToD)
Return the translation unit from where the declaration was imported.
llvm::Expected< DeclContext * > ImportContext(DeclContext *FromDC)
Import the given declaration context from the "from" AST context into the "to" AST context.
llvm::Error ImportDefinition(Decl *From)
Import the definition of the given declaration, including all of the declarations it contains.
virtual Expected< 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.
virtual bool returnWithErrorInTest()
Used only in unittests to verify the behaviour of the error handling.
std::optional< DeclT * > getImportedFromDecl(const DeclT *ToD) const
Return the declaration in the "from" context from which the declaration in the "to" context was impor...
void RegisterImportedDecl(Decl *FromD, Decl *ToD)
std::optional< ASTImportError > getImportDeclErrorIfAny(Decl *FromD) const
Return if import of the given declaration has failed and if yes the kind of the problem.
friend class ASTNodeImporter
static std::optional< unsigned > getFieldIndex(Decl *F)
Determine the index of a field in its parent record.
llvm::Error importInto(ImportT &To, const ImportT &From)
Import the given object, returns the result.
virtual Decl * GetOriginalDecl(Decl *To)
Called by StructuralEquivalenceContext.
virtual void Imported(Decl *From, Decl *To)
Subclasses can override this function to observe all of the From -> To declaration mappings as they a...
DiagnosticBuilder FromDiag(SourceLocation Loc, unsigned DiagID)
Report a diagnostic in the "from" context.
bool IsStructurallyEquivalent(QualType From, QualType To, bool Complain=true)
Determine whether the given types are structurally equivalent.
virtual Expected< Decl * > ImportImpl(Decl *From)
Can be overwritten by subclasses to implement their own import logic.
bool isMinimalImport() const
Whether the importer will perform a minimal import, creating to-be-completed forward declarations whe...
ASTImporter(ASTContext &ToContext, FileManager &ToFileManager, ASTContext &FromContext, FileManager &FromFileManager, bool MinimalImport, std::shared_ptr< ASTImporterSharedState > SharedState=nullptr)
llvm::Expected< ExprWithCleanups::CleanupObject > Import(ExprWithCleanups::CleanupObject From)
Import cleanup objects owned by ExprWithCleanup.
virtual void CompleteDecl(Decl *D)
Called for ObjCInterfaceDecl, ObjCProtocolDecl, and TagDecl.
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...
void setImportDeclError(Decl *From, ASTImportError Error)
Mark (newly) imported declaration with error.
ExpectedDecl VisitObjCImplementationDecl(ObjCImplementationDecl *D)
ExpectedStmt VisitGenericSelectionExpr(GenericSelectionExpr *E)
ExpectedStmt VisitTypeTraitExpr(TypeTraitExpr *E)
ExpectedDecl VisitTypeAliasTemplateDecl(TypeAliasTemplateDecl *D)
ExpectedDecl VisitObjCInterfaceDecl(ObjCInterfaceDecl *D)
ExpectedStmt VisitDeclRefExpr(DeclRefExpr *E)
ExpectedDecl VisitAccessSpecDecl(AccessSpecDecl *D)
ExpectedDecl VisitFunctionDecl(FunctionDecl *D)
ExpectedDecl VisitParmVarDecl(ParmVarDecl *D)
ExpectedStmt VisitImplicitValueInitExpr(ImplicitValueInitExpr *E)
ExpectedStmt VisitImplicitCastExpr(ImplicitCastExpr *E)
ExpectedDecl VisitCXXMethodDecl(CXXMethodDecl *D)
ExpectedDecl VisitUsingDecl(UsingDecl *D)
ExpectedDecl VisitObjCProtocolDecl(ObjCProtocolDecl *D)
ExpectedStmt VisitStmt(Stmt *S)
ExpectedDecl VisitTranslationUnitDecl(TranslationUnitDecl *D)
ExpectedDecl VisitFieldDecl(FieldDecl *D)
Error ImportFieldDeclDefinition(const FieldDecl *From, const FieldDecl *To)
Error ImportDefinitionIfNeeded(Decl *FromD, Decl *ToD=nullptr)
ExpectedStmt VisitCharacterLiteral(CharacterLiteral *E)
ExpectedStmt VisitCXXConstructExpr(CXXConstructExpr *E)
ExpectedStmt VisitObjCAtThrowStmt(ObjCAtThrowStmt *S)
ExpectedDecl VisitStaticAssertDecl(StaticAssertDecl *D)
ExpectedStmt VisitShuffleVectorExpr(ShuffleVectorExpr *E)
ExpectedDecl VisitObjCPropertyDecl(ObjCPropertyDecl *D)
ExpectedDecl VisitRecordDecl(RecordDecl *D)
ExpectedStmt VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E)
ExpectedDecl VisitUsingShadowDecl(UsingShadowDecl *D)
Error ImportArrayChecked(const InContainerTy &InContainer, OIter Obegin)
ExpectedStmt VisitObjCAtFinallyStmt(ObjCAtFinallyStmt *S)
T importChecked(Error &Err, const T &From)
ExpectedStmt VisitVAArgExpr(VAArgExpr *E)
ExpectedStmt VisitDefaultStmt(DefaultStmt *S)
ExpectedDecl VisitUnresolvedUsingTypenameDecl(UnresolvedUsingTypenameDecl *D)
ExpectedStmt VisitCXXThrowExpr(CXXThrowExpr *E)
ExpectedDecl VisitLabelDecl(LabelDecl *D)
ExpectedStmt VisitSizeOfPackExpr(SizeOfPackExpr *E)
ExpectedStmt VisitObjCAtTryStmt(ObjCAtTryStmt *S)
ExpectedStmt VisitUnaryOperator(UnaryOperator *E)
Error ImportTemplateParameterLists(const DeclTy *FromD, DeclTy *ToD)
Error ImportDeclContext(DeclContext *FromDC, bool ForceImport=false)
ExpectedStmt VisitContinueStmt(ContinueStmt *S)
ExpectedStmt VisitCXXMemberCallExpr(CXXMemberCallExpr *E)
ExpectedDecl VisitVarDecl(VarDecl *D)
ExpectedStmt VisitCXXStdInitializerListExpr(CXXStdInitializerListExpr *E)
ExpectedDecl VisitUnresolvedUsingValueDecl(UnresolvedUsingValueDecl *D)
Error ImportImplicitMethods(const CXXRecordDecl *From, CXXRecordDecl *To)
ExpectedStmt VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *E)
ExpectedStmt VisitImaginaryLiteral(ImaginaryLiteral *E)
ExpectedDecl VisitLinkageSpecDecl(LinkageSpecDecl *D)
ExpectedDecl VisitCXXDestructorDecl(CXXDestructorDecl *D)
ExpectedStmt VisitCXXNamedCastExpr(CXXNamedCastExpr *E)
ExpectedStmt VisitOffsetOfExpr(OffsetOfExpr *OE)
ExpectedStmt VisitExprWithCleanups(ExprWithCleanups *E)
ExpectedDecl VisitIndirectFieldDecl(IndirectFieldDecl *D)
ExpectedStmt VisitCXXFoldExpr(CXXFoldExpr *E)
ExpectedDecl VisitTypeAliasDecl(TypeAliasDecl *D)
Expected< InheritedConstructor > ImportInheritedConstructor(const InheritedConstructor &From)
ExpectedStmt VisitCXXNewExpr(CXXNewExpr *E)
Error ImportDeclParts(NamedDecl *D, DeclarationName &Name, NamedDecl *&ToD, SourceLocation &Loc)
Error ImportDefinition(RecordDecl *From, RecordDecl *To, ImportDefinitionKind Kind=IDK_Default)
ExpectedStmt VisitObjCAutoreleasePoolStmt(ObjCAutoreleasePoolStmt *S)
ExpectedStmt VisitConstantExpr(ConstantExpr *E)
ExpectedStmt VisitCompoundLiteralExpr(CompoundLiteralExpr *E)
ExpectedStmt VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *E)
ExpectedDecl VisitDecl(Decl *D)
bool hasSameVisibilityContextAndLinkage(T *Found, T *From)
ExpectedStmt VisitParenExpr(ParenExpr *E)
ExpectedStmt VisitObjCForCollectionStmt(ObjCForCollectionStmt *S)
ExpectedStmt VisitSourceLocExpr(SourceLocExpr *E)
ExpectedStmt VisitInitListExpr(InitListExpr *E)
Expected< FunctionTemplateAndArgsTy > ImportFunctionTemplateWithTemplateArgsFromSpecialization(FunctionDecl *FromFD)
ExpectedStmt VisitReturnStmt(ReturnStmt *S)
ExpectedStmt VisitAtomicExpr(AtomicExpr *E)
ExpectedStmt VisitConditionalOperator(ConditionalOperator *E)
ExpectedStmt VisitChooseExpr(ChooseExpr *E)
ExpectedStmt VisitCompoundStmt(CompoundStmt *S)
Expected< TemplateArgument > ImportTemplateArgument(const TemplateArgument &From)
ExpectedStmt VisitCXXNullPtrLiteralExpr(CXXNullPtrLiteralExpr *E)
ExpectedStmt VisitCaseStmt(CaseStmt *S)
ExpectedStmt VisitCXXRewrittenBinaryOperator(CXXRewrittenBinaryOperator *E)
ExpectedStmt VisitDesignatedInitExpr(DesignatedInitExpr *E)
ExpectedDecl VisitObjCTypeParamDecl(ObjCTypeParamDecl *D)
ExpectedStmt VisitCompoundAssignOperator(CompoundAssignOperator *E)
ExpectedStmt VisitMaterializeTemporaryExpr(MaterializeTemporaryExpr *E)
ExpectedStmt VisitLambdaExpr(LambdaExpr *LE)
ExpectedStmt VisitBinaryOperator(BinaryOperator *E)
ExpectedStmt VisitCallExpr(CallExpr *E)
ExpectedStmt VisitDeclStmt(DeclStmt *S)
ExpectedStmt VisitCXXDeleteExpr(CXXDeleteExpr *E)
ExpectedStmt VisitUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr *E)
Error ImportArrayChecked(IIter Ibegin, IIter Iend, OIter Obegin)
ExpectedDecl VisitClassTemplateDecl(ClassTemplateDecl *D)
ExpectedDecl VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D)
Expected< CXXCastPath > ImportCastPath(CastExpr *E)
Expected< APValue > ImportAPValue(const APValue &FromValue)
ExpectedDecl VisitFunctionTemplateDecl(FunctionTemplateDecl *D)
ExpectedStmt VisitGNUNullExpr(GNUNullExpr *E)
ExpectedDecl VisitClassTemplateSpecializationDecl(ClassTemplateSpecializationDecl *D)
ExpectedStmt VisitCXXDefaultArgExpr(CXXDefaultArgExpr *E)
ExpectedDecl VisitLifetimeExtendedTemporaryDecl(LifetimeExtendedTemporaryDecl *D)
ExpectedDecl VisitTypedefNameDecl(TypedefNameDecl *D, bool IsAlias)
ExpectedDecl VisitCXXConstructorDecl(CXXConstructorDecl *D)
ExpectedDecl VisitObjCCategoryImplDecl(ObjCCategoryImplDecl *D)
ExpectedDecl VisitObjCIvarDecl(ObjCIvarDecl *D)
Expected< ObjCTypeParamList * > ImportObjCTypeParamList(ObjCTypeParamList *list)
ExpectedDecl VisitUsingPackDecl(UsingPackDecl *D)
ExpectedStmt VisitWhileStmt(WhileStmt *S)
ExpectedDecl VisitEnumConstantDecl(EnumConstantDecl *D)
ExpectedStmt VisitUnresolvedMemberExpr(UnresolvedMemberExpr *E)
ExpectedStmt VisitCXXForRangeStmt(CXXForRangeStmt *S)
ExpectedDecl VisitFriendDecl(FriendDecl *D)
Error ImportContainerChecked(const InContainerTy &InContainer, OutContainerTy &OutContainer)
ExpectedStmt VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *E)
ExpectedStmt VisitExpressionTraitExpr(ExpressionTraitExpr *E)
bool IsStructuralMatch(Decl *From, Decl *To, bool Complain=true, bool IgnoreTemplateParmDepth=false)
ExpectedStmt VisitFixedPointLiteral(FixedPointLiteral *E)
ExpectedStmt VisitForStmt(ForStmt *S)
ExpectedStmt VisitUnresolvedLookupExpr(UnresolvedLookupExpr *E)
ExpectedDecl VisitEnumDecl(EnumDecl *D)
ExpectedDecl VisitObjCCategoryDecl(ObjCCategoryDecl *D)
ExpectedStmt VisitAddrLabelExpr(AddrLabelExpr *E)
ExpectedStmt VisitBinaryConditionalOperator(BinaryConditionalOperator *E)
ExpectedStmt VisitSwitchStmt(SwitchStmt *S)
ExpectedType VisitType(const Type *T)
ExpectedDecl VisitVarTemplateDecl(VarTemplateDecl *D)
ExpectedDecl ImportUsingShadowDecls(BaseUsingDecl *D, BaseUsingDecl *ToSI)
ExpectedStmt VisitPredefinedExpr(PredefinedExpr *E)
ExpectedStmt VisitOpaqueValueExpr(OpaqueValueExpr *E)
ExpectedDecl VisitNamespaceAliasDecl(NamespaceAliasDecl *D)
ExpectedStmt VisitCXXInheritedCtorInitExpr(CXXInheritedCtorInitExpr *E)
ExpectedDecl VisitVarTemplateSpecializationDecl(VarTemplateSpecializationDecl *D)
ExpectedStmt VisitPackExpansionExpr(PackExpansionExpr *E)
ExpectedStmt VisitCXXUnresolvedConstructExpr(CXXUnresolvedConstructExpr *E)
ExpectedDecl VisitObjCMethodDecl(ObjCMethodDecl *D)
Error ImportTemplateArguments(ArrayRef< TemplateArgument > FromArgs, SmallVectorImpl< TemplateArgument > &ToArgs)
ExpectedDecl VisitObjCPropertyImplDecl(ObjCPropertyImplDecl *D)
ExpectedStmt VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *E)
ExpectedDecl VisitImplicitParamDecl(ImplicitParamDecl *D)
ExpectedDecl VisitNonTypeTemplateParmDecl(NonTypeTemplateParmDecl *D)
ExpectedStmt VisitExplicitCastExpr(ExplicitCastExpr *E)
ExpectedStmt VisitArrayInitIndexExpr(ArrayInitIndexExpr *E)
Error ImportTemplateArgumentListInfo(const InContainerTy &Container, TemplateArgumentListInfo &ToTAInfo)
ExpectedStmt VisitDoStmt(DoStmt *S)
ExpectedStmt VisitNullStmt(NullStmt *S)
ExpectedStmt VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E)
ExpectedDecl VisitBuiltinTemplateDecl(BuiltinTemplateDecl *D)
Error ImportOverriddenMethods(CXXMethodDecl *ToMethod, CXXMethodDecl *FromMethod)
ExpectedStmt VisitStringLiteral(StringLiteral *E)
Error ImportDeclarationNameLoc(const DeclarationNameInfo &From, DeclarationNameInfo &To)
ExpectedStmt VisitCXXDependentScopeMemberExpr(CXXDependentScopeMemberExpr *E)
bool hasReturnTypeDeclaredInside(FunctionDecl *D)
This function checks if the given function has a return type that contains a reference (in any way) t...
ASTNodeImporter(ASTImporter &Importer)
std::tuple< FunctionTemplateDecl *, TemplateArgsTy > FunctionTemplateAndArgsTy
ExpectedDecl VisitCXXDeductionGuideDecl(CXXDeductionGuideDecl *D)
ExpectedStmt VisitMemberExpr(MemberExpr *E)
ExpectedStmt VisitCXXThisExpr(CXXThisExpr *E)
Error ImportInitializer(VarDecl *From, VarDecl *To)
ImportDefinitionKind
What we should import from the definition.
@ IDK_Everything
Import everything.
@ IDK_Default
Import the default subset of the definition, which might be nothing (if minimal import is set) or mig...
@ IDK_Basic
Import only the bare bones needed to establish a valid DeclContext.
ExpectedDecl VisitTypedefDecl(TypedefDecl *D)
ExpectedDecl VisitUsingDirectiveDecl(UsingDirectiveDecl *D)
ExpectedStmt VisitArrayTypeTraitExpr(ArrayTypeTraitExpr *E)
ExpectedDecl VisitTemplateTemplateParmDecl(TemplateTemplateParmDecl *D)
ExpectedStmt VisitFloatingLiteral(FloatingLiteral *E)
ExpectedStmt VisitIfStmt(IfStmt *S)
ExpectedStmt VisitLabelStmt(LabelStmt *S)
ExpectedStmt VisitCXXTypeidExpr(CXXTypeidExpr *E)
ExpectedStmt VisitConvertVectorExpr(ConvertVectorExpr *E)
ExpectedDecl VisitUsingEnumDecl(UsingEnumDecl *D)
ExpectedStmt VisitGotoStmt(GotoStmt *S)
ExpectedStmt VisitSubstNonTypeTemplateParmExpr(SubstNonTypeTemplateParmExpr *E)
ExpectedStmt VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt *S)
ExpectedStmt VisitGCCAsmStmt(GCCAsmStmt *S)
ExpectedDecl VisitNamespaceDecl(NamespaceDecl *D)
ExpectedStmt VisitCXXTryStmt(CXXTryStmt *S)
ExpectedDecl VisitImportDecl(ImportDecl *D)
Error ImportFunctionDeclBody(FunctionDecl *FromFD, FunctionDecl *ToFD)
ExpectedStmt VisitArraySubscriptExpr(ArraySubscriptExpr *E)
ExpectedStmt VisitIntegerLiteral(IntegerLiteral *E)
ExpectedDecl VisitEmptyDecl(EmptyDecl *D)
ExpectedStmt VisitCXXNoexceptExpr(CXXNoexceptExpr *E)
ExpectedStmt VisitExpr(Expr *E)
Error ImportDefaultArgOfParmVarDecl(const ParmVarDecl *FromParam, ParmVarDecl *ToParam)
ExpectedStmt VisitArrayInitLoopExpr(ArrayInitLoopExpr *E)
ExpectedStmt VisitCXXCatchStmt(CXXCatchStmt *S)
ExpectedStmt VisitAttributedStmt(AttributedStmt *S)
ExpectedStmt VisitIndirectGotoStmt(IndirectGotoStmt *S)
ExpectedStmt VisitParenListExpr(ParenListExpr *E)
Expected< FunctionDecl * > FindFunctionTemplateSpecialization(FunctionDecl *FromFD)
ExpectedDecl VisitCXXConversionDecl(CXXConversionDecl *D)
ExpectedStmt VisitObjCAtCatchStmt(ObjCAtCatchStmt *S)
Error ImportTemplateInformation(FunctionDecl *FromFD, FunctionDecl *ToFD)
ExpectedStmt VisitStmtExpr(StmtExpr *E)
ExpectedStmt VisitCXXDefaultInitExpr(CXXDefaultInitExpr *E)
bool shouldForceImportDeclContext(ImportDefinitionKind IDK)
ExpectedDecl VisitBindingDecl(BindingDecl *D)
ExpectedStmt VisitBreakStmt(BreakStmt *S)
Represents an access specifier followed by colon ':'.
AddrLabelExpr - The GNU address of label extension, representing &&label.
Represents a type which was implicitly adjusted by the semantic engine for arbitrary reasons.
Represents the index of the current element of an array being initialized by an ArrayInitLoopExpr.
Represents a loop initializing the elements of an array.
Represents a constant array type that does not decay to a pointer when used as a function parameter.
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
An Embarcadero array type trait, as used in the implementation of __array_rank and __array_extent.
Represents an array type, per C99 6.7.5.2 - Array Declarators.
QualType getElementType() const
A structure for storing the information associated with a name that has been assumed to be a template...
DeclarationName getDeclName() const
Get the name of the template.
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load,...
Attr - This represents one attribute.
attr::Kind getKind() const
void setPackExpansion(bool PE)
Attr * clone(ASTContext &C) const
SourceRange getRange() const
void setRange(SourceRange R)
void setAttrName(const IdentifierInfo *AttrNameII)
const IdentifierInfo * getAttrName() const
Represents an attribute applied to a statement.
static AttributedStmt * Create(const ASTContext &C, SourceLocation Loc, ArrayRef< const Attr * > Attrs, Stmt *SubStmt)
An attributed type is a type to which a type attribute has been applied.
Represents a C++11 auto or C++14 decltype(auto) type, possibly constrained by a type-constraint.
Represents a C++ declaration that introduces decls from somewhere else.
void addShadowDecl(UsingShadowDecl *S)
BinaryConditionalOperator - The GNU extension to the conditional operator which allows the middle ope...
A builtin binary operation expression such as "x + y" or "x <= y".
static BinaryOperator * Create(const ASTContext &C, Expr *lhs, Expr *rhs, Opcode opc, QualType ResTy, ExprValueKind VK, ExprObjectKind OK, SourceLocation opLoc, FPOptionsOverride FPFeatures)
A binding in a decomposition declaration.
void setBinding(QualType DeclaredType, Expr *Binding)
Set the binding for this BindingDecl, along with its declared type (which should be a possibly-cv-qua...
void setDecomposedDecl(ValueDecl *Decomposed)
Set the decomposed variable for this BindingDecl.
A fixed int type of a specified bitwidth.
BreakStmt - This represents a break.
Represents a C++2a __builtin_bit_cast(T, v) expression.
Represents the builtin template declaration which is used to implement __make_integer_seq and other b...
This class is used for builtin types like 'int'.
static CStyleCastExpr * Create(const ASTContext &Context, QualType T, ExprValueKind VK, CastKind K, Expr *Op, const CXXCastPath *BasePath, FPOptionsOverride FPO, TypeSourceInfo *WrittenTy, SourceLocation L, SourceLocation R)
Represents a base class of a C++ class.
AccessSpecifier getAccessSpecifierAsWritten() const
Retrieves the access specifier as written in the source code (which may mean that no access specifier...
SourceLocation getEllipsisLoc() const
For a pack expansion, determine the location of the ellipsis.
bool isVirtual() const
Determines whether the base class is a virtual base class (or not).
TypeSourceInfo * getTypeSourceInfo() const
Retrieves the type and source location of the base class.
bool isBaseOfClass() const
Determine whether this base class is a base of a class declared with the 'class' keyword (vs.
SourceRange getSourceRange() const LLVM_READONLY
Retrieves the source range that contains the entire base specifier.
Represents binding an expression to a temporary.
static CXXBindTemporaryExpr * Create(const ASTContext &C, CXXTemporary *Temp, Expr *SubExpr)
A boolean literal, per ([C++ lex.bool] Boolean literals).
static CXXBoolLiteralExpr * Create(const ASTContext &C, bool Val, QualType Ty, SourceLocation Loc)
CXXCatchStmt - This represents a C++ catch block.
static CXXConstCastExpr * Create(const ASTContext &Context, QualType T, ExprValueKind VK, Expr *Op, TypeSourceInfo *WrittenTy, SourceLocation L, SourceLocation RParenLoc, SourceRange AngleBrackets)
Represents a call to a C++ constructor.
void setIsImmediateEscalating(bool Set)
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, CXXConstructionKind ConstructKind, SourceRange ParenOrBraceRange)
Create a C++ construction expression.
Represents a C++ constructor within a class.
Represents a C++ conversion function within a class.
Represents a C++ base or member initializer.
FieldDecl * getMember() const
If this is a member initializer, returns the declaration of the non-static data member being initiali...
bool isDelegatingInitializer() const
Determine whether this initializer is creating a delegating constructor.
Expr * getInit() const
Get the initializer.
SourceLocation getRParenLoc() const
SourceLocation getEllipsisLoc() const
SourceLocation getLParenLoc() const
bool isPackExpansion() const
Determine whether this initializer is a pack expansion.
TypeSourceInfo * getTypeSourceInfo() const
Returns the declarator information for a base class or delegating initializer.
bool isMemberInitializer() const
Determine whether this initializer is initializing a non-static data member.
bool isBaseInitializer() const
Determine whether this initializer is initializing a base class.
bool isIndirectMemberInitializer() const
SourceLocation getMemberLocation() const
IndirectFieldDecl * getIndirectMember() const
bool isBaseVirtual() const
Returns whether the base is virtual or not.
Represents a C++ deduction guide declaration.
SourceDeductionGuideKind getSourceDeductionGuideKind() const
A default argument (C++ [dcl.fct.default]).
static CXXDefaultArgExpr * Create(const ASTContext &C, SourceLocation Loc, ParmVarDecl *Param, Expr *RewrittenExpr, DeclContext *UsedContext)
A use of a default initializer in a constructor or in aggregate initialization.
static CXXDefaultInitExpr * Create(const ASTContext &Ctx, SourceLocation Loc, FieldDecl *Field, DeclContext *UsedContext, Expr *RewrittenInitExpr)
Field is the non-static data member whose default initializer is used by this expression.
Represents a delete expression for memory deallocation and destructor calls, e.g.
Represents a C++ member access expression where the actual member referenced could not be resolved be...
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)
Represents a C++ destructor within a class.
void setOperatorDelete(FunctionDecl *OD, Expr *ThisArg)
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)
Represents a folding of a pack over an operator.
CXXForRangeStmt - This represents C++0x [stmt.ranged]'s ranged for statement, represented as 'for (ra...
static CXXFunctionalCastExpr * Create(const ASTContext &Context, QualType T, ExprValueKind VK, TypeSourceInfo *Written, CastKind Kind, Expr *Op, const CXXCastPath *Path, FPOptionsOverride FPO, SourceLocation LPLoc, SourceLocation RPLoc)
Represents a call to an inherited base class constructor from an inheriting constructor.
Represents a call to a member function that may be written either with member call syntax (e....
static CXXMemberCallExpr * Create(const ASTContext &Ctx, Expr *Fn, ArrayRef< Expr * > Args, QualType Ty, ExprValueKind VK, SourceLocation RP, FPOptionsOverride FPFeatures, unsigned MinNumArgs=0)
Represents a static or instance method of a struct/union/class.
void addOverriddenMethod(const CXXMethodDecl *MD)
overridden_method_range overridden_methods() const
CXXMethodDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
Abstract class common to all of the C++ "named"/"keyword" casts.
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)".
static CXXNewExpr * Create(const ASTContext &Ctx, bool IsGlobalNew, FunctionDecl *OperatorNew, FunctionDecl *OperatorDelete, bool ShouldPassAlignment, bool UsualArrayDeleteWantsSize, ArrayRef< Expr * > PlacementArgs, SourceRange TypeIdParens, std::optional< Expr * > ArraySize, CXXNewInitializationStyle InitializationStyle, Expr *Initializer, QualType Ty, TypeSourceInfo *AllocatedTypeInfo, SourceRange Range, SourceRange DirectInitRange)
Create a c++ new expression.
Represents a C++11 noexcept expression (C++ [expr.unary.noexcept]).
The null pointer literal (C++11 [lex.nullptr])
static CXXOperatorCallExpr * Create(const ASTContext &Ctx, OverloadedOperatorKind OpKind, Expr *Fn, ArrayRef< Expr * > Args, QualType Ty, ExprValueKind VK, SourceLocation OperatorLoc, FPOptionsOverride FPFeatures, ADLCallKind UsesADL=NotADL)
Represents a C++ pseudo-destructor (C++ [expr.pseudo]).
Represents a C++ struct/union/class.
CXXRecordDecl * getMostRecentDecl()
CXXRecordDecl * getInstantiatedFromMemberClass() const
If this record is an instantiation of a member class, retrieves the member class from which it was in...
method_range methods() const
CXXRecordDecl * getDefinition() const
static CXXRecordDecl * CreateLambda(const ASTContext &C, DeclContext *DC, TypeSourceInfo *Info, SourceLocation Loc, unsigned DependencyKind, bool IsGeneric, LambdaCaptureDefault CaptureDefault)
void setInstantiationOfMemberClass(CXXRecordDecl *RD, TemplateSpecializationKind TSK)
Specify that this record is an instantiation of the member class RD.
void setDescribedClassTemplate(ClassTemplateDecl *Template)
void setLambdaNumbering(LambdaNumbering Numbering)
Set the mangling numbers and context declaration for a lambda class.
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this class is an instantiation of a member class of a class template specialization,...
void setTemplateSpecializationKind(TemplateSpecializationKind TSK)
Set the kind of specialization or template instantiation this is.
CXXRecordDecl * getPreviousDecl()
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)
A rewritten comparison expression that was originally written using operator syntax.
An expression "T()" which creates an rvalue of a non-class type T.
static CXXStaticCastExpr * Create(const ASTContext &Context, QualType T, ExprValueKind VK, CastKind K, Expr *Op, const CXXCastPath *Path, TypeSourceInfo *Written, FPOptionsOverride FPO, SourceLocation L, SourceLocation RParenLoc, SourceRange AngleBrackets)
Implicit construction of a std::initializer_list<T> object from an array temporary within list-initia...
Represents a C++ functional cast expression that builds a temporary object.
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)
Represents a C++ temporary.
static CXXTemporary * Create(const ASTContext &C, const CXXDestructorDecl *Destructor)
Represents the this expression in C++.
static CXXThisExpr * Create(const ASTContext &Ctx, SourceLocation L, QualType Ty, bool IsImplicit)
A C++ throw-expression (C++ [except.throw]).
CXXTryStmt - A C++ try block, including all handlers.
static CXXTryStmt * Create(const ASTContext &C, SourceLocation tryLoc, CompoundStmt *tryBlock, ArrayRef< Stmt * > handlers)
A C++ typeid expression (C++ [expr.typeid]), which gets the type_info that corresponds to the supplie...
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
static CXXUnresolvedConstructExpr * Create(const ASTContext &Context, QualType T, TypeSourceInfo *TSI, SourceLocation LParenLoc, ArrayRef< Expr * > Args, SourceLocation RParenLoc, bool IsListInit)
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
static CallExpr * Create(const ASTContext &Ctx, Expr *Fn, ArrayRef< Expr * > Args, QualType Ty, ExprValueKind VK, SourceLocation RParenLoc, FPOptionsOverride FPFeatures, unsigned MinNumArgs=0, ADLCallKind UsesADL=NotADL)
Create a call expression.
CaseStmt - Represent a case statement.
static CaseStmt * Create(const ASTContext &Ctx, Expr *lhs, Expr *rhs, SourceLocation caseLoc, SourceLocation ellipsisLoc, SourceLocation colonLoc)
Build a case statement.
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
path_iterator path_begin()
CharUnits - This is an opaque type for sizes expressed in character units.
How to handle import errors that occur when import of a child declaration of a DeclContext fails.
bool ignoreChildErrorOnParent(Decl *FromChildD) const
Determine if import failure of a child does not cause import failure of its parent.
ChildErrorHandlingStrategy(const Decl *FromD)
void handleChildImportResult(Error &ResultErr, Error &&ChildErr)
Process the import result of a child (of the current declaration).
ChildErrorHandlingStrategy(const DeclContext *FromDC)
ChooseExpr - GNU builtin-in function __builtin_choose_expr.
Declaration of a class template.
void AddPartialSpecialization(ClassTemplatePartialSpecializationDecl *D, void *InsertPos)
Insert the specified partial specialization knowing that it is not already in.
ClassTemplateDecl * getMostRecentDecl()
CXXRecordDecl * getTemplatedDecl() const
Get the underlying class declarations of the template.
ClassTemplatePartialSpecializationDecl * findPartialSpecialization(ArrayRef< TemplateArgument > Args, TemplateParameterList *TPL, void *&InsertPos)
Return the partial specialization with the provided arguments if it exists, otherwise return the inse...
void AddSpecialization(ClassTemplateSpecializationDecl *D, void *InsertPos)
Insert the specified specialization knowing that it is not already in.
QualType getInjectedClassNameSpecialization()
Retrieve the template specialization type of the injected-class-name for this class template.
ClassTemplateSpecializationDecl * findSpecialization(ArrayRef< TemplateArgument > Args, void *&InsertPos)
Return the specialization with the provided arguments if it exists, otherwise return the insertion po...
ClassTemplatePartialSpecializationDecl * getInstantiatedFromMember() const
Retrieve the member class template partial specialization from which this particular class template p...
QualType getInjectedSpecializationType() const
Retrieves the injected specialization type for this partial specialization.
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
Represents a class template specialization, which refers to a class template with a given set of temp...
void setPointOfInstantiation(SourceLocation Loc)
void setExternKeywordLoc(SourceLocation Loc)
Sets the location of the extern keyword.
void setSpecializationKind(TemplateSpecializationKind TSK)
void setTemplateKeywordLoc(SourceLocation Loc)
Sets the location of the template keyword.
void setInstantiationOf(ClassTemplatePartialSpecializationDecl *PartialSpec, const TemplateArgumentList *TemplateArgs)
Note that this class template specialization is actually an instantiation of the given class template...
bool isExplicitInstantiationOrSpecialization() const
True if this declaration is an explicit specialization, explicit instantiation declaration,...
void setTemplateArgsAsWritten(const ASTTemplateArgumentListInfo *ArgsWritten)
Set the template argument list as written in the sources.
Complex values, per C99 6.2.5p11.
CompoundAssignOperator - For compound assignments (e.g.
static CompoundAssignOperator * Create(const ASTContext &C, Expr *lhs, Expr *rhs, Opcode opc, QualType ResTy, ExprValueKind VK, ExprObjectKind OK, SourceLocation opLoc, FPOptionsOverride FPFeatures, QualType CompLHSType=QualType(), QualType CompResultType=QualType())
CompoundLiteralExpr - [C99 6.5.2.5].
CompoundStmt - This represents a group of statements like { stmt stmt }.
static CompoundStmt * Create(const ASTContext &C, ArrayRef< Stmt * > Stmts, FPOptionsOverride FPFeatures, SourceLocation LB, SourceLocation RB)
A reference to a concept and its template args, as it appears in the code.
const NestedNameSpecifierLoc & getNestedNameSpecifierLoc() const
NamedDecl * getFoundDecl() const
const DeclarationNameInfo & getConceptNameInfo() const
ConceptDecl * getNamedConcept() const
static ConceptReference * Create(const ASTContext &C, NestedNameSpecifierLoc NNS, SourceLocation TemplateKWLoc, DeclarationNameInfo ConceptNameInfo, NamedDecl *FoundDecl, ConceptDecl *NamedConcept, const ASTTemplateArgumentListInfo *ArgsAsWritten)
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
SourceLocation getTemplateKWLoc() const
ConditionalOperator - The ?: ternary operator.
Represents the canonical version of C arrays with a specified constant size.
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
static ConstantExpr * Create(const ASTContext &Context, Expr *E, const APValue &Result)
Represents a concrete matrix type with constant number of rows and columns.
Represents a shadow constructor declaration introduced into a class by a C++11 using-declaration that...
ContinueStmt - This represents a continue.
ConvertVectorExpr - Clang builtin function __builtin_convertvector This AST node provides support for...
Represents a sugar type with __counted_by or __sized_by annotations, including their _or_null variant...
Represents a pointer type decayed from an array or function type.
A POD class for pairing a NamedDecl* with an access specifier.
static DeclAccessPair make(NamedDecl *D, AccessSpecifier AS)
The results of name lookup within a DeclContext.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
DeclContext * getParent()
getParent - Returns the containing DeclContext.
void makeDeclVisibleInContext(NamedDecl *D)
Makes a declaration visible within this context.
bool isDependentContext() const
Determines whether this context is dependent on a template parameter.
lookup_result lookup(DeclarationName Name) const
lookup - Find the declarations (if any) with the given Name in this context.
DeclContext * getRedeclContext()
getRedeclContext - Retrieve the context in which an entity conflicts with other entities of the same ...
void addDeclInternal(Decl *D)
Add the declaration D into this context, but suppress searches for external declarations with the sam...
bool containsDeclAndLoad(Decl *D) const
Checks whether a declaration is in this context.
void removeDecl(Decl *D)
Removes a declaration from this context.
lookup_result noload_lookup(DeclarationName Name)
Find the declarations with the given name that are visible within this context; don't attempt to retr...
bool containsDecl(Decl *D) const
Checks whether a declaration is in this context.
decl_range decls() const
decls_begin/decls_end - Iterate over the declarations stored in this context.
bool isFunctionOrMethod() const
void localUncachedLookup(DeclarationName Name, SmallVectorImpl< NamedDecl * > &Results)
A simplistic name lookup mechanism that performs name lookup into this declaration context without co...
static DeclGroupRef Create(ASTContext &C, Decl **Decls, unsigned NumDecls)
A reference to a declared variable, function, enum, etc.
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)
DeclStmt - Adaptor class for mixing declarations with statements and expressions.
A simple visitor class that helps create declaration visitors.
Decl - This represents one declaration (or definition), e.g.
SourceLocation getEndLoc() const LLVM_READONLY
TemplateDecl * getDescribedTemplate() const
If this is a declaration that describes some template, this method returns that template declaration.
FriendObjectKind getFriendObjectKind() const
Determines whether this declaration is the object of a friend declaration and, if so,...
ASTContext & getASTContext() const LLVM_READONLY
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
bool isParameterPack() const
Whether this declaration is a parameter pack.
bool isInIdentifierNamespace(unsigned NS) const
@ FOK_None
Not a friend object.
void setObjectOfFriendDecl(bool PerformFriendInjection=false)
Changes the namespace of this declaration to reflect that it's the object of a friend declaration.
void setAccess(AccessSpecifier AS)
SourceLocation getLocation() const
const char * getDeclKindName() const
IdentifierNamespace
IdentifierNamespace - The different namespaces in which declarations may appear.
@ IDNS_NonMemberOperator
This declaration is a C++ operator declared in a non-class context.
@ IDNS_TagFriend
This declaration is a friend class.
@ IDNS_Ordinary
Ordinary names.
@ IDNS_ObjCProtocol
Objective C @protocol.
@ IDNS_Namespace
Namespaces, declared with 'namespace foo {}'.
@ IDNS_OrdinaryFriend
This declaration is a friend function.
@ IDNS_Tag
Tags, declared with 'struct foo;' and referenced with 'struct foo'.
void setImplicit(bool I=true)
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl.
void setIsUsed()
Set whether the declaration is used, in the sense of odr-use.
bool isUsed(bool CheckUsedAttr=true) const
Whether any (re-)declaration of the entity was used, meaning that a definition is required.
DeclContext * getDeclContext()
AccessSpecifier getAccess() const
bool isInAnonymousNamespace() const
SourceLocation getBeginLoc() const LLVM_READONLY
TranslationUnitDecl * getTranslationUnitDecl()
void setDeclContext(DeclContext *DC)
setDeclContext - Set both the semantic and lexical DeclContext to DC.
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC).
void setLexicalDeclContext(DeclContext *DC)
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
The name of a declaration.
IdentifierInfo * getAsIdentifierInfo() const
Retrieve the IdentifierInfo * stored in this declaration name, or null if this declaration name isn't...
TemplateDecl * getCXXDeductionGuideTemplate() const
If this name is the name of a C++ deduction guide, return the template associated with that name.
const IdentifierInfo * getCXXLiteralIdentifier() const
If this name is the name of a literal operator, retrieve the identifier associated with it.
static DeclarationName getUsingDirectiveName()
Returns the name for all C++ using-directives.
OverloadedOperatorKind getCXXOverloadedOperator() const
If this name is the name of an overloadable operator in C++ (e.g., operator+), retrieve the kind of o...
@ CXXConversionFunctionName
QualType getCXXNameType() const
If this name is one of the C++ names (of a constructor, destructor, or conversion function),...
Selector getObjCSelector() const
Get the Objective-C selector stored in this declaration name.
NameKind getNameKind() const
Determine what kind of name this is.
bool isEmpty() const
Evaluates true when this declaration name is empty.
void setTypeSourceInfo(TypeSourceInfo *TI)
void setQualifierInfo(NestedNameSpecifierLoc QualifierLoc)
Represents the type decltype(expr) (C++11).
A decomposition declaration.
Represents a C++17 deduced template specialization type.
Represents an extended address space qualifier where the input address space value is dependent.
Represents a qualified type name for which the type name is dependent.
A qualified reference to a name whose declaration cannot yet be resolved.
static DependentScopeDeclRefExpr * Create(const ASTContext &Context, NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs)
Represents an array type in C++ whose size is a value-dependent expression.
Represents an extended vector type where either the type or size is dependent.
Represents a matrix type where the type and the number of rows and columns is dependent on a template...
Represents a dependent template name that cannot be resolved prior to template instantiation.
OverloadedOperatorKind getOperator() const
Return the overloaded operator to which this template name refers.
bool isIdentifier() const
Determine whether this template name refers to an identifier.
NestedNameSpecifier * getQualifier() const
Return the nested name specifier that qualifies this name.
const IdentifierInfo * getIdentifier() const
Returns the identifier to which this template name refers.
Represents a template specialization type whose template cannot be resolved, e.g.
Represents a vector type where either the type or size is dependent.
Represents a single C99 designator.
static Designator CreateArrayRangeDesignator(unsigned Index, SourceLocation LBracketLoc, SourceLocation EllipsisLoc, SourceLocation RBracketLoc)
Creates a GNU array-range designator.
static Designator CreateFieldDesignator(const IdentifierInfo *FieldName, SourceLocation DotLoc, SourceLocation FieldLoc)
Creates a field designator.
static Designator CreateArrayDesignator(unsigned Index, SourceLocation LBracketLoc, SourceLocation RBracketLoc)
Creates an array designator.
Represents a C99 designated initializer expression.
static DesignatedInitExpr * Create(const ASTContext &C, llvm::ArrayRef< Designator > Designators, ArrayRef< Expr * > IndexExprs, SourceLocation EqualOrColonLoc, bool GNUSyntax, Expr *Init)
A little helper class used to produce diagnostics.
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.
void notePriorDiagnosticFrom(const DiagnosticsEngine &Other)
Note that the prior diagnostic was emitted by some other DiagnosticsEngine, and we may be attaching a...
DoStmt - This represents a 'do/while' stmt.
Symbolic representation of a dynamic allocation.
Represents a type that was referred to using an elaborated type keyword, e.g., struct S,...
Represents an empty-declaration.
An instance of this object exists for each enum constant that is defined.
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this enumeration is an instantiation of a member enumeration of a class template specialization,...
unsigned getNumNegativeBits() const
Returns the width in bits required to store all the negative enumerators of this enum.
void setIntegerType(QualType T)
Set the underlying integer type.
EnumDecl * getMostRecentDecl()
void completeDefinition(QualType NewType, QualType PromotionType, unsigned NumPositiveBits, unsigned NumNegativeBits)
When created, the EnumDecl corresponds to a forward-declared enum.
EnumDecl * getDefinition() const
unsigned getNumPositiveBits() const
Returns the width in bits required to store all the non-negative enumerators of this enum.
QualType getPromotionType() const
Return the integer type that enumerators should promote to.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums.
ExplicitCastExpr - An explicit cast written in the source code.
Store information needed for an explicit specifier.
ExplicitSpecKind getKind() const
const Expr * getExpr() const
Represents an expression â generally a full-expression â that introduces cleanups to be run at the en...
llvm::PointerUnion< BlockDecl *, CompoundLiteralExpr * > CleanupObject
The type of objects that are kept in the cleanup.
static ExprWithCleanups * Create(const ASTContext &C, EmptyShell empty, unsigned numObjects)
This represents one expression.
bool isValueDependent() const
Determines whether the value of this expression depends on.
ExprValueKind getValueKind() const
getValueKind - The value kind that this expression produces.
bool isTypeDependent() const
Determines whether the type of this expression depends on.
bool containsUnexpandedParameterPack() const
Whether this expression contains an unexpanded parameter pack (for C++11 variadic templates).
ExprObjectKind getObjectKind() const
getObjectKind - The object kind that this expression produces.
bool isInstantiationDependent() const
Whether this expression is instantiation-dependent, meaning that it depends in some way on.
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
ExprDependence getDependence() const
An expression trait intrinsic.
ExtVectorType - Extended vector type.
virtual void CompleteType(TagDecl *Tag)
Gives the external AST source an opportunity to complete an incomplete type.
Represents difference between two FPOptions values.
Represents a member of a struct/union/class.
Expr * getInClassInitializer() const
Get the C++11 default member initializer for this member, or null if one has not been set.
bool hasInClassInitializer() const
Determine whether this member has a C++11 default member initializer.
void setInClassInitializer(Expr *NewInit)
Set the C++11 in-class initializer for this member.
void setCapturedVLAType(const VariableArrayType *VLAType)
Set the captured variable length array type for this field.
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
Implements support for file system lookup, file system caching, and directory search management.
OptionalFileEntryRef getOptionalFileRef(StringRef Filename, bool OpenFile=false, bool CacheFailure=true)
Get a FileEntryRef if it exists, without doing anything on error.
static FloatingLiteral * Create(const ASTContext &C, const llvm::APFloat &V, bool isexact, QualType Type, SourceLocation L)
ForStmt - This represents a 'for (init;cond;inc)' stmt.
FriendDecl - Represents the declaration of a friend entity, which can be a function,...
llvm::PointerUnion< NamedDecl *, TypeSourceInfo * > FriendUnion
TypeSourceInfo * getFriendType() const
If this friend declaration names an (untemplated but possibly dependent) type, return the type; other...
static DefaultedOrDeletedFunctionInfo * Create(ASTContext &Context, ArrayRef< DeclAccessPair > Lookups, StringLiteral *DeletedMessage=nullptr)
Represents a function declaration or definition.
Stmt * getBody(const FunctionDecl *&Definition) const
Retrieve the body (definition) of the function.
void setDescribedFunctionTemplate(FunctionTemplateDecl *Template)
FunctionTemplateDecl * getDescribedFunctionTemplate() const
Retrieves the function template that is described by this function declaration.
void setIsPureVirtual(bool P=true)
void setDefaultedOrDeletedInfo(DefaultedOrDeletedFunctionInfo *Info)
void setFriendConstraintRefersToEnclosingTemplate(bool V=true)
ArrayRef< ParmVarDecl * > parameters() const
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this function is an instantiation of a member function of a class template specialization,...
FunctionTemplateSpecializationInfo * getTemplateSpecializationInfo() const
If this function is actually a function template specialization, retrieve information about this func...
void setDefaultLoc(SourceLocation NewLoc)
DependentFunctionTemplateSpecializationInfo * getDependentSpecializationInfo() const
@ TK_MemberSpecialization
@ TK_DependentNonTemplate
@ TK_FunctionTemplateSpecialization
@ TK_DependentFunctionTemplateSpecialization
TemplatedKind getTemplatedKind() const
What kind of templated function this is.
void setInstantiatedFromDecl(FunctionDecl *FD)
Specify that this function declaration was instantiated from a FunctionDecl FD.
void setDependentTemplateSpecialization(ASTContext &Context, const UnresolvedSetImpl &Templates, const TemplateArgumentListInfo *TemplateArgs)
Specifies that this function declaration is actually a dependent function template specialization.
void setVirtualAsWritten(bool V)
State that this function is marked as virtual explicitly.
void setRangeEnd(SourceLocation E)
FunctionDecl * getInstantiatedFromDecl() const
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template instantiation this function represents.
void setDefaulted(bool D=true)
void setDeletedAsWritten(bool D=true, StringLiteral *Message=nullptr)
void setExplicitlyDefaulted(bool ED=true)
State that this function is explicitly defaulted.
FunctionDecl * getInstantiatedFromMemberFunction() const
If this function is an instantiation of a member function of a class template specialization,...
bool hasBody(const FunctionDecl *&Definition) const
Returns true if the function has a body.
Represents a K&R-style 'int foo()' function, which has no information available about its arguments.
Represents a prototype with parameter type info, e.g.
ExtProtoInfo getExtProtoInfo() const
ArrayRef< QualType > exceptions() const
ArrayRef< QualType > param_types() const
Declaration of a template function.
FunctionDecl * findSpecialization(ArrayRef< TemplateArgument > Args, void *&InsertPos)
Return the specialization with the provided arguments if it exists, otherwise return the insertion po...
FunctionDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
FunctionTemplateDecl * getMostRecentDecl()
ExtInfo getExtInfo() const
QualType getReturnType() const
This represents a GCC inline-assembly statement extension.
GNUNullExpr - Implements the GNU __null extension, which is a name for a null pointer constant that h...
Represents a C11 generic selection.
static GenericSelectionExpr * Create(const ASTContext &Context, SourceLocation GenericLoc, Expr *ControllingExpr, ArrayRef< TypeSourceInfo * > AssocTypes, ArrayRef< Expr * > AssocExprs, SourceLocation DefaultLoc, SourceLocation RParenLoc, bool ContainsUnexpandedParameterPack, unsigned ResultIndex)
Create a non-result-dependent generic selection expression accepting an expression predicate.
GotoStmt - This represents a direct goto.
One of these records is kept for each identifier that is lexed.
unsigned getBuiltinID() const
Return a value indicating whether this is a builtin function.
void setBuiltinID(unsigned ID)
StringRef getName() const
Return the actual identifier string.
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
IfStmt - This represents an if/then/else.
static IfStmt * Create(const ASTContext &Ctx, SourceLocation IL, IfStatementKind Kind, Stmt *Init, VarDecl *Var, Expr *Cond, SourceLocation LPL, SourceLocation RPL, Stmt *Then, SourceLocation EL=SourceLocation(), Stmt *Else=nullptr)
Create an IfStmt.
ImaginaryLiteral - We support imaginary integer and floating point literals, like "1....
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
static ImplicitCastExpr * Create(const ASTContext &Context, QualType T, CastKind Kind, Expr *Operand, const CXXCastPath *BasePath, ExprValueKind Cat, FPOptionsOverride FPO)
Represents an implicitly-generated value initialization of an object of a given type.
Describes a module import declaration, which makes the contents of the named module visible in the cu...
Represents a C array with an unspecified size.
Represents a field injected from an anonymous union/struct into the parent scope.
IndirectGotoStmt - This represents an indirect goto.
Description of a constructor that was inherited from a base class.
CXXConstructorDecl * getConstructor() const
ConstructorUsingShadowDecl * getShadowDecl() const
Describes an C or C++ initializer list.
void setSyntacticForm(InitListExpr *Init)
void setArrayFiller(Expr *filler)
void setInitializedFieldInUnion(FieldDecl *FD)
void sawArrayRangeDesignator(bool ARD=true)
The injected class name of a C++ class template or class template partial specialization.
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'.
An lvalue reference type, per C++11 [dcl.ref].
Represents the declaration of a label.
void setStmt(LabelStmt *T)
LabelStmt - Represents a label, which has a substatement.
Describes the capture of a variable or of this, or of a C++1y init-capture.
bool capturesVariable() const
Determine whether this capture handles a variable.
bool isPackExpansion() const
Determine whether this capture is a pack expansion, which captures a function parameter pack.
SourceLocation getEllipsisLoc() const
Retrieve the location of the ellipsis for a capture that is a pack expansion.
LambdaCaptureKind getCaptureKind() const
Determine the kind of capture.
ValueDecl * getCapturedVar() const
Retrieve the declaration of the local variable being captured.
bool isImplicit() const
Determine whether this was an implicit capture (not written between the square brackets introducing t...
SourceLocation getLocation() const
Retrieve the source location of the capture.
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
static LambdaExpr * Create(const ASTContext &C, CXXRecordDecl *Class, SourceRange IntroducerRange, LambdaCaptureDefault CaptureDefault, SourceLocation CaptureDefaultLoc, bool ExplicitParams, bool ExplicitResultType, ArrayRef< Expr * > CaptureInits, SourceLocation ClosingBrace, bool ContainsUnexpandedParameterPack)
Construct a new lambda expression.
Implicit declaration of a temporary that was materialized by a MaterializeTemporaryExpr and lifetime-...
Represents a linkage specification.
void setRBraceLoc(SourceLocation L)
Represents the results of name lookup.
Sugar type that represents a type that was qualified by a qualifier written as a macro invocation.
Represents a prvalue temporary that is written into memory so that a reference can bind to it.
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
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)
A pointer to member type per C++ 8.3.3 - Pointers to members.
Provides information a specialization of a member of a class template, which may be a member function...
SourceLocation getPointOfInstantiation() const
Retrieve the first point of instantiation of this member.
void setPointOfInstantiation(SourceLocation POI)
Set the first point of instantiation.
This represents a decl that may have a name.
Linkage getLinkageInternal() const
Determine what kind of linkage this entity has.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
Represents a C++ namespace alias.
Represent a C++ namespace.
NamespaceDecl * getAnonymousNamespace() const
Retrieve the anonymous namespace that inhabits this namespace, if any.
void setRBraceLoc(SourceLocation L)
Class that aids in the construction of nested-name-specifiers along with source-location information ...
A C++ nested-name-specifier augmented with source location information.
SourceLocation getLocalEndLoc() const
Retrieve the location of the end of this component of the nested-name-specifier.
TypeLoc getTypeLoc() const
For a nested-name-specifier that refers to a type, retrieve the type with source-location information...
NestedNameSpecifierLoc getPrefix() const
Return the prefix of this nested-name-specifier.
NestedNameSpecifier * getNestedNameSpecifier() const
Retrieve the nested-name-specifier to which this instance refers.
SourceLocation getLocalBeginLoc() const
Retrieve the location of the beginning of this component of the nested-name-specifier.
SourceRange getSourceRange() const LLVM_READONLY
Retrieve the source range covering the entirety of this nested-name-specifier.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
CXXRecordDecl * getAsRecordDecl() const
Retrieve the record declaration stored in this nested name specifier.
SpecifierKind getKind() const
Determine what kind of nested name specifier is stored.
static NestedNameSpecifier * Create(const ASTContext &Context, NestedNameSpecifier *Prefix, const IdentifierInfo *II)
Builds a specifier combining a prefix and an identifier.
NamespaceAliasDecl * getAsNamespaceAlias() const
Retrieve the namespace alias stored in this nested name specifier.
IdentifierInfo * getAsIdentifier() const
Retrieve the identifier stored in this nested name specifier.
static NestedNameSpecifier * GlobalSpecifier(const ASTContext &Context)
Returns the nested name specifier representing the global scope.
NestedNameSpecifier * getPrefix() const
Return the prefix of this nested name specifier.
SpecifierKind
The kind of specifier that completes this nested name specifier.
@ NamespaceAlias
A namespace alias, stored as a NamespaceAliasDecl*.
@ TypeSpec
A type, stored as a Type*.
@ TypeSpecWithTemplate
A type that was preceded by the 'template' keyword, stored as a Type*.
@ Super
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in.
@ Identifier
An identifier, stored as an IdentifierInfo*.
@ Global
The global specifier '::'. There is no stored value.
@ Namespace
A namespace, stored as a NamespaceDecl*.
NamespaceDecl * getAsNamespace() const
Retrieve the namespace stored in this nested name specifier.
static NestedNameSpecifier * SuperSpecifier(const ASTContext &Context, CXXRecordDecl *RD)
Returns the nested name specifier representing the __super scope for the given CXXRecordDecl.
const Type * getAsType() const
Retrieve the type stored in this nested name specifier.
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
NullStmt - This is the null statement ";": C99 6.8.3p3.
Represents Objective-C's @catch statement.
Represents Objective-C's @finally statement.
Represents Objective-C's @synchronized statement.
Represents Objective-C's @throw statement.
Represents Objective-C's @try ... @catch ... @finally statement.
static ObjCAtTryStmt * Create(const ASTContext &Context, SourceLocation atTryLoc, Stmt *atTryStmt, Stmt **CatchStmts, unsigned NumCatchStmts, Stmt *atFinallyStmt)
Represents Objective-C's @autoreleasepool Statement.
An Objective-C "bridged" cast expression, which casts between Objective-C pointers and C pointers,...
ObjCCategoryDecl - Represents a category declaration.
void setTypeParamList(ObjCTypeParamList *TPL)
Set the type parameters of this category.
void setProtocolList(ObjCProtocolDecl *const *List, unsigned Num, const SourceLocation *Locs, ASTContext &C)
setProtocolList - Set the list of protocols that this interface implements.
void setImplementation(ObjCCategoryImplDecl *ImplD)
ObjCProtocolList::iterator protocol_iterator
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration.
Represents Objective-C's collection statement.
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
const ObjCInterfaceDecl * getSuperClass() const
Represents an ObjC class declaration.
void setProtocolList(ObjCProtocolDecl *const *List, unsigned Num, const SourceLocation *Locs, ASTContext &C)
setProtocolList - Set the list of protocols that this interface implements.
ObjCCategoryDecl * FindCategoryDeclaration(const IdentifierInfo *CategoryId) const
FindCategoryDeclaration - Finds category declaration in the list of categories for this class and ret...
protocol_loc_iterator protocol_loc_begin() const
void setImplementation(ObjCImplementationDecl *ImplD)
known_categories_range known_categories() const
void setSuperClass(TypeSourceInfo *superClass)
protocol_iterator protocol_end() const
SourceLocation getSuperClassLoc() const
Retrieve the starting location of the superclass.
void setTypeParamList(ObjCTypeParamList *TPL)
Set the type parameters of this class.
ObjCProtocolList::iterator protocol_iterator
ObjCImplementationDecl * getImplementation() const
protocol_iterator protocol_begin() const
void startDefinition()
Starts the definition of this Objective-C class, taking it from a forward declaration (@class) to a d...
ObjCInterfaceDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this Objective-C class.
ObjCInterfaceDecl * getSuperClass() const
ObjCInterfaceDecl * getDefinition()
Retrieve the definition of this class, or NULL if this class has been forward-declared (with @class) ...
TypeSourceInfo * getSuperClassTInfo() const
Interfaces are the core concept in Objective-C for object oriented design.
ObjCIvarDecl - Represents an ObjC instance variable.
ObjCMethodDecl - Represents an instance or class method declaration.
void setMethodParams(ASTContext &C, ArrayRef< ParmVarDecl * > Params, ArrayRef< SourceLocation > SelLocs={})
Sets the method's parameters and selector source locations.
void createImplicitParams(ASTContext &Context, const ObjCInterfaceDecl *ID)
createImplicitParams - Used to lazily create the self and cmd implicit parameters.
ParmVarDecl *const * param_iterator
ObjCInterfaceDecl * getClassInterface()
Represents a pointer to an Objective C object.
Represents a class type in Objective C.
Represents one property declaration in an Objective-C interface.
void setSetterName(Selector Sel, SourceLocation Loc=SourceLocation())
void setPropertyAttributes(ObjCPropertyAttribute::Kind PRVal)
void setPropertyAttributesAsWritten(ObjCPropertyAttribute::Kind PRVal)
void setPropertyIvarDecl(ObjCIvarDecl *Ivar)
void setSetterMethodDecl(ObjCMethodDecl *gDecl)
void setGetterName(Selector Sel, SourceLocation Loc=SourceLocation())
void setGetterMethodDecl(ObjCMethodDecl *gDecl)
ObjCPropertyImplDecl - Represents implementation declaration of a property in a class or category imp...
ObjCIvarDecl * getPropertyIvarDecl() const
SourceLocation getPropertyIvarDeclLoc() const
Kind getPropertyImplementation() const
Represents an Objective-C protocol declaration.
void setProtocolList(ObjCProtocolDecl *const *List, unsigned Num, const SourceLocation *Locs, ASTContext &C)
setProtocolList - Set the list of protocols that this interface implements.
ObjCProtocolDecl * getDefinition()
Retrieve the definition of this protocol, if any.
void startDefinition()
Starts the definition of this Objective-C protocol.
ObjCProtocolList::iterator protocol_iterator
protocol_iterator protocol_begin() const
protocol_iterator protocol_end() const
protocol_loc_iterator protocol_loc_begin() const
Represents the declaration of an Objective-C type parameter.
Stores a list of Objective-C type parameters for a parameterized class or a category/extension thereo...
SourceLocation getRAngleLoc() const
static ObjCTypeParamList * create(ASTContext &ctx, SourceLocation lAngleLoc, ArrayRef< ObjCTypeParamDecl * > typeParams, SourceLocation rAngleLoc)
Create a new Objective-C type parameter list.
SourceLocation getLAngleLoc() const
Represents a type parameter type in Objective C.
OffsetOfExpr - [C99 7.17] - This represents an expression of the form offsetof(record-type,...
static OffsetOfExpr * Create(const ASTContext &C, QualType type, SourceLocation OperatorLoc, TypeSourceInfo *tsi, ArrayRef< OffsetOfNode > comps, ArrayRef< Expr * > exprs, SourceLocation RParenLoc)
Helper class for OffsetOfExpr.
unsigned getArrayExprIndex() const
For an array element node, returns the index into the array of expressions.
FieldDecl * getField() const
For a field offsetof node, returns the field.
IdentifierInfo * getFieldName() const
For a field or identifier offsetof node, returns the name of the field.
@ Array
An index into an array.
@ Identifier
A field in a dependent type, known only by its name.
@ Base
An implicit indirection through a C++ base class, when the field found is in a base class.
SourceLocation getBeginLoc() const LLVM_READONLY
Kind getKind() const
Determine what kind of offsetof node this is.
SourceLocation getEndLoc() const LLVM_READONLY
CXXBaseSpecifier * getBase() const
For a base class node, returns the base specifier.
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class.
A structure for storing the information associated with an overloaded template name.
Represents a C++11 pack expansion that produces a sequence of expressions.
Represents a pack expansion of types.
ParenExpr - This represents a parenthesized expression, e.g.
static ParenListExpr * Create(const ASTContext &Ctx, SourceLocation LParenLoc, ArrayRef< Expr * > Exprs, SourceLocation RParenLoc)
Create a paren list.
Sugar for parentheses used when specifying types.
Represents a parameter to a function.
bool isKNRPromoted() const
True if the value passed to this parameter must undergo K&R-style default argument promotion:
void setObjCDeclQualifier(ObjCDeclQualifier QTVal)
void setDefaultArg(Expr *defarg)
SourceLocation getExplicitObjectParamThisLoc() const
void setUnparsedDefaultArg()
Specify that this parameter has an unparsed default argument.
bool hasUnparsedDefaultArg() const
Determines whether this parameter has a default argument that has not yet been parsed.
void setUninstantiatedDefaultArg(Expr *arg)
void setScopeInfo(unsigned scopeDepth, unsigned parameterIndex)
bool hasUninstantiatedDefaultArg() const
void setObjCMethodScopeInfo(unsigned parameterIndex)
bool hasInheritedDefaultArg() const
void setKNRPromoted(bool promoted)
void setExplicitObjectParameterLoc(SourceLocation Loc)
Expr * getUninstantiatedDefaultArg()
bool hasDefaultArg() const
Determines whether this parameter has a default argument, either parsed or not.
void setHasInheritedDefaultArg(bool I=true)
PointerType - C99 6.7.5.1 - Pointer Declarators.
[C99 6.4.2.2] - A predefined identifier such as func.
static PredefinedExpr * Create(const ASTContext &Ctx, SourceLocation L, QualType FNTy, PredefinedIdentKind IK, bool IsTransparent, StringLiteral *SL)
Create a PredefinedExpr.
Stores the type being destroyed by a pseudo-destructor expression.
A (possibly-)qualified type.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
QualType getCanonicalType() const
Qualifiers getLocalQualifiers() const
Retrieve the set of qualifiers local to this particular QualType instance, not including any qualifie...
Represents a template name as written in source code.
TemplateName getUnderlyingTemplate() const
Return the underlying template name.
NestedNameSpecifier * getQualifier() const
Return the nested name specifier that qualifies this name.
bool hasTemplateKeyword() const
Whether the template name was prefixed by the "template" keyword.
An rvalue reference type, per C++11 [dcl.ref].
Represents a struct/union/class.
bool isLambda() const
Determine whether this record is a class describing a lambda function object.
void setAnonymousStructOrUnion(bool Anon)
RecordDecl * getMostRecentDecl()
virtual void completeDefinition()
Note that the definition of this type is now complete.
RecordDecl * getDefinition() const
Returns the RecordDecl that actually defines this struct/union/class.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
RecordDecl * getDecl() const
Provides common interface for the Decls that can be redeclared.
decl_type * getPreviousDecl()
Return the previous declaration of this declaration or NULL if this is the first declaration.
decl_type * getMostRecentDecl()
Returns the most recent (re)declaration of this declaration.
void setPreviousDecl(decl_type *PrevDecl)
Set the previous declaration.
Base for LValueReferenceType and RValueReferenceType.
ReturnStmt - This represents a return, optionally of an expression: return; return 4;.
static ReturnStmt * Create(const ASTContext &Ctx, SourceLocation RL, Expr *E, const VarDecl *NRVOCandidate)
Create a return statement.
Selector getSelector(unsigned NumArgs, const IdentifierInfo **IIV)
Can create any sort of selector.
Smart pointer class that efficiently represents Objective-C method names.
const IdentifierInfo * getIdentifierInfoForSlot(unsigned argIndex) const
Retrieve the identifier at a given position in the selector.
bool isNull() const
Determine whether this is the empty selector.
unsigned getNumArgs() const
static std::enable_if_t< std::is_base_of_v< Attr, AttrInfo >, SourceLocation > getAttrLoc(const AttrInfo &AL)
A helper function to provide Attribute Location for the Attr types AND the ParsedAttr.
ShuffleVectorExpr - clang-specific builtin-in function __builtin_shufflevector.
Represents an expression that computes the length of a parameter pack.
static SizeOfPackExpr * Create(ASTContext &Context, SourceLocation OperatorLoc, NamedDecl *Pack, SourceLocation PackLoc, SourceLocation RParenLoc, std::optional< unsigned > Length=std::nullopt, ArrayRef< TemplateArgument > PartialArgs={})
Represents a function call to one of __builtin_LINE(), __builtin_COLUMN(), __builtin_FUNCTION(),...
Encodes a location in the source.
This class handles loading and caching of source files into memory.
FileID getFileID(SourceLocation SpellingLoc) const
Return the FileID for a SourceLocation.
bool isWrittenInBuiltinFile(SourceLocation Loc) const
Returns whether Loc is located in a <built-in> file.
FileID createFileID(FileEntryRef SourceFile, SourceLocation IncludePos, SrcMgr::CharacteristicKind FileCharacter, int LoadedID=0, SourceLocation::UIntTy LoadedOffset=0)
Create a new FileID that represents the specified file being #included from the specified IncludePosi...
SourceLocation getComposedLoc(FileID FID, unsigned Offset) const
Form a SourceLocation from a FileID and Offset pair.
FileManager & getFileManager() const
FileID getMainFileID() const
Returns the FileID of the main source file.
unsigned getFileIDSize(FileID FID) const
The size of the SLocEntry that FID represents.
std::pair< FileID, unsigned > getDecomposedLoc(SourceLocation Loc) const
Decompose the specified location into a raw FileID + Offset pair.
SourceLocation getLocForStartOfFile(FileID FID) const
Return the source location corresponding to the first byte of the specified file.
SourceLocation createExpansionLoc(SourceLocation SpellingLoc, SourceLocation ExpansionLocStart, SourceLocation ExpansionLocEnd, unsigned Length, bool ExpansionIsTokenRange=true, int LoadedID=0, SourceLocation::UIntTy LoadedOffset=0)
Creates an expansion SLocEntry for a macro use.
const SrcMgr::SLocEntry & getSLocEntry(FileID FID, bool *Invalid=nullptr) const
SourceLocation createMacroArgExpansionLoc(SourceLocation SpellingLoc, SourceLocation ExpansionLoc, unsigned Length)
Creates an expansion SLocEntry for the substitution of an argument into a function-like macro's body.
A trivial tuple used to represent a source range.
SourceLocation getEnd() const
SourceLocation getBegin() const
One instance of this struct is kept for every file loaded or used.
Each ExpansionInfo encodes the expansion location - where the token was ultimately expanded,...
SourceLocation getExpansionLocStart() const
bool isExpansionTokenRange() const
SourceLocation getSpellingLoc() const
bool isMacroArgExpansion() const
SourceLocation getExpansionLocEnd() const
const ContentCache & getContentCache() const
CharacteristicKind getFileCharacteristic() const
Return whether this is a system header or not.
SourceLocation getIncludeLoc() const
This is a discriminated union of FileInfo and ExpansionInfo.
const FileInfo & getFile() const
const ExpansionInfo & getExpansion() const
Represents a C++11 static_assert declaration.
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
StmtVisitor - This class implements a simple visitor for Stmt subclasses.
Stmt - This represents one statement.
SourceLocation getEndLoc() const LLVM_READONLY
child_iterator child_begin()
StmtClass getStmtClass() const
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
child_iterator child_end()
const char * getStmtClassName() const
SourceLocation getBeginLoc() const LLVM_READONLY
StringLiteral - This represents a string literal expression, e.g.
static StringLiteral * Create(const ASTContext &Ctx, StringRef Str, StringLiteralKind 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...
Represents a reference to a non-type template parameter that has been substituted with a template arg...
A structure for storing an already-substituted template template parameter pack.
Decl * getAssociatedDecl() const
A template-like entity which owns the whole pattern being substituted.
TemplateArgument getArgumentPack() const
Retrieve the template template argument pack with which this parameter was substituted.
unsigned getIndex() const
Returns the index of the replaced parameter in the associated declaration.
A structure for storing the information associated with a substituted template template parameter.
TemplateName getReplacement() const
std::optional< unsigned > getPackIndex() const
unsigned getIndex() const
Returns the index of the replaced parameter in the associated declaration.
Decl * getAssociatedDecl() const
A template-like entity which owns the whole pattern being substituted.
Represents the result of substituting a set of types for a template type parameter pack.
Represents the result of substituting a type for a template type parameter.
void setNextSwitchCase(SwitchCase *SC)
SwitchStmt - This represents a 'switch' stmt.
static SwitchStmt * Create(const ASTContext &Ctx, Stmt *Init, VarDecl *Var, Expr *Cond, SourceLocation LParenLoc, SourceLocation RParenLoc)
Create a switch statement.
Represents the declaration of a struct/union/class/enum.
bool isBeingDefined() const
Return true if this decl is currently being defined.
bool isCompleteDefinition() const
Return true if this decl has its body fully specified.
TypedefNameDecl * getTypedefNameForAnonDecl() const
void startDefinition()
Starts the definition of this tag declaration.
void setTypedefNameForAnonDecl(TypedefNameDecl *TDD)
void setQualifierInfo(NestedNameSpecifierLoc QualifierLoc)
void setBraceRange(SourceRange R)
void setCompleteDefinition(bool V=true)
True if this decl has its body fully specified.
A convenient class for passing around template argument information.
SourceLocation getRAngleLoc() const
void addArgument(const TemplateArgumentLoc &Loc)
llvm::ArrayRef< TemplateArgumentLoc > arguments() const
SourceLocation getLAngleLoc() const
A template argument list.
static TemplateArgumentList * CreateCopy(ASTContext &Context, ArrayRef< TemplateArgument > Args)
Create a new template argument list that copies the given set of template arguments.
unsigned size() const
Retrieve the number of template arguments in this template argument list.
Location wrapper for a TemplateArgument.
TemplateArgumentLocInfo getLocInfo() const
const TemplateArgument & getArgument() const
Represents a template argument.
ArrayRef< TemplateArgument > getPackAsArray() const
Return the array of arguments in this template argument pack.
QualType getStructuralValueType() const
Get the type of a StructuralValue.
QualType getParamTypeForDecl() const
Expr * getAsExpr() const
Retrieve the template argument as an expression.
std::optional< unsigned > getNumTemplateExpansions() const
Retrieve the number of expansions that a template template argument expansion will produce,...
QualType getAsType() const
Retrieve the type for a type template argument.
QualType getNullPtrType() const
Retrieve the type for null non-type template argument.
TemplateName getAsTemplate() const
Retrieve the template name for a template name argument.
unsigned pack_size() const
The number of template arguments in the given template argument pack.
QualType getIntegralType() const
Retrieve the type of the integral value.
bool getIsDefaulted() const
If returns 'true', this TemplateArgument corresponds to a default template parameter.
ValueDecl * getAsDecl() const
Retrieve the declaration for a declaration non-type template argument.
ArrayRef< TemplateArgument > pack_elements() const
Iterator range referencing all of the elements of a template argument pack.
@ Declaration
The template argument is a declaration that was provided for a pointer, reference,...
@ Template
The template argument is a template name that was provided for a template template parameter.
@ StructuralValue
The template argument is a non-type template argument that can't be represented by the special-case D...
@ Pack
The template argument is actually a parameter pack.
@ TemplateExpansion
The template argument is a pack expansion of a template name that was provided for a template templat...
@ NullPtr
The template argument is a null pointer or null pointer to member that was provided for a non-type te...
@ Type
The template argument is a type.
@ Null
Represents an empty template argument, e.g., one that has not been deduced.
@ Integral
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
@ Expression
The template argument is an expression, and we've not resolved it to one of the other forms yet,...
ArgKind getKind() const
Return the kind of stored template argument.
TemplateName getAsTemplateOrTemplatePattern() const
Retrieve the template argument as a template name; if the argument is a pack expansion,...
const APValue & getAsStructuralValue() const
Get the value of a StructuralValue.
Represents a C++ template name within the type system.
TemplateDecl * getAsTemplateDecl(bool IgnoreDeduced=false) const
Retrieve the underlying template declaration that this template name refers to, if known.
DependentTemplateName * getAsDependentTemplateName() const
Retrieve the underlying dependent template name structure, if any.
QualifiedTemplateName * getAsQualifiedTemplateName() const
Retrieve the underlying qualified template name structure, if any.
OverloadedTemplateStorage * getAsOverloadedTemplate() const
Retrieve the underlying, overloaded function template declarations that this template name refers to,...
AssumedTemplateStorage * getAsAssumedTemplateName() const
Retrieve information on a name that has been assumed to be a template-name in order to permit a call ...
@ UsingTemplate
A template name that refers to a template declaration found through a specific using shadow declarati...
@ OverloadedTemplate
A set of overloaded template declarations.
@ Template
A single template declaration.
@ DependentTemplate
A dependent template name that has not been resolved to a template (or set of templates).
@ SubstTemplateTemplateParm
A template template parameter that has been substituted for some other template name.
@ SubstTemplateTemplateParmPack
A template template parameter pack that has been substituted for a template template argument pack,...
@ DeducedTemplate
A template name that refers to another TemplateName with deduced default arguments.
@ QualifiedTemplate
A qualified template name, where the qualification is kept to describe the source code as written.
@ AssumedTemplate
An unqualified-id that has been assumed to name a function template that will be found by ADL.
UsingShadowDecl * getAsUsingShadowDecl() const
Retrieve the using shadow declaration through which the underlying template declaration is introduced...
SubstTemplateTemplateParmPackStorage * getAsSubstTemplateTemplateParmPack() const
Retrieve the substituted template template parameter pack, if known.
SubstTemplateTemplateParmStorage * getAsSubstTemplateTemplateParm() const
Retrieve the substituted template template parameter, if known.
Stores a list of template parameters for a TemplateDecl and its derived classes.
NamedDecl * getParam(unsigned Idx)
static TemplateParameterList * Create(const ASTContext &C, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ArrayRef< NamedDecl * > Params, SourceLocation RAngleLoc, Expr *RequiresClause)
Expr * getRequiresClause()
The constraint-expression of the associated requires-clause.
SourceLocation getRAngleLoc() const
SourceLocation getLAngleLoc() const
SourceLocation getTemplateLoc() const
Represents a type template specialization; the template must be a class template, a type alias templa...
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
Declaration of a template type parameter.
void setTypeConstraint(ConceptReference *CR, Expr *ImmediatelyDeclaredConstraint)
The top declaration context.
Represents the declaration of a typedef-name via a C++11 alias-declaration.
TypeAliasTemplateDecl * getDescribedAliasTemplate() const
Declaration of an alias template.
Models the abbreviated syntax to constrain a template type parameter: template <convertible_to<string...
[BoundsSafety] Represents information of declarations referenced by the arguments of the counted_by a...
void setTypeForDecl(const Type *TD)
const Type * getTypeForDecl() const
Symbolic representation of typeid(T) for some type T.
const Type * getType() const
SourceLocation getBeginLoc() const
Get the begin source location.
Represents a typeof (or typeof) expression (a C23 feature and GCC extension) or a typeof_unqual expre...
Represents typeof(type), a C23 feature and GCC extension, or `typeof_unqual(type),...
A container of type source information.
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
QualType getType() const
Return the type wrapped by this type source info.
A type trait used in the implementation of various C++11 and Library TR1 trait templates.
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.
ExpectedType Visit(const Type *T)
Performs the operation associated with this visitor object.
The base class of the type hierarchy.
const Type * getPointeeOrArrayElementType() const
If this is a pointer type, return the pointee type.
bool isPointerType() const
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
QualType getCanonicalTypeInternal() const
const char * getTypeClassName() const
const Type * getBaseElementTypeUnsafe() const
Get the base element type of this type, potentially discarding type qualifiers.
bool isIncompleteType(NamedDecl **Def=nullptr) const
Types are partitioned into 3 broad categories (C99 6.2.5p1): object types, function types,...
bool isCanonicalUnqualified() const
Determines if this type would be canonical if it had no further qualification.
const T * getAs() const
Member-template getAs<specific type>'.
bool isRecordType() const
RecordDecl * getAsRecordDecl() const
Retrieves the RecordDecl this type refers to.
Represents the declaration of a typedef-name via the 'typedef' type specifier.
Base class for declarations which introduce a typedef-name.
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand.
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
static UnaryOperator * CreateEmpty(const ASTContext &C, bool hasFPFeatures)
A unary type transform, which is a type constructed from another.
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
static UnresolvedLookupExpr * Create(const ASTContext &Context, CXXRecordDecl *NamingClass, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, bool RequiresADL, UnresolvedSetIterator Begin, UnresolvedSetIterator End, bool KnownDependent, bool KnownInstantiationDependent)
Represents a C++ member access expression for which lookup produced a set of overloaded functions.
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 addDecl(NamedDecl *D)
A set of unresolved declarations.
Represents the dependent type named by a dependently-scoped typename using declaration,...
Represents a dependent using declaration which was marked with typename.
Represents a dependent using declaration which was not marked with typename.
Represents a C++ using-declaration.
Represents C++ using-directive.
Represents a C++ using-enum-declaration.
Represents a pack of using declarations that a single using-declarator pack-expanded into.
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
Represents a call to the builtin function __builtin_va_arg.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
void setType(QualType newType)
Represents a variable declaration or definition.
void setInstantiationOfStaticDataMember(VarDecl *VD, TemplateSpecializationKind TSK)
Specify that this variable is an instantiation of the static data member VD.
VarDecl * getDefinition(ASTContext &)
Get the real (not just tentative) definition for this declaration.
EvaluatedStmt * getEvaluatedStmt() const
EvaluatedStmt * ensureEvaluatedStmt() const
Convert the initializer for this declaration to the elaborated EvaluatedStmt form,...
void setInlineSpecified()
void setTSCSpec(ThreadStorageClassSpecifier TSC)
const Expr * getInit() const
void setConstexpr(bool IC)
void setDescribedVarTemplate(VarTemplateDecl *Template)
void setImplicitlyInline()
const Expr * getAnyInitializer() const
Get the initializer for this variable, no matter which declaration it is attached to.
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this variable is an instantiation of a static data member of a class template specialization,...
Declaration of a variable template.
VarDecl * getTemplatedDecl() const
Get the underlying variable declarations of the template.
void AddSpecialization(VarTemplateSpecializationDecl *D, void *InsertPos)
Insert the specified specialization knowing that it is not already in.
VarTemplateSpecializationDecl * findSpecialization(ArrayRef< TemplateArgument > Args, void *&InsertPos)
Return the specialization with the provided arguments if it exists, otherwise return the insertion po...
VarTemplateDecl * getMostRecentDecl()
void setInstantiatedFromMember(VarTemplatePartialSpecializationDecl *PartialSpec)
Represents a variable template specialization, which refers to a variable template with a given set o...
void setTemplateArgsAsWritten(const ASTTemplateArgumentListInfo *ArgsWritten)
Set the template argument list as written in the sources.
void setSpecializationKind(TemplateSpecializationKind TSK)
void setPointOfInstantiation(SourceLocation Loc)
VarTemplateSpecializationDecl * getMostRecentDecl()
Represents a C array with a specified size that is not an integer-constant-expression.
Represents a GCC generic vector type.
WhileStmt - This represents a 'while' stmt.
static WhileStmt * Create(const ASTContext &Ctx, VarDecl *Var, Expr *Cond, Stmt *Body, SourceLocation WL, SourceLocation LParenLoc, SourceLocation RParenLoc)
Create a while statement.
The JSON file list parser is used to communicate input to InstallAPI.
bool isa(CodeGen::Address addr)
StructuralEquivalenceKind
Whether to perform a normal or minimal equivalence check.
CanThrowResult
Possible results from evaluation of a noexcept expression.
ExprObjectKind
A further classification of the kind of object referenced by an l-value or x-value.
@ Property
The type of a property.
@ Result
The result type of a method or function.
@ BTK__type_pack_element
This names the __type_pack_element BuiltinTemplateDecl.
@ BTK__builtin_common_type
This names the __builtin_common_type BuiltinTemplateDecl.
@ BTK__make_integer_seq
This names the __make_integer_seq BuiltinTemplateDecl.
CastKind
CastKind - The kind of operation required for a conversion.
ExprValueKind
The categorization of expression values, currently following the C++11 scheme.
const FunctionProtoType * T
llvm::SmallVector< Decl *, 2 > getCanonicalForwardRedeclChain(Decl *D)
bool declaresSameEntity(const Decl *D1, const Decl *D2)
Determine whether two declarations declare the same entity.
TemplateSpecializationKind
Describes the kind of template specialization that a particular template specialization declaration r...
bool isLambdaMethod(const DeclContext *DC)
static void updateFlags(const Decl *From, Decl *To)
Used as return type of getFriendCountAndPosition.
unsigned int IndexOfDecl
Index of the specific FriendDecl.
unsigned int TotalCount
Number of similar looking friends.
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>".
static const ASTTemplateArgumentListInfo * Create(const ASTContext &C, const TemplateArgumentListInfo &List)
Information about how a lambda is numbered within its context.
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...
SourceLocation getLoc() const
getLoc - Returns the main location of the declaration name.
DeclarationName getName() const
getName - Returns the embedded declaration name.
void setCXXLiteralOperatorNameLoc(SourceLocation Loc)
setCXXLiteralOperatorNameLoc - Sets the location of the literal operator name (not the operator keywo...
void setNamedTypeInfo(TypeSourceInfo *TInfo)
setNamedTypeInfo - Sets the source type info associated to the name.
void setCXXOperatorNameRange(SourceRange R)
setCXXOperatorNameRange - Sets the range of the operator name (without the operator keyword).
SourceRange getCXXOperatorNameRange() const
getCXXOperatorNameRange - Gets the range of the operator name (without the operator keyword).
TypeSourceInfo * getNamedTypeInfo() const
getNamedTypeInfo - Returns the source type info associated to the name.
SourceLocation getCXXLiteralOperatorNameLoc() const
getCXXLiteralOperatorNameLoc - Returns the location of the literal operator name (not the operator ke...
Structure used to store a statement, the constant value to which it was evaluated (if any),...
bool HasConstantDestruction
Whether this variable is known to have constant destruction.
bool HasConstantInitialization
Whether this variable is known to have constant initialization.
FunctionDecl * SourceDecl
The function whose exception specification this is, for EST_Unevaluated and EST_Uninstantiated.
FunctionDecl * SourceTemplate
The function template whose exception specification this is instantiated from, for EST_Uninstantiated...
ExceptionSpecificationType Type
The kind of exception specification this is.
ArrayRef< QualType > Exceptions
Explicitly-specified list of exception types.
Expr * NoexceptExpr
Noexcept expression, if this is a computed noexcept specification.
Extra information about a function prototype.
ExceptionSpecInfo ExceptionSpec
RefQualifierKind RefQualifier
unsigned HasTrailingReturn
FunctionType::ExtInfo ExtInfo
Location information for a TemplateArgument.
SourceLocation getTemplateEllipsisLoc() const
NestedNameSpecifierLoc getTemplateQualifierLoc() const
TypeSourceInfo * getAsTypeSourceInfo() const
SourceLocation getTemplateNameLoc() const
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4