48 #include "llvm/ADT/Hashing.h"
49 #include "llvm/ADT/StringExtras.h"
50 #include "llvm/Bitcode/BitstreamReader.h"
51 #include "llvm/Support/ErrorHandling.h"
52 #include "llvm/Support/FileSystem.h"
53 #include "llvm/Support/MemoryBuffer.h"
54 #include "llvm/Support/Path.h"
55 #include "llvm/Support/SaveAndRestore.h"
56 #include "llvm/Support/raw_ostream.h"
60 #include <system_error>
62 using namespace clang;
63 using namespace clang::serialization;
64 using namespace clang::serialization::reader;
65 using llvm::BitstreamCursor;
74 return First->ReadFullVersionInformation(FullVersion) ||
75 Second->ReadFullVersionInformation(FullVersion);
78 First->ReadModuleName(ModuleName);
79 Second->ReadModuleName(ModuleName);
82 First->ReadModuleMapFile(ModuleMapPath);
83 Second->ReadModuleMapFile(ModuleMapPath);
88 bool AllowCompatibleDifferences) {
89 return First->ReadLanguageOptions(LangOpts, Complain,
90 AllowCompatibleDifferences) ||
91 Second->ReadLanguageOptions(LangOpts, Complain,
92 AllowCompatibleDifferences);
96 bool AllowCompatibleDifferences) {
97 return First->ReadTargetOptions(TargetOpts, Complain,
98 AllowCompatibleDifferences) ||
99 Second->ReadTargetOptions(TargetOpts, Complain,
100 AllowCompatibleDifferences);
104 return First->ReadDiagnosticOptions(DiagOpts, Complain) ||
105 Second->ReadDiagnosticOptions(DiagOpts, Complain);
110 return First->ReadFileSystemOptions(FSOpts, Complain) ||
111 Second->ReadFileSystemOptions(FSOpts, Complain);
117 return First->ReadHeaderSearchOptions(HSOpts, SpecificModuleCachePath,
119 Second->ReadHeaderSearchOptions(HSOpts, SpecificModuleCachePath,
124 std::string &SuggestedPredefines) {
125 return First->ReadPreprocessorOptions(PPOpts, Complain,
126 SuggestedPredefines) ||
127 Second->ReadPreprocessorOptions(PPOpts, Complain, SuggestedPredefines);
131 First->ReadCounter(M, Value);
132 Second->ReadCounter(M, Value);
135 return First->needsInputFileVisitation() ||
136 Second->needsInputFileVisitation();
139 return First->needsSystemInputFileVisitation() ||
140 Second->needsSystemInputFileVisitation();
144 First->visitModuleFile(Filename, Kind);
145 Second->visitModuleFile(Filename, Kind);
150 bool isExplicitModule) {
151 bool Continue =
false;
152 if (First->needsInputFileVisitation() &&
153 (!isSystem || First->needsSystemInputFileVisitation()))
154 Continue |= First->visitInputFile(Filename, isSystem, isOverridden,
156 if (Second->needsInputFileVisitation() &&
157 (!isSystem || Second->needsSystemInputFileVisitation()))
158 Continue |= Second->visitInputFile(Filename, isSystem, isOverridden,
165 First->readModuleFileExtension(Metadata);
166 Second->readModuleFileExtension(Metadata);
186 bool AllowCompatibleDifferences =
true) {
187 #define LANGOPT(Name, Bits, Default, Description) \
188 if (ExistingLangOpts.Name != LangOpts.Name) { \
190 Diags->Report(diag::err_pch_langopt_mismatch) \
191 << Description << LangOpts.Name << ExistingLangOpts.Name; \
195 #define VALUE_LANGOPT(Name, Bits, Default, Description) \
196 if (ExistingLangOpts.Name != LangOpts.Name) { \
198 Diags->Report(diag::err_pch_langopt_value_mismatch) \
203 #define ENUM_LANGOPT(Name, Type, Bits, Default, Description) \
204 if (ExistingLangOpts.get##Name() != LangOpts.get##Name()) { \
206 Diags->Report(diag::err_pch_langopt_value_mismatch) \
211 #define COMPATIBLE_LANGOPT(Name, Bits, Default, Description) \
212 if (!AllowCompatibleDifferences) \
213 LANGOPT(Name, Bits, Default, Description)
215 #define COMPATIBLE_ENUM_LANGOPT(Name, Bits, Default, Description) \
216 if (!AllowCompatibleDifferences) \
217 ENUM_LANGOPT(Name, Bits, Default, Description)
219 #define BENIGN_LANGOPT(Name, Bits, Default, Description)
220 #define BENIGN_ENUM_LANGOPT(Name, Type, Bits, Default, Description)
221 #include "clang/Basic/LangOptions.def"
225 Diags->
Report(diag::err_pch_langopt_value_mismatch) <<
"module features";
231 Diags->
Report(diag::err_pch_langopt_value_mismatch)
232 <<
"target Objective-C runtime";
239 Diags->
Report(diag::err_pch_langopt_value_mismatch)
240 <<
"block command names";
256 bool AllowCompatibleDifferences =
true) {
257 #define CHECK_TARGET_OPT(Field, Name) \
258 if (TargetOpts.Field != ExistingTargetOpts.Field) { \
260 Diags->Report(diag::err_pch_targetopt_mismatch) \
261 << Name << TargetOpts.Field << ExistingTargetOpts.Field; \
272 if (!AllowCompatibleDifferences)
275 #undef CHECK_TARGET_OPT
283 std::sort(ExistingFeatures.begin(), ExistingFeatures.end());
284 std::sort(ReadFeatures.begin(), ReadFeatures.end());
290 ExistingFeatures.begin(), ExistingFeatures.end(), ReadFeatures.begin(),
291 ReadFeatures.end(), std::back_inserter(UnmatchedExistingFeatures));
292 std::set_difference(ReadFeatures.begin(), ReadFeatures.end(),
293 ExistingFeatures.begin(), ExistingFeatures.end(),
294 std::back_inserter(UnmatchedReadFeatures));
298 if (AllowCompatibleDifferences && UnmatchedReadFeatures.empty())
302 for (StringRef Feature : UnmatchedReadFeatures)
303 Diags->
Report(diag::err_pch_targetopt_feature_mismatch)
305 for (StringRef Feature : UnmatchedExistingFeatures)
306 Diags->
Report(diag::err_pch_targetopt_feature_mismatch)
310 return !UnmatchedReadFeatures.empty() || !UnmatchedExistingFeatures.empty();
316 bool AllowCompatibleDifferences) {
317 const LangOptions &ExistingLangOpts = PP.getLangOpts();
319 Complain ? &Reader.Diags :
nullptr,
320 AllowCompatibleDifferences);
325 bool AllowCompatibleDifferences) {
326 const TargetOptions &ExistingTargetOpts = PP.getTargetInfo().getTargetOpts();
328 Complain ? &Reader.Diags :
nullptr,
329 AllowCompatibleDifferences);
333 typedef llvm::StringMap<std::pair<StringRef,
bool > >
335 typedef llvm::DenseMap<DeclarationName, SmallVector<NamedDecl *, 8> >
350 for (
auto DiagIDMappingPair : MappingSource->getDiagnosticMappings()) {
359 Diags.
Report(diag::err_pch_diagopt_mismatch) <<
"-Werror=" +
378 bool IsSystem,
bool Complain) {
386 Diags.
Report(diag::err_pch_diagopt_mismatch) <<
"-Wsystem-headers";
393 Diags.
Report(diag::err_pch_diagopt_mismatch) <<
"-Werror";
400 Diags.
Report(diag::err_pch_diagopt_mismatch) <<
"-Weverything -Werror";
407 Diags.
Report(diag::err_pch_diagopt_mismatch) <<
"-pedantic-errors";
425 assert(ModuleMgr.
size() >= 1 &&
"what ASTFile is this then");
434 ModuleFile *TopImport = *ModuleMgr.
rbegin();
435 while (!TopImport->ImportedBy.empty())
436 TopImport = TopImport->ImportedBy[0];
440 StringRef ModuleName = TopImport->ModuleName;
441 assert(!ModuleName.empty() &&
"diagnostic options read before module name");
443 Module *M = PP.getHeaderSearchInfo().lookupModule(ModuleName);
444 assert(M &&
"missing module");
455 MacroDefinitionsMap &Macros,
457 for (
unsigned I = 0, N = PPOpts.
Macros.size();
I != N; ++
I) {
458 StringRef Macro = PPOpts.
Macros[
I].first;
459 bool IsUndef = PPOpts.
Macros[
I].second;
461 std::pair<StringRef, StringRef> MacroPair = Macro.split(
'=');
462 StringRef MacroName = MacroPair.first;
463 StringRef MacroBody = MacroPair.second;
467 if (MacroNames && !Macros.count(MacroName))
468 MacroNames->push_back(MacroName);
470 Macros[MacroName] = std::make_pair(
"",
true);
475 if (MacroName.size() == Macro.size())
479 StringRef::size_type
End = MacroBody.find_first_of(
"\n\r");
480 MacroBody = MacroBody.substr(0, End);
483 if (MacroNames && !Macros.count(MacroName))
484 MacroNames->push_back(MacroName);
485 Macros[MacroName] = std::make_pair(MacroBody,
false);
497 std::string &SuggestedPredefines,
500 MacroDefinitionsMap ASTFileMacros;
502 MacroDefinitionsMap ExistingMacros;
506 for (
unsigned I = 0, N = ExistingMacroNames.size();
I != N; ++
I) {
508 StringRef MacroName = ExistingMacroNames[
I];
509 std::pair<StringRef, bool> Existing = ExistingMacros[MacroName];
512 llvm::StringMap<std::pair<StringRef,
bool > >
::iterator Known
513 = ASTFileMacros.find(MacroName);
514 if (Known == ASTFileMacros.end()) {
519 if (Existing.second) {
520 SuggestedPredefines +=
"#undef ";
521 SuggestedPredefines += MacroName.str();
522 SuggestedPredefines +=
'\n';
524 SuggestedPredefines +=
"#define ";
525 SuggestedPredefines += MacroName.str();
526 SuggestedPredefines +=
' ';
527 SuggestedPredefines += Existing.first.str();
528 SuggestedPredefines +=
'\n';
535 if (Existing.second != Known->second.second) {
537 Diags->
Report(diag::err_pch_macro_def_undef)
538 << MacroName << Known->second.second;
545 if (Existing.second || Existing.first == Known->second.first)
550 Diags->
Report(diag::err_pch_macro_def_conflict)
551 << MacroName << Known->second.first << Existing.first;
565 if (LangOpts.Modules &&
574 for (
unsigned I = 0, N = ExistingPPOpts.
Includes.size();
I != N; ++
I) {
575 StringRef File = ExistingPPOpts.
Includes[
I];
583 SuggestedPredefines +=
"#include \"";
584 SuggestedPredefines += File;
585 SuggestedPredefines +=
"\"\n";
588 for (
unsigned I = 0, N = ExistingPPOpts.
MacroIncludes.size();
I != N; ++
I) {
595 SuggestedPredefines +=
"#__include_macros \"";
596 SuggestedPredefines += File;
597 SuggestedPredefines +=
"\"\n##\n";
605 std::string &SuggestedPredefines) {
609 Complain? &Reader.Diags :
nullptr,
620 StringRef SpecificModuleCachePath,
621 StringRef ExistingModuleCachePath,
624 if (LangOpts.Modules) {
625 if (SpecificModuleCachePath != ExistingModuleCachePath) {
627 Diags->
Report(diag::err_pch_modulecache_mismatch)
628 << SpecificModuleCachePath << ExistingModuleCachePath;
637 StringRef SpecificModuleCachePath,
640 PP.getHeaderSearchInfo().getModuleCachePath(),
641 Complain ? &Reader.Diags :
nullptr,
646 PP.setCounterValue(Value);
654 bool TakeOwnership) {
655 DeserializationListener = Listener;
656 OwnsDeserializationListener = TakeOwnership;
666 std::pair<unsigned, unsigned>
668 using namespace llvm::support;
669 unsigned KeyLen = endian::readNext<uint16_t, little, unaligned>(d);
670 unsigned DataLen = endian::readNext<uint16_t, little, unaligned>(d);
671 return std::make_pair(KeyLen, DataLen);
676 using namespace llvm::support;
678 unsigned N = endian::readNext<uint16_t, little, unaligned>(d);
680 F, endian::readNext<uint32_t, little, unaligned>(d));
682 return SelTable.getNullarySelector(FirstII);
684 return SelTable.getUnarySelector(FirstII);
687 Args.push_back(FirstII);
688 for (
unsigned I = 1;
I != N; ++
I)
689 Args.push_back(Reader.getLocalIdentifier(
690 F, endian::readNext<uint32_t, little, unaligned>(d)));
692 return SelTable.getSelector(N, Args.data());
698 using namespace llvm::support;
702 Result.ID = Reader.getGlobalSelectorID(
703 F, endian::readNext<uint32_t, little, unaligned>(d));
704 unsigned FullInstanceBits = endian::readNext<uint16_t, little, unaligned>(d);
705 unsigned FullFactoryBits = endian::readNext<uint16_t, little, unaligned>(d);
706 Result.InstanceBits = FullInstanceBits & 0x3;
707 Result.InstanceHasMoreThanOneDecl = (FullInstanceBits >> 2) & 0x1;
708 Result.FactoryBits = FullFactoryBits & 0x3;
709 Result.FactoryHasMoreThanOneDecl = (FullFactoryBits >> 2) & 0x1;
710 unsigned NumInstanceMethods = FullInstanceBits >> 3;
711 unsigned NumFactoryMethods = FullFactoryBits >> 3;
714 for (
unsigned I = 0;
I != NumInstanceMethods; ++
I) {
716 F, endian::readNext<uint32_t, little, unaligned>(d)))
717 Result.Instance.push_back(Method);
721 for (
unsigned I = 0;
I != NumFactoryMethods; ++
I) {
723 F, endian::readNext<uint32_t, little, unaligned>(d)))
724 Result.Factory.push_back(Method);
731 return llvm::HashString(a);
734 std::pair<unsigned, unsigned>
736 using namespace llvm::support;
737 unsigned DataLen = endian::readNext<uint16_t, little, unaligned>(d);
738 unsigned KeyLen = endian::readNext<uint16_t, little, unaligned>(d);
739 return std::make_pair(KeyLen, DataLen);
744 assert(n >= 2 && d[n-1] ==
'\0');
745 return StringRef((
const char*) d, n-1);
760 bool Value = Bits & 0x1;
766 using namespace llvm::support;
767 unsigned RawID = endian::readNext<uint32_t, little, unaligned>(d);
768 return Reader.getGlobalIdentifierID(F, RawID >> 1);
772 const unsigned char* d,
774 using namespace llvm::support;
775 unsigned RawID = endian::readNext<uint32_t, little, unaligned>(d);
776 bool IsInteresting = RawID & 0x01;
784 II = &Reader.getIdentifierTable().getOwn(k);
787 if (!II->isFromAST()) {
789 bool IsModule = Reader.PP.getCurrentModule() !=
nullptr;
791 II->setChangedSinceDeserialization();
793 Reader.markIdentifierUpToDate(II);
795 IdentID ID = Reader.getGlobalIdentifierID(F, RawID);
796 if (!IsInteresting) {
799 Reader.SetIdentifierInfo(
ID, II);
803 unsigned ObjCOrBuiltinID = endian::readNext<uint16_t, little, unaligned>(d);
804 unsigned Bits = endian::readNext<uint16_t, little, unaligned>(d);
805 bool CPlusPlusOperatorKeyword =
readBit(Bits);
806 bool HasRevertedTokenIDToIdentifier =
readBit(Bits);
807 bool HasRevertedBuiltin =
readBit(Bits);
809 bool ExtensionToken =
readBit(Bits);
810 bool HadMacroDefinition =
readBit(Bits);
812 assert(Bits == 0 &&
"Extra bits in the identifier?");
817 if (HasRevertedTokenIDToIdentifier && II->getTokenID() != tok::identifier)
818 II->revertTokenIDToIdentifier();
820 II->setObjCOrBuiltinID(ObjCOrBuiltinID);
821 else if (HasRevertedBuiltin && II->getBuiltinID()) {
823 assert((II->hasRevertedBuiltin() ||
824 II->getObjCOrBuiltinID() == ObjCOrBuiltinID) &&
825 "Incorrect ObjC keyword or builtin ID");
827 assert(II->isExtensionToken() == ExtensionToken &&
828 "Incorrect extension token flag");
829 (void)ExtensionToken;
831 II->setIsPoisoned(
true);
832 assert(II->isCPlusPlusOperatorKeyword() == CPlusPlusOperatorKeyword &&
833 "Incorrect C++ operator keyword flag");
834 (void)CPlusPlusOperatorKeyword;
838 if (HadMacroDefinition) {
839 uint32_t MacroDirectivesOffset =
840 endian::readNext<uint32_t, little, unaligned>(d);
843 Reader.addPendingMacro(II, &F, MacroDirectivesOffset);
846 Reader.SetIdentifierInfo(
ID, II);
852 for (; DataLen > 0; DataLen -= 4)
853 DeclIDs.push_back(Reader.getGlobalDeclID(
854 F, endian::readNext<uint32_t, little, unaligned>(d)));
855 Reader.SetGloballyVisibleDecls(II, DeclIDs);
862 :
Kind(Name.getNameKind()) {
888 llvm::FoldingSetNodeID
ID;
911 return ID.ComputeHash();
915 ASTDeclContextNameLookupTrait::ReadFileRef(
const unsigned char *&d) {
916 using namespace llvm::support;
917 uint32_t ModuleFileID = endian::readNext<uint32_t, little, unaligned>(d);
918 return Reader.getLocalModuleFile(F, ModuleFileID);
921 std::pair<unsigned, unsigned>
922 ASTDeclContextNameLookupTrait::ReadKeyDataLength(
const unsigned char *&d) {
923 using namespace llvm::support;
924 unsigned KeyLen = endian::readNext<uint16_t, little, unaligned>(d);
925 unsigned DataLen = endian::readNext<uint16_t, little, unaligned>(d);
926 return std::make_pair(KeyLen, DataLen);
930 ASTDeclContextNameLookupTrait::ReadKey(
const unsigned char *d,
unsigned) {
931 using namespace llvm::support;
937 Data = (uint64_t)Reader.getLocalIdentifier(
938 F, endian::readNext<uint32_t, little, unaligned>(d));
944 (uint64_t)Reader.getLocalSelector(
945 F, endian::readNext<uint32_t, little, unaligned>(
946 d)).getAsOpaquePtr();
952 Data = (uint64_t)Reader.getLocalIdentifier(
953 F, endian::readNext<uint32_t, little, unaligned>(d));
967 const unsigned char *d,
970 using namespace llvm::support;
971 for (
unsigned NumDecls = DataLen / 4; NumDecls; --NumDecls) {
972 uint32_t LocalID = endian::readNext<uint32_t, little, unaligned>(d);
973 Val.
insert(Reader.getGlobalDeclID(F, LocalID));
977 bool ASTReader::ReadLexicalDeclContextStorage(
ModuleFile &M,
984 Cursor.JumpToBit(Offset);
988 unsigned Code = Cursor.ReadCode();
989 unsigned RecCode = Cursor.readRecord(Code, Record, &Blob);
991 Error(
"Expected lexical block");
995 assert(!isa<TranslationUnitDecl>(DC) &&
996 "expected a TU_UPDATE_LEXICAL record for TU");
1001 auto &
Lex = LexicalDecls[DC];
1003 Lex = std::make_pair(
1004 &M, llvm::makeArrayRef(
1005 reinterpret_cast<const llvm::support::unaligned_uint32_t *>(
1013 bool ASTReader::ReadVisibleDeclContextStorage(
ModuleFile &M,
1014 BitstreamCursor &Cursor,
1017 assert(Offset != 0);
1020 Cursor.JumpToBit(Offset);
1024 unsigned Code = Cursor.ReadCode();
1025 unsigned RecCode = Cursor.readRecord(Code, Record, &Blob);
1027 Error(
"Expected visible lookup table block");
1033 auto *Data = (
const unsigned char*)Blob.data();
1034 PendingVisibleUpdates[
ID].push_back(PendingVisibleUpdate{&M, Data});
1038 void ASTReader::Error(StringRef Msg) {
1039 Error(diag::err_fe_pch_malformed, Msg);
1041 !PP.getHeaderSearchInfo().getModuleCachePath().empty()) {
1042 Diag(diag::note_module_cache_path)
1043 << PP.getHeaderSearchInfo().getModuleCachePath();
1047 void ASTReader::Error(
unsigned DiagID,
1048 StringRef Arg1, StringRef Arg2) {
1049 if (Diags.isDiagnosticInFlight())
1050 Diags.SetDelayedDiagnostic(DiagID, Arg1, Arg2);
1052 Diag(DiagID) << Arg1 << Arg2;
1061 bool ASTReader::ParseLineTable(
ModuleFile &F,
1062 const RecordData &Record) {
1067 std::map<int, int> FileIDs;
1068 for (
unsigned I = 0; Record[Idx]; ++
I) {
1070 auto Filename = ReadPath(F, Record, Idx);
1076 std::vector<LineEntry> Entries;
1077 while (Idx < Record.size()) {
1078 int FID = Record[Idx++];
1079 assert(FID >= 0 &&
"Serialized line entries for non-local file.");
1084 unsigned NumEntries = Record[Idx++];
1085 assert(NumEntries &&
"no line entries for file ID");
1087 Entries.reserve(NumEntries);
1088 for (
unsigned I = 0;
I != NumEntries; ++
I) {
1089 unsigned FileOffset = Record[Idx++];
1090 unsigned LineNo = Record[Idx++];
1091 int FilenameID = FileIDs[Record[Idx++]];
1094 unsigned IncludeOffset = Record[Idx++];
1096 FileKind, IncludeOffset));
1098 LineTable.
AddEntry(FileID::get(FID), Entries);
1105 bool ASTReader::ReadSourceManagerBlock(
ModuleFile &F) {
1106 using namespace SrcMgr;
1114 SLocEntryCursor = F.
Stream;
1117 if (F.
Stream.SkipBlock()) {
1118 Error(
"malformed block record in AST file");
1124 Error(
"malformed source manager block record in AST file");
1130 llvm::BitstreamEntry
E = SLocEntryCursor.advanceSkippingSubblocks();
1133 case llvm::BitstreamEntry::SubBlock:
1135 Error(
"malformed block record in AST file");
1137 case llvm::BitstreamEntry::EndBlock:
1139 case llvm::BitstreamEntry::Record:
1147 switch (SLocEntryCursor.readRecord(E.ID, Record, &Blob)) {
1166 const std::string &OriginalDir,
1167 const std::string &CurrDir) {
1168 assert(OriginalDir != CurrDir &&
1169 "No point trying to resolve the file if the PCH dir didn't change");
1170 using namespace llvm::sys;
1172 fs::make_absolute(filePath);
1173 assert(path::is_absolute(OriginalDir));
1176 path::const_iterator fileDirI =
path::begin(path::parent_path(filePath)),
1177 fileDirE =
path::end(path::parent_path(filePath));
1178 path::const_iterator origDirI =
path::begin(OriginalDir),
1181 while (fileDirI != fileDirE && origDirI != origDirE &&
1182 *fileDirI == *origDirI) {
1186 for (; origDirI != origDirE; ++origDirI)
1187 path::append(currPCHPath,
"..");
1188 path::append(currPCHPath, fileDirI, fileDirE);
1189 path::append(currPCHPath, path::filename(Filename));
1190 return currPCHPath.str();
1197 if (
unsigned(-ID) - 2 >= getTotalNumSLocs() || ID > 0) {
1198 Error(
"source location entry ID out-of-range for AST file");
1202 ModuleFile *F = GlobalSLocEntryMap.find(-ID)->second;
1207 ++NumSLocEntriesRead;
1208 llvm::BitstreamEntry Entry = SLocEntryCursor.advance();
1209 if (Entry.Kind != llvm::BitstreamEntry::Record) {
1210 Error(
"incorrectly-formatted source location entry in AST file");
1216 switch (SLocEntryCursor.readRecord(Entry.ID, Record, &Blob)) {
1218 Error(
"incorrectly-formatted source location entry in AST file");
1224 unsigned InputID = Record[4];
1225 InputFile IF = getInputFile(*F, InputID);
1238 IncludeLoc = getImportLocation(F);
1243 ID, BaseOffset + Record[0]);
1246 FileInfo.NumCreatedFIDs = Record[5];
1251 unsigned NumFileDecls = Record[7];
1253 assert(F->
FileSortedDecls &&
"FILE_SORTED_DECLS not encountered yet ?");
1254 FileDeclIDs[FID] = FileDeclsInfo(F, llvm::makeArrayRef(FirstDecl,
1258 const SrcMgr::ContentCache *ContentCache
1259 =
SourceMgr.getOrCreateContentCache(File,
1261 if (OverriddenBuffer && !ContentCache->BufferOverridden &&
1262 ContentCache->ContentsEntry == ContentCache->OrigEntry &&
1263 !ContentCache->getRawBuffer()) {
1264 unsigned Code = SLocEntryCursor.ReadCode();
1266 unsigned RecCode = SLocEntryCursor.readRecord(Code, Record, &Blob);
1269 Error(
"AST record has invalid code");
1273 std::unique_ptr<llvm::MemoryBuffer>
Buffer
1274 = llvm::MemoryBuffer::getMemBuffer(Blob.drop_back(1), File->
getName());
1282 const char *
Name = Blob.data();
1283 unsigned Offset = Record[0];
1289 IncludeLoc = getImportLocation(F);
1291 unsigned Code = SLocEntryCursor.ReadCode();
1294 = SLocEntryCursor.readRecord(Code, Record, &Blob);
1297 Error(
"AST record has invalid code");
1301 std::unique_ptr<llvm::MemoryBuffer>
Buffer =
1302 llvm::MemoryBuffer::getMemBuffer(Blob.drop_back(1),
Name);
1304 BaseOffset + Offset, IncludeLoc);
1311 ReadSourceLocation(*F, Record[2]),
1312 ReadSourceLocation(*F, Record[3]),
1315 BaseOffset + Record[0]);
1327 if (
unsigned(-ID) - 2 >= getTotalNumSLocs() || ID > 0) {
1328 Error(
"source location entry ID out-of-range for AST file");
1333 ModuleFile *M = GlobalSLocEntryMap.find(-ID)->second;
1344 if (F->ImportLoc.isValid())
1345 return F->ImportLoc;
1349 if (F->ImportedBy.empty() || !F->ImportedBy[0]) {
1354 return F->ImportedBy[0]->FirstLoc;
1361 if (Cursor.EnterSubBlock(BlockID))
1365 uint64_t Offset = Cursor.GetCurrentBitNo();
1366 unsigned Code = Cursor.ReadCode();
1369 if (Code != llvm::bitc::DEFINE_ABBREV) {
1370 Cursor.JumpToBit(Offset);
1373 Cursor.ReadAbbrevRecord();
1381 Tok.
setLocation(ReadSourceLocation(F, Record, Idx));
1397 Stream.JumpToBit(Offset);
1406 unsigned Flags = BitstreamCursor::AF_DontPopBlockAtEnd;
1407 llvm::BitstreamEntry Entry = Stream.advanceSkippingSubblocks(Flags);
1409 switch (Entry.Kind) {
1410 case llvm::BitstreamEntry::SubBlock:
1412 Error(
"malformed block record in AST file");
1414 case llvm::BitstreamEntry::EndBlock:
1416 case llvm::BitstreamEntry::Record:
1439 SubmoduleID SubModID = getGlobalSubmoduleID(F, Record[NextIndex++]);
1441 MacroInfo *MI = PP.AllocateDeserializedMacroInfo(Loc, SubModID);
1448 bool isC99VarArgs = Record[NextIndex++];
1449 bool isGNUVarArgs = Record[NextIndex++];
1450 bool hasCommaPasting = Record[NextIndex++];
1452 unsigned NumArgs = Record[NextIndex++];
1453 for (
unsigned i = 0; i !=
NumArgs; ++i)
1454 MacroArgs.push_back(getLocalIdentifier(F, Record[NextIndex++]));
1468 if (NextIndex + 1 == Record.size() && PP.getPreprocessingRecord() &&
1472 GlobalID = getGlobalPreprocessedEntityID(F, Record[NextIndex]);
1474 PreprocessingRecord::PPEntityID PPID =
1475 PPRec.getPPEntityID(GlobalID - 1,
true);
1477 PPRec.getPreprocessedEntity(PPID));
1479 PPRec.RegisterMacroDefinition(Macro, PPDef);
1492 Token Tok = ReadToken(F, Record, Idx);
1505 &&
"Invalid index into preprocessed entity index remap");
1507 return LocalID + I->second;
1511 return llvm::hash_combine(ikey.
Size, ikey.
ModTime);
1526 if (llvm::sys::path::is_absolute(a.
Filename) &&
1534 return FileMgr.
getFile(Key.Filename);
1536 std::string Resolved = Key.Filename;
1537 Reader.ResolveImportedPath(M, Resolved);
1538 return FileMgr.
getFile(Resolved);
1543 return FEA && FEA == FEB;
1546 std::pair<unsigned, unsigned>
1547 HeaderFileInfoTrait::ReadKeyDataLength(
const unsigned char*& d) {
1548 using namespace llvm::support;
1549 unsigned KeyLen = (
unsigned) endian::readNext<uint16_t, little, unaligned>(d);
1550 unsigned DataLen = (
unsigned) *d++;
1551 return std::make_pair(KeyLen, DataLen);
1555 HeaderFileInfoTrait::ReadKey(
const unsigned char *d,
unsigned) {
1556 using namespace llvm::support;
1558 ikey.
Size = off_t(endian::readNext<uint64_t, little, unaligned>(d));
1559 ikey.ModTime = time_t(endian::readNext<uint64_t, little, unaligned>(d));
1560 ikey.Filename = (
const char *)d;
1561 ikey.Imported =
true;
1568 const unsigned char *
End = d + DataLen;
1569 using namespace llvm::support;
1571 unsigned Flags = *d++;
1573 HFI.
isImport |= (Flags >> 4) & 0x01;
1574 HFI.isPragmaOnce |= (Flags >> 3) & 0x01;
1575 HFI.DirInfo = (Flags >> 1) & 0x03;
1576 HFI.IndexHeaderMapHeader = Flags & 0x01;
1579 HFI.NumIncludes = std::max(endian::readNext<uint16_t, little, unaligned>(d),
1581 HFI.ControllingMacroID = Reader.getGlobalIdentifierID(
1582 M, endian::readNext<uint32_t, little, unaligned>(d));
1583 if (
unsigned FrameworkOffset =
1584 endian::readNext<uint32_t, little, unaligned>(d)) {
1587 StringRef FrameworkName(FrameworkStrings + FrameworkOffset - 1);
1588 HFI.Framework = HS->getUniqueFrameworkName(FrameworkName);
1591 assert((End - d) % 4 == 0 &&
1592 "Wrong data length in HeaderFileInfo deserialization");
1594 uint32_t LocalSMID = endian::readNext<uint32_t, little, unaligned>(d);
1600 SubmoduleID GlobalSMID = Reader.getGlobalSubmoduleID(M, LocalSMID);
1601 Module *Mod = Reader.getSubmodule(GlobalSMID);
1604 Reader.getPreprocessor().getHeaderSearchInfo().getModuleMap();
1608 Reader.ResolveImportedPath(M, Filename);
1613 ModMap.
addHeader(Mod, H, HeaderRole,
true);
1618 HFI.External =
true;
1625 uint64_t MacroDirectivesOffset) {
1626 assert(NumCurrentElementsDeserializing > 0 &&
"Missing deserialization guard");
1627 PendingMacroIDs[II].push_back(PendingMacroInfo(M, MacroDirectivesOffset));
1634 for (
auto &
I : llvm::reverse(ModuleMgr)) {
1635 BitstreamCursor &MacroCursor =
I->MacroCursor;
1638 if (!MacroCursor.getBitStreamReader())
1641 BitstreamCursor Cursor = MacroCursor;
1642 Cursor.JumpToBit(
I->MacroStartOffset);
1646 llvm::BitstreamEntry E = Cursor.advanceSkippingSubblocks();
1649 case llvm::BitstreamEntry::SubBlock:
1651 Error(
"malformed block record in AST file");
1653 case llvm::BitstreamEntry::EndBlock:
1656 case llvm::BitstreamEntry::Record:
1658 switch (Cursor.readRecord(E.ID, Record)) {
1664 getLocalIdentifier(*
I, Record[0]);
1680 class IdentifierLookupVisitor {
1683 unsigned PriorGeneration;
1684 unsigned &NumIdentifierLookups;
1685 unsigned &NumIdentifierLookupHits;
1689 IdentifierLookupVisitor(StringRef
Name,
unsigned PriorGeneration,
1690 unsigned &NumIdentifierLookups,
1691 unsigned &NumIdentifierLookupHits)
1693 PriorGeneration(PriorGeneration),
1694 NumIdentifierLookups(NumIdentifierLookups),
1695 NumIdentifierLookupHits(NumIdentifierLookupHits),
1712 ++NumIdentifierLookups;
1714 IdTable->find_hashed(
Name, NameHash, &Trait);
1715 if (Pos == IdTable->end())
1721 ++NumIdentifierLookupHits;
1736 unsigned PriorGeneration = 0;
1737 if (getContext().getLangOpts().Modules)
1738 PriorGeneration = IdentifierGeneration[&II];
1744 if (!loadGlobalIndex()) {
1745 if (GlobalIndex->lookupIdentifier(II.
getName(), Hits)) {
1750 IdentifierLookupVisitor Visitor(II.
getName(), PriorGeneration,
1751 NumIdentifierLookups,
1752 NumIdentifierLookupHits);
1753 ModuleMgr.visit(Visitor, HitsPtr);
1754 markIdentifierUpToDate(&II);
1764 if (getContext().getLangOpts().Modules)
1765 IdentifierGeneration[II] = getGeneration();
1769 const PendingMacroInfo &PMInfo) {
1774 Cursor.JumpToBit(PMInfo.MacroDirectivesOffset);
1776 struct ModuleMacroRecord {
1788 llvm::BitstreamEntry Entry =
1789 Cursor.advance(BitstreamCursor::AF_DontPopBlockAtEnd);
1790 if (Entry.Kind != llvm::BitstreamEntry::Record) {
1791 Error(
"malformed block record in AST file");
1801 ModuleMacros.push_back(ModuleMacroRecord());
1802 auto &Info = ModuleMacros.back();
1803 Info.SubModID = getGlobalSubmoduleID(M, Record[0]);
1804 Info.MI = getMacro(getGlobalMacroID(M, Record[1]));
1805 for (
int I = 2, N = Record.size();
I != N; ++
I)
1806 Info.Overrides.push_back(getGlobalSubmoduleID(M, Record[
I]));
1811 Error(
"malformed block record in AST file");
1822 std::reverse(ModuleMacros.begin(), ModuleMacros.end());
1824 for (
auto &MMR : ModuleMacros) {
1826 for (
unsigned ModID : MMR.Overrides) {
1827 Module *Mod = getSubmodule(ModID);
1828 auto *Macro = PP.getModuleMacro(Mod, II);
1829 assert(Macro &&
"missing definition for overridden macro");
1830 Overrides.push_back(Macro);
1833 bool Inserted =
false;
1834 Module *Owner = getSubmodule(MMR.SubModID);
1835 PP.addModuleMacro(Owner, II, MMR.MI, Overrides, Inserted);
1846 unsigned Idx = 0, N = Record.size();
1853 MacroInfo *MI = getMacro(getGlobalMacroID(M, Record[Idx++]));
1854 MD = PP.AllocateDefMacroDirective(MI, Loc);
1858 MD = PP.AllocateUndefMacroDirective(Loc);
1862 bool isPublic = Record[Idx++];
1863 MD = PP.AllocateVisibilityMacroDirective(Loc, isPublic);
1875 PP.setLoadedMacroDirective(II, Latest);
1878 ASTReader::InputFileInfo
1879 ASTReader::readInputFileInfo(ModuleFile &F,
unsigned ID) {
1881 BitstreamCursor &Cursor = F.InputFilesCursor;
1883 Cursor.JumpToBit(F.InputFileOffsets[ID-1]);
1885 unsigned Code = Cursor.ReadCode();
1889 unsigned Result = Cursor.readRecord(Code, Record, &Blob);
1890 assert(static_cast<InputFileRecordTypes>(Result) ==
INPUT_FILE &&
1891 "invalid record type for input file");
1894 assert(Record[0] == ID &&
"Bogus stored ID or offset");
1896 R.StoredSize =
static_cast<off_t
>(Record[1]);
1897 R.StoredTime =
static_cast<time_t
>(Record[2]);
1898 R.Overridden =
static_cast<bool>(Record[3]);
1899 R.Transient =
static_cast<bool>(Record[4]);
1901 ResolveImportedPath(F, R.Filename);
1922 InputFileInfo FI = readInputFileInfo(F, ID);
1923 off_t StoredSize = FI.StoredSize;
1924 time_t StoredTime = FI.StoredTime;
1925 bool Overridden = FI.Overridden;
1926 bool Transient = FI.Transient;
1929 const FileEntry *File = FileMgr.getFile(Filename,
false);
1933 if (File ==
nullptr && !F.
OriginalDir.empty() && !CurrentDir.empty() &&
1938 if (!Resolved.empty())
1939 File = FileMgr.getFile(Resolved);
1944 if ((Overridden || Transient) && File ==
nullptr)
1945 File = FileMgr.getVirtualFile(Filename, StoredSize, StoredTime);
1947 if (File ==
nullptr) {
1949 std::string ErrorStr =
"could not find file '";
1951 ErrorStr +=
"' referenced by AST file '";
1954 Error(ErrorStr.c_str());
1969 Error(diag::err_fe_pch_file_overridden, Filename);
1981 FileMgr.modifyFileEntry(const_cast<FileEntry*>(File),
1982 StoredSize, StoredTime);
1985 bool IsOutOfDate =
false;
1989 (StoredSize != File->
getSize() ||
1990 #if defined(LLVM_ON_WIN32)
2005 while (ImportStack.back()->ImportedBy.size() > 0)
2006 ImportStack.push_back(ImportStack.back()->ImportedBy[0]);
2009 StringRef TopLevelPCHName(ImportStack.back()->FileName);
2010 Error(diag::err_fe_pch_file_modified, Filename, TopLevelPCHName);
2013 if (ImportStack.size() > 1 && !Diags.isDiagnosticInFlight()) {
2014 Diag(diag::note_pch_required_by)
2015 << Filename << ImportStack[0]->FileName;
2016 for (
unsigned I = 1;
I < ImportStack.size(); ++
I)
2017 Diag(diag::note_pch_required_by)
2018 << ImportStack[
I-1]->FileName << ImportStack[
I]->FileName;
2021 if (!Diags.isDiagnosticInFlight())
2022 Diag(diag::note_pch_rebuild_required) << TopLevelPCHName;
2047 if (Filename.empty() || llvm::sys::path::is_absolute(Filename))
2051 llvm::sys::path::append(Buffer, Prefix, Filename);
2052 Filename.assign(Buffer.begin(), Buffer.end());
2067 llvm_unreachable(
"unknown ASTReadResult");
2071 BitstreamCursor &Stream,
unsigned ClientLoadCapabilities,
2073 std::string &SuggestedPredefines) {
2079 ASTReadResult Result =
Success;
2081 llvm::BitstreamEntry Entry = Stream.advance();
2083 switch (Entry.Kind) {
2085 case llvm::BitstreamEntry::SubBlock:
2088 case llvm::BitstreamEntry::EndBlock:
2091 case llvm::BitstreamEntry::Record:
2100 bool Complain = (ClientLoadCapabilities & ARR_ConfigurationMismatch) == 0;
2101 if (ParseLanguageOptions(Record, Complain, Listener,
2102 AllowCompatibleConfigurationMismatch))
2103 Result = ConfigurationMismatch;
2108 bool Complain = (ClientLoadCapabilities & ARR_ConfigurationMismatch) == 0;
2109 if (ParseTargetOptions(Record, Complain, Listener,
2110 AllowCompatibleConfigurationMismatch))
2111 Result = ConfigurationMismatch;
2116 bool Complain = (ClientLoadCapabilities & ARR_OutOfDate) == 0;
2117 if (!AllowCompatibleConfigurationMismatch &&
2118 ParseDiagnosticOptions(Record, Complain, Listener))
2124 bool Complain = (ClientLoadCapabilities & ARR_ConfigurationMismatch) == 0;
2125 if (!AllowCompatibleConfigurationMismatch &&
2126 ParseFileSystemOptions(Record, Complain, Listener))
2127 Result = ConfigurationMismatch;
2132 bool Complain = (ClientLoadCapabilities & ARR_ConfigurationMismatch) == 0;
2133 if (!AllowCompatibleConfigurationMismatch &&
2134 ParseHeaderSearchOptions(Record, Complain, Listener))
2135 Result = ConfigurationMismatch;
2140 bool Complain = (ClientLoadCapabilities & ARR_ConfigurationMismatch) == 0;
2141 if (!AllowCompatibleConfigurationMismatch &&
2142 ParsePreprocessorOptions(Record, Complain, Listener,
2143 SuggestedPredefines))
2144 Result = ConfigurationMismatch;
2154 unsigned ClientLoadCapabilities) {
2155 BitstreamCursor &Stream = F.
Stream;
2156 ASTReadResult Result =
Success;
2159 Error(
"malformed block record in AST file");
2165 unsigned NumInputs = 0;
2166 unsigned NumUserInputs = 0;
2168 llvm::BitstreamEntry Entry = Stream.advance();
2170 switch (Entry.Kind) {
2172 Error(
"malformed block record in AST file");
2174 case llvm::BitstreamEntry::EndBlock: {
2177 PP.getHeaderSearchInfo().getHeaderSearchOpts();
2183 bool Complain = (ClientLoadCapabilities & ARR_OutOfDate) == 0;
2189 unsigned N = NumUserInputs;
2190 if (ValidateSystemInputs ||
2196 for (
unsigned I = 0;
I < N; ++
I) {
2197 InputFile IF = getInputFile(F,
I+1, Complain);
2209 for (
unsigned I = 0;
I < N; ++
I) {
2210 bool IsSystem =
I >= NumUserInputs;
2211 InputFileInfo FI = readInputFileInfo(F,
I+1);
2220 case llvm::BitstreamEntry::SubBlock:
2224 if (Stream.SkipBlock() ||
2227 Error(
"malformed block record in AST file");
2236 if (Listener && !ImportedBy) {
2242 bool AllowCompatibleConfigurationMismatch =
2245 Result = ReadOptionsBlock(Stream, ClientLoadCapabilities,
2246 AllowCompatibleConfigurationMismatch,
2247 *Listener, SuggestedPredefines);
2248 if (Result == Failure) {
2249 Error(
"malformed block record in AST file");
2253 if (DisableValidation ||
2254 (AllowConfigurationMismatch && Result == ConfigurationMismatch))
2258 if (Result != Success &&
2261 }
else if (Stream.SkipBlock()) {
2262 Error(
"malformed block record in AST file");
2268 if (Stream.SkipBlock()) {
2269 Error(
"malformed block record in AST file");
2275 case llvm::BitstreamEntry::Record:
2286 if ((ClientLoadCapabilities & ARR_VersionMismatch) == 0)
2288 : diag::err_pch_version_too_new);
2292 bool hasErrors = Record[6];
2293 if (hasErrors && !DisableValidation && !AllowASTWithCompilerErrors) {
2294 Diag(diag::err_pch_with_compiler_errors);
2306 StringRef ASTBranch = Blob;
2307 if (StringRef(CurBranch) != ASTBranch && !DisableValidation) {
2308 if ((ClientLoadCapabilities & ARR_VersionMismatch) == 0)
2309 Diag(diag::err_pch_different_branch) << ASTBranch << CurBranch;
2322 unsigned Idx = 0, N = Record.size();
2331 off_t StoredSize = (off_t)Record[Idx++];
2332 time_t StoredModTime = (time_t)Record[Idx++];
2334 auto ImportedFile = ReadPath(F, Record, Idx);
2338 unsigned Capabilities = ClientLoadCapabilities;
2339 if ((ClientLoadCapabilities & ARR_OutOfDate) == 0)
2340 Capabilities &= ~ARR_Missing;
2343 auto Result = ReadASTCore(ImportedFile, ImportedKind, ImportLoc, &F,
2344 Loaded, StoredSize, StoredModTime,
2345 StoredSignature, Capabilities);
2349 Diag(diag::note_module_file_imported_by)
2353 case Failure:
return Failure;
2356 case OutOfDate:
return OutOfDate;
2358 case ConfigurationMismatch:
return ConfigurationMismatch;
2359 case HadErrors:
return HadErrors;
2389 "MODULE_DIRECTORY found before MODULE_NAME");
2393 if (M && M->Directory) {
2398 PP.getFileManager().getDirectory(Blob);
2399 if (!BuildDir || BuildDir != M->Directory) {
2400 if ((ClientLoadCapabilities & ARR_OutOfDate) == 0)
2401 Diag(diag::err_imported_module_relocated)
2402 << F.
ModuleName << Blob << M->Directory->getName();
2414 if (ASTReadResult Result =
2415 ReadModuleMapFileBlock(Record, F, ImportedBy, ClientLoadCapabilities))
2420 NumInputs = Record[0];
2421 NumUserInputs = Record[1];
2423 (
const llvm::support::unaligned_uint64_t *)Blob.data();
2431 ASTReader::ReadASTBlock(
ModuleFile &F,
unsigned ClientLoadCapabilities) {
2432 BitstreamCursor &Stream = F.
Stream;
2435 Error(
"malformed block record in AST file");
2442 llvm::BitstreamEntry Entry = Stream.advance();
2444 switch (Entry.Kind) {
2446 Error(
"error at end of module block in AST file");
2448 case llvm::BitstreamEntry::EndBlock: {
2456 !getContext().getLangOpts().CPlusPlus)
2461 case llvm::BitstreamEntry::SubBlock:
2469 if (Stream.SkipBlock() ||
2472 Error(
"malformed block record in AST file");
2479 if (!PP.getExternalSource())
2480 PP.setExternalSource(
this);
2482 if (Stream.SkipBlock() ||
2484 Error(
"malformed block record in AST file");
2492 if (Stream.SkipBlock() ||
2495 Error(
"malformed preprocessor detail record in AST file");
2501 if (!PP.getPreprocessingRecord())
2502 PP.createPreprocessingRecord();
2503 if (!PP.getPreprocessingRecord()->getExternalSource())
2504 PP.getPreprocessingRecord()->SetExternalSource(*
this);
2508 if (ReadSourceManagerBlock(F))
2513 if (ASTReadResult Result = ReadSubmoduleBlock(F, ClientLoadCapabilities))
2518 BitstreamCursor
C = Stream;
2519 if (Stream.SkipBlock() ||
2521 Error(
"malformed comments block in AST file");
2524 CommentsCursors.push_back(std::make_pair(C, &F));
2529 if (Stream.SkipBlock()) {
2530 Error(
"malformed block record in AST file");
2537 case llvm::BitstreamEntry::Record:
2545 switch ((
ASTRecordTypes)Stream.readRecord(Entry.ID, Record, &Blob)) {
2551 Error(
"duplicate TYPE_OFFSET record in AST file");
2556 unsigned LocalBaseTypeIndex = Record[1];
2561 GlobalTypeMap.insert(std::make_pair(getTotalNumTypes(), &F));
2565 std::make_pair(LocalBaseTypeIndex,
2575 Error(
"duplicate DECL_OFFSET record in AST file");
2580 unsigned LocalBaseDeclID = Record[1];
2586 GlobalDeclMap.insert(
2592 std::make_pair(LocalBaseDeclID, F.
BaseDeclID - LocalBaseDeclID));
2605 LexicalContents Contents(
2606 reinterpret_cast<const llvm::support::unaligned_uint32_t *>(
2608 static_cast<unsigned int>(Blob.size() / 4));
2609 TULexicalDecls.push_back(std::make_pair(&F, Contents));
2617 auto *Data = (
const unsigned char*)Blob.data();
2618 PendingVisibleUpdates[
ID].push_back(PendingVisibleUpdate{&F, Data});
2621 if (
Decl *D = GetExistingDecl(ID))
2622 PendingUpdateRecords.push_back(std::make_pair(ID, D));
2635 PP.getIdentifierTable().setExternalIdentifierLookup(
this);
2641 Error(
"duplicate IDENTIFIER_OFFSET record in AST file");
2646 unsigned LocalBaseIdentifierID = Record[1];
2652 GlobalIdentifierMap.insert(std::make_pair(getTotalNumIdentifiers() + 1,
2658 std::make_pair(LocalBaseIdentifierID,
2661 IdentifiersLoaded.resize(IdentifiersLoaded.size()
2674 for (
unsigned I = 0, N = Record.size();
I != N; ++
I)
2675 EagerlyDeserializedDecls.push_back(getGlobalDeclID(F, Record[
I]));
2679 if (SpecialTypes.empty()) {
2680 for (
unsigned I = 0, N = Record.size(); I != N; ++
I)
2681 SpecialTypes.push_back(getGlobalTypeID(F, Record[I]));
2685 if (SpecialTypes.size() != Record.size()) {
2686 Error(
"invalid special-types record");
2690 for (
unsigned I = 0, N = Record.size(); I != N; ++
I) {
2692 if (!SpecialTypes[I])
2693 SpecialTypes[
I] =
ID;
2700 TotalNumStatements += Record[0];
2701 TotalNumMacros += Record[1];
2702 TotalLexicalDeclContexts += Record[2];
2703 TotalVisibleDeclContexts += Record[3];
2707 for (
unsigned I = 0, N = Record.size(); I != N; ++
I)
2708 UnusedFileScopedDecls.push_back(getGlobalDeclID(F, Record[I]));
2712 for (
unsigned I = 0, N = Record.size(); I != N; ++
I)
2713 DelegatingCtorDecls.push_back(getGlobalDeclID(F, Record[I]));
2717 if (Record.size() % 4 != 0) {
2718 Error(
"invalid weak identifiers record");
2724 WeakUndeclaredIdentifiers.clear();
2727 for (
unsigned I = 0, N = Record.size(); I < N; ) {
2728 WeakUndeclaredIdentifiers.push_back(
2729 getGlobalIdentifierID(F, Record[I++]));
2730 WeakUndeclaredIdentifiers.push_back(
2731 getGlobalIdentifierID(F, Record[I++]));
2732 WeakUndeclaredIdentifiers.push_back(
2733 ReadSourceLocation(F, Record, I).getRawEncoding());
2734 WeakUndeclaredIdentifiers.push_back(Record[I++]);
2741 unsigned LocalBaseSelectorID = Record[1];
2747 GlobalSelectorMap.insert(std::make_pair(getTotalNumSelectors()+1, &F));
2752 std::make_pair(LocalBaseSelectorID,
2768 TotalNumMethodPoolEntries += Record[1];
2772 if (!Record.empty()) {
2773 for (
unsigned Idx = 0, N = Record.size() - 1; Idx < N; ) {
2774 ReferencedSelectorsData.push_back(getGlobalSelectorID(F,
2776 ReferencedSelectorsData.push_back(ReadSourceLocation(F, Record, Idx).
2783 if (!Record.empty() && Listener)
2795 unsigned SLocSpaceSize = Record[1];
2800 Error(
"ran out of source locations");
2806 unsigned RangeStart =
2808 GlobalSLocEntryMap.insert(std::make_pair(RangeStart, &F));
2813 GlobalSLocOffsetMap.insert(
2815 - SLocSpaceSize,&F));
2830 const unsigned char *Data = (
const unsigned char*)Blob.data();
2831 const unsigned char *DataEnd = Data + Blob.size();
2851 while (Data < DataEnd) {
2852 using namespace llvm::support;
2853 uint16_t Len = endian::readNext<uint16_t, little, unaligned>(Data);
2854 StringRef
Name = StringRef((
const char*)Data, Len);
2858 Error(
"SourceLocation remap refers to unknown module");
2862 uint32_t SLocOffset =
2863 endian::readNext<uint32_t, little, unaligned>(Data);
2864 uint32_t IdentifierIDOffset =
2865 endian::readNext<uint32_t, little, unaligned>(Data);
2866 uint32_t MacroIDOffset =
2867 endian::readNext<uint32_t, little, unaligned>(Data);
2868 uint32_t PreprocessedEntityIDOffset =
2869 endian::readNext<uint32_t, little, unaligned>(Data);
2870 uint32_t SubmoduleIDOffset =
2871 endian::readNext<uint32_t, little, unaligned>(Data);
2872 uint32_t SelectorIDOffset =
2873 endian::readNext<uint32_t, little, unaligned>(Data);
2874 uint32_t DeclIDOffset =
2875 endian::readNext<uint32_t, little, unaligned>(Data);
2876 uint32_t TypeIndexOffset =
2877 endian::readNext<uint32_t, little, unaligned>(Data);
2879 uint32_t
None = std::numeric_limits<uint32_t>::max();
2881 auto mapOffset = [&](uint32_t
Offset, uint32_t BaseOffset,
2882 RemapBuilder &Remap) {
2884 Remap.insert(std::make_pair(Offset,
2885 static_cast<int>(BaseOffset - Offset)));
2887 mapOffset(SLocOffset, OM->SLocEntryBaseOffset,
SLocRemap);
2888 mapOffset(IdentifierIDOffset, OM->BaseIdentifierID, IdentifierRemap);
2889 mapOffset(MacroIDOffset, OM->BaseMacroID, MacroRemap);
2890 mapOffset(PreprocessedEntityIDOffset, OM->BasePreprocessedEntityID,
2891 PreprocessedEntityRemap);
2892 mapOffset(SubmoduleIDOffset, OM->BaseSubmoduleID, SubmoduleRemap);
2893 mapOffset(SelectorIDOffset, OM->BaseSelectorID, SelectorRemap);
2894 mapOffset(DeclIDOffset, OM->BaseDeclID, DeclRemap);
2895 mapOffset(TypeIndexOffset, OM->BaseTypeIndex, TypeRemap);
2904 if (ParseLineTable(F, Record))
2912 Error(
"Multiple SOURCE_LOCATION_PRELOADS records in AST file");
2921 for (
unsigned I = 0, N = Record.size(); I != N; ++
I)
2922 ExtVectorDecls.push_back(getGlobalDeclID(F, Record[I]));
2926 if (Record.size() % 3 != 0) {
2927 Error(
"Invalid VTABLE_USES record");
2936 for (
unsigned Idx = 0, N = Record.size(); Idx != N; ) {
2937 VTableUses.push_back(getGlobalDeclID(F, Record[Idx++]));
2938 VTableUses.push_back(
2939 ReadSourceLocation(F, Record, Idx).getRawEncoding());
2940 VTableUses.push_back(Record[Idx++]);
2945 if (PendingInstantiations.size() % 2 != 0) {
2946 Error(
"Invalid existing PendingInstantiations");
2950 if (Record.size() % 2 != 0) {
2951 Error(
"Invalid PENDING_IMPLICIT_INSTANTIATIONS block");
2955 for (
unsigned I = 0, N = Record.size(); I != N; ) {
2956 PendingInstantiations.push_back(getGlobalDeclID(F, Record[I++]));
2957 PendingInstantiations.push_back(
2958 ReadSourceLocation(F, Record, I).getRawEncoding());
2963 if (Record.size() != 2) {
2964 Error(
"Invalid SEMA_DECL_REFS block");
2967 for (
unsigned I = 0, N = Record.size(); I != N; ++
I)
2968 SemaDeclRefs.push_back(getGlobalDeclID(F, Record[I]));
2976 unsigned LocalBasePreprocessedEntityID = Record[0];
2978 unsigned StartingID;
2979 if (!PP.getPreprocessingRecord())
2980 PP.createPreprocessingRecord();
2981 if (!PP.getPreprocessingRecord()->getExternalSource())
2982 PP.getPreprocessingRecord()->SetExternalSource(*
this);
2984 = PP.getPreprocessingRecord()
2991 GlobalPreprocessedEntityMap.insert(std::make_pair(StartingID, &F));
2996 std::make_pair(LocalBasePreprocessedEntityID,
3004 if (Record.size() % 2 != 0) {
3005 Error(
"invalid DECL_UPDATE_OFFSETS block in AST file");
3008 for (
unsigned I = 0, N = Record.size(); I != N; I += 2) {
3010 DeclUpdateOffsets[
ID].push_back(std::make_pair(&F, Record[I + 1]));
3014 if (
Decl *D = GetExistingDecl(ID))
3015 PendingUpdateRecords.push_back(std::make_pair(ID, D));
3021 if (Record.size() % 3 != 0) {
3022 Error(
"invalid DECL_REPLACEMENTS block in AST file");
3025 for (
unsigned I = 0, N = Record.size(); I != N; I += 3)
3026 ReplacedDecls[getGlobalDeclID(F, Record[I])]
3027 = ReplacedDeclInfo(&F, Record[I+1], Record[I+2]);
3033 Error(
"duplicate OBJC_CATEGORIES_MAP record in AST file");
3048 Error(
"duplicate CXX_BASE_SPECIFIER_OFFSETS record in AST file");
3059 Error(
"duplicate CXX_CTOR_INITIALIZERS_OFFSETS record in AST file");
3073 Record.begin(), Record.end());
3079 CUDASpecialDeclRefs.clear();
3080 for (
unsigned I = 0, N = Record.size(); I != N; ++
I)
3081 CUDASpecialDeclRefs.push_back(getGlobalDeclID(F, Record[I]));
3093 &PP.getHeaderSearchInfo(),
3094 Blob.data() + Record[2]));
3096 PP.getHeaderSearchInfo().SetExternalSource(
this);
3097 if (!PP.getHeaderSearchInfo().getExternalLookup())
3098 PP.getHeaderSearchInfo().SetExternalLookup(
this);
3105 FPPragmaOptions.swap(Record);
3110 OpenCLExtensions.swap(Record);
3114 for (
unsigned I = 0, N = Record.size(); I != N; ++
I)
3115 TentativeDefinitions.push_back(getGlobalDeclID(F, Record[I]));
3119 for (
unsigned I = 0, N = Record.size(); I != N; ++
I)
3120 KnownNamespaces.push_back(getGlobalDeclID(F, Record[I]));
3124 if (UndefinedButUsed.size() % 2 != 0) {
3125 Error(
"Invalid existing UndefinedButUsed");
3129 if (Record.size() % 2 != 0) {
3130 Error(
"invalid undefined-but-used record");
3133 for (
unsigned I = 0, N = Record.size(); I != N; ) {
3134 UndefinedButUsed.push_back(getGlobalDeclID(F, Record[I++]));
3135 UndefinedButUsed.push_back(
3136 ReadSourceLocation(F, Record, I).getRawEncoding());
3140 for (
unsigned I = 0, N = Record.size(); I != N;) {
3141 DelayedDeleteExprs.push_back(getGlobalDeclID(F, Record[I++]));
3142 const uint64_t
Count = Record[I++];
3143 DelayedDeleteExprs.push_back(Count);
3144 for (uint64_t C = 0; C <
Count; ++
C) {
3145 DelayedDeleteExprs.push_back(ReadSourceLocation(F, Record, I).getRawEncoding());
3146 bool IsArrayForm = Record[I++] == 1;
3147 DelayedDeleteExprs.push_back(IsArrayForm);
3157 for (
unsigned I = 0, N = Record.size(); I != N; ) {
3158 unsigned GlobalID = getGlobalSubmoduleID(F, Record[I++]);
3161 ImportedModules.push_back(ImportedSubmodule(GlobalID, Loc));
3169 Error(
"duplicate MACRO_OFFSET record in AST file");
3174 unsigned LocalBaseMacroID = Record[1];
3179 GlobalMacroMap.insert(std::make_pair(getTotalNumMacros() + 1, &F));
3183 std::make_pair(LocalBaseMacroID,
3192 LateParsedTemplates.append(Record.begin(), Record.end());
3197 if (Record.size() != 1) {
3198 Error(
"invalid pragma optimize record");
3201 OptimizeOffPragmaLocation = ReadSourceLocation(F, Record[0]);
3205 for (
unsigned I = 0, N = Record.size(); I != N; ++
I)
3206 UnusedLocalTypedefNameCandidates.push_back(
3207 getGlobalDeclID(F, Record[I]));
3214 ASTReader::ReadModuleMapFileBlock(RecordData &Record,
ModuleFile &F,
3216 unsigned ClientLoadCapabilities) {
3231 "MODULE_NAME should come before MODULE_MAP_FILE");
3237 auto &
Map = PP.getHeaderSearchInfo().getModuleMap();
3238 const FileEntry *ModMap = M ?
Map.getModuleMapFileForUniquing(M) :
nullptr;
3240 assert(ImportedBy &&
"top-level import should be verified");
3241 if ((ClientLoadCapabilities & ARR_OutOfDate) == 0) {
3242 if (
auto *ASTFE = M ? M->
getASTFile() :
nullptr)
3245 << ASTFE->getName();
3248 Diag(diag::err_imported_module_not_found)
3255 assert(M->
Name == F.
ModuleName &&
"found module with different name");
3259 if (StoredModMap ==
nullptr || StoredModMap != ModMap) {
3260 assert(ModMap &&
"found module is missing module map file");
3261 assert(ImportedBy &&
"top-level import should be verified");
3262 if ((ClientLoadCapabilities & ARR_OutOfDate) == 0)
3263 Diag(diag::err_imported_module_modmap_changed)
3269 llvm::SmallPtrSet<const FileEntry *, 1> AdditionalStoredMaps;
3270 for (
unsigned I = 0, N = Record[Idx++]; I < N; ++
I) {
3272 std::string Filename = ReadPath(F, Record, Idx);
3274 FileMgr.getFile(Filename,
false,
false);
3276 if ((ClientLoadCapabilities & ARR_OutOfDate) == 0)
3277 Error(
"could not find file '" + Filename +
"' referenced by AST file");
3280 AdditionalStoredMaps.insert(F);
3285 if (
auto *AdditionalModuleMaps =
Map.getAdditionalModuleMapFiles(M)) {
3286 for (
const FileEntry *ModMap : *AdditionalModuleMaps) {
3289 if (!AdditionalStoredMaps.erase(ModMap)) {
3290 if ((ClientLoadCapabilities & ARR_OutOfDate) == 0)
3291 Diag(diag::err_module_different_modmap)
3292 << F.ModuleName << 0 << ModMap->
getName();
3300 for (
const FileEntry *ModMap : AdditionalStoredMaps) {
3301 if ((ClientLoadCapabilities & ARR_OutOfDate) == 0)
3302 Diag(diag::err_module_different_modmap)
3303 << F.ModuleName << 1 << ModMap->
getName();
3324 : Known->second.second;
3328 if (List->getMethod() == Method) {
3336 if (List->getNext())
3337 List->setMethod(List->getNext()->getMethod());
3339 List->setMethod(Method);
3345 for (
Decl *D : Names) {
3346 bool wasHidden = D->Hidden;
3349 if (wasHidden && SemaObj) {
3360 llvm::SmallPtrSet<Module *, 4> Visited;
3362 Stack.push_back(Mod);
3363 while (!Stack.empty()) {
3364 Mod = Stack.pop_back_val();
3366 if (NameVisibility <= Mod->NameVisibility) {
3383 if (Hidden != HiddenNamesMap.end()) {
3385 HiddenNamesMap.erase(Hidden);
3387 assert(HiddenNamesMap.find(Mod) == HiddenNamesMap.end() &&
3388 "making names visible added hidden names");
3395 I = Exports.begin(), E = Exports.end(); I !=
E; ++
I) {
3397 if (Visited.insert(Exported).second)
3398 Stack.push_back(Exported);
3407 if (TriedLoadingGlobalIndex || !UseGlobalIndex ||
3412 TriedLoadingGlobalIndex =
true;
3413 StringRef ModuleCachePath
3414 = getPreprocessor().getHeaderSearchInfo().getModuleCachePath();
3415 std::pair<GlobalModuleIndex *, GlobalModuleIndex::ErrorCode> Result
3420 GlobalIndex.reset(Result.first);
3421 ModuleMgr.setGlobalIndex(GlobalIndex.get());
3427 !hasGlobalIndex() && TriedLoadingGlobalIndex;
3434 llvm::raw_fd_ostream OS(TimestampFilename, EC, llvm::sys::fs::F_Text);
3437 OS <<
"Timestamp file\n";
3445 llvm::BitstreamEntry Entry = Cursor.advance();
3446 switch (Entry.Kind) {
3448 case llvm::BitstreamEntry::EndBlock:
3451 case llvm::BitstreamEntry::Record:
3453 Cursor.skipRecord(Entry.ID);
3456 case llvm::BitstreamEntry::SubBlock:
3457 if (Entry.ID == BlockID) {
3458 if (Cursor.EnterSubBlock(BlockID))
3464 if (Cursor.SkipBlock())
3473 unsigned ClientLoadCapabilities) {
3475 SetCurImportLocRAII(CurrentImportLoc, ImportLoc);
3481 unsigned PreviousGeneration = incrementGeneration(
Context);
3483 unsigned NumModules = ModuleMgr.size();
3485 switch(
ASTReadResult ReadResult = ReadASTCore(FileName, Type, ImportLoc,
3488 ClientLoadCapabilities)) {
3492 case VersionMismatch:
3493 case ConfigurationMismatch:
3495 llvm::SmallPtrSet<ModuleFile *, 4> LoadedSet;
3496 for (
const ImportedModule &IM : Loaded)
3497 LoadedSet.insert(IM.Mod);
3499 ModuleMgr.removeModules(ModuleMgr.begin() + NumModules, ModuleMgr.end(),
3502 ? &PP.getHeaderSearchInfo().getModuleMap()
3507 GlobalIndex.reset();
3508 ModuleMgr.setGlobalIndex(
nullptr);
3519 MEnd = Loaded.end();
3524 if (
ASTReadResult Result = ReadASTBlock(F, ClientLoadCapabilities))
3546 SourceMgr.getLoadedSLocEntryByID(Index);
3552 const unsigned char *Data =
reinterpret_cast<const unsigned char *
>(
3557 auto Key = Trait.
ReadKey(Data, KeyDataLen.first);
3558 auto &II = PP.getIdentifierTable().getOwn(Key);
3559 II.setOutOfDate(
true);
3563 if (!II.isFromAST()) {
3565 bool IsModule = PP.getCurrentModule() !=
nullptr;
3567 II.setChangedSinceDeserialization();
3572 SetIdentifierInfo(ID, &II);
3579 MEnd = Loaded.end();
3583 ModuleMgr.moduleFileAccepted(&F);
3590 F.
ImportLoc = ReadSourceLocation(*M->ImportedBy,
3591 M->ImportLoc.getRawEncoding());
3604 IdEnd = PP.getIdentifierTable().end();
3606 Id->second->setOutOfDate(
true);
3610 for (
unsigned I = 0, N = UnresolvedModuleRefs.size(); I != N; ++
I) {
3611 UnresolvedModuleRef &Unresolved = UnresolvedModuleRefs[
I];
3612 SubmoduleID GlobalID = getGlobalSubmoduleID(*Unresolved.File,Unresolved.ID);
3613 Module *ResolvedMod = getSubmodule(GlobalID);
3615 switch (Unresolved.Kind) {
3616 case UnresolvedModuleRef::Conflict:
3619 Conflict.
Other = ResolvedMod;
3620 Conflict.
Message = Unresolved.String.str();
3621 Unresolved.Mod->Conflicts.push_back(Conflict);
3625 case UnresolvedModuleRef::Import:
3627 Unresolved.Mod->Imports.insert(ResolvedMod);
3630 case UnresolvedModuleRef::Export:
3631 if (ResolvedMod || Unresolved.IsWildcard)
3632 Unresolved.Mod->Exports.push_back(
3637 UnresolvedModuleRefs.clear();
3643 InitializeContext();
3648 if (DeserializationListener)
3649 DeserializationListener->ReaderInitialized(
this);
3651 ModuleFile &PrimaryModule = ModuleMgr.getPrimaryModule();
3669 for (
unsigned I = 0, N = ObjCClassesLoaded.size(); I != N; ++
I) {
3670 loadObjCCategories(ObjCClassesLoaded[I]->getGlobalID(),
3671 ObjCClassesLoaded[I],
3672 PreviousGeneration);
3675 if (PP.getHeaderSearchInfo()
3676 .getHeaderSearchOpts()
3677 .ModulesValidateOncePerBuildSession) {
3682 for (
unsigned I = 0, N = Loaded.size(); I != N; ++
I) {
3683 ImportedModule &M = Loaded[
I];
3697 return Stream.Read(8) ==
'C' &&
3698 Stream.Read(8) ==
'P' &&
3699 Stream.Read(8) ==
'C' &&
3700 Stream.Read(8) ==
'H';
3714 llvm_unreachable(
"unknown module kind");
3718 ASTReader::ReadASTCore(StringRef FileName,
3723 off_t ExpectedSize, time_t ExpectedModTime,
3725 unsigned ClientLoadCapabilities) {
3727 std::string ErrorStr;
3729 = ModuleMgr.addModule(FileName, Type, ImportLoc, ImportedBy,
3730 getGeneration(), ExpectedSize, ExpectedModTime,
3734 switch (AddResult) {
3745 if (ClientLoadCapabilities & ARR_Missing)
3750 << FileName << ErrorStr.empty()
3757 if (ClientLoadCapabilities & ARR_OutOfDate)
3762 << FileName << ErrorStr.empty()
3767 assert(M &&
"Missing module file");
3771 if (FileName !=
"-") {
3772 CurrentDir = llvm::sys::path::parent_path(FileName);
3773 if (CurrentDir.empty()) CurrentDir =
".";
3777 BitstreamCursor &Stream = F.
Stream;
3790 bool HaveReadControlBlock =
false;
3792 llvm::BitstreamEntry Entry = Stream.advance();
3794 switch (Entry.Kind) {
3796 case llvm::BitstreamEntry::Record:
3797 case llvm::BitstreamEntry::EndBlock:
3798 Error(
"invalid record at top-level of AST file");
3801 case llvm::BitstreamEntry::SubBlock:
3807 HaveReadControlBlock =
true;
3808 switch (ReadControlBlock(F, Loaded, ImportedBy, ClientLoadCapabilities)) {
3817 if (Result != OutOfDate ||
3818 (ClientLoadCapabilities & ARR_OutOfDate) == 0)
3819 Diag(diag::err_module_file_not_module) << FileName;
3824 case Failure:
return Failure;
3825 case Missing:
return Missing;
3826 case OutOfDate:
return OutOfDate;
3828 case ConfigurationMismatch:
return ConfigurationMismatch;
3829 case HadErrors:
return HadErrors;
3834 if (!HaveReadControlBlock) {
3835 if ((ClientLoadCapabilities & ARR_VersionMismatch) == 0)
3836 Diag(diag::err_pch_version_too_old);
3841 Loaded.push_back(ImportedModule(M, ImportedBy, ImportLoc));
3845 if (Stream.SkipBlock()) {
3846 Error(
"malformed block record in AST file");
3861 if (Record.size() < 4)
return true;
3866 unsigned BlockNameLen = Record[2];
3867 unsigned UserInfoLen = Record[3];
3869 if (BlockNameLen + UserInfoLen > Blob.size())
return true;
3871 Metadata.
BlockName = std::string(Blob.data(), Blob.data() + BlockNameLen);
3872 Metadata.
UserInfo = std::string(Blob.data() + BlockNameLen,
3873 Blob.data() + BlockNameLen + UserInfoLen);
3878 BitstreamCursor &Stream = F.
Stream;
3882 llvm::BitstreamEntry Entry = Stream.advance();
3883 switch (Entry.Kind) {
3884 case llvm::BitstreamEntry::SubBlock:
3885 if (Stream.SkipBlock())
3890 case llvm::BitstreamEntry::EndBlock:
3896 case llvm::BitstreamEntry::Record:
3902 unsigned RecCode = Stream.readRecord(Entry.ID, Record, &Blob);
3910 auto Known = ModuleFileExtensions.find(Metadata.
BlockName);
3911 if (Known == ModuleFileExtensions.end())
break;
3914 if (
auto Reader = Known->second->createExtensionReader(Metadata, *
this,
3929 if (DeserializationListener)
3939 if (!
Context.CFConstantStringTypeDecl)
3946 Error(
"FILE type is NULL");
3956 Error(
"Invalid FILE type in AST file");
3965 QualType Jmp_bufType = GetType(Jmp_buf);
3966 if (Jmp_bufType.
isNull()) {
3967 Error(
"jmp_buf type is NULL");
3977 Error(
"Invalid jmp_buf type in AST file");
3986 QualType Sigjmp_bufType = GetType(Sigjmp_buf);
3987 if (Sigjmp_bufType.
isNull()) {
3988 Error(
"sigjmp_buf type is NULL");
3992 if (!
Context.sigjmp_bufDecl) {
3997 assert(Tag &&
"Invalid sigjmp_buf type in AST file");
4003 if (
unsigned ObjCIdRedef
4006 Context.ObjCIdRedefinitionType = GetType(ObjCIdRedef);
4009 if (
unsigned ObjCClassRedef
4012 Context.ObjCClassRedefinitionType = GetType(ObjCClassRedef);
4015 if (
unsigned ObjCSelRedef
4018 Context.ObjCSelRedefinitionType = GetType(ObjCSelRedef);
4022 QualType Ucontext_tType = GetType(Ucontext_t);
4023 if (Ucontext_tType.
isNull()) {
4024 Error(
"ucontext_t type is NULL");
4028 if (!
Context.ucontext_tDecl) {
4033 assert(Tag &&
"Invalid ucontext_t type in AST file");
4043 if (!CUDASpecialDeclRefs.empty()) {
4044 assert(CUDASpecialDeclRefs.size() == 1 &&
"More decl refs than expected!");
4046 cast<FunctionDecl>(GetDecl(CUDASpecialDeclRefs[0])));
4051 for (
auto &Import : ImportedModules) {
4052 if (
Module *Imported = getSubmodule(Import.ID)) {
4055 PP.makeModuleVisible(Imported, Import.ImportLoc);
4058 ImportedModules.clear();
4068 BitstreamCursor Stream(StreamFile);
4079 llvm::BitstreamEntry Entry = Stream.advanceSkippingSubblocks();
4080 if (Entry.Kind == llvm::BitstreamEntry::EndBlock ||
4081 Entry.Kind != llvm::BitstreamEntry::Record)
4086 if (
SIGNATURE == Stream.readRecord(Entry.ID, Record, &Blob))
4095 const std::string &ASTFileName,
FileManager &FileMgr,
4100 Diags.
Report(diag::err_fe_unable_to_read_pch_file)
4101 << ASTFileName <<
Buffer.getError().message();
4102 return std::string();
4106 llvm::BitstreamReader StreamFile;
4107 PCHContainerRdr.
ExtractPCH((*Buffer)->getMemBufferRef(), StreamFile);
4108 BitstreamCursor Stream(StreamFile);
4112 Diags.
Report(diag::err_fe_not_a_pch_file) << ASTFileName;
4113 return std::string();
4118 Diags.
Report(diag::err_fe_pch_malformed_block) << ASTFileName;
4119 return std::string();
4125 llvm::BitstreamEntry Entry = Stream.advanceSkippingSubblocks();
4126 if (Entry.Kind == llvm::BitstreamEntry::EndBlock)
4127 return std::string();
4129 if (Entry.Kind != llvm::BitstreamEntry::Record) {
4130 Diags.
Report(diag::err_fe_pch_malformed_block) << ASTFileName;
4131 return std::string();
4136 if (Stream.readRecord(Entry.ID, Record, &Blob) ==
ORIGINAL_FILE)
4146 std::string ExistingModuleCachePath;
4150 SimplePCHValidator(
const LangOptions &ExistingLangOpts,
4153 StringRef ExistingModuleCachePath,
4155 : ExistingLangOpts(ExistingLangOpts),
4156 ExistingTargetOpts(ExistingTargetOpts),
4157 ExistingPPOpts(ExistingPPOpts),
4158 ExistingModuleCachePath(ExistingModuleCachePath),
4163 bool ReadLanguageOptions(
const LangOptions &LangOpts,
bool Complain,
4164 bool AllowCompatibleDifferences)
override {
4166 AllowCompatibleDifferences);
4168 bool ReadTargetOptions(
const TargetOptions &TargetOpts,
bool Complain,
4169 bool AllowCompatibleDifferences)
override {
4171 AllowCompatibleDifferences);
4174 StringRef SpecificModuleCachePath,
4175 bool Complain)
override {
4177 ExistingModuleCachePath,
4178 nullptr, ExistingLangOpts);
4182 std::string &SuggestedPredefines)
override {
4184 SuggestedPredefines, ExistingLangOpts);
4192 bool FindModuleFileExtensions,
4203 llvm::BitstreamReader StreamFile;
4204 PCHContainerRdr.
ExtractPCH((*Buffer)->getMemBufferRef(), StreamFile);
4205 BitstreamCursor Stream(StreamFile);
4218 BitstreamCursor InputFilesCursor;
4221 std::string ModuleDir;
4222 bool DoneWithControlBlock =
false;
4223 while (!DoneWithControlBlock) {
4224 llvm::BitstreamEntry Entry = Stream.advance();
4226 switch (Entry.Kind) {
4227 case llvm::BitstreamEntry::SubBlock: {
4230 std::string IgnoredSuggestedPredefines;
4231 if (ReadOptionsBlock(Stream, ARR_ConfigurationMismatch | ARR_OutOfDate,
4233 Listener, IgnoredSuggestedPredefines) != Success)
4239 InputFilesCursor = Stream;
4240 if (Stream.SkipBlock() ||
4247 if (Stream.SkipBlock())
4255 case llvm::BitstreamEntry::EndBlock:
4256 DoneWithControlBlock =
true;
4262 case llvm::BitstreamEntry::Record:
4266 if (DoneWithControlBlock)
break;
4270 unsigned RecCode = Stream.readRecord(Entry.ID, Record, &Blob);
4289 auto Path = ReadString(Record, Idx);
4290 ResolveImportedPath(Path, ModuleDir);
4295 if (!NeedsInputFiles)
4298 unsigned NumInputFiles = Record[0];
4299 unsigned NumUserFiles = Record[1];
4300 const uint64_t *InputFileOffs = (
const uint64_t *)Blob.data();
4301 for (
unsigned I = 0; I != NumInputFiles; ++
I) {
4303 bool isSystemFile = I >= NumUserFiles;
4305 if (isSystemFile && !NeedsSystemInputFiles)
4308 BitstreamCursor &Cursor = InputFilesCursor;
4310 Cursor.JumpToBit(InputFileOffs[I]);
4312 unsigned Code = Cursor.ReadCode();
4315 bool shouldContinue =
false;
4318 bool Overridden =
static_cast<bool>(Record[3]);
4319 std::string Filename = Blob;
4320 ResolveImportedPath(Filename, ModuleDir);
4322 Filename, isSystemFile, Overridden,
false);
4325 if (!shouldContinue)
4335 unsigned Idx = 0, N = Record.size();
4339 std::string Filename = ReadString(Record, Idx);
4340 ResolveImportedPath(Filename, ModuleDir);
4353 if (FindModuleFileExtensions) {
4355 bool DoneWithExtensionBlock =
false;
4356 while (!DoneWithExtensionBlock) {
4357 llvm::BitstreamEntry Entry = Stream.advance();
4359 switch (Entry.Kind) {
4360 case llvm::BitstreamEntry::SubBlock:
4361 if (Stream.SkipBlock())
4366 case llvm::BitstreamEntry::EndBlock:
4367 DoneWithExtensionBlock =
true;
4373 case llvm::BitstreamEntry::Record:
4379 unsigned RecCode = Stream.readRecord(Entry.ID, Record, &Blob);
4401 std::string ExistingModuleCachePath) {
4402 SimplePCHValidator validator(LangOpts, TargetOpts, PPOpts,
4403 ExistingModuleCachePath, FileMgr);
4404 return !readASTFileControlBlock(Filename, FileMgr, PCHContainerRdr,
4410 ASTReader::ReadSubmoduleBlock(ModuleFile &F,
unsigned ClientLoadCapabilities) {
4413 Error(
"malformed submodule block record in AST file");
4417 ModuleMap &ModMap = PP.getHeaderSearchInfo().getModuleMap();
4419 Module *CurrentModule =
nullptr;
4422 llvm::BitstreamEntry Entry = F.Stream.advanceSkippingSubblocks();
4424 switch (Entry.Kind) {
4425 case llvm::BitstreamEntry::SubBlock:
4427 Error(
"malformed block record in AST file");
4429 case llvm::BitstreamEntry::EndBlock:
4431 case llvm::BitstreamEntry::Record:
4439 auto Kind = F.Stream.readRecord(Entry.ID, Record, &Blob);
4442 Error(
"submodule metadata record should be at beginning of block");
4458 if (Record.size() < 8) {
4459 Error(
"malformed module definition");
4463 StringRef
Name = Blob;
4465 SubmoduleID GlobalID = getGlobalSubmoduleID(F, Record[Idx++]);
4466 SubmoduleID Parent = getGlobalSubmoduleID(F, Record[Idx++]);
4467 bool IsFramework = Record[Idx++];
4468 bool IsExplicit = Record[Idx++];
4469 bool IsSystem = Record[Idx++];
4470 bool IsExternC = Record[Idx++];
4471 bool InferSubmodules = Record[Idx++];
4472 bool InferExplicitSubmodules = Record[Idx++];
4473 bool InferExportWildcard = Record[Idx++];
4474 bool ConfigMacrosExhaustive = Record[Idx++];
4476 Module *ParentModule =
nullptr;
4478 ParentModule = getSubmodule(Parent);
4489 if (GlobalIndex >= SubmodulesLoaded.size() ||
4490 SubmodulesLoaded[GlobalIndex]) {
4491 Error(
"too many submodules");
4495 if (!ParentModule) {
4497 if (CurFile != F.File) {
4498 if (!Diags.isDiagnosticInFlight()) {
4499 Diag(diag::err_module_file_conflict)
4501 << CurFile->getName()
4502 << F.File->getName();
4519 if (DeserializationListener)
4520 DeserializationListener->ModuleRead(GlobalID, CurrentModule);
4522 SubmodulesLoaded[GlobalIndex] = CurrentModule;
4533 std::string Filename = Blob;
4534 ResolveImportedPath(F, Filename);
4535 if (
auto *Umbrella = PP.getFileManager().getFile(Filename)) {
4571 std::string Dirname = Blob;
4572 ResolveImportedPath(F, Dirname);
4573 if (
auto *Umbrella = PP.getFileManager().getDirectory(Dirname)) {
4577 if ((ClientLoadCapabilities & ARR_OutOfDate) == 0)
4578 Error(
"mismatched umbrella directories in submodule");
4586 F.BaseSubmoduleID = getTotalNumSubmodules();
4587 F.LocalNumSubmodules = Record[0];
4588 unsigned LocalBaseSubmoduleID = Record[1];
4589 if (F.LocalNumSubmodules > 0) {
4592 GlobalSubmoduleMap.insert(std::make_pair(getTotalNumSubmodules()+1,&F));
4596 F.SubmoduleRemap.insertOrReplace(
4597 std::make_pair(LocalBaseSubmoduleID,
4598 F.BaseSubmoduleID - LocalBaseSubmoduleID));
4600 SubmodulesLoaded.resize(SubmodulesLoaded.size() + F.LocalNumSubmodules);
4606 for (
unsigned Idx = 0; Idx != Record.size(); ++Idx) {
4607 UnresolvedModuleRef Unresolved;
4608 Unresolved.File = &F;
4609 Unresolved.Mod = CurrentModule;
4610 Unresolved.ID = Record[Idx];
4611 Unresolved.Kind = UnresolvedModuleRef::Import;
4612 Unresolved.IsWildcard =
false;
4613 UnresolvedModuleRefs.push_back(Unresolved);
4619 for (
unsigned Idx = 0; Idx + 1 < Record.size(); Idx += 2) {
4620 UnresolvedModuleRef Unresolved;
4621 Unresolved.File = &F;
4622 Unresolved.Mod = CurrentModule;
4623 Unresolved.ID = Record[Idx];
4624 Unresolved.Kind = UnresolvedModuleRef::Export;
4625 Unresolved.IsWildcard = Record[Idx + 1];
4626 UnresolvedModuleRefs.push_back(Unresolved);
4650 UnresolvedModuleRef Unresolved;
4651 Unresolved.File = &F;
4652 Unresolved.Mod = CurrentModule;
4653 Unresolved.ID = Record[0];
4654 Unresolved.Kind = UnresolvedModuleRef::Conflict;
4655 Unresolved.IsWildcard =
false;
4656 Unresolved.String = Blob;
4657 UnresolvedModuleRefs.push_back(Unresolved);
4671 bool ASTReader::ParseLanguageOptions(
const RecordData &Record,
4674 bool AllowCompatibleDifferences) {
4677 #define LANGOPT(Name, Bits, Default, Description) \
4678 LangOpts.Name = Record[Idx++];
4679 #define ENUM_LANGOPT(Name, Type, Bits, Default, Description) \
4680 LangOpts.set##Name(static_cast<LangOptions::Type>(Record[Idx++]));
4681 #include "clang/Basic/LangOptions.def"
4682 #define SANITIZER(NAME, ID) \
4683 LangOpts.Sanitize.set(SanitizerKind::ID, Record[Idx++]);
4684 #include "clang/Basic/Sanitizers.def"
4686 for (
unsigned N = Record[Idx++]; N; --N)
4690 VersionTuple runtimeVersion = ReadVersionTuple(Record, Idx);
4696 for (
unsigned N = Record[Idx++]; N; --N) {
4698 ReadString(Record, Idx));
4703 for (
unsigned N = Record[Idx++]; N; --N) {
4704 LangOpts.
OMPTargetTriples.push_back(llvm::Triple(ReadString(Record, Idx)));
4710 AllowCompatibleDifferences);
4713 bool ASTReader::ParseTargetOptions(
const RecordData &Record,
bool Complain,
4715 bool AllowCompatibleDifferences) {
4718 TargetOpts.
Triple = ReadString(Record, Idx);
4719 TargetOpts.
CPU = ReadString(Record, Idx);
4720 TargetOpts.
ABI = ReadString(Record, Idx);
4721 for (
unsigned N = Record[Idx++]; N; --N) {
4724 for (
unsigned N = Record[Idx++]; N; --N) {
4725 TargetOpts.
Features.push_back(ReadString(Record, Idx));
4729 AllowCompatibleDifferences);
4732 bool ASTReader::ParseDiagnosticOptions(
const RecordData &Record,
bool Complain,
4736 #define DIAGOPT(Name, Bits, Default) DiagOpts->Name = Record[Idx++];
4737 #define ENUM_DIAGOPT(Name, Type, Bits, Default) \
4738 DiagOpts->set##Name(static_cast<Type>(Record[Idx++]));
4739 #include "clang/Basic/DiagnosticOptions.def"
4741 for (
unsigned N = Record[Idx++]; N; --N)
4742 DiagOpts->Warnings.push_back(ReadString(Record, Idx));
4743 for (
unsigned N = Record[Idx++]; N; --N)
4744 DiagOpts->Remarks.push_back(ReadString(Record, Idx));
4749 bool ASTReader::ParseFileSystemOptions(
const RecordData &Record,
bool Complain,
4757 bool ASTReader::ParseHeaderSearchOptions(
const RecordData &Record,
4762 HSOpts.
Sysroot = ReadString(Record, Idx);
4765 for (
unsigned N = Record[Idx++]; N; --N) {
4766 std::string Path = ReadString(Record, Idx);
4769 bool IsFramework = Record[Idx++];
4770 bool IgnoreSysRoot = Record[Idx++];
4771 HSOpts.
UserEntries.emplace_back(std::move(Path), Group, IsFramework,
4776 for (
unsigned N = Record[Idx++]; N; --N) {
4777 std::string Prefix = ReadString(Record, Idx);
4778 bool IsSystemHeader = Record[Idx++];
4790 std::string SpecificModuleCachePath = ReadString(Record, Idx);
4796 bool ASTReader::ParsePreprocessorOptions(
const RecordData &Record,
4799 std::string &SuggestedPredefines) {
4804 for (
unsigned N = Record[Idx++]; N; --N) {
4805 std::string Macro = ReadString(Record, Idx);
4806 bool IsUndef = Record[Idx++];
4807 PPOpts.
Macros.push_back(std::make_pair(Macro, IsUndef));
4811 for (
unsigned N = Record[Idx++]; N; --N) {
4812 PPOpts.
Includes.push_back(ReadString(Record, Idx));
4816 for (
unsigned N = Record[Idx++]; N; --N) {
4826 SuggestedPredefines.clear();
4828 SuggestedPredefines);
4831 std::pair<ModuleFile *, unsigned>
4832 ASTReader::getModulePreprocessedEntity(
unsigned GlobalIndex) {
4834 I = GlobalPreprocessedEntityMap.find(GlobalIndex);
4835 assert(I != GlobalPreprocessedEntityMap.end() &&
4836 "Corrupted global preprocessed entity map");
4838 unsigned LocalIndex = GlobalIndex - M->BasePreprocessedEntityID;
4839 return std::make_pair(M, LocalIndex);
4842 llvm::iterator_range<PreprocessingRecord::iterator>
4843 ASTReader::getModulePreprocessedEntities(
ModuleFile &Mod)
const {
4852 llvm::iterator_range<ASTReader::ModuleDeclIterator>
4853 ASTReader::getModuleFileLevelDecls(
ModuleFile &Mod) {
4854 return llvm::make_range(
4856 ModuleDeclIterator(
this, &Mod,
4862 std::pair<ModuleFile *, unsigned> PPInfo = getModulePreprocessedEntity(Index);
4864 unsigned LocalIndex = PPInfo.second;
4867 if (!PP.getPreprocessingRecord()) {
4868 Error(
"no preprocessing record");
4875 llvm::BitstreamEntry Entry =
4877 if (Entry.Kind != llvm::BitstreamEntry::Record)
4882 ReadSourceLocation(M, PPOffs.
End));
4888 Entry.ID, Record, &Blob);
4891 bool isBuiltin = Record[0];
4895 Name = getLocalIdentifier(M, Record[1]);
4898 getGlobalPreprocessedEntityID(M, Record[1]);
4899 Def = cast<MacroDefinitionRecord>(
4900 PPRec.getLoadedPreprocessedEntity(GlobalID - 1));
4918 if (DeserializationListener)
4919 DeserializationListener->MacroDefinitionRead(PPID, MD);
4925 const char *FullFileNameStart = Blob.data() + Record[0];
4926 StringRef FullFileName(FullFileNameStart, Blob.size() - Record[0]);
4928 if (!FullFileName.empty())
4929 File = PP.getFileManager().getFile(FullFileName);
4936 StringRef(Blob.data(), Record[0]),
4937 Record[1], Record[3],
4944 llvm_unreachable(
"Invalid PreprocessorDetailRecordTypes");
4952 GlobalSLocOffsetMapType::const_iterator SLocMapI)
const {
4954 for (GlobalSLocOffsetMapType::const_iterator
4955 EndI = GlobalSLocOffsetMap.end(); SLocMapI != EndI; ++SLocMapI) {
4956 ModuleFile &M = *SLocMapI->second;
4957 if (M.NumPreprocessedEntities)
4961 return getTotalNumPreprocessedEntities();
4966 template <
unsigned PPEntityOffset::*PPLoc>
4967 struct PPEntityComp {
4976 return Reader.getSourceManager().isBeforeInTranslationUnit(LHS, RHS);
4981 return Reader.getSourceManager().isBeforeInTranslationUnit(LHS, RHS);
4986 return Reader.getSourceManager().isBeforeInTranslationUnit(LHS, RHS);
4990 return Reader.ReadSourceLocation(M, PPE.*PPLoc);
4997 bool EndsAfter)
const {
4999 return getTotalNumPreprocessedEntities();
5001 GlobalSLocOffsetMapType::const_iterator SLocMapI = GlobalSLocOffsetMap.find(
5002 SourceManager::MaxLoadedOffset - Loc.getOffset() - 1);
5003 assert(SLocMapI != GlobalSLocOffsetMap.end() &&
5004 "Corrupted global sloc offset map");
5006 if (SLocMapI->second->NumPreprocessedEntities == 0)
5007 return findNextPreprocessedEntity(SLocMapI);
5016 pp_iterator First = pp_begin;
5020 PPI = std::upper_bound(pp_begin, pp_end, Loc,
5021 PPEntityComp<&PPEntityOffset::Begin>(*
this, M));
5030 std::advance(PPI, Half);
5035 Count = Count - Half - 1;
5042 return findNextPreprocessedEntity(SLocMapI);
5049 std::pair<unsigned, unsigned>
5052 return std::make_pair(0,0);
5056 findPreprocessedEntity(Range.
getBegin(),
false);
5058 return std::make_pair(BeginID, EndID);
5068 std::pair<ModuleFile *, unsigned> PPInfo = getModulePreprocessedEntity(Index);
5070 unsigned LocalIndex = PPInfo.second;
5085 class HeaderFileInfoVisitor {
5091 explicit HeaderFileInfoVisitor(
const FileEntry *FE)
5102 if (Pos == Table->end())
5114 HeaderFileInfoVisitor Visitor(FE);
5115 ModuleMgr.visit(Visitor);
5125 for (
ModuleIterator I = ModuleMgr.begin(), E = ModuleMgr.end(); I !=
E; ++
I) {
5129 assert(!Diag.DiagStates.empty());
5130 DiagStates.push_back(&Diag.DiagStates.front());
5134 if (DiagStateID != 0) {
5135 Diag.DiagStatePoints.push_back(
5136 DiagnosticsEngine::DiagStatePoint(DiagStates[DiagStateID-1],
5141 assert(DiagStateID == 0);
5143 Diag.DiagStates.push_back(*Diag.GetCurDiagState());
5144 DiagnosticsEngine::DiagState *NewState = &Diag.DiagStates.back();
5145 DiagStates.push_back(NewState);
5146 Diag.DiagStatePoints.push_back(
5147 DiagnosticsEngine::DiagStatePoint(NewState,
5151 "Invalid data, didn't find '-1' marking end of diag/map pairs");
5157 if (DiagID == (
unsigned)-1) {
5162 Diag.GetCurDiagState()->setMapping(DiagID, Mapping);
5169 ASTReader::RecordLocation ASTReader::TypeCursorForIndex(
unsigned Index) {
5171 assert(I != GlobalTypeMap.end() &&
"Corrupted global type map");
5172 ModuleFile *M = I->second;
5173 return RecordLocation(M, M->TypeOffsets[Index - M->BaseTypeIndex]);
5182 QualType ASTReader::readTypeRecord(
unsigned Index) {
5183 RecordLocation Loc = TypeCursorForIndex(Index);
5184 BitstreamCursor &DeclsCursor = Loc.F->DeclsCursor;
5190 ReadingKindTracker ReadingKind(Read_Type, *
this);
5193 Deserializing AType(
this);
5196 DeclsCursor.JumpToBit(Loc.Offset);
5198 unsigned Code = DeclsCursor.ReadCode();
5199 switch ((
TypeCode)DeclsCursor.readRecord(Code, Record)) {
5201 if (Record.size() != 2) {
5202 Error(
"Incorrect encoding of extended qualifier type");
5211 if (Record.size() != 1) {
5212 Error(
"Incorrect encoding of complex type");
5215 QualType ElemType = readType(*Loc.F, Record, Idx);
5220 if (Record.size() != 1) {
5221 Error(
"Incorrect encoding of pointer type");
5224 QualType PointeeType = readType(*Loc.F, Record, Idx);
5229 if (Record.size() != 1) {
5230 Error(
"Incorrect encoding of decayed type");
5233 QualType OriginalType = readType(*Loc.F, Record, Idx);
5235 if (!isa<DecayedType>(DT))
5236 Error(
"Decayed type does not decay");
5241 if (Record.size() != 2) {
5242 Error(
"Incorrect encoding of adjusted type");
5245 QualType OriginalTy = readType(*Loc.F, Record, Idx);
5246 QualType AdjustedTy = readType(*Loc.F, Record, Idx);
5251 if (Record.size() != 1) {
5252 Error(
"Incorrect encoding of block pointer type");
5255 QualType PointeeType = readType(*Loc.F, Record, Idx);
5260 if (Record.size() != 2) {
5261 Error(
"Incorrect encoding of lvalue reference type");
5264 QualType PointeeType = readType(*Loc.F, Record, Idx);
5269 if (Record.size() != 1) {
5270 Error(
"Incorrect encoding of rvalue reference type");
5273 QualType PointeeType = readType(*Loc.F, Record, Idx);
5278 if (Record.size() != 2) {
5279 Error(
"Incorrect encoding of member pointer type");
5282 QualType PointeeType = readType(*Loc.F, Record, Idx);
5283 QualType ClassType = readType(*Loc.F, Record, Idx);
5291 QualType ElementType = readType(*Loc.F, Record, Idx);
5293 unsigned IndexTypeQuals = Record[2];
5295 llvm::APInt Size = ReadAPInt(Record, Idx);
5297 ASM, IndexTypeQuals);
5301 QualType ElementType = readType(*Loc.F, Record, Idx);
5303 unsigned IndexTypeQuals = Record[2];
5308 QualType ElementType = readType(*Loc.F, Record, Idx);
5310 unsigned IndexTypeQuals = Record[2];
5314 ASM, IndexTypeQuals,
5319 if (Record.size() != 3) {
5320 Error(
"incorrect encoding of vector type in AST file");
5324 QualType ElementType = readType(*Loc.F, Record, Idx);
5325 unsigned NumElements = Record[1];
5326 unsigned VecKind = Record[2];
5332 if (Record.size() != 3) {
5333 Error(
"incorrect encoding of extended vector type in AST file");
5337 QualType ElementType = readType(*Loc.F, Record, Idx);
5338 unsigned NumElements = Record[1];
5343 if (Record.size() != 6) {
5344 Error(
"incorrect encoding of no-proto function type");
5347 QualType ResultType = readType(*Loc.F, Record, Idx);
5354 QualType ResultType = readType(*Loc.F, Record, Idx);
5360 static_cast<CallingConv>(Record[4]),
5370 readExceptionSpec(*Loc.F, ExceptionStorage, EPI.
ExceptionSpec, Record, Idx);
5372 unsigned NumParams = Record[Idx++];
5374 for (
unsigned I = 0; I != NumParams; ++
I)
5375 ParamTypes.push_back(readType(*Loc.F, Record, Idx));
5383 ReadDeclAs<UnresolvedUsingTypenameDecl>(*Loc.F, Record, Idx));
5387 if (Record.size() != 2) {
5388 Error(
"incorrect encoding of typedef type");
5393 QualType Canonical = readType(*Loc.F, Record, Idx);
5394 if (!Canonical.isNull())
5403 if (Record.size() != 1) {
5404 Error(
"incorrect encoding of typeof(type) in AST file");
5407 QualType UnderlyingType = readType(*Loc.F, Record, Idx);
5412 QualType UnderlyingType = readType(*Loc.F, Record, Idx);
5417 QualType BaseType = readType(*Loc.F, Record, Idx);
5418 QualType UnderlyingType = readType(*Loc.F, Record, Idx);
5424 QualType Deduced = readType(*Loc.F, Record, Idx);
5426 bool IsDependent = Deduced.
isNull() ? Record[Idx++] :
false;
5431 if (Record.size() != 2) {
5432 Error(
"incorrect encoding of record type");
5436 bool IsDependent = Record[Idx++];
5437 RecordDecl *RD = ReadDeclAs<RecordDecl>(*Loc.F, Record, Idx);
5438 RD = cast_or_null<RecordDecl>(RD->getCanonicalDecl());
5440 const_cast<Type*
>(T.getTypePtr())->setDependent(IsDependent);
5445 if (Record.size() != 2) {
5446 Error(
"incorrect encoding of enum type");
5450 bool IsDependent = Record[Idx++];
5453 const_cast<Type*
>(T.
getTypePtr())->setDependent(IsDependent);
5458 if (Record.size() != 3) {
5459 Error(
"incorrect encoding of attributed type");
5462 QualType modifiedType = readType(*Loc.F, Record, Idx);
5463 QualType equivalentType = readType(*Loc.F, Record, Idx);
5469 if (Record.size() != 1) {
5470 Error(
"incorrect encoding of paren type");
5473 QualType InnerType = readType(*Loc.F, Record, Idx);
5478 if (Record.size() != 2) {
5479 Error(
"incorrect encoding of pack expansion type");
5482 QualType Pattern = readType(*Loc.F, Record, Idx);
5487 NumExpansions = Record[1] - 1;
5495 QualType NamedType = readType(*Loc.F, Record, Idx);
5502 = ReadDeclAs<ObjCInterfaceDecl>(*Loc.F, Record, Idx);
5508 QualType Base = readType(*Loc.F, Record, Idx);
5509 unsigned NumTypeArgs = Record[Idx++];
5511 for (
unsigned I = 0; I != NumTypeArgs; ++
I)
5512 TypeArgs.push_back(readType(*Loc.F, Record, Idx));
5513 unsigned NumProtos = Record[Idx++];
5515 for (
unsigned I = 0; I != NumProtos; ++
I)
5516 Protos.push_back(ReadDeclAs<ObjCProtocolDecl>(*Loc.F, Record, Idx));
5517 bool IsKindOf = Record[Idx++];
5523 QualType Pointee = readType(*Loc.F, Record, Idx);
5529 QualType Parm = readType(*Loc.F, Record, Idx);
5530 QualType Replacement = readType(*Loc.F, Record, Idx);
5532 cast<TemplateTypeParmType>(Parm),
5538 QualType Parm = readType(*Loc.F, Record, Idx);
5541 cast<TemplateTypeParmType>(Parm),
5546 CXXRecordDecl *D = ReadDeclAs<CXXRecordDecl>(*Loc.F, Record, Idx);
5547 QualType TST = readType(*Loc.F, Record, Idx);
5550 const Type *T =
nullptr;
5552 if (
const Type *Existing = DI->getTypeForDecl()) {
5560 DI->setTypeForDecl(T);
5567 unsigned Depth = Record[Idx++];
5568 unsigned Index = Record[Idx++];
5569 bool Pack = Record[Idx++];
5571 = ReadDeclAs<TemplateTypeParmDecl>(*Loc.F, Record, Idx);
5579 const IdentifierInfo *Name = GetIdentifierInfo(*Loc.F, Record, Idx);
5580 QualType Canon = readType(*Loc.F, Record, Idx);
5590 const IdentifierInfo *Name = GetIdentifierInfo(*Loc.F, Record, Idx);
5591 unsigned NumArgs = Record[Idx++];
5593 Args.reserve(NumArgs);
5595 Args.push_back(ReadTemplateArgument(*Loc.F, Record, Idx));
5597 Args.size(), Args.data());
5604 QualType ElementType = readType(*Loc.F, Record, Idx);
5607 unsigned IndexTypeQuals = Record[Idx++];
5610 Expr *NumElts = ReadExpr(*Loc.F);
5611 SourceRange Brackets = ReadSourceRange(*Loc.F, Record, Idx);
5614 IndexTypeQuals, Brackets);
5619 bool IsDependent = Record[Idx++];
5620 TemplateName Name = ReadTemplateName(*Loc.F, Record, Idx);
5622 ReadTemplateArgumentList(Args, *Loc.F, Record, Idx);
5623 QualType Underlying = readType(*Loc.F, Record, Idx);
5630 Args.size(), Underlying);
5631 const_cast<Type*
>(T.
getTypePtr())->setDependent(IsDependent);
5636 if (Record.size() != 1) {
5637 Error(
"Incorrect encoding of atomic type");
5640 QualType ValueType = readType(*Loc.F, Record, Idx);
5645 if (Record.size() != 1) {
5646 Error(
"Incorrect encoding of pipe type");
5651 QualType ElementType = readType(*Loc.F, Record, Idx);
5655 llvm_unreachable(
"Invalid TypeCode!");
5661 const RecordData &Record,
unsigned &Idx) {
5666 for (
unsigned I = 0, N = Record[Idx++]; I != N; ++
I)
5667 Exceptions.push_back(readType(ModuleFile, Record, Idx));
5672 ESI.
SourceDecl = ReadDeclAs<FunctionDecl>(ModuleFile, Record, Idx);
5673 ESI.
SourceTemplate = ReadDeclAs<FunctionDecl>(ModuleFile, Record, Idx);
5675 ESI.
SourceDecl = ReadDeclAs<FunctionDecl>(ModuleFile, Record, Idx);
5687 return Reader.ReadSourceLocation(F, R, I);
5690 template<
typename T>
5692 return Reader.ReadDeclAs<T>(F, Record, Idx);
5698 : Reader(Reader), F(F), Record(Record), Idx(Idx)
5704 #define ABSTRACT_TYPELOC(CLASS, PARENT)
5705 #define TYPELOC(CLASS, PARENT) \
5706 void Visit##CLASS##TypeLoc(CLASS##TypeLoc TyLoc);
5707 #include "clang/AST/TypeLocNodes.def"
5726 TL.
setNameLoc(ReadSourceLocation(Record, Idx));
5729 TL.
setStarLoc(ReadSourceLocation(Record, Idx));
5741 TL.
setAmpLoc(ReadSourceLocation(Record, Idx));
5747 TL.
setStarLoc(ReadSourceLocation(Record, Idx));
5759 VisitArrayTypeLoc(TL);
5762 VisitArrayTypeLoc(TL);
5765 VisitArrayTypeLoc(TL);
5767 void TypeLocReader::VisitDependentSizedArrayTypeLoc(
5769 VisitArrayTypeLoc(TL);
5771 void TypeLocReader::VisitDependentSizedExtVectorTypeLoc(
5773 TL.
setNameLoc(ReadSourceLocation(Record, Idx));
5776 TL.
setNameLoc(ReadSourceLocation(Record, Idx));
5779 TL.
setNameLoc(ReadSourceLocation(Record, Idx));
5786 for (
unsigned i = 0, e = TL.
getNumParams(); i != e; ++i) {
5787 TL.
setParam(i, ReadDeclAs<ParmVarDecl>(Record, Idx));
5791 VisitFunctionTypeLoc(TL);
5794 VisitFunctionTypeLoc(TL);
5797 TL.
setNameLoc(ReadSourceLocation(Record, Idx));
5800 TL.
setNameLoc(ReadSourceLocation(Record, Idx));
5814 TL.
setNameLoc(ReadSourceLocation(Record, Idx));
5817 TL.
setKWLoc(ReadSourceLocation(Record, Idx));
5822 void TypeLocReader::VisitAutoTypeLoc(
AutoTypeLoc TL) {
5823 TL.
setNameLoc(ReadSourceLocation(Record, Idx));
5826 TL.
setNameLoc(ReadSourceLocation(Record, Idx));
5828 void TypeLocReader::VisitEnumTypeLoc(
EnumTypeLoc TL) {
5829 TL.
setNameLoc(ReadSourceLocation(Record, Idx));
5832 TL.setAttrNameLoc(ReadSourceLocation(Record, Idx));
5835 range.
setBegin(ReadSourceLocation(Record, Idx));
5836 range.
setEnd(ReadSourceLocation(Record, Idx));
5841 TL.setAttrExprOperand(Reader.ReadExpr(F));
5843 TL.setAttrExprOperand(
nullptr);
5848 TL.
setNameLoc(ReadSourceLocation(Record, Idx));
5850 void TypeLocReader::VisitSubstTemplateTypeParmTypeLoc(
5852 TL.
setNameLoc(ReadSourceLocation(Record, Idx));
5854 void TypeLocReader::VisitSubstTemplateTypeParmPackTypeLoc(
5856 TL.
setNameLoc(ReadSourceLocation(Record, Idx));
5858 void TypeLocReader::VisitTemplateSpecializationTypeLoc(
5864 for (
unsigned i = 0, e = TL.
getNumArgs(); i != e; ++i)
5866 Reader.GetTemplateArgumentLocInfo(F,
5870 void TypeLocReader::VisitParenTypeLoc(
ParenTypeLoc TL) {
5876 TL.
setQualifierLoc(Reader.ReadNestedNameSpecifierLoc(F, Record, Idx));
5879 TL.
setNameLoc(ReadSourceLocation(Record, Idx));
5883 TL.
setQualifierLoc(Reader.ReadNestedNameSpecifierLoc(F, Record, Idx));
5884 TL.
setNameLoc(ReadSourceLocation(Record, Idx));
5886 void TypeLocReader::VisitDependentTemplateSpecializationTypeLoc(
5889 TL.
setQualifierLoc(Reader.ReadNestedNameSpecifierLoc(F, Record, Idx));
5896 Reader.GetTemplateArgumentLocInfo(F,
5904 TL.
setNameLoc(ReadSourceLocation(Record, Idx));
5918 TL.
setStarLoc(ReadSourceLocation(Record, Idx));
5921 TL.
setKWLoc(ReadSourceLocation(Record, Idx));
5925 void TypeLocReader::VisitPipeTypeLoc(
PipeTypeLoc TL) {
5926 TL.
setKWLoc(ReadSourceLocation(Record, Idx));
5932 QualType InfoTy = readType(F, Record, Idx);
5936 TypeSourceInfo *TInfo = getContext().CreateTypeSourceInfo(InfoTy);
6124 assert(!T.
isNull() &&
"Unknown predefined type");
6129 assert(Index < TypesLoaded.size() &&
"Type index out-of-range");
6130 if (TypesLoaded[Index].isNull()) {
6131 TypesLoaded[Index] = readTypeRecord(Index);
6132 if (TypesLoaded[Index].isNull())
6135 TypesLoaded[Index]->setFromAST();
6136 if (DeserializationListener)
6138 TypesLoaded[Index]);
6141 return TypesLoaded[Index].withFastQualifiers(FastQuals);
6145 return GetType(getGlobalTypeID(F, LocalID));
6158 assert(I != F.
TypeRemap.
end() &&
"Invalid index into type index remap");
6160 unsigned GlobalIndex = LocalIndex + I->second;
6161 return (GlobalIndex << Qualifiers::FastWidth) | FastQuals;
6173 return GetTypeSourceInfo(F, Record, Index);
6177 SourceLocation TemplateNameLoc = ReadSourceLocation(F, Record, Index);
6184 SourceLocation TemplateNameLoc = ReadSourceLocation(F, Record, Index);
6185 SourceLocation EllipsisLoc = ReadSourceLocation(F, Record, Index);
6197 llvm_unreachable(
"unexpected template argument loc");
6206 if (Record[Index++])
6219 unsigned NumArgsAsWritten = Record[Index++];
6221 for (
unsigned i = 0; i != NumArgsAsWritten; ++i)
6222 TemplArgsInfo.
addArgument(ReadTemplateArgumentLoc(F, Record, Index));
6230 template<
typename TemplateSpecializationDecl>
6232 if (
auto *TSD = dyn_cast<TemplateSpecializationDecl>(D))
6233 TSD->getSpecializedTemplate()->LoadLazySpecializations();
6237 if (NumCurrentElementsDeserializing) {
6242 PendingIncompleteDeclChains.push_back(const_cast<Decl*>(D));
6253 if (isa<TranslationUnitDecl>(DC) || isa<NamespaceDecl>(DC) ||
6254 isa<CXXRecordDecl>(DC) || isa<EnumDecl>(DC)) {
6256 if (!getContext().getLangOpts().
CPlusPlus &&
6257 isa<TranslationUnitDecl>(DC)) {
6261 auto *II = Name.getAsIdentifierInfo();
6262 assert(II &&
"non-identifier name in C?");
6263 if (II->isOutOfDate())
6264 updateOutOfDateIdentifier(*II);
6270 auto *DC = cast<DeclContext>(DCDecl);
6272 FindExternalLexicalDecls(
6278 if (
auto *CTSD = dyn_cast<ClassTemplateSpecializationDecl>(D))
6279 CTSD->getSpecializedTemplate()->LoadLazySpecializations();
6280 if (
auto *VTSD = dyn_cast<VarTemplateSpecializationDecl>(D))
6281 VTSD->getSpecializedTemplate()->LoadLazySpecializations();
6282 if (
auto *FD = dyn_cast<FunctionDecl>(D)) {
6283 if (
auto *Template = FD->getPrimaryTemplate())
6284 Template->LoadLazySpecializations();
6292 Error(
"malformed AST file: missing C++ ctor initializers");
6296 unsigned LocalID = Record[Idx++];
6302 RecordLocation Loc = getLocalBitOffset(Offset);
6303 BitstreamCursor &Cursor = Loc.F->DeclsCursor;
6305 Cursor.JumpToBit(Loc.Offset);
6306 ReadingKindTracker ReadingKind(Read_Decl, *
this);
6309 unsigned Code = Cursor.ReadCode();
6310 unsigned RecCode = Cursor.readRecord(Code, Record);
6312 Error(
"malformed AST file: missing C++ ctor initializers");
6317 return ReadCXXCtorInitializers(*Loc.F, Record, Idx);
6324 Error(
"malformed AST file: missing C++ base specifier");
6328 unsigned LocalID = Record[Idx++];
6333 RecordLocation Loc = getLocalBitOffset(Offset);
6334 BitstreamCursor &Cursor = Loc.F->DeclsCursor;
6336 Cursor.JumpToBit(Loc.Offset);
6337 ReadingKindTracker ReadingKind(Read_Decl, *
this);
6339 unsigned Code = Cursor.ReadCode();
6340 unsigned RecCode = Cursor.readRecord(Code, Record);
6342 Error(
"malformed AST file: missing C++ base specifiers");
6347 unsigned NumBases = Record[Idx++];
6350 for (
unsigned I = 0; I != NumBases; ++
I)
6351 Bases[I] = ReadCXXBaseSpecifier(*Loc.F, Record, Idx);
6362 assert(I != F.
DeclRemap.
end() &&
"Invalid index into decl index remap");
6364 return LocalID + I->second;
6368 ModuleFile &M)
const {
6381 assert(I != GlobalDeclMap.end() &&
"Corrupted global declaration map");
6391 if (Index > DeclsLoaded.size()) {
6392 Error(
"declaration ID out-of-range for AST file");
6396 if (Decl *D = DeclsLoaded[Index])
6399 unsigned RawLocation = 0;
6400 RecordLocation Rec = DeclCursorForID(ID, RawLocation);
6401 return ReadSourceLocation(*Rec.F, RawLocation);
6448 llvm_unreachable(
"PredefinedDeclIDs unknown enum value");
6459 Merged.push_back(ID);
6466 if (Index >= DeclsLoaded.size()) {
6467 assert(0 &&
"declaration ID out-of-range for AST file");
6468 Error(
"declaration ID out-of-range for AST file");
6472 return DeclsLoaded[Index];
6477 return GetExistingDecl(ID);
6481 if (Index >= DeclsLoaded.size()) {
6482 assert(0 &&
"declaration ID out-of-range for AST file");
6483 Error(
"declaration ID out-of-range for AST file");
6487 if (!DeclsLoaded[Index]) {
6489 if (DeserializationListener)
6490 DeserializationListener->DeclRead(ID, DeclsLoaded[Index]);
6493 return DeclsLoaded[Index];
6502 assert(I != GlobalDeclMap.end() &&
"Corrupted global declaration map");
6503 ModuleFile *Owner = I->second;
6510 return GlobalID - Owner->BaseDeclID + Pos->second;
6516 if (Idx >= Record.size()) {
6517 Error(
"Corrupted AST file");
6521 return getGlobalDeclID(F, Record[Idx++]);
6531 ClearSwitchCaseIDs();
6534 RecordLocation Loc = getLocalBitOffset(Offset);
6535 Loc.F->DeclsCursor.JumpToBit(Loc.Offset);
6536 return ReadStmtFromStream(*Loc.F);
6545 assert(LexicalDecls.size() % 2 == 0 &&
"expected an even number of entries");
6546 for (
int I = 0, N = LexicalDecls.size(); I != N; I += 2) {
6548 if (!IsKindWeWant(K))
6556 if (PredefsVisited[ID])
6559 PredefsVisited[
ID] =
true;
6562 if (Decl *D = GetLocalDecl(*M, ID)) {
6563 assert(D->
getKind() == K &&
"wrong kind for lexical decl");
6570 if (isa<TranslationUnitDecl>(DC)) {
6571 for (
auto Lexical : TULexicalDecls)
6572 Visit(Lexical.first, Lexical.second);
6574 auto I = LexicalDecls.find(DC);
6575 if (I != LexicalDecls.end())
6576 Visit(I->second.first, I->second.second);
6579 ++NumLexicalDeclContextsRead;
6589 DeclIDComp(
ASTReader &Reader, ModuleFile &M) : Reader(Reader), Mod(M) {}
6594 return Reader.getSourceManager().isBeforeInTranslationUnit(LHS, RHS);
6599 return Reader.getSourceManager().isBeforeInTranslationUnit(LHS, RHS);
6604 return Reader.getSourceManager().isBeforeInTranslationUnit(LHS, RHS);
6608 return Reader.getSourceManager().getFileLoc(
6609 Reader.getSourceLocationForDeclID(Reader.getGlobalDeclID(Mod, ID)));
6616 unsigned Offset,
unsigned Length,
6621 if (I == FileDeclIDs.end())
6624 FileDeclsInfo &DInfo = I->second;
6625 if (DInfo.Decls.empty())
6632 DeclIDComp DIDComp(*
this, *DInfo.Mod);
6634 BeginIt = std::lower_bound(DInfo.Decls.begin(), DInfo.Decls.end(),
6636 if (BeginIt != DInfo.Decls.begin())
6642 while (BeginIt != DInfo.Decls.begin() &&
6643 GetDecl(getGlobalDeclID(*DInfo.Mod, *BeginIt))
6644 ->isTopLevelDeclInObjCContainer())
6648 EndIt = std::upper_bound(DInfo.Decls.begin(), DInfo.Decls.end(),
6650 if (EndIt != DInfo.Decls.end())
6654 DIt = BeginIt; DIt != EndIt; ++DIt)
6655 Decls.push_back(GetDecl(getGlobalDeclID(*DInfo.Mod, *DIt)));
6662 "DeclContext has no visible decls in storage");
6666 auto It = Lookups.find(DC);
6667 if (It == Lookups.end())
6674 for (
DeclID ID : It->second.Table.find(Name)) {
6675 NamedDecl *ND = cast<NamedDecl>(GetDecl(ID));
6677 Decls.push_back(ND);
6680 ++NumVisibleDeclContextsRead;
6681 SetExternalVisibleDeclsForName(DC, Name, Decls);
6682 return !Decls.empty();
6689 auto It = Lookups.find(DC);
6690 assert(It != Lookups.end() &&
6691 "have external visible storage but no lookup tables");
6695 for (
DeclID ID : It->second.Table.findAll()) {
6696 NamedDecl *ND = cast<NamedDecl>(GetDecl(ID));
6700 ++NumVisibleDeclContextsRead;
6703 SetExternalVisibleDeclsForName(DC, I->first, I->second);
6705 const_cast<DeclContext *
>(DC)->setHasExternalVisibleStorage(
false);
6710 auto I = Lookups.find(Primary);
6711 return I == Lookups.end() ?
nullptr : &I->second;
6720 assert(ImplD && Consumer);
6722 for (
auto *I : ImplD->
methods())
6728 void ASTReader::PassInterestingDeclsToConsumer() {
6731 if (PassingDeclsToConsumer)
6741 for (
auto ID : EagerlyDeserializedDecls)
6743 EagerlyDeserializedDecls.clear();
6745 while (!InterestingDecls.empty()) {
6746 Decl *D = InterestingDecls.front();
6747 InterestingDecls.pop_front();
6749 PassInterestingDeclToConsumer(D);
6753 void ASTReader::PassInterestingDeclToConsumer(Decl *D) {
6761 this->Consumer = Consumer;
6764 PassInterestingDeclsToConsumer();
6766 if (DeserializationListener)
6767 DeserializationListener->ReaderInitialized(
this);
6771 std::fprintf(stderr,
"*** AST File Statistics:\n");
6773 unsigned NumTypesLoaded
6774 = TypesLoaded.size() - std::count(TypesLoaded.begin(), TypesLoaded.end(),
6776 unsigned NumDeclsLoaded
6777 = DeclsLoaded.size() - std::count(DeclsLoaded.begin(), DeclsLoaded.end(),
6779 unsigned NumIdentifiersLoaded
6780 = IdentifiersLoaded.size() - std::count(IdentifiersLoaded.begin(),
6781 IdentifiersLoaded.end(),
6783 unsigned NumMacrosLoaded
6784 = MacrosLoaded.size() - std::count(MacrosLoaded.begin(),
6787 unsigned NumSelectorsLoaded
6788 = SelectorsLoaded.size() - std::count(SelectorsLoaded.begin(),
6789 SelectorsLoaded.end(),
6792 if (
unsigned TotalNumSLocEntries = getTotalNumSLocs())
6793 std::fprintf(stderr,
" %u/%u source location entries read (%f%%)\n",
6794 NumSLocEntriesRead, TotalNumSLocEntries,
6795 ((
float)NumSLocEntriesRead/TotalNumSLocEntries * 100));
6796 if (!TypesLoaded.empty())
6797 std::fprintf(stderr,
" %u/%u types read (%f%%)\n",
6798 NumTypesLoaded, (
unsigned)TypesLoaded.size(),
6799 ((float)NumTypesLoaded/TypesLoaded.size() * 100));
6800 if (!DeclsLoaded.empty())
6801 std::fprintf(stderr,
" %u/%u declarations read (%f%%)\n",
6802 NumDeclsLoaded, (
unsigned)DeclsLoaded.size(),
6803 ((float)NumDeclsLoaded/DeclsLoaded.size() * 100));
6804 if (!IdentifiersLoaded.empty())
6805 std::fprintf(stderr,
" %u/%u identifiers read (%f%%)\n",
6806 NumIdentifiersLoaded, (
unsigned)IdentifiersLoaded.size(),
6807 ((float)NumIdentifiersLoaded/IdentifiersLoaded.size() * 100));
6808 if (!MacrosLoaded.empty())
6809 std::fprintf(stderr,
" %u/%u macros read (%f%%)\n",
6810 NumMacrosLoaded, (
unsigned)MacrosLoaded.size(),
6811 ((float)NumMacrosLoaded/MacrosLoaded.size() * 100));
6812 if (!SelectorsLoaded.empty())
6813 std::fprintf(stderr,
" %u/%u selectors read (%f%%)\n",
6814 NumSelectorsLoaded, (
unsigned)SelectorsLoaded.size(),
6815 ((float)NumSelectorsLoaded/SelectorsLoaded.size() * 100));
6816 if (TotalNumStatements)
6817 std::fprintf(stderr,
" %u/%u statements read (%f%%)\n",
6818 NumStatementsRead, TotalNumStatements,
6819 ((
float)NumStatementsRead/TotalNumStatements * 100));
6821 std::fprintf(stderr,
" %u/%u macros read (%f%%)\n",
6822 NumMacrosRead, TotalNumMacros,
6823 ((
float)NumMacrosRead/TotalNumMacros * 100));
6824 if (TotalLexicalDeclContexts)
6825 std::fprintf(stderr,
" %u/%u lexical declcontexts read (%f%%)\n",
6826 NumLexicalDeclContextsRead, TotalLexicalDeclContexts,
6827 ((
float)NumLexicalDeclContextsRead/TotalLexicalDeclContexts
6829 if (TotalVisibleDeclContexts)
6830 std::fprintf(stderr,
" %u/%u visible declcontexts read (%f%%)\n",
6831 NumVisibleDeclContextsRead, TotalVisibleDeclContexts,
6832 ((
float)NumVisibleDeclContextsRead/TotalVisibleDeclContexts
6834 if (TotalNumMethodPoolEntries) {
6835 std::fprintf(stderr,
" %u/%u method pool entries read (%f%%)\n",
6836 NumMethodPoolEntriesRead, TotalNumMethodPoolEntries,
6837 ((
float)NumMethodPoolEntriesRead/TotalNumMethodPoolEntries
6840 if (NumMethodPoolLookups) {
6841 std::fprintf(stderr,
" %u/%u method pool lookups succeeded (%f%%)\n",
6842 NumMethodPoolHits, NumMethodPoolLookups,
6843 ((
float)NumMethodPoolHits/NumMethodPoolLookups * 100.0));
6845 if (NumMethodPoolTableLookups) {
6846 std::fprintf(stderr,
" %u/%u method pool table lookups succeeded (%f%%)\n",
6847 NumMethodPoolTableHits, NumMethodPoolTableLookups,
6848 ((
float)NumMethodPoolTableHits/NumMethodPoolTableLookups
6852 if (NumIdentifierLookupHits) {
6853 std::fprintf(stderr,
6854 " %u / %u identifier table lookups succeeded (%f%%)\n",
6855 NumIdentifierLookupHits, NumIdentifierLookups,
6856 (
double)NumIdentifierLookupHits*100.0/NumIdentifierLookups);
6860 std::fprintf(stderr,
"\n");
6861 GlobalIndex->printStats();
6864 std::fprintf(stderr,
"\n");
6866 std::fprintf(stderr,
"\n");
6869 template<
typename Key,
typename ModuleFile,
unsigned InitialCapacity>
6873 InitialCapacity> &
Map) {
6874 if (
Map.begin() ==
Map.end())
6878 llvm::errs() << Name <<
":\n";
6879 for (
typename MapType::const_iterator I =
Map.begin(), IEnd =
Map.end();
6881 llvm::errs() <<
" " << I->first <<
" -> " << I->second->FileName
6887 llvm::errs() <<
"*** PCH/ModuleFile Remappings:\n";
6889 dumpModuleIDMap(
"Global source location entry map", GlobalSLocEntryMap);
6897 GlobalPreprocessedEntityMap);
6899 llvm::errs() <<
"\n*** PCH/Modules Loaded:";
6901 MEnd = ModuleMgr.end();
6910 E = ModuleMgr.end(); I !=
E; ++
I) {
6911 if (llvm::MemoryBuffer *buf = (*I)->Buffer.get()) {
6912 size_t bytes = buf->getBufferSize();
6913 switch (buf->getBufferKind()) {
6914 case llvm::MemoryBuffer::MemoryBuffer_Malloc:
6917 case llvm::MemoryBuffer::MemoryBuffer_MMap:
6931 for (uint64_t ID : PreloadedDeclIDs) {
6932 NamedDecl *D = cast<NamedDecl>(GetDecl(ID));
6935 PreloadedDeclIDs.clear();
6938 if (!FPPragmaOptions.empty()) {
6939 assert(FPPragmaOptions.size() == 1 &&
"Wrong number of FP_PRAGMA_OPTIONS");
6940 SemaObj->FPFeatures.fp_contract = FPPragmaOptions[0];
6944 if (!OpenCLExtensions.empty()) {
6946 #define OPENCLEXT(nm) SemaObj->OpenCLFeatures.nm = OpenCLExtensions[I++];
6947 #include "clang/Basic/OpenCLExtensions.def"
6949 assert(OpenCLExtensions.size() == I &&
"Wrong number of OPENCL_EXTENSIONS");
6956 assert(SemaObj &&
"no Sema to update");
6960 if (!SemaDeclRefs.empty()) {
6961 assert(SemaDeclRefs.size() % 2 == 0);
6962 for (
unsigned I = 0; I != SemaDeclRefs.size(); I += 2) {
6963 if (!SemaObj->StdNamespace)
6964 SemaObj->StdNamespace = SemaDeclRefs[
I];
6965 if (!SemaObj->StdBadAlloc)
6966 SemaObj->StdBadAlloc = SemaDeclRefs[I+1];
6968 SemaDeclRefs.clear();
6973 if(OptimizeOffPragmaLocation.isValid())
6974 SemaObj->ActOnPragmaOptimize(
false, OptimizeOffPragmaLocation);
6981 IdentifierLookupVisitor Visitor(Name, 0,
6982 NumIdentifierLookups,
6983 NumIdentifierLookupHits);
6990 for (
auto F : ModuleMgr.pch_modules())
6998 if (!loadGlobalIndex()) {
6999 if (GlobalIndex->lookupIdentifier(Name, Hits)) {
7004 ModuleMgr.visit(Visitor, HitsPtr);
7008 markIdentifierUpToDate(II);
7025 ASTIdentifierLookupTable::key_iterator
Current;
7029 ASTIdentifierLookupTable::key_iterator
End;
7034 StringRef
Next()
override;
7039 : Reader(Reader), Index(Reader.ModuleMgr.size() - 1) {
7042 Current = IdTable->key_begin();
7043 End = IdTable->key_end();
7047 while (Current == End) {
7055 IdentifierLookupTable;
7056 Current = IdTable->key_begin();
7057 End = IdTable->key_end();
7062 StringRef Result = *Current;
7069 return GlobalIndex->createIdentifierIterator();
7074 namespace clang {
namespace serialization {
7078 unsigned PriorGeneration;
7079 unsigned InstanceBits;
7080 unsigned FactoryBits;
7081 bool InstanceHasMoreThanOneDecl;
7082 bool FactoryHasMoreThanOneDecl;
7088 unsigned PriorGeneration)
7089 : Reader(Reader), Sel(Sel), PriorGeneration(PriorGeneration),
7090 InstanceBits(0), FactoryBits(0), InstanceHasMoreThanOneDecl(
false),
7091 FactoryHasMoreThanOneDecl(
false) {}
7101 ++Reader.NumMethodPoolTableLookups;
7105 if (Pos == PoolTable->end())
7108 ++Reader.NumMethodPoolTableHits;
7109 ++Reader.NumSelectorsRead;
7113 ++Reader.NumMethodPoolEntriesRead;
7115 if (Reader.DeserializationListener)
7129 return InstanceMethods;
7134 return FactoryMethods;
7140 return InstanceHasMoreThanOneDecl;
7149 for (
unsigned I = 0, N = Methods.size(); I != N; ++
I) {
7156 unsigned &Generation = SelectorGeneration[Sel];
7157 unsigned PriorGeneration = Generation;
7161 ++NumMethodPoolLookups;
7163 ModuleMgr.
visit(Visitor);
7169 ++NumMethodPoolHits;
7194 for (
unsigned I = 0, N = KnownNamespaces.size(); I != N; ++
I) {
7196 = dyn_cast_or_null<NamespaceDecl>(
GetDecl(KnownNamespaces[I])))
7197 Namespaces.push_back(Namespace);
7202 llvm::DenseMap<NamedDecl*, SourceLocation> &Undefined) {
7203 for (
unsigned Idx = 0, N = UndefinedButUsed.size(); Idx != N;) {
7207 Undefined.insert(std::make_pair(D, Loc));
7214 for (
unsigned Idx = 0, N = DelayedDeleteExprs.size(); Idx != N;) {
7216 uint64_t Count = DelayedDeleteExprs[Idx++];
7217 for (uint64_t C = 0; C <
Count; ++
C) {
7220 const bool IsArrayForm = DelayedDeleteExprs[Idx++];
7221 Exprs[FD].push_back(std::make_pair(DeleteLoc, IsArrayForm));
7228 for (
unsigned I = 0, N = TentativeDefinitions.size(); I != N; ++
I) {
7229 VarDecl *Var = dyn_cast_or_null<VarDecl>(
GetDecl(TentativeDefinitions[I]));
7231 TentativeDefs.push_back(Var);
7233 TentativeDefinitions.clear();
7238 for (
unsigned I = 0, N = UnusedFileScopedDecls.size(); I != N; ++
I) {
7240 = dyn_cast_or_null<DeclaratorDecl>(
GetDecl(UnusedFileScopedDecls[I]));
7244 UnusedFileScopedDecls.clear();
7249 for (
unsigned I = 0, N = DelegatingCtorDecls.size(); I != N; ++
I) {
7251 = dyn_cast_or_null<CXXConstructorDecl>(
GetDecl(DelegatingCtorDecls[I]));
7255 DelegatingCtorDecls.clear();
7259 for (
unsigned I = 0, N = ExtVectorDecls.size(); I != N; ++
I) {
7261 = dyn_cast_or_null<TypedefNameDecl>(
GetDecl(ExtVectorDecls[I]));
7265 ExtVectorDecls.clear();
7270 for (
unsigned I = 0, N = UnusedLocalTypedefNameCandidates.size(); I != N;
7273 GetDecl(UnusedLocalTypedefNameCandidates[I]));
7277 UnusedLocalTypedefNameCandidates.clear();
7282 if (ReferencedSelectorsData.empty())
7287 unsigned int DataSize = ReferencedSelectorsData.size()-1;
7289 while (I < DataSize) {
7293 Sels.push_back(std::make_pair(Sel, SelLoc));
7295 ReferencedSelectorsData.clear();
7300 if (WeakUndeclaredIdentifiers.empty())
7303 for (
unsigned I = 0, N = WeakUndeclaredIdentifiers.size(); I < N; ) {
7310 bool Used = WeakUndeclaredIdentifiers[I++];
7313 WeakIDs.push_back(std::make_pair(WeakId, WI));
7315 WeakUndeclaredIdentifiers.clear();
7319 for (
unsigned Idx = 0, N = VTableUses.size(); Idx < N; ) {
7321 VT.
Record = dyn_cast_or_null<CXXRecordDecl>(
GetDecl(VTableUses[Idx++]));
7324 VTables.push_back(VT);
7332 for (
unsigned Idx = 0, N = PendingInstantiations.size(); Idx < N;) {
7337 Pending.push_back(std::make_pair(D, Loc));
7339 PendingInstantiations.clear();
7343 llvm::MapVector<const FunctionDecl *, LateParsedTemplate *> &LPTMap) {
7344 for (
unsigned Idx = 0, N = LateParsedTemplates.size(); Idx < N;
7349 LT->
D =
GetDecl(LateParsedTemplates[Idx++]);
7352 assert(F &&
"No module");
7354 unsigned TokN = LateParsedTemplates[Idx++];
7355 LT->Toks.reserve(TokN);
7356 for (
unsigned T = 0; T < TokN; ++T)
7357 LT->Toks.push_back(
ReadToken(*F, LateParsedTemplates, Idx));
7359 LPTMap.insert(std::make_pair(FD, LT));
7362 LateParsedTemplates.clear();
7371 assert(ID &&
"Non-zero identifier ID required");
7372 assert(ID <= IdentifiersLoaded.size() &&
"identifier ID out of range");
7373 IdentifiersLoaded[ID - 1] = II;
7374 if (DeserializationListener)
7398 if (NumCurrentElementsDeserializing && !Decls) {
7399 PendingIdentifierInfos[II].append(DeclIDs.begin(), DeclIDs.end());
7403 for (
unsigned I = 0, N = DeclIDs.size(); I != N; ++
I) {
7416 Decls->push_back(D);
7423 pushExternalDeclIntoScope(D, II);
7431 if (IdentifiersLoaded.empty()) {
7432 Error(
"no identifier table in AST file");
7437 if (!IdentifiersLoaded[ID]) {
7439 assert(I != GlobalIdentifierMap.
end() &&
"Corrupted global identifier map");
7440 ModuleFile *M = I->second;
7441 unsigned Index = ID - M->BaseIdentifierID;
7442 const char *Str = M->IdentifierTableData + M->IdentifierOffsets[Index];
7449 const unsigned char *StrLenPtr = (
const unsigned char*) Str - 2;
7450 unsigned StrLen = (((
unsigned) StrLenPtr[0])
7451 | (((
unsigned) StrLenPtr[1]) << 8)) - 1;
7452 IdentifiersLoaded[
ID]
7454 if (DeserializationListener)
7455 DeserializationListener->
IdentifierRead(ID + 1, IdentifiersLoaded[ID]);
7458 return IdentifiersLoaded[
ID];
7472 &&
"Invalid index into identifier index remap");
7474 return LocalID + I->second;
7481 if (MacrosLoaded.empty()) {
7482 Error(
"no macro table in AST file");
7487 if (!MacrosLoaded[ID]) {
7490 assert(I != GlobalMacroMap.
end() &&
"Corrupted global macro map");
7491 ModuleFile *M = I->second;
7492 unsigned Index = ID - M->BaseMacroID;
7495 if (DeserializationListener)
7500 return MacrosLoaded[
ID];
7509 assert(I != M.
MacroRemap.
end() &&
"Invalid index into macro index remap");
7511 return LocalID + I->second;
7516 if (LocalID < NUM_PREDEF_SUBMODULE_IDS)
7522 &&
"Invalid index into submodule index remap");
7524 return LocalID + I->second;
7528 if (GlobalID < NUM_PREDEF_SUBMODULE_IDS) {
7529 assert(GlobalID == 0 &&
"Unhandled global submodule ID");
7533 if (GlobalID > SubmodulesLoaded.size()) {
7534 Error(
"submodule ID out of range in AST file");
7549 return I == GlobalSubmoduleMap.
end() ?
nullptr : I->second;
7552 unsigned IndexFromEnd = ID >> 1;
7553 assert(IndexFromEnd &&
"got reference to unknown module file");
7570 auto I = std::find(PCHModules.begin(), PCHModules.end(), F);
7571 assert(I != PCHModules.end() &&
"emitting reference to unknown file");
7572 return (I - PCHModules.end()) << 1;
7582 if (ModuleMgr.
size() == 1) {
7598 if (ID > SelectorsLoaded.size()) {
7599 Error(
"selector ID out of range in AST file");
7603 if (SelectorsLoaded[ID - 1].getAsOpaquePtr() ==
nullptr) {
7606 assert(I != GlobalSelectorMap.
end() &&
"Corrupted global selector map");
7607 ModuleFile &M = *I->second;
7610 SelectorsLoaded[ID - 1] =
7611 Trait.
ReadKey(M.SelectorLookupTableData + M.SelectorOffsets[Idx], 0);
7612 if (DeserializationListener)
7613 DeserializationListener->
SelectorRead(ID, SelectorsLoaded[ID - 1]);
7616 return SelectorsLoaded[ID - 1];
7636 &&
"Invalid index into selector index remap");
7638 return LocalID + I->second;
7678 llvm_unreachable(
"Invalid NameKind!");
7726 unsigned NumTPLists = Record[Idx++];
7730 for (
unsigned i=0; i != NumTPLists; ++i)
7741 return TemplateName(ReadDeclAs<TemplateDecl>(F, Record, Idx));
7744 unsigned size = Record[Idx++];
7747 Decls.
addDecl(ReadDeclAs<NamedDecl>(F, Record, Idx));
7754 bool hasTemplKeyword = Record[Idx++];
7755 TemplateDecl *Template = ReadDeclAs<TemplateDecl>(F, Record, Idx);
7771 = ReadDeclAs<TemplateTemplateParmDecl>(F, Record, Idx);
7779 = ReadDeclAs<TemplateTemplateParmDecl>(F, Record, Idx);
7791 llvm_unreachable(
"Unhandled template name kind!");
7797 bool Canonicalize) {
7814 ValueDecl *D = ReadDeclAs<ValueDecl>(F, Record, Idx);
7829 if (
unsigned NumExpansions = Record[Idx++])
7830 NumTemplateExpansions = NumExpansions - 1;
7836 unsigned NumArgs = Record[Idx++];
7838 for (
unsigned I = 0; I !=
NumArgs; ++
I)
7844 llvm_unreachable(
"Unhandled template argument kind!");
7854 unsigned NumParams = Record[Idx++];
7856 Params.reserve(NumParams);
7858 Params.push_back(ReadDeclAs<NamedDecl>(F, Record, Idx));
7863 return TemplateParams;
7870 unsigned &Idx,
bool Canonicalize) {
7871 unsigned NumTemplateArgs = Record[Idx++];
7872 TemplArgs.reserve(NumTemplateArgs);
7873 while (NumTemplateArgs--)
7880 unsigned NumDecls = Record[Idx++];
7881 Set.
reserve(Context, NumDecls);
7882 while (NumDecls--) {
7892 bool isVirtual =
static_cast<bool>(Record[Idx++]);
7893 bool isBaseOfClass =
static_cast<bool>(Record[Idx++]);
7895 bool inheritConstructors =
static_cast<bool>(Record[Idx++]);
7908 unsigned NumInitializers = Record[Idx++];
7909 assert(NumInitializers &&
"wrote ctor initializers but have no inits");
7911 for (
unsigned i = 0; i != NumInitializers; ++i) {
7913 bool IsBaseVirtual =
false;
7921 IsBaseVirtual = Record[Idx++];
7929 Member = ReadDeclAs<FieldDecl>(F, Record, Idx);
7933 IndirectMember = ReadDeclAs<IndirectFieldDecl>(F, Record, Idx);
7941 bool IsWritten = Record[Idx++];
7942 unsigned SourceOrderOrNumArrayIndices;
7945 SourceOrderOrNumArrayIndices = Record[Idx++];
7947 SourceOrderOrNumArrayIndices = Record[Idx++];
7948 Indices.reserve(SourceOrderOrNumArrayIndices);
7949 for (
unsigned i=0; i != SourceOrderOrNumArrayIndices; ++i)
7950 Indices.push_back(ReadDeclAs<VarDecl>(F, Record, Idx));
7955 BOMInit =
new (Context)
7957 RParenLoc, MemberOrEllipsisLoc);
7959 BOMInit =
new (Context)
7961 }
else if (IsWritten) {
7964 Context, Member, MemberOrEllipsisLoc, LParenLoc, Init, RParenLoc);
7966 BOMInit =
new (Context)
7968 LParenLoc, Init, RParenLoc);
7970 if (IndirectMember) {
7971 assert(Indices.empty() &&
"Indirect field improperly initialized");
7972 BOMInit =
new (Context)
7974 LParenLoc, Init, RParenLoc);
7977 Context, Member, MemberOrEllipsisLoc, LParenLoc, Init, RParenLoc,
7978 Indices.data(), Indices.size());
7984 CtorInitializers[i] = BOMInit;
7987 return CtorInitializers;
7993 unsigned N = Record[Idx++];
7995 for (
unsigned I = 0; I != N; ++
I) {
8006 NamespaceDecl *NS = ReadDeclAs<NamespaceDecl>(F, Record, Idx);
8023 bool Template = Record[Idx++];
8035 CXXRecordDecl *RD = ReadDeclAs<CXXRecordDecl>(F, Record, Idx);
8048 unsigned N = Record[Idx++];
8050 for (
unsigned I = 0; I != N; ++
I) {
8062 NamespaceDecl *NS = ReadDeclAs<NamespaceDecl>(F, Record, Idx);
8064 Builder.
Extend(Context, NS, Range.getBegin(), Range.getEnd());
8071 Builder.
Extend(Context, Alias, Range.getBegin(), Range.getEnd());
8077 bool Template = Record[Idx++];
8097 CXXRecordDecl *RD = ReadDeclAs<CXXRecordDecl>(F, Record, Idx);
8099 Builder.
MakeSuper(Context, RD, Range.getBegin(), Range.getEnd());
8118 unsigned BitWidth = Record[Idx++];
8119 unsigned NumWords = llvm::APInt::getNumWords(BitWidth);
8120 llvm::APInt
Result(BitWidth, NumWords, &Record[Idx]);
8127 bool isUnsigned = Record[Idx++];
8128 return llvm::APSInt(
ReadAPInt(Record, Idx), isUnsigned);
8133 const llvm::fltSemantics &Sem,
8135 return llvm::APFloat(Sem,
ReadAPInt(Record, Idx));
8140 unsigned Len = Record[Idx++];
8141 std::string
Result(Record.data() + Idx, Record.data() + Idx + Len);
8148 std::string Filename =
ReadString(Record, Idx);
8155 unsigned Major = Record[Idx++];
8156 unsigned Minor = Record[Idx++];
8157 unsigned Subminor = Record[Idx++];
8173 return Diag(CurrentImportLoc, DiagID);
8177 return Diags.
Report(Loc, DiagID);
8189 assert((*CurrSwitchCaseStmts)[ID] ==
nullptr &&
8190 "Already have a SwitchCase with this ID");
8191 (*CurrSwitchCaseStmts)[
ID] = SC;
8196 assert((*CurrSwitchCaseStmts)[ID] !=
nullptr &&
"No SwitchCase with this ID");
8197 return (*CurrSwitchCaseStmts)[
ID];
8201 CurrSwitchCaseStmts->clear();
8205 std::vector<RawComment *> Comments;
8212 BitstreamCursor &Cursor = I->first;
8218 llvm::BitstreamEntry Entry =
8219 Cursor.advanceSkippingSubblocks(BitstreamCursor::AF_DontPopBlockAtEnd);
8221 switch (Entry.Kind) {
8222 case llvm::BitstreamEntry::SubBlock:
8224 Error(
"malformed block record in AST file");
8226 case llvm::BitstreamEntry::EndBlock:
8228 case llvm::BitstreamEntry::Record:
8241 bool IsTrailingComment = Record[Idx++];
8242 bool IsAlmostTrailingComment = Record[Idx++];
8244 SR, Kind, IsTrailingComment, IsAlmostTrailingComment,
8251 Context.
Comments.addDeserializedComments(Comments);
8258 return M->getFullModuleName();
8268 void ASTReader::finishPendingActions() {
8269 while (!PendingIdentifierInfos.empty() ||
8270 !PendingIncompleteDeclChains.empty() || !PendingDeclChains.empty() ||
8271 !PendingMacroIDs.empty() || !PendingDeclContextInfos.empty() ||
8272 !PendingUpdateRecords.empty()) {
8275 typedef llvm::DenseMap<IdentifierInfo *, SmallVector<Decl *, 2> >
8277 TopLevelDeclsMap TopLevelDecls;
8279 while (!PendingIdentifierInfos.empty()) {
8282 std::move(PendingIdentifierInfos.back().second);
8283 PendingIdentifierInfos.pop_back();
8290 for (
unsigned I = 0; I != PendingIncompleteDeclChains.size(); ++
I) {
8291 markIncompleteDeclChain(PendingIncompleteDeclChains[I]);
8293 PendingIncompleteDeclChains.clear();
8296 for (
unsigned I = 0; I != PendingDeclChains.size(); ++
I)
8297 loadPendingDeclChain(PendingDeclChains[I].first, PendingDeclChains[I].second);
8298 PendingDeclChains.clear();
8302 TLDEnd = TopLevelDecls.end(); TLD != TLDEnd; ++TLD) {
8304 for (
unsigned I = 0, N = TLD->second.size(); I != N; ++
I) {
8305 pushExternalDeclIntoScope(cast<NamedDecl>(TLD->second[I]), II);
8310 for (
unsigned I = 0; I != PendingMacroIDs.size(); ++
I) {
8313 GlobalIDs.swap(PendingMacroIDs.begin()[
I].second);
8315 for (
unsigned IDIdx = 0, NumIDs = GlobalIDs.size(); IDIdx != NumIDs;
8317 const PendingMacroInfo &Info = GlobalIDs[IDIdx];
8323 for (
unsigned IDIdx = 0, NumIDs = GlobalIDs.size(); IDIdx != NumIDs;
8325 const PendingMacroInfo &Info = GlobalIDs[IDIdx];
8331 PendingMacroIDs.clear();
8335 while (!PendingDeclContextInfos.empty()) {
8336 PendingDeclContextInfo Info = PendingDeclContextInfos.front();
8337 PendingDeclContextInfos.pop_front();
8340 Info.D->setDeclContextsImpl(SemaDC, LexicalDC,
getContext());
8344 while (!PendingUpdateRecords.empty()) {
8345 auto Update = PendingUpdateRecords.pop_back_val();
8346 ReadingKindTracker ReadingKind(Read_Decl, *
this);
8347 loadDeclUpdateRecords(Update.first, Update.second);
8353 assert(PendingFakeDefinitionData.empty() &&
8354 "faked up a class definition but never saw the real one");
8360 for (Decl *D : PendingDefinitions) {
8361 if (
TagDecl *TD = dyn_cast<TagDecl>(D)) {
8362 if (
const TagType *TagT = dyn_cast<TagType>(TD->getTypeForDecl())) {
8367 if (
auto RD = dyn_cast<CXXRecordDecl>(D)) {
8368 for (
auto *R = getMostRecentExistingDecl(RD); R;
8371 cast<CXXRecordDecl>(R)->isThisDeclarationADefinition() &&
8372 "declaration thinks it's the definition but it isn't");
8373 cast<CXXRecordDecl>(R)->DefinitionData = RD->DefinitionData;
8380 if (
auto ID = dyn_cast<ObjCInterfaceDecl>(D)) {
8385 for (
auto *R = getMostRecentExistingDecl(ID); R; R = R->
getPreviousDecl())
8386 cast<ObjCInterfaceDecl>(R)->Data = ID->Data;
8391 if (
auto PD = dyn_cast<ObjCProtocolDecl>(D)) {
8392 for (
auto *R = getMostRecentExistingDecl(PD); R; R = R->
getPreviousDecl())
8393 cast<ObjCProtocolDecl>(R)->Data = PD->Data;
8398 auto RTD = cast<RedeclarableTemplateDecl>(D)->getCanonicalDecl();
8399 for (
auto *R = getMostRecentExistingDecl(RTD); R; R = R->
getPreviousDecl())
8400 cast<RedeclarableTemplateDecl>(R)->Common = RTD->Common;
8402 PendingDefinitions.clear();
8409 PBEnd = PendingBodies.end();
8410 PB != PBEnd; ++PB) {
8411 if (
FunctionDecl *FD = dyn_cast<FunctionDecl>(PB->first)) {
8415 FD->setLazyBody(PB->second);
8423 PendingBodies.clear();
8426 for (
auto *ND : PendingMergedDefinitionsToDeduplicate)
8428 PendingMergedDefinitionsToDeduplicate.clear();
8431 void ASTReader::diagnoseOdrViolations() {
8432 if (PendingOdrMergeFailures.empty() && PendingOdrMergeChecks.empty())
8439 auto OdrMergeFailures = std::move(PendingOdrMergeFailures);
8440 PendingOdrMergeFailures.clear();
8441 for (
auto &Merge : OdrMergeFailures) {
8442 Merge.first->buildLookup();
8443 Merge.first->decls_begin();
8444 Merge.first->bases_begin();
8445 Merge.first->vbases_begin();
8446 for (
auto *RD : Merge.second) {
8459 while (!PendingOdrMergeChecks.empty()) {
8460 NamedDecl *D = PendingOdrMergeChecks.pop_back_val();
8474 for (
auto RI : D->
redecls()) {
8475 if (RI->getLexicalDeclContext() == CanonDef) {
8490 for (
auto *CanonMember : CanonDef->
decls()) {
8491 if (CanonMember->getCanonicalDecl() == DCanon) {
8500 if (
auto *ND = dyn_cast<NamedDecl>(CanonMember))
8502 Candidates.push_back(ND);
8508 if (!isa<TagDecl>(D))
8513 Deserializing RecursionGuard(
this);
8515 std::string CanonDefModule =
8519 << CanonDef << CanonDefModule.empty() << CanonDefModule;
8521 if (Candidates.empty())
8522 Diag(cast<Decl>(CanonDef)->getLocation(),
8523 diag::note_module_odr_violation_no_possible_decls) << D;
8525 for (
unsigned I = 0, N = Candidates.size(); I != N; ++
I)
8526 Diag(Candidates[I]->getLocation(),
8527 diag::note_module_odr_violation_possible_decl)
8531 DiagnosedOdrMergeFailures.insert(CanonDef);
8535 if (OdrMergeFailures.empty())
8540 Deserializing RecursionGuard(
this);
8543 for (
auto &Merge : OdrMergeFailures) {
8546 if (!DiagnosedOdrMergeFailures.insert(Merge.first).second)
8549 bool Diagnosed =
false;
8550 for (
auto *RD : Merge.second) {
8553 if (Merge.first != RD) {
8558 Diag(Merge.first->getLocation(),
8559 diag::err_module_odr_violation_different_definitions)
8560 << Merge.first << Module.empty() << Module;
8564 Diag(RD->getLocation(),
8565 diag::note_module_odr_violation_different_definitions)
8577 Diag(Merge.first->getLocation(),
8578 diag::err_module_odr_violation_different_instantiations)
8585 if (++NumCurrentElementsDeserializing == 1 && ReadTimer.get())
8586 ReadTimer->startTimer();
8590 assert(NumCurrentElementsDeserializing &&
8591 "FinishedDeserializing not paired with StartedDeserializing");
8592 if (NumCurrentElementsDeserializing == 1) {
8595 finishPendingActions();
8597 --NumCurrentElementsDeserializing;
8599 if (NumCurrentElementsDeserializing == 0) {
8601 while (!PendingExceptionSpecUpdates.empty()) {
8602 auto Updates = std::move(PendingExceptionSpecUpdates);
8603 PendingExceptionSpecUpdates.clear();
8606 auto ESI = FPT->getExtProtoInfo().ExceptionSpec;
8608 Listener->ResolvedExceptionSpec(cast<FunctionDecl>(Update.second));
8609 for (
auto *Redecl : Update.second->redecls())
8615 ReadTimer->stopTimer();
8617 diagnoseOdrViolations();
8622 PassInterestingDeclsToConsumer();
8629 auto It = PendingFakeLookupResults.find(II);
8630 if (It != PendingFakeLookupResults.end()) {
8631 for (
auto *ND : It->second)
8642 }
else if (SemaObj->
TUScope) {
8652 ASTReader::ASTReader(
8656 StringRef isysroot,
bool DisableValidation,
8657 bool AllowASTWithCompilerErrors,
8658 bool AllowConfigurationMismatch,
bool ValidateSystemInputs,
8659 bool UseGlobalIndex,
8660 std::unique_ptr<llvm::Timer> ReadTimer)
8661 : Listener(new
PCHValidator(PP, *this)), DeserializationListener(nullptr),
8662 OwnsDeserializationListener(
false),
SourceMgr(PP.getSourceManager()),
8663 FileMgr(PP.getFileManager()), PCHContainerRdr(PCHContainerRdr),
8664 Diags(PP.getDiagnostics()), SemaObj(nullptr), PP(PP), Context(Context),
8665 Consumer(nullptr), ModuleMgr(PP.getFileManager(), PCHContainerRdr),
8666 ReadTimer(std::move(ReadTimer)),
8667 isysroot(isysroot), DisableValidation(DisableValidation),
8668 AllowASTWithCompilerErrors(AllowASTWithCompilerErrors),
8669 AllowConfigurationMismatch(AllowConfigurationMismatch),
8670 ValidateSystemInputs(ValidateSystemInputs),
8671 UseGlobalIndex(UseGlobalIndex), TriedLoadingGlobalIndex(
false),
8672 CurrSwitchCaseStmts(&SwitchCaseStmts), NumSLocEntriesRead(0),
8673 TotalNumSLocEntries(0), NumStatementsRead(0), TotalNumStatements(0),
8674 NumMacrosRead(0), TotalNumMacros(0), NumIdentifierLookups(0),
8675 NumIdentifierLookupHits(0), NumSelectorsRead(0),
8676 NumMethodPoolEntriesRead(0), NumMethodPoolLookups(0),
8677 NumMethodPoolHits(0), NumMethodPoolTableLookups(0),
8678 NumMethodPoolTableHits(0), TotalNumMethodPoolEntries(0),
8679 NumLexicalDeclContextsRead(0), TotalLexicalDeclContexts(0),
8680 NumVisibleDeclContextsRead(0), TotalVisibleDeclContexts(0),
8681 TotalModulesSizeInBits(0), NumCurrentElementsDeserializing(0),
8682 PassingDeclsToConsumer(
false), ReadingKind(Read_None) {
8685 for (
const auto &Ext : Extensions) {
8686 auto BlockName = Ext->getExtensionMetadata().BlockName;
8687 auto Known = ModuleFileExtensions.find(BlockName);
8688 if (Known != ModuleFileExtensions.end()) {
8689 Diags.
Report(diag::warn_duplicate_module_file_extension)
8694 ModuleFileExtensions.insert({BlockName, Ext});
8699 if (OwnsDeserializationListener)
8700 delete DeserializationListener;
llvm::APInt ReadAPInt(const RecordData &Record, unsigned &Idx)
Read an integral value.
Decl * GetExistingDecl(serialization::DeclID ID)
Resolve a declaration ID into a declaration.
TypedefDecl * getObjCInstanceTypeDecl()
Retrieve the typedef declaration corresponding to the Objective-C "instancetype" type.
bool isPoisoned() const
Return true if this token has been poisoned.
QualType getElaboratedType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, QualType NamedType) const
SmallVector< std::pair< llvm::BitstreamCursor, serialization::ModuleFile * >, 8 > CommentsCursors
Cursors for comments blocks.
Defines the clang::ASTContext interface.
SourceLocation getEnd() const
bool FindExternalVisibleDeclsByName(const DeclContext *DC, DeclarationName Name) override
Finds all the visible declarations with a given name.
ASTReadResult
The result of reading the control block of an AST file, which can fail for various reasons...
Record code for the preprocessor options table.
static bool checkPreprocessorOptions(const PreprocessorOptions &PPOpts, const PreprocessorOptions &ExistingPPOpts, DiagnosticsEngine *Diags, FileManager &FileMgr, std::string &SuggestedPredefines, const LangOptions &LangOpts)
Check the preprocessor options deserialized from the control block against the preprocessor options i...
std::vector< unsigned > PreloadIdentifierOffsets
Offsets of identifiers that we're going to preload within IdentifierTableData.
SmallVector< UnresolvedExportDecl, 2 > UnresolvedExports
The set of export declarations that have yet to be resolved.
The client can handle an AST file that cannot load because it was built with a different version of C...
void setInfo(const DeclarationNameLoc &Info)
FunctionDecl - An instance of this class is created to represent a function declaration or definition...
std::string Name
The name of this module.
static DiagnosticBuilder Diag(DiagnosticsEngine *Diags, const LangOptions &Features, FullSourceLoc TokLoc, const char *TokBegin, const char *TokRangeBegin, const char *TokRangeEnd, unsigned DiagID)
Produce a diagnostic highlighting some portion of a literal.
Source range/offset of a preprocessed entity.
Header getUmbrellaHeader() const
Retrieve the header that serves as the umbrella header for this module.
std::vector< std::pair< std::string, bool > > Macros
IdentifierIterator * getIdentifiers() override
Retrieve an iterator into the set of all identifiers in all loaded AST files.
Record code for the signature that identifiers this AST file.
void * IdentifierLookupTable
A pointer to an on-disk hash table of opaque type IdentifierHashTable.
void setjmp_bufDecl(TypeDecl *jmp_bufDecl)
Set the type for the C jmp_buf type.
bool ReadHeaderSearchOptions(const HeaderSearchOptions &HSOpts, StringRef SpecificModuleCachePath, bool Complain) override
Receives the header search options.
Record code for potentially unused local typedef names.
Record code for map of Objective-C class definition IDs to the ObjC categories in a module that are a...
Smart pointer class that efficiently represents Objective-C method names.
static void updateModuleTimestamp(ModuleFile &MF)
ASTReadResult ReadAST(const std::string &FileName, ModuleKind Type, SourceLocation ImportLoc, unsigned ClientLoadCapabilities)
Load the AST file designated by the given file name.
static hash_value_type ComputeHash(Selector Sel)
static bool checkTargetOptions(const TargetOptions &TargetOpts, const TargetOptions &ExistingTargetOpts, DiagnosticsEngine *Diags, bool AllowCompatibleDifferences=true)
Compare the given set of target options against an existing set of target options.
A (possibly-)qualified type.
virtual bool ReadPreprocessorOptions(const PreprocessorOptions &PPOpts, bool Complain, std::string &SuggestedPredefines)
Receives the preprocessor options.
CtorInitializerType
The different kinds of data that can occur in a CtorInitializer.
TypedefDecl * getUInt128Decl() const
Retrieve the declaration for the 128-bit unsigned integer type.
void AddTokenToBody(const Token &Tok)
Add the specified token to the replacement text for the macro.
void setStarLoc(SourceLocation Loc)
NameKind
NameKind - The kind of name this object contains.
The macro directives history for a particular identifier.
Represents a version number in the form major[.minor[.subminor[.build]]].
CanQualType OCLImage1dBufferTy
static bool startsWithASTFileMagic(BitstreamCursor &Stream)
Whether Stream starts with the AST/PCH file magic number 'CPCH'.
void SetIdentifierInfo(unsigned ID, IdentifierInfo *II)
virtual bool visitInputFile(StringRef Filename, bool isSystem, bool isOverridden, bool isExplicitModule)
if needsInputFileVisitation returns true, this is called for each non-system input file of the AST Fi...
Implements support for file system lookup, file system caching, and directory search management...
The (signed) 'long long' type.
ASTConsumer - This is an abstract interface that should be implemented by clients that read ASTs...
virtual void visitModuleFile(StringRef Filename, serialization::ModuleKind Kind)
This is called for each AST file loaded.
A simple structure that captures a vtable use for the purposes of the ExternalSemaSource.
bool operator()(ModuleFile &M)
QualType getAdjustedType(QualType Orig, QualType New) const
Return the uniqued reference to a type adjusted from the original type to a new type.
RAII class for safely pairing a StartedDeserializing call with FinishedDeserializing.
Defines the clang::FileManager interface and associated types.
CXXBaseSpecifier * GetExternalCXXBaseSpecifiers(uint64_t Offset) override
Resolve the offset of a set of C++ base specifiers in the decl stream into an array of specifiers...
Record code for the source manager line table information, which stores information about #line direc...
QualType getComplexType(QualType T) const
Return the uniqued reference to the type for a complex number with the specified element type...
bool tryAddTopLevelDecl(NamedDecl *D, DeclarationName Name)
Try to add the given declaration to the top level scope, if it (or a redeclaration of it) hasn't alre...
ObjCXXARCStandardLibraryKind
Enumerate the kinds of standard library that.
This header is part of the module (for layering purposes) but should be textually included...
The 'bool' or '_Bool' type.
bool factoryHasMoreThanOneDecl() const
QualType getQualifiedType(SplitQualType split) const
Un-split a SplitQualType.
void setKWLoc(SourceLocation Loc)
unsigned getHash() const
Compute a fingerprint of this key for use in on-disk hash table.
void setRParenLoc(SourceLocation Loc)
const unsigned NUM_PREDEF_TYPE_IDS
The number of predefined type IDs that are reserved for the PREDEF_TYPE_* constants.
CanQualType OCLImage2dMSAADepthTy
AutoTypeKeyword
Which keyword(s) were used to create an AutoType.
void setStarLoc(SourceLocation Loc)
Optional< bool > isPreprocessedEntityInFileID(unsigned Index, FileID FID) override
Optionally returns true or false if the preallocated preprocessed entity with index Index came from f...
void setLAngleLoc(SourceLocation Loc)
decl_range decls() const
decls_begin/decls_end - Iterate over the declarations stored in this context.
SourceLocation ReadSourceLocation(ModuleFile &ModuleFile, unsigned Raw) const
Read a source location from raw form.
QualType getRValueReferenceType(QualType T) const
Return the uniqued reference to the type for an rvalue reference to the specified type...
SourceLocation DirectImportLoc
The source location where the module was explicitly or implicitly imported in the local translation u...
unsigned IsExternC
Whether this is an 'extern "C"' module (which implicitly puts all headers in it within an 'extern "...
IdentifierInfo * getCXXLiteralIdentifier() const
getCXXLiteralIdentifier - If this name is the name of a literal operator, retrieve the identifier ass...
ControlRecordTypes
Record types that occur within the control block.
void addTopHeaderFilename(StringRef Filename)
Add a top-level header filename associated with this module.
unsigned Generation
The generation of which this module file is a part.
void ReadComments() override
Loads comments ranges.
std::vector< UnresolvedConflict > UnresolvedConflicts
The list of conflicts for which the module-id has not yet been resolved.
C Language Family Type Representation.
Defines the SourceManager interface.
uint32_t IdentID
An ID number that refers to an identifier in an AST file.
The 'unknown any' placeholder type.
void setWrittenWidthSpec(TypeSpecifierWidth written)
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in...
void setucontext_tDecl(TypeDecl *ucontext_tDecl)
Set the type for the C ucontext_t type.
bool ReadTargetOptions(const TargetOptions &TargetOpts, bool Complain, bool AllowCompatibleDifferences) override
Receives the target options.
The template argument is an expression, and we've not resolved it to one of the other forms yet...
QualType getUnaryTransformType(QualType BaseType, QualType UnderlyingType, UnaryTransformType::UTTKind UKind) const
Unary type transforms.
RawCommentList Comments
All comments in this translation unit.
Module * getSubmodule(serialization::SubmoduleID GlobalID)
Retrieve the submodule that corresponds to a global submodule ID.
unsigned size() const
Number of modules loaded.
const unsigned int NUM_PREDEF_SELECTOR_IDS
The number of predefined selector IDs.
Decl - This represents one declaration (or definition), e.g.
SmallVector< uint64_t, 4 > PreloadSLocEntries
SLocEntries that we're going to preload.
std::string getTimestampFilename() const
virtual void MacroRead(serialization::MacroID ID, MacroInfo *MI)
A macro was read from the AST file.
const SrcMgr::SLocEntry & getSLocEntry(FileID FID, bool *Invalid=nullptr) const
CanQualType ObjCBuiltinSelTy
RetTy Visit(TypeLoc TyLoc)
ModuleManager::ModuleConstIterator ModuleConstIterator
void VisitFunctionTypeLoc(FunctionTypeLoc)
ModuleKind Kind
The type of this module.
virtual void ReadCounter(const serialization::ModuleFile &M, unsigned Value)
Receives COUNTER value.
unsigned Begin
Raw source location of beginning of range.
Defines the C++ template declaration subclasses.
Describes a source location entry (SLocEntry) for a macro expansion.
Scope * TUScope
Translation Unit Scope - useful to Objective-C actions that need to lookup file scope declarations in...
unsigned getFactoryBits() const
std::vector< std::string > Includes
An LValueReferenceType record.
Decl * getPreviousDecl()
Retrieve the previous declaration that declares the same entity as this declaration, or NULL if there is no previous declaration.
The placeholder type for builtin functions.
static void completeRedeclChainForTemplateSpecialization(Decl *D)
Defines the clang::MacroInfo and clang::MacroDirective classes.
Specifies the submodules that are imported by this submodule.
std::string ModuleName
The name of the module.
QualType getLValueReferenceType(QualType T, bool SpelledAsLValue=true) const
Return the uniqued reference to the type for an lvalue reference to the specified type...
CanQualType ARCUnbridgedCastTy
A record that stores the set of declarations that are lexically stored within a given DeclContext...
The module file is out-of-date.
bool isModule() const
Is this a module file for a module (rather than a PCH or similar).
IdentifierInfo * getAsIdentifierInfo() const
getAsIdentifierInfo - Retrieve the IdentifierInfo * stored in this declaration name, or NULL if this declaration name isn't a simple identifier.
Specifies an umbrella directory.
The base class of the type hierarchy.
uint32_t DeclID
An ID number that refers to a declaration in an AST file.
IdentifierInfo * getLocalIdentifier(ModuleFile &M, unsigned LocalID)
unsigned LocalNumObjCCategoriesInMap
The number of redeclaration info entries in ObjCCategoriesMap.
void setHasLineDirectives()
Set the flag that indicates that this FileID has line table entries associated with it...
StringRef getOriginalSourceFile()
Retrieve the name of the original source file name for the primary module file.
#define CHECK_TARGET_OPT(Field, Name)
A SubstTemplateTypeParmType record.
QualType getRecordType(const RecordDecl *Decl) const
std::unique_ptr< llvm::MemoryBuffer > Buffer
Decl * GetDecl(serialization::DeclID ID)
Resolve a declaration ID into a declaration, potentially building a new declaration.
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.
void setTemplateKeywordLoc(SourceLocation Loc)
void setFlag(TokenFlags Flag)
Set the specified flag.
The template argument is a declaration that was provided for a pointer, reference, or pointer to member non-type template parameter.
NamespaceDecl - Represent a C++ namespace.
Wrapper for source info for typedefs.
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
A container of type source information.
RefQualifierKind RefQualifier
Base class that describes a preprocessed entity, which may be a preprocessor directive or macro expan...
uint64_t GlobalBitOffset
The global bit offset (or base) of this module.
SmallVector< ObjCMethodDecl *, 2 > Instance
Record code for enabled OpenCL extensions.
Record code for the module build directory.
void * getAsOpaquePtr() const
void makeModuleVisible(Module *Mod, Module::NameVisibilityKind NameVisibility, SourceLocation ImportLoc)
Make the entities in the given module and any of its (non-explicit) submodules visible to name lookup...
An ElaboratedType record.
Expr * getAsExpr() const
Retrieve the template argument as an expression.
serialization::SelectorID BaseSelectorID
Base selector ID for selectors local to this module.
virtual void IdentifierRead(serialization::IdentID ID, IdentifierInfo *II)
An identifier was deserialized from the AST file.
An UnresolvedUsingType record.
PreprocessorOptions - This class is used for passing the various options used in preprocessor initial...
unsigned getRawEncoding() const
When a SourceLocation itself cannot be used, this returns an (opaque) 32-bit integer encoding for it...
Wrapper for source info for pointers decayed from arrays and functions.
bool hasAttrEnumOperand() const
ASTFileSignature Signature
The signature of the module file, which may be used along with size and modification time to identify...
Represents a C++ constructor within a class.
TypeLoc getNextTypeLoc() const
An IncompleteArrayType record.
QualType getPipeType(QualType T) const
Return pipe type for the specified type.
A template template parameter that has been substituted for some other template name.
void addPendingMacro(IdentifierInfo *II, ModuleFile *M, uint64_t MacroDirectivesOffset)
Add a macro to deserialize its macro directive history.
Specifies a header that is part of the module but must be textually included.
const uint32_t * SLocEntryOffsets
Offsets for all of the source location entries in the AST file.
bool RelocatablePCH
Whether this precompiled header is a relocatable PCH file.
CXXBaseSpecifier ReadCXXBaseSpecifier(ModuleFile &F, const RecordData &Record, unsigned &Idx)
Read a C++ base specifier.
ARC's unbridged-cast placeholder type.
The client can handle an AST file that cannot load because it is out-of-date relative to its input fi...
void visit(llvm::function_ref< bool(ModuleFile &M)> Visitor, llvm::SmallPtrSetImpl< ModuleFile * > *ModuleFilesHit=nullptr)
Visit each of the modules.
unsigned NumPreprocessedEntities
ArrayRef< ObjCMethodDecl * > getInstanceMethods() const
Retrieve the instance methods found by this visitor.
bool getWarningsAsErrors() const
uint32_t IdentifierID
An ID number that refers to an identifier in an AST file.
An identifier, stored as an IdentifierInfo*.
The internal '__builtin_va_list' typedef.
void addRequirement(StringRef Feature, bool RequiredState, const LangOptions &LangOpts, const TargetInfo &Target)
Add the given feature requirement to the list of features required by this module.
void getExportedModules(SmallVectorImpl< Module * > &Exported) const
Appends this module's list of exported modules to Exported.
Manages the set of modules loaded by an AST reader.
static Qualifiers fromOpaqueValue(unsigned opaque)
QualType getBlockPointerType(QualType T) const
Return the uniqued reference to the type for a block of the specified type.
VarDecl - An instance of this class is created to represent a variable declaration or definition...
static NestedNameSpecifier * Create(const ASTContext &Context, NestedNameSpecifier *Prefix, IdentifierInfo *II)
Builds a specifier combining a prefix and an identifier.
void ReadReferencedSelectors(SmallVectorImpl< std::pair< Selector, SourceLocation > > &Sels) override
Read the set of referenced selectors known to the external Sema source.
TypedefDecl * getBuiltinVaListDecl() const
Retrieve the C type declaration corresponding to the predefined __builtin_va_list type...
std::string ImplicitPTHInclude
The implicit PTH input included at the start of the translation unit, or empty.
const FileEntry * getASTFile() const
The serialized AST file for this module, if one was created.
CXXCtorInitializer ** GetExternalCXXCtorInitializers(uint64_t Offset) override
Read the contents of a CXXCtorInitializer array.
Wrapper for source info for member pointers.
void VisitArrayTypeLoc(ArrayTypeLoc)
void setPreambleFileID(FileID Preamble)
Set the file ID for the precompiled preamble.
Options for controlling the target.
Wrapper of type source information for a type with non-trivial direct qualifiers. ...
serialization::TypeID getGlobalTypeID(ModuleFile &F, unsigned LocalID) const
Map a local type ID within a given AST file into a global type ID.
Severity
Enum values that allow the client to map NOTEs, WARNINGs, and EXTENSIONs to either Ignore (nothing)...
bool hasAttrExprOperand() const
void CompleteRedeclChain(const Decl *D) override
If any redeclarations of D have been imported since it was last checked, this digs out those redeclar...
void dump()
Dump information about the AST reader to standard error.
Represents an empty template argument, e.g., one that has not been deduced.
Extra information about a function prototype.
void InitializeSema(Sema &S) override
Initialize the semantic source with the Sema instance being used to perform semantic analysis on the ...
serialization::SubmoduleID BaseSubmoduleID
Base submodule ID for submodules local to this module.
const unsigned int NUM_PREDEF_DECL_IDS
The number of declaration IDs that are predefined.
The value of the next COUNTER to dispense.
ObjCMethodDecl - Represents an instance or class method declaration.
unsigned getLineTableFilenameID(StringRef Str)
Specifies the umbrella header used to create this module, if any.
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>".
A namespace, stored as a NamespaceDecl*.
CharacteristicKind
Indicates whether a file or directory holds normal user code, system code, or system code which is im...
Record code for header search information.
data_type ReadData(Selector, const unsigned char *d, unsigned DataLen)
Stores a list of template parameters for a TemplateDecl and its derived classes.
void setBegin(SourceLocation b)
Describes a source location entry (SLocEntry) for a buffer.
Used to hold and unique data used to represent #line information.
Record code for the target options table.
static StringRef bytes(const std::vector< T, Allocator > &v)
bool hasAttrOperand() const
void ReadCounter(const serialization::ModuleFile &M, unsigned Value) override
Receives COUNTER value.
Record code for the array of eagerly deserialized decls.
Defines the clang::Expr interface and subclasses for C++ expressions.
Selector ReadSelector(ModuleFile &M, const RecordData &Record, unsigned &Idx)
int SLocEntryBaseID
The base ID in the source manager's view of this module.
TemplateArgument getCanonicalTemplateArgument(const TemplateArgument &Arg) const
Retrieve the "canonical" template argument.
QualType getFunctionNoProtoType(QualType ResultTy, const FunctionType::ExtInfo &Info) const
Return a K&R style C function type like 'int()'.
ContinuousRangeMap< uint32_t, int, 2 > DeclRemap
Remapping table for declaration IDs in this module.
void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
MemoryBufferSizes getMemoryBufferSizes() const
Return the amount of memory used by memory buffers, breaking down by heap-backed versus mmap'ed memor...
The collection of all-type qualifiers we support.
void setTypeArgTInfo(unsigned i, TypeSourceInfo *TInfo)
SourceLocation ImportLoc
The source location where this module was first imported.
Record code for the diagnostic options table.
void ReadTentativeDefinitions(SmallVectorImpl< VarDecl * > &TentativeDefs) override
Read the set of tentative definitions known to the external Sema source.
An UnresolvedSet-like class that might not have been loaded from the external AST source yet...
iterator begin(DeclarationName Name)
begin - Returns an iterator for decls with the name 'Name'.
The client can handle an AST file that cannot load because it is missing.
Base wrapper for a particular "section" of type source info.
RecordDecl - Represents a struct/union/class.
C ucontext_t typedef type.
const unsigned VERSION_MAJOR
AST file major version number supported by this version of Clang.
ObjCInterfaceDecl * getObjCProtocolDecl() const
Retrieve the Objective-C class declaration corresponding to the predefined Protocol class...
DeclarationName getName() const
getName - Returns the embedded declaration name.
FunctionType::ExtInfo ExtInfo
One of these records is kept for each identifier that is lexed.
A macro directive exported by a module.
void setLocalRangeEnd(SourceLocation L)
void addLazyDecl(ASTContext &C, uintptr_t ID, AccessSpecifier AS)
bool ReadDiagnosticOptions(IntrusiveRefCntPtr< DiagnosticOptions > DiagOpts, bool Complain) override
Receives the diagnostic options.
void disableFileContentsOverride(const FileEntry *File)
Disable overridding the contents of a file, previously enabled with overrideFileContents.
void setMainFileID(FileID FID)
Set the file ID for the main source file.
Specifies a top-level header that falls into this (sub)module.
std::string ActualOriginalSourceFileName
The actual original source file name that was used to build this AST file.
The block containing comments.
SmallVectorImpl< ModuleFile * >::const_iterator ModuleConstIterator
This table allows us to fully hide how we implement multi-keyword caching.
AddModuleResult
The result of attempting to add a new module.
The Objective-C 'SEL' type.
bool isDeclInLexicalTraversal(const Decl *D) const
Determine whether the given declaration is stored in the list of declarations lexically within this c...
A library or framework to link against when an entity from this module is used.
class LLVM_ALIGNAS(8) DependentTemplateSpecializationType const IdentifierInfo * Name
Represents a template specialization type whose template cannot be resolved, e.g. ...
bool instanceHasMoreThanOneDecl() const
CanQualType OCLImage2dArrayMSAADepthTy
void finalizeForWriting()
Finalizes the AST reader's state before writing an AST file to disk.
Iteration over the preprocessed entities.
CXXRecordDecl * getPreviousDecl()
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
A C++ nested-name-specifier augmented with source location information.
Record the location of a macro definition.
CanQualType OCLImage2dArrayTy
unsigned getNumArgs() const
bool hasExternalLexicalStorage() const
Whether this DeclContext has external storage containing additional declarations that are lexically i...
The 'char' type, when it is signed.
static std::string resolveFileRelativeToOriginalDir(const std::string &Filename, const std::string &OriginalDir, const std::string &CurrDir)
If a header file is not found at the path that we expect it to be and the PCH file was moved from its...
serialization::SelectorID getGlobalSelectorID(ModuleFile &F, unsigned LocalID) const
Retrieve the global selector ID that corresponds to this the local selector ID in a given module...
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
void setBuiltinLoc(SourceLocation Loc)
void setArgLocInfo(unsigned i, TemplateArgumentLocInfo AI)
OpenCL 2d image MSAA depth type.
static bool readASTFileControlBlock(StringRef Filename, FileManager &FileMgr, const PCHContainerReader &PCHContainerRdr, bool FindModuleFileExtensions, ASTReaderListener &Listener)
Read the control block for the named AST file.
The 'unsigned long' type.
Specifies a header that has been explicitly excluded from this submodule.
void setRBracketLoc(SourceLocation Loc)
static SourceLocation getFromRawEncoding(unsigned Encoding)
Turn a raw encoding of a SourceLocation object into a real SourceLocation.
QualType getExtVectorType(QualType VectorType, unsigned NumElts) const
Return the unique reference to an extended vector type of the specified element type and size...
FieldDecl - An instance of this class is created by Sema::ActOnField to represent a member of a struc...
void ReadLateParsedTemplates(llvm::MapVector< const FunctionDecl *, LateParsedTemplate * > &LPTMap) override
Read the set of late parsed template functions for this source.
The unsigned 128-bit integer type.
ContinuousRangeMap< uint32_t, int, 2 > PreprocessedEntityRemap
Remapping table for preprocessed entity IDs in this module.
Record code for the module map file that was used to build this AST file.
Delete expressions that will be analyzed later.
llvm::SmallPtrSet< ModuleFile *, 4 > HitSet
A set of module files in which we found a result.
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
unsigned ASTFileSignature
Helper class that saves the current stream position and then restores it when destroyed.
void setName(DeclarationName N)
setName - Sets the embedded declaration name.
static CXXCtorInitializer * Create(ASTContext &Context, FieldDecl *Member, SourceLocation MemberLoc, SourceLocation L, Expr *Init, SourceLocation R, VarDecl **Indices, unsigned NumIndices)
Creates a new member initializer that optionally contains array indices used to describe an elementwi...
void ReadUndefinedButUsed(llvm::DenseMap< NamedDecl *, SourceLocation > &Undefined) override
Load the set of used but not defined functions or variables with internal linkage, or used but not defined internal functions.
OpenCL 1d image buffer type.
void setElaboratedKeywordLoc(SourceLocation Loc)
TemplateName ReadTemplateName(ModuleFile &F, const RecordData &Record, unsigned &Idx)
Read a template name.
bool isFileOverridden(const FileEntry *File)
Returns true if the file contents have been overridden.
virtual bool ReadLanguageOptions(const LangOptions &LangOpts, bool Complain, bool AllowCompatibleDifferences)
Receives the language options.
Token - This structure provides full information about a lexed token.
method_range methods() const
void setUmbrellaDir(Module *Mod, const DirectoryEntry *UmbrellaDir, Twine NameAsWritten)
Sets the umbrella directory of the given module to the given directory.
unsigned DetailedRecord
Whether we should maintain a detailed record of all macro definitions and expansions.
QualType getTypeOfType(QualType t) const
getTypeOfType - Unlike many "get<Type>" functions, we don't unique TypeOfType nodes...
unsigned getNumProtocols() const
Wrapper for source info for unresolved typename using decls.
std::string OriginalDir
The directory that the PCH was originally created in.
void setKind(tok::TokenKind K)
Sema * getSema()
Retrieve the semantic analysis object used to analyze the translation unit in which the precompiled h...
void ReadExtVectorDecls(SmallVectorImpl< TypedefNameDecl * > &Decls) override
Read the set of ext_vector type declarations known to the external Sema source.
An AttributedType record.
An object-like macro definition.
The client can handle an AST file that cannot load because it's compiled configuration doesn't match ...
CanQualType OCLReserveIDTy
StringRef internal_key_type
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
internal_key_type ReadKey(const unsigned char *d, unsigned)
void ReadWeakUndeclaredIdentifiers(SmallVectorImpl< std::pair< IdentifierInfo *, WeakInfo > > &WI) override
Read the set of weak, undeclared identifiers known to the external Sema source.
Describes a module or submodule.
void completeVisibleDeclsMap(const DeclContext *DC) override
Load all external visible decls in the given DeclContext.
unsigned LocalNumHeaderFileInfos
The number of local HeaderFileInfo structures.
Record code for the set of ext_vector type names.
iterator end()
end - Returns an iterator that has 'finished'.
static VersionTuple ReadVersionTuple(const RecordData &Record, unsigned &Idx)
Read a version tuple.
llvm::Optional< ASTSourceDescriptor > getSourceDescriptor(unsigned ID) override
Return a descriptor for the corresponding module.
static void collectMacroDefinitions(const PreprocessorOptions &PPOpts, MacroDefinitionsMap &Macros, SmallVectorImpl< StringRef > *MacroNames=nullptr)
Collect the macro definitions provided by the given preprocessor options.
SourceLocation getBeginLoc() const
Get the begin source location.
const PPEntityOffset * PreprocessedEntityOffsets
Specifies the submodules that are re-exported from this submodule.
TemplateParameterList ** TemplParamLists
TemplParamLists - A new-allocated array of size NumTemplParamLists, containing pointers to the "outer...
serialization::MacroID BaseMacroID
Base macro ID for macros local to this module.
uint32_t SubmoduleID
An ID number that refers to a submodule in a module file.
QualType getParenType(QualType NamedType) const
The Objective-C 'id' type.
void setLParenLoc(SourceLocation Loc)
unsigned InferExportWildcard
Whether, when inferring submodules, the inferr submodules should export all modules they import (e...
void setNameLoc(SourceLocation Loc)
A qualified template name, where the qualification is kept to describe the source code as written...
const TargetInfo & getTargetInfo() const
virtual void HandleInterestingDecl(DeclGroupRef D)
HandleInterestingDecl - Handle the specified interesting declaration.
SourceLocation getLocWithOffset(int Offset) const
Return a source location with the specified offset from this SourceLocation.
PreprocessedEntity * ReadPreprocessedEntity(unsigned Index) override
Read a preallocated preprocessed entity from the external source.
void setCaretLoc(SourceLocation Loc)
void setRAngleLoc(SourceLocation Loc)
const LangOptions & getLangOpts() const
Wrapper for source info for injected class names of class templates.
bool isAvailable() const
Determine whether this module is available for use within the current translation unit...
A record of the steps taken while preprocessing a source file, including the various preprocessing di...
TypeSourceInfo * GetTypeSourceInfo(ModuleFile &F, const RecordData &Record, unsigned &Idx)
Reads a declarator info from the given record.
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
const unsigned NumSpecialTypeIDs
The number of special type IDs.
A convenient class for passing around template argument information.
void setcudaConfigureCallDecl(FunctionDecl *FD)
Describes a blob that contains the data for a buffer entry.
static void dump(llvm::raw_ostream &OS, StringRef FunctionName, ArrayRef< CounterExpression > Expressions, ArrayRef< CounterMappingRegion > Regions)
Record code for the language options table.
ModuleManager & getModuleManager()
Retrieve the module manager.
void ReadQualifierInfo(ModuleFile &F, QualifierInfo &Info, const RecordData &Record, unsigned &Idx)
std::string Message
The message provided to the user when there is a conflict.
Wrapper for source info for functions.
Specifies a conflict with another module.
The signed 128-bit integer type.
CXXCtorInitializer ** ReadCXXCtorInitializers(ModuleFile &F, const RecordData &Record, unsigned &Idx)
Read a CXXCtorInitializer array.
llvm::APSInt ReadAPSInt(const RecordData &Record, unsigned &Idx)
Read a signed integral value.
A UnaryTransformType record.
uint64_t readCXXBaseSpecifiers(ModuleFile &M, const RecordData &Record, unsigned &Idx)
Read a CXXBaseSpecifiers ID form the given record and return its global bit offset.
An ObjCObjectType record.
A ConstantArrayType record.
std::string ReadPath(ModuleFile &F, const RecordData &Record, unsigned &Idx)
void RemoveDecl(NamedDecl *D)
RemoveDecl - Unlink the decl from its shadowed decl chain.
bool ReadPreprocessorOptions(const PreprocessorOptions &PPOpts, bool Complain, std::string &SuggestedPredefines) override
Receives the preprocessor options.
Wrapper for substituted template type parameters.
std::string getOwningModuleNameForDiagnostic(const Decl *D)
Get the best name we know for the module that owns the given declaration, or an empty string if the d...
TemplateName getSubstTemplateTemplateParm(TemplateTemplateParmDecl *param, TemplateName replacement) const
Concrete class used by the front-end to report problems and issues.
serialization::SubmoduleID getGlobalSubmoduleID(ModuleFile &M, unsigned LocalID)
Retrieve the global submodule ID given a module and its local ID number.
Record code for #pragma optimize options.
uint32_t BitOffset
Offset in the AST file.
CXXTemporary * ReadCXXTemporary(ModuleFile &F, const RecordData &Record, unsigned &Idx)
GlobalMethodPool MethodPool
Method Pool - allows efficient lookup when typechecking messages to "id".
Specifies a header that is private to this submodule but must be textually included.
Record code for pending implicit instantiations.
Wrapper for substituted template type parameters.
TypeLocReader(ASTReader &Reader, ModuleFile &F, const ASTReader::RecordData &Record, unsigned &Idx)
CanQualType PseudoObjectTy
The internal '__make_integer_seq' template.
bool needsExtraLocalData() const
void setRParenLoc(SourceLocation Loc)
void setLazyBody(uint64_t Offset)
TemplateArgument ReadTemplateArgument(ModuleFile &F, const RecordData &Record, unsigned &Idx, bool Canonicalize=false)
Read a template argument.
ASTContext & getContext()
Retrieve the AST context that this AST reader supplements.
Decl * getVaListTagDecl() const
Retrieve the C type declaration corresponding to the predefined __va_list_tag type used to help defin...
Record code for #pragma diagnostic mappings.
TypedefDecl * getObjCIdDecl() const
Retrieve the typedef corresponding to the predefined id type in Objective-C.
Record code for floating point #pragma options.
CommentRecordTypes
Record types used within a comments block.
static internal_key_type ReadKey(const unsigned char *d, unsigned n)
void setMustBuildLookupTable()
Mark that there are external lexical declarations that we need to include in our lookup table (and th...
The module file is missing.
void addExternalSource(ExternalSemaSource *E)
Registers an external source.
unsigned IsFromModuleFile
Whether this module was loaded from a module file.
std::string OriginalSourceFileName
The original source file name that was used to build the primary AST file, which may have been modifi...
Wrapper for source info for ObjC interfaces.
Record code for the set of known namespaces, which are used for typo correction.
static bool isDiagnosedResult(ASTReader::ASTReadResult ARR, unsigned Caps)
SourceLocation getFileLoc(SourceLocation Loc) const
Given Loc, if it is a macro location return the expansion location or the spelling location...
Record code for an array of all of the (sub)modules that were imported by the AST file...
The 'unsigned short' type.
serialization::DeclID BaseDeclID
Base declaration ID for declarations local to this module.
Present this diagnostic as an error.
ModuleManager::ModuleIterator ModuleIterator
SourceLocation FirstLoc
The first source location in this module.
void ReadPendingInstantiations(SmallVectorImpl< std::pair< ValueDecl *, SourceLocation > > &Pending) override
Read the set of pending instantiations known to the external Sema source.
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC)...
NestedNameSpecifierLoc getWithLocInContext(ASTContext &Context) const
Retrieve a nested-name-specifier with location information, copied into the given AST context...
const IntrusiveRefCntPtr< DiagnosticIDs > & getDiagnosticIDs() const
A BlockPointerType record.
void setProtocolLoc(unsigned i, SourceLocation Loc)
A MemberPointerType record.
ContinuousRangeMap< uint32_t, int, 2 > SLocRemap
Remapping table for source locations in this module.
void setLocalRangeBegin(SourceLocation L)
void ReadPragmaDiagnosticMappings(DiagnosticsEngine &Diag)
Represents an ObjC class declaration.
This abstract interface provides operations for unwrapping containers for serialized ASTs (precompile...
The AST file itself appears corrupted.
detail::InMemoryDirectory::const_iterator I
FunctionDecl * SourceDecl
The function whose exception specification this is, for EST_Unevaluated and EST_Uninstantiated.
unsigned getNumParams() const
void ReadMismatchingDeleteExpressions(llvm::MapVector< FieldDecl *, llvm::SmallVector< std::pair< SourceLocation, bool >, 4 >> &Exprs) override
uint64_t PreprocessorDetailStartOffset
The offset of the start of the preprocessor detail cursor.
TypedefDecl * getObjCClassDecl() const
Retrieve the typedef declaration corresponding to the predefined Objective-C 'Class' type...
CanQualType UnsignedCharTy
Record code for the table of offsets into the block of source-location information.
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
friend class ASTIdentifierIterator
virtual bool needsInputFileVisitation()
Returns true if this ASTReaderListener wants to receive the input files of the AST file via visitInpu...
A SubstTemplateTypeParmPackType record.
Objective-C "id" redefinition type.
void ReadDelegatingConstructors(SmallVectorImpl< CXXConstructorDecl * > &Decls) override
Read the set of delegating constructors known to the external Sema source.
static std::string ReadString(const RecordData &Record, unsigned &Idx)
TypeCode
Record codes for each kind of type.
Records the location of a macro expansion.
DiagnosticsEngine & getDiagnostics() const
virtual void SelectorRead(serialization::SelectorID iD, Selector Sel)
A selector was read from the AST file.
virtual bool ReadFileSystemOptions(const FileSystemOptions &FSOpts, bool Complain)
Receives the file system options.
void setUnderlyingTInfo(TypeSourceInfo *TI) const
OpenCL 2d image depth type.
std::vector< std::string > ModuleFeatures
The names of any features to enable in module 'requires' decls in addition to the hard-coded list in ...
Class that aids in the construction of nested-name-specifiers along with source-location information ...
unsigned getObjCOrBuiltinID() const
QualType getAutoRRefDeductType() const
C++11 deduction pattern for 'auto &&' type.
QualType getTemplateSpecializationType(TemplateName T, const TemplateArgument *Args, unsigned NumArgs, QualType Canon=QualType()) const
unsigned IsSystem
Whether this is a "system" module (which assumes that all headers in it are system headers)...
The block containing information about the source manager.
IdentifierInfo * GetIdentifierInfo(ModuleFile &M, const RecordData &Record, unsigned &Idx)
The placeholder type for OpenMP array section.
A VariableArrayType record.
const FileEntry * getFile(StringRef Filename, bool OpenFile=false, bool CacheFailure=true)
Lookup, cache, and verify the specified file (real or virtual).
OpenCL 2d image array depth type.
Sema - This implements semantic analysis and AST building for C.
diag::Severity getExtensionHandlingBehavior() const
const unsigned int NUM_PREDEF_PP_ENTITY_IDS
The number of predefined preprocessed entity IDs.
QualType getObjCObjectType(QualType Base, ObjCProtocolDecl *const *Protocols, unsigned NumProtocols) const
Legacy interface: cannot provide type arguments or __kindof.
void setUsedForHeaderGuard(bool Val)
ASTRecordTypes
Record types that occur within the AST block itself.
A little helper class used to produce diagnostics.
static bool parseModuleFileExtensionMetadata(const SmallVectorImpl< uint64_t > &Record, StringRef Blob, ModuleFileExtensionMetadata &Metadata)
Parse a record and blob containing module file extension metadata.
Stmt * GetExternalDeclStmt(uint64_t Offset) override
Resolve the offset of a statement into a statement.
unsigned NumTemplParamLists
NumTemplParamLists - The number of "outer" template parameter lists.
Represents a prototype with parameter type info, e.g.
Defines the major attributes of a submodule, including its name and parent.
llvm::BitstreamCursor Stream
The main bitstream cursor for the main block.
std::string CurrentModule
The name of the current module.
llvm::DenseMap< ModuleFile *, serialization::DeclID > GlobalToLocalDeclIDs
Mapping from the module files that this module file depends on to the base declaration ID for that mo...
Represents a ValueDecl that came out of a declarator.
The "auto &&" deduction type.
ModuleHeaderRole
Flags describing the role of a module header.
ReadMethodPoolVisitor(ASTReader &Reader, Selector Sel, unsigned PriorGeneration)
ModuleKind
Specifies the kind of module that has been loaded.
A dependent template name that has not been resolved to a template (or set of templates).
DeclarationNameTable DeclarationNames
ArraySizeModifier
Capture whether this is a normal array (e.g.
void SetGloballyVisibleDecls(IdentifierInfo *II, const SmallVectorImpl< uint32_t > &DeclIDs, SmallVectorImpl< Decl * > *Decls=nullptr)
Set the globally-visible declarations associated with the given identifier.
std::vector< bool > & Stack
void ReadModuleMapFile(StringRef ModuleMapPath) override
void setSizeExpr(Expr *Size)
unsigned LocalNumSLocEntries
The number of source location entries in this AST file.
void setCFConstantStringType(QualType T)
Captures information about a #pragma weak directive.
void setArgLocInfo(unsigned i, TemplateArgumentLocInfo AI)
QualType getAtomicType(QualType T) const
Return the uniqued reference to the atomic type for the specified type.
static bool isAcceptableASTFile(StringRef Filename, FileManager &FileMgr, const PCHContainerReader &PCHContainerRdr, const LangOptions &LangOpts, const TargetOptions &TargetOpts, const PreprocessorOptions &PPOpts, std::string ExistingModuleCachePath)
Determine whether the given AST file is acceptable to load into a translation unit with the given lan...
ID
Defines the set of possible language-specific address spaces.
Record code for the table of offsets of each macro ID.
const DirectoryEntry * Entry
const uint32_t * TypeOffsets
Offset of each type within the bitstream, indexed by the type ID, or the representation of a Type*...
void resolvePendingMacro(IdentifierInfo *II, const PendingMacroInfo &PMInfo)
QualType getObjCInterfaceType(const ObjCInterfaceDecl *Decl, ObjCInterfaceDecl *PrevDecl=nullptr) const
getObjCInterfaceType - Return the unique reference to the type for the specified ObjC interface decl...
NameKind getNameKind() const
getNameKind - Determine what kind of name this is.
unsigned UsePredefines
Initialize the preprocessor with the compiler and target specific predefines.
void setTemplateNameLoc(SourceLocation Loc)
static NestedNameSpecifier * SuperSpecifier(const ASTContext &Context, CXXRecordDecl *RD)
Returns the nested name specifier representing the __super scope for the given CXXRecordDecl.
bool isInFileID(SourceLocation Loc, FileID FID, unsigned *RelativeOffset=nullptr) const
Given a specific FileID, returns true if Loc is inside that FileID chunk and sets relative offset (of...
serialization::PreprocessedEntityID getGlobalPreprocessedEntityID(ModuleFile &M, unsigned LocalID) const
Determine the global preprocessed entity ID that corresponds to the given local ID within the given m...
QualType getDependentTemplateSpecializationType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, const IdentifierInfo *Name, const TemplateArgumentListInfo &Args) const
A record containing CXXBaseSpecifiers.
ASTReaderListener implementation to validate the information of the PCH file against an initialized P...
uint64_t Signature
The module signature.
CommentOptions CommentOpts
Options for parsing comments.
An TemplateSpecializationType record.
An ObjCObjectPointerType record.
Type source information for an attributed type.
An ObjCInterfaceType record.
QualType getAutoDeductType() const
C++11 deduction pattern for 'auto' type.
const Type * getTypePtrOrNull() const
void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
HeaderFileInfo GetHeaderFileInfo(const FileEntry *FE) override
Read the header file information for the given file entry.
ValueDecl - Represent the declaration of a variable (in which case it is an lvalue) a function (in wh...
Expr - This represents one expression.
unsigned getModuleFileID(ModuleFile *M)
Get an ID for the given module file.
StringRef getName() const
Return the actual identifier string.
Record code for the array of VTable uses.
IncludeDirGroup
IncludeDirGroup - Identifies the group an include Entry belongs to, representing its relative positiv...
The 'char' type, when it is unsigned.
void setHasCommaPasting()
static bool isInterestingIdentifier(ASTReader &Reader, IdentifierInfo &II, bool IsModule)
Whether the given identifier is "interesting".
void setModeAttr(bool written)
SwitchCase * getSwitchCaseWithID(unsigned ID)
Retrieve the switch-case statement with the given ID.
serialization::MacroID getGlobalMacroID(ModuleFile &M, unsigned LocalID)
Retrieve the global macro ID corresponding to the given local ID within the given module file...
The directory that the PCH was originally created in.
DiagnosticBuilder Diag(unsigned DiagID)
Report a diagnostic.
bool isBeforeInTranslationUnit(SourceLocation LHS, SourceLocation RHS) const
Determines the order of 2 source locations in the translation unit.
QualType readType(ModuleFile &F, const RecordData &Record, unsigned &Idx)
Read a type from the current position in the given record, which was read from the given AST file...
Declaration of a template type parameter.
FileID createFileID(const FileEntry *SourceFile, SourceLocation IncludePos, SrcMgr::CharacteristicKind FileCharacter, int LoadedID=0, unsigned LoadedOffset=0)
Create a new FileID that represents the specified file being #included from the specified IncludePosi...
std::string WorkingDir
If set, paths are resolved as if the working directory was set to the value of WorkingDir.
unsigned LocalNumIdentifiers
The number of identifiers in this AST file.
void ReadUsedVTables(SmallVectorImpl< ExternalVTableUse > &VTables) override
Read the set of used vtables known to the external Sema source.
The placeholder type for overloaded function sets.
std::string OMPHostIRFile
Name of the IR file that contains the result of the OpenMP target host code generation.
Implements an efficient mapping from strings to IdentifierInfo nodes.
Defines implementation details of the clang::SourceManager class.
MacroArgs - An instance of this class captures information about the formal arguments specified to a ...
ElaboratedTypeKeyword
The elaboration keyword that precedes a qualified type name or introduces an elaborated-type-specifie...
The template argument is a null pointer or null pointer to member that was provided for a non-type te...
virtual void readModuleFileExtension(const ModuleFileExtensionMetadata &Metadata)
Indicates that a particular module file extension has been read.
TemplateName getOverloadedTemplateName(UnresolvedSetIterator Begin, UnresolvedSetIterator End) const
Retrieve the template name that corresponds to a non-empty lookup.
unsigned ConfigMacrosExhaustive
Whether the set of configuration macros is exhaustive.
Record code for the table of offsets to entries in the preprocessing record.
unsigned LocalNumCXXBaseSpecifiers
The number of C++ base specifier sets in this AST file.
std::unique_ptr< llvm::MemoryBuffer > Buffer
The memory buffer that stores the data associated with this AST file.
Represents a C++ destructor within a class.
ContinuousRangeMap< uint32_t, int, 2 > IdentifierRemap
Remapping table for identifier IDs in this module.
CanQualType OMPArraySectionTy
llvm::BitstreamCursor SLocEntryCursor
Cursor used to read source location entries.
void setInvalidDecl(bool Invalid=true)
setInvalidDecl - Indicates the Decl had a semantic error.
TranslationUnitDecl * getTranslationUnitDecl() const
Defines version macros and version-related utility functions for Clang.
The OpenCL 'half' / ARM NEON __fp16 type.
CanQualType OCLImage2dArrayMSAATy
Defines the clang::Preprocessor interface.
ArgKind
The kind of template argument we're storing.
serialization::DeclID getGlobalDeclID(ModuleFile &F, serialization::LocalDeclID LocalID) const
Map from a local declaration ID within a given module to a global declaration ID. ...
The block containing the detailed preprocessing record.
ArgKind getKind() const
Return the kind of stored template argument.
std::pair< SourceLocation, StringRef > getModuleImportLoc(int ID) override
Retrieve the module import location and module name for the given source manager entry ID...
DeclContext * getDeclContext()
static LineEntry get(unsigned Offs, unsigned Line, int Filename, SrcMgr::CharacteristicKind FileKind, unsigned IncludeOffset)
void setWrittenSignSpec(TypeSpecifierSign written)
llvm::BitstreamCursor InputFilesCursor
The cursor to the start of the input-files block.
OpenCL 2d image MSAA type.
unsigned LocalNumMacros
The number of macros in this AST file.
SourceRange ReadSourceRange(ModuleFile &F, const RecordData &Record, unsigned &Idx)
Read a source range.
A record containing CXXCtorInitializers.
Record code for the original file that was used to generate the AST file, including both its file ID ...
void setRParenLoc(SourceLocation Loc)
Represents a C++ template name within the type system.
llvm::SmallVector< LinkLibrary, 2 > LinkLibraries
The set of libraries or frameworks to link against when an entity from this module is used...
QualType getLocalType(ModuleFile &F, unsigned LocalID)
Resolve a local type ID within a given AST file into a type.
Information about a module that has been loaded by the ASTReader.
A namespace alias, stored as a NamespaceAliasDecl*.
virtual ~ASTReaderListener()
void ReadCounter(const serialization::ModuleFile &M, unsigned Value) override
Receives COUNTER value.
CanQualType UnsignedInt128Ty
An iterator that walks over all of the known identifiers in the lookup table.
SmallVector< uint64_t, 1 > ObjCCategories
The Objective-C category lists for categories known to this module.
void setNameLoc(SourceLocation Loc)
unsigned getInstanceBits() const
void setLParenLoc(SourceLocation Loc)
FileID OriginalSourceFileID
The file ID for the original source file that was used to build this AST file.
A FunctionProtoType record.
void setInheritConstructors(bool Inherit=true)
Set that this base class's constructors should be inherited.
bool HasTimestamps
Whether timestamps are included in this module file.
Describes a source location entry (SLocEntry) for a file.
QualType getAdjustedParameterType(QualType T) const
Perform adjustment on the parameter type of a function.
CanQualType OCLImage2dMSAATy
Wrapper for source info for enum types.
A block containing a module file extension.
bool isInstanceMethod() const
clang::ObjCRuntime ObjCRuntime
std::string FileName
The file name of the module file.
void setUmbrellaHeader(Module *Mod, const FileEntry *UmbrellaHeader, Twine NameAsWritten)
Sets the umbrella header of the given module to the given header.
void setEllipsisLoc(SourceLocation Loc)
Module * getImportedOwningModule() const
Get the imported owning module, if this decl is from an imported (non-local) module.
bool isFromASTFile() const
Determine whether this declaration came from an AST file (such as a precompiled header or module) rat...
Record code for an update to a decl context's lookup table.
CanQualType OCLImage2dArrayDepthTy
void setHasBaseTypeAsWritten(bool HasBaseType)
Record the location of an inclusion directive, such as an #include or #import statement.
bool ReadTargetOptions(const TargetOptions &TargetOpts, bool Complain, bool AllowCompatibleDifferences) override
Receives the target options.
InclusionKind
The kind of inclusion directives known to the preprocessor.
QualType withFastQualifiers(unsigned TQs) const
static OMPLinearClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, OpenMPLinearClauseKind Modifier, SourceLocation ModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL, ArrayRef< Expr * > PL, ArrayRef< Expr * > IL, Expr *Step, Expr *CalcStep)
Creates clause with a list of variables VL and a linear step Step.
SourceLocation createExpansionLoc(SourceLocation Loc, SourceLocation ExpansionLocStart, SourceLocation ExpansionLocEnd, unsigned TokLength, int LoadedID=0, unsigned LoadedOffset=0)
Return a new SourceLocation that encodes the fact that a token from SpellingLoc should actually be re...
struct CXXOpName CXXOperatorName
DeclarationName getDeclName() const
getDeclName - Get the actual, stored name of the declaration, which may be a special name...
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
QualType getSubstTemplateTypeParmPackType(const TemplateTypeParmType *Replaced, const TemplateArgument &ArgPack)
Retrieve a.
void insertOrReplace(const value_type &Val)
void addMethodToGlobalList(ObjCMethodList *List, ObjCMethodDecl *Method)
Add the given method to the list of globally-known methods.
class LLVM_ALIGNAS(8) TemplateSpecializationType unsigned NumArgs
Represents a type template specialization; the template must be a class template, a type alias templa...
void deduplicateMergedDefinitonsFor(NamedDecl *ND)
Clean up the merged definition list.
void StartedDeserializing() override
Notify ASTReader that we started deserialization of a decl or type so until FinishedDeserializing is ...
DirectoryName getUmbrellaDir() const
Retrieve the directory for which this module serves as the umbrella.
void setArgumentList(ArrayRef< IdentifierInfo * > List, llvm::BumpPtrAllocator &PPAllocator)
Set the specified list of identifiers as the argument list for this macro.
BuiltinTemplateDecl * getMakeIntegerSeqDecl() const
The result type of a method or function.
unsigned SLocEntryBaseOffset
The base offset in the source manager's view of this module.
Record code for the table of offsets of each identifier ID.
void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
A type, stored as a Type*.
SmallVector< uint64_t, 16 > PreloadedDeclIDs
Record code for undefined but used functions and variables that need a definition in this TU...
void ReadDeclarationNameInfo(ModuleFile &F, DeclarationNameInfo &NameInfo, const RecordData &Record, unsigned &Idx)
A DependentNameType record.
SmallVector< ObjCMethodDecl *, 2 > Factory
CallingConv
CallingConv - Specifies the calling convention that a function uses.
Record code for the identifier table.
TemplateName getQualifiedTemplateName(NestedNameSpecifier *NNS, bool TemplateKeyword, TemplateDecl *Template) const
Retrieve the template name that represents a qualified template name such as std::vector.
StringRef getTopLevelModuleName() const
Retrieve the name of the top-level module.
The AST file was missing.
NestedNameSpecifier * ReadNestedNameSpecifier(ModuleFile &F, const RecordData &Record, unsigned &Idx)
void AddEntry(FileID FID, const std::vector< LineEntry > &Entries)
Add a new line entry that has already been encoded into the internal representation of the line table...
The placeholder type for bound member functions.
void setIsUsed(bool Val)
Set the value of the IsUsed flag.
The "auto" deduction type.
std::string CPU
If given, the name of the target CPU to generate code for.
bool getSuppressSystemWarnings() const
void overrideFileContents(const FileEntry *SourceFile, llvm::MemoryBuffer *Buffer, bool DoNotFree)
Override the contents of the given source file by providing an already-allocated buffer.
void setStarLoc(SourceLocation Loc)
static TemplateParameterList * Create(const ASTContext &C, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ArrayRef< NamedDecl * > Params, SourceLocation RAngleLoc)
std::vector< std::unique_ptr< ModuleFileExtensionReader > > ExtensionReaders
The list of extension readers that are attached to this module file.
Representation::const_iterator const_iterator
QualType getPackExpansionType(QualType Pattern, Optional< unsigned > NumExpansions)
const unsigned int NUM_PREDEF_IDENT_IDS
The number of predefined identifier IDs.
void setTypeofLoc(SourceLocation Loc)
The Objective-C 'Class' type.
SpecifierKind
The kind of specifier that completes this nested name specifier.
std::pair< Module *, bool > findOrCreateModule(StringRef Name, Module *Parent, bool IsFramework, bool IsExplicit)
Find a new module or submodule, or create it if it does not already exist.
void makeNamesVisible(const HiddenNames &Names, Module *Owner)
Make the names within this set of hidden names visible.
StringRef Next() override
Retrieve the next string in the identifier table and advances the iterator for the following string...
The 'unsigned long long' type.
A template template parameter pack that has been substituted for a template template argument pack...
Wrapper for source info for arrays.
virtual void ExtractPCH(llvm::MemoryBufferRef Buffer, llvm::BitstreamReader &StreamFile) const =0
Initialize an llvm::BitstreamReader with the serialized AST inside the PCH container Buffer...
Record code for the set of source location entries that need to be preloaded by the AST reader...
QualifierInfo - A struct with extended info about a syntactic name qualifier, to be used for the case...
The control block was read successfully.
The list of delegating constructor declarations.
Information about a FileID, basically just the logical file that it represents and include stack info...
void setSourceOrder(int pos)
Set the source order of this initializer.
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
void setAttrOperandParensRange(SourceRange range)
static bool readBit(unsigned &Bits)
void setIsFunctionLike()
Function/Object-likeness.
const unsigned char * SelectorLookupTableData
A pointer to the character data that comprises the selector table.
Encapsulates changes to the "macros namespace" (the location where the macro name became active...
Representation::iterator iterator
bool ReadFullVersionInformation(StringRef FullVersion) override
Receives the full Clang version information.
serialization::TypeID BaseTypeIndex
Base type ID for types local to this module as represented in the global type ID space.
ContinuousRangeMap< uint32_t, int, 2 > SelectorRemap
Remapping table for selector IDs in this module.
std::string ABI
If given, the name of the target ABI to use.
void setASTFile(const FileEntry *File)
Set the serialized AST file for the top-level module of this module.
bool isGlobalIndexUnavailable() const
Determine whether we tried to load the global index, but failed, e.g., because it is out-of-date or d...
bool hasRevertedBuiltin() const
True if setNotBuiltin() was called.
ExceptionSpecificationType Type
The kind of exception specification this is.
void LoadSelector(Selector Sel)
Load a selector from disk, registering its ID if it exists.
void setLAngleLoc(SourceLocation Loc)
serialization::IdentID BaseIdentifierID
Base identifier ID for identifiers local to this module.
MacroInfo * ReadMacroRecord(ModuleFile &F, uint64_t Offset)
Reads the macro record located at the given offset.
const uint32_t * CXXCtorInitializersOffsets
Offset of each C++ ctor initializer list within the bitstream, indexed by the C++ ctor initializer li...
File is a PCH file treated as the preamble.
ContinuousRangeMap< unsigned, int, 2 > SLocRemap
const char * getName() const
static void moveMethodToBackOfGlobalList(Sema &S, ObjCMethodDecl *Method)
Move the given method to the back of the global list of methods.
void MakeSuper(ASTContext &Context, CXXRecordDecl *RD, SourceLocation SuperLoc, SourceLocation ColonColonLoc)
Turns this (empty) nested-name-specifier into '__super' nested-name-specifier.
ExternCContextDecl * getExternCContextDecl() const
Encodes a location in the source.
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
static bool checkHeaderSearchOptions(const HeaderSearchOptions &HSOpts, StringRef SpecificModuleCachePath, StringRef ExistingModuleCachePath, DiagnosticsEngine *Diags, const LangOptions &LangOpts)
Check the header search options deserialized from the control block against the header search options...
const serialization::reader::DeclContextLookupTable * getLoadedLookupTables(DeclContext *Primary) const
Get the loaded lookup tables for Primary, if any.
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
const TemplateArgument * iterator
A record that stores the set of declarations that are visible from a given DeclContext.
File is a PCH file treated as such.
IdentifierInfo * get(StringRef Name) override
Retrieve the IdentifierInfo for the named identifier.
void setLength(unsigned Len)
Specifies a library or framework to link against.
Record code for file ID of the file or buffer that was used to generate the AST file.
Represents a C++ temporary.
Interfaces are the core concept in Objective-C for object oriented design.
void InitializeContext()
Initializes the ASTContext.
Specifies a header that falls into this (sub)module.
std::string ImplicitPCHInclude
The implicit PCH included at the start of the translation unit, or empty.
Record code for the table of offsets to CXXBaseSpecifier sets.
ContinuousRangeMap< uint32_t, int, 2 > SubmoduleRemap
Remapping table for submodule IDs in this module.
void setUsed(bool Used=true)
Record code for special CUDA declarations.
OverloadedOperatorKind getCXXOverloadedOperator() const
getCXXOverloadedOperator - If this name is the name of an overloadable operator in C++ (e...
Options for controlling the compiler diagnostics engine.
A list of "interesting" identifiers.
NameVisibilityKind NameVisibility
The visibility of names within this particular module.
An identifier-lookup iterator that enumerates all of the identifiers stored within a set of AST files...
The block of configuration options, used to check that a module is being used in a configuration comp...
TagDecl - Represents the declaration of a struct/union/class/enum.
TemplateName getDependentTemplateName(NestedNameSpecifier *NNS, const IdentifierInfo *Name) const
Retrieve the template name that represents a dependent template name such as MetaFun::template apply...
void ReadKnownNamespaces(SmallVectorImpl< NamespaceDecl * > &Namespaces) override
Load the set of namespaces that are known to the external source, which will be used during typo corr...
PredefinedTypeIDs
Predefined type IDs.
llvm::BitstreamReader StreamFile
The bitstream reader from which we'll read the AST file.
QualType getDependentSizedArrayType(QualType EltTy, Expr *NumElts, ArrayType::ArraySizeModifier ASM, unsigned IndexTypeQuals, SourceRange Brackets) const
Return a non-unique reference to the type for a dependently-sized array of the specified element type...
All of the names in this module are hidden.
File is an implicitly-loaded module.
IdentifierTable & getIdentifierTable()
void setProtocolRAngleLoc(SourceLocation Loc)
The 'unsigned char' type.
Cached information about one file (either on disk or in the virtual file system). ...
Metadata describing this particular extension.
bool ReadPreprocessorOptions(const PreprocessorOptions &PPOpts, bool Complain, std::string &SuggestedPredefines) override
Receives the preprocessor options.
void setIsC99Varargs()
Varargs querying methods. This can only be set for function-like macros.
MacroInfo * getMacro(serialization::MacroID ID)
Retrieve the macro with the given ID.
uint64_t SizeInBits
The size of this file, in bits.
TemplateParameterList * ReadTemplateParameterList(ModuleFile &F, const RecordData &Record, unsigned &Idx)
Read a template parameter list.
void ProcessWarningOptions(DiagnosticsEngine &Diags, const DiagnosticOptions &Opts, bool ReportDiags=true)
ProcessWarningOptions - Initialize the diagnostic client and process the warning options specified on...
The (signed) 'long' type.
bool isDeclIDFromModule(serialization::GlobalDeclID ID, ModuleFile &M) const
Returns true if global DeclID ID originated from module M.
ModuleReverseIterator rbegin()
Reverse iterator to traverse all loaded modules.
Record code for the offsets of each decl.
void setIdentifierInfo(IdentifierInfo *II)
void ReadMethodPool(Selector Sel) override
Load the contents of the global method pool for a given selector.
void * SelectorLookupTable
A pointer to an on-disk hash table of opaque type ASTSelectorLookupTable.
Metadata for submodules as a whole.
const uint32_t * IdentifierOffsets
Offsets into the identifier table data.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
Class that performs lookup for a selector's entries in the global method pool stored in an AST file...
std::string getClangFullRepositoryVersion()
Retrieves the full repository version that is an amalgamation of the information in getClangRepositor...
Record code for late parsed template functions.
The (signed) 'short' type.
Defines the clang::TargetOptions class.
void MakeGlobal(ASTContext &Context, SourceLocation ColonColonLoc)
Turn this (empty) nested-name-specifier into the global nested-name-specifier '::'.
QualType getIncompleteArrayType(QualType EltTy, ArrayType::ArraySizeModifier ASM, unsigned IndexTypeQuals) const
Return a unique reference to the type for an incomplete array of the specified element type...
void setDefinitionEndLoc(SourceLocation EndLoc)
Set the location of the last token in the macro.
virtual bool ReadFullVersionInformation(StringRef FullVersion)
Receives the full Clang version information.
std::vector< std::string > Features
The list of target specific features to enable or disable – this should be a list of strings starting...
unsigned LocalNumDecls
The number of declarations in this AST file.
unsigned NumFileSortedDecls
The internal 'instancetype' typedef.
OptionsRecordTypes
Record types that occur within the options block inside the control block.
TokenKind
Provides a simple uniform namespace for tokens from all C languages.
void addDecl(NamedDecl *D)
unsigned getNumTypeArgs() const
Describes the categories of an Objective-C class.
uint32_t MacroID
An ID number that refers to a macro in an AST file.
const FileInfo & getFile() const
The AST block, which acts as a container around the full AST block.
RefQualifierKind
The kind of C++11 ref-qualifier associated with a function type.
IdentID ReadIdentifierID(const unsigned char *d)
void setElaboratedKeywordLoc(SourceLocation Loc)
void setWrittenTypeSpec(TypeSpecifierType written)
Objective-C "SEL" redefinition type.
std::vector< std::string > FeaturesAsWritten
The list of target specific features to enable or disable, as written on the command line...
SourceLocation getBegin() const
void setAmpLoc(SourceLocation Loc)
lookup_result lookup(DeclarationName Name) const
lookup - Find the declarations (if any) with the given Name in this context.
void setLBracketLoc(SourceLocation Loc)
QualType getAttributedType(AttributedType::Kind attrKind, QualType modifiedType, QualType equivalentType)
QualType getAutoType(QualType DeducedType, AutoTypeKeyword Keyword, bool IsDependent) const
C++11 deduced auto type.
static bool checkLanguageOptions(const LangOptions &LangOpts, const LangOptions &ExistingLangOpts, DiagnosticsEngine *Diags, bool AllowCompatibleDifferences=true)
Compare the given set of language options against an existing set of language options.
An InjectedClassNameType record.
FileID getMainFileID() const
Returns the FileID of the main source file.
const serialization::DeclID * FileSortedDecls
Array of file-level DeclIDs sorted by file.
Record code for the extra statistics we gather while generating an AST file.
bool getEnableAllWarnings() const
static Decl * getPredefinedDecl(ASTContext &Context, PredefinedDeclIDs ID)
TypedefDecl * getInt128Decl() const
Retrieve the declaration for the 128-bit signed integer type.
virtual void visitImport(StringRef Filename)
If needsImportVisitation returns true, this is called for each AST file imported by this AST file...
static bool checkDiagnosticGroupMappings(DiagnosticsEngine &StoredDiags, DiagnosticsEngine &Diags, bool Complain)
std::vector< InputFile > InputFilesLoaded
The input files that have been loaded from this AST file.
The module file was just loaded in response to this call.
DeclarationName ReadDeclarationName(ModuleFile &F, const RecordData &Record, unsigned &Idx)
Read a declaration name.
HashTableTy::const_iterator iterator
unsigned ComputeHash(Selector Sel)
The AST file was writtten with a different language/target configuration.
ArrayRef< ObjCMethodDecl * > getFactoryMethods() const
Retrieve the instance methods found by this visitor.
const char * HeaderFileInfoTableData
Actual data for the on-disk hash table of header file information.
void markIdentifierUpToDate(IdentifierInfo *II)
Note that this identifier is up-to-date.
const llvm::support::unaligned_uint64_t * InputFileOffsets
Offsets for all of the input file entries in the AST file.
void addArgument(const TemplateArgumentLoc &Loc)
void addHeader(Module *Mod, Module::Header Header, ModuleHeaderRole Role, bool Imported=false)
Adds this header to the given module.
File is a PCH file treated as the actual main file.
llvm::APFloat ReadAPFloat(const RecordData &Record, const llvm::fltSemantics &Sem, unsigned &Idx)
Read a floating-point value.
Record code for referenced selector pool.
bool isLocalSourceLocation(SourceLocation Loc) const
Returns true if Loc did not come from a PCH/Module.
std::vector< std::string > MacroIncludes
The injected class name of a C++ class template or class template partial specialization.
ModuleFile * getLocalModuleFile(ModuleFile &M, unsigned ID)
Retrieve the module file with a given local ID within the specified ModuleFile.
Record code for the set of non-builtin, special types.
QualType getFunctionType(QualType ResultTy, ArrayRef< QualType > Args, const FunctionProtoType::ExtProtoInfo &EPI) const
Return a normal function type with a typed argument list.
QualType getDependentNameType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, const IdentifierInfo *Name, QualType Canon=QualType()) const
DeclarationNameLoc - Additional source/type location info for a declaration name. ...
void setLParenLoc(SourceLocation Loc)
void setTemplateKeywordLoc(SourceLocation Loc)
void setTypeArgsLAngleLoc(SourceLocation Loc)
uint64_t InputFilesValidationTimestamp
If non-zero, specifies the time when we last validated input files.
CanQualType UnsignedShortTy
const uint32_t * MacroOffsets
Offsets of macros in the preprocessor block.
Base class for declarations which introduce a typedef-name.
unsigned LocalNumSelectors
The number of selectors new to this file.
Record code for a decl replacement block.
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
if(T->getSizeExpr()) TRY_TO(TraverseStmt(T-> getSizeExpr()))
Represents a template argument.
Record code for the list of other AST files imported by this AST file.
Selector getLocalSelector(ModuleFile &M, unsigned LocalID)
Retrieve a selector from the given module with its local ID number.
Describes a macro definition within the preprocessing record.
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl.
QualType getMemberPointerType(QualType T, const Type *Cls) const
Return the uniqued reference to the type for a member pointer to the specified type in the specified ...
const ASTTemplateArgumentListInfo * ReadASTTemplateArgumentListInfo(ModuleFile &F, const RecordData &Record, unsigned &Index)
A conflict between two modules.
void setClassTInfo(TypeSourceInfo *TI)
bool ReadSLocEntry(int ID) override
Read the source location entry with index ID.
bool ReadHeaderSearchOptions(const HeaderSearchOptions &HSOpts, StringRef SpecificModuleCachePath, bool Complain) override
Receives the header search options.
Record code for the module name.
Selector getObjCSelector() const
getObjCSelector - Get the Objective-C selector stored in this declaration name.
TemplateName getSubstTemplateTemplateParmPack(TemplateTemplateParmDecl *Param, const TemplateArgument &ArgPack) const
CanQualType ObjCBuiltinIdTy
void ResolveImportedPath(ModuleFile &M, std::string &Filename)
If we are loading a relocatable PCH or module file, and the filename is not an absolute path...
void setDeserializationListener(ASTDeserializationListener *Listener, bool TakeOwnership=false)
Set the AST deserialization listener.
Describes an inclusion directive within the preprocessing record.
The internal '__builtin_ms_va_list' typedef.
llvm::BitstreamCursor DeclsCursor
DeclsCursor - This is a cursor to the start of the DECLS_BLOCK block.
QualType getCanonicalTemplateSpecializationType(TemplateName T, const TemplateArgument *Args, unsigned NumArgs) const
OpenCL 2d image array MSAA type.
not evaluated yet, for special member function
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Record code for a file sorted array of DeclIDs in a module.
void setAmpAmpLoc(SourceLocation Loc)
Record code for the array of Objective-C categories (including extensions).
void updateOutOfDateIdentifier(IdentifierInfo &II) override
Update an out-of-date identifier.
void reserve(ASTContext &C, unsigned N)
Specifies a configuration macro for this module.
void ReadDefinedMacros() override
Read the set of macros defined by this external macro source.
The base class of all kinds of template declarations (e.g., class, function, etc.).
PreprocessorDetailRecordTypes
Record types used within a preprocessor detail block.
static std::pair< GlobalModuleIndex *, ErrorCode > readIndex(StringRef Path)
Read a global index file for the given directory.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
static unsigned moduleKindForDiagnostic(ModuleKind Kind)
bool ReadFileSystemOptions(const FileSystemOptions &FSOpts, bool Complain) override
Receives the file system options.
The basic abstraction for the target Objective-C runtime.
uint64_t MacroStartOffset
The offset of the start of the set of defined macros.
The template argument is a pack expansion of a template name that was provided for a template templat...
Record code for the array of unused file scoped decls.
A FunctionNoProtoType record.
std::vector< llvm::Triple > OMPTargetTriples
Triples of the OpenMP targets that the host code codegen should take into account in order to generat...
static bool SkipCursorToBlock(BitstreamCursor &Cursor, unsigned BlockID)
Given a cursor at the start of an AST file, scan ahead and drop the cursor into the start of the give...
Reads an AST files chain containing the contents of a translation unit.
File is an explicitly-loaded module.
IndirectFieldDecl - An instance of this class is created to represent a field injected from an anonym...
Expr * ReadExpr(ModuleFile &F)
Reads an expression.
bool ReadLanguageOptions(const LangOptions &LangOpts, bool Complain, bool AllowCompatibleDifferences) override
Receives the language options.
ModuleFile & getPrimaryModule()
Returns the primary module associated with the manager, that is, the first module loaded...
CanQualType UnsignedLongLongTy
bool visitInputFile(StringRef Filename, bool isSystem, bool isOverridden, bool isExplicitModule) override
if needsInputFileVisitation returns true, this is called for each non-system input file of the AST Fi...
QualType getEnumType(const EnumDecl *Decl) const
llvm::ErrorOr< std::unique_ptr< llvm::MemoryBuffer > > getBufferForFile(const FileEntry *Entry, bool isVolatile=false, bool ShouldCloseOpenFile=true)
Open the specified file as a MemoryBuffer, returning a new MemoryBuffer if successful, otherwise returning null.
uint64_t ReadCXXCtorInitializersRef(ModuleFile &M, const RecordData &Record, unsigned &Idx)
Read a CXXCtorInitializers ID from the given record and return its global bit offset.
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
DeclarationName - The name of a declaration.
Record code for the Objective-C method pool,.
virtual void ReadModuleMapFile(StringRef ModuleMapPath)
Specifies a header that is private to this submodule.
QualType getObjCObjectPointerType(QualType OIT) const
Return a ObjCObjectPointerType type for the given ObjCObjectType.
bool needsInputFileVisitation() override
Returns true if this ASTReaderListener wants to receive the input files of the AST file via visitInpu...
Describes a macro expansion within the preprocessing record.
QualType getTemplateTypeParmType(unsigned Depth, unsigned Index, bool ParameterPack, TemplateTypeParmDecl *ParmDecl=nullptr) const
Retrieve the template type parameter type for a template parameter or parameter pack with the given d...
Selector getSelector() const
void FindExternalLexicalDecls(const DeclContext *DC, llvm::function_ref< bool(Decl::Kind)> IsKindWeWant, SmallVectorImpl< Decl * > &Decls) override
Read all of the declarations lexically stored in a declaration context.
detail::InMemoryDirectory::const_iterator E
IdentifierTable & getIdentifierTable()
Retrieve the identifier table associated with the preprocessor.
IdentifierResolver IdResolver
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
A map from continuous integer ranges to some value, with a very specialized interface.
Class that performs lookup for an identifier stored in an AST file.
void setExternalSLocEntrySource(ExternalSLocEntrySource *Source)
ContinuousRangeMap< uint32_t, int, 2 > MacroRemap
Remapping table for macro IDs in this module.
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspnd...
An RValueReferenceType record.
void ReadDeclarationNameLoc(ModuleFile &F, DeclarationNameLoc &DNLoc, DeclarationName Name, const RecordData &Record, unsigned &Idx)
A type that was preceded by the 'template' keyword, stored as a Type*.
void ClearSwitchCaseIDs()
void setHasExternalLexicalStorage(bool ES=true)
State whether this DeclContext has external storage for declarations lexically in this context...
unsigned getTotalNumSelectors() const
Returns the number of selectors found in the chain.
unsigned Map[Count]
The type of a lookup table which maps from language-specific address spaces to target-specific ones...
static void PassObjCImplDeclToConsumer(ObjCImplDecl *ImplD, ASTConsumer *Consumer)
Under non-PCH compilation the consumer receives the objc methods before receiving the implementation...
The placeholder type for dependent types.
All of the names in this module are visible.
void setNameLoc(SourceLocation Loc)
Encapsulates the data about a macro definition (e.g.
OpenCL 2d image array type.
Decl * GetExternalDecl(uint32_t ID) override
Resolve a declaration ID into a declaration, potentially building a new declaration.
static std::pair< unsigned, unsigned > ReadKeyDataLength(const unsigned char *&d)
uint32_t getGeneration() const
Get the current generation of this AST source.
FunctionDecl * SourceTemplate
The function template whose exception specification this is instantiated from, for EST_Uninstantiated...
time_t getModificationTime() const
void ReadUnresolvedSet(ModuleFile &F, LazyASTUnresolvedSet &Set, const RecordData &Record, unsigned &Idx)
Read a UnresolvedSet structure.
void setAttrEnumOperandLoc(SourceLocation loc)
struct CXXLitOpName CXXLiteralOperatorName
Abstract interface for callback invocations by the ASTReader.
Location wrapper for a TemplateArgument.
C sigjmp_buf typedef type.
std::vector< Conflict > Conflicts
The list of conflicts.
const T * getAs() const
Member-template getAs<specific type>'.
NestedNameSpecifierLoc ReadNestedNameSpecifierLoc(ModuleFile &F, const RecordData &Record, unsigned &Idx)
std::pair< unsigned, unsigned > findPreprocessedEntitiesInRange(SourceRange Range) override
Returns a pair of [Begin, End) indices of preallocated preprocessed entities that Range encompasses...
Record code for the table of offsets into the Objective-C method pool.
Represents a C++ base or member initializer.
llvm::iterator_range< ModuleConstIterator > pch_modules() const
A range covering the PCH and preamble module files loaded.
A DependentSizedArrayType record.
CanQualType UnsignedLongTy
Record code for the remapping information used to relate loaded modules to the various offsets and ID...
virtual bool needsImportVisitation() const
Returns true if this ASTReaderListener wants to receive the imports of the AST file via visitImport...
bool InstanceHasMoreThanOneDecl
A key used when looking up entities by DeclarationName.
void readModuleFileExtension(const ModuleFileExtensionMetadata &Metadata) override
Indicates that a particular module file extension has been read.
unsigned getNumArgs() const
Record code for declarations that Sema keeps references of.
void ReadTemplateArgumentList(SmallVectorImpl< TemplateArgument > &TemplArgs, ModuleFile &F, const RecordData &Record, unsigned &Idx, bool Canonicalize=false)
Read a template argument array.
void * HeaderFileInfoTable
The on-disk hash table that contains information about each of the header files.
const unsigned int NUM_PREDEF_MACRO_IDS
The number of predefined macro IDs.
bool hasBody() const override
Determine whether this method has a body.
Offsets into the input-files block where input files reside.
bool FactoryHasMoreThanOneDecl
bool ReadLanguageOptions(const LangOptions &LangOpts, bool Complain, bool AllowCompatibleDifferences) override
Receives the language options.
CanQualType ObjCBuiltinClassTy
static std::pair< unsigned, unsigned > ReadKeyDataLength(const unsigned char *&d)
DeclContext * getRedeclContext()
getRedeclContext - Retrieve the context in which an entity conflicts with other entities of the same ...
PreprocessorRecordTypes
Record types used within a preprocessor block.
static bool isExtHandlingFromDiagsError(DiagnosticsEngine &Diags)
CanQualType BoundMemberTy
The block containing the submodule structure.
std::pair< int, unsigned > AllocateLoadedSLocEntries(unsigned NumSLocEntries, unsigned TotalSize)
Allocate a number of loaded SLocEntries, which will be actually loaded on demand from the external so...
void setTypeArgsRAngleLoc(SourceLocation Loc)
Wrapper for source info for record types.
std::string BaseDirectory
The base directory of the module.
ObjCInterfaceDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this Objective-C class.
CanQualType OCLImage2dDepthTy
The template argument is a type.
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
Wraps an ObjCPointerType with source location information.
const uint32_t * CXXBaseSpecifiersOffsets
Offset of each C++ base specifier set within the bitstream, indexed by the C++ base specifier set ID ...
const TypeClass * getTypePtr() const
ContinuousRangeMap< uint32_t, int, 2 > TypeRemap
Remapping table for type IDs in this module.
Selector DecodeSelector(serialization::SelectorID Idx)
ObjCXXARCStandardLibraryKind ObjCXXARCStandardLibrary
The Objective-C++ ARC standard library that we should support, by providing appropriate definitions t...
The template argument is actually a parameter pack.
serialization::PreprocessedEntityID BasePreprocessedEntityID
Base preprocessed entity ID for preprocessed entities local to this module.
Represents a base class of a C++ class.
Cached information about one directory (either on disk or in the virtual file system).
ASTMutationListener * getASTMutationListener() const
Retrieve a pointer to the AST mutation listener associated with this AST context, if any...
uint32_t GetNumExternalSelectors() override
Returns the number of selectors known to the external AST source.
void PrintStats() override
Print some statistics about AST usage.
void insert(const value_type &Val)
ArrayRef< QualType > Exceptions
Explicitly-specified list of exception types.
Keeps track of options that affect how file operations are performed.
unsigned End
Raw source location of end of range.
static bool ReadBlockAbbrevs(llvm::BitstreamCursor &Cursor, unsigned BlockID)
ReadBlockAbbrevs - Enter a subblock of the specified BlockID with the specified cursor.
QualType GetType(serialization::TypeID ID)
Resolve a type ID into a type, potentially building a new type.
void setLoc(SourceLocation L)
setLoc - Sets the main location of the declaration name.
IdentifierInfo * DecodeIdentifierInfo(serialization::IdentifierID ID)
Expr * NoexceptExpr
Noexcept expression, if this is EST_ComputedNoexcept.
NestedNameSpecifierLoc QualifierLoc
virtual bool ReadHeaderSearchOptions(const HeaderSearchOptions &HSOpts, StringRef SpecificModuleCachePath, bool Complain)
Receives the header search options.
QualType getTypedefType(const TypedefNameDecl *Decl, QualType Canon=QualType()) const
Return the unique reference to the type for the specified typedef-name decl.
QualType getTypeOfExprType(Expr *e) const
GCC extension.
bool hasRevertedTokenIDToIdentifier() const
True if revertTokenIDToIdentifier() was called.
void setKWLoc(SourceLocation Loc)
uint32_t PreprocessedEntityID
An ID number that refers to an entity in the detailed preprocessing record.
void FindFileRegionDecls(FileID File, unsigned Offset, unsigned Length, SmallVectorImpl< Decl * > &Decls) override
Get the decls that are contained in a file in the Offset/Length range.
QualType getVariableArrayType(QualType EltTy, Expr *NumElts, ArrayType::ArraySizeModifier ASM, unsigned IndexTypeQuals, SourceRange Brackets) const
Return a non-unique reference to the type for a variable array of the specified element type...
TemplateArgumentLoc ReadTemplateArgumentLoc(ModuleFile &F, const RecordData &Record, unsigned &Idx)
Reads a TemplateArgumentLoc.
unsigned InferSubmodules
Whether we should infer submodules for this module based on the headers.
void setEnd(SourceLocation e)
TemplateArgumentLocInfo GetTemplateArgumentLocInfo(ModuleFile &F, TemplateArgument::ArgKind Kind, const RecordData &Record, unsigned &Idx)
Reads a TemplateArgumentLocInfo appropriate for the given TemplateArgument kind.
Represents a C++ struct/union/class.
BoundNodesTreeBuilder *const Builder
Selector GetExternalSelector(serialization::SelectorID ID) override
Resolve a selector ID into a selector.
static const ASTTemplateArgumentListInfo * Create(ASTContext &C, const TemplateArgumentListInfo &List)
uint32_t SelectorID
An ID number that refers to an ObjC selector in an AST file.
serialization::DeclID ReadDeclID(ModuleFile &F, const RecordData &Record, unsigned &Idx)
Reads a declaration ID from the given position in a record in the given module.
static ASTFileSignature readASTFileSignature(llvm::BitstreamReader &StreamFile)
Reads and return the signature record from StreamFile's control block, or else returns 0...
virtual bool needsSystemInputFileVisitation()
Returns true if this ASTReaderListener wants to receive the system input files of the AST file via vi...
An TemplateTypeParmType record.
llvm::PointerIntPair< Module *, 1, bool > ExportDecl
Describes an exported module.
Decl * D
The template function declaration to be late parsed.
The template argument is a template name that was provided for a template template parameter...
bool needsSystemInputFileVisitation() override
Returns true if this ASTReaderListener wants to receive the system input files of the AST file via vi...
static CXXTemporary * Create(const ASTContext &C, const CXXDestructorDecl *Destructor)
SmallVector< uint64_t, 8 > PragmaDiagMappings
Diagnostic IDs and their mappings that the user changed.
Record code for the filesystem options table.
static hash_value_type ComputeHash(const internal_key_type &a)
Token ReadToken(ModuleFile &M, const RecordDataImpl &Record, unsigned &Idx)
Reads a token out of a record.
const char * IdentifierTableData
Actual data for the on-disk hash table of identifiers.
CanQualType OCLImage1dArrayTy
void setParam(unsigned i, ParmVarDecl *VD)
The width of the "fast" qualifier mask.
bool needsAnonymousDeclarationNumber(const NamedDecl *D)
Determine whether the given declaration needs an anonymous declaration number.
void * Allocate(size_t Size, unsigned Align=8) const
Level
The level of the diagnostic, after it has been through mapping.
void setOutOfDate(bool OOD)
Set whether the information for this identifier is out of date with respect to the external source...
ASTIdentifierIterator(const ASTReader &Reader)
void setLParenLoc(SourceLocation Loc)
const DeclOffset * DeclOffsets
Offset of each declaration within the bitstream, indexed by the declaration ID (-1).
Location information for a TemplateArgument.
virtual bool ReadTargetOptions(const TargetOptions &TargetOpts, bool Complain, bool AllowCompatibleDifferences)
Receives the target options.
Record code for the offsets of each type.
QualType getVectorType(QualType VectorType, unsigned NumElts, VectorType::VectorKind VecKind) const
Return the unique reference to a vector type of the specified element type and size.
The block containing the definitions of all of the types and decls used within the AST file...
The internal '__va_list_tag' struct, if any.
unsigned kind
All of the diagnostics that can be emitted by the frontend.
Record code for the table of offsets to CXXCtorInitializers lists.
virtual void ReadModuleName(StringRef ModuleName)
bool ReadDiagnosticOptions(IntrusiveRefCntPtr< DiagnosticOptions > DiagOpts, bool Complain) override
Receives the diagnostic options.
The module file had already been loaded.
LineTableInfo & getLineTable()
Retrieve the stored line table.
Defines the clang::TargetInfo interface.
The AST file is out-of-date relative to its input files, and needs to be regenerated.
A SourceLocation and its associated SourceManager.
Defines the clang::VersionTuple class, which represents a version in the form major[.minor[.subminor]].
NameVisibilityKind
Describes the visibility of the various names within a particular module.
void setPrevious(MacroDirective *Prev)
Set previous definition of the macro with the same name.
a linked list of methods with the same selector name but different signatures.
OpenCL 2d image array MSAA depth type.
void setRAngleLoc(SourceLocation Loc)
std::pair< ObjCMethodList, ObjCMethodList > GlobalMethods
data_type ReadData(const internal_key_type &k, const unsigned char *d, unsigned DataLen)
Kind
Lists the kind of concrete classes of Decl.
Specifies a required feature.
void adjustExceptionSpec(FunctionDecl *FD, const FunctionProtoType::ExceptionSpecInfo &ESI, bool AsWritten=false)
Change the exception specification on a function once it is delay-parsed, instantiated, or computed.
SourceLocation getSourceLocationForDeclID(serialization::GlobalDeclID ID)
Returns the source location for the decl ID.
std::vector< std::string > ConfigMacros
The set of "configuration macros", which are macros that (intentionally) change how this module is bu...
TagDecl * getDecl() const
Abstracts clang modules and precompiled header files and holds everything needed to generate debug in...
The AST file was written by a different version of Clang.
Record for offsets of DECL_UPDATES records for declarations that were modified after being deserializ...
static bool checkDiagnosticMappings(DiagnosticsEngine &StoredDiags, DiagnosticsEngine &Diags, bool IsSystem, bool Complain)
QualType getDecltypeType(Expr *e, QualType UnderlyingType) const
C++11 decltype.
static void dumpModuleIDMap(StringRef Name, const ContinuousRangeMap< Key, ModuleFile *, InitialCapacity > &Map)
llvm::BitstreamCursor PreprocessorDetailCursor
The cursor to the start of the (optional) detailed preprocessing record block.
QualType getConstantArrayType(QualType EltTy, const llvm::APInt &ArySize, ArrayType::ArraySizeModifier ASM, unsigned IndexTypeQuals) const
Return the unique reference to the type for a constant array of the specified element type...
void setProtocolLAngleLoc(SourceLocation Loc)
DeclContext * getPrimaryContext()
getPrimaryContext - There may be many different declarations of the same entity (including forward de...
void Extend(ASTContext &Context, SourceLocation TemplateKWLoc, TypeLoc TL, SourceLocation ColonColonLoc)
Extend the current nested-name-specifier by another nested-name-specifier component of the form 'type...
SourceLocation getLocForStartOfFile(FileID FID) const
Return the source location corresponding to the first byte of the specified file. ...
ModuleFile * getOwningModuleFile(const Decl *D)
Retrieve the module file that owns the given declaration, or NULL if the declaration is not from a mo...
Contains a late templated function.
Record code for weak undeclared identifiers.
The block containing information about the preprocessor.
TypedefDecl * getObjCSelDecl() const
Retrieve the typedef corresponding to the predefined 'SEL' type in Objective-C.
TypedefDecl * getBuiltinMSVaListDecl() const
Retrieve the C type declaration corresponding to the predefined __builtin_ms_va_list type...
void StartTranslationUnit(ASTConsumer *Consumer) override
Function that will be invoked when we begin parsing a new translation unit involving this external AS...
OpenCL 1d image array type.
void setLocation(SourceLocation L)
bool hadMacroDefinition() const
Returns true if this identifier was #defined to some value at any moment.
uint32_t TypeID
An ID number that refers to a type in an AST file.
unsigned getGlobalID() const
Retrieve the global declaration ID associated with this declaration, which specifies where in the...
Wrapper for source info for builtin types.
void setRParenLoc(SourceLocation Loc)
A set of overloaded template declarations.
Wrapper for template type parameters.
Record code for the headers search options table.
Module * Other
The module that this module conflicts with.
A trivial tuple used to represent a source range.
SourceLocation getLocation() const
std::string ModuleMapPath
NamedDecl - This represents a decl with a name.
void setsigjmp_bufDecl(TypeDecl *sigjmp_bufDecl)
Set the type for the C sigjmp_buf type.
void setFILEDecl(TypeDecl *FILEDecl)
Set the type for the C FILE type.
AST file metadata, including the AST file version number and information about the compiler used to b...
The block of input files, which were used as inputs to create this AST file.
static DeclarationName getUsingDirectiveName()
getUsingDirectiveName - Return name for all using-directives.
Present this diagnostic as a warning.
ObjCMethodList * getNext() const
llvm::BitstreamCursor MacroCursor
The cursor to the start of the preprocessor block, which stores all of the macro definitions.
const uint32_t * SelectorOffsets
Offsets into the selector lookup table's data array where each selector resides.
void UpdateSema()
Update the state of Sema after loading some additional modules.
unsigned LocalNumTypes
The number of types in this AST file.
Level getDiagnosticLevel(unsigned DiagID, SourceLocation Loc) const
Based on the way the client configured the DiagnosticsEngine object, classify the specified diagnosti...
Represents a C++ namespace alias.
void setTemplateNameLoc(SourceLocation Loc)
Kind
The basic Objective-C runtimes that we know about.
static TypeIdx fromTypeID(TypeID ID)
serialization::DeclID mapGlobalIDToModuleFileGlobalID(ModuleFile &M, serialization::DeclID GlobalID)
Map a global declaration ID into the declaration ID used to refer to this declaration within the give...
InputFileRecordTypes
Record types that occur within the input-files block inside the control block.
void ReadUnusedFileScopedDecls(SmallVectorImpl< const DeclaratorDecl * > &Decls) override
Read the set of unused file-scope declarations known to the external Sema source. ...
void FinishedDeserializing() override
Notify ASTReader that we finished the deserialization of a decl or type.
A function-like macro definition.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
The Objective-C 'Protocol' type.
QualType getSubstTemplateTypeParmType(const TemplateTypeParmType *Replaced, QualType Replacement) const
Retrieve a substitution-result type.
The global specifier '::'. There is no stored value.
T * getFETokenInfo() const
getFETokenInfo/setFETokenInfo - The language front-end is allowed to associate arbitrary metadata wit...
The control block, which contains all of the information that needs to be validated prior to committi...
Wrapper for source info for pointers.
std::string Triple
If given, the name of the target triple to compile for.
Wrapper for source info for block pointers.
void ReadModuleName(StringRef ModuleName) override
This class handles loading and caching of source files into memory.
ExceptionSpecInfo ExceptionSpec
PredefinedDeclIDs
Predefined declaration IDs.
Record code for an update to the TU's lexically contained declarations.
A class which abstracts out some details necessary for making a call.
void setElaboratedKeywordLoc(SourceLocation Loc)
Source range/offset of a preprocessed entity.
void visitModuleFile(StringRef Filename, serialization::ModuleKind Kind) override
This is called for each AST file loaded.
const serialization::ObjCCategoriesInfo * ObjCCategoriesMap
Array of category list location information within this module file, sorted by the definition ID...
bool loadGlobalIndex()
Attempts to load the global index.
unsigned LocalNumCXXCtorInitializers
The number of C++ ctor initializer lists in this AST file.
void startToken()
Reset all flags to cleared.
Module * getModule(unsigned ID) override
Retrieve the module that corresponds to the given module ID.
Objective-C "Class" redefinition type.
A PackExpansionType record.
void ReadUnusedLocalTypedefNameCandidates(llvm::SmallSetVector< const TypedefNameDecl *, 4 > &Decls) override
Read the set of potentially unused typedefs known to the source.
A single template declaration.
CanQualType OCLClkEventTy
The pseudo-object placeholder type.
const unsigned int NUM_PREDEF_SUBMODULE_IDS
The number of predefined submodule IDs.
virtual bool ReadDiagnosticOptions(IntrusiveRefCntPtr< DiagnosticOptions > DiagOpts, bool Complain)
Receives the diagnostic options.
unsigned InferExplicitSubmodules
Whether, when inferring submodules, the inferred submodules should be explicit.
void RecordSwitchCaseID(SwitchCase *SC, unsigned ID)
Record that the given ID maps to the given switch-case statement.
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
A DependentTemplateSpecializationType record.
CanQualType UnsignedIntTy
serialization::IdentifierID getGlobalIdentifierID(ModuleFile &M, unsigned LocalID)
Record code for the array of tentative definitions.
static void addMethodsToPool(Sema &S, ArrayRef< ObjCMethodDecl * > Methods, ObjCMethodList &List)
Add the given set of methods to the method list.
bool hasExternalVisibleStorage() const
Whether this DeclContext has external storage containing additional declarations that are visible in ...
static NestedNameSpecifier * GlobalSpecifier(const ASTContext &Context)
Returns the nested name specifier representing the global scope.