Lines Matching +full:tune +full:- +full:hs +full:- +full:dc +full:- +full:level

1 //===- ASTReader.cpp - AST File Reader ------------------------------------===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
11 //===----------------------------------------------------------------------===//
154 //===----------------------------------------------------------------------===//
156 //===----------------------------------------------------------------------===//
160 return First->ReadFullVersionInformation(FullVersion) ||
161 Second->ReadFullVersionInformation(FullVersion);
165 First->ReadModuleName(ModuleName);
166 Second->ReadModuleName(ModuleName);
170 First->ReadModuleMapFile(ModuleMapPath);
171 Second->ReadModuleMapFile(ModuleMapPath);
178 return First->ReadLanguageOptions(LangOpts, Complain,
180 Second->ReadLanguageOptions(LangOpts, Complain,
187 return First->ReadTargetOptions(TargetOpts, Complain,
189 Second->ReadTargetOptions(TargetOpts, Complain,
195 return First->ReadDiagnosticOptions(DiagOpts, Complain) ||
196 Second->ReadDiagnosticOptions(DiagOpts, Complain);
202 return First->ReadFileSystemOptions(FSOpts, Complain) ||
203 Second->ReadFileSystemOptions(FSOpts, Complain);
209 return First->ReadHeaderSearchOptions(HSOpts, SpecificModuleCachePath,
211 Second->ReadHeaderSearchOptions(HSOpts, SpecificModuleCachePath,
218 return First->ReadPreprocessorOptions(PPOpts, ReadMacros, Complain,
220 Second->ReadPreprocessorOptions(PPOpts, ReadMacros, Complain,
226 First->ReadCounter(M, Value);
227 Second->ReadCounter(M, Value);
231 return First->needsInputFileVisitation() ||
232 Second->needsInputFileVisitation();
236 return First->needsSystemInputFileVisitation() ||
237 Second->needsSystemInputFileVisitation();
242 First->visitModuleFile(Filename, Kind);
243 Second->visitModuleFile(Filename, Kind);
251 if (First->needsInputFileVisitation() &&
252 (!isSystem || First->needsSystemInputFileVisitation()))
253 Continue |= First->visitInputFile(Filename, isSystem, isOverridden,
255 if (Second->needsInputFileVisitation() &&
256 (!isSystem || Second->needsSystemInputFileVisitation()))
257 Continue |= Second->visitInputFile(Filename, isSystem, isOverridden,
264 First->readModuleFileExtension(Metadata);
265 Second->readModuleFileExtension(Metadata);
268 //===----------------------------------------------------------------------===//
270 //===----------------------------------------------------------------------===//
277 /// \param Diags If non-NULL, diagnostics will be emitted via this engine.
281 /// \returns true if the languagae options mis-match, false otherwise.
290 Diags->Report(diag::err_pch_langopt_mismatch) \
293 Diags->Report(diag::err_pch_langopt_value_mismatch) \
302 Diags->Report(diag::err_pch_langopt_value_mismatch) \
310 Diags->Report(diag::err_pch_langopt_value_mismatch) \
334 Diags->Report(diag::err_pch_langopt_value_mismatch) << "module features";
340 Diags->Report(diag::err_pch_langopt_value_mismatch)
341 << "target Objective-C runtime";
348 Diags->Report(diag::err_pch_langopt_value_mismatch)
355 // mismatches of non-modular sanitizers (the only ones which can affect AST
364 const std::string Flag = "-fsanitize=";
371 Diags->Report(diag::err_pch_targetopt_feature_mismatch) \
386 /// \param Diags If non-NULL, diagnostics will be emitted via this engine.
388 /// \returns true if the target options mis-match, false otherwise.
396 Diags->Report(diag::err_pch_targetopt_mismatch) \
410 CHECK_TARGET_OPT(TuneCPU, "tune CPU");
441 Diags->Report(diag::err_pch_targetopt_feature_mismatch)
442 << /* is-existing-feature */ false << Feature;
444 Diags->Report(diag::err_pch_targetopt_feature_mismatch)
445 << /* is-existing-feature */ true << Feature;
481 using Level = DiagnosticsEngine::Level;
483 // Check current mappings for new -Werror mappings, and the stored mappings
485 // errors because of options like -Werror.
489 for (auto DiagIDMappingPair : MappingSource->getDiagnosticMappings()) {
491 Level CurLevel = Diags.getDiagnosticLevel(DiagID, SourceLocation());
494 Level StoredLevel =
498 Diags.Report(diag::err_pch_diagopt_mismatch) << "-Werror=" +
499 Diags.getDiagnosticIDs()->getWarningOptionForDiag(DiagID).str();
519 // Top-level options
523 // If -Wsystem-headers was not enabled before, and it was not explicit,
528 Diags.Report(diag::err_pch_diagopt_mismatch) << "-Wsystem-headers";
535 Diags.Report(diag::err_pch_diagopt_mismatch) << "-Werror";
542 Diags.Report(diag::err_pch_diagopt_mismatch) << "-Weverything -Werror";
549 Diags.Report(diag::err_pch_diagopt_mismatch) << "-pedantic-errors";
562 // module import of an implicitly-loaded module file.
567 while (!TopImport->ImportedBy.empty())
568 TopImport = TopImport->ImportedBy[0];
569 if (TopImport->Kind != MK_ImplicitModule)
572 StringRef ModuleName = TopImport->ModuleName;
576 PP.getHeaderSearchInfo().lookupModule(ModuleName, TopImport->ImportLoc);
603 Importer->Name);
607 return checkDiagnosticMappings(*Diags, ExistingDiags, TopM->IsSystem,
628 MacroNames->push_back(MacroName);
638 // Note: GCC drops anything following an end-of-line character.
644 MacroNames->push_back(MacroName);
658 /// \param Diags If non-null, produce diagnostics for any mismatches incurred.
662 /// line (-D or -U) match, but tolerate options missing in one or the
697 Diags->Report(diag::err_pch_macro_def_undef) << MacroName << true;
721 if (Existing.second != Known->second.second) {
723 Diags->Report(diag::err_pch_macro_def_undef)
724 << MacroName << Known->second.second;
731 if (Existing.second || Existing.first == Known->second.first) {
738 Diags->Report(diag::err_pch_macro_def_conflict)
739 << MacroName << Known->second.first << Existing.first;
744 // Leave the <command line> file and return to <built-in>.
745 SuggestedPredefines += "# 1 \"<built-in>\" 2\n";
752 Diags->Report(diag::err_pch_macro_def_undef) << MacroName << false;
763 Diags->Report(diag::err_pch_undef) << ExistingPPOpts.UsePredefines;
773 Diags->Report(diag::err_pch_pp_detailed_record) << PPOpts.DetailedRecord;
837 /// \param Diags If non-null, produce diagnostics for any mismatches incurred.
853 Diags->Report(diag::err_pch_modulecache_mismatch)
872 //===----------------------------------------------------------------------===//
874 //===----------------------------------------------------------------------===//
887 /// Read ULEB-encoded key length and data length.
923 ModuleFileIndex == 0 ? &MF : MF.TransitiveImports[ModuleFileIndex - 1];
926 unsigned LocalNumDecls = OwningModuleFile->LocalNumDecls;
1023 assert(n >= 2 && d[n-1] == '\0');
1024 return StringRef((const char*) d, n-1);
1072 DataLen -= sizeof(IdentifierID);
1104 DataLen -= sizeof(uint16_t) * 2;
1107 // Token IDs are read-only.
1108 if (HasRevertedTokenIDToIdentifier && II->getTokenID() != tok::identifier)
1109 II->revertTokenIDToIdentifier();
1111 II->setObjCOrBuiltinID(ObjCOrBuiltinID);
1112 assert(II->isExtensionToken() == ExtensionToken &&
1116 II->setIsPoisoned(true);
1117 assert(II->isCPlusPlusOperatorKeyword() == CPlusPlusOperatorKeyword &&
1126 DataLen -= 4;
1137 for (; DataLen > 0; DataLen -= sizeof(DeclID))
1167 ->getDeclName().getAsIdentifierInfo();
1186 ID.AddString(((IdentifierInfo*)Data)->getName());
1261 for (unsigned NumDecls = DataLen / sizeof(DeclID); NumDecls; --NumDecls) {
1271 DeclContext *DC) {
1300 assert(!isa<TranslationUnitDecl>(DC) &&
1306 auto &Lex = LexicalDecls[DC];
1313 DC->setHasExternalLexicalStorage(true);
1378 // Ideally we'd just emit it, but have to handle a possible in-flight
1380 auto NumArgs = Diag.getStorage()->NumDiagArgs;
1399 //===----------------------------------------------------------------------===//
1401 //===----------------------------------------------------------------------===//
1410 FileIDs[-1] = -1; // For unspecified filenames.
1448 // Set the source-location entry cursor to the current position in
1451 // source-location entries as needed.
1505 BitstreamCursor &Cursor = F->SLocEntryCursor;
1507 if (llvm::Error Err = Cursor.JumpToBit(F->SLocEntryOffsetsBase +
1508 F->SLocEntryOffsets[Index]))
1519 "incorrectly-formatted source location entry in AST file");
1531 "incorrectly-formatted source location entry in AST file");
1535 return F->SLocEntryBaseOffset + Record[0];
1541 GlobalSLocOffsetMap.find(SourceManager::MaxLoadedOffset - SLocOffset - 1);
1544 ModuleFile *F = SLocMapI->second;
1549 llvm::index_range(0, F->LocalNumSLocEntries), SLocOffset,
1551 int ID = F->SLocEntryBaseID + LocalIndex;
1552 std::size_t Index = -ID - 2;
1573 return F->SLocEntryBaseID + *std::prev(It);
1580 if (unsigned(-ID) - 2 >= getTotalNumSLocs() || ID > 0) {
1581 Error("source location entry ID out-of-range for AST file");
1585 // Local helper to read the (possibly-compressed) buffer data following the
1589 StringRef Name) -> std::unique_ptr<llvm::MemoryBuffer> {
1609 // (little-endian 0xFD2FB528).
1635 ModuleFile *F = GlobalSLocEntryMap.find(-ID)->second;
1636 if (llvm::Error Err = F->SLocEntryCursor.JumpToBit(
1637 F->SLocEntryOffsetsBase +
1638 F->SLocEntryOffsets[ID - F->SLocEntryBaseID])) {
1643 BitstreamCursor &SLocEntryCursor = F->SLocEntryCursor;
1644 SourceLocation::UIntTy BaseOffset = F->SLocEntryBaseOffset;
1655 Error("incorrectly-formatted source location entry in AST file");
1669 Error("incorrectly-formatted source location entry in AST file");
1680 // Note that we only check if a File was returned. If it was out-of-date
1687 if (IncludeLoc.isInvalid() && F->Kind != MK_MainFile) {
1702 const unaligned_decl_id_t *FirstDecl = F->FileSortedDecls + Record[6];
1703 assert(F->FileSortedDecls && "FILE_SORTED_DECLS not encountered yet ?");
1713 auto Buffer = ReadBuffer(SLocEntryCursor, File->getName());
1728 if (IncludeLoc.isInvalid() && F->isModule()) {
1763 if (unsigned(-ID) - 2 >= getTotalNumSLocs() || ID > 0) {
1764 Error("source location entry ID out-of-range for AST file");
1769 ModuleFile *M = GlobalSLocEntryMap.find(-ID)->second;
1770 if (!M->isModule())
1775 return std::make_pair(M->ImportLoc, StringRef(M->ModuleName));
1780 if (F->ImportLoc.isValid())
1781 return F->ImportLoc;
1785 if (F->ImportedBy.empty() || !F->ImportedBy[0]) {
1790 return F->ImportedBy[0]->FirstLoc;
1836 Info->PragmaName = ReadToken(M, Record, Idx);
1837 Info->Option = ReadToken(M, Record, Idx);
1843 Info->Toks = llvm::ArrayRef(Toks).copy(PP.getPreprocessorAllocator());
1849 Info->Action = static_cast<Sema::PragmaMsStackAction>(Record[Idx++]);
1851 Info->SlotLabel =
1853 Info->Alignment = ReadToken(M, Record, Idx);
1942 MI->setDefinitionEndLoc(ReadSourceLocation(F, Record, NextIndex));
1943 MI->setIsUsed(Record[NextIndex++]);
1944 MI->setUsedForHeaderGuard(Record[NextIndex++]);
1945 MacroTokens = MI->allocateTokens(Record[NextIndex++],
1948 // Decode function-like macro info.
1957 // Install function-like macro info.
1958 MI->setIsFunctionLike();
1959 if (isC99VarArgs) MI->setIsC99Varargs();
1960 if (isGNUVarArgs) MI->setIsGNUVarargs();
1961 if (hasCommaPasting) MI->setHasCommaPasting();
1962 MI->setParameterList(MacroParams, PP.getPreprocessorAllocator());
1976 PPRec.getPPEntityID(GlobalID - 1, /*isLoaded=*/true);
2012 I = M.PreprocessedEntityRemap.find(LocalID - NUM_PREDEF_PP_ENTITY_IDS);
2016 return LocalID + I->second;
2107 StringRef FrameworkName(FrameworkStrings + FrameworkOffset - 1);
2108 HFI.Framework = HS->getUniqueFrameworkName(FrameworkName);
2111 assert((End - d) % 4 == 0 &&
2198 if (II->isOutOfDate())
2245 ASTIdentifierLookupTrait Trait(IdTable->getInfoObj().getReader(), M,
2249 IdTable->find_hashed(Name, NameHash, &Trait);
2250 if (Pos == IdTable->end())
2281 if (GlobalIndex->lookupIdentifier(II.getName(), Hits)) {
2297 const_cast<IdentifierInfo *>(II)->setOutOfDate(false);
2395 // Deserialize the macro directives history in reverse source-order.
2420 Earliest->setPrevious(MD);
2457 if (!F.InputFileInfosLoaded[ID - 1].Filename.empty())
2458 return F.InputFileInfosLoaded[ID - 1];
2464 F.InputFileOffsets[ID - 1])) {
2528 F.InputFileInfosLoaded[ID - 1] = R;
2539 if (F.InputFilesLoaded[ID-1].getFile())
2540 return F.InputFilesLoaded[ID-1];
2542 if (F.InputFilesLoaded[ID-1].isNotFound())
2549 F.InputFileOffsets[ID - 1])) {
2592 F.InputFilesLoaded[ID-1] = InputFile::getNotFound();
2611 F.InputFilesLoaded[ID - 1] = InputFile::getNotFound();
2639 ErrorStr += File->getName();
2645 auto ContentHash = xxh3_64bits(MemBuffOrError.get()->getBuffer());
2652 if (StoredSize != File->getSize())
2653 return Change{Change::Size, StoredSize, File->getSize()};
2655 StoredTime != File->getModificationTime()) {
2657 File->getModificationTime()};
2691 while (!ImportStack.back()->ImportedBy.empty())
2692 ImportStack.push_back(ImportStack.back()->ImportedBy[0]);
2694 // The top-level PCH is stale.
2695 StringRef TopLevelPCHName(ImportStack.back()->FileName);
2697 << Filename << moduleKindForDiagnostic(ImportStack.back()->Kind)
2706 << Filename << ImportStack[0]->FileName;
2709 << ImportStack[I-1]->FileName << ImportStack[I]->FileName;
2723 F.InputFilesLoaded[ID-1] = IF;
2738 Filename == "<built-in>" || Filename == "<command line>")
2931 Listener->visitModuleFile(F.FileName, F.Kind);
2933 if (Listener && Listener->needsInputFileVisitation()) {
2934 unsigned N = Listener->needsSystemInputFileVisitation() ? NumInputs
2939 Listener->visitInputFile(
2972 // FIXME: Allow this for files explicitly specified with -include-pch.
3034 // or compiled, mark modules on error as out-of-date.
3071 // them can be error-prone and expensive). A module will have a name and
3179 << (ImportedBy ? StringRef(ImportedBy->ModuleName) : StringRef());
3181 Listener->ReadModuleName(F.ModuleName);
3204 if (M && M->Directory) {
3207 // Don't emit module relocation error if we have -fno-validate-pch
3212 if (!BuildDir || *BuildDir != M->Directory) {
3215 << F.ModuleName << Blob << M->Directory->getName();
3219 F.BaseDirectory = std::string(M->Directory->getName());
3271 DeclContext *DC = Ctx->getTranslationUnitDecl();
3272 if (DC->hasExternalLexicalStorage() && !Ctx->getLangOpts().CPlusPlus)
3273 DC->setMustBuildLookupTable();
3319 if (!PP.getPreprocessingRecord()->getExternalSource())
3320 PP.getPreprocessingRecord()->SetExternalSource(*this);
3423 DeclContext *TU = ContextObj->getTranslationUnitDecl();
3428 TU->setHasExternalLexicalStorage(true);
3503 "invalid special-types record");
3536 // FIXME: Ignore weak undeclared identifiers from non-original PCH
3558 // Introduce the global -> local mapping for selectors within this
3562 // Introduce the local -> global mapping for selectors within this
3566 F.BaseSelectorID - LocalBaseSelectorID));
3586 for (unsigned Idx = 0, N = Record.size() - 1; Idx < N; /* in loop */) {
3616 unsigned Idx = 0, End = Record.size() - 1;
3643 Listener->ReadCounter(F, Record[0]);
3671 unsigned(-F.SLocEntryBaseID) - F.LocalNumSLocEntries + 1;
3678 std::make_pair(SourceManager::MaxLoadedOffset - F.SLocEntryBaseOffset
3679 - SLocSpaceSize,&F));
3748 if (!PP.getPreprocessingRecord()->getExternalSource())
3749 PP.getPreprocessingRecord()->SetExternalSource(*this);
3752 ->allocateLoadedEntities(F.NumPreprocessedEntities);
3756 // Introduce the global -> local mapping for preprocessed entities in
3760 // Introduce the local -> global mapping for preprocessed entities in
3764 F.BasePreprocessedEntityID - LocalBasePreprocessedEntityID));
3777 if (!PP.getPreprocessingRecord()->getExternalSource())
3778 PP.getPreprocessingRecord()->SetExternalSource(*this);
3780 ->allocateSkippedRanges(F.NumPreprocessedSkippedRanges);
3903 "invalid undefined-but-used record");
3935 // FIXME: Deal with macros-only imports.
3942 DeserializationListener->ModuleImportRead(GlobalID, Loc);
3960 // Introduce the global -> local mapping for macros within this module.
3963 // Introduce the local -> global mapping for macros within this module.
3966 F.BaseMacroID - LocalBaseMacroID));
4120 static_cast<int>(BaseOffset - Offset)));
4123 mapOffset(MacroIDOffset, OM->BaseMacroID, MacroRemap);
4124 mapOffset(PreprocessedEntityIDOffset, OM->BasePreprocessedEntityID,
4126 mapOffset(SubmoduleIDOffset, OM->BaseSubmoduleID, SubmoduleRemap);
4127 mapOffset(SelectorIDOffset, OM->BaseSelectorID, SelectorRemap);
4140 // top-level AST file is a main file, skip this check because there is no
4145 F.Kind == MK_ImplicitModule && ModuleMgr.begin()->Kind != MK_MainFile) {
4146 // An implicitly-loaded module file should have its module listed in some
4153 // Don't emit module relocation error if we have -fno-validate-pch
4158 if (auto ASTFE = M ? M->getASTFile() : std::nullopt) {
4161 << ASTFE->getName();
4166 << (ImportedBy ? ImportedBy->FileName : "") << F.ModuleMapPath
4171 if (ImportedBy && ImportedBy->Kind == MK_PCH)
4179 assert(M && M->Name == F.ModuleName && "found module with different name");
4186 "top-level import should be verified");
4190 << F.ModuleName << (NotImported ? F.FileName : ImportedBy->FileName)
4191 << ModMap->getName() << F.ModuleMapPath << NotImported;
4234 Listener->ReadModuleMapFile(F.ModuleMapPath);
4242 S.ObjC().MethodPool.find(Method->getSelector());
4247 ObjCMethodList &Start = Method->isInstanceMethod()? Known->second.first
4248 : Known->second.second;
4250 for (ObjCMethodList *List = &Start; List; List = List->getNext()) {
4252 if (List->getMethod() == Method) {
4260 if (List->getNext())
4261 List->setMethod(List->getNext()->getMethod());
4263 List->setMethod(Method);
4268 assert(Owner->NameVisibility != Module::Hidden && "nothing to make visible?");
4270 bool wasHidden = !D->isUnconditionallyVisible();
4271 D->setVisibleDespiteOwningModule();
4290 if (NameVisibility <= Mod->NameVisibility) {
4291 // This module already has this level of visibility (or greater), so
4296 if (Mod->isUnimportable()) {
4302 Mod->NameVisibility = NameVisibility;
4317 Mod->getExportedModules(Exports);
4332 if (!Def->isUnconditionallyVisible()) {
4334 if (MergedDef->isUnconditionallyVisible())
4335 Def->setVisibleDespiteOwningModule();
4338 Def, MergedDef->getImportedOwningModule(),
4407 // Ignore top-level records.
4463 // to be out-of-date. Just remove it.
4531 // instance are marked out-of-date so that they can be deserialized
4539 II = It->second;
4543 // table of the importing instance and marked as out-of-date. This makes
4544 // ASTReader::get() a no-op, and deserialization will take place on
4549 II->setOutOfDate(true);
4562 // identifiers as out-of-date, so that they are deserialized on first use.
4565 Id.second->setOutOfDate(true);
4600 Unresolved.Mod->Conflicts.push_back(Conflict);
4606 Unresolved.Mod->Imports.insert(ResolvedMod);
4611 Unresolved.Mod->AffectingClangModules.insert(ResolvedMod);
4616 Unresolved.Mod->Exports.push_back(
4634 DeserializationListener->ReaderInitialized(this);
4648 // For any Objective-C class definitions we have already loaded, make sure
4652 loadObjCCategories(ObjCClassesLoaded[I]->getGlobalID(),
4660 // up-to-date. For implicitly-built module files, ensure the corresponding
4661 // timestamp files are up-to-date in this build session.
4664 if (M.Mod->Kind == MK_ImplicitModule &&
4665 M.Mod->InputFilesValidationTimestamp < HSOpts.BuildSessionTimestamp)
4729 << M->ModuleName << M->FileName << (ImportedBy ? true : false)
4730 << (ImportedBy ? StringRef(ImportedBy->ModuleName) : StringRef());
4750 // We couldn't load the module file because it is out-of-date. If the
4751 // client can handle out-of-date, return it.
4775 F.SizeInBits = F.Buffer->getBufferSize() * 8;
4798 Error("invalid record at top-level of AST file");
4810 // Check that we didn't try to load a non-module AST file as a module.
4892 // If -Wno-system-headers (the default), and the first import is as a
4893 // system module, then validation will fail during the as-user import,
4894 // since -Werror flags won't have been validated. However, it's reasonable
4897 // If -Wsystem-headers, the PCM on disk was built with
4898 // -Wno-system-headers, and the first import is as a user module, then
4899 // validation will fail during the as-system import since the PCM on disk
4900 // doesn't guarantee that -Werror was respected. However, the -Werror
4901 // flags were checked during the initial as-user import.
4966 F->Signature = ASTFileSignature::create(Blob.begin(), Blob.end());
4967 assert(F->Signature != ASTFileSignature::createDummy() &&
4973 F->ASTBlockHash = ASTFileSignature::create(Blob.begin(), Blob.end());
4974 assert(F->ASTBlockHash != ASTFileSignature::createDummy() &&
4996 if (F->PragmaDiagMappings.empty())
4997 F->PragmaDiagMappings.swap(Record);
4999 F->PragmaDiagMappings.insert(F->PragmaDiagMappings.end(),
5004 F->SearchPathUsage = ReadBitVector(Record, Blob);
5008 F->VFSUsage = ReadBitVector(Record, Blob);
5078 if (auto Reader = Known->second->createExtensionReader(Metadata, *this,
5097 DeserializationListener->DeclRead(
5102 // built-in types. Right now, we just ignore the problem.
5119 if (const TypedefType *Typedef = FileType->getAs<TypedefType>())
5120 Context.setFILEDecl(Typedef->getDecl());
5122 const TagType *Tag = FileType->getAs<TagType>();
5127 Context.setFILEDecl(Tag->getDecl());
5140 if (const TypedefType *Typedef = Jmp_bufType->getAs<TypedefType>())
5141 Context.setjmp_bufDecl(Typedef->getDecl());
5143 const TagType *Tag = Jmp_bufType->getAs<TagType>();
5148 Context.setjmp_bufDecl(Tag->getDecl());
5161 if (const TypedefType *Typedef = Sigjmp_bufType->getAs<TypedefType>())
5162 Context.setsigjmp_bufDecl(Typedef->getDecl());
5164 const TagType *Tag = Sigjmp_bufType->getAs<TagType>();
5166 Context.setsigjmp_bufDecl(Tag->getDecl());
5196 if (const TypedefType *Typedef = Ucontext_tType->getAs<TypedefType>())
5197 Context.setucontext_tDecl(Typedef->getDecl());
5199 const TagType *Tag = Ucontext_tType->getAs<TagType>();
5201 Context.setucontext_tDecl(Tag->getDecl());
5216 // Re-export any modules that were imported by a non-module AST file.
5217 // FIXME: This does not make macro-only imports visible again.
5800 SubmoduleID GlobalIndex = GlobalID - NUM_PREDEF_SUBMODULE_IDS;
5807 if (OptionalFileEntryRef CurFile = CurrentModule->getASTFile()) {
5808 // Don't emit module relocation error if we have -fno-validate-pch
5814 ContextObj->DiagAllocator)
5815 << CurrentModule->getTopLevelModuleName() << CurFile->getName()
5822 CurrentModule->setASTFile(F.File);
5823 CurrentModule->PresumedModuleMapFile = F.ModuleMapPath;
5826 CurrentModule->Kind = Kind;
5827 CurrentModule->DefinitionLoc = DefinitionLoc;
5828 CurrentModule->Signature = F.Signature;
5829 CurrentModule->IsFromModuleFile = true;
5830 CurrentModule->IsSystem = IsSystem || CurrentModule->IsSystem;
5831 CurrentModule->IsExternC = IsExternC;
5832 CurrentModule->InferSubmodules = InferSubmodules;
5833 CurrentModule->InferExplicitSubmodules = InferExplicitSubmodules;
5834 CurrentModule->InferExportWildcard = InferExportWildcard;
5835 CurrentModule->ConfigMacrosExhaustive = ConfigMacrosExhaustive;
5836 CurrentModule->ModuleMapIsPrivate = ModuleMapIsPrivate;
5837 CurrentModule->NamedModuleHasInit = NamedModuleHasInit;
5839 DeserializationListener->ModuleRead(GlobalID, CurrentModule);
5844 CurrentModule->LinkLibraries.clear();
5845 CurrentModule->ConfigMacros.clear();
5846 CurrentModule->UnresolvedConflicts.clear();
5847 CurrentModule->Conflicts.clear();
5850 // requirements will be (re-)added by SUBMODULE_REQUIRES records.
5852 // make it unavailable -- if we got this far, this must be an explicitly
5854 CurrentModule->Requirements.clear();
5855 CurrentModule->MissingHeaders.clear();
5856 CurrentModule->IsUnimportable =
5857 ParentModule && ParentModule->IsUnimportable;
5858 CurrentModule->IsAvailable = !CurrentModule->IsUnimportable;
5869 if (!CurrentModule->getUmbrellaHeaderAsWritten()) {
5885 // FIXME: Re-evaluate this section; maybe only store InputFile IDs instead
5898 CurrentModule->addTopHeaderFilename(HeaderName);
5908 if (!CurrentModule->getUmbrellaDirAsWritten()) {
5921 // Introduce the global -> local mapping for submodules within this
5925 // Introduce the local -> global mapping for submodules within this
5929 F.BaseSubmoduleID - LocalBaseSubmoduleID));
5973 CurrentModule->UnresolvedExports.clear();
5977 CurrentModule->addRequirement(Blob, Record[0], PP.getLangOpts(),
5983 CurrentModule->LinkLibraries.push_back(
5988 CurrentModule->ConfigMacros.push_back(Blob.str());
6009 ContextObj->addLazyModuleInitializers(CurrentModule, Inits);
6014 CurrentModule->ExportAsModule = Blob.str();
6043 for (unsigned N = Record[Idx++]; N; --N)
6053 for (unsigned N = Record[Idx++]; N; --N) {
6060 for (unsigned N = Record[Idx++]; N; --N) {
6079 for (unsigned N = Record[Idx++]; N; --N) {
6082 for (unsigned N = Record[Idx++]; N; --N) {
6094 #define DIAGOPT(Name, Bits, Default) DiagOpts->Name = Record[Idx++];
6096 DiagOpts->set##Name(static_cast<Type>(Record[Idx++]));
6099 for (unsigned N = Record[Idx++]; N; --N)
6100 DiagOpts->Warnings.push_back(ReadString(Record, Idx));
6101 for (unsigned N = Record[Idx++]; N; --N)
6102 DiagOpts->Remarks.push_back(ReadString(Record, Idx));
6145 for (unsigned N = Record[Idx++]; N; --N) {
6156 for (unsigned N = Record[Idx++]; N; --N) {
6163 for (unsigned N = Record[Idx++]; N; --N) {
6181 for (unsigned N = Record[Idx++]; N; --N) {
6189 for (unsigned N = Record[Idx++]; N; --N) {
6194 for (unsigned N = Record[Idx++]; N; --N) {
6214 ModuleFile *M = I->second;
6215 unsigned LocalIndex = GlobalIndex - M->BasePreprocessedEntityID;
6222 return PPRec->getIteratorsForLoadedRange(Mod.BasePreprocessedEntityID,
6247 ModuleFile *M = I->second;
6248 unsigned LocalIndex = GlobalIndex - M->BasePreprocessedSkippedRangeID;
6249 assert(LocalIndex < M->NumPreprocessedSkippedRanges);
6250 PPSkippedRange RawRange = M->PreprocessedSkippedRangeOffsets[LocalIndex];
6310 PPRec.getLoadedPreprocessedEntity(GlobalID - 1));
6329 DeserializationListener->MacroDefinitionRead(PPID, MD);
6336 StringRef FullFileName(FullFileNameStart, Blob.size() - Record[0]);
6368 ModuleFile &M = *SLocMapI->second;
6413 SourceManager::MaxLoadedOffset - Loc.getOffset() - 1);
6417 if (SLocMapI->second->NumPreprocessedEntities == 0)
6420 ModuleFile &M = *SLocMapI->second;
6445 ReadSourceLocation(M, PPI->getEnd()), Loc)) {
6448 Count = Count - Half - 1;
6457 return M.BasePreprocessedEntityID + (PPI - pp_begin);
6512 // Look in the on-disk hash table for an entry for this file name.
6513 HeaderFileInfoLookupTable::iterator Pos = Table->find(FE);
6514 if (Pos == Table->end())
6551 return DiagStates[BackrefID - 1];
6560 while (Size--) {
6567 DiagnosticMapping &Mapping = NewState->getOrAddMapping(DiagID);
6585 // Implicitly-built modules are reused with different diagnostic
6599 // command line (-w, -Weverything, -Werror, ...) along with any explicit
6600 // -Wblah flags.
6627 while (NumLocations--) {
6675 return RecordLocation(M, M->TypeOffsets[Index - M->BaseTypeIndex].get() +
6676 M->DeclsBlockStartOffset);
6699 BitstreamCursor &DeclsCursor = Loc.F->DeclsCursor;
6769 // We want compile-time assurance that we've enumerated all of
6771 // define them out-of-line.
7033 TL.getTypePtr()->template_arguments()[i].getKind()));
7067 TL.getTypePtr()->template_arguments()[I].getKind()));
7135 readTypeLoc(TInfo->getTypeLoc());
7160 ModuleFile *OwningModuleFile = &getModuleManager()[ModuleFileIndex - 1];
7165 OwningModuleFile->BaseTypeIndex + getIndexForTypeID(ID)};
7451 assert(Index < TypesLoaded.size() && "Type index out-of-range");
7457 TypesLoaded[Index]->setFromAST();
7459 DeserializationListener->TypeRead(TypeIdx::fromTypeID(ID),
7482 LocalID -= NUM_PREDEF_TYPE_IDS << Qualifiers::FastWidth;
7485 ModuleFileIndex ? *F.TransitiveImports[ModuleFileIndex - 1] : F;
7561 if (!D->getDeclContext()) {
7566 const DeclContext *DC = D->getDeclContext()->getRedeclContext();
7573 if (isa<TranslationUnitDecl, NamespaceDecl, RecordDecl, EnumDecl>(DC)) {
7574 if (DeclarationName Name = cast<NamedDecl>(D)->getDeclName()) {
7576 isa<TranslationUnitDecl>(DC)) {
7581 assert(II && "non-identifier name in C?");
7582 if (II->isOutOfDate())
7585 DC->lookup(Name);
7588 for (auto *DCDecl : cast<Decl>(D->getLexicalDeclContext())->redecls()) {
7589 auto *DC = cast<DeclContext>(DCDecl);
7592 DC, [&](Decl::Kind K) { return K == D->getKind(); }, Decls);
7598 CTSD->getSpecializedTemplate()->LoadLazySpecializations();
7600 VTSD->getSpecializedTemplate()->LoadLazySpecializations();
7602 if (auto *Template = FD->getPrimaryTemplate())
7603 Template->LoadLazySpecializations();
7610 BitstreamCursor &Cursor = Loc.F->DeclsCursor;
7645 BitstreamCursor &Cursor = Loc.F->DeclsCursor;
7696 : F.TransitiveImports[OwningModuleFileIndex - 1];
7699 ID -= NUM_PREDEF_DECL_IDS;
7701 uint64_t NewModuleFileIndex = OwningModuleFile->Index + 1;
7711 return M.Index == ModuleFileIndex - 1;
7722 return &getModuleManager()[ModuleFileIndex - 1];
7726 if (!D->isFromASTFile())
7729 return getOwningModuleFile(D->getGlobalID());
7737 return D->getLocation();
7810 return OwningModuleFile->BaseDeclIndex + GlobalID.getLocalDeclIndex();
7820 // pre-existing predefined declaration \p D.
7821 auto &Merged = KeyDecls[D->getCanonicalDecl()];
7831 assert(0 && "declaration ID out-of-range for AST file");
7832 Error("declaration ID out-of-range for AST file");
7846 assert(0 && "declaration ID out-of-range for AST file");
7847 Error("declaration ID out-of-range for AST file");
7854 DeserializationListener->DeclRead(ID, DeclsLoaded[Index]);
7910 if (llvm::Error Err = Loc.F->DeclsCursor.JumpToBit(Loc.Offset)) {
7921 const DeclContext *DC, llvm::function_ref<bool(Decl::Kind)> IsKindWeWant,
7944 assert(D->getKind() == K && "wrong kind for lexical decl");
7945 if (!DC->isDeclInLexicalTraversal(D))
7951 if (isa<TranslationUnitDecl>(DC)) {
7955 auto I = LexicalDecls.find(DC);
7957 Visit(I->second.first, I->second.second);
8007 FileDeclsInfo &DInfo = I->second;
8019 --BeginIt;
8021 // If we are pointing at a top-level decl inside an objc container, we need
8027 ->isTopLevelDeclInObjCContainer())
8028 --BeginIt;
8042 ASTReader::FindExternalVisibleDeclsByName(const DeclContext *DC,
8044 assert(DC->hasExternalVisibleStorage() && DC == DC->getPrimaryContext() &&
8049 auto It = Lookups.find(DC);
8059 for (GlobalDeclID ID : It->second.Table.find(Name)) {
8061 if (ND->getDeclName() == Name && Found.insert(ND).second)
8066 SetExternalVisibleDeclsForName(DC, Name, Decls);
8070 void ASTReader::completeVisibleDeclsMap(const DeclContext *DC) {
8071 if (!DC->hasExternalVisibleStorage())
8074 auto It = Lookups.find(DC);
8080 for (GlobalDeclID ID : It->second.Table.findAll()) {
8082 Decls[ND->getDeclName()].push_back(ND);
8088 SetExternalVisibleDeclsForName(DC, I->first, I->second);
8090 const_cast<DeclContext *>(DC)->setHasExternalVisibleStorage(false);
8096 return I == Lookups.end() ? nullptr : &I->second;
8099 /// Under non-PCH compilation the consumer receives the objc methods
8107 for (auto *I : ImplD->methods())
8108 Consumer->HandleInterestingDecl(DeclGroupRef(I));
8110 Consumer->HandleInterestingDecl(DeclGroupRef(ImplD));
8117 Consumer->HandleInterestingDecl(DeclGroupRef(D));
8121 Consumer->HandleVTable(RD);
8125 this->Consumer = Consumer;
8131 DeserializationListener->ReaderInitialized(this);
8138 TypesLoaded.size() - llvm::count(TypesLoaded.materialized(), QualType());
8140 DeclsLoaded.size() -
8143 IdentifiersLoaded.size() -
8146 MacrosLoaded.size() - llvm::count(MacrosLoaded, (MacroInfo *)nullptr);
8148 SelectorsLoaded.size() - llvm::count(SelectorsLoaded, Selector());
8214 GlobalIndex->printStats();
8235 llvm::errs() << " " << (DeclID)I->first << " -> " << I->second->FileName
8255 /// by heap-backed versus mmap'ed memory.
8259 size_t bytes = buf->getBufferSize();
8260 switch (buf->getBufferKind()) {
8280 pushExternalDeclIntoScope(D, D->getDeclName());
8289 SemaObj->CurFPFeatures =
8290 NewOverrides.applyOverrides(SemaObj->getLangOpts());
8293 SemaObj->OpenCLFeatures = OpenCLExtensions;
8306 if (!SemaObj->StdNamespace)
8307 SemaObj->StdNamespace = SemaDeclRefs[I].getRawValue();
8308 if (!SemaObj->StdBadAlloc)
8309 SemaObj->StdBadAlloc = SemaDeclRefs[I + 1].getRawValue();
8310 if (!SemaObj->StdAlignValT)
8311 SemaObj->StdAlignValT = SemaDeclRefs[I + 2].getRawValue();
8319 SemaObj->ActOnPragmaOptimize(/* On = */ false, OptimizeOffPragmaLocation);
8320 if (PragmaMSStructState != -1)
8321 SemaObj->ActOnPragmaMSStruct((PragmaMSStructKind)PragmaMSStructState);
8323 SemaObj->ActOnPragmaMSPointersToMembers(
8328 SemaObj->CUDA().ForceHostDeviceDepth = ForceHostDeviceDepth;
8338 SemaObj->AlignPackStack.DefaultValue &&
8340 SemaObj->AlignPackStack.Stack.emplace_back(
8342 SemaObj->AlignPackStack.CurrentValue,
8343 SemaObj->AlignPackStack.CurrentPragmaLocation,
8349 SemaObj->AlignPackStack.Stack.emplace_back(
8354 SemaObj->AlignPackStack.DefaultValue &&
8358 SemaObj->AlignPackStack.CurrentValue = *PragmaAlignPackCurrentValue;
8359 SemaObj->AlignPackStack.CurrentPragmaLocation =
8365 // to the current value to ensure that fp-pragma state is preserved after
8370 SemaObj->FpPragmaStack.DefaultValue &&
8372 SemaObj->FpPragmaStack.Stack.emplace_back(
8373 FpPragmaStack.front().SlotLabel, SemaObj->FpPragmaStack.CurrentValue,
8374 SemaObj->FpPragmaStack.CurrentPragmaLocation,
8380 SemaObj->FpPragmaStack.Stack.emplace_back(
8383 assert(*FpPragmaCurrentValue == SemaObj->FpPragmaStack.DefaultValue &&
8387 SemaObj->FpPragmaStack.CurrentValue = *FpPragmaCurrentValue;
8388 SemaObj->FpPragmaStack.CurrentPragmaLocation = FpPragmaCurrentLocation;
8392 // For non-modular AST files, restore visiblity of modules.
8397 SemaObj->makeModuleVisible(Imported, Import.ImportLoc);
8425 if (GlobalIndex->lookupIdentifier(Name, Hits)) {
8440 /// An identifier-lookup iterator that enumerates all of the
8481 --Index;
8488 Current = IdTable->key_begin();
8489 End = IdTable->key_end();
8515 StringRef result = Current->Next();
8533 GlobalIndex->createIdentifierIterator());
8571 ASTSelectorLookupTable::iterator Pos = PoolTable->find(Sel);
8572 if (Pos == PoolTable->end())
8583 Reader.DeserializationListener->SelectorRead(Data.ID, Sel);
8655 Pos->second.first.setBits(Visitor.getInstanceBits());
8656 Pos->second.first.setHasMoreThanOneDecl(Visitor.instanceHasMoreThanOneDecl());
8657 Pos->second.second.setBits(Visitor.getFactoryBits());
8658 Pos->second.second.setHasMoreThanOneDecl(Visitor.factoryHasMoreThanOneDecl());
8663 addMethodsToPool(S, Visitor.getInstanceMethods(), Pos->second.first);
8664 addMethodsToPool(S, Visitor.getFactoryMethods(), Pos->second.second);
8780 // implementation of -Wselector.
8781 unsigned int DataSize = ReferencedSelectorsData.size()-1;
8846 LT->D = ReadDecl(*FMod, LateParsed, Idx);
8847 LT->FPO = FPOptions::getFromOpaqueInt(LateParsed[Idx++]);
8849 ModuleFile *F = getOwningModuleFile(LT->D);
8853 LT->Toks.reserve(TokN);
8855 LT->Toks.push_back(ReadToken(*F, LateParsed, Idx));
8865 if (Lambda->getLambdaContextDecl()) {
8869 {{Lambda->getLambdaContextDecl()->getCanonicalDecl(),
8870 Lambda->getLambdaIndexInContext()},
8881 assert(ID && "Non-zero identifier ID required");
8886 DeserializationListener->IdentifierRead(ID, II);
8889 /// Set the globally-visible declarations associated with the given
8896 /// \param II an IdentifierInfo that refers to one or more globally-visible
8902 /// \param Decls if non-null, this vector will be populated with the set of
8926 Decls->push_back(D);
8930 // Introduce this declaration into the translation-unit scope
8946 assert(getModuleManager().size() > ModuleFileIndex - 1);
8948 ModuleFile &MF = getModuleManager()[ModuleFileIndex - 1];
8965 assert(Index >= M->BaseIdentifierID);
8966 unsigned LocalIndex = Index - M->BaseIdentifierID;
8968 M->IdentifierTableData + M->IdentifierOffsets[LocalIndex];
8977 DeserializationListener->IdentifierRead(ID, &II);
8997 ModuleFileIndex ? M.TransitiveImports[ModuleFileIndex - 1] : &M;
9001 LocalID -= NUM_PREDEF_IDENT_IDS;
9003 return ((IdentifierID)(MF->Index + 1) << 32) | LocalID;
9015 ID -= NUM_PREDEF_MACRO_IDS;
9020 ModuleFile *M = I->second;
9021 unsigned Index = ID - M->BaseMacroID;
9023 ReadMacroRecord(*M, M->MacroOffsetsBase + M->MacroOffsets[Index]);
9026 DeserializationListener->MacroRead(ID + NUM_PREDEF_MACRO_IDS,
9041 = M.MacroRemap.find(LocalID - NUM_PREDEF_MACRO_IDS);
9044 return LocalID + I->second;
9056 = M.SubmoduleRemap.find(LocalID - NUM_PREDEF_SUBMODULE_IDS);
9060 return LocalID + I->second;
9074 return SubmodulesLoaded[GlobalID - NUM_PREDEF_SUBMODULE_IDS];
9085 return I == GlobalSubmoduleMap.end() ? nullptr : I->second;
9090 return getModuleManager().pch_modules().end()[-IndexFromEnd];
9098 // For a file representing a module, use the submodule ID of the top-level
9102 if (M->isModule())
9103 return ((M->BaseSubmoduleID + NUM_PREDEF_SUBMODULE_IDS) << 1) | 1;
9108 return (I - PCHModules.end()) << 1;
9133 return I->second ? EK_Never : EK_Always;
9149 if (SelectorsLoaded[ID - 1].getAsOpaquePtr() == nullptr) {
9153 ModuleFile &M = *I->second;
9155 unsigned Idx = ID - M.BaseSelectorID - NUM_PREDEF_SELECTOR_IDS;
9156 SelectorsLoaded[ID - 1] =
9159 DeserializationListener->SelectorRead(ID, SelectorsLoaded[ID - 1]);
9162 return SelectorsLoaded[ID - 1];
9183 = M.SelectorRemap.find(LocalID - NUM_PREDEF_SELECTOR_IDS);
9187 return LocalID + I->second;
9249 while (NumParams--)
9265 while (NumTemplateArgs--)
9273 while (NumDecls--) {
9351 BOMInit->setSourceOrder(SourceOrder);
9399 Template? T->getTypeLoc().getBeginLoc() : SourceLocation(),
9400 T->getTypeLoc(), ColonColonLoc);
9441 /// Read a floating-point value
9477 return VersionTuple(Major, Minor - 1);
9478 return VersionTuple(Major, Minor - 1, Subminor - 1);
9499 SemaObj->warnStackExhausted(Loc);
9516 /// Record that the given ID maps to the given switch-case
9524 /// Retrieve the switch-case statement with the given ID.
9531 CurrSwitchCaseStmts->clear();
9543 BitstreamCursor &Cursor = I->first;
9544 serialization::ModuleFile &F = *I->second;
9595 SourceLocation CommentLoc = C->getBeginLoc();
9656 // If any identifiers with corresponding top-level declarations have
9675 FD->setType(GetType(PendingDeducedFunctionTypes[I].second));
9677 if (auto *DT = FD->getReturnType()->getContainedDeducedType()) {
9680 if (DT->isDeduced()) {
9682 {FD->getCanonicalDecl(), FD->getReturnType()});
9699 VD->setType(GetType(PendingDeducedVarTypes[I].second));
9716 // Make the most recent of the top-level declarations visible.
9719 IdentifierInfo *II = TLD->first;
9720 for (unsigned I = 0, N = TLD->second.size(); I != N; ++I) {
9721 pushExternalDeclIntoScope(cast<NamedDecl>(TLD->second[I]), II);
9730 // Initialize the macro history from chained-PCHs ahead of module imports.
9734 if (!Info.M->isModule())
9741 if (Info.M->isModule())
9754 Info.D->setDeclContextsImpl(SemaDC, LexicalDC, getContext());
9770 ExtensionsPair.first->getASTContext(),
9771 ExtensionsPair.second->getASTContext(), NonEquivalentDecls,
9780 Ivar->setDeclContextsImpl(PrevIvar->getDeclContext(),
9781 Ivar->getLexicalDeclContext(),
9783 getContext().setPrimaryMergedDecl(Ivar, PrevIvar->getCanonicalDecl());
9786 ExtensionsPair.first->setInvalidDecl();
9787 ExtensionsPair.second->getClassInterface()
9788 ->getDefinition()
9789 ->setIvarList(nullptr);
9792 Diag(IvarPair.first->getLocation(),
9794 << IvarPair.first->getIdentifier();
9795 Diag(IvarPair.second->getLocation(), diag::note_previous_definition);
9807 // If we deserialized any C++ or Objective-C class definitions, any
9808 // Objective-C protocol definitions, or any redeclarable templates, make sure
9813 if (const TagType *TagT = dyn_cast<TagType>(TD->getTypeForDecl())) {
9815 const_cast<TagType*>(TagT)->decl = TD;
9820 R = R->getPreviousDecl()) {
9822 cast<CXXRecordDecl>(R)->isThisDeclarationADefinition() &&
9824 cast<CXXRecordDecl>(R)->DefinitionData = RD->DefinitionData;
9833 const_cast<ObjCInterfaceType *>(cast<ObjCInterfaceType>(ID->TypeForDecl))
9834 ->Decl = ID;
9836 for (auto *R = getMostRecentExistingDecl(ID); R; R = R->getPreviousDecl())
9837 cast<ObjCInterfaceDecl>(R)->Data = ID->Data;
9843 for (auto *R = getMostRecentExistingDecl(PD); R; R = R->getPreviousDecl())
9844 cast<ObjCProtocolDecl>(R)->Data = PD->Data;
9849 auto RTD = cast<RedeclarableTemplateDecl>(D)->getCanonicalDecl();
9850 for (auto *R = getMostRecentExistingDecl(RTD); R; R = R->getPreviousDecl())
9851 cast<RedeclarableTemplateDecl>(R)->Common = RTD->Common;
9862 if (FunctionDecl *FD = dyn_cast<FunctionDecl>(PB->first)) {
9872 if (auto *RD = dyn_cast<CXXRecordDecl>(FD->getLexicalParent()))
9873 if (RD->isDependentContext() && !RD->isThisDeclarationADefinition())
9878 if (!getContext().getLangOpts().Modules || !FD->hasBody(Defn)) {
9879 FD->setLazyBody(PB->second);
9884 if (!FD->isLateTemplateParsed() &&
9885 !NonConstDefn->isLateTemplateParsed() &&
9890 FD->getODRHash() != NonConstDefn->getODRHash()) {
9893 } else if (FD->getLexicalParent()->isFileContext() &&
9894 NonConstDefn->getLexicalParent()->isFileContext()) {
9895 // Only diagnose out-of-line method definitions. If they are
9905 ObjCMethodDecl *MD = cast<ObjCMethodDecl>(PB->first);
9906 if (!getContext().getLangOpts().Modules || !MD->hasBody())
9907 MD->setLazyBody(PB->second);
9913 RD->addedMember(MD);
9933 // odr-merging problems, so we can produce better diagnostics for them.
9939 Merge.first->buildLookup();
9940 Merge.first->decls_begin();
9941 Merge.first->bases_begin();
9942 Merge.first->vbases_begin();
9945 RD->decls_begin();
9946 RD->bases_begin();
9947 RD->vbases_begin();
9955 Merge.first->decls_begin();
9957 D->decls_begin();
9965 Merge.first->decls_begin();
9967 InterfacePair.first->decls_begin();
9974 Merge.first->buildLookup();
9975 Merge.first->decls_begin();
9976 Merge.first->getBody();
9978 FD->buildLookup();
9979 FD->decls_begin();
9980 FD->getBody();
9988 Merge.first->decls_begin();
9990 Enum->decls_begin();
9999 Merge.first->decls_begin();
10001 ProtocolPair.first->decls_begin();
10009 // PendingOdrMergeChecks. Don't turn this into a range-based for loop!
10014 // like implicitly-declared special member functions. This isn't entirely
10017 if (D->isImplicit())
10020 DeclContext *CanonDef = D->getDeclContext();
10023 const Decl *DCanon = D->getCanonicalDecl();
10025 for (auto *RI : D->redecls()) {
10026 if (RI->getLexicalDeclContext() == CanonDef) {
10041 for (auto *CanonMember : CanonDef->decls()) {
10042 if (CanonMember->getCanonicalDecl() == DCanon) {
10052 if (ND->getDeclName() == D->getDeclName())
10060 D->setInvalidDecl();
10069 Diag(D->getLocation(), diag::err_module_odr_violation_missing_decl)
10074 Diag(cast<Decl>(CanonDef)->getLocation(),
10078 Diag(Candidates[I]->getLocation(),
10096 // Issue any pending ODR-failure diagnostics.
10120 Diag(Merge.first->getLocation(),
10126 // Issue any pending ODR-failure diagnostics for RecordDecl in C/ObjC. Note
10220 ReadTimer->startTimer();
10228 // are finished, to avoid recursively re-calling finishPendingActions().
10231 --NumCurrentElementsDeserializing;
10245 auto *FPT = Update.second->getType()->castAs<FunctionProtoType>();
10246 auto ESI = FPT->getExtProtoInfo().ExceptionSpec;
10248 Listener->ResolvedExceptionSpec(cast<FunctionDecl>(Update.second));
10249 for (auto *Redecl : Update.second->redecls())
10267 (void)UndeducedFD->getMostRecentDecl();
10271 ReadTimer->stopTimer();
10287 for (auto *ND : It->second)
10288 SemaObj->IdResolver.RemoveDecl(ND);
10292 It->second.clear();
10296 if (SemaObj->IdResolver.tryAddTopLevelDecl(D, Name) && SemaObj->TUScope) {
10297 SemaObj->TUScope->AddDecl(D);
10298 } else if (SemaObj->TUScope) {
10302 if (llvm::is_contained(SemaObj->IdResolver.decls(Name), D))
10303 SemaObj->TUScope->AddDecl(D);
10334 auto BlockName = Ext->getExtensionMetadata().BlockName;
10352 return SemaObj ? SemaObj->IdResolver : DummyIdResolver;
10361 //===----------------------------------------------------------------------===//
10363 ////===----------------------------------------------------------------------===//
10726 C->setLocStart(Record.readSourceLocation());
10727 C->setLocEnd(Record.readSourceLocation());
10733 C->setPreInitStmt(Record.readSubStmt(),
10739 C->setPostUpdateExpr(Record.readSubExpr());
10744 C->setNameModifier(static_cast<OpenMPDirectiveKind>(Record.readInt()));
10745 C->setNameModifierLoc(Record.readSourceLocation());
10746 C->setColonLoc(Record.readSourceLocation());
10747 C->setCondition(Record.readSubExpr());
10748 C->setLParenLoc(Record.readSourceLocation());
10753 C->setCondition(Record.readSubExpr());
10754 C->setLParenLoc(Record.readSourceLocation());
10759 C->setNumThreads(Record.readSubExpr());
10760 C->setLParenLoc(Record.readSourceLocation());
10764 C->setSafelen(Record.readSubExpr());
10765 C->setLParenLoc(Record.readSourceLocation());
10769 C->setSimdlen(Record.readSubExpr());
10770 C->setLParenLoc(Record.readSourceLocation());
10774 for (Expr *&E : C->getSizesRefs())
10776 C->setLParenLoc(Record.readSourceLocation());
10782 C->setFactor(Record.readSubExpr());
10783 C->setLParenLoc(Record.readSourceLocation());
10787 C->setAllocator(Record.readExpr());
10788 C->setLParenLoc(Record.readSourceLocation());
10792 C->setNumForLoops(Record.readSubExpr());
10793 C->setLParenLoc(Record.readSourceLocation());
10797 C->setDefaultKind(static_cast<llvm::omp::DefaultKind>(Record.readInt()));
10798 C->setLParenLoc(Record.readSourceLocation());
10799 C->setDefaultKindKwLoc(Record.readSourceLocation());
10803 C->setProcBindKind(static_cast<llvm::omp::ProcBindKind>(Record.readInt()));
10804 C->setLParenLoc(Record.readSourceLocation());
10805 C->setProcBindKindKwLoc(Record.readSourceLocation());
10810 C->setScheduleKind(
10812 C->setFirstScheduleModifier(
10814 C->setSecondScheduleModifier(
10816 C->setChunkSize(Record.readSubExpr());
10817 C->setLParenLoc(Record.readSourceLocation());
10818 C->setFirstScheduleModifierLoc(Record.readSourceLocation());
10819 C->setSecondScheduleModifierLoc(Record.readSourceLocation());
10820 C->setScheduleKindLoc(Record.readSourceLocation());
10821 C->setCommaLoc(Record.readSourceLocation());
10825 C->setNumForLoops(Record.readSubExpr());
10826 for (unsigned I = 0, E = C->NumberOfLoops; I < E; ++I)
10827 C->setLoopNumIterations(I, Record.readSubExpr());
10828 for (unsigned I = 0, E = C->NumberOfLoops; I < E; ++I)
10829 C->setLoopCounter(I, Record.readSubExpr());
10830 C->setLParenLoc(Record.readSourceLocation());
10834 C->setEventHandler(Record.readSubExpr());
10835 C->setLParenLoc(Record.readSourceLocation());
10849 if (C->isExtended()) {
10850 C->setLParenLoc(Record.readSourceLocation());
10851 C->setArgumentLoc(Record.readSourceLocation());
10852 C->setDependencyKind(Record.readEnum<OpenMPDependClauseKind>());
10863 C->setLParenLoc(Record.readSourceLocation());
10865 C->setFailParameterLoc(FailParameterLoc);
10867 C->setFailParameter(CKind);
10889 unsigned NumVars = C->varlist_size();
10894 C->setVarRefs(Vars);
10895 C->setIsTarget(Record.readBool());
10896 C->setIsTargetSync(Record.readBool());
10897 C->setLParenLoc(Record.readSourceLocation());
10898 C->setVarLoc(Record.readSourceLocation());
10902 C->setInteropVar(Record.readSubExpr());
10903 C->setLParenLoc(Record.readSourceLocation());
10904 C->setVarLoc(Record.readSourceLocation());
10908 C->setInteropVar(Record.readSubExpr());
10909 C->setLParenLoc(Record.readSourceLocation());
10910 C->setVarLoc(Record.readSourceLocation());
10915 C->setCondition(Record.readSubExpr());
10916 C->setLParenLoc(Record.readSourceLocation());
10921 C->setCondition(Record.readSubExpr());
10922 C->setLParenLoc(Record.readSourceLocation());
10938 C->setAtomicDefaultMemOrderKind(
10940 C->setLParenLoc(Record.readSourceLocation());
10941 C->setAtomicDefaultMemOrderKindKwLoc(Record.readSourceLocation());
10945 C->setAtKind(static_cast<OpenMPAtClauseKind>(Record.readInt()));
10946 C->setLParenLoc(Record.readSourceLocation());
10947 C->setAtKindKwLoc(Record.readSourceLocation());
10951 C->setSeverityKind(static_cast<OpenMPSeverityClauseKind>(Record.readInt()));
10952 C->setLParenLoc(Record.readSourceLocation());
10953 C->setSeverityKindKwLoc(Record.readSourceLocation());
10957 C->setMessageString(Record.readSubExpr());
10958 C->setLParenLoc(Record.readSourceLocation());
10962 C->setLParenLoc(Record.readSourceLocation());
10963 unsigned NumVars = C->varlist_size();
10968 C->setVarRefs(Vars);
10972 C->setPrivateCopies(Vars);
10977 C->setLParenLoc(Record.readSourceLocation());
10978 unsigned NumVars = C->varlist_size();
10983 C->setVarRefs(Vars);
10987 C->setPrivateCopies(Vars);
10991 C->setInits(Vars);
10996 C->setLParenLoc(Record.readSourceLocation());
10997 C->setKind(Record.readEnum<OpenMPLastprivateModifier>());
10998 C->setKindLoc(Record.readSourceLocation());
10999 C->setColonLoc(Record.readSourceLocation());
11000 unsigned NumVars = C->varlist_size();
11005 C->setVarRefs(Vars);
11009 C->setPrivateCopies(Vars);
11013 C->setSourceExprs(Vars);
11017 C->setDestinationExprs(Vars);
11021 C->setAssignmentOps(Vars);
11025 C->setLParenLoc(Record.readSourceLocation());
11026 unsigned NumVars = C->varlist_size();
11031 C->setVarRefs(Vars);
11036 C->setLParenLoc(Record.readSourceLocation());
11037 C->setModifierLoc(Record.readSourceLocation());
11038 C->setColonLoc(Record.readSourceLocation());
11041 C->setQualifierLoc(NNSL);
11042 C->setNameInfo(DNI);
11044 unsigned NumVars = C->varlist_size();
11049 C->setVarRefs(Vars);
11053 C->setPrivates(Vars);
11057 C->setLHSExprs(Vars);
11061 C->setRHSExprs(Vars);
11065 C->setReductionOps(Vars);
11066 if (C->getModifier() == OMPC_REDUCTION_inscan) {
11070 C->setInscanCopyOps(Vars);
11074 C->setInscanCopyArrayTemps(Vars);
11078 C->setInscanCopyArrayElems(Vars);
11084 C->setLParenLoc(Record.readSourceLocation());
11085 C->setColonLoc(Record.readSourceLocation());
11088 C->setQualifierLoc(NNSL);
11089 C->setNameInfo(DNI);
11091 unsigned NumVars = C->varlist_size();
11096 C->setVarRefs(Vars);
11100 C->setPrivates(Vars);
11104 C->setLHSExprs(Vars);
11108 C->setRHSExprs(Vars);
11112 C->setReductionOps(Vars);
11117 C->setLParenLoc(Record.readSourceLocation());
11118 C->setColonLoc(Record.readSourceLocation());
11121 C->setQualifierLoc(NNSL);
11122 C->setNameInfo(DNI);
11124 unsigned NumVars = C->varlist_size();
11129 C->setVarRefs(Vars);
11133 C->setPrivates(Vars);
11137 C->setLHSExprs(Vars);
11141 C->setRHSExprs(Vars);
11145 C->setReductionOps(Vars);
11149 C->setTaskgroupDescriptors(Vars);
11154 C->setLParenLoc(Record.readSourceLocation());
11155 C->setColonLoc(Record.readSourceLocation());
11156 C->setModifier(static_cast<OpenMPLinearClauseKind>(Record.readInt()));
11157 C->setModifierLoc(Record.readSourceLocation());
11158 unsigned NumVars = C->varlist_size();
11163 C->setVarRefs(Vars);
11167 C->setPrivates(Vars);
11171 C->setInits(Vars);
11175 C->setUpdates(Vars);
11179 C->setFinals(Vars);
11180 C->setStep(Record.readSubExpr());
11181 C->setCalcStep(Record.readSubExpr());
11185 C->setUsedExprs(Vars);
11189 C->setLParenLoc(Record.readSourceLocation());
11190 C->setColonLoc(Record.readSourceLocation());
11191 unsigned NumVars = C->varlist_size();
11196 C->setVarRefs(Vars);
11197 C->setAlignment(Record.readSubExpr());
11201 C->setLParenLoc(Record.readSourceLocation());
11202 unsigned NumVars = C->varlist_size();
11207 C->setVarRefs(Exprs);
11211 C->setSourceExprs(Exprs);
11215 C->setDestinationExprs(Exprs);
11219 C->setAssignmentOps(Exprs);
11223 C->setLParenLoc(Record.readSourceLocation());
11224 unsigned NumVars = C->varlist_size();
11229 C->setVarRefs(Exprs);
11233 C->setSourceExprs(Exprs);
11237 C->setDestinationExprs(Exprs);
11241 C->setAssignmentOps(Exprs);
11245 C->setLParenLoc(Record.readSourceLocation());
11246 unsigned NumVars = C->varlist_size();
11251 C->setVarRefs(Vars);
11255 C->setDepobj(Record.readSubExpr());
11256 C->setLParenLoc(Record.readSourceLocation());
11260 C->setLParenLoc(Record.readSourceLocation());
11261 C->setModifier(Record.readSubExpr());
11262 C->setDependencyKind(
11264 C->setDependencyLoc(Record.readSourceLocation());
11265 C->setColonLoc(Record.readSourceLocation());
11266 C->setOmpAllMemoryLoc(Record.readSourceLocation());
11267 unsigned NumVars = C->varlist_size();
11272 C->setVarRefs(Vars);
11273 for (unsigned I = 0, E = C->getNumLoops(); I < E; ++I)
11274 C->setLoopData(I, Record.readSubExpr());
11279 C->setModifier(Record.readEnum<OpenMPDeviceClauseModifier>());
11280 C->setDevice(Record.readSubExpr());
11281 C->setModifierLoc(Record.readSourceLocation());
11282 C->setLParenLoc(Record.readSourceLocation());
11286 C->setLParenLoc(Record.readSourceLocation());
11289 C->setMapTypeModifier(
11291 C->setMapTypeModifierLoc(I, Record.readSourceLocation());
11292 if (C->getMapTypeModifier(I) == OMPC_MAP_MODIFIER_iterator)
11295 C->setMapperQualifierLoc(Record.readNestedNameSpecifierLoc());
11296 C->setMapperIdInfo(Record.readDeclarationNameInfo());
11297 C->setMapType(
11299 C->setMapLoc(Record.readSourceLocation());
11300 C->setColonLoc(Record.readSourceLocation());
11301 auto NumVars = C->varlist_size();
11302 auto UniqueDecls = C->getUniqueDeclarationsNum();
11303 auto TotalLists = C->getTotalComponentListNum();
11304 auto TotalComponents = C->getTotalComponentsNum();
11310 C->setVarRefs(Vars);
11316 C->setUDMapperRefs(UDMappers);
11319 C->setIteratorModifier(Record.readExpr());
11325 C->setUniqueDecls(Decls);
11331 C->setDeclNumLists(ListsPerDecl);
11337 C->setComponentListSizes(ListSizes);
11347 C->setComponents(Components, ListSizes);
11351 C->setLParenLoc(Record.readSourceLocation());
11352 C->setColonLoc(Record.readSourceLocation());
11353 C->setAllocator(Record.readSubExpr());
11354 unsigned NumVars = C->varlist_size();
11359 C->setVarRefs(Vars);
11364 C->setNumTeams(Record.readSubExpr());
11365 C->setLParenLoc(Record.readSourceLocation());
11370 C->setThreadLimit(Record.readSubExpr());
11371 C->setLParenLoc(Record.readSourceLocation());
11376 C->setPriority(Record.readSubExpr());
11377 C->setLParenLoc(Record.readSourceLocation());
11382 C->setModifier(Record.readEnum<OpenMPGrainsizeClauseModifier>());
11383 C->setGrainsize(Record.readSubExpr());
11384 C->setModifierLoc(Record.readSourceLocation());
11385 C->setLParenLoc(Record.readSourceLocation());
11390 C->setModifier(Record.readEnum<OpenMPNumTasksClauseModifier>());
11391 C->setNumTasks(Record.readSubExpr());
11392 C->setModifierLoc(Record.readSourceLocation());
11393 C->setLParenLoc(Record.readSourceLocation());
11397 C->setHint(Record.readSubExpr());
11398 C->setLParenLoc(Record.readSourceLocation());
11403 C->setDistScheduleKind(
11405 C->setChunkSize(Record.readSubExpr());
11406 C->setLParenLoc(Record.readSourceLocation());
11407 C->setDistScheduleKindLoc(Record.readSourceLocation());
11408 C->setCommaLoc(Record.readSourceLocation());
11412 C->setDefaultmapKind(
11414 C->setDefaultmapModifier(
11416 C->setLParenLoc(Record.readSourceLocation());
11417 C->setDefaultmapModifierLoc(Record.readSourceLocation());
11418 C->setDefaultmapKindLoc(Record.readSourceLocation());
11422 C->setLParenLoc(Record.readSourceLocation());
11424 C->setMotionModifier(
11426 C->setMotionModifierLoc(I, Record.readSourceLocation());
11428 C->setMapperQualifierLoc(Record.readNestedNameSpecifierLoc());
11429 C->setMapperIdInfo(Record.readDeclarationNameInfo());
11430 C->setColonLoc(Record.readSourceLocation());
11431 auto NumVars = C->varlist_size();
11432 auto UniqueDecls = C->getUniqueDeclarationsNum();
11433 auto TotalLists = C->getTotalComponentListNum();
11434 auto TotalComponents = C->getTotalComponentsNum();
11440 C->setVarRefs(Vars);
11446 C->setUDMapperRefs(UDMappers);
11452 C->setUniqueDecls(Decls);
11458 C->setDeclNumLists(ListsPerDecl);
11464 C->setComponentListSizes(ListSizes);
11474 C->setComponents(Components, ListSizes);
11478 C->setLParenLoc(Record.readSourceLocation());
11480 C->setMotionModifier(
11482 C->setMotionModifierLoc(I, Record.readSourceLocation());
11484 C->setMapperQualifierLoc(Record.readNestedNameSpecifierLoc());
11485 C->setMapperIdInfo(Record.readDeclarationNameInfo());
11486 C->setColonLoc(Record.readSourceLocation());
11487 auto NumVars = C->varlist_size();
11488 auto UniqueDecls = C->getUniqueDeclarationsNum();
11489 auto TotalLists = C->getTotalComponentListNum();
11490 auto TotalComponents = C->getTotalComponentsNum();
11496 C->setVarRefs(Vars);
11502 C->setUDMapperRefs(UDMappers);
11508 C->setUniqueDecls(Decls);
11514 C->setDeclNumLists(ListsPerDecl);
11520 C->setComponentListSizes(ListSizes);
11530 C->setComponents(Components, ListSizes);
11534 C->setLParenLoc(Record.readSourceLocation());
11535 auto NumVars = C->varlist_size();
11536 auto UniqueDecls = C->getUniqueDeclarationsNum();
11537 auto TotalLists = C->getTotalComponentListNum();
11538 auto TotalComponents = C->getTotalComponentsNum();
11544 C->setVarRefs(Vars);
11548 C->setPrivateCopies(Vars);
11552 C->setInits(Vars);
11558 C->setUniqueDecls(Decls);
11564 C->setDeclNumLists(ListsPerDecl);
11570 C->setComponentListSizes(ListSizes);
11580 C->setComponents(Components, ListSizes);
11584 C->setLParenLoc(Record.readSourceLocation());
11585 auto NumVars = C->varlist_size();
11586 auto UniqueDecls = C->getUniqueDeclarationsNum();
11587 auto TotalLists = C->getTotalComponentListNum();
11588 auto TotalComponents = C->getTotalComponentsNum();
11594 C->setVarRefs(Vars);
11600 C->setUniqueDecls(Decls);
11606 C->setDeclNumLists(ListsPerDecl);
11612 C->setComponentListSizes(ListSizes);
11622 C->setComponents(Components, ListSizes);
11626 C->setLParenLoc(Record.readSourceLocation());
11627 auto NumVars = C->varlist_size();
11628 auto UniqueDecls = C->getUniqueDeclarationsNum();
11629 auto TotalLists = C->getTotalComponentListNum();
11630 auto TotalComponents = C->getTotalComponentsNum();
11636 C->setVarRefs(Vars);
11643 C->setUniqueDecls(Decls);
11649 C->setDeclNumLists(ListsPerDecl);
11655 C->setComponentListSizes(ListSizes);
11665 C->setComponents(Components, ListSizes);
11669 C->setLParenLoc(Record.readSourceLocation());
11670 auto NumVars = C->varlist_size();
11671 auto UniqueDecls = C->getUniqueDeclarationsNum();
11672 auto TotalLists = C->getTotalComponentListNum();
11673 auto TotalComponents = C->getTotalComponentsNum();
11679 C->setVarRefs(Vars);
11686 C->setUniqueDecls(Decls);
11692 C->setDeclNumLists(ListsPerDecl);
11698 C->setComponentListSizes(ListSizes);
11708 C->setComponents(Components, ListSizes);
11712 C->setLParenLoc(Record.readSourceLocation());
11713 unsigned NumVars = C->varlist_size();
11718 C->setVarRefs(Vars);
11723 C->setPrivateRefs(Vars);
11727 C->setLParenLoc(Record.readSourceLocation());
11728 unsigned NumVars = C->varlist_size();
11733 C->setVarRefs(Vars);
11737 C->setLParenLoc(Record.readSourceLocation());
11738 unsigned NumVars = C->varlist_size();
11743 C->setVarRefs(Vars);
11747 C->setLParenLoc(Record.readSourceLocation());
11748 unsigned NumOfAllocators = C->getNumberOfAllocators();
11758 C->setAllocatorsData(Data);
11762 C->setLParenLoc(Record.readSourceLocation());
11763 C->setModifier(Record.readSubExpr());
11764 C->setColonLoc(Record.readSourceLocation());
11765 unsigned NumOfLocators = C->varlist_size();
11770 C->setVarRefs(Locators);
11774 C->setKind(Record.readEnum<OpenMPOrderClauseKind>());
11775 C->setModifier(Record.readEnum<OpenMPOrderClauseModifier>());
11776 C->setLParenLoc(Record.readSourceLocation());
11777 C->setKindKwLoc(Record.readSourceLocation());
11778 C->setModifierKwLoc(Record.readSourceLocation());
11783 C->setThreadID(Record.readSubExpr());
11784 C->setLParenLoc(Record.readSourceLocation());
11788 C->setBindKind(Record.readEnum<OpenMPBindClauseKind>());
11789 C->setLParenLoc(Record.readSourceLocation());
11790 C->setBindKindLoc(Record.readSourceLocation());
11794 C->setAlignment(Record.readExpr());
11795 C->setLParenLoc(Record.readSourceLocation());
11800 C->setSize(Record.readSubExpr());
11801 C->setLParenLoc(Record.readSourceLocation());
11805 C->setLParenLoc(Record.readSourceLocation());
11806 C->setDependenceType(
11808 C->setDependenceLoc(Record.readSourceLocation());
11809 C->setColonLoc(Record.readSourceLocation());
11810 unsigned NumVars = C->varlist_size();
11815 C->setVarRefs(Vars);
11816 for (unsigned I = 0, E = C->getNumLoops(); I < E; ++I)
11817 C->setLoopData(I, Record.readSubExpr());
11823 C->setAttrs(Attrs);
11824 C->setLocStart(Record.readSourceLocation());
11825 C->setLParenLoc(Record.readSourceLocation());
11826 C->setLocEnd(Record.readSourceLocation());
11853 if (Reader->ReadingKind == ASTReader::Read_Stmt) {
11857 SmallVector<OMPClause *, 4> Clauses(Data->getNumClauses());
11858 for (unsigned I = 0, E = Data->getNumClauses(); I < E; ++I)
11860 Data->setClauses(Clauses);
11861 if (Data->hasAssociatedStmt())
11862 Data->setAssociatedStmt(readStmt());
11863 for (unsigned I = 0, E = Data->getNumChildren(); I < E; ++I)
11864 Data->getChildren()[I] = readStmt();