Lines Matching refs:D

49     void Visit(Decl *D);
51 void VisitDecl(Decl *D);
52 void VisitTranslationUnitDecl(TranslationUnitDecl *D);
53 void VisitNamedDecl(NamedDecl *D);
55 void VisitNamespaceDecl(NamespaceDecl *D);
56 void VisitUsingDirectiveDecl(UsingDirectiveDecl *D);
57 void VisitNamespaceAliasDecl(NamespaceAliasDecl *D);
58 void VisitTypeDecl(TypeDecl *D);
59 void VisitTypedefNameDecl(TypedefNameDecl *D);
60 void VisitTypedefDecl(TypedefDecl *D);
61 void VisitTypeAliasDecl(TypeAliasDecl *D);
62 void VisitUnresolvedUsingTypenameDecl(UnresolvedUsingTypenameDecl *D);
63 void VisitTagDecl(TagDecl *D);
64 void VisitEnumDecl(EnumDecl *D);
65 void VisitRecordDecl(RecordDecl *D);
66 void VisitCXXRecordDecl(CXXRecordDecl *D);
68 ClassTemplateSpecializationDecl *D);
70 ClassTemplatePartialSpecializationDecl *D);
71 void VisitVarTemplateSpecializationDecl(VarTemplateSpecializationDecl *D);
73 VarTemplatePartialSpecializationDecl *D);
75 ClassScopeFunctionSpecializationDecl *D);
76 void VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D);
77 void VisitValueDecl(ValueDecl *D);
78 void VisitEnumConstantDecl(EnumConstantDecl *D);
79 void VisitUnresolvedUsingValueDecl(UnresolvedUsingValueDecl *D);
80 void VisitDeclaratorDecl(DeclaratorDecl *D);
81 void VisitFunctionDecl(FunctionDecl *D);
82 void VisitCXXMethodDecl(CXXMethodDecl *D);
83 void VisitCXXConstructorDecl(CXXConstructorDecl *D);
84 void VisitCXXDestructorDecl(CXXDestructorDecl *D);
85 void VisitCXXConversionDecl(CXXConversionDecl *D);
86 void VisitFieldDecl(FieldDecl *D);
87 void VisitMSPropertyDecl(MSPropertyDecl *D);
88 void VisitIndirectFieldDecl(IndirectFieldDecl *D);
89 void VisitVarDecl(VarDecl *D);
90 void VisitImplicitParamDecl(ImplicitParamDecl *D);
91 void VisitParmVarDecl(ParmVarDecl *D);
92 void VisitNonTypeTemplateParmDecl(NonTypeTemplateParmDecl *D);
93 void VisitTemplateDecl(TemplateDecl *D);
94 void VisitRedeclarableTemplateDecl(RedeclarableTemplateDecl *D);
95 void VisitClassTemplateDecl(ClassTemplateDecl *D);
96 void VisitVarTemplateDecl(VarTemplateDecl *D);
97 void VisitFunctionTemplateDecl(FunctionTemplateDecl *D);
98 void VisitTemplateTemplateParmDecl(TemplateTemplateParmDecl *D);
99 void VisitTypeAliasTemplateDecl(TypeAliasTemplateDecl *D);
100 void VisitUsingDecl(UsingDecl *D);
101 void VisitUsingShadowDecl(UsingShadowDecl *D);
102 void VisitLinkageSpecDecl(LinkageSpecDecl *D);
103 void VisitFileScopeAsmDecl(FileScopeAsmDecl *D);
104 void VisitImportDecl(ImportDecl *D);
105 void VisitAccessSpecDecl(AccessSpecDecl *D);
106 void VisitFriendDecl(FriendDecl *D);
107 void VisitFriendTemplateDecl(FriendTemplateDecl *D);
108 void VisitStaticAssertDecl(StaticAssertDecl *D);
109 void VisitBlockDecl(BlockDecl *D);
110 void VisitCapturedDecl(CapturedDecl *D);
111 void VisitEmptyDecl(EmptyDecl *D);
115 template <typename T> void VisitRedeclarable(Redeclarable<T> *D);
119 void VisitObjCMethodDecl(ObjCMethodDecl *D);
120 void VisitObjCTypeParamDecl(ObjCTypeParamDecl *D);
121 void VisitObjCContainerDecl(ObjCContainerDecl *D);
122 void VisitObjCInterfaceDecl(ObjCInterfaceDecl *D);
123 void VisitObjCIvarDecl(ObjCIvarDecl *D);
124 void VisitObjCProtocolDecl(ObjCProtocolDecl *D);
125 void VisitObjCAtDefsFieldDecl(ObjCAtDefsFieldDecl *D);
126 void VisitObjCCategoryDecl(ObjCCategoryDecl *D);
127 void VisitObjCImplDecl(ObjCImplDecl *D);
128 void VisitObjCCategoryImplDecl(ObjCCategoryImplDecl *D);
129 void VisitObjCImplementationDecl(ObjCImplementationDecl *D);
130 void VisitObjCCompatibleAliasDecl(ObjCCompatibleAliasDecl *D);
131 void VisitObjCPropertyDecl(ObjCPropertyDecl *D);
132 void VisitObjCPropertyImplDecl(ObjCPropertyImplDecl *D);
133 void VisitOMPThreadPrivateDecl(OMPThreadPrivateDecl *D);
165 void AddFirstDeclFromEachModule(const Decl *D, bool IncludeLocal) { in AddFirstDeclFromEachModule() argument
168 for (const Decl *R = D->getMostRecentDecl(); R; R = R->getPreviousDecl()) { in AddFirstDeclFromEachModule()
195 void AddTemplateSpecializations(Decl *D) { in AddTemplateSpecializations() argument
196 auto *Common = D->getCommonPtr(); in AddTemplateSpecializations()
203 D->LoadLazySpecializations(); in AddTemplateSpecializations()
218 auto *D = getSpecializationDecl(Entry); in AddTemplateSpecializations() local
219 assert(D->isCanonicalDecl() && "non-canonical decl in set"); in AddTemplateSpecializations()
220 AddFirstDeclFromEachModule(D, /*IncludeLocal*/true); in AddTemplateSpecializations()
223 auto *D = getSpecializationDecl(Entry); in AddTemplateSpecializations() local
224 assert(D->isCanonicalDecl() && "non-canonical decl in set"); in AddTemplateSpecializations()
225 AddFirstDeclFromEachModule(D, /*IncludeLocal*/true); in AddTemplateSpecializations()
257 void ASTDeclWriter::Visit(Decl *D) { in Visit() argument
258 DeclVisitor<ASTDeclWriter>::Visit(D); in Visit()
263 if (DeclaratorDecl *DD = dyn_cast<DeclaratorDecl>(D)) { in Visit()
270 if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) { in Visit()
277 void ASTDeclWriter::VisitDecl(Decl *D) { in VisitDecl() argument
278 Writer.AddDeclRef(cast_or_null<Decl>(D->getDeclContext()), Record); in VisitDecl()
279 if (D->getDeclContext() != D->getLexicalDeclContext()) in VisitDecl()
280 Writer.AddDeclRef(cast_or_null<Decl>(D->getLexicalDeclContext()), Record); in VisitDecl()
283 Record.push_back(D->isInvalidDecl()); in VisitDecl()
284 Record.push_back(D->hasAttrs()); in VisitDecl()
285 if (D->hasAttrs()) in VisitDecl()
286 Writer.WriteAttributes(llvm::makeArrayRef(D->getAttrs().begin(), in VisitDecl()
287 D->getAttrs().size()), Record); in VisitDecl()
288 Record.push_back(D->isImplicit()); in VisitDecl()
289 Record.push_back(D->isUsed(false)); in VisitDecl()
290 Record.push_back(D->isReferenced()); in VisitDecl()
291 Record.push_back(D->isTopLevelDeclInObjCContainer()); in VisitDecl()
292 Record.push_back(D->getAccess()); in VisitDecl()
293 Record.push_back(D->isModulePrivate()); in VisitDecl()
294 Record.push_back(Writer.inferSubmoduleIDFromLocation(D->getLocation())); in VisitDecl()
304 if (D->isOutOfLine()) { in VisitDecl()
305 auto *DC = D->getDeclContext(); in VisitDecl()
317 void ASTDeclWriter::VisitTranslationUnitDecl(TranslationUnitDecl *D) { in VisitTranslationUnitDecl() argument
321 void ASTDeclWriter::VisitNamedDecl(NamedDecl *D) { in VisitNamedDecl() argument
322 VisitDecl(D); in VisitNamedDecl()
323 Writer.AddDeclarationName(D->getDeclName(), Record); in VisitNamedDecl()
324 Record.push_back(needsAnonymousDeclarationNumber(D) in VisitNamedDecl()
325 ? Writer.getAnonymousDeclarationNumber(D) in VisitNamedDecl()
329 void ASTDeclWriter::VisitTypeDecl(TypeDecl *D) { in VisitTypeDecl() argument
330 VisitNamedDecl(D); in VisitTypeDecl()
331 Writer.AddSourceLocation(D->getLocStart(), Record); in VisitTypeDecl()
332 Writer.AddTypeRef(QualType(D->getTypeForDecl(), 0), Record); in VisitTypeDecl()
335 void ASTDeclWriter::VisitTypedefNameDecl(TypedefNameDecl *D) { in VisitTypedefNameDecl() argument
336 VisitRedeclarable(D); in VisitTypedefNameDecl()
337 VisitTypeDecl(D); in VisitTypedefNameDecl()
338 Writer.AddTypeSourceInfo(D->getTypeSourceInfo(), Record); in VisitTypedefNameDecl()
339 Record.push_back(D->isModed()); in VisitTypedefNameDecl()
340 if (D->isModed()) in VisitTypedefNameDecl()
341 Writer.AddTypeRef(D->getUnderlyingType(), Record); in VisitTypedefNameDecl()
344 void ASTDeclWriter::VisitTypedefDecl(TypedefDecl *D) { in VisitTypedefDecl() argument
345 VisitTypedefNameDecl(D); in VisitTypedefDecl()
346 if (D->getDeclContext() == D->getLexicalDeclContext() && in VisitTypedefDecl()
347 !D->hasAttrs() && in VisitTypedefDecl()
348 !D->isImplicit() && in VisitTypedefDecl()
349 D->getFirstDecl() == D->getMostRecentDecl() && in VisitTypedefDecl()
350 !D->isInvalidDecl() && in VisitTypedefDecl()
351 !D->isTopLevelDeclInObjCContainer() && in VisitTypedefDecl()
352 !D->isModulePrivate() && in VisitTypedefDecl()
353 !needsAnonymousDeclarationNumber(D) && in VisitTypedefDecl()
354 D->getDeclName().getNameKind() == DeclarationName::Identifier) in VisitTypedefDecl()
360 void ASTDeclWriter::VisitTypeAliasDecl(TypeAliasDecl *D) { in VisitTypeAliasDecl() argument
361 VisitTypedefNameDecl(D); in VisitTypeAliasDecl()
362 Writer.AddDeclRef(D->getDescribedAliasTemplate(), Record); in VisitTypeAliasDecl()
366 void ASTDeclWriter::VisitTagDecl(TagDecl *D) { in VisitTagDecl() argument
367 VisitRedeclarable(D); in VisitTagDecl()
368 VisitTypeDecl(D); in VisitTagDecl()
369 Record.push_back(D->getIdentifierNamespace()); in VisitTagDecl()
370 Record.push_back((unsigned)D->getTagKind()); // FIXME: stable encoding in VisitTagDecl()
371 if (!isa<CXXRecordDecl>(D)) in VisitTagDecl()
372 Record.push_back(D->isCompleteDefinition()); in VisitTagDecl()
373 Record.push_back(D->isEmbeddedInDeclarator()); in VisitTagDecl()
374 Record.push_back(D->isFreeStanding()); in VisitTagDecl()
375 Record.push_back(D->isCompleteDefinitionRequired()); in VisitTagDecl()
376 Writer.AddSourceLocation(D->getRBraceLoc(), Record); in VisitTagDecl()
378 if (D->hasExtInfo()) { in VisitTagDecl()
380 Writer.AddQualifierInfo(*D->getExtInfo(), Record); in VisitTagDecl()
381 } else if (auto *TD = D->getTypedefNameForAnonDecl()) { in VisitTagDecl()
390 void ASTDeclWriter::VisitEnumDecl(EnumDecl *D) { in VisitEnumDecl() argument
391 VisitTagDecl(D); in VisitEnumDecl()
392 Writer.AddTypeSourceInfo(D->getIntegerTypeSourceInfo(), Record); in VisitEnumDecl()
393 if (!D->getIntegerTypeSourceInfo()) in VisitEnumDecl()
394 Writer.AddTypeRef(D->getIntegerType(), Record); in VisitEnumDecl()
395 Writer.AddTypeRef(D->getPromotionType(), Record); in VisitEnumDecl()
396 Record.push_back(D->getNumPositiveBits()); in VisitEnumDecl()
397 Record.push_back(D->getNumNegativeBits()); in VisitEnumDecl()
398 Record.push_back(D->isScoped()); in VisitEnumDecl()
399 Record.push_back(D->isScopedUsingClassTag()); in VisitEnumDecl()
400 Record.push_back(D->isFixed()); in VisitEnumDecl()
401 if (MemberSpecializationInfo *MemberInfo = D->getMemberSpecializationInfo()) { in VisitEnumDecl()
409 if (D->getDeclContext() == D->getLexicalDeclContext() && in VisitEnumDecl()
410 !D->hasAttrs() && in VisitEnumDecl()
411 !D->isImplicit() && in VisitEnumDecl()
412 !D->isUsed(false) && in VisitEnumDecl()
413 !D->hasExtInfo() && in VisitEnumDecl()
414 !D->getTypedefNameForAnonDecl() && in VisitEnumDecl()
415 D->getFirstDecl() == D->getMostRecentDecl() && in VisitEnumDecl()
416 !D->isInvalidDecl() && in VisitEnumDecl()
417 !D->isReferenced() && in VisitEnumDecl()
418 !D->isTopLevelDeclInObjCContainer() && in VisitEnumDecl()
419 D->getAccess() == AS_none && in VisitEnumDecl()
420 !D->isModulePrivate() && in VisitEnumDecl()
421 !CXXRecordDecl::classofKind(D->getKind()) && in VisitEnumDecl()
422 !D->getIntegerTypeSourceInfo() && in VisitEnumDecl()
423 !D->getMemberSpecializationInfo() && in VisitEnumDecl()
424 !needsAnonymousDeclarationNumber(D) && in VisitEnumDecl()
425 D->getDeclName().getNameKind() == DeclarationName::Identifier) in VisitEnumDecl()
431 void ASTDeclWriter::VisitRecordDecl(RecordDecl *D) { in VisitRecordDecl() argument
432 VisitTagDecl(D); in VisitRecordDecl()
433 Record.push_back(D->hasFlexibleArrayMember()); in VisitRecordDecl()
434 Record.push_back(D->isAnonymousStructOrUnion()); in VisitRecordDecl()
435 Record.push_back(D->hasObjectMember()); in VisitRecordDecl()
436 Record.push_back(D->hasVolatileMember()); in VisitRecordDecl()
438 if (D->getDeclContext() == D->getLexicalDeclContext() && in VisitRecordDecl()
439 !D->hasAttrs() && in VisitRecordDecl()
440 !D->isImplicit() && in VisitRecordDecl()
441 !D->isUsed(false) && in VisitRecordDecl()
442 !D->hasExtInfo() && in VisitRecordDecl()
443 !D->getTypedefNameForAnonDecl() && in VisitRecordDecl()
444 D->getFirstDecl() == D->getMostRecentDecl() && in VisitRecordDecl()
445 !D->isInvalidDecl() && in VisitRecordDecl()
446 !D->isReferenced() && in VisitRecordDecl()
447 !D->isTopLevelDeclInObjCContainer() && in VisitRecordDecl()
448 D->getAccess() == AS_none && in VisitRecordDecl()
449 !D->isModulePrivate() && in VisitRecordDecl()
450 !CXXRecordDecl::classofKind(D->getKind()) && in VisitRecordDecl()
451 !needsAnonymousDeclarationNumber(D) && in VisitRecordDecl()
452 D->getDeclName().getNameKind() == DeclarationName::Identifier) in VisitRecordDecl()
458 void ASTDeclWriter::VisitValueDecl(ValueDecl *D) { in VisitValueDecl() argument
459 VisitNamedDecl(D); in VisitValueDecl()
460 Writer.AddTypeRef(D->getType(), Record); in VisitValueDecl()
463 void ASTDeclWriter::VisitEnumConstantDecl(EnumConstantDecl *D) { in VisitEnumConstantDecl() argument
464 VisitValueDecl(D); in VisitEnumConstantDecl()
465 Record.push_back(D->getInitExpr()? 1 : 0); in VisitEnumConstantDecl()
466 if (D->getInitExpr()) in VisitEnumConstantDecl()
467 Writer.AddStmt(D->getInitExpr()); in VisitEnumConstantDecl()
468 Writer.AddAPSInt(D->getInitVal(), Record); in VisitEnumConstantDecl()
473 void ASTDeclWriter::VisitDeclaratorDecl(DeclaratorDecl *D) { in VisitDeclaratorDecl() argument
474 VisitValueDecl(D); in VisitDeclaratorDecl()
475 Writer.AddSourceLocation(D->getInnerLocStart(), Record); in VisitDeclaratorDecl()
476 Record.push_back(D->hasExtInfo()); in VisitDeclaratorDecl()
477 if (D->hasExtInfo()) in VisitDeclaratorDecl()
478 Writer.AddQualifierInfo(*D->getExtInfo(), Record); in VisitDeclaratorDecl()
481 void ASTDeclWriter::VisitFunctionDecl(FunctionDecl *D) { in VisitFunctionDecl() argument
482 VisitRedeclarable(D); in VisitFunctionDecl()
483 VisitDeclaratorDecl(D); in VisitFunctionDecl()
484 Writer.AddDeclarationNameLoc(D->DNLoc, D->getDeclName(), Record); in VisitFunctionDecl()
485 Record.push_back(D->getIdentifierNamespace()); in VisitFunctionDecl()
490 Record.push_back((int)D->SClass); // FIXME: stable encoding in VisitFunctionDecl()
491 Record.push_back(D->IsInline); in VisitFunctionDecl()
492 Record.push_back(D->IsInlineSpecified); in VisitFunctionDecl()
493 Record.push_back(D->IsVirtualAsWritten); in VisitFunctionDecl()
494 Record.push_back(D->IsPure); in VisitFunctionDecl()
495 Record.push_back(D->HasInheritedPrototype); in VisitFunctionDecl()
496 Record.push_back(D->HasWrittenPrototype); in VisitFunctionDecl()
497 Record.push_back(D->IsDeleted); in VisitFunctionDecl()
498 Record.push_back(D->IsTrivial); in VisitFunctionDecl()
499 Record.push_back(D->IsDefaulted); in VisitFunctionDecl()
500 Record.push_back(D->IsExplicitlyDefaulted); in VisitFunctionDecl()
501 Record.push_back(D->HasImplicitReturnZero); in VisitFunctionDecl()
502 Record.push_back(D->IsConstexpr); in VisitFunctionDecl()
503 Record.push_back(D->HasSkippedBody); in VisitFunctionDecl()
504 Record.push_back(D->IsLateTemplateParsed); in VisitFunctionDecl()
505 Record.push_back(D->getLinkageInternal()); in VisitFunctionDecl()
506 Writer.AddSourceLocation(D->getLocEnd(), Record); in VisitFunctionDecl()
508 Record.push_back(D->getTemplatedKind()); in VisitFunctionDecl()
509 switch (D->getTemplatedKind()) { in VisitFunctionDecl()
513 Writer.AddDeclRef(D->getDescribedFunctionTemplate(), Record); in VisitFunctionDecl()
516 MemberSpecializationInfo *MemberInfo = D->getMemberSpecializationInfo(); in VisitFunctionDecl()
524 FTSInfo = D->getTemplateSpecializationInfo(); in VisitFunctionDecl()
526 RegisterTemplateSpecialization(FTSInfo->getTemplate(), D); in VisitFunctionDecl()
550 if (D->isCanonicalDecl()) { in VisitFunctionDecl()
559 DFTSInfo = D->getDependentSpecializationInfo(); in VisitFunctionDecl()
576 Record.push_back(D->param_size()); in VisitFunctionDecl()
577 for (auto P : D->params()) in VisitFunctionDecl()
582 void ASTDeclWriter::VisitObjCMethodDecl(ObjCMethodDecl *D) { in VisitObjCMethodDecl() argument
583 VisitNamedDecl(D); in VisitObjCMethodDecl()
586 bool HasBodyStuff = D->getBody() != nullptr || in VisitObjCMethodDecl()
587 D->getSelfDecl() != nullptr || D->getCmdDecl() != nullptr; in VisitObjCMethodDecl()
590 Writer.AddStmt(D->getBody()); in VisitObjCMethodDecl()
591 Writer.AddDeclRef(D->getSelfDecl(), Record); in VisitObjCMethodDecl()
592 Writer.AddDeclRef(D->getCmdDecl(), Record); in VisitObjCMethodDecl()
594 Record.push_back(D->isInstanceMethod()); in VisitObjCMethodDecl()
595 Record.push_back(D->isVariadic()); in VisitObjCMethodDecl()
596 Record.push_back(D->isPropertyAccessor()); in VisitObjCMethodDecl()
597 Record.push_back(D->isDefined()); in VisitObjCMethodDecl()
598 Record.push_back(D->IsOverriding); in VisitObjCMethodDecl()
599 Record.push_back(D->HasSkippedBody); in VisitObjCMethodDecl()
601 Record.push_back(D->IsRedeclaration); in VisitObjCMethodDecl()
602 Record.push_back(D->HasRedeclaration); in VisitObjCMethodDecl()
603 if (D->HasRedeclaration) { in VisitObjCMethodDecl()
604 assert(Context.getObjCMethodRedeclaration(D)); in VisitObjCMethodDecl()
605 Writer.AddDeclRef(Context.getObjCMethodRedeclaration(D), Record); in VisitObjCMethodDecl()
609 Record.push_back(D->getImplementationControl()); in VisitObjCMethodDecl()
611 Record.push_back(D->getObjCDeclQualifier()); in VisitObjCMethodDecl()
612 Record.push_back(D->hasRelatedResultType()); in VisitObjCMethodDecl()
613 Writer.AddTypeRef(D->getReturnType(), Record); in VisitObjCMethodDecl()
614 Writer.AddTypeSourceInfo(D->getReturnTypeSourceInfo(), Record); in VisitObjCMethodDecl()
615 Writer.AddSourceLocation(D->getLocEnd(), Record); in VisitObjCMethodDecl()
616 Record.push_back(D->param_size()); in VisitObjCMethodDecl()
617 for (const auto *P : D->params()) in VisitObjCMethodDecl()
620 Record.push_back(D->SelLocsKind); in VisitObjCMethodDecl()
621 unsigned NumStoredSelLocs = D->getNumStoredSelLocs(); in VisitObjCMethodDecl()
622 SourceLocation *SelLocs = D->getStoredSelLocs(); in VisitObjCMethodDecl()
630 void ASTDeclWriter::VisitObjCTypeParamDecl(ObjCTypeParamDecl *D) { in VisitObjCTypeParamDecl() argument
631 VisitTypedefNameDecl(D); in VisitObjCTypeParamDecl()
632 Record.push_back(D->Variance); in VisitObjCTypeParamDecl()
633 Record.push_back(D->Index); in VisitObjCTypeParamDecl()
634 Writer.AddSourceLocation(D->VarianceLoc, Record); in VisitObjCTypeParamDecl()
635 Writer.AddSourceLocation(D->ColonLoc, Record); in VisitObjCTypeParamDecl()
640 void ASTDeclWriter::VisitObjCContainerDecl(ObjCContainerDecl *D) { in VisitObjCContainerDecl() argument
641 VisitNamedDecl(D); in VisitObjCContainerDecl()
642 Writer.AddSourceLocation(D->getAtStartLoc(), Record); in VisitObjCContainerDecl()
643 Writer.AddSourceRange(D->getAtEndRange(), Record); in VisitObjCContainerDecl()
647 void ASTDeclWriter::VisitObjCInterfaceDecl(ObjCInterfaceDecl *D) { in VisitObjCInterfaceDecl() argument
648 VisitRedeclarable(D); in VisitObjCInterfaceDecl()
649 VisitObjCContainerDecl(D); in VisitObjCInterfaceDecl()
650 Writer.AddTypeRef(QualType(D->getTypeForDecl(), 0), Record); in VisitObjCInterfaceDecl()
651 AddObjCTypeParamList(D->TypeParamList); in VisitObjCInterfaceDecl()
653 Record.push_back(D->isThisDeclarationADefinition()); in VisitObjCInterfaceDecl()
654 if (D->isThisDeclarationADefinition()) { in VisitObjCInterfaceDecl()
656 ObjCInterfaceDecl::DefinitionData &Data = D->data(); in VisitObjCInterfaceDecl()
658 Writer.AddTypeSourceInfo(D->getSuperClassTInfo(), Record); in VisitObjCInterfaceDecl()
659 Writer.AddSourceLocation(D->getEndOfDefinitionLoc(), Record); in VisitObjCInterfaceDecl()
664 for (const auto *P : D->protocols()) in VisitObjCInterfaceDecl()
666 for (const auto &PL : D->protocol_locs()) in VisitObjCInterfaceDecl()
678 if (ObjCCategoryDecl *Cat = D->getCategoryListRaw()) { in VisitObjCInterfaceDecl()
680 Writer.ObjCClassesWithCategories.insert(D); in VisitObjCInterfaceDecl()
691 void ASTDeclWriter::VisitObjCIvarDecl(ObjCIvarDecl *D) { in VisitObjCIvarDecl() argument
692 VisitFieldDecl(D); in VisitObjCIvarDecl()
694 Record.push_back(D->getAccessControl()); in VisitObjCIvarDecl()
695 Record.push_back(D->getSynthesize()); in VisitObjCIvarDecl()
697 if (D->getDeclContext() == D->getLexicalDeclContext() && in VisitObjCIvarDecl()
698 !D->hasAttrs() && in VisitObjCIvarDecl()
699 !D->isImplicit() && in VisitObjCIvarDecl()
700 !D->isUsed(false) && in VisitObjCIvarDecl()
701 !D->isInvalidDecl() && in VisitObjCIvarDecl()
702 !D->isReferenced() && in VisitObjCIvarDecl()
703 !D->isModulePrivate() && in VisitObjCIvarDecl()
704 !D->getBitWidth() && in VisitObjCIvarDecl()
705 !D->hasExtInfo() && in VisitObjCIvarDecl()
706 D->getDeclName()) in VisitObjCIvarDecl()
712 void ASTDeclWriter::VisitObjCProtocolDecl(ObjCProtocolDecl *D) { in VisitObjCProtocolDecl() argument
713 VisitRedeclarable(D); in VisitObjCProtocolDecl()
714 VisitObjCContainerDecl(D); in VisitObjCProtocolDecl()
716 Record.push_back(D->isThisDeclarationADefinition()); in VisitObjCProtocolDecl()
717 if (D->isThisDeclarationADefinition()) { in VisitObjCProtocolDecl()
718 Record.push_back(D->protocol_size()); in VisitObjCProtocolDecl()
719 for (const auto *I : D->protocols()) in VisitObjCProtocolDecl()
721 for (const auto &PL : D->protocol_locs()) in VisitObjCProtocolDecl()
728 void ASTDeclWriter::VisitObjCAtDefsFieldDecl(ObjCAtDefsFieldDecl *D) { in VisitObjCAtDefsFieldDecl() argument
729 VisitFieldDecl(D); in VisitObjCAtDefsFieldDecl()
733 void ASTDeclWriter::VisitObjCCategoryDecl(ObjCCategoryDecl *D) { in VisitObjCCategoryDecl() argument
734 VisitObjCContainerDecl(D); in VisitObjCCategoryDecl()
735 Writer.AddSourceLocation(D->getCategoryNameLoc(), Record); in VisitObjCCategoryDecl()
736 Writer.AddSourceLocation(D->getIvarLBraceLoc(), Record); in VisitObjCCategoryDecl()
737 Writer.AddSourceLocation(D->getIvarRBraceLoc(), Record); in VisitObjCCategoryDecl()
738 Writer.AddDeclRef(D->getClassInterface(), Record); in VisitObjCCategoryDecl()
739 AddObjCTypeParamList(D->TypeParamList); in VisitObjCCategoryDecl()
740 Record.push_back(D->protocol_size()); in VisitObjCCategoryDecl()
741 for (const auto *I : D->protocols()) in VisitObjCCategoryDecl()
743 for (const auto &PL : D->protocol_locs()) in VisitObjCCategoryDecl()
748 void ASTDeclWriter::VisitObjCCompatibleAliasDecl(ObjCCompatibleAliasDecl *D) { in VisitObjCCompatibleAliasDecl() argument
749 VisitNamedDecl(D); in VisitObjCCompatibleAliasDecl()
750 Writer.AddDeclRef(D->getClassInterface(), Record); in VisitObjCCompatibleAliasDecl()
754 void ASTDeclWriter::VisitObjCPropertyDecl(ObjCPropertyDecl *D) { in VisitObjCPropertyDecl() argument
755 VisitNamedDecl(D); in VisitObjCPropertyDecl()
756 Writer.AddSourceLocation(D->getAtLoc(), Record); in VisitObjCPropertyDecl()
757 Writer.AddSourceLocation(D->getLParenLoc(), Record); in VisitObjCPropertyDecl()
758 Writer.AddTypeRef(D->getType(), Record); in VisitObjCPropertyDecl()
759 Writer.AddTypeSourceInfo(D->getTypeSourceInfo(), Record); in VisitObjCPropertyDecl()
761 Record.push_back((unsigned)D->getPropertyAttributes()); in VisitObjCPropertyDecl()
762 Record.push_back((unsigned)D->getPropertyAttributesAsWritten()); in VisitObjCPropertyDecl()
764 Record.push_back((unsigned)D->getPropertyImplementation()); in VisitObjCPropertyDecl()
765 Writer.AddDeclarationName(D->getGetterName(), Record); in VisitObjCPropertyDecl()
766 Writer.AddDeclarationName(D->getSetterName(), Record); in VisitObjCPropertyDecl()
767 Writer.AddDeclRef(D->getGetterMethodDecl(), Record); in VisitObjCPropertyDecl()
768 Writer.AddDeclRef(D->getSetterMethodDecl(), Record); in VisitObjCPropertyDecl()
769 Writer.AddDeclRef(D->getPropertyIvarDecl(), Record); in VisitObjCPropertyDecl()
773 void ASTDeclWriter::VisitObjCImplDecl(ObjCImplDecl *D) { in VisitObjCImplDecl() argument
774 VisitObjCContainerDecl(D); in VisitObjCImplDecl()
775 Writer.AddDeclRef(D->getClassInterface(), Record); in VisitObjCImplDecl()
779 void ASTDeclWriter::VisitObjCCategoryImplDecl(ObjCCategoryImplDecl *D) { in VisitObjCCategoryImplDecl() argument
780 VisitObjCImplDecl(D); in VisitObjCCategoryImplDecl()
781 Writer.AddIdentifierRef(D->getIdentifier(), Record); in VisitObjCCategoryImplDecl()
782 Writer.AddSourceLocation(D->getCategoryNameLoc(), Record); in VisitObjCCategoryImplDecl()
786 void ASTDeclWriter::VisitObjCImplementationDecl(ObjCImplementationDecl *D) { in VisitObjCImplementationDecl() argument
787 VisitObjCImplDecl(D); in VisitObjCImplementationDecl()
788 Writer.AddDeclRef(D->getSuperClass(), Record); in VisitObjCImplementationDecl()
789 Writer.AddSourceLocation(D->getSuperClassLoc(), Record); in VisitObjCImplementationDecl()
790 Writer.AddSourceLocation(D->getIvarLBraceLoc(), Record); in VisitObjCImplementationDecl()
791 Writer.AddSourceLocation(D->getIvarRBraceLoc(), Record); in VisitObjCImplementationDecl()
792 Record.push_back(D->hasNonZeroConstructors()); in VisitObjCImplementationDecl()
793 Record.push_back(D->hasDestructors()); in VisitObjCImplementationDecl()
794 Record.push_back(D->NumIvarInitializers); in VisitObjCImplementationDecl()
795 if (D->NumIvarInitializers) in VisitObjCImplementationDecl()
797 llvm::makeArrayRef(D->init_begin(), D->init_end()), Record); in VisitObjCImplementationDecl()
801 void ASTDeclWriter::VisitObjCPropertyImplDecl(ObjCPropertyImplDecl *D) { in VisitObjCPropertyImplDecl() argument
802 VisitDecl(D); in VisitObjCPropertyImplDecl()
803 Writer.AddSourceLocation(D->getLocStart(), Record); in VisitObjCPropertyImplDecl()
804 Writer.AddDeclRef(D->getPropertyDecl(), Record); in VisitObjCPropertyImplDecl()
805 Writer.AddDeclRef(D->getPropertyIvarDecl(), Record); in VisitObjCPropertyImplDecl()
806 Writer.AddSourceLocation(D->getPropertyIvarDeclLoc(), Record); in VisitObjCPropertyImplDecl()
807 Writer.AddStmt(D->getGetterCXXConstructor()); in VisitObjCPropertyImplDecl()
808 Writer.AddStmt(D->getSetterCXXAssignment()); in VisitObjCPropertyImplDecl()
812 void ASTDeclWriter::VisitFieldDecl(FieldDecl *D) { in VisitFieldDecl() argument
813 VisitDeclaratorDecl(D); in VisitFieldDecl()
814 Record.push_back(D->isMutable()); in VisitFieldDecl()
815 if (D->InitStorage.getInt() == FieldDecl::ISK_BitWidthOrNothing && in VisitFieldDecl()
816 D->InitStorage.getPointer() == nullptr) { in VisitFieldDecl()
818 } else if (D->InitStorage.getInt() == FieldDecl::ISK_CapturedVLAType) { in VisitFieldDecl()
819 Record.push_back(D->InitStorage.getInt() + 1); in VisitFieldDecl()
821 QualType(static_cast<Type *>(D->InitStorage.getPointer()), 0), in VisitFieldDecl()
824 Record.push_back(D->InitStorage.getInt() + 1); in VisitFieldDecl()
825 Writer.AddStmt(static_cast<Expr *>(D->InitStorage.getPointer())); in VisitFieldDecl()
827 if (!D->getDeclName()) in VisitFieldDecl()
828 Writer.AddDeclRef(Context.getInstantiatedFromUnnamedFieldDecl(D), Record); in VisitFieldDecl()
830 if (D->getDeclContext() == D->getLexicalDeclContext() && in VisitFieldDecl()
831 !D->hasAttrs() && in VisitFieldDecl()
832 !D->isImplicit() && in VisitFieldDecl()
833 !D->isUsed(false) && in VisitFieldDecl()
834 !D->isInvalidDecl() && in VisitFieldDecl()
835 !D->isReferenced() && in VisitFieldDecl()
836 !D->isTopLevelDeclInObjCContainer() && in VisitFieldDecl()
837 !D->isModulePrivate() && in VisitFieldDecl()
838 !D->getBitWidth() && in VisitFieldDecl()
839 !D->hasInClassInitializer() && in VisitFieldDecl()
840 !D->hasExtInfo() && in VisitFieldDecl()
841 !ObjCIvarDecl::classofKind(D->getKind()) && in VisitFieldDecl()
842 !ObjCAtDefsFieldDecl::classofKind(D->getKind()) && in VisitFieldDecl()
843 D->getDeclName()) in VisitFieldDecl()
849 void ASTDeclWriter::VisitMSPropertyDecl(MSPropertyDecl *D) { in VisitMSPropertyDecl() argument
850 VisitDeclaratorDecl(D); in VisitMSPropertyDecl()
851 Writer.AddIdentifierRef(D->getGetterId(), Record); in VisitMSPropertyDecl()
852 Writer.AddIdentifierRef(D->getSetterId(), Record); in VisitMSPropertyDecl()
856 void ASTDeclWriter::VisitIndirectFieldDecl(IndirectFieldDecl *D) { in VisitIndirectFieldDecl() argument
857 VisitValueDecl(D); in VisitIndirectFieldDecl()
858 Record.push_back(D->getChainingSize()); in VisitIndirectFieldDecl()
860 for (const auto *P : D->chain()) in VisitIndirectFieldDecl()
865 void ASTDeclWriter::VisitVarDecl(VarDecl *D) { in VisitVarDecl() argument
866 VisitRedeclarable(D); in VisitVarDecl()
867 VisitDeclaratorDecl(D); in VisitVarDecl()
868 Record.push_back(D->getStorageClass()); in VisitVarDecl()
869 Record.push_back(D->getTSCSpec()); in VisitVarDecl()
870 Record.push_back(D->getInitStyle()); in VisitVarDecl()
871 if (!isa<ParmVarDecl>(D)) { in VisitVarDecl()
872 Record.push_back(D->isExceptionVariable()); in VisitVarDecl()
873 Record.push_back(D->isNRVOVariable()); in VisitVarDecl()
874 Record.push_back(D->isCXXForRangeDecl()); in VisitVarDecl()
875 Record.push_back(D->isARCPseudoStrong()); in VisitVarDecl()
876 Record.push_back(D->isConstexpr()); in VisitVarDecl()
877 Record.push_back(D->isInitCapture()); in VisitVarDecl()
878 Record.push_back(D->isPreviousDeclInSameBlockScope()); in VisitVarDecl()
880 Record.push_back(D->getLinkageInternal()); in VisitVarDecl()
882 if (D->getInit()) { in VisitVarDecl()
883 Record.push_back(!D->isInitKnownICE() ? 1 : (D->isInitICE() ? 3 : 2)); in VisitVarDecl()
884 Writer.AddStmt(D->getInit()); in VisitVarDecl()
892 if (VarTemplateDecl *TemplD = D->getDescribedVarTemplate()) { in VisitVarDecl()
896 = D->getMemberSpecializationInfo()) { in VisitVarDecl()
905 if (D->getDeclContext() == D->getLexicalDeclContext() && in VisitVarDecl()
906 !D->hasAttrs() && in VisitVarDecl()
907 !D->isImplicit() && in VisitVarDecl()
908 !D->isUsed(false) && in VisitVarDecl()
909 !D->isInvalidDecl() && in VisitVarDecl()
910 !D->isReferenced() && in VisitVarDecl()
911 !D->isTopLevelDeclInObjCContainer() && in VisitVarDecl()
912 D->getAccess() == AS_none && in VisitVarDecl()
913 !D->isModulePrivate() && in VisitVarDecl()
914 !needsAnonymousDeclarationNumber(D) && in VisitVarDecl()
915 D->getDeclName().getNameKind() == DeclarationName::Identifier && in VisitVarDecl()
916 !D->hasExtInfo() && in VisitVarDecl()
917 D->getFirstDecl() == D->getMostRecentDecl() && in VisitVarDecl()
918 D->getInitStyle() == VarDecl::CInit && in VisitVarDecl()
919 D->getInit() == nullptr && in VisitVarDecl()
920 !isa<ParmVarDecl>(D) && in VisitVarDecl()
921 !isa<VarTemplateSpecializationDecl>(D) && in VisitVarDecl()
922 !D->isConstexpr() && in VisitVarDecl()
923 !D->isInitCapture() && in VisitVarDecl()
924 !D->isPreviousDeclInSameBlockScope() && in VisitVarDecl()
925 !D->getMemberSpecializationInfo()) in VisitVarDecl()
931 void ASTDeclWriter::VisitImplicitParamDecl(ImplicitParamDecl *D) { in VisitImplicitParamDecl() argument
932 VisitVarDecl(D); in VisitImplicitParamDecl()
936 void ASTDeclWriter::VisitParmVarDecl(ParmVarDecl *D) { in VisitParmVarDecl() argument
937 VisitVarDecl(D); in VisitParmVarDecl()
938 Record.push_back(D->isObjCMethodParameter()); in VisitParmVarDecl()
939 Record.push_back(D->getFunctionScopeDepth()); in VisitParmVarDecl()
940 Record.push_back(D->getFunctionScopeIndex()); in VisitParmVarDecl()
941 Record.push_back(D->getObjCDeclQualifier()); // FIXME: stable encoding in VisitParmVarDecl()
942 Record.push_back(D->isKNRPromoted()); in VisitParmVarDecl()
943 Record.push_back(D->hasInheritedDefaultArg()); in VisitParmVarDecl()
944 Record.push_back(D->hasUninstantiatedDefaultArg()); in VisitParmVarDecl()
945 if (D->hasUninstantiatedDefaultArg()) in VisitParmVarDecl()
946 Writer.AddStmt(D->getUninstantiatedDefaultArg()); in VisitParmVarDecl()
949 assert(!D->isARCPseudoStrong()); // can be true of ImplicitParamDecl in VisitParmVarDecl()
954 if (D->getDeclContext() == D->getLexicalDeclContext() && in VisitParmVarDecl()
955 !D->hasAttrs() && in VisitParmVarDecl()
956 !D->hasExtInfo() && in VisitParmVarDecl()
957 !D->isImplicit() && in VisitParmVarDecl()
958 !D->isUsed(false) && in VisitParmVarDecl()
959 !D->isInvalidDecl() && in VisitParmVarDecl()
960 !D->isReferenced() && in VisitParmVarDecl()
961 D->getAccess() == AS_none && in VisitParmVarDecl()
962 !D->isModulePrivate() && in VisitParmVarDecl()
963 D->getStorageClass() == 0 && in VisitParmVarDecl()
964 D->getInitStyle() == VarDecl::CInit && // Can params have anything else? in VisitParmVarDecl()
965 D->getFunctionScopeDepth() == 0 && in VisitParmVarDecl()
966 D->getObjCDeclQualifier() == 0 && in VisitParmVarDecl()
967 !D->isKNRPromoted() && in VisitParmVarDecl()
968 !D->hasInheritedDefaultArg() && in VisitParmVarDecl()
969 D->getInit() == nullptr && in VisitParmVarDecl()
970 !D->hasUninstantiatedDefaultArg()) // No default expr. in VisitParmVarDecl()
975 assert(!D->getTSCSpec() && "PARM_VAR_DECL can't use TLS"); in VisitParmVarDecl()
976 assert(D->getAccess() == AS_none && "PARM_VAR_DECL can't be public/private"); in VisitParmVarDecl()
977 assert(!D->isExceptionVariable() && "PARM_VAR_DECL can't be exception var"); in VisitParmVarDecl()
978 assert(D->getPreviousDecl() == nullptr && "PARM_VAR_DECL can't be redecl"); in VisitParmVarDecl()
979 assert(!D->isStaticDataMember() && in VisitParmVarDecl()
983 void ASTDeclWriter::VisitFileScopeAsmDecl(FileScopeAsmDecl *D) { in VisitFileScopeAsmDecl() argument
984 VisitDecl(D); in VisitFileScopeAsmDecl()
985 Writer.AddStmt(D->getAsmString()); in VisitFileScopeAsmDecl()
986 Writer.AddSourceLocation(D->getRParenLoc(), Record); in VisitFileScopeAsmDecl()
990 void ASTDeclWriter::VisitEmptyDecl(EmptyDecl *D) { in VisitEmptyDecl() argument
991 VisitDecl(D); in VisitEmptyDecl()
995 void ASTDeclWriter::VisitBlockDecl(BlockDecl *D) { in VisitBlockDecl() argument
996 VisitDecl(D); in VisitBlockDecl()
997 Writer.AddStmt(D->getBody()); in VisitBlockDecl()
998 Writer.AddTypeSourceInfo(D->getSignatureAsWritten(), Record); in VisitBlockDecl()
999 Record.push_back(D->param_size()); in VisitBlockDecl()
1000 for (FunctionDecl::param_iterator P = D->param_begin(), PEnd = D->param_end(); in VisitBlockDecl()
1003 Record.push_back(D->isVariadic()); in VisitBlockDecl()
1004 Record.push_back(D->blockMissingReturnType()); in VisitBlockDecl()
1005 Record.push_back(D->isConversionFromLambda()); in VisitBlockDecl()
1006 Record.push_back(D->capturesCXXThis()); in VisitBlockDecl()
1007 Record.push_back(D->getNumCaptures()); in VisitBlockDecl()
1008 for (const auto &capture : D->captures()) { in VisitBlockDecl()
1034 void ASTDeclWriter::VisitLinkageSpecDecl(LinkageSpecDecl *D) { in VisitLinkageSpecDecl() argument
1035 VisitDecl(D); in VisitLinkageSpecDecl()
1036 Record.push_back(D->getLanguage()); in VisitLinkageSpecDecl()
1037 Writer.AddSourceLocation(D->getExternLoc(), Record); in VisitLinkageSpecDecl()
1038 Writer.AddSourceLocation(D->getRBraceLoc(), Record); in VisitLinkageSpecDecl()
1042 void ASTDeclWriter::VisitLabelDecl(LabelDecl *D) { in VisitLabelDecl() argument
1043 VisitNamedDecl(D); in VisitLabelDecl()
1044 Writer.AddSourceLocation(D->getLocStart(), Record); in VisitLabelDecl()
1049 void ASTDeclWriter::VisitNamespaceDecl(NamespaceDecl *D) { in VisitNamespaceDecl() argument
1050 VisitRedeclarable(D); in VisitNamespaceDecl()
1051 VisitNamedDecl(D); in VisitNamespaceDecl()
1052 Record.push_back(D->isInline()); in VisitNamespaceDecl()
1053 Writer.AddSourceLocation(D->getLocStart(), Record); in VisitNamespaceDecl()
1054 Writer.AddSourceLocation(D->getRBraceLoc(), Record); in VisitNamespaceDecl()
1056 if (D->isOriginalNamespace()) in VisitNamespaceDecl()
1057 Writer.AddDeclRef(D->getAnonymousNamespace(), Record); in VisitNamespaceDecl()
1060 if (Writer.hasChain() && D->isAnonymousNamespace() && in VisitNamespaceDecl()
1061 D == D->getMostRecentDecl()) { in VisitNamespaceDecl()
1067 D->getParent()->getRedeclContext()->getPrimaryContext()); in VisitNamespaceDecl()
1070 ASTWriter::DeclUpdate(UPD_CXX_ADDED_ANONYMOUS_NAMESPACE, D)); in VisitNamespaceDecl()
1075 void ASTDeclWriter::VisitNamespaceAliasDecl(NamespaceAliasDecl *D) { in VisitNamespaceAliasDecl() argument
1076 VisitRedeclarable(D); in VisitNamespaceAliasDecl()
1077 VisitNamedDecl(D); in VisitNamespaceAliasDecl()
1078 Writer.AddSourceLocation(D->getNamespaceLoc(), Record); in VisitNamespaceAliasDecl()
1079 Writer.AddSourceLocation(D->getTargetNameLoc(), Record); in VisitNamespaceAliasDecl()
1080 Writer.AddNestedNameSpecifierLoc(D->getQualifierLoc(), Record); in VisitNamespaceAliasDecl()
1081 Writer.AddDeclRef(D->getNamespace(), Record); in VisitNamespaceAliasDecl()
1085 void ASTDeclWriter::VisitUsingDecl(UsingDecl *D) { in VisitUsingDecl() argument
1086 VisitNamedDecl(D); in VisitUsingDecl()
1087 Writer.AddSourceLocation(D->getUsingLoc(), Record); in VisitUsingDecl()
1088 Writer.AddNestedNameSpecifierLoc(D->getQualifierLoc(), Record); in VisitUsingDecl()
1089 Writer.AddDeclarationNameLoc(D->DNLoc, D->getDeclName(), Record); in VisitUsingDecl()
1090 Writer.AddDeclRef(D->FirstUsingShadow.getPointer(), Record); in VisitUsingDecl()
1091 Record.push_back(D->hasTypename()); in VisitUsingDecl()
1092 Writer.AddDeclRef(Context.getInstantiatedFromUsingDecl(D), Record); in VisitUsingDecl()
1096 void ASTDeclWriter::VisitUsingShadowDecl(UsingShadowDecl *D) { in VisitUsingShadowDecl() argument
1097 VisitRedeclarable(D); in VisitUsingShadowDecl()
1098 VisitNamedDecl(D); in VisitUsingShadowDecl()
1099 Writer.AddDeclRef(D->getTargetDecl(), Record); in VisitUsingShadowDecl()
1100 Writer.AddDeclRef(D->UsingOrNextShadow, Record); in VisitUsingShadowDecl()
1101 Writer.AddDeclRef(Context.getInstantiatedFromUsingShadowDecl(D), Record); in VisitUsingShadowDecl()
1105 void ASTDeclWriter::VisitUsingDirectiveDecl(UsingDirectiveDecl *D) { in VisitUsingDirectiveDecl() argument
1106 VisitNamedDecl(D); in VisitUsingDirectiveDecl()
1107 Writer.AddSourceLocation(D->getUsingLoc(), Record); in VisitUsingDirectiveDecl()
1108 Writer.AddSourceLocation(D->getNamespaceKeyLocation(), Record); in VisitUsingDirectiveDecl()
1109 Writer.AddNestedNameSpecifierLoc(D->getQualifierLoc(), Record); in VisitUsingDirectiveDecl()
1110 Writer.AddDeclRef(D->getNominatedNamespace(), Record); in VisitUsingDirectiveDecl()
1111 Writer.AddDeclRef(dyn_cast<Decl>(D->getCommonAncestor()), Record); in VisitUsingDirectiveDecl()
1115 void ASTDeclWriter::VisitUnresolvedUsingValueDecl(UnresolvedUsingValueDecl *D) { in VisitUnresolvedUsingValueDecl() argument
1116 VisitValueDecl(D); in VisitUnresolvedUsingValueDecl()
1117 Writer.AddSourceLocation(D->getUsingLoc(), Record); in VisitUnresolvedUsingValueDecl()
1118 Writer.AddNestedNameSpecifierLoc(D->getQualifierLoc(), Record); in VisitUnresolvedUsingValueDecl()
1119 Writer.AddDeclarationNameLoc(D->DNLoc, D->getDeclName(), Record); in VisitUnresolvedUsingValueDecl()
1124 UnresolvedUsingTypenameDecl *D) { in VisitUnresolvedUsingTypenameDecl() argument
1125 VisitTypeDecl(D); in VisitUnresolvedUsingTypenameDecl()
1126 Writer.AddSourceLocation(D->getTypenameLoc(), Record); in VisitUnresolvedUsingTypenameDecl()
1127 Writer.AddNestedNameSpecifierLoc(D->getQualifierLoc(), Record); in VisitUnresolvedUsingTypenameDecl()
1131 void ASTDeclWriter::VisitCXXRecordDecl(CXXRecordDecl *D) { in VisitCXXRecordDecl() argument
1132 VisitRecordDecl(D); in VisitCXXRecordDecl()
1137 if (ClassTemplateDecl *TemplD = D->getDescribedClassTemplate()) { in VisitCXXRecordDecl()
1141 = D->getMemberSpecializationInfo()) { in VisitCXXRecordDecl()
1150 Record.push_back(D->isThisDeclarationADefinition()); in VisitCXXRecordDecl()
1151 if (D->isThisDeclarationADefinition()) in VisitCXXRecordDecl()
1152 Writer.AddCXXDefinitionData(D, Record); in VisitCXXRecordDecl()
1156 if (D->IsCompleteDefinition) in VisitCXXRecordDecl()
1157 Writer.AddDeclRef(Context.getCurrentKeyFunction(D), Record); in VisitCXXRecordDecl()
1162 void ASTDeclWriter::VisitCXXMethodDecl(CXXMethodDecl *D) { in VisitCXXMethodDecl() argument
1163 VisitFunctionDecl(D); in VisitCXXMethodDecl()
1164 if (D->isCanonicalDecl()) { in VisitCXXMethodDecl()
1165 Record.push_back(D->size_overridden_methods()); in VisitCXXMethodDecl()
1167 I = D->begin_overridden_methods(), E = D->end_overridden_methods(); in VisitCXXMethodDecl()
1175 if (D->getDeclContext() == D->getLexicalDeclContext() && in VisitCXXMethodDecl()
1176 D->getFirstDecl() == D->getMostRecentDecl() && in VisitCXXMethodDecl()
1177 !D->isInvalidDecl() && in VisitCXXMethodDecl()
1178 !D->hasAttrs() && in VisitCXXMethodDecl()
1179 !D->isTopLevelDeclInObjCContainer() && in VisitCXXMethodDecl()
1180 D->getDeclName().getNameKind() == DeclarationName::Identifier && in VisitCXXMethodDecl()
1181 !D->hasExtInfo() && in VisitCXXMethodDecl()
1182 !D->hasInheritedPrototype() && in VisitCXXMethodDecl()
1183 D->hasWrittenPrototype()) in VisitCXXMethodDecl()
1189 void ASTDeclWriter::VisitCXXConstructorDecl(CXXConstructorDecl *D) { in VisitCXXConstructorDecl() argument
1190 VisitCXXMethodDecl(D); in VisitCXXConstructorDecl()
1192 Writer.AddDeclRef(D->getInheritedConstructor(), Record); in VisitCXXConstructorDecl()
1193 Record.push_back(D->IsExplicitSpecified); in VisitCXXConstructorDecl()
1198 void ASTDeclWriter::VisitCXXDestructorDecl(CXXDestructorDecl *D) { in VisitCXXDestructorDecl() argument
1199 VisitCXXMethodDecl(D); in VisitCXXDestructorDecl()
1201 Writer.AddDeclRef(D->getOperatorDelete(), Record); in VisitCXXDestructorDecl()
1206 void ASTDeclWriter::VisitCXXConversionDecl(CXXConversionDecl *D) { in VisitCXXConversionDecl() argument
1207 VisitCXXMethodDecl(D); in VisitCXXConversionDecl()
1208 Record.push_back(D->IsExplicitSpecified); in VisitCXXConversionDecl()
1212 void ASTDeclWriter::VisitImportDecl(ImportDecl *D) { in VisitImportDecl() argument
1213 VisitDecl(D); in VisitImportDecl()
1214 Record.push_back(Writer.getSubmoduleID(D->getImportedModule())); in VisitImportDecl()
1215 ArrayRef<SourceLocation> IdentifierLocs = D->getIdentifierLocs(); in VisitImportDecl()
1218 Writer.AddSourceLocation(D->getLocEnd(), Record); in VisitImportDecl()
1230 void ASTDeclWriter::VisitAccessSpecDecl(AccessSpecDecl *D) { in VisitAccessSpecDecl() argument
1231 VisitDecl(D); in VisitAccessSpecDecl()
1232 Writer.AddSourceLocation(D->getColonLoc(), Record); in VisitAccessSpecDecl()
1236 void ASTDeclWriter::VisitFriendDecl(FriendDecl *D) { in VisitFriendDecl() argument
1239 Record.push_back(D->NumTPLists); in VisitFriendDecl()
1240 VisitDecl(D); in VisitFriendDecl()
1241 bool hasFriendDecl = D->Friend.is<NamedDecl*>(); in VisitFriendDecl()
1244 Writer.AddDeclRef(D->getFriendDecl(), Record); in VisitFriendDecl()
1246 Writer.AddTypeSourceInfo(D->getFriendType(), Record); in VisitFriendDecl()
1247 for (unsigned i = 0; i < D->NumTPLists; ++i) in VisitFriendDecl()
1248 Writer.AddTemplateParameterList(D->getFriendTypeTemplateParameterList(i), in VisitFriendDecl()
1250 Writer.AddDeclRef(D->getNextFriend(), Record); in VisitFriendDecl()
1251 Record.push_back(D->UnsupportedFriend); in VisitFriendDecl()
1252 Writer.AddSourceLocation(D->FriendLoc, Record); in VisitFriendDecl()
1256 void ASTDeclWriter::VisitFriendTemplateDecl(FriendTemplateDecl *D) { in VisitFriendTemplateDecl() argument
1257 VisitDecl(D); in VisitFriendTemplateDecl()
1258 Record.push_back(D->getNumTemplateParameters()); in VisitFriendTemplateDecl()
1259 for (unsigned i = 0, e = D->getNumTemplateParameters(); i != e; ++i) in VisitFriendTemplateDecl()
1260 Writer.AddTemplateParameterList(D->getTemplateParameterList(i), Record); in VisitFriendTemplateDecl()
1261 Record.push_back(D->getFriendDecl() != nullptr); in VisitFriendTemplateDecl()
1262 if (D->getFriendDecl()) in VisitFriendTemplateDecl()
1263 Writer.AddDeclRef(D->getFriendDecl(), Record); in VisitFriendTemplateDecl()
1265 Writer.AddTypeSourceInfo(D->getFriendType(), Record); in VisitFriendTemplateDecl()
1266 Writer.AddSourceLocation(D->getFriendLoc(), Record); in VisitFriendTemplateDecl()
1270 void ASTDeclWriter::VisitTemplateDecl(TemplateDecl *D) { in VisitTemplateDecl() argument
1271 VisitNamedDecl(D); in VisitTemplateDecl()
1273 Writer.AddDeclRef(D->getTemplatedDecl(), Record); in VisitTemplateDecl()
1274 Writer.AddTemplateParameterList(D->getTemplateParameters(), Record); in VisitTemplateDecl()
1277 void ASTDeclWriter::VisitRedeclarableTemplateDecl(RedeclarableTemplateDecl *D) { in VisitRedeclarableTemplateDecl() argument
1278 VisitRedeclarable(D); in VisitRedeclarableTemplateDecl()
1282 if (D->isFirstDecl()) { in VisitRedeclarableTemplateDecl()
1284 Writer.AddDeclRef(D->getInstantiatedFromMemberTemplate(), Record); in VisitRedeclarableTemplateDecl()
1285 if (D->getInstantiatedFromMemberTemplate()) in VisitRedeclarableTemplateDecl()
1286 Record.push_back(D->isMemberSpecialization()); in VisitRedeclarableTemplateDecl()
1289 VisitTemplateDecl(D); in VisitRedeclarableTemplateDecl()
1290 Record.push_back(D->getIdentifierNamespace()); in VisitRedeclarableTemplateDecl()
1293 void ASTDeclWriter::VisitClassTemplateDecl(ClassTemplateDecl *D) { in VisitClassTemplateDecl() argument
1294 VisitRedeclarableTemplateDecl(D); in VisitClassTemplateDecl()
1296 if (D->isFirstDecl()) in VisitClassTemplateDecl()
1297 AddTemplateSpecializations(D); in VisitClassTemplateDecl()
1302 ClassTemplateSpecializationDecl *D) { in VisitClassTemplateSpecializationDecl() argument
1303 RegisterTemplateSpecialization(D->getSpecializedTemplate(), D); in VisitClassTemplateSpecializationDecl()
1305 VisitCXXRecordDecl(D); in VisitClassTemplateSpecializationDecl()
1309 = D->getSpecializedTemplateOrPartial(); in VisitClassTemplateSpecializationDecl()
1315 Writer.AddTemplateArgumentList(&D->getTemplateInstantiationArgs(), Record); in VisitClassTemplateSpecializationDecl()
1318 Writer.AddTemplateArgumentList(&D->getTemplateArgs(), Record); in VisitClassTemplateSpecializationDecl()
1319 Writer.AddSourceLocation(D->getPointOfInstantiation(), Record); in VisitClassTemplateSpecializationDecl()
1320 Record.push_back(D->getSpecializationKind()); in VisitClassTemplateSpecializationDecl()
1321 Record.push_back(D->isCanonicalDecl()); in VisitClassTemplateSpecializationDecl()
1323 if (D->isCanonicalDecl()) { in VisitClassTemplateSpecializationDecl()
1325 Writer.AddDeclRef(D->getSpecializedTemplate()->getCanonicalDecl(), Record); in VisitClassTemplateSpecializationDecl()
1329 Writer.AddTypeSourceInfo(D->getTypeAsWritten(), Record); in VisitClassTemplateSpecializationDecl()
1330 if (D->getTypeAsWritten()) { in VisitClassTemplateSpecializationDecl()
1331 Writer.AddSourceLocation(D->getExternLoc(), Record); in VisitClassTemplateSpecializationDecl()
1332 Writer.AddSourceLocation(D->getTemplateKeywordLoc(), Record); in VisitClassTemplateSpecializationDecl()
1339 ClassTemplatePartialSpecializationDecl *D) { in VisitClassTemplatePartialSpecializationDecl() argument
1340 VisitClassTemplateSpecializationDecl(D); in VisitClassTemplatePartialSpecializationDecl()
1342 Writer.AddTemplateParameterList(D->getTemplateParameters(), Record); in VisitClassTemplatePartialSpecializationDecl()
1343 Writer.AddASTTemplateArgumentListInfo(D->getTemplateArgsAsWritten(), Record); in VisitClassTemplatePartialSpecializationDecl()
1346 if (D->getPreviousDecl() == nullptr) { in VisitClassTemplatePartialSpecializationDecl()
1347 Writer.AddDeclRef(D->getInstantiatedFromMember(), Record); in VisitClassTemplatePartialSpecializationDecl()
1348 Record.push_back(D->isMemberSpecialization()); in VisitClassTemplatePartialSpecializationDecl()
1354 void ASTDeclWriter::VisitVarTemplateDecl(VarTemplateDecl *D) { in VisitVarTemplateDecl() argument
1355 VisitRedeclarableTemplateDecl(D); in VisitVarTemplateDecl()
1357 if (D->isFirstDecl()) in VisitVarTemplateDecl()
1358 AddTemplateSpecializations(D); in VisitVarTemplateDecl()
1363 VarTemplateSpecializationDecl *D) { in VisitVarTemplateSpecializationDecl() argument
1364 RegisterTemplateSpecialization(D->getSpecializedTemplate(), D); in VisitVarTemplateSpecializationDecl()
1366 VisitVarDecl(D); in VisitVarTemplateSpecializationDecl()
1369 InstFrom = D->getSpecializedTemplateOrPartial(); in VisitVarTemplateSpecializationDecl()
1375 Writer.AddTemplateArgumentList(&D->getTemplateInstantiationArgs(), Record); in VisitVarTemplateSpecializationDecl()
1379 Writer.AddTypeSourceInfo(D->getTypeAsWritten(), Record); in VisitVarTemplateSpecializationDecl()
1380 if (D->getTypeAsWritten()) { in VisitVarTemplateSpecializationDecl()
1381 Writer.AddSourceLocation(D->getExternLoc(), Record); in VisitVarTemplateSpecializationDecl()
1382 Writer.AddSourceLocation(D->getTemplateKeywordLoc(), Record); in VisitVarTemplateSpecializationDecl()
1385 Writer.AddTemplateArgumentList(&D->getTemplateArgs(), Record); in VisitVarTemplateSpecializationDecl()
1386 Writer.AddSourceLocation(D->getPointOfInstantiation(), Record); in VisitVarTemplateSpecializationDecl()
1387 Record.push_back(D->getSpecializationKind()); in VisitVarTemplateSpecializationDecl()
1388 Record.push_back(D->isCanonicalDecl()); in VisitVarTemplateSpecializationDecl()
1390 if (D->isCanonicalDecl()) { in VisitVarTemplateSpecializationDecl()
1392 Writer.AddDeclRef(D->getSpecializedTemplate()->getCanonicalDecl(), Record); in VisitVarTemplateSpecializationDecl()
1399 VarTemplatePartialSpecializationDecl *D) { in VisitVarTemplatePartialSpecializationDecl() argument
1400 VisitVarTemplateSpecializationDecl(D); in VisitVarTemplatePartialSpecializationDecl()
1402 Writer.AddTemplateParameterList(D->getTemplateParameters(), Record); in VisitVarTemplatePartialSpecializationDecl()
1403 Writer.AddASTTemplateArgumentListInfo(D->getTemplateArgsAsWritten(), Record); in VisitVarTemplatePartialSpecializationDecl()
1406 if (D->getPreviousDecl() == nullptr) { in VisitVarTemplatePartialSpecializationDecl()
1407 Writer.AddDeclRef(D->getInstantiatedFromMember(), Record); in VisitVarTemplatePartialSpecializationDecl()
1408 Record.push_back(D->isMemberSpecialization()); in VisitVarTemplatePartialSpecializationDecl()
1415 ClassScopeFunctionSpecializationDecl *D) { in VisitClassScopeFunctionSpecializationDecl() argument
1416 VisitDecl(D); in VisitClassScopeFunctionSpecializationDecl()
1417 Writer.AddDeclRef(D->getSpecialization(), Record); in VisitClassScopeFunctionSpecializationDecl()
1422 void ASTDeclWriter::VisitFunctionTemplateDecl(FunctionTemplateDecl *D) { in VisitFunctionTemplateDecl() argument
1423 VisitRedeclarableTemplateDecl(D); in VisitFunctionTemplateDecl()
1425 if (D->isFirstDecl()) in VisitFunctionTemplateDecl()
1426 AddTemplateSpecializations(D); in VisitFunctionTemplateDecl()
1430 void ASTDeclWriter::VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D) { in VisitTemplateTypeParmDecl() argument
1431 VisitTypeDecl(D); in VisitTemplateTypeParmDecl()
1433 Record.push_back(D->wasDeclaredWithTypename()); in VisitTemplateTypeParmDecl()
1435 bool OwnsDefaultArg = D->hasDefaultArgument() && in VisitTemplateTypeParmDecl()
1436 !D->defaultArgumentWasInherited(); in VisitTemplateTypeParmDecl()
1439 Writer.AddTypeSourceInfo(D->getDefaultArgumentInfo(), Record); in VisitTemplateTypeParmDecl()
1444 void ASTDeclWriter::VisitNonTypeTemplateParmDecl(NonTypeTemplateParmDecl *D) { in VisitNonTypeTemplateParmDecl() argument
1448 if (D->isExpandedParameterPack()) in VisitNonTypeTemplateParmDecl()
1449 Record.push_back(D->getNumExpansionTypes()); in VisitNonTypeTemplateParmDecl()
1451 VisitDeclaratorDecl(D); in VisitNonTypeTemplateParmDecl()
1453 Record.push_back(D->getDepth()); in VisitNonTypeTemplateParmDecl()
1454 Record.push_back(D->getPosition()); in VisitNonTypeTemplateParmDecl()
1456 if (D->isExpandedParameterPack()) { in VisitNonTypeTemplateParmDecl()
1457 for (unsigned I = 0, N = D->getNumExpansionTypes(); I != N; ++I) { in VisitNonTypeTemplateParmDecl()
1458 Writer.AddTypeRef(D->getExpansionType(I), Record); in VisitNonTypeTemplateParmDecl()
1459 Writer.AddTypeSourceInfo(D->getExpansionTypeSourceInfo(I), Record); in VisitNonTypeTemplateParmDecl()
1465 Record.push_back(D->isParameterPack()); in VisitNonTypeTemplateParmDecl()
1466 bool OwnsDefaultArg = D->hasDefaultArgument() && in VisitNonTypeTemplateParmDecl()
1467 !D->defaultArgumentWasInherited(); in VisitNonTypeTemplateParmDecl()
1470 Writer.AddStmt(D->getDefaultArgument()); in VisitNonTypeTemplateParmDecl()
1475 void ASTDeclWriter::VisitTemplateTemplateParmDecl(TemplateTemplateParmDecl *D) { in VisitTemplateTemplateParmDecl() argument
1479 if (D->isExpandedParameterPack()) in VisitTemplateTemplateParmDecl()
1480 Record.push_back(D->getNumExpansionTemplateParameters()); in VisitTemplateTemplateParmDecl()
1482 VisitTemplateDecl(D); in VisitTemplateTemplateParmDecl()
1484 Record.push_back(D->getDepth()); in VisitTemplateTemplateParmDecl()
1485 Record.push_back(D->getPosition()); in VisitTemplateTemplateParmDecl()
1487 if (D->isExpandedParameterPack()) { in VisitTemplateTemplateParmDecl()
1488 for (unsigned I = 0, N = D->getNumExpansionTemplateParameters(); in VisitTemplateTemplateParmDecl()
1490 Writer.AddTemplateParameterList(D->getExpansionTemplateParameters(I), in VisitTemplateTemplateParmDecl()
1495 Record.push_back(D->isParameterPack()); in VisitTemplateTemplateParmDecl()
1496 bool OwnsDefaultArg = D->hasDefaultArgument() && in VisitTemplateTemplateParmDecl()
1497 !D->defaultArgumentWasInherited(); in VisitTemplateTemplateParmDecl()
1500 Writer.AddTemplateArgumentLoc(D->getDefaultArgument(), Record); in VisitTemplateTemplateParmDecl()
1505 void ASTDeclWriter::VisitTypeAliasTemplateDecl(TypeAliasTemplateDecl *D) { in VisitTypeAliasTemplateDecl() argument
1506 VisitRedeclarableTemplateDecl(D); in VisitTypeAliasTemplateDecl()
1510 void ASTDeclWriter::VisitStaticAssertDecl(StaticAssertDecl *D) { in VisitStaticAssertDecl() argument
1511 VisitDecl(D); in VisitStaticAssertDecl()
1512 Writer.AddStmt(D->getAssertExpr()); in VisitStaticAssertDecl()
1513 Record.push_back(D->isFailed()); in VisitStaticAssertDecl()
1514 Writer.AddStmt(D->getMessage()); in VisitStaticAssertDecl()
1515 Writer.AddSourceLocation(D->getRParenLoc(), Record); in VisitStaticAssertDecl()
1536 const Decl *ASTWriter::getFirstLocalDecl(const Decl *D) { in getFirstLocalDecl() argument
1540 auto IsLocalDecl = [&](const Decl *D) -> bool { in getFirstLocalDecl() argument
1541 if (D->isFromASTFile()) in getFirstLocalDecl()
1543 auto I = DeclIDs.find(D); in getFirstLocalDecl()
1547 assert(IsLocalDecl(D) && "expected a local declaration"); in getFirstLocalDecl()
1549 const Decl *Canon = D->getCanonicalDecl(); in getFirstLocalDecl()
1557 for (const Decl *Redecl = D; Redecl; Redecl = Redecl->getPreviousDecl()) in getFirstLocalDecl()
1559 D = Redecl; in getFirstLocalDecl()
1560 return CacheEntry = D; in getFirstLocalDecl()
1564 void ASTDeclWriter::VisitRedeclarable(Redeclarable<T> *D) { in VisitRedeclarable() argument
1565 T *First = D->getFirstDecl(); in VisitRedeclarable()
1567 T *DAsT = static_cast<T *>(D); in VisitRedeclarable()
1615 (void)Writer.GetDeclRef(D->getPreviousDecl()); in VisitRedeclarable()
1623 void ASTDeclWriter::VisitOMPThreadPrivateDecl(OMPThreadPrivateDecl *D) { in VisitOMPThreadPrivateDecl() argument
1624 Record.push_back(D->varlist_size()); in VisitOMPThreadPrivateDecl()
1625 VisitDecl(D); in VisitOMPThreadPrivateDecl()
1626 for (auto *I : D->varlists()) in VisitOMPThreadPrivateDecl()
2080 static bool isRequiredDecl(const Decl *D, ASTContext &Context, in isRequiredDecl() argument
2086 if (isa<FileScopeAsmDecl>(D) || isa<ObjCImplDecl>(D)) in isRequiredDecl()
2092 if (isa<ImportDecl>(D) && !WritingModule) in isRequiredDecl()
2095 return Context.DeclMustBeEmitted(D); in isRequiredDecl()
2098 void ASTWriter::WriteDecl(ASTContext &Context, Decl *D) { in WriteDecl() argument
2107 assert(!D->isFromASTFile() && "should not be emitting imported decl"); in WriteDecl()
2108 serialization::DeclID &IDR = DeclIDs[D]; in WriteDecl()
2123 DeclContext *DC = dyn_cast<DeclContext>(D); in WriteDecl()
2141 W.Visit(D); in WriteDecl()
2147 D->getLocation())); in WriteDecl()
2152 SourceLocation Loc = D->getLocation(); in WriteDecl()
2163 associateDeclWithFile(D, ID); in WriteDecl()
2168 D->getDeclKindName() + "'"); in WriteDecl()
2177 if (isRequiredDecl(D, Context, WritingModule)) in WriteDecl()