@@ -584,7 +584,18 @@ void ASTDeclReader::Visit(Decl *D) {
584
584
585
585
void ASTDeclReader::VisitDecl (Decl *D) {
586
586
BitsUnpacker DeclBits (Record.readInt ());
587
+ auto ModuleOwnership =
588
+ (Decl::ModuleOwnershipKind)DeclBits.getNextBits (/* Width=*/ 3 );
589
+ D->setReferenced (DeclBits.getNextBit ());
590
+ D->Used = DeclBits.getNextBit ();
591
+ IsDeclMarkedUsed |= D->Used ;
592
+ D->setAccess ((AccessSpecifier)DeclBits.getNextBits (/* Width=*/ 2 ));
593
+ D->setImplicit (DeclBits.getNextBit ());
587
594
bool HasStandaloneLexicalDC = DeclBits.getNextBit ();
595
+ bool HasAttrs = DeclBits.getNextBit ();
596
+ D->setTopLevelDeclInObjCContainer (DeclBits.getNextBit ());
597
+ D->InvalidDecl = DeclBits.getNextBit ();
598
+ D->FromASTFile = true ;
588
599
589
600
if (D->isTemplateParameter () || D->isTemplateParameterPack () ||
590
601
isa<ParmVarDecl, ObjCTypeParamDecl>(D)) {
@@ -623,20 +634,6 @@ void ASTDeclReader::VisitDecl(Decl *D) {
623
634
}
624
635
D->setLocation (ThisDeclLoc);
625
636
626
- D->InvalidDecl = DeclBits.getNextBit ();
627
- bool HasAttrs = DeclBits.getNextBit ();
628
- D->setImplicit (DeclBits.getNextBit ());
629
- D->Used = DeclBits.getNextBit ();
630
- IsDeclMarkedUsed |= D->Used ;
631
- D->setReferenced (DeclBits.getNextBit ());
632
- D->setTopLevelDeclInObjCContainer (DeclBits.getNextBit ());
633
- D->setAccess ((AccessSpecifier)DeclBits.getNextBits (/* Width=*/ 2 ));
634
- D->FromASTFile = true ;
635
- auto ModuleOwnership =
636
- (Decl::ModuleOwnershipKind)DeclBits.getNextBits (/* Width=*/ 3 );
637
- bool ModulePrivate =
638
- (ModuleOwnership == Decl::ModuleOwnershipKind::ModulePrivate);
639
-
640
637
if (HasAttrs) {
641
638
AttrVec Attrs;
642
639
Record.readAttributes (Attrs);
@@ -647,8 +644,9 @@ void ASTDeclReader::VisitDecl(Decl *D) {
647
644
648
645
// Determine whether this declaration is part of a (sub)module. If so, it
649
646
// may not yet be visible.
647
+ bool ModulePrivate =
648
+ (ModuleOwnership == Decl::ModuleOwnershipKind::ModulePrivate);
650
649
if (unsigned SubmoduleID = readSubmoduleID ()) {
651
-
652
650
switch (ModuleOwnership) {
653
651
case Decl::ModuleOwnershipKind::Visible:
654
652
ModuleOwnership = Decl::ModuleOwnershipKind::VisibleWhenImported;
@@ -1065,9 +1063,11 @@ void ASTDeclReader::VisitFunctionDecl(FunctionDecl *FD) {
1065
1063
// after everything else is read.
1066
1064
BitsUnpacker FunctionDeclBits (Record.readInt ());
1067
1065
1066
+ FD->setCachedLinkage ((Linkage)FunctionDeclBits.getNextBits (/* Width=*/ 3 ));
1068
1067
FD->setStorageClass ((StorageClass)FunctionDeclBits.getNextBits (/* Width=*/ 3 ));
1069
1068
FD->setInlineSpecified (FunctionDeclBits.getNextBit ());
1070
1069
FD->setImplicitlyInline (FunctionDeclBits.getNextBit ());
1070
+ FD->setHasSkippedBody (FunctionDeclBits.getNextBit ());
1071
1071
FD->setVirtualAsWritten (FunctionDeclBits.getNextBit ());
1072
1072
// We defer calling `FunctionDecl::setPure()` here as for methods of
1073
1073
// `CXXTemplateSpecializationDecl`s, we may not have connected up the
@@ -1081,16 +1081,14 @@ void ASTDeclReader::VisitFunctionDecl(FunctionDecl *FD) {
1081
1081
FD->setDefaulted (FunctionDeclBits.getNextBit ());
1082
1082
FD->setExplicitlyDefaulted (FunctionDeclBits.getNextBit ());
1083
1083
FD->setIneligibleOrNotSelected (FunctionDeclBits.getNextBit ());
1084
- FD->setHasImplicitReturnZero (FunctionDeclBits.getNextBit ());
1085
1084
FD->setConstexprKind (
1086
1085
(ConstexprSpecKind)FunctionDeclBits.getNextBits (/* Width=*/ 2 ));
1087
- FD->setUsesSEHTry (FunctionDeclBits.getNextBit ());
1088
- FD->setHasSkippedBody (FunctionDeclBits.getNextBit ());
1086
+ FD->setHasImplicitReturnZero (FunctionDeclBits.getNextBit ());
1089
1087
FD->setIsMultiVersion (FunctionDeclBits.getNextBit ());
1090
1088
FD->setLateTemplateParsed (FunctionDeclBits.getNextBit ());
1091
1089
FD->setFriendConstraintRefersToEnclosingTemplate (
1092
1090
FunctionDeclBits.getNextBit ());
1093
- FD->setCachedLinkage ((Linkage) FunctionDeclBits.getNextBits ( /* Width= */ 3 ));
1091
+ FD->setUsesSEHTry ( FunctionDeclBits.getNextBit ( ));
1094
1092
1095
1093
FD->EndRangeLoc = readSourceLocation ();
1096
1094
if (FD->isExplicitlyDefaulted ())
@@ -1597,6 +1595,8 @@ ASTDeclReader::RedeclarableResult ASTDeclReader::VisitVarDeclImpl(VarDecl *VD) {
1597
1595
VisitDeclaratorDecl (VD);
1598
1596
1599
1597
BitsUnpacker VarDeclBits (Record.readInt ());
1598
+ auto VarLinkage = Linkage (VarDeclBits.getNextBits (/* Width=*/ 3 ));
1599
+ bool DefGeneratedInModule = VarDeclBits.getNextBit ();
1600
1600
VD->VarDeclBits .SClass = (StorageClass)VarDeclBits.getNextBits (/* Width=*/ 3 );
1601
1601
VD->VarDeclBits .TSCSpec = VarDeclBits.getNextBits (/* Width=*/ 2 );
1602
1602
VD->VarDeclBits .InitStyle = VarDeclBits.getNextBits (/* Width=*/ 2 );
@@ -1608,17 +1608,20 @@ ASTDeclReader::RedeclarableResult ASTDeclReader::VisitVarDeclImpl(VarDecl *VD) {
1608
1608
VD->NonParmVarDeclBits .ExceptionVar = VarDeclBits.getNextBit ();
1609
1609
VD->NonParmVarDeclBits .NRVOVariable = VarDeclBits.getNextBit ();
1610
1610
VD->NonParmVarDeclBits .CXXForRangeDecl = VarDeclBits.getNextBit ();
1611
- VD-> NonParmVarDeclBits . ObjCForDecl = VarDeclBits. getNextBit ();
1611
+
1612
1612
VD->NonParmVarDeclBits .IsInline = VarDeclBits.getNextBit ();
1613
1613
VD->NonParmVarDeclBits .IsInlineSpecified = VarDeclBits.getNextBit ();
1614
1614
VD->NonParmVarDeclBits .IsConstexpr = VarDeclBits.getNextBit ();
1615
1615
VD->NonParmVarDeclBits .IsInitCapture = VarDeclBits.getNextBit ();
1616
1616
VD->NonParmVarDeclBits .PreviousDeclInSameBlockScope =
1617
1617
VarDeclBits.getNextBit ();
1618
- VD->NonParmVarDeclBits .ImplicitParamKind =
1619
- VarDeclBits.getNextBits (/* Width*/ 3 );
1618
+
1620
1619
VD->NonParmVarDeclBits .EscapingByref = VarDeclBits.getNextBit ();
1621
1620
HasDeducedType = VarDeclBits.getNextBit ();
1621
+ VD->NonParmVarDeclBits .ImplicitParamKind =
1622
+ VarDeclBits.getNextBits (/* Width*/ 3 );
1623
+
1624
+ VD->NonParmVarDeclBits .ObjCForDecl = VarDeclBits.getNextBit ();
1622
1625
}
1623
1626
1624
1627
// If this variable has a deduced type, defer reading that type until we are
@@ -1630,15 +1633,14 @@ ASTDeclReader::RedeclarableResult ASTDeclReader::VisitVarDeclImpl(VarDecl *VD) {
1630
1633
VD->setType (Reader.GetType (DeferredTypeID));
1631
1634
DeferredTypeID = 0 ;
1632
1635
1633
- auto VarLinkage = Linkage (VarDeclBits.getNextBits (/* Width=*/ 3 ));
1634
1636
VD->setCachedLinkage (VarLinkage);
1635
1637
1636
1638
// Reconstruct the one piece of the IdentifierNamespace that we need.
1637
1639
if (VD->getStorageClass () == SC_Extern && VarLinkage != Linkage::None &&
1638
1640
VD->getLexicalDeclContext ()->isFunctionOrMethod ())
1639
1641
VD->setLocalExternDecl ();
1640
1642
1641
- if (VarDeclBits. getNextBit () ) {
1643
+ if (DefGeneratedInModule ) {
1642
1644
Reader.DefinitionSource [VD] =
1643
1645
Loc.F ->Kind == ModuleKind::MK_MainFile ||
1644
1646
Reader.getContext ().getLangOpts ().BuildingPCHWithObjectFile ;
0 commit comments