From 52ca678d7464cf6d85393794558297411d7eeaf0 Mon Sep 17 00:00:00 2001 From: Ben Langmuir Date: Mon, 20 Oct 2014 16:27:32 +0000 Subject: [PATCH] Revert most of r215810, which is no longer needed Now that we no longer add mappings when there are no local entities, there is no need to always bump the size of the tables that correspond to ContinuousRangeMaps. llvm-svn: 220208 --- clang/lib/Serialization/ASTReader.cpp | 39 ++++++++++++++--------------------- 1 file changed, 15 insertions(+), 24 deletions(-) diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index e2e2162..3ffbb50 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -2620,9 +2620,9 @@ ASTReader::ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities) { F.TypeRemap.insertOrReplace( std::make_pair(LocalBaseTypeIndex, F.BaseTypeIndex - LocalBaseTypeIndex)); + + TypesLoaded.resize(TypesLoaded.size() + F.LocalNumTypes); } - // Increase size by >= 1 so we get a unique base index in the next module. - TypesLoaded.resize(TypesLoaded.size() + std::max(F.LocalNumTypes, 1U)); break; } @@ -2650,10 +2650,9 @@ ASTReader::ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities) { // Introduce the global -> local mapping for declarations within this // module. F.GlobalToLocalDeclIDs[&F] = LocalBaseDeclID; - } - // Increase size by >= 1 so we get a unique base index in the next module. - DeclsLoaded.resize(DeclsLoaded.size() + std::max(F.LocalNumDecls, 1U)); + DeclsLoaded.resize(DeclsLoaded.size() + F.LocalNumDecls); + } break; } @@ -2721,11 +2720,10 @@ ASTReader::ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities) { F.IdentifierRemap.insertOrReplace( std::make_pair(LocalBaseIdentifierID, F.BaseIdentifierID - LocalBaseIdentifierID)); - } - // Increase size by >= 1 so we get a unique base index in the next module. - IdentifiersLoaded.resize(IdentifiersLoaded.size() + - std::max(F.LocalNumIdentifiers, 1U)); + IdentifiersLoaded.resize(IdentifiersLoaded.size() + + F.LocalNumIdentifiers); + } break; } @@ -2815,10 +2813,9 @@ ASTReader::ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities) { F.SelectorRemap.insertOrReplace( std::make_pair(LocalBaseSelectorID, F.BaseSelectorID - LocalBaseSelectorID)); + + SelectorsLoaded.resize(SelectorsLoaded.size() + F.LocalNumSelectors); } - // Increase size by >= 1 so we get a unique base index in the next module. - SelectorsLoaded.resize(SelectorsLoaded.size() + - std::max(F.LocalNumSelectors, 1U)); break; } @@ -2858,10 +2855,8 @@ ASTReader::ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities) { F.SLocEntryOffsets = (const uint32_t *)Blob.data(); F.LocalNumSLocEntries = Record[0]; unsigned SLocSpaceSize = Record[1]; - - // Increase size by >= 1 so we get a unique base index in the next module. std::tie(F.SLocEntryBaseID, F.SLocEntryBaseOffset) = - SourceMgr.AllocateLoadedSLocEntries(std::max(F.LocalNumSLocEntries, 1U), + SourceMgr.AllocateLoadedSLocEntries(F.LocalNumSLocEntries, SLocSpaceSize); // Make our entry in the range map. BaseID is negative and growing, so // we invert it. Because we invert it, though, we need the other end of @@ -3048,11 +3043,9 @@ ASTReader::ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities) { PP.createPreprocessingRecord(); if (!PP.getPreprocessingRecord()->getExternalSource()) PP.getPreprocessingRecord()->SetExternalSource(*this); - - // Increase size by >= 1 so we get a unique base index in the next module. StartingID = PP.getPreprocessingRecord() - ->allocateLoadedEntities(std::max(F.NumPreprocessedEntities, 1U)); + ->allocateLoadedEntities(F.NumPreprocessedEntities); F.BasePreprocessedEntityID = StartingID; if (F.NumPreprocessedEntities > 0) { @@ -3256,9 +3249,9 @@ ASTReader::ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities) { F.MacroRemap.insertOrReplace( std::make_pair(LocalBaseMacroID, F.BaseMacroID - LocalBaseMacroID)); + + MacrosLoaded.resize(MacrosLoaded.size() + F.LocalNumMacros); } - // Increase size by >= 1 so we get a unique base index in the next module. - MacrosLoaded.resize(MacrosLoaded.size() + std::max(F.LocalNumMacros, 1U)); break; } @@ -4515,11 +4508,9 @@ ASTReader::ReadSubmoduleBlock(ModuleFile &F, unsigned ClientLoadCapabilities) { F.SubmoduleRemap.insertOrReplace( std::make_pair(LocalBaseSubmoduleID, F.BaseSubmoduleID - LocalBaseSubmoduleID)); - } - // Increase size by >= 1 so we get a unique base index in the next module. - SubmodulesLoaded.resize(SubmodulesLoaded.size() + - std::max(F.LocalNumSubmodules, 1U)); + SubmodulesLoaded.resize(SubmodulesLoaded.size() + F.LocalNumSubmodules); + } break; } -- 2.7.4