@@ -613,7 +613,7 @@ void ASTDeclReader::VisitDecl(Decl *D) {
613613
614614 if (HasAttrs) {
615615 AttrVec Attrs;
616- Record.readAttributes (Attrs, D );
616+ Record.readAttributes (Attrs);
617617 // Avoid calling setAttrs() directly because it uses Decl::getASTContext()
618618 // internally which is unsafe during derialization.
619619 D->setAttrsImpl (Attrs, Reader.getContext ());
@@ -3098,8 +3098,6 @@ class AttrReader {
30983098 return Reader.readInt ();
30993099 }
31003100
3101- uint64_t peekInts (unsigned N) { return Reader.peekInts (N); }
3102-
31033101 bool readBool () { return Reader.readBool (); }
31043102
31053103 SourceRange readSourceRange () {
@@ -3130,29 +3128,18 @@ class AttrReader {
31303128 return Reader.readVersionTuple ();
31313129 }
31323130
3133- void skipInt () { Reader.skipInts (1 ); }
3134-
3135- void skipInts (unsigned N) { Reader.skipInts (N); }
3136-
3137- unsigned getCurrentIdx () { return Reader.getIdx (); }
3138-
31393131 OMPTraitInfo *readOMPTraitInfo () { return Reader.readOMPTraitInfo (); }
31403132
31413133 template <typename T> T *readDeclAs () { return Reader.readDeclAs <T>(); }
31423134};
31433135}
31443136
3145- // / Reads one attribute from the current stream position, advancing Idx.
31463137Attr *ASTRecordReader::readAttr () {
31473138 AttrReader Record (*this );
31483139 auto V = Record.readInt ();
31493140 if (!V)
31503141 return nullptr ;
31513142
3152- // Read and ignore the skip count, since attribute deserialization is not
3153- // deferred on this pass.
3154- Record.skipInt ();
3155-
31563143 Attr *New = nullptr ;
31573144 // Kind is stored as a 1-based integer because 0 is used to indicate a null
31583145 // Attr pointer.
@@ -3182,28 +3169,13 @@ Attr *ASTRecordReader::readAttr() {
31823169 return New;
31833170}
31843171
3185- // / Reads attributes from the current stream position, advancing Idx.
3186- // / For some attributes (where type depends on itself recursively), defer
3187- // / reading the attribute until the type has been read.
3188- void ASTRecordReader::readAttributes (AttrVec &Attrs, Decl *D) {
3172+ // / Reads attributes from the current stream position.
3173+ void ASTRecordReader::readAttributes (AttrVec &Attrs) {
31893174 for (unsigned I = 0 , E = readInt (); I != E; ++I)
3190- if (auto *A = readOrDeferAttrFor (D ))
3175+ if (auto *A = readAttr ( ))
31913176 Attrs.push_back (A);
31923177}
31933178
3194- // / Reads one attribute from the current stream position, advancing Idx.
3195- // / For some attributes (where type depends on itself recursively), defer
3196- // / reading the attribute until the type has been read.
3197- Attr *ASTRecordReader::readOrDeferAttrFor (Decl *D) {
3198- AttrReader Record (*this );
3199- unsigned SkipCount = Record.peekInts (1 );
3200- if (!SkipCount)
3201- return readAttr ();
3202- Reader->PendingDeferredAttributes .push_back ({Record.getCurrentIdx (), D});
3203- Record.skipInts (SkipCount);
3204- return nullptr ;
3205- }
3206-
32073179// ===----------------------------------------------------------------------===//
32083180// ASTReader Implementation
32093181// ===----------------------------------------------------------------------===//
@@ -4512,49 +4484,6 @@ void ASTReader::loadPendingDeclChain(Decl *FirstLocal, uint64_t LocalOffset) {
45124484 ASTDeclReader::attachLatestDecl (CanonDecl, MostRecent);
45134485}
45144486
4515- void ASTReader::loadDeferredAttribute (const DeferredAttribute &DA) {
4516- Decl *D = DA.TargetedDecl ;
4517- ModuleFile *M = getOwningModuleFile (D);
4518-
4519- unsigned LocalDeclIndex = D->getGlobalID ().getLocalDeclIndex ();
4520- const DeclOffset &DOffs = M->DeclOffsets [LocalDeclIndex];
4521- RecordLocation Loc (M, DOffs.getBitOffset (M->DeclsBlockStartOffset ));
4522-
4523- llvm::BitstreamCursor &Cursor = Loc.F ->DeclsCursor ;
4524- SavedStreamPosition SavedPosition (Cursor);
4525- if (llvm::Error Err = Cursor.JumpToBit (Loc.Offset )) {
4526- Error (std::move (Err));
4527- }
4528-
4529- Expected<unsigned > MaybeCode = Cursor.ReadCode ();
4530- if (!MaybeCode) {
4531- llvm::report_fatal_error (
4532- Twine (" ASTReader::loadPreferredNameAttribute failed reading code: " ) +
4533- toString (MaybeCode.takeError ()));
4534- }
4535- unsigned Code = MaybeCode.get ();
4536-
4537- ASTRecordReader Record (*this , *Loc.F );
4538- Expected<unsigned > MaybeRecCode = Record.readRecord (Cursor, Code);
4539- if (!MaybeRecCode) {
4540- llvm::report_fatal_error (
4541- Twine (
4542- " ASTReader::loadPreferredNameAttribute failed reading rec code: " ) +
4543- toString (MaybeCode.takeError ()));
4544- }
4545- unsigned RecCode = MaybeRecCode.get ();
4546- if (RecCode < DECL_TYPEDEF || RecCode > DECL_LAST) {
4547- llvm::report_fatal_error (
4548- Twine (" ASTReader::loadPreferredNameAttribute failed reading rec code: "
4549- " expected valid DeclCode" ) +
4550- toString (MaybeCode.takeError ()));
4551- }
4552-
4553- Record.skipInts (DA.RecordIdx );
4554- Attr *A = Record.readAttr ();
4555- getContext ().getDeclAttrs (D).push_back (A);
4556- }
4557-
45584487namespace {
45594488
45604489 // / Given an ObjC interface, goes through the modules and links to the
0 commit comments