This revision was automatically updated to reflect the committed changes. Closed by commit rG2deebc0048f9: [RFC] Add and sort decl to maintain order instead of inserting in order (authored by kuganv, committed by ivanmurashko). Herald added a project: clang. Herald added a subscriber: cfe-commits.
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124840/new/ https://reviews.llvm.org/D124840 Files: clang/lib/Serialization/ASTWriter.cpp Index: clang/lib/Serialization/ASTWriter.cpp =================================================================== --- clang/lib/Serialization/ASTWriter.cpp +++ clang/lib/Serialization/ASTWriter.cpp @@ -3114,6 +3114,7 @@ for (auto &FileDeclEntry : SortedFileDeclIDs) { DeclIDInFileInfo &Info = *FileDeclEntry.second; Info.FirstDeclIndex = FileGroupedDeclIDs.size(); + llvm::stable_sort(Info.DeclIDs); for (auto &LocDeclEntry : Info.DeclIDs) FileGroupedDeclIDs.push_back(LocDeclEntry.second); } @@ -5462,16 +5463,7 @@ std::pair<unsigned, serialization::DeclID> LocDecl(Offset, ID); LocDeclIDsTy &Decls = Info->DeclIDs; - - if (Decls.empty() || Decls.back().first <= Offset) { - Decls.push_back(LocDecl); - return; - } - - LocDeclIDsTy::iterator I = - llvm::upper_bound(Decls, LocDecl, llvm::less_first()); - - Decls.insert(I, LocDecl); + Decls.push_back(LocDecl); } unsigned ASTWriter::getAnonymousDeclarationNumber(const NamedDecl *D) {
Index: clang/lib/Serialization/ASTWriter.cpp =================================================================== --- clang/lib/Serialization/ASTWriter.cpp +++ clang/lib/Serialization/ASTWriter.cpp @@ -3114,6 +3114,7 @@ for (auto &FileDeclEntry : SortedFileDeclIDs) { DeclIDInFileInfo &Info = *FileDeclEntry.second; Info.FirstDeclIndex = FileGroupedDeclIDs.size(); + llvm::stable_sort(Info.DeclIDs); for (auto &LocDeclEntry : Info.DeclIDs) FileGroupedDeclIDs.push_back(LocDeclEntry.second); } @@ -5462,16 +5463,7 @@ std::pair<unsigned, serialization::DeclID> LocDecl(Offset, ID); LocDeclIDsTy &Decls = Info->DeclIDs; - - if (Decls.empty() || Decls.back().first <= Offset) { - Decls.push_back(LocDecl); - return; - } - - LocDeclIDsTy::iterator I = - llvm::upper_bound(Decls, LocDecl, llvm::less_first()); - - Decls.insert(I, LocDecl); + Decls.push_back(LocDecl); } unsigned ASTWriter::getAnonymousDeclarationNumber(const NamedDecl *D) {
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits