diff options
Diffstat (limited to 'clang/lib/Serialization/ASTReader.cpp')
-rw-r--r-- | clang/lib/Serialization/ASTReader.cpp | 587 |
1 files changed, 288 insertions, 299 deletions
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index 656298b5c57..8d6735c50d8 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -735,7 +735,7 @@ ASTSelectorLookupTrait::ReadKeyDataLength(const unsigned char*& d) { return std::make_pair(KeyLen, DataLen); } -ASTSelectorLookupTrait::internal_key_type +ASTSelectorLookupTrait::internal_key_type ASTSelectorLookupTrait::ReadKey(const unsigned char* d, unsigned) { using namespace llvm::support; SelectorTable &SelTable = Reader.getContext().Selectors; @@ -756,8 +756,8 @@ ASTSelectorLookupTrait::ReadKey(const unsigned char* d, unsigned) { return SelTable.getSelector(N, Args.data()); } -ASTSelectorLookupTrait::data_type -ASTSelectorLookupTrait::ReadData(Selector, const unsigned char* d, +ASTSelectorLookupTrait::data_type +ASTSelectorLookupTrait::ReadData(Selector, const unsigned char* d, unsigned DataLen) { using namespace llvm::support; @@ -1196,7 +1196,7 @@ bool ASTReader::ReadSourceManagerBlock(ModuleFile &F) { RecordData Record; while (true) { llvm::BitstreamEntry E = SLocEntryCursor.advanceSkippingSubblocks(); - + switch (E.Kind) { case llvm::BitstreamEntry::SubBlock: // Handled for us already. case llvm::BitstreamEntry::Error: @@ -1208,7 +1208,7 @@ bool ASTReader::ReadSourceManagerBlock(ModuleFile &F) { // The interesting case. break; } - + // Read a record. Record.clear(); StringRef Blob; @@ -1304,7 +1304,7 @@ bool ASTReader::ReadSLocEntry(int ID) { Error("incorrectly-formatted source location entry in AST file"); return true; } - + RecordData Record; StringRef Blob; switch (SLocEntryCursor.readRecord(Entry.ID, Record, &Blob)) { @@ -1420,7 +1420,7 @@ std::pair<SourceLocation, StringRef> ASTReader::getModuleImportLoc(int ID) { SourceLocation ASTReader::getImportLocation(ModuleFile *F) { if (F->ImportLoc.isValid()) return F->ImportLoc; - + // Otherwise we have a PCH. It's considered to be "imported" at the first // location of its includer. if (F->ImportedBy.empty() || !F->ImportedBy[0]) { @@ -1482,7 +1482,7 @@ MacroInfo *ASTReader::ReadMacroRecord(ModuleFile &F, uint64_t Offset) { // be able to reseek within the block and read entries. unsigned Flags = BitstreamCursor::AF_DontPopBlockAtEnd; llvm::BitstreamEntry Entry = Stream.advanceSkippingSubblocks(Flags); - + switch (Entry.Kind) { case llvm::BitstreamEntry::SubBlock: // Handled for us already. case llvm::BitstreamEntry::Error: @@ -1574,13 +1574,13 @@ MacroInfo *ASTReader::ReadMacroRecord(ModuleFile &F, uint64_t Offset) { } } -PreprocessedEntityID +PreprocessedEntityID ASTReader::getGlobalPreprocessedEntityID(ModuleFile &M, unsigned LocalID) const { - ContinuousRangeMap<uint32_t, int, 2>::const_iterator + ContinuousRangeMap<uint32_t, int, 2>::const_iterator I = M.PreprocessedEntityRemap.find(LocalID - NUM_PREDEF_PP_ENTITY_IDS); - assert(I != M.PreprocessedEntityRemap.end() + assert(I != M.PreprocessedEntityRemap.end() && "Invalid index into preprocessed entity index remap"); - + return LocalID + I->second; } @@ -1588,21 +1588,21 @@ unsigned HeaderFileInfoTrait::ComputeHash(internal_key_ref ikey) { return llvm::hash_combine(ikey.Size, ikey.ModTime); } -HeaderFileInfoTrait::internal_key_type +HeaderFileInfoTrait::internal_key_type HeaderFileInfoTrait::GetInternalKey(const FileEntry *FE) { internal_key_type ikey = {FE->getSize(), M.HasTimestamps ? FE->getModificationTime() : 0, FE->getName(), /*Imported*/ false}; return ikey; } - + bool HeaderFileInfoTrait::EqualKey(internal_key_ref a, internal_key_ref b) { if (a.Size != b.Size || (a.ModTime && b.ModTime && a.ModTime != b.ModTime)) return false; if (llvm::sys::path::is_absolute(a.Filename) && a.Filename == b.Filename) return true; - + // Determine whether the actual files are equivalent. FileManager &FileMgr = Reader.getFileManager(); auto GetFile = [&](const internal_key_type &Key) -> const FileEntry* { @@ -1618,7 +1618,7 @@ bool HeaderFileInfoTrait::EqualKey(internal_key_ref a, internal_key_ref b) { const FileEntry *FEB = GetFile(b); return FEA && FEA == FEB; } - + std::pair<unsigned, unsigned> HeaderFileInfoTrait::ReadKeyDataLength(const unsigned char*& d) { using namespace llvm::support; @@ -1638,7 +1638,7 @@ HeaderFileInfoTrait::ReadKey(const unsigned char *d, unsigned) { return ikey; } -HeaderFileInfoTrait::data_type +HeaderFileInfoTrait::data_type HeaderFileInfoTrait::ReadData(internal_key_ref key, const unsigned char *d, unsigned DataLen) { const unsigned char *End = d + DataLen; @@ -1658,7 +1658,7 @@ HeaderFileInfoTrait::ReadData(internal_key_ref key, const unsigned char *d, M, endian::readNext<uint32_t, little, unaligned>(d)); if (unsigned FrameworkOffset = endian::readNext<uint32_t, little, unaligned>(d)) { - // The framework offset is 1 greater than the actual offset, + // The framework offset is 1 greater than the actual offset, // since 0 is used as an indicator for "no framework name". StringRef FrameworkName(FrameworkStrings + FrameworkOffset - 1); HFI.Framework = HS->getUniqueFrameworkName(FrameworkName); @@ -1720,7 +1720,7 @@ void ASTReader::ReadDefinedMacros() { RecordData Record; while (true) { llvm::BitstreamEntry E = Cursor.advanceSkippingSubblocks(); - + switch (E.Kind) { case llvm::BitstreamEntry::SubBlock: // Handled for us already. case llvm::BitstreamEntry::Error: @@ -1728,13 +1728,13 @@ void ASTReader::ReadDefinedMacros() { return; case llvm::BitstreamEntry::EndBlock: goto NextCursor; - + case llvm::BitstreamEntry::Record: Record.clear(); switch (Cursor.readRecord(E.ID, Record)) { default: // Default behavior: ignore. break; - + case PP_MACRO_OBJECT_LIKE: case PP_MACRO_FUNCTION_LIKE: { IdentifierInfo *II = getLocalIdentifier(*I, Record[0]); @@ -1742,7 +1742,7 @@ void ASTReader::ReadDefinedMacros() { updateOutOfDateIdentifier(*II); break; } - + case PP_TOKEN: // Ignore tokens. break; @@ -1794,7 +1794,7 @@ namespace { IdTable->find_hashed(Name, NameHash, &Trait); if (Pos == IdTable->end()) return false; - + // Dereferencing the iterator has the effect of building the // IdentifierInfo node and populating it with the various // declarations it needs. @@ -1802,7 +1802,7 @@ namespace { Found = *Pos; return true; } - + // \brief Retrieve the identifier info found within the module // files. IdentifierInfo *getIdentifierInfo() const { return Found; } @@ -1838,7 +1838,7 @@ void ASTReader::updateOutOfDateIdentifier(IdentifierInfo &II) { void ASTReader::markIdentifierUpToDate(IdentifierInfo *II) { if (!II) return; - + II->setOutOfDate(false); // Update the generation for this identifier. @@ -2000,7 +2000,7 @@ InputFile ASTReader::getInputFile(ModuleFile &F, unsigned ID, bool Complain) { BitstreamCursor &Cursor = F.InputFilesCursor; SavedStreamPosition SavedPosition(Cursor); Cursor.JumpToBit(F.InputFileOffsets[ID-1]); - + InputFileInfo FI = readInputFileInfo(F, ID); off_t StoredSize = FI.StoredSize; time_t StoredTime = FI.StoredTime; @@ -2158,7 +2158,7 @@ ASTReader::ASTReadResult ASTReader::ReadOptionsBlock( ASTReadResult Result = Success; while (true) { llvm::BitstreamEntry Entry = Stream.advance(); - + switch (Entry.Kind) { case llvm::BitstreamEntry::Error: case llvm::BitstreamEntry::SubBlock: @@ -2246,7 +2246,7 @@ ASTReader::ReadControlBlock(ModuleFile &F, unsigned NumUserInputs = 0; while (true) { llvm::BitstreamEntry Entry = Stream.advance(); - + switch (Entry.Kind) { case llvm::BitstreamEntry::Error: Error("malformed block record in AST file"); @@ -2349,7 +2349,7 @@ ASTReader::ReadControlBlock(ModuleFile &F, return Failure; } continue; - + default: if (Stream.SkipBlock()) { Error("malformed block record in AST file"); @@ -2357,7 +2357,7 @@ ASTReader::ReadControlBlock(ModuleFile &F, } continue; } - + case llvm::BitstreamEntry::Record: // The interesting case. break; @@ -2409,7 +2409,7 @@ ASTReader::ReadControlBlock(ModuleFile &F, break; case IMPORTS: { - // Load each of the imported PCH files. + // Load each of the imported PCH files. unsigned Idx = 0, N = Record.size(); while (Idx < N) { // Read information about the AST file. @@ -2531,7 +2531,7 @@ ASTReader::ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities) { RecordData Record; while (true) { llvm::BitstreamEntry Entry = Stream.advance(); - + switch (Entry.Kind) { case llvm::BitstreamEntry::Error: Error("error at end of module block in AST file"); @@ -2546,7 +2546,7 @@ ASTReader::ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities) { if (DC->hasExternalLexicalStorage() && !getContext().getLangOpts().CPlusPlus) DC->setMustBuildLookupTable(); - + return Success; } case llvm::BitstreamEntry::SubBlock: @@ -2569,7 +2569,7 @@ ASTReader::ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities) { F.MacroCursor = Stream; if (!PP.getExternalSource()) PP.setExternalSource(this); - + if (Stream.SkipBlock() || ReadBlockAbbrevs(F.MacroCursor, PREPROCESSOR_BLOCK_ID)) { Error("malformed block record in AST file"); @@ -2577,7 +2577,7 @@ ASTReader::ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities) { } F.MacroStartOffset = F.MacroCursor.GetCurrentBitNo(); break; - + case PREPROCESSOR_DETAIL_BLOCK_ID: F.PreprocessorDetailCursor = Stream; if (Stream.SkipBlock() || @@ -2588,23 +2588,23 @@ ASTReader::ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities) { } F.PreprocessorDetailStartOffset = F.PreprocessorDetailCursor.GetCurrentBitNo(); - + if (!PP.getPreprocessingRecord()) PP.createPreprocessingRecord(); if (!PP.getPreprocessingRecord()->getExternalSource()) PP.getPreprocessingRecord()->SetExternalSource(*this); break; - + case SOURCE_MANAGER_BLOCK_ID: if (ReadSourceManagerBlock(F)) return Failure; break; - + case SUBMODULE_BLOCK_ID: if (ASTReadResult Result = ReadSubmoduleBlock(F, ClientLoadCapabilities)) return Result; break; - + case COMMENTS_BLOCK_ID: { BitstreamCursor C = Stream; if (Stream.SkipBlock() || @@ -2615,7 +2615,7 @@ ASTReader::ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities) { CommentsCursors.push_back(std::make_pair(C, &F)); break; } - + default: if (Stream.SkipBlock()) { Error("malformed block record in AST file"); @@ -2624,7 +2624,7 @@ ASTReader::ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities) { break; } continue; - + case llvm::BitstreamEntry::Record: // The interesting case. break; @@ -2646,21 +2646,21 @@ ASTReader::ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities) { F.LocalNumTypes = Record[0]; unsigned LocalBaseTypeIndex = Record[1]; F.BaseTypeIndex = getTotalNumTypes(); - + if (F.LocalNumTypes > 0) { // Introduce the global -> local mapping for types within this module. GlobalTypeMap.insert(std::make_pair(getTotalNumTypes(), &F)); - + // Introduce the local -> global mapping for types within this module. F.TypeRemap.insertOrReplace( - std::make_pair(LocalBaseTypeIndex, + std::make_pair(LocalBaseTypeIndex, F.BaseTypeIndex - LocalBaseTypeIndex)); TypesLoaded.resize(TypesLoaded.size() + F.LocalNumTypes); } break; } - + case DECL_OFFSET: { if (F.LocalNumDecls != 0) { Error("duplicate DECL_OFFSET record in AST file"); @@ -2670,18 +2670,18 @@ ASTReader::ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities) { F.LocalNumDecls = Record[0]; unsigned LocalBaseDeclID = Record[1]; F.BaseDeclID = getTotalNumDecls(); - + if (F.LocalNumDecls > 0) { - // Introduce the global -> local mapping for declarations within this + // Introduce the global -> local mapping for declarations within this // module. GlobalDeclMap.insert( std::make_pair(getTotalNumDecls() + NUM_PREDEF_DECL_IDS, &F)); - + // Introduce the local -> global mapping for declarations within this // module. F.DeclRemap.insertOrReplace( std::make_pair(LocalBaseDeclID, F.BaseDeclID - LocalBaseDeclID)); - + // Introduce the global -> local mapping for declarations within this // module. F.GlobalToLocalDeclIDs[&F] = LocalBaseDeclID; @@ -2690,7 +2690,7 @@ ASTReader::ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities) { } break; } - + case TU_UPDATE_LEXICAL: { DeclContext *TU = Context.getTranslationUnitDecl(); LexicalContents Contents( @@ -2722,7 +2722,7 @@ ASTReader::ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities) { (const unsigned char *)F.IdentifierTableData + sizeof(uint32_t), (const unsigned char *)F.IdentifierTableData, ASTIdentifierLookupTrait(*this, F)); - + PP.getIdentifierTable().setExternalIdentifierLookup(this); } break; @@ -2736,13 +2736,13 @@ ASTReader::ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities) { F.LocalNumIdentifiers = Record[0]; unsigned LocalBaseIdentifierID = Record[1]; F.BaseIdentifierID = getTotalNumIdentifiers(); - + if (F.LocalNumIdentifiers > 0) { // Introduce the global -> local mapping for identifiers within this // module. - GlobalIdentifierMap.insert(std::make_pair(getTotalNumIdentifiers() + 1, + GlobalIdentifierMap.insert(std::make_pair(getTotalNumIdentifiers() + 1, &F)); - + // Introduce the local -> global mapping for identifiers within this // module. F.IdentifierRemap.insertOrReplace( @@ -2809,11 +2809,11 @@ ASTReader::ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities) { Error("invalid weak identifiers record"); return Failure; } - - // FIXME: Ignore weak undeclared identifiers from non-original PCH + + // FIXME: Ignore weak undeclared identifiers from non-original PCH // files. This isn't the way to do it :) WeakUndeclaredIdentifiers.clear(); - + // Translate the weak, undeclared identifiers into global IDs. for (unsigned I = 0, N = Record.size(); I < N; /* in loop */) { WeakUndeclaredIdentifiers.push_back( @@ -2831,13 +2831,13 @@ ASTReader::ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities) { F.LocalNumSelectors = Record[0]; unsigned LocalBaseSelectorID = Record[1]; F.BaseSelectorID = getTotalNumSelectors(); - + if (F.LocalNumSelectors > 0) { - // Introduce the global -> local mapping for selectors within this + // Introduce the global -> local mapping for selectors within this // module. GlobalSelectorMap.insert(std::make_pair(getTotalNumSelectors()+1, &F)); - - // Introduce the local -> global mapping for selectors within this + + // Introduce the local -> global mapping for selectors within this // module. F.SelectorRemap.insertOrReplace( std::make_pair(LocalBaseSelectorID, @@ -2847,7 +2847,7 @@ ASTReader::ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities) { } break; } - + case METHOD_POOL: F.SelectorLookupTableData = (const unsigned char *)Blob.data(); if (Record[0]) @@ -2862,7 +2862,7 @@ ASTReader::ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities) { case REFERENCED_SELECTOR_POOL: if (!Record.empty()) { for (unsigned Idx = 0, N = Record.size() - 1; Idx < N; /* in loop */) { - ReferencedSelectorsData.push_back(getGlobalSelectorID(F, + ReferencedSelectorsData.push_back(getGlobalSelectorID(F, Record[Idx++])); ReferencedSelectorsData.push_back(ReadSourceLocation(F, Record, Idx). getRawEncoding()); @@ -2874,7 +2874,7 @@ ASTReader::ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities) { if (!Record.empty() && Listener) Listener->ReadCounter(F, Record[0]); break; - + case FILE_SORTED_DECLS: F.FileSortedDecls = (const DeclID *)Blob.data(); F.NumFileSortedDecls = Record[0]; @@ -2911,7 +2911,7 @@ ASTReader::ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities) { // This module. Base was 2 when being compiled. F.SLocRemap.insertOrReplace(std::make_pair(2U, static_cast<int>(F.SLocEntryBaseOffset - 2))); - + TotalNumSLocEntries += F.LocalNumSLocEntries; break; } @@ -3003,7 +3003,7 @@ ASTReader::ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities) { Error("Multiple SOURCE_LOCATION_PRELOADS records in AST file"); return Failure; } - + F.PreloadSLocEntries.swap(Record); break; } @@ -3018,12 +3018,12 @@ ASTReader::ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities) { Error("Invalid VTABLE_USES record"); return Failure; } - + // Later tables overwrite earlier ones. // FIXME: Modules will have some trouble with this. This is clearly not // the right way to do this. VTableUses.clear(); - + for (unsigned Idx = 0, N = Record.size(); Idx != N; /* In loop */) { VTableUses.push_back(getGlobalDeclID(F, Record[Idx++])); VTableUses.push_back( @@ -3065,13 +3065,13 @@ ASTReader::ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities) { F.NumPreprocessedEntities = Blob.size() / sizeof(PPEntityOffset); unsigned LocalBasePreprocessedEntityID = Record[0]; - + unsigned StartingID; if (!PP.getPreprocessingRecord()) PP.createPreprocessingRecord(); if (!PP.getPreprocessingRecord()->getExternalSource()) PP.getPreprocessingRecord()->SetExternalSource(*this); - StartingID + StartingID = PP.getPreprocessingRecord() ->allocateLoadedEntities(F.NumPreprocessedEntities); F.BasePreprocessedEntityID = StartingID; @@ -3080,7 +3080,7 @@ ASTReader::ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities) { // Introduce the global -> local mapping for preprocessed entities in // this module. GlobalPreprocessedEntityMap.insert(std::make_pair(StartingID, &F)); - + // Introduce the local -> global mapping for preprocessed entities in // this module. F.PreprocessedEntityRemap.insertOrReplace( @@ -3090,7 +3090,7 @@ ASTReader::ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities) { break; } - + case DECL_UPDATE_OFFSETS: { if (Record.size() % 2 != 0) { Error("invalid DECL_UPDATE_OFFSETS block in AST file"); @@ -3113,12 +3113,12 @@ ASTReader::ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities) { Error("duplicate OBJC_CATEGORIES_MAP record in AST file"); return Failure; } - + F.LocalNumObjCCategoriesInMap = Record[0]; F.ObjCCategoriesMap = (const ObjCCategoriesInfo *)Blob.data(); break; } - + case OBJC_CATEGORIES: F.ObjCCategories.swap(Record); break; @@ -3130,7 +3130,7 @@ ASTReader::ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities) { F.PragmaDiagMappings.insert(F.PragmaDiagMappings.end(), Record.begin(), Record.end()); break; - + case CUDA_SPECIAL_DECL_REFS: // Later tables overwrite earlier ones. // FIXME: Modules will have trouble with this. @@ -3147,17 +3147,17 @@ ASTReader::ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities) { = HeaderFileInfoLookupTable::Create( (const unsigned char *)F.HeaderFileInfoTableData + Record[0], (const unsigned char *)F.HeaderFileInfoTableData, - HeaderFileInfoTrait(*this, F, + HeaderFileInfoTrait(*this, F, &PP.getHeaderSearchInfo(), Blob.data() + Record[2])); - + PP.getHeaderSearchInfo().SetExternalSource(this); if (!PP.getHeaderSearchInfo().getExternalLookup()) PP.getHeaderSearchInfo().SetExternalLookup(this); } break; } - + case FP_PRAGMA_OPTIONS: // Later tables overwrite earlier ones. FPPragmaOptions.swap(Record); @@ -3172,7 +3172,7 @@ ASTReader::ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities) { for (unsigned I = 0, N = Record.size(); I != N; ++I) TentativeDefinitions.push_back(getGlobalDeclID(F, Record[I])); break; - + case KNOWN_NAMESPACES: for (unsigned I = 0, N = Record.size(); I != N; ++I) KnownNamespaces.push_back(getGlobalDeclID(F, Record[I])); @@ -3515,7 +3515,7 @@ bool ASTReader::loadGlobalIndex() { if (TriedLoadingGlobalIndex || !UseGlobalIndex || !Context.getLangOpts().Modules) return true; - + // Try to load the global index. TriedLoadingGlobalIndex = true; StringRef ModuleCachePath @@ -3639,12 +3639,12 @@ ASTReader::ASTReadResult ASTReader::ReadAST(StringRef FileName, return Result; } - // Once read, set the ModuleFile bit base offset and update the size in + // Once read, set the ModuleFile bit base offset and update the size in // bits of all files we've seen. F.GlobalBitOffset = TotalModulesSizeInBits; TotalModulesSizeInBits += F.SizeInBits; GlobalBitOffsetsMap.insert(std::make_pair(F.GlobalBitOffset, &F)); - + // Preload SLocEntries. for (unsigned I = 0, N = F.PreloadSLocEntries.size(); I != N; ++I) { int Index = int(F.PreloadSLocEntries[I] - 1) + F.SLocEntryBaseID; @@ -3714,7 +3714,7 @@ ASTReader::ASTReadResult ASTReader::ReadAST(StringRef FileName, // Mark selectors as out of date. for (auto Sel : SelectorGeneration) SelectorOutOfDate[Sel.first] = true; - + // Resolve any unresolved module exports. for (unsigned I = 0, N = UnresolvedModuleRefs.size(); I != N; ++I) { UnresolvedModuleRef &Unresolved = UnresolvedModuleRefs[I]; @@ -3752,7 +3752,7 @@ ASTReader::ASTReadResult ASTReader::ReadAST(StringRef FileName, // FIXME: How do we load the 'use'd modules? They may not be submodules. // Might be unnecessary as use declarations are only used to build the // module itself. - + InitializeContext(); if (SemaObj) @@ -3763,7 +3763,7 @@ ASTReader::ASTReadResult ASTReader::ReadAST(StringRef FileName, ModuleFile &PrimaryModule = ModuleMgr.getPrimaryModule(); if (PrimaryModule.OriginalSourceFileID.isValid()) { - PrimaryModule.OriginalSourceFileID + PrimaryModule.OriginalSourceFileID = FileID::get(PrimaryModule.SLocEntryBaseID + PrimaryModule.OriginalSourceFileID.getOpaqueValue() - 1); @@ -3776,11 +3776,11 @@ ASTReader::ASTReadResult ASTReader::ReadAST(StringRef FileName, SourceMgr.setMainFileID(PrimaryModule.OriginalSourceFileID); } } - + // For any Objective-C class definitions we have already loaded, make sure // that we load any additional categories. for (unsigned I = 0, N = ObjCClassesLoaded.size(); I != N; ++I) { - loadObjCCategories(ObjCClassesLoaded[I]->getGlobalID(), + loadObjCCategories(ObjCClassesLoaded[I]->getGlobalID(), ObjCClassesLoaded[I], PreviousGeneration); } @@ -3892,7 +3892,7 @@ ASTReader::ReadASTCore(StringRef FileName, BitstreamCursor &Stream = F.Stream; Stream = BitstreamCursor(PCHContainerRdr.ExtractPCH(*F.Buffer)); F.SizeInBits = F.Buffer->getBufferSize() * 8; - + // Sniff for the signature. if (!startsWithASTFileMagic(Stream)) { Diag(diag::err_module_file_invalid) << moduleKindForDiagnostic(Type) @@ -3904,14 +3904,14 @@ ASTReader::ReadASTCore(StringRef FileName, bool HaveReadControlBlock = false; while (true) { llvm::BitstreamEntry Entry = Stream.advance(); - + switch (Entry.Kind) { case llvm::BitstreamEntry::Error: case llvm::BitstreamEntry::Record: case llvm::BitstreamEntry::EndBlock: Error("invalid record at top-level of AST file"); return Failure; - + case llvm::BitstreamEntry::SubBlock: break; } @@ -4042,26 +4042,26 @@ ASTReader::ASTReadResult ASTReader::ReadExtensionBlock(ModuleFile &F) { void ASTReader::InitializeContext() { // If there's a listener, notify them that we "read" the translation unit. if (DeserializationListener) - DeserializationListener->DeclRead(PREDEF_DECL_TRANSLATION_UNIT_ID, + DeserializationListener->DeclRead(PREDEF_DECL_TRANSLATION_UNIT_ID, Context.getTranslationUnitDecl()); // FIXME: Find a better way to deal with collisions between these // built-in types. Right now, we just ignore the problem. - + // Load the special types. if (SpecialTypes.size() >= NumSpecialTypeIDs) { if (unsigned String = SpecialTypes[SPECIAL_TYPE_CF_CONSTANT_STRING]) { if (!Context.CFConstantStringTypeDecl) Context.setCFConstantStringType(GetType(String)); } - + if (unsigned File = SpecialTypes[SPECIAL_TYPE_FILE]) { QualType FileType = GetType(File); if (FileType.isNull()) { Error("FILE type is NULL"); return; } - + if (!Context.FILEDecl) { if (const TypedefType *Typedef = FileType->getAs<TypedefType>()) Context.setFILEDecl(Typedef->getDecl()); @@ -4075,14 +4075,14 @@ void ASTReader::InitializeContext() { } } } - + if (unsigned Jmp_buf = SpecialTypes[SPECIAL_TYPE_JMP_BUF]) { QualType Jmp_bufType = GetType(Jmp_buf); if (Jmp_bufType.isNull()) { Error("jmp_buf type is NULL"); return; } - + if (!Context.jmp_bufDecl) { if (const TypedefType *Typedef = Jmp_bufType->getAs<TypedefType>()) Context.setjmp_bufDecl(Typedef->getDecl()); @@ -4096,14 +4096,14 @@ void ASTReader::InitializeContext() { } } } - + if (unsigned Sigjmp_buf = SpecialTypes[SPECIAL_TYPE_SIGJMP_BUF]) { QualType Sigjmp_bufType = GetType(Sigjmp_buf); if (Sigjmp_bufType.isNull()) { Error("sigjmp_buf type is NULL"); return; } - + if (!Context.sigjmp_bufDecl) { if (const TypedefType *Typedef = Sigjmp_bufType->getAs<TypedefType>()) Context.setsigjmp_bufDecl(Typedef->getDecl()); @@ -4151,7 +4151,7 @@ void ASTReader::InitializeContext() { } } } - + ReadPragmaDiagnosticMappings(Context.getDiagnostics()); // If there were any CUDA special declarations, deserialize them. @@ -4226,7 +4226,7 @@ std::string ASTReader::getOriginalSourceFile( Diags.Report(diag::err_fe_not_a_pch_file) << ASTFileName; return std::string(); } - + // Scan for the CONTROL_BLOCK_ID block. if (SkipCursorToBlock(Stream, CONTROL_BLOCK_ID)) { Diags.Report(diag::err_fe_pch_malformed_block) << ASTFileName; @@ -4239,12 +4239,12 @@ std::string ASTReader::getOriginalSourceFile( llvm::BitstreamEntry Entry = Stream.advanceSkippingSubblocks(); if (Entry.Kind == llvm::BitstreamEntry::EndBlock) return std::string(); - + if (Entry.Kind != llvm::BitstreamEntry::Record) { Diags.Report(diag::err_fe_pch_malformed_block) << ASTFileName; return std::string(); } - + Record.clear(); StringRef Blob; if (Stream.readRecord(Entry.ID, Record, &Blob) == ORIGINAL_FILE) @@ -4393,7 +4393,7 @@ bool ASTReader::readASTFileControlBlock( if (Listener.ReadFullVersionInformation(Blob)) return true; - + break; } case MODULE_NAME: @@ -4539,7 +4539,7 @@ ASTReader::ReadSubmoduleBlock(ModuleFile &F, unsigned ClientLoadCapabilities) { RecordData Record; while (true) { llvm::BitstreamEntry Entry = F.Stream.advanceSkippingSubblocks(); - + switch (Entry.Kind) { case llvm::BitstreamEntry::SubBlock: // Handled for us already. case llvm::BitstreamEntry::Error: @@ -4637,7 +4637,7 @@ ASTReader::ReadSubmoduleBlock(ModuleFile &F, unsigned ClientLoadCapabilities) { CurrentModule->ConfigMacrosExhaustive = ConfigMacrosExhaustive; if (DeserializationListener) DeserializationListener->ModuleRead(GlobalID, CurrentModule); - + SubmodulesLoaded[GlobalIndex] = CurrentModule; // Clear out data that will be replaced by what is in the module file. @@ -4677,7 +4677,7 @@ ASTReader::ReadSubmoduleBlock(ModuleFile &F, unsigned ClientLoadCapabilities) { } break; } - + case SUBMODULE_HEADER: case SUBMODULE_EXCLUDED_HEADER: case SUBMODULE_PRIVATE_HEADER: @@ -4711,17 +4711,17 @@ ASTReader::ReadSubmoduleBlock(ModuleFile &F, unsigned ClientLoadCapabilities) { } break; } - + case SUBMODULE_METADATA: { F.BaseSubmoduleID = getTotalNumSubmodules(); F.LocalNumSubmodules = Record[0]; unsigned LocalBaseSubmoduleID = Record[1]; if (F.LocalNumSubmodules > 0) { - // Introduce the global -> local mapping for submodules within this + // Introduce the global -> local mapping for submodules within this // module. GlobalSubmoduleMap.insert(std::make_pair(getTotalNumSubmodules()+1,&F)); - - // Introduce the local -> global mapping for submodules within this + + // Introduce the local -> global mapping for submodules within this // module. F.SubmoduleRemap.insertOrReplace( std::make_pair(LocalBaseSubmoduleID, @@ -4731,7 +4731,7 @@ ASTReader::ReadSubmoduleBlock(ModuleFile &F, unsigned ClientLoadCapabilities) { } break; } - + case SUBMODULE_IMPORTS: { for (unsigned Idx = 0; Idx != Record.size(); ++Idx) { UnresolvedModuleRef Unresolved; @@ -4755,8 +4755,8 @@ ASTReader::ReadSubmoduleBlock(ModuleFile &F, unsigned ClientLoadCapabilities) { Unresolved.IsWildcard = Record[Idx + 1]; UnresolvedModuleRefs.push_back(Unresolved); } - - // Once we've loaded the set of exports, there's no reason to keep + + // Once we've loaded the set of exports, there's no reason to keep // the parsed, unresolved exports around. CurrentModule->UnresolvedExports.clear(); break; @@ -4969,7 +4969,7 @@ std::pair<ModuleFile *, unsigned> ASTReader::getModulePreprocessedEntity(unsigned GlobalIndex) { GlobalPreprocessedEntityMapType::iterator I = GlobalPreprocessedEntityMap.find(GlobalIndex); - assert(I != GlobalPreprocessedEntityMap.end() && + assert(I != GlobalPreprocessedEntityMap.end() && "Corrupted global preprocessed entity map"); ModuleFile *M = I->second; unsigned LocalIndex = GlobalIndex - M->BasePreprocessedEntityID; @@ -5005,8 +5005,8 @@ PreprocessedEntity *ASTReader::ReadPreprocessedEntity(unsigned Index) { Error("no preprocessing record"); return nullptr; } - - SavedStreamPosition SavedPosition(M.PreprocessorDetailCursor); + + SavedStreamPosition SavedPosition(M.PreprocessorDetailCursor); M.PreprocessorDetailCursor.JumpToBit(PPOffs.BitOffset); llvm::BitstreamEntry Entry = @@ -5045,7 +5045,7 @@ PreprocessedEntity *ASTReader::ReadPreprocessedEntity(unsigned Index) { return ME; } - + case PPD_MACRO_DEFINITION: { // Decode the identifier info and then check again; if the macro is // still defined and associated with the identifier, @@ -5057,14 +5057,14 @@ PreprocessedEntity *ASTReader::ReadPreprocessedEntity(unsigned Index) { return MD; } - + case PPD_INCLUSION_DIRECTIVE: { const char *FullFileNameStart = Blob.data() + Record[0]; StringRef FullFileName(FullFileNameStart, Blob.size() - Record[0]); const FileEntry *File = nullptr; if (!FullFileName.empty()) File = PP.getFileManager().getFile(FullFileName); - + // FIXME: Stable encoding InclusionDirective::InclusionKind Kind = static_cast<InclusionDirective::InclusionKind>(Record[2]); @@ -5205,11 +5205,11 @@ Optional<bool> ASTReader::isPreprocessedEntityInFileID(unsigned Index, ModuleFile &M = *PPInfo.first; unsigned LocalIndex = PPInfo.second; const PPEntityOffset &PPOffs = M.PreprocessedEntityOffsets[LocalIndex]; - + SourceLocation Loc = TranslateSourceLocation(M, PPOffs.getBegin()); if (Loc.isInvalid()) return false; - + if (SourceMgr.isInFileID(SourceMgr.getFileLoc(Loc), FID)) return true; else @@ -5221,9 +5221,9 @@ namespace { /// \brief Visitor used to search for information about a header file. class HeaderFileInfoVisitor { const FileEntry *FE; - + Optional<HeaderFileInfo> HFI; - + public: explicit HeaderFileInfoVisitor(const FileEntry *FE) : FE(FE) { } @@ -5242,7 +5242,7 @@ namespace { HFI = *Pos; return true; } - + Optional<HeaderFileInfo> getHeaderFileInfo() const { return HFI; } }; @@ -5253,7 +5253,7 @@ HeaderFileInfo ASTReader::GetHeaderFileInfo(const FileEntry *FE) { ModuleMgr.visit(Visitor); if (Optional<HeaderFileInfo> HFI = Visitor.getHeaderFileInfo()) return *HFI; - + return HeaderFileInfo(); } @@ -5275,7 +5275,7 @@ void ASTReader::ReadPragmaDiagnosticMappings(DiagnosticsEngine &Diag) { FullSourceLoc(Loc, SourceMgr))); continue; } - + assert(DiagStateID == 0); // A new DiagState was created here. Diag.DiagStates.push_back(*Diag.GetCurDiagState()); @@ -5421,7 +5421,7 @@ QualType ASTReader::readTypeRecord(unsigned Index) { QualType ClassType = readType(*Loc.F, Record, Idx); if (PointeeType.isNull() || ClassType.isNull()) return QualType(); - + return Context.getMemberPointerType(PointeeType, ClassType.getTypePtr()); } @@ -5531,7 +5531,7 @@ QualType ASTReader::readTypeRecord(unsigned Index) { return Context.getTypeDeclType( ReadDeclAs<UnresolvedUsingTypenameDecl>(*Loc.F, Record, Idx)); } - + case TYPE_TYPEDEF: { if (Record.size() != 2) { Error("incorrect encoding of typedef type"); @@ -5836,26 +5836,17 @@ void ASTReader::readExceptionSpec(ModuleFile &ModuleFile, } class clang::TypeLocReader : public TypeLocVisitor<TypeLocReader> { - ASTReader &Reader; - ModuleFile &F; - const ASTReader::RecordData &Record; + ASTRecordReader Reader; unsigned &Idx; - SourceLocation ReadSourceLocation(const ASTReader::RecordData &R, - unsigned &I) { - return Reader.ReadSourceLocation(F, R, I); + SourceLocation ReadSourceLocation() { + return Reader.ReadSourceLocation(Idx); } - template<typename T> - T *ReadDeclAs(const ASTReader::RecordData &Record, unsigned &Idx) { - return Reader.ReadDeclAs<T>(F, Record, Idx); - } - public: TypeLocReader(ASTReader &Reader, ModuleFile &F, const ASTReader::RecordData &Record, unsigned &Idx) - : Reader(Reader), F(F), Record(Record), Idx(Idx) - { } + : Reader(Reader, Record, F), Idx(Idx) {} // We want compile-time assurance that we've enumerated all of // these, so unfortunately we have to declare them first, then @@ -5874,21 +5865,21 @@ void TypeLocReader::VisitQualifiedTypeLoc(QualifiedTypeLoc TL) { } void TypeLocReader::VisitBuiltinTypeLoc(BuiltinTypeLoc TL) { - TL.setBuiltinLoc(ReadSourceLocation(Record, Idx)); + TL.setBuiltinLoc(ReadSourceLocation()); if (TL.needsExtraLocalData()) { - TL.setWrittenTypeSpec(static_cast<DeclSpec::TST>(Record[Idx++])); - TL.setWrittenSignSpec(static_cast<DeclSpec::TSS>(Record[Idx++])); - TL.setWrittenWidthSpec(static_cast<DeclSpec::TSW>(Record[Idx++])); - TL.setModeAttr(Record[Idx++]); + TL.setWrittenTypeSpec(static_cast<DeclSpec::TST>(Reader[Idx++])); + TL.setWrittenSignSpec(static_cast<DeclSpec::TSS>(Reader[Idx++])); + TL.setWrittenWidthSpec(static_cast<DeclSpec::TSW>(Reader[Idx++])); + TL.setModeAttr(Reader[Idx++]); } } void TypeLocReader::VisitComplexTypeLoc(ComplexTypeLoc TL) { - TL.setNameLoc(ReadSourceLocation(Record, Idx)); + TL.setNameLoc(ReadSourceLocation()); } void TypeLocReader::VisitPointerTypeLoc(PointerTypeLoc TL) { - TL.setStarLoc(ReadSourceLocation(Record, Idx)); + TL.setStarLoc(ReadSourceLocation()); } void TypeLocReader::VisitDecayedTypeLoc(DecayedTypeLoc TL) { @@ -5900,27 +5891,27 @@ void TypeLocReader::VisitAdjustedTypeLoc(AdjustedTypeLoc TL) { } void TypeLocReader::VisitBlockPointerTypeLoc(BlockPointerTypeLoc TL) { - TL.setCaretLoc(ReadSourceLocation(Record, Idx)); + TL.setCaretLoc(ReadSourceLocation()); } void TypeLocReader::VisitLValueReferenceTypeLoc(LValueReferenceTypeLoc TL) { - TL.setAmpLoc(ReadSourceLocation(Record, Idx)); + TL.setAmpLoc(ReadSourceLocation()); } void TypeLocReader::VisitRValueReferenceTypeLoc(RValueReferenceTypeLoc TL) { - TL.setAmpAmpLoc(ReadSourceLocation(Record, Idx)); + TL.setAmpAmpLoc(ReadSourceLocation()); } void TypeLocReader::VisitMemberPointerTypeLoc(MemberPointerTypeLoc TL) { - TL.setStarLoc(ReadSourceLocation(Record, Idx)); - TL.setClassTInfo(Reader.GetTypeSourceInfo(F, Record, Idx)); + TL.setStarLoc(ReadSourceLocation()); + TL.setClassTInfo(Reader.GetTypeSourceInfo(Idx)); } void TypeLocReader::VisitArrayTypeLoc(ArrayTypeLoc TL) { - TL.setLBracketLoc(ReadSourceLocation(Record, Idx)); - TL.setRBracketLoc(ReadSourceLocation(Record, Idx)); - if (Record[Idx++]) - TL.setSizeExpr(Reader.ReadExpr(F)); + TL.setLBracketLoc(ReadSourceLocation()); + TL.setRBracketLoc(ReadSourceLocation()); + if (Reader[Idx++]) + TL.setSizeExpr(Reader.ReadExpr()); else TL.setSizeExpr(nullptr); } @@ -5944,24 +5935,24 @@ void TypeLocReader::VisitDependentSizedArrayTypeLoc( void TypeLocReader::VisitDependentSizedExtVectorTypeLoc( DependentSizedExtVectorTypeLoc TL) { - TL.setNameLoc(ReadSourceLocation(Record, Idx)); + TL.setNameLoc(ReadSourceLocation()); } void TypeLocReader::VisitVectorTypeLoc(VectorTypeLoc TL) { - TL.setNameLoc(ReadSourceLocation(Record, Idx)); + TL.setNameLoc(ReadSourceLocation()); } void TypeLocReader::VisitExtVectorTypeLoc(ExtVectorTypeLoc TL) { - TL.setNameLoc(ReadSourceLocation(Record, Idx)); + TL.setNameLoc(ReadSourceLocation()); } void TypeLocReader::VisitFunctionTypeLoc(FunctionTypeLoc TL) { - TL.setLocalRangeBegin(ReadSourceLocation(Record, Idx)); - TL.setLParenLoc(ReadSourceLocation(Record, Idx)); - TL.setRParenLoc(ReadSourceLocation(Record, Idx)); - TL.setLocalRangeEnd(ReadSourceLocation(Record, Idx)); + TL.setLocalRangeBegin(ReadSourceLocation()); + TL.setLParenLoc(ReadSourceLocation()); + TL.setRParenLoc(ReadSourceLocation()); + TL.setLocalRangeEnd(ReadSourceLocation()); for (unsigned i = 0, e = TL.getNumParams(); i != e; ++i) { - TL.setParam(i, ReadDeclAs<ParmVarDecl>(Record, Idx)); + TL.setParam(i, Reader.ReadDeclAs<ParmVarDecl>(Idx)); } } @@ -5973,162 +5964,160 @@ void TypeLocReader::VisitFunctionNoProtoTypeLoc(FunctionNoProtoTypeLoc TL) { VisitFunctionTypeLoc(TL); } void TypeLocReader::VisitUnresolvedUsingTypeLoc(UnresolvedUsingTypeLoc TL) { - TL.setNameLoc(ReadSourceLocation(Record, Idx)); + TL.setNameLoc(ReadSourceLocation()); } void TypeLocReader::VisitTypedefTypeLoc(TypedefTypeLoc TL) { - TL.setNameLoc(ReadSourceLocation(Record, Idx)); + TL.setNameLoc(ReadSourceLocation()); } void TypeLocReader::VisitTypeOfExprTypeLoc(TypeOfExprTypeLoc TL) { - TL.setTypeofLoc(ReadSourceLocation(Record, Idx)); - TL.setLParenLoc(ReadSourceLocation(Record, Idx)); - TL.setRParenLoc(ReadSourceLocation(Record, Idx)); + TL.setTypeofLoc(ReadSourceLocation()); + TL.setLParenLoc(ReadSourceLocation()); + TL.setRParenLoc(ReadSourceLocation()); } void TypeLocReader::VisitTypeOfTypeLoc(TypeOfTypeLoc TL) { - TL.setTypeofLoc(ReadSourceLocation(Record, Idx)); - TL.setLParenLoc(ReadSourceLocation(Record, Idx)); - TL.setRParenLoc(ReadSourceLocation(Record, Idx)); - TL.setUnderlyingTInfo(Reader.GetTypeSourceInfo(F, Record, Idx)); + TL.setTypeofLoc(ReadSourceLocation()); + TL.setLParenLoc(ReadSourceLocation()); + TL.setRParenLoc(ReadSourceLocation()); + TL.setUnderlyingTInfo(Reader.GetTypeSourceInfo(Idx)); } void TypeLocReader::VisitDecltypeTypeLoc(DecltypeTypeLoc TL) { - TL.setNameLoc(ReadSourceLocation(Record, Idx)); + TL.setNameLoc(ReadSourceLocation()); } void TypeLocReader::VisitUnaryTransformTypeLoc(UnaryTransformTypeLoc TL) { - TL.setKWLoc(ReadSourceLocation(Record, Idx)); - TL.setLParenLoc(ReadSourceLocation(Record, Idx)); - TL.setRParenLoc(ReadSourceLocation(Record, Idx)); - TL.setUnderlyingTInfo(Reader.GetTypeSourceInfo(F, Record, Idx)); + TL.setKWLoc(ReadSourceLocation()); + TL.setLParenLoc(ReadSourceLocation()); + TL.setRParenLoc(ReadSourceLocation()); + TL.setUnderlyingTInfo(Reader.GetTypeSourceInfo(Idx)); } void TypeLocReader::VisitAutoTypeLoc(AutoTypeLoc TL) { - TL.setNameLoc(ReadSourceLocation(Record, Idx)); + TL.setNameLoc(ReadSourceLocation()); } void TypeLocReader::VisitRecordTypeLoc(RecordTypeLoc TL) { - TL.setNameLoc(ReadSourceLocation(Record, Idx)); + TL.setNameLoc(ReadSourceLocation()); } void TypeLocReader::VisitEnumTypeLoc(EnumTypeLoc TL) { - TL.setNameLoc(ReadSourceLocation(Record, Idx)); + TL.setNameLoc(ReadSourceLocation()); } void TypeLocReader::VisitAttributedTypeLoc(AttributedTypeLoc TL) { - TL.setAttrNameLoc(ReadSourceLocation(Record, Idx)); + TL.setAttrNameLoc(ReadSourceLocation()); if (TL.hasAttrOperand()) { SourceRange range; - range.setBegin(ReadSourceLocation(Record, Idx)); - range.setEnd(ReadSourceLocation(Record, Idx)); + range.setBegin(ReadSourceLocation()); + range.setEnd(ReadSourceLocation()); TL.setAttrOperandParensRange(range); } if (TL.hasAttrExprOperand()) { - if (Record[Idx++]) - TL.setAttrExprOperand(Reader.ReadExpr(F)); + if (Reader[Idx++]) + TL.setAttrExprOperand(Reader.ReadExpr()); else TL.setAttrExprOperand(nullptr); } else if (TL.hasAttrEnumOperand()) - TL.setAttrEnumOperandLoc(ReadSourceLocation(Record, Idx)); + TL.setAttrEnumOperandLoc(ReadSourceLocation()); } void TypeLocReader::VisitTemplateTypeParmTypeLoc(TemplateTypeParmTypeLoc TL) { - TL.setNameLoc(ReadSourceLocation(Record, Idx)); + TL.setNameLoc(ReadSourceLocation()); } void TypeLocReader::VisitSubstTemplateTypeParmTypeLoc( SubstTemplateTypeParmTypeLoc TL) { - TL.setNameLoc(ReadSourceLocation(Record, Idx)); + TL.setNameLoc(ReadSourceLocation()); } void TypeLocReader::VisitSubstTemplateTypeParmPackTypeLoc( SubstTemplateTypeParmPackTypeLoc TL) { - TL.setNameLoc(ReadSourceLocation(Record, Idx)); + TL.setNameLoc(ReadSourceLocation()); } void TypeLocReader::VisitTemplateSpecializationTypeLoc( TemplateSpecializationTypeLoc TL) { - TL.setTemplateKeywordLoc(ReadSourceLocation(Record, Idx)); - TL.setTemplateNameLoc(ReadSourceLocation(Record, Idx)); - TL.setLAngleLoc(ReadSourceLocation(Record, Idx)); - TL.setRAngleLoc(ReadSourceLocation(Record, Idx)); + TL.setTemplateKeywordLoc(ReadSourceLocation()); + TL.setTemplateNameLoc(ReadSourceLocation()); + TL.setLAngleLoc(ReadSourceLocation()); + TL.setRAngleLoc(ReadSourceLocation()); for (unsigned i = 0, e = TL.getNumArgs(); i != e; ++i) TL.setArgLocInfo(i, - Reader.GetTemplateArgumentLocInfo(F, - TL.getTypePtr()->getArg(i).getKind(), - Record, Idx)); + Reader.GetTemplateArgumentLocInfo(TL.getTypePtr()->getArg(i).getKind(), + Idx)); } void TypeLocReader::VisitParenTypeLoc(ParenTypeLoc TL) { - TL.setLParenLoc(ReadSourceLocation(Record, Idx)); - TL.setRParenLoc(ReadSourceLocation(Record, Idx)); + TL.setLParenLoc(ReadSourceLocation()); + TL.setRParenLoc(ReadSourceLocation()); } void TypeLocReader::VisitElaboratedTypeLoc(ElaboratedTypeLoc TL) { - TL.setElaboratedKeywordLoc(ReadSourceLocation(Record, Idx)); - TL.setQualifierLoc(Reader.ReadNestedNameSpecifierLoc(F, Record, Idx)); + TL.setElaboratedKeywordLoc(ReadSourceLocation()); + TL.setQualifierLoc(Reader.ReadNestedNameSpecifierLoc(Idx)); } void TypeLocReader::VisitInjectedClassNameTypeLoc(InjectedClassNameTypeLoc TL) { - TL.setNameLoc(ReadSourceLocation(Record, Idx)); + TL.setNameLoc(ReadSourceLocation()); } void TypeLocReader::VisitDependentNameTypeLoc(DependentNameTypeLoc TL) { - TL.setElaboratedKeywordLoc(ReadSourceLocation(Record, Idx)); - TL.setQualifierLoc(Reader.ReadNestedNameSpecifierLoc(F, Record, Idx)); - TL.setNameLoc(ReadSourceLocation(Record, Idx)); + TL.setElaboratedKeywordLoc(ReadSourceLocation()); + TL.setQualifierLoc(Reader.ReadNestedNameSpecifierLoc(Idx)); + TL.setNameLoc(ReadSourceLocation()); } void TypeLocReader::VisitDependentTemplateSpecializationTypeLoc( DependentTemplateSpecializationTypeLoc TL) { - TL.setElaboratedKeywordLoc(ReadSourceLocation(Record, Idx)); - TL.setQualifierLoc(Reader.ReadNestedNameSpecifierLoc(F, Record, Idx)); - TL.setTemplateKeywordLoc(ReadSourceLocation(Record, Idx)); - TL.setTemplateNameLoc(ReadSourceLocation(Record, Idx)); - TL.setLAngleLoc(ReadSourceLocation(Record, Idx)); - TL.setRAngleLoc(ReadSourceLocation(Record, Idx)); + TL.setElaboratedKeywordLoc(ReadSourceLocation()); + TL.setQualifierLoc(Reader.ReadNestedNameSpecifierLoc(Idx)); + TL.setTemplateKeywordLoc(ReadSourceLocation()); + TL.setTemplateNameLoc(ReadSourceLocation()); + TL.setLAngleLoc(ReadSourceLocation()); + TL.setRAngleLoc(ReadSourceLocation()); for (unsigned I = 0, E = TL.getNumArgs(); I != E; ++I) TL.setArgLocInfo(I, - Reader.GetTemplateArgumentLocInfo(F, - TL.getTypePtr()->getArg(I).getKind(), - Record, Idx)); + Reader.GetTemplateArgumentLocInfo(TL.getTypePtr()->getArg(I).getKind(), + Idx)); } void TypeLocReader::VisitPackExpansionTypeLoc(PackExpansionTypeLoc TL) { - TL.setEllipsisLoc(ReadSourceLocation(Record, Idx)); + TL.setEllipsisLoc(ReadSourceLocation()); } void TypeLocReader::VisitObjCInterfaceTypeLoc(ObjCInterfaceTypeLoc TL) { - TL.setNameLoc(ReadSourceLocation(Record, Idx)); + TL.setNameLoc(ReadSourceLocation()); } void TypeLocReader::VisitObjCTypeParamTypeLoc(ObjCTypeParamTypeLoc TL) { if (TL.getNumProtocols()) { - TL.setProtocolLAngleLoc(ReadSourceLocation(Record, Idx)); - TL.setProtocolRAngleLoc(ReadSourceLocation(Record, Idx)); + TL.setProtocolLAngleLoc(ReadSourceLocation()); + TL.setProtocolRAngleLoc(ReadSourceLocation()); } for (unsigned i = 0, e = TL.getNumProtocols(); i != e; ++i) - TL.setProtocolLoc(i, ReadSourceLocation(Record, Idx)); + TL.setProtocolLoc(i, ReadSourceLocation()); } void TypeLocReader::VisitObjCObjectTypeLoc(ObjCObjectTypeLoc TL) { - TL.setHasBaseTypeAsWritten(Record[Idx++]); - TL.setTypeArgsLAngleLoc(ReadSourceLocation(Record, Idx)); - TL.setTypeArgsRAngleLoc(ReadSourceLocation(Record, Idx)); + TL.setHasBaseTypeAsWritten(Reader[Idx++]); + TL.setTypeArgsLAngleLoc(ReadSourceLocation()); + TL.setTypeArgsRAngleLoc(ReadSourceLocation()); for (unsigned i = 0, e = TL.getNumTypeArgs(); i != e; ++i) - TL.setTypeArgTInfo(i, Reader.GetTypeSourceInfo(F, Record, Idx)); - TL.setProtocolLAngleLoc(ReadSourceLocation(Record, Idx)); - TL.setProtocolRAngleLoc(ReadSourceLocation(Record, Idx)); + TL.setTypeArgTInfo(i, Reader.GetTypeSourceInfo(Idx)); + TL.setProtocolLAngleLoc(ReadSourceLocation()); + TL.setProtocolRAngleLoc(ReadSourceLocation()); for (unsigned i = 0, e = TL.getNumProtocols(); i != e; ++i) - TL.setProtocolLoc(i, ReadSourceLocation(Record, Idx)); + TL.setProtocolLoc(i, ReadSourceLocation()); } void TypeLocReader::VisitObjCObjectPointerTypeLoc(ObjCObjectPointerTypeLoc TL) { - TL.setStarLoc(ReadSourceLocation(Record, Idx)); + TL.setStarLoc(ReadSourceLocation()); } void TypeLocReader::VisitAtomicTypeLoc(AtomicTypeLoc TL) { - TL.setKWLoc(ReadSourceLocation(Record, Idx)); - TL.setLParenLoc(ReadSourceLocation(Record, Idx)); - TL.setRParenLoc(ReadSourceLocation(Record, Idx)); + TL.setKWLoc(ReadSourceLocation()); + TL.setLParenLoc(ReadSourceLocation()); + TL.setRParenLoc(ReadSourceLocation()); } void TypeLocReader::VisitPipeTypeLoc(PipeTypeLoc TL) { - TL.setKWLoc(ReadSourceLocation(Record, Idx)); + TL.setKWLoc(ReadSourceLocation()); } TypeSourceInfo *ASTReader::GetTypeSourceInfo(ModuleFile &F, @@ -6322,18 +6311,18 @@ QualType ASTReader::getLocalType(ModuleFile &F, unsigned LocalID) { return GetType(getGlobalTypeID(F, LocalID)); } -serialization::TypeID +serialization::TypeID ASTReader::getGlobalTypeID(ModuleFile &F, unsigned LocalID) const { unsigned FastQuals = LocalID & Qualifiers::FastMask; unsigned LocalIndex = LocalID >> Qualifiers::FastWidth; - + if (LocalIndex < NUM_PREDEF_TYPE_IDS) return LocalID; ContinuousRangeMap<uint32_t, int, 2>::iterator I = F.TypeRemap.find(LocalIndex - NUM_PREDEF_TYPE_IDS); assert(I != F.TypeRemap.end() && "Invalid index into type index remap"); - + unsigned GlobalIndex = LocalIndex + I->second; return (GlobalIndex << Qualifiers::FastWidth) | FastQuals; } @@ -6349,18 +6338,18 @@ ASTReader::GetTemplateArgumentLocInfo(ModuleFile &F, case TemplateArgument::Type: return GetTypeSourceInfo(F, Record, Index); case TemplateArgument::Template: { - NestedNameSpecifierLoc QualifierLoc = ReadNestedNameSpecifierLoc(F, Record, + NestedNameSpecifierLoc QualifierLoc = ReadNestedNameSpecifierLoc(F, Record, Index); SourceLocation TemplateNameLoc = ReadSourceLocation(F, Record, Index); return TemplateArgumentLocInfo(QualifierLoc, TemplateNameLoc, SourceLocation()); } case TemplateArgument::TemplateExpansion: { - NestedNameSpecifierLoc QualifierLoc = ReadNestedNameSpecifierLoc(F, Record, + NestedNameSpecifierLoc QualifierLoc = ReadNestedNameSpecifierLoc(F, Record, Index); SourceLocation TemplateNameLoc = ReadSourceLocation(F, Record, Index); SourceLocation EllipsisLoc = ReadSourceLocation(F, Record, Index); - return TemplateArgumentLocInfo(QualifierLoc, TemplateNameLoc, + return TemplateArgumentLocInfo(QualifierLoc, TemplateNameLoc, EllipsisLoc); } case TemplateArgument::Null: @@ -6505,7 +6494,7 @@ CXXBaseSpecifier *ASTReader::GetExternalCXXBaseSpecifiers(uint64_t Offset) { return Bases; } -serialization::DeclID +serialization::DeclID ASTReader::getGlobalDeclID(ModuleFile &F, LocalDeclID LocalID) const { if (LocalID < NUM_PREDEF_DECL_IDS) return LocalID; @@ -6513,7 +6502,7 @@ ASTReader::getGlobalDeclID(ModuleFile &F, LocalDeclID LocalID) const { ContinuousRangeMap<uint32_t, int, 2>::iterator I = F.DeclRemap.find(LocalID - NUM_PREDEF_DECL_IDS); assert(I != F.DeclRemap.end() && "Invalid index into decl index remap"); - + return LocalID + I->second; } @@ -6523,7 +6512,7 @@ bool ASTReader::isDeclIDFromModule(serialization::GlobalDeclID ID, if (ID < NUM_PREDEF_DECL_IDS) return false; - return ID - NUM_PREDEF_DECL_IDS >= M.BaseDeclID && + return ID - NUM_PREDEF_DECL_IDS >= M.BaseDeclID && ID - NUM_PREDEF_DECL_IDS < M.BaseDeclID + M.LocalNumDecls; } @@ -6655,11 +6644,11 @@ Decl *ASTReader::GetDecl(DeclID ID) { return DeclsLoaded[Index]; } -DeclID ASTReader::mapGlobalIDToModuleFileGlobalID(ModuleFile &M, +DeclID ASTReader::mapGlobalIDToModuleFileGlobalID(ModuleFile &M, DeclID GlobalID) { if (GlobalID < NUM_PREDEF_DECL_IDS) return GlobalID; - + GlobalDeclMapType::const_iterator I = GlobalDeclMap.find(GlobalID); assert(I != GlobalDeclMap.end() && "Corrupted global declaration map"); ModuleFile *Owner = I->second; @@ -6668,18 +6657,18 @@ DeclID ASTReader::mapGlobalIDToModuleFileGlobalID(ModuleFile &M, = M.GlobalToLocalDeclIDs.find(Owner); if (Pos == M.GlobalToLocalDeclIDs.end()) return 0; - + return GlobalID - Owner->BaseDeclID + Pos->second; } -serialization::DeclID ASTReader::ReadDeclID(ModuleFile &F, +serialization::DeclID ASTReader::ReadDeclID(ModuleFile &F, const RecordData &Record, unsigned &Idx) { if (Idx >= Record.size()) { Error("Corrupted AST file"); return 0; } - + return getGlobalDeclID(F, Record[Idx++]); } @@ -6811,7 +6800,7 @@ void ASTReader::FindFileRegionDecls(FileID File, EndLoc, DIDComp); if (EndIt != DInfo.Decls.end()) ++EndIt; - + for (ArrayRef<serialization::LocalDeclID>::iterator DIt = BeginIt; DIt != EndIt; ++DIt) Decls.push_back(GetDecl(getGlobalDeclID(*DInfo.Mod, *DIt))); @@ -7022,23 +7011,23 @@ void ASTReader::PrintStats() { std::fprintf(stderr, "\n"); GlobalIndex->printStats(); } - + std::fprintf(stderr, "\n"); dump(); std::fprintf(stderr, "\n"); } template<typename Key, typename ModuleFile, unsigned InitialCapacity> -static void +static void dumpModuleIDMap(StringRef Name, - const ContinuousRangeMap<Key, ModuleFile *, + const ContinuousRangeMap<Key, ModuleFile *, InitialCapacity> &Map) { if (Map.begin() == Map.end()) return; - + typedef ContinuousRangeMap<Key, ModuleFile *, InitialCapacity> MapType; llvm::errs() << Name << ":\n"; - for (typename MapType::const_iterator I = Map.begin(), IEnd = Map.end(); + for (typename MapType::const_iterator I = Map.begin(), IEnd = Map.end(); I != IEnd; ++I) { llvm::errs() << " " << I->first << " -> " << I->second->FileName << "\n"; @@ -7055,11 +7044,11 @@ LLVM_DUMP_METHOD void ASTReader::dump() { dumpModuleIDMap("Global macro map", GlobalMacroMap); dumpModuleIDMap("Global submodule map", GlobalSubmoduleMap); dumpModuleIDMap("Global selector map", GlobalSelectorMap); - dumpModuleIDMap("Global preprocessed entity map", + dumpModuleIDMap("Global preprocessed entity map", GlobalPreprocessedEntityMap); - + llvm::errs() << "\n*** PCH/Modules Loaded:"; - for (ModuleManager::ModuleConstIterator M = ModuleMgr.begin(), + for (ModuleManager::ModuleConstIterator M = ModuleMgr.begin(), MEnd = ModuleMgr.end(); M != MEnd; ++M) (*M)->dump(); @@ -7309,7 +7298,7 @@ namespace serialization { bool operator()(ModuleFile &M) { if (!M.SelectorLookupTable) return false; - + // If we've already searched this module file, skip it now. if (M.Generation <= PriorGeneration) return true; @@ -7339,14 +7328,14 @@ namespace serialization { FactoryHasMoreThanOneDecl = Data.FactoryHasMoreThanOneDecl; return true; } - + /// \brief Retrieve the instance methods found by this visitor. - ArrayRef<ObjCMethodDecl *> getInstanceMethods() const { - return InstanceMethods; + ArrayRef<ObjCMethodDecl *> getInstanceMethods() const { + return InstanceMethods; } /// \brief Retrieve the instance methods found by this visitor. - ArrayRef<ObjCMethodDecl *> getFactoryMethods() const { + ArrayRef<ObjCMethodDecl *> getFactoryMethods() const { return FactoryMethods; } @@ -7368,14 +7357,14 @@ static void addMethodsToPool(Sema &S, ArrayRef<ObjCMethodDecl *> Methods, S.addMethodToGlobalList(&List, Methods[I]); } } - + void ASTReader::ReadMethodPool(Selector Sel) { // Get the selector generation and update it to the current generation. unsigned &Generation = SelectorGeneration[Sel]; unsigned PriorGeneration = Generation; Generation = getGeneration(); SelectorOutOfDate[Sel] = false; - + // Search for methods defined with this selector. ++NumMethodPoolLookups; ReadMethodPoolVisitor Visitor(*this, Sel, PriorGeneration); @@ -7389,7 +7378,7 @@ void ASTReader::ReadMethodPool(Selector Sel) { if (!getSema()) return; - + Sema &S = *getSema(); Sema::GlobalMethodPool::iterator Pos = S.MethodPool.insert(std::make_pair(Sel, Sema::GlobalMethods())).first; @@ -7414,9 +7403,9 @@ void ASTReader::updateOutOfDateSelector(Selector Sel) { void ASTReader::ReadKnownNamespaces( SmallVectorImpl<NamespaceDecl *> &Namespaces) { Namespaces.clear(); - + for (unsigned I = 0, N = KnownNamespaces.size(); I != N; ++I) { - if (NamespaceDecl *Namespace + if (NamespaceDecl *Namespace = dyn_cast_or_null<NamespaceDecl>(GetDecl(KnownNamespaces[I]))) Namespaces.push_back(Namespace); } @@ -7505,7 +7494,7 @@ void ASTReader::ReadReferencedSelectors( SmallVectorImpl<std::pair<Selector, SourceLocation> > &Sels) { if (ReferencedSelectorsData.empty()) return; - + // If there are @selector references added them to its pool. This is for // implementation of -Wselector. unsigned int DataSize = ReferencedSelectorsData.size()-1; @@ -7525,9 +7514,9 @@ void ASTReader::ReadWeakUndeclaredIdentifiers( return; for (unsigned I = 0, N = WeakUndeclaredIdentifiers.size(); I < N; /*none*/) { - IdentifierInfo *WeakId + IdentifierInfo *WeakId = DecodeIdentifierInfo(WeakUndeclaredIdentifiers[I++]); - IdentifierInfo *AliasId + IdentifierInfo *AliasId = DecodeIdentifierInfo(WeakUndeclaredIdentifiers[I++]); SourceLocation Loc = SourceLocation::getFromRawEncoding(WeakUndeclaredIdentifiers[I++]); @@ -7547,7 +7536,7 @@ void ASTReader::ReadUsedVTables(SmallVectorImpl<ExternalVTableUse> &VTables) { VT.DefinitionRequired = VTableUses[Idx++]; VTables.push_back(VT); } - + VTableUses.clear(); } @@ -7559,7 +7548,7 @@ void ASTReader::ReadPendingInstantiations( = SourceLocation::getFromRawEncoding(PendingInstantiations[Idx++]); Pending.push_back(std::make_pair(D, Loc)); - } + } PendingInstantiations.clear(); } @@ -7691,12 +7680,12 @@ IdentifierInfo *ASTReader::getLocalIdentifier(ModuleFile &M, unsigned LocalID) { IdentifierID ASTReader::getGlobalIdentifierID(ModuleFile &M, unsigned LocalID) { if (LocalID < NUM_PREDEF_IDENT_IDS) return LocalID; - + ContinuousRangeMap<uint32_t, int, 2>::iterator I = M.IdentifierRemap.find(LocalID - NUM_PREDEF_IDENT_IDS); - assert(I != M.IdentifierRemap.end() + assert(I != M.IdentifierRemap.end() && "Invalid index into identifier index remap"); - + return LocalID + I->second; } @@ -7717,7 +7706,7 @@ MacroInfo *ASTReader::getMacro(MacroID ID) { ModuleFile *M = I->second; unsigned Index = ID - M->BaseMacroID; MacrosLoaded[ID] = ReadMacroRecord(*M, M->MacroOffsets[Index]); - + if (DeserializationListener) DeserializationListener->MacroRead(ID + NUM_PREDEF_MACRO_IDS, MacrosLoaded[ID]); @@ -7741,12 +7730,12 @@ serialization::SubmoduleID ASTReader::getGlobalSubmoduleID(ModuleFile &M, unsigned LocalID) { if (LocalID < NUM_PREDEF_SUBMODULE_IDS) return LocalID; - + ContinuousRangeMap<uint32_t, int, 2>::iterator I = M.SubmoduleRemap.find(LocalID - NUM_PREDEF_SUBMODULE_IDS); - assert(I != M.SubmoduleRemap.end() + assert(I != M.SubmoduleRemap.end() && "Invalid index into submodule index remap"); - + return LocalID + I->second; } @@ -7755,12 +7744,12 @@ Module *ASTReader::getSubmodule(SubmoduleID GlobalID) { assert(GlobalID == 0 && "Unhandled global submodule ID"); return nullptr; } - + if (GlobalID > SubmodulesLoaded.size()) { Error("submodule ID out of range in AST file"); return nullptr; } - + return SubmodulesLoaded[GlobalID - NUM_PREDEF_SUBMODULE_IDS]; } @@ -7857,17 +7846,17 @@ serialization::SelectorID ASTReader::getGlobalSelectorID(ModuleFile &M, unsigned LocalID) const { if (LocalID < NUM_PREDEF_SELECTOR_IDS) return LocalID; - + ContinuousRangeMap<uint32_t, int, 2>::iterator I = M.SelectorRemap.find(LocalID - NUM_PREDEF_SELECTOR_IDS); - assert(I != M.SelectorRemap.end() + assert(I != M.SelectorRemap.end() && "Invalid index into selector index remap"); - + return LocalID + I->second; } DeclarationName -ASTReader::ReadDeclarationName(ModuleFile &F, +ASTReader::ReadDeclarationName(ModuleFile &F, const RecordData &Record, unsigned &Idx) { DeclarationName::NameKind Kind = (DeclarationName::NameKind)Record[Idx++]; switch (Kind) { @@ -7961,7 +7950,7 @@ void ASTReader::ReadQualifierInfo(ModuleFile &F, QualifierInfo &Info, } TemplateName -ASTReader::ReadTemplateName(ModuleFile &F, const RecordData &Record, +ASTReader::ReadTemplateName(ModuleFile &F, const RecordData &Record, unsigned &Idx) { TemplateName::NameKind Kind = (TemplateName::NameKind)Record[Idx++]; switch (Kind) { @@ -7988,7 +7977,7 @@ ASTReader::ReadTemplateName(ModuleFile &F, const RecordData &Record, NestedNameSpecifier *NNS = ReadNestedNameSpecifier(F, Record, Idx); if (Record[Idx++]) // isIdentifier return Context.getDependentTemplateName(NNS, - GetIdentifierInfo(F, Record, + GetIdentifierInfo(F, Record, Idx)); return Context.getDependentTemplateName(NNS, (OverloadedOperatorKind)Record[Idx++]); @@ -8001,17 +7990,17 @@ ASTReader::ReadTemplateName(ModuleFile &F, const RecordData &Record, TemplateName replacement = ReadTemplateName(F, Record, Idx); return Context.getSubstTemplateTemplateParm(param, replacement); } - + case TemplateName::SubstTemplateTemplateParmPack: { - TemplateTemplateParmDecl *Param + TemplateTemplateParmDecl *Param = ReadDeclAs<TemplateTemplateParmDecl>(F, Record, Idx); if (!Param) return TemplateName(); - + TemplateArgument ArgPack = ReadTemplateArgument(F, Record, Idx); if (ArgPack.getKind() != TemplateArgument::Pack) return TemplateName(); - + return Context.getSubstTemplateTemplateParmPack(Param, ArgPack); } } @@ -8049,7 +8038,7 @@ TemplateArgument ASTReader::ReadTemplateArgument(ModuleFile &F, QualType T = readType(F, Record, Idx); return TemplateArgument(Context, Value, T); } - case TemplateArgument::Template: + case TemplateArgument::Template: return TemplateArgument(ReadTemplateName(F, Record, Idx)); case TemplateArgument::TemplateExpansion: { TemplateName Name = ReadTemplateName(F, Record, Idx); @@ -8125,7 +8114,7 @@ ASTReader::ReadCXXBaseSpecifier(ModuleFile &F, TypeSourceInfo *TInfo = GetTypeSourceInfo(F, Record, Idx); SourceRange Range = ReadSourceRange(F, Record, Idx); SourceLocation EllipsisLoc = ReadSourceLocation(F, Record, Idx); - CXXBaseSpecifier Result(Range, isVirtual, isBaseOfClass, AS, TInfo, + CXXBaseSpecifier Result(Range, isVirtual, isBaseOfClass, AS, TInfo, EllipsisLoc); Result.setInheritConstructors(inheritConstructors); return Result; @@ -8252,7 +8241,7 @@ ASTReader::ReadNestedNameSpecifier(ModuleFile &F, } NestedNameSpecifierLoc -ASTReader::ReadNestedNameSpecifierLoc(ModuleFile &F, const RecordData &Record, +ASTReader::ReadNestedNameSpecifierLoc(ModuleFile &F, const RecordData &Record, unsigned &Idx) { unsigned N = Record[Idx++]; NestedNameSpecifierLocBuilder Builder; @@ -8261,7 +8250,7 @@ ASTReader::ReadNestedNameSpecifierLoc(ModuleFile &F, const RecordData &Record, = (NestedNameSpecifier::SpecifierKind)Record[Idx++]; switch (Kind) { case NestedNameSpecifier::Identifier: { - IdentifierInfo *II = GetIdentifierInfo(F, Record, Idx); + IdentifierInfo *II = GetIdentifierInfo(F, Record, Idx); SourceRange Range = ReadSourceRange(F, Record, Idx); Builder.Extend(Context, II, Range.getBegin(), Range.getEnd()); break; @@ -8290,7 +8279,7 @@ ASTReader::ReadNestedNameSpecifierLoc(ModuleFile &F, const RecordData &Record, SourceLocation ColonColonLoc = ReadSourceLocation(F, Record, Idx); // FIXME: 'template' keyword location not saved anywhere, so we fake it. - Builder.Extend(Context, + Builder.Extend(Context, Template? T->getTypeLoc().getBeginLoc() : SourceLocation(), T->getTypeLoc(), ColonColonLoc); break; @@ -8359,7 +8348,7 @@ std::string ASTReader::ReadPath(ModuleFile &F, const RecordData &Record, return Filename; } -VersionTuple ASTReader::ReadVersionTuple(const RecordData &Record, +VersionTuple ASTReader::ReadVersionTuple(const RecordData &Record, unsigned &Idx) { unsigned Major = Record[Idx++]; unsigned Minor = Record[Idx++]; @@ -8371,7 +8360,7 @@ VersionTuple ASTReader::ReadVersionTuple(const RecordData &Record, return VersionTuple(Major, Minor - 1, Subminor - 1); } -CXXTemporary *ASTReader::ReadCXXTemporary(ModuleFile &F, +CXXTemporary *ASTReader::ReadCXXTemporary(ModuleFile &F, const RecordData &Record, unsigned &Idx) { CXXDestructorDecl *Decl = ReadDeclAs<CXXDestructorDecl>(F, Record, Idx); @@ -8562,7 +8551,7 @@ void ASTReader::finishPendingActions() { // If we deserialized any C++ or Objective-C class definitions, any // Objective-C protocol definitions, or any redeclarable templates, make sure - // that all redeclarations point to the definitions. Note that this can only + // that all redeclarations point to the definitions. Note that this can only // happen now, after the redeclaration chains have been fully wired. for (Decl *D : PendingDefinitions) { if (TagDecl *TD = dyn_cast<TagDecl>(D)) { @@ -8717,7 +8706,7 @@ void ASTReader::diagnoseOdrViolations() { // completed. We only really need to mark FieldDecls as invalid here. if (!isa<TagDecl>(D)) D->setInvalidDecl(); - + // Ensure we don't accidentally recursively enter deserialization while // we're producing our diagnostic. Deserializing RecursionGuard(this); @@ -8792,7 +8781,7 @@ void ASTReader::diagnoseOdrViolations() { } void ASTReader::StartedDeserializing() { - if (++NumCurrentElementsDeserializing == 1 && ReadTimer.get()) + if (++NumCurrentElementsDeserializing == 1 && ReadTimer.get()) ReadTimer->startTimer(); } |