Lines Matching defs:ToD

240     // must immediately register that as an imported Decl.  The parameter `ToD`
245 [[nodiscard]] bool GetImportedOrCreateDecl(ToDeclT *&ToD, FromDeclT *FromD,
251 return GetImportedOrCreateSpecialDecl(ToD, OC, FromD,
261 [[nodiscard]] bool GetImportedOrCreateDecl(ToDeclT *&ToD, FromDeclT *FromD,
264 return GetImportedOrCreateSpecialDecl(ToD, OC, FromD,
272 GetImportedOrCreateSpecialDecl(ToDeclT *&ToD, CreateFunT CreateFun,
275 ToD = nullptr;
278 ToD = cast_or_null<ToDeclT>(Importer.GetAlreadyImportedOrNull(FromD));
279 if (ToD)
281 ToD = CreateFun(std::forward<Args>(args)...);
283 Importer.RegisterImportedDecl(FromD, ToD);
284 Importer.SharedState->markAsNewDecl(ToD);
285 InitializeImportedDecl(FromD, ToD);
289 void InitializeImportedDecl(Decl *FromD, Decl *ToD) {
290 ToD->IdentifierNamespace = FromD->IdentifierNamespace;
292 ToD->setIsUsed();
294 ToD->setImplicit();
307 void addDeclToContexts(Decl *FromD, Decl *ToD) {
314 ToD->getLexicalDeclContext()->addDeclInternal(ToD);
320 DeclContext *ToDC = ToD->getDeclContext();
321 DeclContext *ToLexicalDC = ToD->getLexicalDeclContext();
325 ToDC->addDeclInternal(ToD);
329 ToLexicalDC->addDeclInternal(ToD);
337 auto *ToNamed = cast<NamedDecl>(ToD);
363 TemplateParmDeclT *ToD) {
383 ToD->setInheritedDefaultArgument(ToD->getASTContext(),
392 if (!ToD->hasDefaultArgument())
393 ToD->setDefaultArgument(Importer.getToContext(),
414 Error ImportDeclParts(NamedDecl *D, DeclarationName &Name, NamedDecl *&ToD,
418 DeclarationName &Name, NamedDecl *&ToD, SourceLocation &Loc);
419 Error ImportDefinitionIfNeeded(Decl *FromD, Decl *ToD = nullptr);
486 Error ImportTemplateParameterLists(const DeclTy *FromD, DeclTy *ToD);
1411 auto ToD = importChecked(Err, T->getDecl());
1417 ToD, cast_or_null<TypeDecl>(ToPrevD));
1933 DeclarationName &Name, NamedDecl *&ToD, SourceLocation &Loc) {
1974 ToD = cast_or_null<NamedDecl>(Importer.GetAlreadyImportedOrNull(D));
1975 if (ToD)
1976 if (Error Err = ASTNodeImporter(*this).ImportDefinitionIfNeeded(D, ToD))
1983 NamedDecl *&ToD, SourceLocation &Loc) {
1993 ToD = cast_or_null<NamedDecl>(Importer.GetAlreadyImportedOrNull(D));
1994 if (ToD)
1995 if (Error Err = ASTNodeImporter(*this).ImportDefinitionIfNeeded(D, ToD))
2001 Error ASTNodeImporter::ImportDefinitionIfNeeded(Decl *FromD, Decl *ToD) {
2005 if (!ToD)
2006 if (Error Err = importInto(ToD, FromD))
2010 if (RecordDecl *ToRecord = cast<RecordDecl>(ToD)) {
2021 if (EnumDecl *ToEnum = cast<EnumDecl>(ToD)) {
2161 if (Decl *ToD = Importer.GetAlreadyImportedOrNull(D)) {
2163 assert(ToDC == ToD->getLexicalDeclContext() && ToDC->containsDecl(ToD));
2165 ToDC->removeDecl(ToD);
2169 ToDC->addDeclInternal(ToD);
2526 EmptyDecl *ToD;
2527 if (GetImportedOrCreateDecl(ToD, D, Importer.getToContext(), DC, *LocOrErr))
2528 return ToD;
2530 ToD->setLexicalDeclContext(LexicalDC);
2531 LexicalDC->addDeclInternal(ToD);
2532 return ToD;
2536 TranslationUnitDecl *ToD =
2539 Importer.MapImported(D, ToD);
2541 return ToD;
2554 BindingDecl *ToD;
2555 if (GetImportedOrCreateDecl(ToD, D, Importer.getToContext(), DC, Loc,
2557 return ToD;
2566 ToD->setBinding(ToType, ToBinding);
2567 ToD->setDecomposedDecl(ToDecomposedDecl);
2568 addDeclToContexts(D, ToD);
2570 return ToD;
2587 AccessSpecDecl *ToD;
2588 if (GetImportedOrCreateDecl(ToD, D, Importer.getToContext(), D->getAccess(),
2590 return ToD;
2594 ToD->setLexicalDeclContext(DC);
2595 DC->addDeclInternal(ToD);
2597 return ToD;
2615 StaticAssertDecl *ToD;
2617 ToD, D, Importer.getToContext(), DC, ToLocation, ToAssertExpr, ToMessage,
2619 return ToD;
2621 ToD->setLexicalDeclContext(LexicalDC);
2622 LexicalDC->addDeclInternal(ToD);
2623 return ToD;
2631 NamedDecl *ToD;
2632 if (Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
2634 if (ToD)
2635 return ToD;
2733 NamespaceAliasDecl *ToD;
2735 ToD, D, Importer.getToContext(), DC, ToNamespaceLoc, ToAliasLoc,
2737 return ToD;
2739 ToD->setLexicalDeclContext(LexicalDC);
2740 LexicalDC->addDeclInternal(ToD);
2742 return ToD;
2750 NamedDecl *ToD;
2753 if (Error Err = ImportDeclParts(D, Name, ToD, Loc))
2755 if (ToD)
2756 return ToD;
2934 NamedDecl *ToD;
2935 if (Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
2937 if (ToD)
2938 return ToD;
2973 NamedDecl *ToD;
2974 if (Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
2976 if (ToD)
2977 return ToD;
3092 NamedDecl *ToD = nullptr;
3093 if (Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
3095 if (ToD)
3096 return ToD;
3339 NamedDecl *ToD;
3340 if (Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
3342 if (ToD)
3343 return ToD;
3394 DeclTy *ToD) {
3405 ToD->setTemplateParameterListsInfo(Importer.ToContext, ToTPLists);
3771 NamedDecl *ToD;
3772 if (Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
3774 if (ToD)
3775 return ToD;
4169 NamedDecl *ToD;
4170 if (Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
4172 if (ToD)
4173 return ToD;
4267 NamedDecl *ToD;
4268 if (Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
4270 if (ToD)
4271 return ToD;
4314 if (Expected<NamedDecl *> ToD = import(PI))
4315 NamedChain[i++] = *ToD;
4317 return ToD.takeError();
4457 NamedDecl *ToD;
4458 if (Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
4460 if (ToD)
4461 return ToD;
4520 NamedDecl *ToD;
4521 if (Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
4523 if (ToD)
4524 return ToD;
4785 NamedDecl *ToD;
4786 if (Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
4788 if (ToD)
4789 return ToD;
4917 NamedDecl *ToD;
4918 if (Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
4920 if (ToD)
4921 return ToD;
4953 NamedDecl *ToD;
4954 if (Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
4956 if (ToD)
4957 return ToD;
5100 NamedDecl *ToD;
5101 if (Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
5103 if (ToD)
5104 return ToD;
5191 NamedDecl *ToD = nullptr;
5192 if (Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
5194 if (ToD)
5195 return ToD;
5233 NamedDecl *ToD = nullptr;
5234 if (Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
5236 if (ToD)
5237 return ToD;
5271 NamedDecl *ToD = nullptr;
5272 if (Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
5274 if (ToD)
5275 return ToD;
5333 NamedDecl *ToD = nullptr;
5334 if (Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
5336 if (ToD)
5337 return ToD;
5372 NamedDecl *ToD = nullptr;
5373 if (Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
5375 if (ToD)
5376 return ToD;
5402 NamedDecl *ToD = nullptr;
5403 if (Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
5405 if (ToD)
5406 return ToD;
5438 NamedDecl *ToD = nullptr;
5439 if (Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
5441 if (ToD)
5442 return ToD;
5466 Decl* ToD = nullptr;
5469 ToD = Importer.getToContext().getMakeIntegerSeqDecl();
5472 ToD = Importer.getToContext().getTypePackElementDecl();
5475 ToD = Importer.getToContext().getBuiltinCommonTypeDecl();
5478 assert(ToD && "BuiltinTemplateDecl of unsupported kind!");
5479 Importer.MapImported(D, ToD);
5480 return ToD;
5626 NamedDecl *ToD;
5627 if (Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
5629 if (ToD)
5630 return ToD;
5800 NamedDecl *ToD;
5801 if (Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
5803 if (ToD)
5804 return ToD;
5967 TemplateTypeParmDecl *ToD = nullptr;
5969 ToD, D, Importer.getToContext(),
5975 return ToD;
5986 ToD->setTypeConstraint(ToConceptRef, ToIDC);
5989 if (Error Err = importTemplateParameterDefaultArgument(D, ToD))
5992 return ToD;
6007 NonTypeTemplateParmDecl *ToD = nullptr;
6008 if (GetImportedOrCreateDecl(ToD, D, Importer.getToContext(),
6014 return ToD;
6016 Err = importTemplateParameterDefaultArgument(D, ToD);
6020 return ToD;
6040 TemplateTemplateParmDecl *ToD = nullptr;
6042 ToD, D, Importer.getToContext(),
6047 return ToD;
6049 if (Error Err = importTemplateParameterDefaultArgument(D, ToD))
6052 return ToD;
6072 NamedDecl *ToD;
6073 if (Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
6075 if (ToD)
6076 return ToD;
6418 NamedDecl *ToD;
6419 if (Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
6421 if (ToD)
6422 return ToD;
6692 NamedDecl *ToD;
6694 if (Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
6697 if (ToD)
6698 return ToD;
9119 void ASTImporter::AddToLookupTable(Decl *ToD) {
9120 SharedState->addDeclToLookup(ToD);
9129 void ASTImporter::RegisterImportedDecl(Decl *FromD, Decl *ToD) {
9130 MapImported(FromD, ToD);
9481 TranslationUnitDecl *ASTImporter::GetFromTU(Decl *ToD) {
9482 auto FromDPos = ImportedFromDecls.find(ToD);
9503 Decl *ToD = GetAlreadyImportedOrNull(FromD);
9504 if (ToD) {
9506 if (auto Error = SharedState->getImportDeclErrorIfAny(ToD)) {
9512 updateFlags(FromD, ToD);
9517 return ToD;
9529 auto *ToD = Pos->second;
9542 auto PosF = ImportedFromDecls.find(ToD);
9547 if (ToD->getDeclContext())
9548 SharedState->removeDeclFromLookup(ToD);
9600 ToD = *ToDOrErr;
9606 if (!ToD) {
9613 // already had imported a Decl as `ToD` from another TU (with another
9615 if (auto Error = SharedState->getImportDeclErrorIfAny(ToD)) {
9626 ToD->addAttr(*ToAttrOrErr);
9632 Imported(FromD, ToD);
9634 updateFlags(FromD, ToD);