Lines Matching defs:ToD
241 // must immediately register that as an imported Decl. The parameter `ToD`
246 [[nodiscard]] bool GetImportedOrCreateDecl(ToDeclT *&ToD, FromDeclT *FromD,
252 return GetImportedOrCreateSpecialDecl(ToD, OC, FromD,
262 [[nodiscard]] bool GetImportedOrCreateDecl(ToDeclT *&ToD, FromDeclT *FromD,
265 return GetImportedOrCreateSpecialDecl(ToD, OC, FromD,
273 GetImportedOrCreateSpecialDecl(ToDeclT *&ToD, CreateFunT CreateFun,
276 ToD = nullptr;
279 ToD = cast_or_null<ToDeclT>(Importer.GetAlreadyImportedOrNull(FromD));
280 if (ToD)
282 ToD = CreateFun(std::forward<Args>(args)...);
284 Importer.RegisterImportedDecl(FromD, ToD);
285 Importer.SharedState->markAsNewDecl(ToD);
286 InitializeImportedDecl(FromD, ToD);
290 void InitializeImportedDecl(Decl *FromD, Decl *ToD) {
291 ToD->IdentifierNamespace = FromD->IdentifierNamespace;
293 ToD->setIsUsed();
295 ToD->setImplicit();
308 void addDeclToContexts(Decl *FromD, Decl *ToD) {
315 ToD->getLexicalDeclContext()->addDeclInternal(ToD);
321 DeclContext *ToDC = ToD->getDeclContext();
322 DeclContext *ToLexicalDC = ToD->getLexicalDeclContext();
326 ToDC->addDeclInternal(ToD);
330 ToLexicalDC->addDeclInternal(ToD);
338 auto *ToNamed = cast<NamedDecl>(ToD);
376 Error ImportDeclParts(NamedDecl *D, DeclarationName &Name, NamedDecl *&ToD,
380 DeclarationName &Name, NamedDecl *&ToD, SourceLocation &Loc);
381 Error ImportDefinitionIfNeeded(Decl *FromD, Decl *ToD = nullptr);
448 Error ImportTemplateParameterLists(const DeclTy *FromD, DeclTy *ToD);
1369 auto ToD = importChecked(Err, T->getDecl());
1375 ToD, cast_or_null<TypeDecl>(ToPrevD));
1877 DeclarationName &Name, NamedDecl *&ToD, SourceLocation &Loc) {
1918 ToD = cast_or_null<NamedDecl>(Importer.GetAlreadyImportedOrNull(D));
1919 if (ToD)
1920 if (Error Err = ASTNodeImporter(*this).ImportDefinitionIfNeeded(D, ToD))
1927 NamedDecl *&ToD, SourceLocation &Loc) {
1937 ToD = cast_or_null<NamedDecl>(Importer.GetAlreadyImportedOrNull(D));
1938 if (ToD)
1939 if (Error Err = ASTNodeImporter(*this).ImportDefinitionIfNeeded(D, ToD))
1945 Error ASTNodeImporter::ImportDefinitionIfNeeded(Decl *FromD, Decl *ToD) {
1949 if (!ToD)
1950 if (Error Err = importInto(ToD, FromD))
1954 if (RecordDecl *ToRecord = cast<RecordDecl>(ToD)) {
1965 if (EnumDecl *ToEnum = cast<EnumDecl>(ToD)) {
2105 if (Decl *ToD = Importer.GetAlreadyImportedOrNull(D)) {
2107 assert(ToDC == ToD->getLexicalDeclContext() && ToDC->containsDecl(ToD));
2109 ToDC->removeDecl(ToD);
2113 ToDC->addDeclInternal(ToD);
2470 EmptyDecl *ToD;
2471 if (GetImportedOrCreateDecl(ToD, D, Importer.getToContext(), DC, *LocOrErr))
2472 return ToD;
2474 ToD->setLexicalDeclContext(LexicalDC);
2475 LexicalDC->addDeclInternal(ToD);
2476 return ToD;
2480 TranslationUnitDecl *ToD =
2483 Importer.MapImported(D, ToD);
2485 return ToD;
2498 BindingDecl *ToD;
2499 if (GetImportedOrCreateDecl(ToD, D, Importer.getToContext(), DC, Loc,
2501 return ToD;
2510 ToD->setBinding(ToType, ToBinding);
2511 ToD->setDecomposedDecl(ToDecomposedDecl);
2512 addDeclToContexts(D, ToD);
2514 return ToD;
2531 AccessSpecDecl *ToD;
2532 if (GetImportedOrCreateDecl(ToD, D, Importer.getToContext(), D->getAccess(),
2534 return ToD;
2538 ToD->setLexicalDeclContext(DC);
2539 DC->addDeclInternal(ToD);
2541 return ToD;
2559 StaticAssertDecl *ToD;
2561 ToD, D, Importer.getToContext(), DC, ToLocation, ToAssertExpr, ToMessage,
2563 return ToD;
2565 ToD->setLexicalDeclContext(LexicalDC);
2566 LexicalDC->addDeclInternal(ToD);
2567 return ToD;
2575 NamedDecl *ToD;
2576 if (Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
2578 if (ToD)
2579 return ToD;
2677 NamespaceAliasDecl *ToD;
2679 ToD, D, Importer.getToContext(), DC, ToNamespaceLoc, ToAliasLoc,
2681 return ToD;
2683 ToD->setLexicalDeclContext(LexicalDC);
2684 LexicalDC->addDeclInternal(ToD);
2686 return ToD;
2694 NamedDecl *ToD;
2697 if (Error Err = ImportDeclParts(D, Name, ToD, Loc))
2699 if (ToD)
2700 return ToD;
2878 NamedDecl *ToD;
2879 if (Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
2881 if (ToD)
2882 return ToD;
2917 NamedDecl *ToD;
2918 if (Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
2920 if (ToD)
2921 return ToD;
3036 NamedDecl *ToD = nullptr;
3037 if (Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
3039 if (ToD)
3040 return ToD;
3282 NamedDecl *ToD;
3283 if (Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
3285 if (ToD)
3286 return ToD;
3337 DeclTy *ToD) {
3348 ToD->setTemplateParameterListsInfo(Importer.ToContext, ToTPLists);
3716 NamedDecl *ToD;
3717 if (Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
3719 if (ToD)
3720 return ToD;
4112 NamedDecl *ToD;
4113 if (Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
4115 if (ToD)
4116 return ToD;
4216 NamedDecl *ToD;
4217 if (Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
4219 if (ToD)
4220 return ToD;
4263 if (Expected<NamedDecl *> ToD = import(PI))
4264 NamedChain[i++] = *ToD;
4266 return ToD.takeError();
4403 NamedDecl *ToD;
4404 if (Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
4406 if (ToD)
4407 return ToD;
4466 NamedDecl *ToD;
4467 if (Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
4469 if (ToD)
4470 return ToD;
4727 NamedDecl *ToD;
4728 if (Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
4730 if (ToD)
4731 return ToD;
4859 NamedDecl *ToD;
4860 if (Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
4862 if (ToD)
4863 return ToD;
4895 NamedDecl *ToD;
4896 if (Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
4898 if (ToD)
4899 return ToD;
5042 NamedDecl *ToD;
5043 if (Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
5045 if (ToD)
5046 return ToD;
5133 NamedDecl *ToD = nullptr;
5134 if (Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
5136 if (ToD)
5137 return ToD;
5175 NamedDecl *ToD = nullptr;
5176 if (Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
5178 if (ToD)
5179 return ToD;
5213 NamedDecl *ToD = nullptr;
5214 if (Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
5216 if (ToD)
5217 return ToD;
5275 NamedDecl *ToD = nullptr;
5276 if (Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
5278 if (ToD)
5279 return ToD;
5314 NamedDecl *ToD = nullptr;
5315 if (Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
5317 if (ToD)
5318 return ToD;
5344 NamedDecl *ToD = nullptr;
5345 if (Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
5347 if (ToD)
5348 return ToD;
5380 NamedDecl *ToD = nullptr;
5381 if (Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
5383 if (ToD)
5384 return ToD;
5408 Decl* ToD = nullptr;
5411 ToD = Importer.getToContext().getMakeIntegerSeqDecl();
5414 ToD = Importer.getToContext().getTypePackElementDecl();
5417 assert(ToD && "BuiltinTemplateDecl of unsupported kind!");
5418 Importer.MapImported(D, ToD);
5419 return ToD;
5565 NamedDecl *ToD;
5566 if (Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
5568 if (ToD)
5569 return ToD;
5739 NamedDecl *ToD;
5740 if (Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
5742 if (ToD)
5743 return ToD;
5906 TemplateTypeParmDecl *ToD = nullptr;
5908 ToD, D, Importer.getToContext(),
5914 return ToD;
5925 ToD->setTypeConstraint(ToConceptRef, ToIDC);
5933 ToD->setDefaultArgument(ToD->getASTContext(), *ToDefaultArgOrErr);
5936 return ToD;
5951 NonTypeTemplateParmDecl *ToD = nullptr;
5952 if (GetImportedOrCreateDecl(ToD, D, Importer.getToContext(),
5958 return ToD;
5965 ToD->setDefaultArgument(Importer.getToContext(), *ToDefaultArgOrErr);
5968 return ToD;
5988 TemplateTemplateParmDecl *ToD = nullptr;
5990 ToD, D, Importer.getToContext(),
5995 return ToD;
6002 ToD->setDefaultArgument(Importer.getToContext(), *ToDefaultArgOrErr);
6005 return ToD;
6025 NamedDecl *ToD;
6026 if (Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
6028 if (ToD)
6029 return ToD;
6359 NamedDecl *ToD;
6360 if (Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
6362 if (ToD)
6363 return ToD;
6633 NamedDecl *ToD;
6635 if (Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
6638 if (ToD)
6639 return ToD;
9035 void ASTImporter::AddToLookupTable(Decl *ToD) {
9036 SharedState->addDeclToLookup(ToD);
9045 void ASTImporter::RegisterImportedDecl(Decl *FromD, Decl *ToD) {
9046 MapImported(FromD, ToD);
9397 TranslationUnitDecl *ASTImporter::GetFromTU(Decl *ToD) {
9398 auto FromDPos = ImportedFromDecls.find(ToD);
9404 Error ASTImporter::ImportAttrs(Decl *ToD, Decl *FromD) {
9405 if (!FromD->hasAttrs() || ToD->hasAttrs())
9410 ToD->addAttr(*ToAttrOrErr);
9432 Decl *ToD = GetAlreadyImportedOrNull(FromD);
9433 if (ToD) {
9435 if (auto Error = SharedState->getImportDeclErrorIfAny(ToD)) {
9441 updateFlags(FromD, ToD);
9446 return ToD;
9458 auto *ToD = Pos->second;
9471 auto PosF = ImportedFromDecls.find(ToD);
9476 if (ToD->getDeclContext())
9477 SharedState->removeDeclFromLookup(ToD);
9529 ToD = *ToDOrErr;
9535 if (!ToD) {
9542 // already had imported a Decl as `ToD` from another TU (with another
9544 if (auto Error = SharedState->getImportDeclErrorIfAny(ToD)) {
9550 if (auto Error = ImportAttrs(ToD, FromD))
9554 Imported(FromD, ToD);
9556 updateFlags(FromD, ToD);