96#include "llvm/ADT/APFloat.h"
97#include "llvm/ADT/APInt.h"
98#include "llvm/ADT/APSInt.h"
99#include "llvm/ADT/ArrayRef.h"
100#include "llvm/ADT/DenseMap.h"
101#include "llvm/ADT/FloatingPointMode.h"
102#include "llvm/ADT/FoldingSet.h"
103#include "llvm/ADT/Hashing.h"
104#include "llvm/ADT/IntrusiveRefCntPtr.h"
105#include "llvm/ADT/STLExtras.h"
106#include "llvm/ADT/ScopeExit.h"
107#include "llvm/ADT/Sequence.h"
108#include "llvm/ADT/SmallPtrSet.h"
109#include "llvm/ADT/SmallString.h"
110#include "llvm/ADT/SmallVector.h"
111#include "llvm/ADT/StringExtras.h"
112#include "llvm/ADT/StringMap.h"
113#include "llvm/ADT/StringRef.h"
114#include "llvm/ADT/iterator_range.h"
115#include "llvm/Bitstream/BitstreamReader.h"
116#include "llvm/Support/Casting.h"
117#include "llvm/Support/Compiler.h"
118#include "llvm/Support/Compression.h"
119#include "llvm/Support/DJB.h"
120#include "llvm/Support/Endian.h"
121#include "llvm/Support/Error.h"
122#include "llvm/Support/ErrorHandling.h"
123#include "llvm/Support/FileSystem.h"
124#include "llvm/Support/LEB128.h"
125#include "llvm/Support/MemoryBuffer.h"
126#include "llvm/Support/Path.h"
127#include "llvm/Support/SaveAndRestore.h"
128#include "llvm/Support/TimeProfiler.h"
129#include "llvm/Support/Timer.h"
130#include "llvm/Support/VersionTuple.h"
131#include "llvm/Support/raw_ostream.h"
132#include "llvm/TargetParser/Triple.h"
145#include <system_error>
150using namespace clang;
153using llvm::BitstreamCursor;
161 return First->ReadFullVersionInformation(FullVersion) ||
162 Second->ReadFullVersionInformation(FullVersion);
166 First->ReadModuleName(ModuleName);
167 Second->ReadModuleName(ModuleName);
171 First->ReadModuleMapFile(ModuleMapPath);
172 Second->ReadModuleMapFile(ModuleMapPath);
176 const LangOptions &LangOpts, StringRef ModuleFilename,
bool Complain,
177 bool AllowCompatibleDifferences) {
178 return First->ReadLanguageOptions(LangOpts, ModuleFilename, Complain,
179 AllowCompatibleDifferences) ||
180 Second->ReadLanguageOptions(LangOpts, ModuleFilename, Complain,
181 AllowCompatibleDifferences);
185 const TargetOptions &TargetOpts, StringRef ModuleFilename,
bool Complain,
186 bool AllowCompatibleDifferences) {
187 return First->ReadTargetOptions(TargetOpts, ModuleFilename, Complain,
188 AllowCompatibleDifferences) ||
189 Second->ReadTargetOptions(TargetOpts, ModuleFilename, Complain,
190 AllowCompatibleDifferences);
196 return First->ReadDiagnosticOptions(DiagOpts, ModuleFilename, Complain) ||
197 Second->ReadDiagnosticOptions(DiagOpts, ModuleFilename, Complain);
203 return First->ReadFileSystemOptions(FSOpts, Complain) ||
204 Second->ReadFileSystemOptions(FSOpts, Complain);
209 StringRef SpecificModuleCachePath,
bool Complain) {
210 return First->ReadHeaderSearchOptions(HSOpts, ModuleFilename,
211 SpecificModuleCachePath, Complain) ||
212 Second->ReadHeaderSearchOptions(HSOpts, ModuleFilename,
213 SpecificModuleCachePath, Complain);
218 bool ReadMacros,
bool Complain, std::string &SuggestedPredefines) {
219 return First->ReadPreprocessorOptions(PPOpts, ModuleFilename, ReadMacros,
220 Complain, SuggestedPredefines) ||
221 Second->ReadPreprocessorOptions(PPOpts, ModuleFilename, ReadMacros,
222 Complain, SuggestedPredefines);
227 First->ReadCounter(M,
Value);
228 Second->ReadCounter(M,
Value);
232 return First->needsInputFileVisitation() ||
233 Second->needsInputFileVisitation();
237 return First->needsSystemInputFileVisitation() ||
238 Second->needsSystemInputFileVisitation();
243 First->visitModuleFile(
Filename, Kind);
244 Second->visitModuleFile(
Filename, Kind);
250 bool isExplicitModule) {
251 bool Continue =
false;
252 if (First->needsInputFileVisitation() &&
253 (!isSystem || First->needsSystemInputFileVisitation()))
254 Continue |= First->visitInputFile(
Filename, isSystem, isOverridden,
256 if (Second->needsInputFileVisitation() &&
257 (!isSystem || Second->needsSystemInputFileVisitation()))
258 Continue |= Second->visitInputFile(
Filename, isSystem, isOverridden,
265 First->readModuleFileExtension(Metadata);
266 Second->readModuleFileExtension(Metadata);
285 StringRef ModuleFilename,
287 bool AllowCompatibleDifferences =
true) {
288#define LANGOPT(Name, Bits, Default, Description) \
289 if (ExistingLangOpts.Name != LangOpts.Name) { \
292 Diags->Report(diag::err_ast_file_langopt_mismatch) \
293 << Description << LangOpts.Name << ExistingLangOpts.Name \
296 Diags->Report(diag::err_ast_file_langopt_value_mismatch) \
297 << Description << ModuleFilename; \
302#define VALUE_LANGOPT(Name, Bits, Default, Description) \
303 if (ExistingLangOpts.Name != LangOpts.Name) { \
305 Diags->Report(diag::err_ast_file_langopt_value_mismatch) \
306 << Description << ModuleFilename; \
310#define ENUM_LANGOPT(Name, Type, Bits, Default, Description) \
311 if (ExistingLangOpts.get##Name() != LangOpts.get##Name()) { \
313 Diags->Report(diag::err_ast_file_langopt_value_mismatch) \
314 << Description << ModuleFilename; \
318#define COMPATIBLE_LANGOPT(Name, Bits, Default, Description) \
319 if (!AllowCompatibleDifferences) \
320 LANGOPT(Name, Bits, Default, Description)
322#define COMPATIBLE_ENUM_LANGOPT(Name, Bits, Default, Description) \
323 if (!AllowCompatibleDifferences) \
324 ENUM_LANGOPT(Name, Bits, Default, Description)
326#define COMPATIBLE_VALUE_LANGOPT(Name, Bits, Default, Description) \
327 if (!AllowCompatibleDifferences) \
328 VALUE_LANGOPT(Name, Bits, Default, Description)
330#define BENIGN_LANGOPT(Name, Bits, Default, Description)
331#define BENIGN_ENUM_LANGOPT(Name, Type, Bits, Default, Description)
332#define BENIGN_VALUE_LANGOPT(Name, Bits, Default, Description)
333#include "clang/Basic/LangOptions.def"
337 Diags->
Report(diag::err_ast_file_langopt_value_mismatch)
338 <<
"module features" << ModuleFilename;
344 Diags->
Report(diag::err_ast_file_langopt_value_mismatch)
345 <<
"target Objective-C runtime" << ModuleFilename;
352 Diags->
Report(diag::err_ast_file_langopt_value_mismatch)
353 <<
"block command names" << ModuleFilename;
361 if (!AllowCompatibleDifferences) {
365 ExistingSanitizers.
clear(ModularSanitizers);
366 ImportedSanitizers.
clear(ModularSanitizers);
367 if (ExistingSanitizers.
Mask != ImportedSanitizers.
Mask) {
368 const std::string Flag =
"-fsanitize=";
370#define SANITIZER(NAME, ID) \
372 bool InExistingModule = ExistingSanitizers.has(SanitizerKind::ID); \
373 bool InImportedModule = ImportedSanitizers.has(SanitizerKind::ID); \
374 if (InExistingModule != InImportedModule) \
375 Diags->Report(diag::err_ast_file_targetopt_feature_mismatch) \
376 << InExistingModule << ModuleFilename << (Flag + NAME); \
378#include "clang/Basic/Sanitizers.def"
395 StringRef ModuleFilename,
397 bool AllowCompatibleDifferences =
true) {
398#define CHECK_TARGET_OPT(Field, Name) \
399 if (TargetOpts.Field != ExistingTargetOpts.Field) { \
401 Diags->Report(diag::err_ast_file_targetopt_mismatch) \
402 << ModuleFilename << Name << TargetOpts.Field \
403 << ExistingTargetOpts.Field; \
414 if (!AllowCompatibleDifferences) {
419#undef CHECK_TARGET_OPT
427 llvm::sort(ExistingFeatures);
428 llvm::sort(ReadFeatures);
434 ExistingFeatures.begin(), ExistingFeatures.end(), ReadFeatures.begin(),
435 ReadFeatures.end(), std::back_inserter(UnmatchedExistingFeatures));
436 std::set_difference(ReadFeatures.begin(), ReadFeatures.end(),
437 ExistingFeatures.begin(), ExistingFeatures.end(),
438 std::back_inserter(UnmatchedReadFeatures));
442 if (AllowCompatibleDifferences && UnmatchedReadFeatures.empty())
446 for (StringRef Feature : UnmatchedReadFeatures)
447 Diags->
Report(diag::err_ast_file_targetopt_feature_mismatch)
448 <<
false << ModuleFilename << Feature;
449 for (StringRef Feature : UnmatchedExistingFeatures)
450 Diags->
Report(diag::err_ast_file_targetopt_feature_mismatch)
451 <<
true << ModuleFilename << Feature;
454 return !UnmatchedReadFeatures.empty() || !UnmatchedExistingFeatures.empty();
458 StringRef ModuleFilename,
bool Complain,
459 bool AllowCompatibleDifferences) {
462 Complain ? &Reader.Diags :
nullptr,
463 AllowCompatibleDifferences);
467 StringRef ModuleFilename,
bool Complain,
468 bool AllowCompatibleDifferences) {
471 Complain ? &Reader.Diags :
nullptr,
472 AllowCompatibleDifferences);
477using MacroDefinitionsMap =
478 llvm::StringMap<std::pair<StringRef,
bool >>;
479using DeclsMap = llvm::DenseMap<DeclarationName, SmallVector<NamedDecl *, 8>>;
485 StringRef ModuleFilename,
495 for (
auto DiagIDMappingPair : MappingSource->getDiagnosticMappings()) {
504 Diags.
Report(diag::err_ast_file_diagopt_mismatch)
506 ->getWarningOptionForDiag(DiagID)
526 StringRef ModuleFilename,
bool IsSystem,
527 bool SystemHeaderWarningsInModule,
536 !SystemHeaderWarningsInModule) {
538 Diags.
Report(diag::err_ast_file_diagopt_mismatch)
539 <<
"-Wsystem-headers" << ModuleFilename;
546 Diags.
Report(diag::err_ast_file_diagopt_mismatch)
547 <<
"-Werror" << ModuleFilename;
554 Diags.
Report(diag::err_ast_file_diagopt_mismatch)
555 <<
"-Weverything -Werror" << ModuleFilename;
562 Diags.
Report(diag::err_ast_file_diagopt_mismatch)
563 <<
"-pedantic-errors" << ModuleFilename;
588 assert(!ModuleName.empty() &&
"diagnostic options read before module name");
592 assert(M &&
"missing module");
608 assert(ModuleMgr.
size() >= 1 &&
"what ASTFile is this then");
617 bool SystemHeaderWarningsInModule =
624 TopM->
IsSystem, SystemHeaderWarningsInModule,
632 MacroDefinitionsMap &Macros,
634 for (
unsigned I = 0, N = PPOpts.
Macros.size(); I != N; ++I) {
635 StringRef Macro = PPOpts.
Macros[I].first;
636 bool IsUndef = PPOpts.
Macros[I].second;
638 std::pair<StringRef, StringRef> MacroPair = Macro.split(
'=');
639 StringRef MacroName = MacroPair.first;
640 StringRef MacroBody = MacroPair.second;
644 if (MacroNames && !Macros.count(MacroName))
645 MacroNames->push_back(MacroName);
647 Macros[MacroName] = std::make_pair(
"",
true);
652 if (MacroName.size() == Macro.size())
656 StringRef::size_type End = MacroBody.find_first_of(
"\n\r");
657 MacroBody = MacroBody.substr(0, End);
660 if (MacroNames && !Macros.count(MacroName))
661 MacroNames->push_back(MacroName);
662 Macros[MacroName] = std::make_pair(MacroBody,
false);
686 std::string &SuggestedPredefines,
const LangOptions &LangOpts,
690 MacroDefinitionsMap ASTFileMacros;
692 MacroDefinitionsMap ExistingMacros;
695 &ExistingMacroNames);
699 SuggestedPredefines +=
"# 1 \"<command line>\" 1\n";
701 for (
unsigned I = 0, N = ExistingMacroNames.size(); I != N; ++I) {
703 StringRef MacroName = ExistingMacroNames[I];
704 std::pair<StringRef, bool> Existing = ExistingMacros[MacroName];
707 llvm::StringMap<std::pair<StringRef,
bool >>::iterator Known =
708 ASTFileMacros.find(MacroName);
714 Diags->
Report(diag::err_ast_file_macro_def_undef)
715 << MacroName <<
true << ModuleFilename;
723 if (Existing.second) {
724 SuggestedPredefines +=
"#undef ";
725 SuggestedPredefines += MacroName.str();
726 SuggestedPredefines +=
'\n';
728 SuggestedPredefines +=
"#define ";
729 SuggestedPredefines += MacroName.str();
730 SuggestedPredefines +=
' ';
731 SuggestedPredefines += Existing.first.str();
732 SuggestedPredefines +=
'\n';
739 if (Existing.second != Known->second.second) {
741 Diags->
Report(diag::err_ast_file_macro_def_undef)
742 << MacroName << Known->second.second << ModuleFilename;
749 if (Existing.second || Existing.first == Known->second.first) {
750 ASTFileMacros.erase(Known);
756 Diags->
Report(diag::err_ast_file_macro_def_conflict)
757 << MacroName << Known->second.first << Existing.first
764 SuggestedPredefines +=
"# 1 \"<built-in>\" 2\n";
769 for (
const auto &MacroName : ASTFileMacros.keys()) {
771 Diags->
Report(diag::err_ast_file_macro_def_undef)
772 << MacroName <<
false << ModuleFilename;
783 Diags->
Report(diag::err_ast_file_undef)
790 if (LangOpts.Modules &&
794 Diags->
Report(diag::err_ast_file_pp_detailed_record)
801 for (
unsigned I = 0, N = ExistingPPOpts.
Includes.size(); I != N; ++I) {
808 SuggestedPredefines +=
"#include \"";
809 SuggestedPredefines +=
File;
810 SuggestedPredefines +=
"\"\n";
820 SuggestedPredefines +=
"#include \"";
821 SuggestedPredefines +=
File;
822 SuggestedPredefines +=
"\"\n";
825 for (
unsigned I = 0, N = ExistingPPOpts.
MacroIncludes.size(); I != N; ++I) {
830 SuggestedPredefines +=
"#__include_macros \"";
831 SuggestedPredefines +=
File;
832 SuggestedPredefines +=
"\"\n##\n";
839 StringRef ModuleFilename,
840 bool ReadMacros,
bool Complain,
841 std::string &SuggestedPredefines) {
845 PPOpts, ExistingPPOpts, ModuleFilename, ReadMacros,
852 bool ReadMacros,
bool Complain, std::string &SuggestedPredefines) {
854 ModuleFilename, ReadMacros,
nullptr,
864 StringRef SpecificModuleCachePath,
865 StringRef ExistingModuleCachePath,
866 StringRef ModuleFilename,
871 SpecificModuleCachePath == ExistingModuleCachePath)
874 VFS.equivalent(SpecificModuleCachePath, ExistingModuleCachePath);
875 if (EqualOrErr && *EqualOrErr)
878 Diags->
Report(diag::err_ast_file_modulecache_mismatch)
879 << SpecificModuleCachePath << ExistingModuleCachePath << ModuleFilename;
884 StringRef ModuleFilename,
885 StringRef SpecificModuleCachePath,
890 Complain ? &Reader.Diags :
nullptr, PP.
getLangOpts(),
904 const char *Error =
nullptr;
906 uint64_t Val = llvm::decodeULEB128(
P, &Length,
nullptr, &Error);
908 llvm::report_fatal_error(Error);
914static std::pair<unsigned, unsigned>
917 if ((
unsigned)KeyLen != KeyLen)
918 llvm::report_fatal_error(
"key too large");
921 if ((
unsigned)DataLen != DataLen)
922 llvm::report_fatal_error(
"data too large");
924 return std::make_pair(KeyLen, DataLen);
928 bool TakeOwnership) {
929 DeserializationListener = Listener;
930 OwnsDeserializationListener = TakeOwnership;
941 Reader.ReadModuleOffsetMap(MF);
943 unsigned ModuleFileIndex =
ID.getModuleFileIndex();
950 assert(OwningModuleFile);
954 if (!ModuleFileIndex)
970std::pair<unsigned, unsigned>
977 using namespace llvm::support;
980 unsigned N = endian::readNext<uint16_t, llvm::endianness::little>(d);
982 F, endian::readNext<IdentifierID, llvm::endianness::little>(d));
989 Args.push_back(FirstII);
990 for (
unsigned I = 1; I != N; ++I)
991 Args.push_back(Reader.getLocalIdentifier(
992 F, endian::readNext<IdentifierID, llvm::endianness::little>(d)));
1000 using namespace llvm::support;
1004 Result.ID = Reader.getGlobalSelectorID(
1005 F, endian::readNext<uint32_t, llvm::endianness::little>(d));
1006 unsigned FullInstanceBits =
1007 endian::readNext<uint16_t, llvm::endianness::little>(d);
1008 unsigned FullFactoryBits =
1009 endian::readNext<uint16_t, llvm::endianness::little>(d);
1010 Result.InstanceBits = FullInstanceBits & 0x3;
1011 Result.InstanceHasMoreThanOneDecl = (FullInstanceBits >> 2) & 0x1;
1012 Result.FactoryBits = FullFactoryBits & 0x3;
1013 Result.FactoryHasMoreThanOneDecl = (FullFactoryBits >> 2) & 0x1;
1014 unsigned NumInstanceMethods = FullInstanceBits >> 3;
1015 unsigned NumFactoryMethods = FullFactoryBits >> 3;
1018 for (
unsigned I = 0; I != NumInstanceMethods; ++I) {
1022 endian::readNext<DeclID, llvm::endianness::little>(d))))
1023 Result.Instance.push_back(Method);
1027 for (
unsigned I = 0; I != NumFactoryMethods; ++I) {
1031 endian::readNext<DeclID, llvm::endianness::little>(d))))
1032 Result.Factory.push_back(Method);
1039 return llvm::djbHash(a);
1042std::pair<unsigned, unsigned>
1049 assert(n >= 2 && d[n-1] ==
'\0');
1050 return StringRef((
const char*) d, n-1);
1056 bool IsInteresting =
1067 bool Value = Bits & 0x1;
1073 using namespace llvm::support;
1076 endian::readNext<IdentifierID, llvm::endianness::little>(d);
1077 return Reader.getGlobalIdentifierID(F, RawID >> 1);
1090 const unsigned char* d,
1092 using namespace llvm::support;
1095 endian::readNext<IdentifierID, llvm::endianness::little>(d);
1096 bool IsInteresting = RawID & 0x01;
1106 II = &Reader.getIdentifierTable().getOwn(k);
1109 bool IsModule = Reader.getPreprocessor().getCurrentModule() !=
nullptr;
1111 Reader.markIdentifierUpToDate(II);
1113 IdentifierID ID = Reader.getGlobalIdentifierID(F, RawID);
1114 if (!IsInteresting) {
1117 Reader.SetIdentifierInfo(ID, II);
1121 unsigned ObjCOrBuiltinID =
1122 endian::readNext<uint16_t, llvm::endianness::little>(d);
1123 unsigned Bits = endian::readNext<uint16_t, llvm::endianness::little>(d);
1124 bool CPlusPlusOperatorKeyword =
readBit(Bits);
1125 bool HasRevertedTokenIDToIdentifier =
readBit(Bits);
1126 bool Poisoned =
readBit(Bits);
1127 bool ExtensionToken =
readBit(Bits);
1128 bool HadMacroDefinition =
readBit(Bits);
1130 assert(Bits == 0 &&
"Extra bits in the identifier?");
1131 DataLen -=
sizeof(uint16_t) * 2;
1135 if (HasRevertedTokenIDToIdentifier && II->
getTokenID() != tok::identifier)
1140 "Incorrect extension token flag");
1141 (void)ExtensionToken;
1145 "Incorrect C++ operator keyword flag");
1146 (void)CPlusPlusOperatorKeyword;
1150 if (HadMacroDefinition) {
1151 uint32_t MacroDirectivesOffset =
1152 endian::readNext<uint32_t, llvm::endianness::little>(d);
1155 Reader.addPendingMacro(II, &F, MacroDirectivesOffset);
1158 Reader.SetIdentifierInfo(ID, II);
1164 for (; DataLen > 0; DataLen -=
sizeof(
DeclID))
1165 DeclIDs.push_back(Reader.getGlobalDeclID(
1168 endian::readNext<DeclID, llvm::endianness::little>(d))));
1169 Reader.SetGloballyVisibleDecls(II, DeclIDs);
1176 : Kind(Name.getNameKind()) {
1179 Data = (uint64_t)Name.getAsIdentifierInfo();
1184 Data = (uint64_t)Name.getObjCSelector().getAsOpaquePtr();
1187 Data = Name.getCXXOverloadedOperator();
1190 Data = (uint64_t)Name.getCXXLiteralIdentifier();
1193 Data = (uint64_t)Name.getCXXDeductionGuideTemplate()
1194 ->getDeclName().getAsIdentifierInfo();
1206 llvm::FoldingSetNodeID ID;
1207 ID.AddInteger(Kind);
1230 return ID.computeStableHash();
1234ASTDeclContextNameLookupTrait::ReadFileRef(
const unsigned char *&d) {
1235 using namespace llvm::support;
1237 uint32_t ModuleFileID =
1238 endian::readNext<uint32_t, llvm::endianness::little>(d);
1239 return Reader.getLocalModuleFile(F, ModuleFileID);
1242std::pair<unsigned, unsigned>
1243ASTDeclContextNameLookupTrait::ReadKeyDataLength(
const unsigned char *&d) {
1248ASTDeclContextNameLookupTrait::ReadKey(
const unsigned char *d,
unsigned) {
1249 using namespace llvm::support;
1257 Data = (uint64_t)Reader.getLocalIdentifier(
1258 F, endian::readNext<IdentifierID, llvm::endianness::little>(d));
1263 Data = (uint64_t)Reader
1265 F, endian::readNext<uint32_t, llvm::endianness::little>(d))
1283 const unsigned char *d,
1286 using namespace llvm::support;
1288 for (
unsigned NumDecls = DataLen /
sizeof(
DeclID); NumDecls; --NumDecls) {
1290 Reader, F, endian::readNext<DeclID, llvm::endianness::little>(d));
1291 Val.
insert(Reader.getGlobalDeclID(F, ID));
1295bool ASTReader::ReadLexicalDeclContextStorage(
ModuleFile &M,
1296 BitstreamCursor &Cursor,
1299 assert(Offset != 0);
1302 if (llvm::Error Err = Cursor.JumpToBit(Offset)) {
1303 Error(std::move(Err));
1311 Error(MaybeCode.takeError());
1314 unsigned Code = MaybeCode.get();
1317 if (!MaybeRecCode) {
1318 Error(MaybeRecCode.takeError());
1321 unsigned RecCode = MaybeRecCode.get();
1323 Error(
"Expected lexical block");
1327 assert(!isa<TranslationUnitDecl>(DC) &&
1328 "expected a TU_UPDATE_LEXICAL record for TU");
1333 auto &Lex = LexicalDecls[DC];
1335 Lex = std::make_pair(
1338 Blob.size() /
sizeof(
DeclID)));
1344bool ASTReader::ReadVisibleDeclContextStorage(
ModuleFile &M,
1345 BitstreamCursor &Cursor,
1348 assert(Offset != 0);
1351 if (llvm::Error Err =
Cursor.JumpToBit(Offset)) {
1352 Error(std::move(Err));
1360 Error(MaybeCode.takeError());
1363 unsigned Code = MaybeCode.get();
1366 if (!MaybeRecCode) {
1367 Error(MaybeRecCode.takeError());
1370 unsigned RecCode = MaybeRecCode.get();
1372 Error(
"Expected visible lookup table block");
1378 auto *
Data = (
const unsigned char*)Blob.data();
1379 PendingVisibleUpdates[
ID].push_back(PendingVisibleUpdate{&M,
Data});
1383void ASTReader::Error(StringRef Msg)
const {
1384 Error(diag::err_fe_pch_malformed, Msg);
1385 if (PP.getLangOpts().Modules && !Diags.isDiagnosticInFlight() &&
1386 !PP.getHeaderSearchInfo().getModuleCachePath().empty()) {
1387 Diag(diag::note_module_cache_path)
1388 << PP.getHeaderSearchInfo().getModuleCachePath();
1392void ASTReader::Error(
unsigned DiagID, StringRef Arg1, StringRef Arg2,
1393 StringRef Arg3)
const {
1394 if (Diags.isDiagnosticInFlight())
1395 Diags.SetDelayedDiagnostic(DiagID, Arg1, Arg2, Arg3);
1397 Diag(DiagID) << Arg1 << Arg2 << Arg3;
1400void ASTReader::Error(llvm::Error &&Err)
const {
1401 llvm::Error RemainingErr =
1403 auto Diag =
E.getDiagnostic().second;
1408 assert(NumArgs <= 3 &&
"Can only have up to 3 arguments");
1409 StringRef Arg1, Arg2, Arg3;
1412 Arg3 =
Diag.getStringArg(2);
1415 Arg2 =
Diag.getStringArg(1);
1418 Arg1 =
Diag.getStringArg(0);
1420 Error(
Diag.getDiagID(), Arg1, Arg2, Arg3);
1436 std::map<int, int> FileIDs;
1438 for (
unsigned I = 0;
Record[Idx]; ++I) {
1446 std::vector<LineEntry> Entries;
1447 while (Idx <
Record.size()) {
1451 unsigned NumEntries =
Record[Idx++];
1452 assert(NumEntries &&
"no line entries for file ID");
1454 Entries.reserve(NumEntries);
1455 for (
unsigned I = 0; I != NumEntries; ++I) {
1456 unsigned FileOffset =
Record[Idx++];
1457 unsigned LineNo =
Record[Idx++];
1458 int FilenameID = FileIDs[
Record[Idx++]];
1461 unsigned IncludeOffset =
Record[Idx++];
1463 FileKind, IncludeOffset));
1470llvm::Error ASTReader::ReadSourceManagerBlock(
ModuleFile &F) {
1471 using namespace SrcMgr;
1479 SLocEntryCursor = F.
Stream;
1482 if (llvm::Error Err = F.
Stream.SkipBlock())
1493 SLocEntryCursor.advanceSkippingSubblocks();
1495 return MaybeE.takeError();
1496 llvm::BitstreamEntry
E = MaybeE.get();
1499 case llvm::BitstreamEntry::SubBlock:
1500 case llvm::BitstreamEntry::Error:
1501 return llvm::createStringError(std::errc::illegal_byte_sequence,
1502 "malformed block record in AST file");
1503 case llvm::BitstreamEntry::EndBlock:
1504 return llvm::Error::success();
1505 case llvm::BitstreamEntry::Record:
1514 SLocEntryCursor.readRecord(
E.ID,
Record, &Blob);
1516 return MaybeRecord.takeError();
1517 switch (MaybeRecord.get()) {
1525 return llvm::Error::success();
1536 return std::move(Err);
1540 return MaybeEntry.takeError();
1542 llvm::BitstreamEntry Entry = MaybeEntry.get();
1543 if (Entry.Kind != llvm::BitstreamEntry::Record)
1544 return llvm::createStringError(
1545 std::errc::illegal_byte_sequence,
1546 "incorrectly-formatted source location entry in AST file");
1552 return MaybeSLOC.takeError();
1554 switch (MaybeSLOC.get()) {
1556 return llvm::createStringError(
1557 std::errc::illegal_byte_sequence,
1558 "incorrectly-formatted source location entry in AST file");
1568 GlobalSLocOffsetMap.find(SourceManager::MaxLoadedOffset - SLocOffset - 1);
1569 assert(SLocMapI != GlobalSLocOffsetMap.end() &&
1570 "Corrupted global sloc offset map");
1575 auto It = llvm::upper_bound(
1578 int ID = F->SLocEntryBaseID + LocalIndex;
1579 std::size_t Index = -ID - 2;
1580 if (!SourceMgr.SLocEntryOffsetLoaded[Index]) {
1581 assert(!SourceMgr.SLocEntryLoaded[Index]);
1582 auto MaybeEntryOffset = readSLocOffset(F, LocalIndex);
1583 if (!MaybeEntryOffset) {
1584 Error(MaybeEntryOffset.takeError());
1588 SourceMgr.LoadedSLocEntryTable[Index] =
1589 SrcMgr::SLocEntry::getOffsetOnly(*MaybeEntryOffset);
1590 SourceMgr.SLocEntryOffsetLoaded[Index] = true;
1592 return Offset < SourceMgr.LoadedSLocEntryTable[Index].getOffset();
1607 if (
unsigned(-ID) - 2 >= getTotalNumSLocs() || ID > 0) {
1608 Error(
"source location entry ID out-of-range for AST file");
1614 auto ReadBuffer = [
this](
1615 BitstreamCursor &SLocEntryCursor,
1616 StringRef Name) -> std::unique_ptr<llvm::MemoryBuffer> {
1621 Error(MaybeCode.takeError());
1624 unsigned Code = MaybeCode.get();
1627 SLocEntryCursor.readRecord(Code,
Record, &Blob);
1628 if (!MaybeRecCode) {
1629 Error(MaybeRecCode.takeError());
1632 unsigned RecCode = MaybeRecCode.get();
1637 const llvm::compression::Format F =
1638 Blob.size() > 0 && Blob.data()[0] == 0x78
1639 ? llvm::compression::Format::Zlib
1640 : llvm::compression::Format::Zstd;
1641 if (
const char *Reason = llvm::compression::getReasonIfUnsupported(F)) {
1646 if (llvm::Error
E = llvm::compression::decompress(
1647 F, llvm::arrayRefFromStringRef(Blob), Decompressed,
Record[0])) {
1648 Error(
"could not decompress embedded file contents: " +
1649 llvm::toString(std::move(
E)));
1652 return llvm::MemoryBuffer::getMemBufferCopy(
1653 llvm::toStringRef(Decompressed), Name);
1655 return llvm::MemoryBuffer::getMemBuffer(Blob.drop_back(1), Name,
true);
1657 Error(
"AST record has invalid code");
1662 ModuleFile *F = GlobalSLocEntryMap.find(-ID)->second;
1666 Error(std::move(Err));
1673 ++NumSLocEntriesRead;
1676 Error(MaybeEntry.takeError());
1679 llvm::BitstreamEntry Entry = MaybeEntry.get();
1681 if (Entry.Kind != llvm::BitstreamEntry::Record) {
1682 Error(
"incorrectly-formatted source location entry in AST file");
1689 SLocEntryCursor.readRecord(Entry.ID,
Record, &Blob);
1691 Error(MaybeSLOC.takeError());
1694 switch (MaybeSLOC.get()) {
1696 Error(
"incorrectly-formatted source location entry in AST file");
1702 unsigned InputID =
Record[4];
1703 InputFile IF = getInputFile(*F, InputID);
1716 IncludeLoc = getImportLocation(F);
1720 FileID FID = SourceMgr.createFileID(*
File, IncludeLoc, FileCharacter, ID,
1723 FileInfo.NumCreatedFIDs =
Record[5];
1727 unsigned NumFileDecls =
Record[7];
1728 if (NumFileDecls && ContextObj) {
1730 assert(F->
FileSortedDecls &&
"FILE_SORTED_DECLS not encountered yet ?");
1736 SourceMgr.getOrCreateContentCache(*
File, isSystem(FileCharacter));
1740 auto Buffer = ReadBuffer(SLocEntryCursor,
File->getName());
1743 SourceMgr.overrideFileContents(*
File, std::move(Buffer));
1750 const char *Name = Blob.data();
1751 unsigned Offset =
Record[0];
1756 IncludeLoc = getImportLocation(F);
1759 auto Buffer = ReadBuffer(SLocEntryCursor, Name);
1762 FileID FID = SourceMgr.createFileID(std::move(Buffer), FileCharacter, ID,
1763 BaseOffset + Offset, IncludeLoc);
1765 auto &FileInfo = SourceMgr.getSLocEntry(FID).getFile();
1766 FileInfo.setHasLineDirectives();
1776 SourceMgr.createExpansionLoc(SpellingLoc, ExpansionBegin, ExpansionEnd,
1790 if (
unsigned(-ID) - 2 >= getTotalNumSLocs() || ID > 0) {
1791 Error(
"source location entry ID out-of-range for AST file");
1796 ModuleFile *M = GlobalSLocEntryMap.find(-ID)->second;
1814 assert(SourceMgr.getMainFileID().isValid() &&
"missing main file");
1815 return SourceMgr.getLocForStartOfFile(SourceMgr.getMainFileID());
1825 uint64_t *StartOfBlockOffset) {
1826 if (llvm::Error Err = Cursor.EnterSubBlock(BlockID))
1829 if (StartOfBlockOffset)
1830 *StartOfBlockOffset = Cursor.GetCurrentBitNo();
1833 uint64_t Offset = Cursor.GetCurrentBitNo();
1836 return MaybeCode.takeError();
1837 unsigned Code = MaybeCode.get();
1840 if (Code != llvm::bitc::DEFINE_ABBREV) {
1841 if (llvm::Error Err = Cursor.JumpToBit(Offset))
1843 return llvm::Error::success();
1845 if (llvm::Error Err = Cursor.ReadAbbrevRecord())
1861 case tok::annot_pragma_loop_hint: {
1864 Info->Option = ReadToken(M,
Record, Idx);
1865 unsigned NumTokens =
Record[Idx++];
1867 Toks.reserve(NumTokens);
1868 for (
unsigned I = 0; I < NumTokens; ++I)
1869 Toks.push_back(ReadToken(M,
Record, Idx));
1870 Info->Toks =
llvm::ArrayRef(Toks).copy(PP.getPreprocessorAllocator());
1874 case tok::annot_pragma_pack: {
1877 auto SlotLabel = ReadString(
Record, Idx);
1879 llvm::StringRef(SlotLabel).copy(PP.getPreprocessorAllocator());
1880 Info->Alignment = ReadToken(M,
Record, Idx);
1885 case tok::annot_pragma_openmp:
1886 case tok::annot_pragma_openmp_end:
1887 case tok::annot_pragma_unused:
1888 case tok::annot_pragma_openacc:
1889 case tok::annot_pragma_openacc_end:
1890 case tok::annot_repl_input_end:
1893 llvm_unreachable(
"missing deserialization code for annotation token");
1910 if (llvm::Error Err = Stream.JumpToBit(Offset)) {
1912 consumeError(std::move(Err));
1924 unsigned Flags = BitstreamCursor::AF_DontPopBlockAtEnd;
1926 Stream.advanceSkippingSubblocks(Flags);
1928 Error(MaybeEntry.takeError());
1931 llvm::BitstreamEntry Entry = MaybeEntry.get();
1933 switch (Entry.Kind) {
1934 case llvm::BitstreamEntry::SubBlock:
1935 case llvm::BitstreamEntry::Error:
1936 Error(
"malformed block record in AST file");
1938 case llvm::BitstreamEntry::EndBlock:
1940 case llvm::BitstreamEntry::Record:
1951 Error(MaybeRecType.takeError());
1967 unsigned NextIndex = 1;
1974 PP.getPreprocessorAllocator());
1977 bool isC99VarArgs =
Record[NextIndex++];
1978 bool isGNUVarArgs =
Record[NextIndex++];
1979 bool hasCommaPasting =
Record[NextIndex++];
1980 MacroParams.clear();
1981 unsigned NumArgs =
Record[NextIndex++];
1982 for (
unsigned i = 0; i != NumArgs; ++i)
1983 MacroParams.push_back(getLocalIdentifier(F,
Record[NextIndex++]));
1997 if (NextIndex + 1 ==
Record.size() && PP.getPreprocessingRecord() &&
2001 GlobalID = getGlobalPreprocessedEntityID(F,
Record[NextIndex]);
2003 PreprocessingRecord::PPEntityID PPID =
2004 PPRec.getPPEntityID(GlobalID - 1,
true);
2006 PPRec.getPreprocessedEntity(PPID));
2008 PPRec.RegisterMacroDefinition(Macro, PPDef);
2019 if (MacroTokens.empty()) {
2020 Error(
"unexpected number of macro tokens for a macro in AST file");
2025 MacroTokens[0] = ReadToken(F,
Record, Idx);
2026 MacroTokens = MacroTokens.drop_front();
2035 unsigned LocalID)
const {
2037 ReadModuleOffsetMap(M);
2042 &&
"Invalid index into preprocessed entity index remap");
2044 return LocalID + I->second;
2047const FileEntry *HeaderFileInfoTrait::getFile(
const internal_key_type &Key) {
2049 if (!Key.Imported) {
2055 std::string Resolved = std::string(Key.Filename);
2056 Reader.ResolveImportedPath(M, Resolved);
2063 uint8_t buf[
sizeof(ikey.
Size) +
sizeof(ikey.
ModTime)];
2066 return llvm::xxh3_64bits(buf);
2087 return FEA && FEA == FEB;
2090std::pair<unsigned, unsigned>
2091HeaderFileInfoTrait::ReadKeyDataLength(
const unsigned char*& d) {
2096HeaderFileInfoTrait::ReadKey(
const unsigned char *d,
unsigned) {
2097 using namespace llvm::support;
2100 ikey.
Size = off_t(endian::readNext<uint64_t, llvm::endianness::little>(d));
2102 time_t(endian::readNext<uint64_t, llvm::endianness::little>(d));
2111 using namespace llvm::support;
2113 const unsigned char *End = d + DataLen;
2115 unsigned Flags = *d++;
2117 bool Included = (Flags >> 6) & 0x01;
2122 Reader.getPreprocessor().getIncludedFiles().insert(FE);
2125 HFI.
isImport |= (Flags >> 5) & 0x01;
2127 HFI.
DirInfo = (Flags >> 1) & 0x07;
2130 M, endian::readNext<IdentifierID, llvm::endianness::little>(d));
2131 if (
unsigned FrameworkOffset =
2132 endian::readNext<uint32_t, llvm::endianness::little>(d)) {
2135 StringRef FrameworkName(FrameworkStrings + FrameworkOffset - 1);
2136 HFI.
Framework = HS->getUniqueFrameworkName(FrameworkName);
2139 assert((End - d) % 4 == 0 &&
2140 "Wrong data length in HeaderFileInfo deserialization");
2142 uint32_t LocalSMID =
2143 endian::readNext<uint32_t, llvm::endianness::little>(d);
2149 SubmoduleID GlobalSMID = Reader.getGlobalSubmoduleID(M, LocalSMID);
2150 Module *Mod = Reader.getSubmodule(GlobalSMID);
2153 Reader.getPreprocessor().getHeaderSearchInfo().getModuleMap();
2157 Reader.ResolveImportedPath(M,
Filename);
2161 ModMap.
addHeader(Mod, H, HeaderRole,
true);
2173 uint32_t MacroDirectivesOffset) {
2174 assert(NumCurrentElementsDeserializing > 0 &&
"Missing deserialization guard");
2175 PendingMacroIDs[II].push_back(PendingMacroInfo(M, MacroDirectivesOffset));
2182 for (
ModuleFile &I : llvm::reverse(ModuleMgr)) {
2183 BitstreamCursor &MacroCursor = I.MacroCursor;
2186 if (MacroCursor.getBitcodeBytes().empty())
2189 BitstreamCursor Cursor = MacroCursor;
2190 if (llvm::Error Err = Cursor.JumpToBit(I.MacroStartOffset)) {
2191 Error(std::move(Err));
2199 Error(MaybeE.takeError());
2202 llvm::BitstreamEntry
E = MaybeE.get();
2205 case llvm::BitstreamEntry::SubBlock:
2206 case llvm::BitstreamEntry::Error:
2207 Error(
"malformed block record in AST file");
2209 case llvm::BitstreamEntry::EndBlock:
2212 case llvm::BitstreamEntry::Record: {
2216 Error(MaybeRecord.takeError());
2219 switch (MaybeRecord.get()) {
2227 updateOutOfDateIdentifier(*II);
2246 class IdentifierLookupVisitor {
2249 unsigned PriorGeneration;
2250 unsigned &NumIdentifierLookups;
2251 unsigned &NumIdentifierLookupHits;
2255 IdentifierLookupVisitor(StringRef Name,
unsigned PriorGeneration,
2256 unsigned &NumIdentifierLookups,
2257 unsigned &NumIdentifierLookupHits)
2259 PriorGeneration(PriorGeneration),
2260 NumIdentifierLookups(NumIdentifierLookups),
2261 NumIdentifierLookupHits(NumIdentifierLookupHits) {}
2275 ++NumIdentifierLookups;
2276 ASTIdentifierLookupTable::iterator Pos =
2277 IdTable->find_hashed(Name, NameHash, &Trait);
2278 if (Pos == IdTable->end())
2284 ++NumIdentifierLookupHits;
2300 unsigned PriorGeneration = 0;
2301 if (getContext().getLangOpts().Modules)
2302 PriorGeneration = IdentifierGeneration[&II];
2308 if (!loadGlobalIndex()) {
2309 if (GlobalIndex->lookupIdentifier(II.
getName(), Hits)) {
2314 IdentifierLookupVisitor Visitor(II.
getName(), PriorGeneration,
2315 NumIdentifierLookups,
2316 NumIdentifierLookupHits);
2317 ModuleMgr.visit(Visitor, HitsPtr);
2318 markIdentifierUpToDate(&II);
2328 if (getContext().getLangOpts().Modules)
2329 IdentifierGeneration[II] = getGeneration();
2333 const PendingMacroInfo &PMInfo) {
2338 if (llvm::Error Err =
2340 Error(std::move(Err));
2344 struct ModuleMacroRecord {
2357 Cursor.advance(BitstreamCursor::AF_DontPopBlockAtEnd);
2359 Error(MaybeEntry.takeError());
2362 llvm::BitstreamEntry Entry = MaybeEntry.get();
2364 if (Entry.Kind != llvm::BitstreamEntry::Record) {
2365 Error(
"malformed block record in AST file");
2372 Error(MaybePP.takeError());
2380 ModuleMacros.push_back(ModuleMacroRecord());
2381 auto &Info = ModuleMacros.back();
2382 Info.SubModID = getGlobalSubmoduleID(M,
Record[0]);
2383 Info.MI = getMacro(getGlobalMacroID(M,
Record[1]));
2384 for (
int I = 2, N =
Record.size(); I != N; ++I)
2385 Info.Overrides.push_back(getGlobalSubmoduleID(M,
Record[I]));
2390 Error(
"malformed block record in AST file");
2401 std::reverse(ModuleMacros.begin(), ModuleMacros.end());
2403 for (
auto &MMR : ModuleMacros) {
2405 for (
unsigned ModID : MMR.Overrides) {
2406 Module *Mod = getSubmodule(ModID);
2407 auto *Macro = PP.getModuleMacro(Mod, II);
2408 assert(Macro &&
"missing definition for overridden macro");
2409 Overrides.push_back(Macro);
2412 bool Inserted =
false;
2413 Module *Owner = getSubmodule(MMR.SubModID);
2414 PP.addModuleMacro(Owner, II, MMR.MI, Overrides, Inserted);
2425 unsigned Idx = 0, N =
Record.size();
2433 MD = PP.AllocateDefMacroDirective(MI,
Loc);
2437 MD = PP.AllocateUndefMacroDirective(
Loc);
2440 bool isPublic =
Record[Idx++];
2441 MD = PP.AllocateVisibilityMacroDirective(
Loc, isPublic);
2453 PP.setLoadedMacroDirective(II, Earliest, Latest);
2456bool ASTReader::shouldDisableValidationForFile(
2494 consumeError(std::move(Err));
2500 consumeError(MaybeCode.takeError());
2502 unsigned Code = MaybeCode.get();
2508 "invalid record type for input file");
2511 consumeError(Maybe.takeError());
2514 assert(
Record[0] == ID &&
"Bogus stored ID or offset");
2523 uint16_t AsRequestedLength =
Record[7];
2525 std::string NameAsRequested = Blob.substr(0, AsRequestedLength).str();
2526 std::string Name = Blob.substr(AsRequestedLength).str();
2528 ResolveImportedPath(F, NameAsRequested);
2529 ResolveImportedPath(F, Name);
2532 Name = NameAsRequested;
2534 return std::make_pair(std::move(NameAsRequested), std::move(Name));
2539 consumeError(MaybeEntry.takeError());
2540 llvm::BitstreamEntry Entry = MaybeEntry.get();
2541 assert(Entry.Kind == llvm::BitstreamEntry::Record &&
2542 "expected record type for input file hash");
2547 "invalid record type for input file hash");
2550 consumeError(Maybe.takeError());
2579 consumeError(std::move(Err));
2594 PP.getHeaderSearchInfo().getHeaderSearchOpts();
2607 if ((Overridden || Transient || SkipChecks) && !
File)
2612 std::string ErrorStr =
"could not find file '";
2614 ErrorStr +=
"' referenced by AST file '";
2630 if ((!Overridden && !Transient) && !SkipChecks &&
2631 SM.isFileOverridden(*
File)) {
2645 enum ModificationKind {
2651 std::optional<int64_t> Old = std::nullopt;
2652 std::optional<int64_t> New = std::nullopt;
2654 auto HasInputContentChanged = [&](Change OriginalChange) {
2655 assert(ValidateASTInputFilesContent &&
2656 "We should only check the content of the inputs with "
2657 "ValidateASTInputFilesContent enabled.");
2659 if (StoredContentHash == 0)
2660 return OriginalChange;
2663 if (!MemBuffOrError) {
2665 return OriginalChange;
2666 std::string ErrorStr =
"could not get buffer for file '";
2667 ErrorStr +=
File->getName();
2670 return OriginalChange;
2673 auto ContentHash = xxh3_64bits(MemBuffOrError.get()->getBuffer());
2674 if (StoredContentHash ==
static_cast<uint64_t>(ContentHash))
2675 return Change{Change::None};
2677 return Change{Change::Content};
2679 auto HasInputFileChanged = [&]() {
2680 if (StoredSize !=
File->getSize())
2681 return Change{Change::Size, StoredSize,
File->getSize()};
2682 if (!shouldDisableValidationForFile(F) && StoredTime &&
2683 StoredTime !=
File->getModificationTime()) {
2684 Change MTimeChange = {Change::ModTime, StoredTime,
2685 File->getModificationTime()};
2689 if (ValidateASTInputFilesContent)
2690 return HasInputContentChanged(MTimeChange);
2694 return Change{Change::None};
2697 bool IsOutOfDate =
false;
2698 auto FileChange = SkipChecks ? Change{Change::None} : HasInputFileChanged();
2704 FileChange = HasInputContentChanged(FileChange);
2710 if (!StoredTime && ValidateASTInputFilesContent &&
2711 FileChange.Kind == Change::None)
2712 FileChange = HasInputContentChanged(FileChange);
2715 if (!Overridden && FileChange.Kind != Change::None) {
2716 if (Complain && !Diags.isDiagnosticInFlight()) {
2719 while (!ImportStack.back()->ImportedBy.empty())
2720 ImportStack.push_back(ImportStack.back()->ImportedBy[0]);
2723 StringRef TopLevelPCHName(ImportStack.back()->FileName);
2724 Diag(diag::err_fe_ast_file_modified)
2726 << TopLevelPCHName << FileChange.Kind
2727 << (FileChange.Old && FileChange.New)
2728 << llvm::itostr(FileChange.Old.value_or(0))
2729 << llvm::itostr(FileChange.New.value_or(0));
2732 if (ImportStack.size() > 1) {
2733 Diag(diag::note_pch_required_by)
2734 <<
Filename << ImportStack[0]->FileName;
2735 for (
unsigned I = 1; I < ImportStack.size(); ++I)
2736 Diag(diag::note_pch_required_by)
2737 << ImportStack[I-1]->FileName << ImportStack[I]->FileName;
2740 Diag(diag::note_pch_rebuild_required) << TopLevelPCHName;
2770 llvm::sys::path::append(Buffer, Prefix,
Filename);
2771 Filename.assign(Buffer.begin(), Buffer.end());
2786 llvm_unreachable(
"unknown ASTReadResult");
2790 BitstreamCursor &Stream, StringRef
Filename,
2791 unsigned ClientLoadCapabilities,
bool AllowCompatibleConfigurationMismatch,
2795 consumeError(std::move(Err));
2806 consumeError(MaybeEntry.takeError());
2809 llvm::BitstreamEntry Entry = MaybeEntry.get();
2811 switch (Entry.Kind) {
2812 case llvm::BitstreamEntry::Error:
2813 case llvm::BitstreamEntry::SubBlock:
2816 case llvm::BitstreamEntry::EndBlock:
2819 case llvm::BitstreamEntry::Record:
2827 if (!MaybeRecordType) {
2829 consumeError(MaybeRecordType.takeError());
2834 bool Complain = (ClientLoadCapabilities & ARR_ConfigurationMismatch) == 0;
2836 AllowCompatibleConfigurationMismatch))
2837 Result = ConfigurationMismatch;
2842 bool Complain = (ClientLoadCapabilities & ARR_ConfigurationMismatch) == 0;
2844 AllowCompatibleConfigurationMismatch))
2845 Result = ConfigurationMismatch;
2850 bool Complain = (ClientLoadCapabilities & ARR_ConfigurationMismatch) == 0;
2851 if (!AllowCompatibleConfigurationMismatch &&
2852 ParseFileSystemOptions(
Record, Complain, Listener))
2853 Result = ConfigurationMismatch;
2858 bool Complain = (ClientLoadCapabilities & ARR_ConfigurationMismatch) == 0;
2859 if (!AllowCompatibleConfigurationMismatch &&
2861 Result = ConfigurationMismatch;
2866 bool Complain = (ClientLoadCapabilities & ARR_ConfigurationMismatch) == 0;
2867 if (!AllowCompatibleConfigurationMismatch &&
2869 SuggestedPredefines))
2870 Result = ConfigurationMismatch;
2880 unsigned ClientLoadCapabilities) {
2881 BitstreamCursor &Stream = F.
Stream;
2884 Error(std::move(Err));
2894 bool HasReadUnhashedControlBlock =
false;
2895 auto readUnhashedControlBlockOnce = [&]() {
2896 if (!HasReadUnhashedControlBlock) {
2897 HasReadUnhashedControlBlock =
true;
2898 if (ASTReadResult
Result =
2899 readUnhashedControlBlock(F, ImportedBy, ClientLoadCapabilities))
2905 bool DisableValidation = shouldDisableValidationForFile(F);
2909 unsigned NumInputs = 0;
2910 unsigned NumUserInputs = 0;
2911 StringRef BaseDirectoryAsWritten;
2915 Error(MaybeEntry.takeError());
2918 llvm::BitstreamEntry Entry = MaybeEntry.get();
2920 switch (Entry.Kind) {
2921 case llvm::BitstreamEntry::Error:
2922 Error(
"malformed block record in AST file");
2924 case llvm::BitstreamEntry::EndBlock: {
2927 if (ASTReadResult
Result = readUnhashedControlBlockOnce())
2932 PP.getHeaderSearchInfo().getHeaderSearchOpts();
2939 bool Complain = (ClientLoadCapabilities & ARR_OutOfDate) == 0;
2945 unsigned N = ValidateSystemInputs ? NumInputs : NumUserInputs;
2951 for (
unsigned I = 0; I < N; ++I) {
2952 InputFile IF = getInputFile(F, I+1, Complain);
2964 for (
unsigned I = 0; I < N; ++I) {
2965 bool IsSystem = I >= NumUserInputs;
2976 case llvm::BitstreamEntry::SubBlock:
2980 if (llvm::Error Err = Stream.SkipBlock()) {
2981 Error(std::move(Err));
2985 Error(
"malformed block record in AST file");
2995 if (Listener && !ImportedBy) {
3001 bool AllowCompatibleConfigurationMismatch =
3005 ReadOptionsBlock(Stream, F.
FileName, ClientLoadCapabilities,
3006 AllowCompatibleConfigurationMismatch, *Listener,
3007 SuggestedPredefines);
3009 Error(
"malformed block record in AST file");
3013 if (DisableValidation ||
3014 (AllowConfigurationMismatch &&
Result == ConfigurationMismatch))
3022 }
else if (llvm::Error Err = Stream.SkipBlock()) {
3023 Error(std::move(Err));
3029 if (llvm::Error Err = Stream.SkipBlock()) {
3030 Error(std::move(Err));
3036 case llvm::BitstreamEntry::Record:
3045 Stream.readRecord(Entry.ID,
Record, &Blob);
3046 if (!MaybeRecordType) {
3047 Error(MaybeRecordType.takeError());
3053 if ((ClientLoadCapabilities & ARR_VersionMismatch) == 0)
3055 : diag::err_ast_file_version_too_new)
3060 bool hasErrors =
Record[7];
3061 if (hasErrors && !DisableValidation) {
3064 if ((ClientLoadCapabilities & ARR_TreatModuleWithErrorsAsOutOfDate) &&
3065 canRecoverFromOutOfDate(F.
FileName, ClientLoadCapabilities))
3068 if (!AllowASTWithCompilerErrors) {
3069 Diag(diag::err_ast_file_with_compiler_errors)
3075 Diags.ErrorOccurred =
true;
3076 Diags.UncompilableErrorOccurred =
true;
3077 Diags.UnrecoverableErrorOccurred =
true;
3090 StringRef ASTBranch = Blob;
3091 if (StringRef(CurBranch) != ASTBranch && !DisableValidation) {
3092 if ((ClientLoadCapabilities & ARR_VersionMismatch) == 0)
3093 Diag(diag::err_ast_file_different_branch)
3105 if (ASTReadResult
Result = readUnhashedControlBlockOnce())
3109 unsigned Idx = 0, N =
Record.size();
3114 bool IsImportingStdCXXModule =
Record[Idx++];
3118 auto [ImportLoc, ImportModuleFileIndex] =
3119 ReadUntranslatedSourceLocation(
Record[Idx++]);
3121 assert(ImportModuleFileIndex == 0);
3122 off_t StoredSize = !IsImportingStdCXXModule ? (off_t)
Record[Idx++] : 0;
3123 time_t StoredModTime =
3124 !IsImportingStdCXXModule ? (time_t)
Record[Idx++] : 0;
3127 if (!IsImportingStdCXXModule) {
3128 auto FirstSignatureByte =
Record.begin() + Idx;
3134 std::string ImportedName = ReadString(
Record, Idx);
3135 std::string ImportedFile;
3144 ImportedFile = PP.getHeaderSearchInfo().getPrebuiltModuleFileName(
3145 ImportedName, !IsImportingStdCXXModule);
3149 if (!IsImportingStdCXXModule) {
3150 if (ImportedFile.empty()) {
3153 ImportedFile = ReadPath(BaseDirectoryAsWritten,
Record, Idx);
3156 }
else if (ImportedFile.empty()) {
3157 Diag(clang::diag::err_failed_to_find_module_file) << ImportedName;
3163 unsigned Capabilities = ClientLoadCapabilities;
3164 if ((ClientLoadCapabilities & ARR_OutOfDate) == 0)
3165 Capabilities &= ~ARR_Missing;
3168 auto Result = ReadASTCore(ImportedFile, ImportedKind, ImportLoc, &F,
3169 Loaded, StoredSize, StoredModTime,
3170 StoredSignature, Capabilities);
3173 bool recompilingFinalized =
3174 Result == OutOfDate && (Capabilities & ARR_OutOfDate) &&
3175 getModuleManager().getModuleCache().isPCMFinal(F.
FileName);
3177 Diag(diag::note_module_file_imported_by)
3179 if (recompilingFinalized)
3180 Diag(diag::note_module_file_conflict);
3183 case Failure:
return Failure;
3186 case OutOfDate:
return OutOfDate;
3188 case ConfigurationMismatch:
return ConfigurationMismatch;
3189 case HadErrors:
return HadErrors;
3209 Diag(diag::remark_module_import)
3211 << (ImportedBy ? StringRef(ImportedBy->
ModuleName) : StringRef());
3217 if (ASTReadResult
Result = readUnhashedControlBlockOnce())
3225 BaseDirectoryAsWritten = Blob;
3227 "MODULE_DIRECTORY found before MODULE_NAME");
3229 if (!PP.getPreprocessorOpts().ModulesCheckRelocated)
3233 Module *M = PP.getHeaderSearchInfo().lookupModule(
3240 if (!
bool(PP.getPreprocessorOpts().DisablePCHOrModuleValidation &
3243 auto BuildDir = PP.getFileManager().getOptionalDirectoryRef(Blob);
3244 if (!BuildDir || *BuildDir != M->
Directory) {
3245 if (!canRecoverFromOutOfDate(F.
FileName, ClientLoadCapabilities))
3246 Diag(diag::err_imported_module_relocated)
3257 if (ASTReadResult
Result =
3258 ReadModuleMapFileBlock(
Record, F, ImportedBy, ClientLoadCapabilities))
3264 NumUserInputs =
Record[1];
3266 (
const llvm::support::unaligned_uint64_t *)Blob.data();
3275llvm::Error ASTReader::ReadASTBlock(
ModuleFile &F,
3276 unsigned ClientLoadCapabilities) {
3277 BitstreamCursor &Stream = F.
Stream;
3279 if (llvm::Error Err = Stream.EnterSubBlock(
AST_BLOCK_ID))
3288 return MaybeEntry.takeError();
3289 llvm::BitstreamEntry Entry = MaybeEntry.get();
3291 switch (Entry.Kind) {
3292 case llvm::BitstreamEntry::Error:
3293 return llvm::createStringError(
3294 std::errc::illegal_byte_sequence,
3295 "error at end of module block in AST file");
3296 case llvm::BitstreamEntry::EndBlock:
3308 return llvm::Error::success();
3309 case llvm::BitstreamEntry::SubBlock:
3317 if (llvm::Error Err = Stream.SkipBlock())
3319 if (llvm::Error Err = ReadBlockAbbrevs(
3326 if (!PP.getExternalSource())
3327 PP.setExternalSource(
this);
3329 if (llvm::Error Err = Stream.SkipBlock())
3331 if (llvm::Error Err =
3340 if (llvm::Error Err = Stream.SkipBlock()) {
3349 if (!PP.getPreprocessingRecord())
3350 PP.createPreprocessingRecord();
3351 if (!PP.getPreprocessingRecord()->getExternalSource())
3352 PP.getPreprocessingRecord()->SetExternalSource(*
this);
3356 if (llvm::Error Err = ReadSourceManagerBlock(F))
3361 if (llvm::Error Err = ReadSubmoduleBlock(F, ClientLoadCapabilities))
3366 BitstreamCursor
C = Stream;
3368 if (llvm::Error Err = Stream.SkipBlock())
3372 CommentsCursors.push_back(std::make_pair(
C, &F));
3377 if (llvm::Error Err = Stream.SkipBlock())
3383 case llvm::BitstreamEntry::Record:
3392 Stream.readRecord(Entry.ID,
Record, &Blob);
3393 if (!MaybeRecordType)
3394 return MaybeRecordType.takeError();
3426 return llvm::createStringError(
3427 std::errc::illegal_byte_sequence,
3428 "duplicate TYPE_OFFSET record in AST file");
3441 return llvm::createStringError(
3442 std::errc::illegal_byte_sequence,
3443 "duplicate DECL_OFFSET record in AST file");
3455 DeclContext *TU = ContextObj->getTranslationUnitDecl();
3456 LexicalContents Contents(
3458 static_cast<unsigned int>(Blob.size() /
sizeof(
DeclID)));
3459 TULexicalDecls.push_back(std::make_pair(&F, Contents));
3467 auto *
Data = (
const unsigned char*)Blob.data();
3468 PendingVisibleUpdates[
ID].push_back(PendingVisibleUpdate{&F,
Data});
3471 if (
Decl *
D = GetExistingDecl(ID))
3472 PendingUpdateRecords.push_back(
3473 PendingUpdateRecord(ID,
D,
false));
3479 reinterpret_cast<const unsigned char *
>(Blob.data());
3487 PP.getIdentifierTable().setExternalIdentifierLookup(
this);
3493 return llvm::createStringError(
3494 std::errc::illegal_byte_sequence,
3495 "duplicate IDENTIFIER_OFFSET record in AST file");
3501 IdentifiersLoaded.resize(IdentifiersLoaded.size()
3513 for (
unsigned I = 0, N =
Record.size(); I != N; )
3514 EagerlyDeserializedDecls.push_back(ReadDeclID(F,
Record, I));
3521 getContext().getLangOpts().BuildingPCHWithObjectFile)
3522 for (
unsigned I = 0, N =
Record.size(); I != N; )
3523 EagerlyDeserializedDecls.push_back(ReadDeclID(F,
Record, I));
3527 if (SpecialTypes.empty()) {
3528 for (
unsigned I = 0, N =
Record.size(); I != N; ++I)
3529 SpecialTypes.push_back(getGlobalTypeID(F,
Record[I]));
3533 if (SpecialTypes.size() !=
Record.size())
3534 return llvm::createStringError(std::errc::illegal_byte_sequence,
3535 "invalid special-types record");
3537 for (
unsigned I = 0, N =
Record.size(); I != N; ++I) {
3539 if (!SpecialTypes[I])
3540 SpecialTypes[I] =
ID;
3547 TotalNumStatements +=
Record[0];
3548 TotalNumMacros +=
Record[1];
3549 TotalLexicalDeclContexts +=
Record[2];
3550 TotalVisibleDeclContexts +=
Record[3];
3554 for (
unsigned I = 0, N =
Record.size(); I != N; )
3555 UnusedFileScopedDecls.push_back(ReadDeclID(F,
Record, I));
3559 for (
unsigned I = 0, N =
Record.size(); I != N; )
3560 DelegatingCtorDecls.push_back(ReadDeclID(F,
Record, I));
3564 if (
Record.size() % 3 != 0)
3565 return llvm::createStringError(std::errc::illegal_byte_sequence,
3566 "invalid weak identifiers record");
3570 WeakUndeclaredIdentifiers.clear();
3573 for (
unsigned I = 0, N =
Record.size(); I < N; ) {
3574 WeakUndeclaredIdentifiers.push_back(
3575 getGlobalIdentifierID(F,
Record[I++]));
3576 WeakUndeclaredIdentifiers.push_back(
3577 getGlobalIdentifierID(F,
Record[I++]));
3578 WeakUndeclaredIdentifiers.push_back(
3579 ReadSourceLocation(F,
Record, I).getRawEncoding());
3586 unsigned LocalBaseSelectorID =
Record[1];
3592 GlobalSelectorMap.insert(std::make_pair(getTotalNumSelectors()+1, &F));
3597 std::make_pair(LocalBaseSelectorID,
3609 = ASTSelectorLookupTable::Create(
3613 TotalNumMethodPoolEntries +=
Record[1];
3618 for (
unsigned Idx = 0, N =
Record.size() - 1; Idx < N; ) {
3619 ReferencedSelectorsData.push_back(getGlobalSelectorID(F,
3621 ReferencedSelectorsData.push_back(ReadSourceLocation(F,
Record, Idx).
3630 PP.setPreambleRecordedPragmaAssumeNonNullLoc(
3631 ReadSourceLocation(F,
Record, Idx));
3639 while (Idx <
Record.size())
3640 SrcLocs.push_back(ReadSourceLocation(F,
Record, Idx));
3641 PP.setDeserializedSafeBufferOptOutMap(SrcLocs);
3648 unsigned Idx = 0, End =
Record.size() - 1;
3649 bool ReachedEOFWhileSkipping =
Record[Idx++];
3650 std::optional<Preprocessor::PreambleSkipInfo> SkipInfo;
3651 if (ReachedEOFWhileSkipping) {
3654 bool FoundNonSkipPortion =
Record[Idx++];
3655 bool FoundElse =
Record[Idx++];
3657 SkipInfo.emplace(HashToken, IfTokenLoc, FoundNonSkipPortion,
3658 FoundElse, ElseLoc);
3662 auto Loc = ReadSourceLocation(F,
Record, Idx);
3663 bool WasSkipping =
Record[Idx++];
3664 bool FoundNonSkip =
Record[Idx++];
3665 bool FoundElse =
Record[Idx++];
3666 ConditionalStack.push_back(
3667 {
Loc, WasSkipping, FoundNonSkip, FoundElse});
3669 PP.setReplayablePreambleConditionalStack(ConditionalStack, SkipInfo);
3674 if (!
Record.empty() && Listener)
3692 if (!Diags.isDiagnosticInFlight()) {
3694 SourceMgr.noteSLocAddressSpaceUsage(Diags);
3696 return llvm::createStringError(std::errc::invalid_argument,
3697 "ran out of source locations");
3702 unsigned RangeStart =
3704 GlobalSLocEntryMap.insert(std::make_pair(RangeStart, &F));
3709 GlobalSLocOffsetMap.insert(
3711 - SLocSpaceSize,&F));
3722 ParseLineTable(F,
Record);
3726 for (
unsigned I = 0, N =
Record.size(); I != N; )
3727 ExtVectorDecls.push_back(ReadDeclID(F,
Record, I));
3731 if (
Record.size() % 3 != 0)
3732 return llvm::createStringError(std::errc::illegal_byte_sequence,
3733 "Invalid VTABLE_USES record");
3740 for (
unsigned Idx = 0, N =
Record.size(); Idx != N; ) {
3741 VTableUses.push_back(
3742 {ReadDeclID(F,
Record, Idx),
3743 ReadSourceLocation(F,
Record, Idx).getRawEncoding(),
3750 if (
Record.size() % 2 != 0)
3751 return llvm::createStringError(
3752 std::errc::illegal_byte_sequence,
3753 "Invalid PENDING_IMPLICIT_INSTANTIATIONS block");
3755 for (
unsigned I = 0, N =
Record.size(); I != N; ) {
3756 PendingInstantiations.push_back(
3757 {ReadDeclID(F,
Record, I),
3758 ReadSourceLocation(F,
Record, I).getRawEncoding()});
3764 return llvm::createStringError(std::errc::illegal_byte_sequence,
3765 "Invalid SEMA_DECL_REFS block");
3766 for (
unsigned I = 0, N =
Record.size(); I != N; )
3767 SemaDeclRefs.push_back(ReadDeclID(F,
Record, I));
3775 unsigned LocalBasePreprocessedEntityID =
Record[0];
3777 unsigned StartingID;
3778 if (!PP.getPreprocessingRecord())
3779 PP.createPreprocessingRecord();
3780 if (!PP.getPreprocessingRecord()->getExternalSource())
3781 PP.getPreprocessingRecord()->SetExternalSource(*
this);
3783 = PP.getPreprocessingRecord()
3790 GlobalPreprocessedEntityMap.insert(std::make_pair(StartingID, &F));
3795 std::make_pair(LocalBasePreprocessedEntityID,
3807 if (!PP.getPreprocessingRecord())
3808 PP.createPreprocessingRecord();
3809 if (!PP.getPreprocessingRecord()->getExternalSource())
3810 PP.getPreprocessingRecord()->SetExternalSource(*
this);
3815 GlobalSkippedRangeMap.insert(
3821 if (
Record.size() % 2 != 0)
3822 return llvm::createStringError(
3823 std::errc::illegal_byte_sequence,
3824 "invalid DECL_UPDATE_OFFSETS block in AST file");
3825 for (
unsigned I = 0, N =
Record.size(); I != N; ) {
3827 DeclUpdateOffsets[
ID].push_back(std::make_pair(&F,
Record[I++]));
3831 if (
Decl *
D = GetExistingDecl(ID))
3832 PendingUpdateRecords.push_back(
3833 PendingUpdateRecord(ID,
D,
false));
3838 if (
Record.size() % 3 != 0)
3839 return llvm::createStringError(
3840 std::errc::illegal_byte_sequence,
3841 "invalid DELAYED_NAMESPACE_LEXICAL_VISIBLE_RECORD block in AST "
3843 for (
unsigned I = 0, N =
Record.size(); I != N; ) {
3847 assert(BaseOffset &&
"Invalid DeclsBlockStartOffset for module file!");
3850 LocalLexicalOffset ? BaseOffset + LocalLexicalOffset : 0;
3853 LocalVisibleOffset ? BaseOffset + LocalVisibleOffset : 0;
3855 DelayedNamespaceOffsetMap[
ID] = {LexicalOffset, VisibleOffset};
3857 assert(!GetExistingDecl(ID) &&
3858 "We shouldn't load the namespace in the front of delayed "
3859 "namespace lexical and visible block");
3866 return llvm::createStringError(
3867 std::errc::illegal_byte_sequence,
3868 "duplicate OBJC_CATEGORIES_MAP record in AST file");
3881 CUDASpecialDeclRefs.clear();
3882 for (
unsigned I = 0, N =
Record.size(); I != N; )
3883 CUDASpecialDeclRefs.push_back(ReadDeclID(F,
Record, I));
3891 = HeaderFileInfoLookupTable::Create(
3895 &PP.getHeaderSearchInfo(),
3896 Blob.data() +
Record[2]));
3898 PP.getHeaderSearchInfo().SetExternalSource(
this);
3899 if (!PP.getHeaderSearchInfo().getExternalLookup())
3900 PP.getHeaderSearchInfo().SetExternalLookup(
this);
3906 FPPragmaOptions.swap(
Record);
3910 for (
unsigned I = 0,
E =
Record.size(); I !=
E; ) {
3911 auto Name = ReadString(
Record, I);
3912 auto &OptInfo = OpenCLExtensions.OptMap[Name];
3913 OptInfo.Supported =
Record[I++] != 0;
3914 OptInfo.Enabled =
Record[I++] != 0;
3915 OptInfo.WithPragma =
Record[I++] != 0;
3916 OptInfo.Avail =
Record[I++];
3917 OptInfo.Core =
Record[I++];
3918 OptInfo.Opt =
Record[I++];
3923 for (
unsigned I = 0, N =
Record.size(); I != N; )
3924 TentativeDefinitions.push_back(ReadDeclID(F,
Record, I));
3928 for (
unsigned I = 0, N =
Record.size(); I != N; )
3929 KnownNamespaces.push_back(ReadDeclID(F,
Record, I));
3933 if (
Record.size() % 2 != 0)
3934 return llvm::createStringError(std::errc::illegal_byte_sequence,
3935 "invalid undefined-but-used record");
3936 for (
unsigned I = 0, N =
Record.size(); I != N; ) {
3937 UndefinedButUsed.push_back(
3938 {ReadDeclID(F,
Record, I),
3939 ReadSourceLocation(F,
Record, I).getRawEncoding()});
3944 for (
unsigned I = 0, N =
Record.size(); I != N;) {
3945 DelayedDeleteExprs.push_back(ReadDeclID(F,
Record, I).getRawValue());
3947 DelayedDeleteExprs.push_back(Count);
3948 for (uint64_t
C = 0;
C < Count; ++
C) {
3949 DelayedDeleteExprs.push_back(ReadSourceLocation(F,
Record, I).getRawEncoding());
3950 bool IsArrayForm =
Record[I++] == 1;
3951 DelayedDeleteExprs.push_back(IsArrayForm);
3958 getContext().getLangOpts().BuildingPCHWithObjectFile)
3959 for (
unsigned I = 0, N =
Record.size(); I != N;)
3960 VTablesToEmit.push_back(ReadDeclID(F,
Record, I));
3968 for (
unsigned I = 0, N =
Record.size(); I != N; ) {
3969 unsigned GlobalID = getGlobalSubmoduleID(F,
Record[I++]);
3972 PendingImportedModules.push_back(ImportedSubmodule(GlobalID,
Loc));
3973 if (DeserializationListener)
3974 DeserializationListener->ModuleImportRead(GlobalID,
Loc);
3982 return llvm::createStringError(
3983 std::errc::illegal_byte_sequence,
3984 "duplicate MACRO_OFFSET record in AST file");
3987 unsigned LocalBaseMacroID =
Record[1];
3993 GlobalMacroMap.insert(std::make_pair(getTotalNumMacros() + 1, &F));
3997 std::make_pair(LocalBaseMacroID,
4006 LateParsedTemplates.emplace_back(
4007 std::piecewise_construct, std::forward_as_tuple(&F),
4013 return llvm::createStringError(std::errc::illegal_byte_sequence,
4014 "invalid pragma optimize record");
4015 OptimizeOffPragmaLocation = ReadSourceLocation(F,
Record[0]);
4020 return llvm::createStringError(std::errc::illegal_byte_sequence,
4021 "invalid pragma ms_struct record");
4022 PragmaMSStructState =
Record[0];
4027 return llvm::createStringError(
4028 std::errc::illegal_byte_sequence,
4029 "invalid pragma pointers to members record");
4030 PragmaMSPointersToMembersState =
Record[0];
4031 PointersToMembersPragmaLocation = ReadSourceLocation(F,
Record[1]);
4035 for (
unsigned I = 0, N =
Record.size(); I != N; )
4036 UnusedLocalTypedefNameCandidates.push_back(ReadDeclID(F,
Record, I));
4041 return llvm::createStringError(std::errc::illegal_byte_sequence,
4042 "invalid cuda pragma options record");
4043 ForceHostDeviceDepth =
Record[0];
4048 return llvm::createStringError(std::errc::illegal_byte_sequence,
4049 "invalid pragma pack record");
4050 PragmaAlignPackCurrentValue = ReadAlignPackInfo(
Record[0]);
4051 PragmaAlignPackCurrentLocation = ReadSourceLocation(F,
Record[1]);
4052 unsigned NumStackEntries =
Record[2];
4055 PragmaAlignPackStack.clear();
4056 for (
unsigned I = 0; I < NumStackEntries; ++I) {
4057 PragmaAlignPackStackEntry Entry;
4058 Entry.Value = ReadAlignPackInfo(
Record[Idx++]);
4059 Entry.Location = ReadSourceLocation(F,
Record[Idx++]);
4060 Entry.PushLocation = ReadSourceLocation(F,
Record[Idx++]);
4061 PragmaAlignPackStrings.push_back(ReadString(
Record, Idx));
4062 Entry.SlotLabel = PragmaAlignPackStrings.back();
4063 PragmaAlignPackStack.push_back(Entry);
4070 return llvm::createStringError(std::errc::illegal_byte_sequence,
4071 "invalid pragma float control record");
4073 FpPragmaCurrentLocation = ReadSourceLocation(F,
Record[1]);
4074 unsigned NumStackEntries =
Record[2];
4077 FpPragmaStack.clear();
4078 for (
unsigned I = 0; I < NumStackEntries; ++I) {
4079 FpPragmaStackEntry Entry;
4081 Entry.Location = ReadSourceLocation(F,
Record[Idx++]);
4082 Entry.PushLocation = ReadSourceLocation(F,
Record[Idx++]);
4083 FpPragmaStrings.push_back(ReadString(
Record, Idx));
4084 Entry.SlotLabel = FpPragmaStrings.back();
4085 FpPragmaStack.push_back(Entry);
4091 for (
unsigned I = 0, N =
Record.size(); I != N; )
4092 DeclsToCheckForDeferredDiags.insert(ReadDeclID(F,
Record, I));
4098void ASTReader::ReadModuleOffsetMap(
ModuleFile &F)
const {
4113 assert(ImportedModuleVector.empty());
4115 while (
Data < DataEnd) {
4119 using namespace llvm::support;
4121 endian::readNext<uint8_t, llvm::endianness::little>(
Data));
4122 uint16_t Len = endian::readNext<uint16_t, llvm::endianness::little>(
Data);
4123 StringRef Name = StringRef((
const char*)
Data, Len);
4127 ? ModuleMgr.lookupByModuleName(Name)
4128 : ModuleMgr.lookupByFileName(Name));
4130 std::string Msg =
"refers to unknown module, cannot find ";
4131 Msg.append(std::string(Name));
4136 ImportedModuleVector.push_back(OM);
4139 endian::readNext<uint32_t, llvm::endianness::little>(
Data);
4140 uint32_t PreprocessedEntityIDOffset =
4141 endian::readNext<uint32_t, llvm::endianness::little>(
Data);
4143 endian::readNext<uint32_t, llvm::endianness::little>(
Data);
4145 endian::readNext<uint32_t, llvm::endianness::little>(
Data);
4148 RemapBuilder &Remap) {
4149 constexpr uint32_t None = std::numeric_limits<uint32_t>::max();
4151 Remap.insert(std::make_pair(Offset,
4152 static_cast<int>(BaseOffset - Offset)));
4155 mapOffset(MacroIDOffset, OM->
BaseMacroID, MacroRemap);
4157 PreprocessedEntityRemap);
4166 unsigned ClientLoadCapabilities) {
4175 "MODULE_NAME should come before MODULE_MAP_FILE");
4176 if (PP.getPreprocessorOpts().ModulesCheckRelocated &&
4182 auto &Map = PP.getHeaderSearchInfo().getModuleMap();
4184 M ? Map.getModuleMapFileForUniquing(M) : std::nullopt;
4186 if (!
bool(PP.getPreprocessorOpts().DisablePCHOrModuleValidation &
4189 if (!canRecoverFromOutOfDate(F.
FileName, ClientLoadCapabilities)) {
4190 if (
auto ASTFE = M ? M->
getASTFile() : std::nullopt) {
4193 << ASTFE->getName();
4196 Diag(diag::err_imported_module_not_found)
4204 Diag(diag::note_imported_by_pch_module_not_found)
4211 assert(M && M->
Name == F.
ModuleName &&
"found module with different name");
4215 if (!StoredModMap || *StoredModMap != ModMap) {
4216 assert(ModMap &&
"found module is missing module map file");
4218 "top-level import should be verified");
4220 if (!canRecoverFromOutOfDate(F.
FileName, ClientLoadCapabilities))
4221 Diag(diag::err_imported_module_modmap_changed)
4228 for (
unsigned I = 0, N =
Record[Idx++]; I < N; ++I) {
4233 if (!canRecoverFromOutOfDate(F.
FileName, ClientLoadCapabilities))
4234 Error(
"could not find file '" +
Filename +
"' referenced by AST file");
4237 AdditionalStoredMaps.insert(*SF);
4242 if (
auto *AdditionalModuleMaps = Map.getAdditionalModuleMapFiles(M)) {
4246 if (!AdditionalStoredMaps.erase(ModMap)) {
4247 if (!canRecoverFromOutOfDate(F.
FileName, ClientLoadCapabilities))
4248 Diag(diag::err_module_different_modmap)
4258 if (!canRecoverFromOutOfDate(F.
FileName, ClientLoadCapabilities))
4259 Diag(diag::err_module_different_modmap)
4280 : Known->second.second;
4282 for (
ObjCMethodList *List = &Start; List; List = List->getNext()) {
4284 if (List->getMethod() == Method) {
4292 if (List->getNext())
4293 List->setMethod(List->getNext()->getMethod());
4295 List->setMethod(Method);
4301 for (
Decl *
D : Names) {
4305 if (wasHidden && SemaObj) {
4318 Stack.push_back(Mod);
4319 while (!Stack.empty()) {
4320 Mod = Stack.pop_back_val();
4322 if (NameVisibility <= Mod->NameVisibility) {
4338 HiddenNamesMapType::iterator Hidden = HiddenNamesMap.find(Mod);
4339 if (Hidden != HiddenNamesMap.end()) {
4341 HiddenNamesMap.erase(Hidden);
4343 assert(!HiddenNamesMap.contains(Mod) &&
4344 "making names visible added hidden names");
4351 I = Exports.begin(),
E = Exports.end(); I !=
E; ++I) {
4353 if (
Visited.insert(Exported).second)
4354 Stack.push_back(Exported);
4369 getContext().mergeDefinitionIntoModule(
4372 PendingMergedDefinitionsToDeduplicate.insert(Def);
4381 if (TriedLoadingGlobalIndex || !UseGlobalIndex ||
4382 !PP.getLangOpts().Modules)
4386 TriedLoadingGlobalIndex =
true;
4387 StringRef ModuleCachePath
4388 = getPreprocessor().getHeaderSearchInfo().getModuleCachePath();
4389 std::pair<GlobalModuleIndex *, llvm::Error>
Result =
4391 if (llvm::Error Err = std::move(
Result.second)) {
4393 consumeError(std::move(Err));
4397 GlobalIndex.reset(
Result.first);
4398 ModuleMgr.setGlobalIndex(GlobalIndex.get());
4403 return PP.getLangOpts().Modules && UseGlobalIndex &&
4404 !hasGlobalIndex() && TriedLoadingGlobalIndex;
4411 llvm::raw_fd_ostream OS(TimestampFilename, EC,
4412 llvm::sys::fs::OF_TextWithCRLF);
4415 OS <<
"Timestamp file\n";
4428 consumeError(MaybeEntry.takeError());
4431 llvm::BitstreamEntry Entry = MaybeEntry.get();
4433 switch (Entry.Kind) {
4434 case llvm::BitstreamEntry::Error:
4435 case llvm::BitstreamEntry::EndBlock:
4438 case llvm::BitstreamEntry::Record:
4444 consumeError(Skipped.takeError());
4448 case llvm::BitstreamEntry::SubBlock:
4449 if (Entry.ID == BlockID) {
4450 if (llvm::Error Err = Cursor.EnterSubBlock(BlockID)) {
4452 consumeError(std::move(Err));
4459 if (llvm::Error Err = Cursor.SkipBlock()) {
4461 consumeError(std::move(Err));
4470 unsigned ClientLoadCapabilities,
4472 llvm::TimeTraceScope scope(
"ReadAST",
FileName);
4476 CurrentDeserializingModuleKind,
Type);
4482 unsigned PreviousGeneration = 0;
4484 PreviousGeneration = incrementGeneration(*ContextObj);
4486 unsigned NumModules = ModuleMgr.size();
4491 ClientLoadCapabilities)) {
4492 ModuleMgr.removeModules(ModuleMgr.begin() + NumModules);
4496 GlobalIndex.reset();
4497 ModuleMgr.setGlobalIndex(
nullptr);
4501 if (NewLoadedModuleFile && !Loaded.empty())
4502 *NewLoadedModuleFile = Loaded.back().Mod;
4513 for (ImportedModule &M : Loaded) {
4515 llvm::TimeTraceScope Scope2(
"Read Loaded AST", F.
ModuleName);
4518 if (llvm::Error Err = ReadASTBlock(F, ClientLoadCapabilities)) {
4519 Error(std::move(Err));
4525 Error(diag::err_module_file_missing_top_level_submodule, F.
FileName);
4531 if (llvm::Error Err = ReadExtensionBlock(F)) {
4532 Error(std::move(Err));
4545 for (ImportedModule &M : Loaded) {
4561 if (!PP.getLangOpts().CPlusPlus) {
4568 auto It = PP.getIdentifierTable().find(Key);
4569 if (It == PP.getIdentifierTable().end())
4578 II = &PP.getIdentifierTable().getOwn(Key);
4589 SetIdentifierInfo(ID, II);
4596 for (
auto &
Id : PP.getIdentifierTable())
4597 Id.second->setOutOfDate(
true);
4600 for (
const auto &Sel : SelectorGeneration)
4601 SelectorOutOfDate[Sel.first] =
true;
4605 for (ImportedModule &M : Loaded) {
4608 ModuleMgr.moduleFileAccepted(&F);
4617 F.
ImportLoc = TranslateSourceLocation(*M.ImportedBy, M.ImportLoc);
4621 for (
unsigned I = 0, N = UnresolvedModuleRefs.size(); I != N; ++I) {
4622 UnresolvedModuleRef &
Unresolved = UnresolvedModuleRefs[I];
4624 Module *ResolvedMod = getSubmodule(GlobalID);
4627 case UnresolvedModuleRef::Conflict:
4630 Conflict.
Other = ResolvedMod;
4632 Unresolved.Mod->Conflicts.push_back(Conflict);
4636 case UnresolvedModuleRef::Import:
4641 case UnresolvedModuleRef::Affecting:
4643 Unresolved.Mod->AffectingClangModules.insert(ResolvedMod);
4646 case UnresolvedModuleRef::Export:
4653 UnresolvedModuleRefs.clear();
4660 InitializeContext();
4665 if (DeserializationListener)
4666 DeserializationListener->ReaderInitialized(
this);
4668 ModuleFile &PrimaryModule = ModuleMgr.getPrimaryModule();
4683 for (
unsigned I = 0, N = ObjCClassesLoaded.size(); I != N; ++I) {
4684 loadObjCCategories(ObjCClassesLoaded[I]->getGlobalID(),
4685 ObjCClassesLoaded[I], PreviousGeneration);
4694 for (
unsigned I = 0, N = Loaded.size(); I != N; ++I) {
4695 ImportedModule &M = Loaded[I];
4712 if (!Stream.canSkipToPos(4))
4713 return llvm::createStringError(std::errc::illegal_byte_sequence,
4714 "file too small to contain AST file magic");
4715 for (
unsigned C : {
'C',
'P',
'C',
'H'})
4718 return llvm::createStringError(
4719 std::errc::illegal_byte_sequence,
4720 "file doesn't start with AST file magic");
4722 return Res.takeError();
4723 return llvm::Error::success();
4738 llvm_unreachable(
"unknown module kind");
4742ASTReader::ReadASTCore(StringRef
FileName,
4747 off_t ExpectedSize, time_t ExpectedModTime,
4749 unsigned ClientLoadCapabilities) {
4751 std::string ErrorStr;
4753 = ModuleMgr.addModule(
FileName,
Type, ImportLoc, ImportedBy,
4754 getGeneration(), ExpectedSize, ExpectedModTime,
4758 switch (AddResult) {
4760 Diag(diag::remark_module_import)
4762 << (ImportedBy ? StringRef(ImportedBy->
ModuleName) : StringRef());
4772 if (ClientLoadCapabilities & ARR_Missing)
4776 Diag(diag::err_ast_file_not_found)
4784 if (ClientLoadCapabilities & ARR_OutOfDate)
4788 Diag(diag::err_ast_file_out_of_date)
4794 assert(M &&
"Missing module file");
4796 bool ShouldFinalizePCM =
false;
4797 auto FinalizeOrDropPCM = llvm::make_scope_exit([&]() {
4798 auto &MC = getModuleManager().getModuleCache();
4799 if (ShouldFinalizePCM)
4805 BitstreamCursor &Stream = F.
Stream;
4806 Stream = BitstreamCursor(PCHContainerRdr.ExtractPCH(*F.Buffer));
4807 F.SizeInBits = F.Buffer->getBufferSize() * 8;
4811 Diag(diag::err_ast_file_invalid)
4817 bool HaveReadControlBlock =
false;
4821 Error(MaybeEntry.takeError());
4824 llvm::BitstreamEntry Entry = MaybeEntry.get();
4826 switch (Entry.Kind) {
4827 case llvm::BitstreamEntry::Error:
4828 case llvm::BitstreamEntry::Record:
4829 case llvm::BitstreamEntry::EndBlock:
4830 Error(
"invalid record at top-level of AST file");
4833 case llvm::BitstreamEntry::SubBlock:
4839 HaveReadControlBlock =
true;
4840 switch (ReadControlBlock(F, Loaded, ImportedBy, ClientLoadCapabilities)) {
4848 F.ModuleName.empty()) {
4850 if (
Result != OutOfDate ||
4851 (ClientLoadCapabilities & ARR_OutOfDate) == 0)
4857 case Failure:
return Failure;
4858 case Missing:
return Missing;
4859 case OutOfDate:
return OutOfDate;
4861 case ConfigurationMismatch:
return ConfigurationMismatch;
4862 case HadErrors:
return HadErrors;
4867 if (!HaveReadControlBlock) {
4868 if ((ClientLoadCapabilities & ARR_VersionMismatch) == 0)
4869 Diag(diag::err_ast_file_version_too_old)
4875 Loaded.push_back(ImportedModule(M, ImportedBy, ImportLoc));
4876 ShouldFinalizePCM =
true;
4880 if (llvm::Error Err = Stream.SkipBlock()) {
4881 Error(std::move(Err));
4888 llvm_unreachable(
"unexpected break; expected return");
4892ASTReader::readUnhashedControlBlock(
ModuleFile &F,
bool WasImportedBy,
4893 unsigned ClientLoadCapabilities) {
4895 PP.getHeaderSearchInfo().getHeaderSearchOpts();
4896 bool AllowCompatibleConfigurationMismatch =
4898 bool DisableValidation = shouldDisableValidationForFile(F);
4900 ASTReadResult
Result = readUnhashedControlBlockImpl(
4902 AllowCompatibleConfigurationMismatch, Listener.get(),
4907 if (DisableValidation || WasImportedBy ||
4908 (AllowConfigurationMismatch &&
Result == ConfigurationMismatch))
4912 Error(
"malformed block record in AST file");
4935 if (getModuleManager().getModuleCache().isPCMFinal(F.
FileName)) {
4936 Diag(diag::warn_module_system_bit_conflict) << F.
FileName;
4946 unsigned ClientLoadCapabilities,
bool AllowCompatibleConfigurationMismatch,
4949 BitstreamCursor Stream(StreamData);
4954 consumeError(std::move(Err));
4969 consumeError(MaybeEntry.takeError());
4972 llvm::BitstreamEntry Entry = MaybeEntry.get();
4974 switch (Entry.Kind) {
4975 case llvm::BitstreamEntry::Error:
4976 case llvm::BitstreamEntry::SubBlock:
4979 case llvm::BitstreamEntry::EndBlock:
4982 case llvm::BitstreamEntry::Record:
4991 Stream.readRecord(Entry.ID,
Record, &Blob);
4992 if (!MaybeRecordType) {
5001 "Dummy AST file signature not backpatched in ASTWriter.");
5008 "Dummy AST block hash not backpatched in ASTWriter.");
5012 bool Complain = (ClientLoadCapabilities & ARR_OutOfDate) == 0;
5013 if (Listener && ValidateDiagnosticOptions &&
5014 !AllowCompatibleConfigurationMismatch &&
5020 bool Complain = (ClientLoadCapabilities & ARR_ConfigurationMismatch) == 0;
5021 if (Listener && !AllowCompatibleConfigurationMismatch &&
5022 ParseHeaderSearchPaths(
Record, Complain, *Listener))
5023 Result = ConfigurationMismatch;
5052 if (
Record.size() < 4)
return true;
5057 unsigned BlockNameLen =
Record[2];
5058 unsigned UserInfoLen =
Record[3];
5060 if (BlockNameLen + UserInfoLen > Blob.size())
return true;
5062 Metadata.
BlockName = std::string(Blob.data(), Blob.data() + BlockNameLen);
5063 Metadata.
UserInfo = std::string(Blob.data() + BlockNameLen,
5064 Blob.data() + BlockNameLen + UserInfoLen);
5068llvm::Error ASTReader::ReadExtensionBlock(
ModuleFile &F) {
5069 BitstreamCursor &Stream = F.
Stream;
5075 return MaybeEntry.takeError();
5076 llvm::BitstreamEntry Entry = MaybeEntry.get();
5078 switch (Entry.Kind) {
5079 case llvm::BitstreamEntry::SubBlock:
5080 if (llvm::Error Err = Stream.SkipBlock())
5083 case llvm::BitstreamEntry::EndBlock:
5084 return llvm::Error::success();
5085 case llvm::BitstreamEntry::Error:
5086 return llvm::createStringError(std::errc::illegal_byte_sequence,
5087 "malformed block record in AST file");
5088 case llvm::BitstreamEntry::Record:
5095 Stream.readRecord(Entry.ID,
Record, &Blob);
5097 return MaybeRecCode.takeError();
5098 switch (MaybeRecCode.get()) {
5102 return llvm::createStringError(
5103 std::errc::illegal_byte_sequence,
5104 "malformed EXTENSION_METADATA in AST file");
5107 auto Known = ModuleFileExtensions.find(Metadata.
BlockName);
5108 if (Known == ModuleFileExtensions.end())
break;
5111 if (
auto Reader = Known->second->createExtensionReader(Metadata, *
this,
5121 return llvm::Error::success();
5125 assert(ContextObj &&
"no context to initialize");
5129 if (DeserializationListener)
5130 DeserializationListener->DeclRead(
5140 if (!Context.CFConstantStringTypeDecl)
5147 Error(
"FILE type is NULL");
5151 if (!Context.FILEDecl) {
5157 Error(
"Invalid FILE type in AST file");
5166 QualType Jmp_bufType = GetType(Jmp_buf);
5167 if (Jmp_bufType.
isNull()) {
5168 Error(
"jmp_buf type is NULL");
5172 if (!Context.jmp_bufDecl) {
5178 Error(
"Invalid jmp_buf type in AST file");
5187 QualType Sigjmp_bufType = GetType(Sigjmp_buf);
5188 if (Sigjmp_bufType.
isNull()) {
5189 Error(
"sigjmp_buf type is NULL");
5193 if (!Context.sigjmp_bufDecl) {
5198 assert(Tag &&
"Invalid sigjmp_buf type in AST file");
5205 if (Context.ObjCIdRedefinitionType.
isNull())
5206 Context.ObjCIdRedefinitionType = GetType(ObjCIdRedef);
5209 if (
TypeID ObjCClassRedef =
5211 if (Context.ObjCClassRedefinitionType.
isNull())
5212 Context.ObjCClassRedefinitionType = GetType(ObjCClassRedef);
5215 if (
TypeID ObjCSelRedef =
5217 if (Context.ObjCSelRedefinitionType.
isNull())
5218 Context.ObjCSelRedefinitionType = GetType(ObjCSelRedef);
5222 QualType Ucontext_tType = GetType(Ucontext_t);
5223 if (Ucontext_tType.
isNull()) {
5224 Error(
"ucontext_t type is NULL");
5228 if (!Context.ucontext_tDecl) {
5233 assert(Tag &&
"Invalid ucontext_t type in AST file");
5243 if (!CUDASpecialDeclRefs.empty()) {
5244 assert(CUDASpecialDeclRefs.size() == 1 &&
"More decl refs than expected!");
5246 cast<FunctionDecl>(GetDecl(CUDASpecialDeclRefs[0])));
5251 for (
auto &Import : PendingImportedModules) {
5252 if (
Module *Imported = getSubmodule(Import.ID)) {
5255 if (Import.ImportLoc.isValid())
5256 PP.makeModuleVisible(Imported, Import.ImportLoc);
5263 PendingImportedModulesSema.append(PendingImportedModules);
5264 PendingImportedModules.clear();
5274 BitstreamCursor Stream(
PCH);
5277 consumeError(std::move(Err));
5289 Stream.advanceSkippingSubblocks();
5292 consumeError(MaybeEntry.takeError());
5295 llvm::BitstreamEntry Entry = MaybeEntry.get();
5297 if (Entry.Kind != llvm::BitstreamEntry::Record)
5305 consumeError(MaybeRecord.takeError());
5311 "Dummy AST file signature not backpatched in ASTWriter.");
5321 const std::string &ASTFileName,
FileManager &FileMgr,
5327 Diags.
Report(diag::err_fe_unable_to_read_pch_file)
5328 << ASTFileName << Buffer.getError().message();
5329 return std::string();
5333 BitstreamCursor Stream(PCHContainerRdr.
ExtractPCH(**Buffer));
5337 Diags.
Report(diag::err_fe_not_a_pch_file) << ASTFileName << std::move(Err);
5338 return std::string();
5343 Diags.
Report(diag::err_fe_pch_malformed_block) << ASTFileName;
5344 return std::string();
5351 Stream.advanceSkippingSubblocks();
5354 consumeError(MaybeEntry.takeError());
5355 return std::string();
5357 llvm::BitstreamEntry Entry = MaybeEntry.get();
5359 if (Entry.Kind == llvm::BitstreamEntry::EndBlock)
5360 return std::string();
5362 if (Entry.Kind != llvm::BitstreamEntry::Record) {
5363 Diags.
Report(diag::err_fe_pch_malformed_block) << ASTFileName;
5364 return std::string();
5372 consumeError(MaybeRecord.takeError());
5373 return std::string();
5386 std::string ExistingModuleCachePath;
5388 bool StrictOptionMatches;
5391 SimplePCHValidator(
const LangOptions &ExistingLangOpts,
5394 StringRef ExistingModuleCachePath,
FileManager &FileMgr,
5395 bool StrictOptionMatches)
5396 : ExistingLangOpts(ExistingLangOpts),
5397 ExistingTargetOpts(ExistingTargetOpts),
5398 ExistingPPOpts(ExistingPPOpts),
5399 ExistingModuleCachePath(ExistingModuleCachePath), FileMgr(FileMgr),
5400 StrictOptionMatches(StrictOptionMatches) {}
5402 bool ReadLanguageOptions(
const LangOptions &LangOpts,
5403 StringRef ModuleFilename,
bool Complain,
5404 bool AllowCompatibleDifferences)
override {
5406 nullptr, AllowCompatibleDifferences);
5410 StringRef ModuleFilename,
bool Complain,
5411 bool AllowCompatibleDifferences)
override {
5413 nullptr, AllowCompatibleDifferences);
5417 StringRef ModuleFilename,
5418 StringRef SpecificModuleCachePath,
5419 bool Complain)
override {
5421 SpecificModuleCachePath,
5422 ExistingModuleCachePath, ModuleFilename,
5423 nullptr, ExistingLangOpts, ExistingPPOpts);
5427 StringRef ModuleFilename,
bool ReadMacros,
5429 std::string &SuggestedPredefines)
override {
5431 PPOpts, ExistingPPOpts, ModuleFilename, ReadMacros,
nullptr,
5432 FileMgr, SuggestedPredefines, ExistingLangOpts,
5445 unsigned ClientLoadCapabilities) {
5447 std::unique_ptr<llvm::MemoryBuffer> OwnedBuffer;
5459 OwnedBuffer = std::move(*BufferOrErr);
5460 Buffer = OwnedBuffer.get();
5464 StringRef Bytes = PCHContainerRdr.
ExtractPCH(*Buffer);
5465 BitstreamCursor Stream(Bytes);
5469 consumeError(std::move(Err));
5480 BitstreamCursor InputFilesCursor;
5481 uint64_t InputFilesOffsetBase = 0;
5484 std::string ModuleDir;
5485 bool DoneWithControlBlock =
false;
5486 while (!DoneWithControlBlock) {
5490 consumeError(MaybeEntry.takeError());
5493 llvm::BitstreamEntry Entry = MaybeEntry.get();
5495 switch (Entry.Kind) {
5496 case llvm::BitstreamEntry::SubBlock: {
5499 std::string IgnoredSuggestedPredefines;
5500 if (ReadOptionsBlock(Stream,
Filename, ClientLoadCapabilities,
5502 Listener, IgnoredSuggestedPredefines) !=
Success)
5508 InputFilesCursor = Stream;
5509 if (llvm::Error Err = Stream.SkipBlock()) {
5511 consumeError(std::move(Err));
5514 if (NeedsInputFiles &&
5517 InputFilesOffsetBase = InputFilesCursor.GetCurrentBitNo();
5521 if (llvm::Error Err = Stream.SkipBlock()) {
5523 consumeError(std::move(Err));
5532 case llvm::BitstreamEntry::EndBlock:
5533 DoneWithControlBlock =
true;
5536 case llvm::BitstreamEntry::Error:
5539 case llvm::BitstreamEntry::Record:
5543 if (DoneWithControlBlock)
break;
5548 Stream.readRecord(Entry.ID,
Record, &Blob);
5549 if (!MaybeRecCode) {
5564 ModuleDir = std::string(Blob);
5569 ResolveImportedPath(
Path, ModuleDir);
5574 if (!NeedsInputFiles)
5577 unsigned NumInputFiles =
Record[0];
5578 unsigned NumUserFiles =
Record[1];
5579 const llvm::support::unaligned_uint64_t *InputFileOffs =
5580 (
const llvm::support::unaligned_uint64_t *)Blob.data();
5581 for (
unsigned I = 0; I != NumInputFiles; ++I) {
5583 bool isSystemFile = I >= NumUserFiles;
5585 if (isSystemFile && !NeedsSystemInputFiles)
5588 BitstreamCursor &Cursor = InputFilesCursor;
5590 if (llvm::Error Err =
5591 Cursor.JumpToBit(InputFilesOffsetBase + InputFileOffs[I])) {
5593 consumeError(std::move(Err));
5599 consumeError(MaybeCode.takeError());
5601 unsigned Code = MaybeCode.get();
5605 bool shouldContinue =
false;
5607 Cursor.readRecord(Code,
Record, &Blob);
5608 if (!MaybeRecordType) {
5610 consumeError(MaybeRecordType.takeError());
5616 bool Overridden =
static_cast<bool>(
Record[3]);
5617 std::string
Filename = std::string(Blob);
5618 ResolveImportedPath(
Filename, ModuleDir);
5620 Filename, isSystemFile, Overridden,
false);
5623 if (!shouldContinue)
5633 unsigned Idx = 0, N =
Record.size();
5639 bool IsStandardCXXModule =
Record[Idx++];
5646 if (IsStandardCXXModule) {
5647 std::string ModuleName = ReadString(
Record, Idx);
5654 std::string ModuleName = ReadString(
Record, Idx);
5656 ResolveImportedPath(
Filename, ModuleDir);
5669 if (FindModuleFileExtensions) {
5670 BitstreamCursor SavedStream = Stream;
5672 bool DoneWithExtensionBlock =
false;
5673 while (!DoneWithExtensionBlock) {
5679 llvm::BitstreamEntry Entry = MaybeEntry.get();
5681 switch (Entry.Kind) {
5682 case llvm::BitstreamEntry::SubBlock:
5683 if (llvm::Error Err = Stream.SkipBlock()) {
5685 consumeError(std::move(Err));
5690 case llvm::BitstreamEntry::EndBlock:
5691 DoneWithExtensionBlock =
true;
5694 case llvm::BitstreamEntry::Error:
5697 case llvm::BitstreamEntry::Record:
5704 Stream.readRecord(Entry.ID,
Record, &Blob);
5705 if (!MaybeRecCode) {
5709 switch (MaybeRecCode.get()) {
5721 Stream = SavedStream;
5725 if (readUnhashedControlBlockImpl(
5726 nullptr, Bytes,
Filename, ClientLoadCapabilities,
5728 ValidateDiagnosticOptions) !=
Success)
5740 StringRef ExistingModuleCachePath,
5741 bool RequireStrictOptionMatches) {
5742 SimplePCHValidator validator(LangOpts, TargetOpts, PPOpts,
5743 ExistingModuleCachePath, FileMgr,
5744 RequireStrictOptionMatches);
5745 return !readASTFileControlBlock(
Filename, FileMgr, ModuleCache,
5751llvm::Error ASTReader::ReadSubmoduleBlock(
ModuleFile &F,
5752 unsigned ClientLoadCapabilities) {
5757 ModuleMap &ModMap = PP.getHeaderSearchInfo().getModuleMap();
5759 Module *CurrentModule =
nullptr;
5763 F.
Stream.advanceSkippingSubblocks();
5765 return MaybeEntry.takeError();
5766 llvm::BitstreamEntry Entry = MaybeEntry.get();
5768 switch (Entry.Kind) {
5769 case llvm::BitstreamEntry::SubBlock:
5770 case llvm::BitstreamEntry::Error:
5771 return llvm::createStringError(std::errc::illegal_byte_sequence,
5772 "malformed block record in AST file");
5773 case llvm::BitstreamEntry::EndBlock:
5774 return llvm::Error::success();
5775 case llvm::BitstreamEntry::Record:
5785 return MaybeKind.takeError();
5786 unsigned Kind = MaybeKind.get();
5789 return llvm::createStringError(
5790 std::errc::illegal_byte_sequence,
5791 "submodule metadata record should be at beginning of block");
5806 return llvm::createStringError(std::errc::illegal_byte_sequence,
5807 "malformed module definition");
5809 StringRef Name = Blob;
5815 bool IsFramework =
Record[Idx++];
5816 bool IsExplicit =
Record[Idx++];
5817 bool IsSystem =
Record[Idx++];
5818 bool IsExternC =
Record[Idx++];
5819 bool InferSubmodules =
Record[Idx++];
5820 bool InferExplicitSubmodules =
Record[Idx++];
5821 bool InferExportWildcard =
Record[Idx++];
5822 bool ConfigMacrosExhaustive =
Record[Idx++];
5823 bool ModuleMapIsPrivate =
Record[Idx++];
5824 bool NamedModuleHasInit =
Record[Idx++];
5826 Module *ParentModule =
nullptr;
5828 ParentModule = getSubmodule(
Parent);
5839 if (GlobalIndex >= SubmodulesLoaded.size() ||
5840 SubmodulesLoaded[GlobalIndex])
5841 return llvm::createStringError(std::errc::invalid_argument,
5842 "too many submodules");
5844 if (!ParentModule) {
5847 if (!
bool(PP.getPreprocessorOpts().DisablePCHOrModuleValidation &
5849 CurFile != F.
File) {
5850 auto ConflictError =
5852 ContextObj->DiagAllocator)
5876 if (DeserializationListener)
5877 DeserializationListener->ModuleRead(GlobalID, CurrentModule);
5879 SubmodulesLoaded[GlobalIndex] = CurrentModule;
5904 std::string
Filename = std::string(Blob);
5906 if (
auto Umbrella = PP.getFileManager().getOptionalFileRef(
Filename)) {
5934 std::string HeaderName(Blob);
5935 ResolveImportedPath(F, HeaderName);
5942 std::string Dirname = std::string(Blob);
5943 ResolveImportedPath(F, Dirname);
5945 PP.getFileManager().getOptionalDirectoryRef(Dirname)) {
5957 unsigned LocalBaseSubmoduleID =
Record[1];
5961 GlobalSubmoduleMap.insert(std::make_pair(getTotalNumSubmodules()+1,&F));
5966 std::make_pair(LocalBaseSubmoduleID,
5975 for (
unsigned Idx = 0; Idx !=
Record.size(); ++Idx) {
5980 Unresolved.Kind = UnresolvedModuleRef::Import;
5987 for (
unsigned Idx = 0; Idx !=
Record.size(); ++Idx) {
5992 Unresolved.Kind = UnresolvedModuleRef::Affecting;
5999 for (
unsigned Idx = 0; Idx + 1 <
Record.size(); Idx += 2) {
6004 Unresolved.Kind = UnresolvedModuleRef::Export;
6016 PP.getTargetInfo());
6034 Unresolved.Kind = UnresolvedModuleRef::Conflict;
6045 for (
unsigned I = 0; I <
Record.size(); )
6046 Inits.push_back(ReadDeclID(F,
Record, I));
6047 ContextObj->addLazyModuleInitializers(CurrentModule, Inits);
6066bool ASTReader::ParseLanguageOptions(
const RecordData &
Record,
6067 StringRef ModuleFilename,
bool Complain,
6069 bool AllowCompatibleDifferences) {
6072#define LANGOPT(Name, Bits, Default, Description) \
6073 LangOpts.Name = Record[Idx++];
6074#define ENUM_LANGOPT(Name, Type, Bits, Default, Description) \
6075 LangOpts.set##Name(static_cast<LangOptions::Type>(Record[Idx++]));
6076#include "clang/Basic/LangOptions.def"
6077#define SANITIZER(NAME, ID) \
6078 LangOpts.Sanitize.set(SanitizerKind::ID, Record[Idx++]);
6079#include "clang/Basic/Sanitizers.def"
6081 for (
unsigned N =
Record[Idx++]; N; --N)
6085 VersionTuple runtimeVersion = ReadVersionTuple(
Record, Idx);
6091 for (
unsigned N =
Record[Idx++]; N; --N) {
6093 ReadString(
Record, Idx));
6098 for (
unsigned N =
Record[Idx++]; N; --N) {
6105 AllowCompatibleDifferences);
6108bool ASTReader::ParseTargetOptions(
const RecordData &
Record,
6109 StringRef ModuleFilename,
bool Complain,
6111 bool AllowCompatibleDifferences) {
6115 TargetOpts.
CPU = ReadString(
Record, Idx);
6117 TargetOpts.
ABI = ReadString(
Record, Idx);
6118 for (
unsigned N =
Record[Idx++]; N; --N) {
6121 for (
unsigned N =
Record[Idx++]; N; --N) {
6126 AllowCompatibleDifferences);
6129bool ASTReader::ParseDiagnosticOptions(
const RecordData &
Record,
6130 StringRef ModuleFilename,
bool Complain,
6134#define DIAGOPT(Name, Bits, Default) DiagOpts->Name = Record[Idx++];
6135#define ENUM_DIAGOPT(Name, Type, Bits, Default) \
6136 DiagOpts->set##Name(static_cast<Type>(Record[Idx++]));
6137#include "clang/Basic/DiagnosticOptions.def"
6139 for (
unsigned N =
Record[Idx++]; N; --N)
6140 DiagOpts->Warnings.push_back(ReadString(
Record, Idx));
6141 for (
unsigned N =
Record[Idx++]; N; --N)
6142 DiagOpts->Remarks.push_back(ReadString(
Record, Idx));
6147bool ASTReader::ParseFileSystemOptions(
const RecordData &
Record,
bool Complain,
6155bool ASTReader::ParseHeaderSearchOptions(
const RecordData &
Record,
6156 StringRef ModuleFilename,
6174 std::string SpecificModuleCachePath = ReadString(
Record, Idx);
6177 SpecificModuleCachePath, Complain);
6180bool ASTReader::ParseHeaderSearchPaths(
const RecordData &
Record,
bool Complain,
6186 for (
unsigned N =
Record[Idx++]; N; --N) {
6190 bool IsFramework =
Record[Idx++];
6191 bool IgnoreSysRoot =
Record[Idx++];
6197 for (
unsigned N =
Record[Idx++]; N; --N) {
6198 std::string Prefix = ReadString(
Record, Idx);
6199 bool IsSystemHeader =
Record[Idx++];
6204 for (
unsigned N =
Record[Idx++]; N; --N) {
6205 std::string VFSOverlayFile = ReadString(
Record, Idx);
6212bool ASTReader::ParsePreprocessorOptions(
const RecordData &
Record,
6213 StringRef ModuleFilename,
6216 std::string &SuggestedPredefines) {
6221 bool ReadMacros =
Record[Idx++];
6223 for (
unsigned N =
Record[Idx++]; N; --N) {
6225 bool IsUndef =
Record[Idx++];
6226 PPOpts.
Macros.push_back(std::make_pair(Macro, IsUndef));
6231 for (
unsigned N =
Record[Idx++]; N; --N) {
6236 for (
unsigned N =
Record[Idx++]; N; --N) {
6245 SuggestedPredefines.clear();
6247 Complain, SuggestedPredefines);
6250std::pair<ModuleFile *, unsigned>
6251ASTReader::getModulePreprocessedEntity(
unsigned GlobalIndex) {
6252 GlobalPreprocessedEntityMapType::iterator
6253 I = GlobalPreprocessedEntityMap.find(GlobalIndex);
6254 assert(I != GlobalPreprocessedEntityMap.end() &&
6255 "Corrupted global preprocessed entity map");
6258 return std::make_pair(M, LocalIndex);
6261llvm::iterator_range<PreprocessingRecord::iterator>
6262ASTReader::getModulePreprocessedEntities(
ModuleFile &Mod)
const {
6271bool ASTReader::canRecoverFromOutOfDate(StringRef ModuleFileName,
6272 unsigned int ClientLoadCapabilities) {
6273 return ClientLoadCapabilities & ARR_OutOfDate &&
6274 !getModuleManager().getModuleCache().isPCMFinal(ModuleFileName);
6277llvm::iterator_range<ASTReader::ModuleDeclIterator>
6279 return llvm::make_range(
6286 auto I = GlobalSkippedRangeMap.find(GlobalIndex);
6287 assert(I != GlobalSkippedRangeMap.end() &&
6288 "Corrupted global skipped range map");
6291 assert(LocalIndex < M->NumPreprocessedSkippedRanges);
6294 ReadSourceLocation(*M, RawRange.
getEnd()));
6301 std::pair<ModuleFile *, unsigned> PPInfo = getModulePreprocessedEntity(Index);
6303 unsigned LocalIndex = PPInfo.second;
6306 if (!PP.getPreprocessingRecord()) {
6307 Error(
"no preprocessing record");
6314 Error(std::move(Err));
6321 Error(MaybeEntry.takeError());
6324 llvm::BitstreamEntry Entry = MaybeEntry.get();
6326 if (Entry.Kind != llvm::BitstreamEntry::Record)
6331 ReadSourceLocation(M, PPOffs.
getEnd()));
6337 if (!MaybeRecType) {
6338 Error(MaybeRecType.takeError());
6343 bool isBuiltin =
Record[0];
6347 Name = getLocalIdentifier(M,
Record[1]);
6350 getGlobalPreprocessedEntityID(M,
Record[1]);
6351 Def = cast<MacroDefinitionRecord>(
6352 PPRec.getLoadedPreprocessedEntity(GlobalID - 1));
6370 if (DeserializationListener)
6371 DeserializationListener->MacroDefinitionRead(PPID, MD);
6377 const char *FullFileNameStart = Blob.data() +
Record[0];
6378 StringRef FullFileName(FullFileNameStart, Blob.size() -
Record[0]);
6380 if (!FullFileName.empty())
6381 File = PP.getFileManager().getOptionalFileRef(FullFileName);
6388 StringRef(Blob.data(),
Record[0]),
6396 llvm_unreachable(
"Invalid PreprocessorDetailRecordTypes");
6406 GlobalSLocOffsetMapType::const_iterator SLocMapI)
const {
6408 for (GlobalSLocOffsetMapType::const_iterator
6409 EndI = GlobalSLocOffsetMap.end(); SLocMapI != EndI; ++SLocMapI) {
6415 return getTotalNumPreprocessedEntities();
6420struct PPEntityComp {
6450 bool EndsAfter)
const {
6451 if (SourceMgr.isLocalSourceLocation(
Loc))
6452 return getTotalNumPreprocessedEntities();
6454 GlobalSLocOffsetMapType::const_iterator SLocMapI = GlobalSLocOffsetMap.find(
6455 SourceManager::MaxLoadedOffset -
Loc.getOffset() - 1);
6456 assert(SLocMapI != GlobalSLocOffsetMap.end() &&
6457 "Corrupted global sloc offset map");
6459 if (SLocMapI->second->NumPreprocessedEntities == 0)
6460 return findNextPreprocessedEntity(SLocMapI);
6471 pp_iterator
First = pp_begin;
6475 PPI = std::upper_bound(pp_begin, pp_end,
Loc,
6476 PPEntityComp(*
this, M));
6485 std::advance(PPI,
Half);
6486 if (SourceMgr.isBeforeInTranslationUnit(
6487 ReadSourceLocation(M, PPI->getEnd()),
Loc)) {
6490 Count = Count -
Half - 1;
6497 return findNextPreprocessedEntity(SLocMapI);
6504std::pair<unsigned, unsigned>
6507 return std::make_pair(0,0);
6513 return std::make_pair(BeginID, EndID);
6523 std::pair<ModuleFile *, unsigned> PPInfo = getModulePreprocessedEntity(Index);
6525 unsigned LocalIndex = PPInfo.second;
6532 if (SourceMgr.isInFileID(SourceMgr.getFileLoc(
Loc), FID))
6541 class HeaderFileInfoVisitor {
6543 std::optional<HeaderFileInfo> HFI;
6546 explicit HeaderFileInfoVisitor(
FileEntryRef FE) : FE(FE) {}
6555 HeaderFileInfoLookupTable::iterator Pos = Table->find(FE);
6556 if (Pos == Table->end())
6563 std::optional<HeaderFileInfo> getHeaderFileInfo()
const {
return HFI; }
6569 HeaderFileInfoVisitor Visitor(FE);
6570 ModuleMgr.visit(Visitor);
6571 if (std::optional<HeaderFileInfo> HFI = Visitor.getHeaderFileInfo())
6578 using DiagState = DiagnosticsEngine::DiagState;
6589 auto ReadDiagState = [&](
const DiagState &BasedOn,
6590 bool IncludeNonPragmaStates) {
6591 unsigned BackrefID =
Record[Idx++];
6593 return DiagStates[BackrefID - 1];
6596 Diag.DiagStates.push_back(BasedOn);
6597 DiagState *NewState = &
Diag.DiagStates.back();
6598 DiagStates.push_back(NewState);
6599 unsigned Size =
Record[Idx++];
6600 assert(Idx + Size * 2 <=
Record.size() &&
6601 "Invalid data, not enough diag/map pairs");
6603 unsigned DiagID =
Record[Idx++];
6606 if (!NewMapping.
isPragma() && !IncludeNonPragmaStates)
6619 Mapping = NewMapping;
6625 DiagState *FirstState;
6630 FirstState =
Diag.DiagStatesByLoc.FirstDiagState;
6631 DiagStates.push_back(FirstState);
6635 "Invalid data, unexpected backref in initial state");
6637 assert(Idx <
Record.size() &&
6638 "Invalid data, not enough state change pairs in initial state");
6643 unsigned Flags =
Record[Idx++];
6645 Initial.SuppressSystemWarnings = Flags & 1; Flags >>= 1;
6646 Initial.ErrorsAsFatal = Flags & 1; Flags >>= 1;
6647 Initial.WarningsAsErrors = Flags & 1; Flags >>= 1;
6648 Initial.EnableAllWarnings = Flags & 1; Flags >>= 1;
6649 Initial.IgnoreAllWarnings = Flags & 1; Flags >>= 1;
6651 FirstState = ReadDiagState(Initial,
true);
6659 .StateTransitions.push_back({FirstState, 0});
6664 FirstState = ReadDiagState(*
Diag.DiagStatesByLoc.CurDiagState,
false);
6668 unsigned NumLocations =
Record[Idx++];
6669 while (NumLocations--) {
6670 assert(Idx <
Record.size() &&
6671 "Invalid data, missing pragma diagnostic states");
6673 assert(FID.
isValid() &&
"invalid FileID for transition");
6674 unsigned Transitions =
Record[Idx++];
6680 auto &F =
Diag.DiagStatesByLoc.Files[FID];
6681 F.StateTransitions.reserve(F.StateTransitions.size() + Transitions);
6682 for (
unsigned I = 0; I != Transitions; ++I) {
6683 unsigned Offset =
Record[Idx++];
6684 auto *State = ReadDiagState(*FirstState,
false);
6685 F.StateTransitions.push_back({State, Offset});
6690 assert(Idx <
Record.size() &&
6691 "Invalid data, missing final pragma diagnostic state");
6693 auto *CurState = ReadDiagState(*FirstState,
false);
6696 Diag.DiagStatesByLoc.CurDiagState = CurState;
6697 Diag.DiagStatesByLoc.CurDiagStateLoc = CurStateLoc;
6702 auto &
T =
Diag.DiagStatesByLoc.Files[NullFile].StateTransitions;
6704 T.push_back({CurState, 0});
6706 T[0].State = CurState;
6715ASTReader::RecordLocation ASTReader::TypeCursorForIndex(
TypeID ID) {
6716 auto [M, Index] = translateTypeIDToIndex(ID);
6723#define TYPE_BIT_CODE(CLASS_ID, CODE_ID, CODE_VALUE) \
6724 case TYPE_##CODE_ID: return Type::CLASS_ID;
6725#include "clang/Serialization/TypeBitCodes.def"
6727 return std::nullopt;
6738 assert(ContextObj &&
"reading type with no AST context");
6740 RecordLocation
Loc = TypeCursorForIndex(ID);
6741 BitstreamCursor &DeclsCursor =
Loc.F->DeclsCursor;
6747 ReadingKindTracker ReadingKind(Read_Type, *
this);
6750 Deserializing AType(
this);
6752 if (llvm::Error Err = DeclsCursor.JumpToBit(
Loc.Offset)) {
6753 Error(std::move(Err));
6758 Error(RawCode.takeError());
6765 Error(Code.takeError());
6776 Error(
"Unexpected code for type");
6781 return TypeReader.read(*maybeClass);
6809 : Reader(Reader),
Seq(
Seq) {}
6814#define ABSTRACT_TYPELOC(CLASS, PARENT)
6815#define TYPELOC(CLASS, PARENT) \
6816 void Visit##CLASS##TypeLoc(CLASS##TypeLoc TyLoc);
6817#include "clang/AST/TypeLocNodes.def"
6883 if (Reader.readBool())
6890 VisitArrayTypeLoc(TL);
6894 VisitArrayTypeLoc(TL);
6898 VisitArrayTypeLoc(TL);
6901void TypeLocReader::VisitDependentSizedArrayTypeLoc(
6903 VisitArrayTypeLoc(TL);
6906void TypeLocReader::VisitDependentAddressSpaceTypeLoc(
6914void TypeLocReader::VisitDependentSizedExtVectorTypeLoc(
6923void TypeLocReader::VisitDependentVectorTypeLoc(
6939void TypeLocReader::VisitDependentSizedMatrixTypeLoc(
6953 for (
unsigned i = 0, e = TL.
getNumParams(); i != e; ++i) {
6959 VisitFunctionTypeLoc(TL);
6963 VisitFunctionTypeLoc(TL);
6970void TypeLocReader::VisitUsingTypeLoc(
UsingTypeLoc TL) {
7008 auto NNS = readNestedNameSpecifierLoc();
7009 auto TemplateKWLoc = readSourceLocation();
7010 auto ConceptNameLoc = readDeclarationNameInfo();
7011 auto FoundDecl = readDeclAs<NamedDecl>();
7012 auto NamedConcept = readDeclAs<ConceptDecl>();
7014 getContext(), NNS, TemplateKWLoc, ConceptNameLoc, FoundDecl, NamedConcept,
7015 (readBool() ? readASTTemplateArgumentListInfo() :
nullptr));
7019void TypeLocReader::VisitAutoTypeLoc(
AutoTypeLoc TL) {
7021 if (Reader.readBool())
7023 if (Reader.readBool())
7027void TypeLocReader::VisitDeducedTemplateSpecializationTypeLoc(
7036void TypeLocReader::VisitEnumTypeLoc(
EnumTypeLoc TL) {
7056void TypeLocReader::VisitSubstTemplateTypeParmTypeLoc(
7061void TypeLocReader::VisitSubstTemplateTypeParmPackTypeLoc(
7066void TypeLocReader::VisitTemplateSpecializationTypeLoc(
7072 for (
unsigned i = 0, e = TL.
getNumArgs(); i != e; ++i)
7074 Reader.readTemplateArgumentLocInfo(
7078void TypeLocReader::VisitParenTypeLoc(
ParenTypeLoc TL) {
7098void TypeLocReader::VisitDependentTemplateSpecializationTypeLoc(
7108 Reader.readTemplateArgumentLocInfo(
7152void TypeLocReader::VisitPipeTypeLoc(
PipeTypeLoc TL) {
7159void TypeLocReader::VisitDependentBitIntTypeLoc(
7176 TypeSourceInfo *TInfo = getContext().CreateTypeSourceInfo(InfoTy);
7195std::pair<ModuleFile *, unsigned>
7198 "Predefined type shouldn't be in TypesLoaded");
7200 assert(ModuleFileIndex &&
"Untranslated Local Decl?");
7202 ModuleFile *OwningModuleFile = &getModuleManager()[ModuleFileIndex - 1];
7203 assert(OwningModuleFile &&
7204 "untranslated type ID or local type ID shouldn't be in TypesLoaded");
7206 return {OwningModuleFile,
7211 assert(ContextObj &&
"reading type with no AST context");
7222 llvm_unreachable(
"Invalid predefined type");
7411#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
7412 case PREDEF_TYPE_##Id##_ID: \
7413 T = Context.SingletonId; \
7415#include "clang/Basic/OpenCLImageTypes.def"
7416#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
7417 case PREDEF_TYPE_##Id##_ID: \
7418 T = Context.Id##Ty; \
7420#include "clang/Basic/OpenCLExtensionTypes.def"
7460#define SVE_TYPE(Name, Id, SingletonId) \
7461 case PREDEF_TYPE_##Id##_ID: \
7462 T = Context.SingletonId; \
7464#include "clang/Basic/AArch64SVEACLETypes.def"
7465#define PPC_VECTOR_TYPE(Name, Id, Size) \
7466 case PREDEF_TYPE_##Id##_ID: \
7467 T = Context.Id##Ty; \
7469#include "clang/Basic/PPCTypes.def"
7470#define RVV_TYPE(Name, Id, SingletonId) \
7471 case PREDEF_TYPE_##Id##_ID: \
7472 T = Context.SingletonId; \
7474#include "clang/Basic/RISCVVTypes.def"
7475#define WASM_TYPE(Name, Id, SingletonId) \
7476 case PREDEF_TYPE_##Id##_ID: \
7477 T = Context.SingletonId; \
7479#include "clang/Basic/WebAssemblyReferenceTypes.def"
7480#define AMDGPU_TYPE(Name, Id, SingletonId) \
7481 case PREDEF_TYPE_##Id##_ID: \
7482 T = Context.SingletonId; \
7484#include "clang/Basic/AMDGPUTypes.def"
7485#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) \
7486 case PREDEF_TYPE_##Id##_ID: \
7487 T = Context.SingletonId; \
7489#include "clang/Basic/HLSLIntangibleTypes.def"
7492 assert(!
T.isNull() &&
"Unknown predefined type");
7493 return T.withFastQualifiers(FastQuals);
7496 unsigned Index = translateTypeIDToIndex(ID).second;
7498 assert(Index < TypesLoaded.size() &&
"Type index out-of-range");
7499 if (TypesLoaded[Index].isNull()) {
7500 TypesLoaded[Index] = readTypeRecord(ID);
7501 if (TypesLoaded[Index].isNull())
7504 TypesLoaded[Index]->setFromAST();
7505 if (DeserializationListener)
7507 TypesLoaded[Index]);
7510 return TypesLoaded[Index].withFastQualifiers(FastQuals);
7514 return GetType(getGlobalTypeID(F, LocalID));
7523 ReadModuleOffsetMap(F);
7526 LocalID &= llvm::maskTrailingOnes<TypeID>(32);
7528 if (ModuleFileIndex == 0)
7533 ModuleFileIndex = MF.
Index + 1;
7534 return ((uint64_t)ModuleFileIndex << 32) | LocalID;
7543 return readTypeSourceInfo();
7546 readNestedNameSpecifierLoc();
7556 TemplateNameLoc, EllipsisLoc);
7567 llvm_unreachable(
"unexpected template argument loc");
7582 Result.setLAngleLoc(readSourceLocation());
7583 Result.setRAngleLoc(readSourceLocation());
7584 unsigned NumArgsAsWritten = readInt();
7585 for (
unsigned i = 0; i != NumArgsAsWritten; ++i)
7586 Result.addArgument(readTemplateArgumentLoc());
7592 readTemplateArgumentListInfo(
Result);
7599 if (NumCurrentElementsDeserializing) {
7604 PendingIncompleteDeclChains.push_back(
const_cast<Decl*
>(
D));
7609 assert(isa<TranslationUnitDecl>(
D) &&
"Not a TU?");
7620 if (isa<TranslationUnitDecl, NamespaceDecl, RecordDecl, EnumDecl>(DC)) {
7622 if (!getContext().getLangOpts().
CPlusPlus &&
7623 isa<TranslationUnitDecl>(DC)) {
7627 auto *II = Name.getAsIdentifierInfo();
7628 assert(II &&
"non-identifier name in C?");
7629 if (II->isOutOfDate())
7630 updateOutOfDateIdentifier(*II);
7636 auto *DC = cast<DeclContext>(DCDecl);
7638 FindExternalLexicalDecls(
7644 if (
auto *CTSD = dyn_cast<ClassTemplateSpecializationDecl>(
D))
7645 CTSD->getSpecializedTemplate()->LoadLazySpecializations();
7646 if (
auto *VTSD = dyn_cast<VarTemplateSpecializationDecl>(
D))
7647 VTSD->getSpecializedTemplate()->LoadLazySpecializations();
7648 if (
auto *FD = dyn_cast<FunctionDecl>(
D)) {
7649 if (
auto *Template = FD->getPrimaryTemplate())
7650 Template->LoadLazySpecializations();
7656 RecordLocation
Loc = getLocalBitOffset(Offset);
7657 BitstreamCursor &Cursor =
Loc.F->DeclsCursor;
7659 if (llvm::Error Err = Cursor.JumpToBit(
Loc.Offset)) {
7660 Error(std::move(Err));
7663 ReadingKindTracker ReadingKind(Read_Decl, *
this);
7668 Error(MaybeCode.takeError());
7671 unsigned Code = MaybeCode.get();
7675 if (!MaybeRecCode) {
7676 Error(MaybeRecCode.takeError());
7680 Error(
"malformed AST file: missing C++ ctor initializers");
7684 return Record.readCXXCtorInitializers();
7688 assert(ContextObj &&
"reading base specifiers with no AST context");
7691 RecordLocation
Loc = getLocalBitOffset(Offset);
7692 BitstreamCursor &Cursor =
Loc.F->DeclsCursor;
7694 if (llvm::Error Err = Cursor.JumpToBit(
Loc.Offset)) {
7695 Error(std::move(Err));
7698 ReadingKindTracker ReadingKind(Read_Decl, *
this);
7703 Error(MaybeCode.takeError());
7706 unsigned Code = MaybeCode.get();
7710 if (!MaybeRecCode) {
7711 Error(MaybeCode.takeError());
7714 unsigned RecCode = MaybeRecCode.get();
7717 Error(
"malformed AST file: missing C++ base specifiers");
7721 unsigned NumBases =
Record.readInt();
7724 for (
unsigned I = 0; I != NumBases; ++I)
7725 Bases[I] =
Record.readCXXBaseSpecifier();
7738 ReadModuleOffsetMap(F);
7741 OwningModuleFileIndex == 0
7745 if (OwningModuleFileIndex == 0)
7748 uint64_t NewModuleFileIndex = OwningModuleFile->
Index + 1;
7757 unsigned ModuleFileIndex = ID.getModuleFileIndex();
7758 return M.
Index == ModuleFileIndex - 1;
7766 uint64_t ModuleFileIndex = ID.getModuleFileIndex();
7767 assert(ModuleFileIndex &&
"Untranslated Local Decl?");
7769 return &getModuleManager()[ModuleFileIndex - 1];
7783 if (
Decl *
D = GetExistingDecl(ID))
7787 DeclCursorForID(ID,
Loc);
7792 assert(ContextObj &&
"reading predefined decl without AST context");
7794 Decl *NewLoaded =
nullptr;
7803 if (Context.ObjCIdDecl)
7804 return Context.ObjCIdDecl;
7809 if (Context.ObjCSelDecl)
7810 return Context.ObjCSelDecl;
7815 if (Context.ObjCClassDecl)
7816 return Context.ObjCClassDecl;
7821 if (Context.ObjCProtocolClassDecl)
7822 return Context.ObjCProtocolClassDecl;
7827 if (Context.Int128Decl)
7828 return Context.Int128Decl;
7833 if (Context.UInt128Decl)
7834 return Context.UInt128Decl;
7839 if (Context.ObjCInstanceTypeDecl)
7840 return Context.ObjCInstanceTypeDecl;
7845 if (Context.BuiltinVaListDecl)
7846 return Context.BuiltinVaListDecl;
7857 if (Context.BuiltinMSVaListDecl)
7858 return Context.BuiltinMSVaListDecl;
7867 if (Context.ExternCContext)
7868 return Context.ExternCContext;
7873 if (Context.MakeIntegerSeqDecl)
7874 return Context.MakeIntegerSeqDecl;
7879 if (Context.CFConstantStringTypeDecl)
7880 return Context.CFConstantStringTypeDecl;
7885 if (Context.CFConstantStringTagDecl)
7886 return Context.CFConstantStringTagDecl;
7891 if (Context.TypePackElementDecl)
7892 return Context.TypePackElementDecl;
7897 assert(NewLoaded &&
"Failed to load predefined decl?");
7899 if (DeserializationListener)
7900 DeserializationListener->PredefinedDeclBuilt(ID, NewLoaded);
7905unsigned ASTReader::translateGlobalDeclIDToIndex(
GlobalDeclID GlobalID)
const {
7906 ModuleFile *OwningModuleFile = getOwningModuleFile(GlobalID);
7907 if (!OwningModuleFile) {
7916 assert(ContextObj &&
"reading decl with no AST context");
7925 Merged.push_back(ID);
7930 unsigned Index = translateGlobalDeclIDToIndex(ID);
7932 if (Index >= DeclsLoaded.size()) {
7933 assert(0 &&
"declaration ID out-of-range for AST file");
7934 Error(
"declaration ID out-of-range for AST file");
7938 return DeclsLoaded[Index];
7943 return GetExistingDecl(ID);
7945 unsigned Index = translateGlobalDeclIDToIndex(ID);
7947 if (Index >= DeclsLoaded.size()) {
7948 assert(0 &&
"declaration ID out-of-range for AST file");
7949 Error(
"declaration ID out-of-range for AST file");
7953 if (!DeclsLoaded[Index]) {
7955 if (DeserializationListener)
7956 DeserializationListener->DeclRead(ID, DeclsLoaded[Index]);
7959 return DeclsLoaded[Index];
7968 ReadModuleOffsetMap(M);
7970 ModuleFile *Owner = getOwningModuleFile(GlobalID);
7978 uint64_t OrignalModuleFileIndex = 0;
7981 OrignalModuleFileIndex = I + 1;
7985 if (!OrignalModuleFileIndex)
7993 if (Idx >=
Record.size()) {
7994 Error(
"Corrupted AST file");
8008 ClearSwitchCaseIDs();
8011 RecordLocation
Loc = getLocalBitOffset(Offset);
8012 if (llvm::Error Err =
Loc.F->DeclsCursor.JumpToBit(
Loc.Offset)) {
8013 Error(std::move(Err));
8016 assert(NumCurrentElementsDeserializing == 0 &&
8017 "should not be called while already deserializing");
8019 return ReadStmtFromStream(*
Loc.F);
8028 assert(LexicalDecls.size() % 2 == 0 &&
"expected an even number of entries");
8029 for (
int I = 0, N = LexicalDecls.size(); I != N; I += 2) {
8031 if (!IsKindWeWant(K))
8034 auto ID = (
DeclID) + LexicalDecls[I + 1];
8039 if (PredefsVisited[ID])
8042 PredefsVisited[ID] =
true;
8046 assert(
D->
getKind() == K &&
"wrong kind for lexical decl");
8053 if (isa<TranslationUnitDecl>(DC)) {
8054 for (
const auto &Lexical : TULexicalDecls)
8055 Visit(Lexical.first, Lexical.second);
8057 auto I = LexicalDecls.find(DC);
8058 if (I != LexicalDecls.end())
8059 Visit(I->second.first, I->second.second);
8062 ++NumLexicalDeclContextsRead;
8067class UnalignedDeclIDComp {
8073 : Reader(Reader), Mod(M) {}
8101 unsigned Offset,
unsigned Length,
8105 llvm::DenseMap<FileID, FileDeclsInfo>::iterator I = FileDeclIDs.find(
File);
8106 if (I == FileDeclIDs.end())
8109 FileDeclsInfo &DInfo = I->second;
8110 if (DInfo.Decls.empty())
8114 BeginLoc =
SM.getLocForStartOfFile(
File).getLocWithOffset(Offset);
8117 UnalignedDeclIDComp DIDComp(*
this, *DInfo.Mod);
8119 llvm::lower_bound(DInfo.Decls, BeginLoc, DIDComp);
8120 if (BeginIt != DInfo.Decls.begin())
8126 while (BeginIt != DInfo.Decls.begin() &&
8127 GetDecl(getGlobalDeclID(*DInfo.Mod,
8129 ->isTopLevelDeclInObjCContainer())
8133 llvm::upper_bound(DInfo.Decls, EndLoc, DIDComp);
8134 if (EndIt != DInfo.Decls.end())
8139 Decls.push_back(GetDecl(getGlobalDeclID(
8147 "DeclContext has no visible decls in storage");
8151 auto It = Lookups.find(DC);
8152 if (It == Lookups.end())
8162 NamedDecl *ND = cast<NamedDecl>(GetDecl(ID));
8164 Decls.push_back(ND);
8167 ++NumVisibleDeclContextsRead;
8168 SetExternalVisibleDeclsForName(DC, Name, Decls);
8169 return !Decls.empty();
8176 auto It = Lookups.find(DC);
8177 assert(It != Lookups.end() &&
8178 "have external visible storage but no lookup tables");
8183 NamedDecl *ND = cast<NamedDecl>(GetDecl(ID));
8187 ++NumVisibleDeclContextsRead;
8189 for (DeclsMap::iterator I = Decls.begin(),
E = Decls.end(); I !=
E; ++I) {
8190 SetExternalVisibleDeclsForName(DC, I->first, I->second);
8192 const_cast<DeclContext *
>(DC)->setHasExternalVisibleStorage(
false);
8197 auto I = Lookups.find(Primary);
8198 return I == Lookups.end() ? nullptr : &I->second;
8207 assert(ImplD && Consumer);
8209 for (
auto *I : ImplD->
methods())
8215void ASTReader::PassInterestingDeclToConsumer(
Decl *
D) {
8223 Consumer->HandleVTable(RD);
8227 this->Consumer = Consumer;
8230 PassInterestingDeclsToConsumer();
8232 if (DeserializationListener)
8233 DeserializationListener->ReaderInitialized(
this);
8237 std::fprintf(stderr,
"*** AST File Statistics:\n");
8239 unsigned NumTypesLoaded =
8240 TypesLoaded.size() - llvm::count(TypesLoaded.materialized(),
QualType());
8241 unsigned NumDeclsLoaded =
8242 DeclsLoaded.size() -
8243 llvm::count(DeclsLoaded.materialized(), (
Decl *)
nullptr);
8244 unsigned NumIdentifiersLoaded =
8245 IdentifiersLoaded.size() -
8247 unsigned NumMacrosLoaded =
8248 MacrosLoaded.size() - llvm::count(MacrosLoaded, (
MacroInfo *)
nullptr);
8249 unsigned NumSelectorsLoaded =
8250 SelectorsLoaded.size() - llvm::count(SelectorsLoaded,
Selector());
8252 if (
unsigned TotalNumSLocEntries = getTotalNumSLocs())
8253 std::fprintf(stderr,
" %u/%u source location entries read (%f%%)\n",
8254 NumSLocEntriesRead, TotalNumSLocEntries,
8255 ((
float)NumSLocEntriesRead/TotalNumSLocEntries * 100));
8256 if (!TypesLoaded.empty())
8257 std::fprintf(stderr,
" %u/%u types read (%f%%)\n",
8258 NumTypesLoaded, (
unsigned)TypesLoaded.size(),
8259 ((
float)NumTypesLoaded/TypesLoaded.size() * 100));
8260 if (!DeclsLoaded.empty())
8261 std::fprintf(stderr,
" %u/%u declarations read (%f%%)\n",
8262 NumDeclsLoaded, (
unsigned)DeclsLoaded.size(),
8263 ((
float)NumDeclsLoaded/DeclsLoaded.size() * 100));
8264 if (!IdentifiersLoaded.empty())
8265 std::fprintf(stderr,
" %u/%u identifiers read (%f%%)\n",
8266 NumIdentifiersLoaded, (
unsigned)IdentifiersLoaded.size(),
8267 ((
float)NumIdentifiersLoaded/IdentifiersLoaded.size() * 100));
8268 if (!MacrosLoaded.empty())
8269 std::fprintf(stderr,
" %u/%u macros read (%f%%)\n",
8270 NumMacrosLoaded, (
unsigned)MacrosLoaded.size(),
8271 ((
float)NumMacrosLoaded/MacrosLoaded.size() * 100));
8272 if (!SelectorsLoaded.empty())
8273 std::fprintf(stderr,
" %u/%u selectors read (%f%%)\n",
8274 NumSelectorsLoaded, (
unsigned)SelectorsLoaded.size(),
8275 ((
float)NumSelectorsLoaded/SelectorsLoaded.size() * 100));
8276 if (TotalNumStatements)
8277 std::fprintf(stderr,
" %u/%u statements read (%f%%)\n",
8278 NumStatementsRead, TotalNumStatements,
8279 ((
float)NumStatementsRead/TotalNumStatements * 100));
8281 std::fprintf(stderr,
" %u/%u macros read (%f%%)\n",
8282 NumMacrosRead, TotalNumMacros,
8283 ((
float)NumMacrosRead/TotalNumMacros * 100));
8284 if (TotalLexicalDeclContexts)
8285 std::fprintf(stderr,
" %u/%u lexical declcontexts read (%f%%)\n",
8286 NumLexicalDeclContextsRead, TotalLexicalDeclContexts,
8287 ((
float)NumLexicalDeclContextsRead/TotalLexicalDeclContexts
8289 if (TotalVisibleDeclContexts)
8290 std::fprintf(stderr,
" %u/%u visible declcontexts read (%f%%)\n",
8291 NumVisibleDeclContextsRead, TotalVisibleDeclContexts,
8292 ((
float)NumVisibleDeclContextsRead/TotalVisibleDeclContexts
8294 if (TotalNumMethodPoolEntries)
8295 std::fprintf(stderr,
" %u/%u method pool entries read (%f%%)\n",
8296 NumMethodPoolEntriesRead, TotalNumMethodPoolEntries,
8297 ((
float)NumMethodPoolEntriesRead/TotalNumMethodPoolEntries
8299 if (NumMethodPoolLookups)
8300 std::fprintf(stderr,
" %u/%u method pool lookups succeeded (%f%%)\n",
8301 NumMethodPoolHits, NumMethodPoolLookups,
8302 ((
float)NumMethodPoolHits/NumMethodPoolLookups * 100.0));
8303 if (NumMethodPoolTableLookups)
8304 std::fprintf(stderr,
" %u/%u method pool table lookups succeeded (%f%%)\n",
8305 NumMethodPoolTableHits, NumMethodPoolTableLookups,
8306 ((
float)NumMethodPoolTableHits/NumMethodPoolTableLookups
8308 if (NumIdentifierLookupHits)
8309 std::fprintf(stderr,
8310 " %u / %u identifier table lookups succeeded (%f%%)\n",
8311 NumIdentifierLookupHits, NumIdentifierLookups,
8312 (
double)NumIdentifierLookupHits*100.0/NumIdentifierLookups);
8315 std::fprintf(stderr,
"\n");
8316 GlobalIndex->printStats();
8319 std::fprintf(stderr,
"\n");
8321 std::fprintf(stderr,
"\n");
8324template<
typename Key,
typename ModuleFile,
unsigned InitialCapacity>
8325LLVM_DUMP_METHOD
static void
8328 InitialCapacity> &Map) {
8329 if (Map.begin() == Map.end())
8334 llvm::errs() << Name <<
":\n";
8335 for (
typename MapType::const_iterator I = Map.begin(), IEnd = Map.end();
8337 llvm::errs() <<
" " << (
DeclID)I->first <<
" -> " << I->second->FileName
8342 llvm::errs() <<
"*** PCH/ModuleFile Remappings:\n";
8344 dumpModuleIDMap(
"Global source location entry map", GlobalSLocEntryMap);
8349 GlobalPreprocessedEntityMap);
8351 llvm::errs() <<
"\n*** PCH/Modules Loaded:";
8360 if (llvm::MemoryBuffer *buf = I.Buffer) {
8361 size_t bytes = buf->getBufferSize();
8362 switch (buf->getBufferKind()) {
8363 case llvm::MemoryBuffer::MemoryBuffer_Malloc:
8366 case llvm::MemoryBuffer::MemoryBuffer_MMap:
8382 pushExternalDeclIntoScope(
D,
D->getDeclName());
8384 PreloadedDeclIDs.clear();
8387 if (!FPPragmaOptions.empty()) {
8388 assert(FPPragmaOptions.size() == 1 &&
"Wrong number of FP_PRAGMA_OPTIONS");
8391 SemaObj->CurFPFeatures =
8395 SemaObj->OpenCLFeatures = OpenCLExtensions;
8401 assert(SemaObj &&
"no Sema to update");
8405 if (!SemaDeclRefs.empty()) {
8406 assert(SemaDeclRefs.size() % 3 == 0);
8407 for (
unsigned I = 0; I != SemaDeclRefs.size(); I += 3) {
8408 if (!SemaObj->StdNamespace)
8409 SemaObj->StdNamespace = SemaDeclRefs[I].getRawValue();
8410 if (!SemaObj->StdBadAlloc)
8411 SemaObj->StdBadAlloc = SemaDeclRefs[I + 1].getRawValue();
8412 if (!SemaObj->StdAlignValT)
8413 SemaObj->StdAlignValT = SemaDeclRefs[I + 2].getRawValue();
8415 SemaDeclRefs.clear();
8420 if(OptimizeOffPragmaLocation.isValid())
8421 SemaObj->ActOnPragmaOptimize(
false, OptimizeOffPragmaLocation);
8422 if (PragmaMSStructState != -1)
8424 if (PointersToMembersPragmaLocation.isValid()) {
8425 SemaObj->ActOnPragmaMSPointersToMembers(
8427 PragmaMSPointersToMembersState,
8428 PointersToMembersPragmaLocation);
8430 SemaObj->CUDA().ForceHostDeviceDepth = ForceHostDeviceDepth;
8432 if (PragmaAlignPackCurrentValue) {
8436 bool DropFirst =
false;
8437 if (!PragmaAlignPackStack.empty() &&
8438 PragmaAlignPackStack.front().Location.isInvalid()) {
8439 assert(PragmaAlignPackStack.front().Value ==
8440 SemaObj->AlignPackStack.DefaultValue &&
8441 "Expected a default alignment value");
8442 SemaObj->AlignPackStack.Stack.emplace_back(
8443 PragmaAlignPackStack.front().SlotLabel,
8444 SemaObj->AlignPackStack.CurrentValue,
8445 SemaObj->AlignPackStack.CurrentPragmaLocation,
8446 PragmaAlignPackStack.front().PushLocation);
8449 for (
const auto &Entry :
8450 llvm::ArrayRef(PragmaAlignPackStack).drop_front(DropFirst ? 1 : 0)) {
8451 SemaObj->AlignPackStack.Stack.emplace_back(
8452 Entry.SlotLabel, Entry.Value, Entry.Location, Entry.PushLocation);
8454 if (PragmaAlignPackCurrentLocation.isInvalid()) {
8455 assert(*PragmaAlignPackCurrentValue ==
8456 SemaObj->AlignPackStack.DefaultValue &&
8457 "Expected a default align and pack value");
8460 SemaObj->AlignPackStack.CurrentValue = *PragmaAlignPackCurrentValue;
8461 SemaObj->AlignPackStack.CurrentPragmaLocation =
8462 PragmaAlignPackCurrentLocation;
8465 if (FpPragmaCurrentValue) {
8469 bool DropFirst =
false;
8470 if (!FpPragmaStack.empty() && FpPragmaStack.front().Location.isInvalid()) {
8471 assert(FpPragmaStack.front().Value ==
8472 SemaObj->FpPragmaStack.DefaultValue &&
8473 "Expected a default pragma float_control value");
8474 SemaObj->FpPragmaStack.Stack.emplace_back(
8475 FpPragmaStack.front().SlotLabel, SemaObj->FpPragmaStack.CurrentValue,
8476 SemaObj->FpPragmaStack.CurrentPragmaLocation,
8477 FpPragmaStack.front().PushLocation);
8480 for (
const auto &Entry :
8482 SemaObj->FpPragmaStack.Stack.emplace_back(
8483 Entry.SlotLabel, Entry.Value, Entry.Location, Entry.PushLocation);
8484 if (FpPragmaCurrentLocation.isInvalid()) {
8485 assert(*FpPragmaCurrentValue == SemaObj->FpPragmaStack.DefaultValue &&
8486 "Expected a default pragma float_control value");
8489 SemaObj->FpPragmaStack.CurrentValue = *FpPragmaCurrentValue;
8490 SemaObj->FpPragmaStack.CurrentPragmaLocation = FpPragmaCurrentLocation;
8495 for (
auto &Import : PendingImportedModulesSema) {
8496 if (Import.ImportLoc.isInvalid())
8498 if (
Module *Imported = getSubmodule(Import.ID)) {
8499 SemaObj->makeModuleVisible(Imported, Import.ImportLoc);
8502 PendingImportedModulesSema.clear();
8509 IdentifierLookupVisitor Visitor(Name, 0,
8510 NumIdentifierLookups,
8511 NumIdentifierLookupHits);
8517 if (PP.getLangOpts().CPlusPlus) {
8518 for (
auto *F : ModuleMgr.pch_modules())
8526 if (!loadGlobalIndex()) {
8527 if (GlobalIndex->lookupIdentifier(Name, Hits)) {
8532 ModuleMgr.visit(Visitor, HitsPtr);
8536 markIdentifierUpToDate(II);
8554 ASTIdentifierLookupTable::key_iterator Current;
8558 ASTIdentifierLookupTable::key_iterator End;
8565 bool SkipModules =
false);
8567 StringRef Next()
override;
8574 : Reader(Reader), Index(Reader.ModuleMgr.size()), SkipModules(SkipModules) {
8578 while (Current == End) {
8590 Current = IdTable->key_begin();
8591 End = IdTable->key_end();
8596 StringRef
Result = *Current;
8605 std::unique_ptr<IdentifierIterator> Current;
8606 std::unique_ptr<IdentifierIterator> Queued;
8609 ChainedIdentifierIterator(std::unique_ptr<IdentifierIterator>
First,
8610 std::unique_ptr<IdentifierIterator> Second)
8611 : Current(
std::move(
First)), Queued(
std::move(Second)) {}
8613 StringRef Next()
override {
8617 StringRef result = Current->Next();
8618 if (!result.empty())
8623 std::swap(Current, Queued);
8632 std::unique_ptr<IdentifierIterator> ReaderIter(
8634 std::unique_ptr<IdentifierIterator> ModulesIter(
8635 GlobalIndex->createIdentifierIterator());
8636 return new ChainedIdentifierIterator(std::move(ReaderIter),
8637 std::move(ModulesIter));
8644namespace serialization {
8649 unsigned PriorGeneration;
8650 unsigned InstanceBits = 0;
8651 unsigned FactoryBits = 0;
8652 bool InstanceHasMoreThanOneDecl =
false;
8653 bool FactoryHasMoreThanOneDecl =
false;
8659 unsigned PriorGeneration)
8660 : Reader(Reader), Sel(Sel), PriorGeneration(PriorGeneration) {}
8670 ++Reader.NumMethodPoolTableLookups;
8673 ASTSelectorLookupTable::iterator Pos = PoolTable->find(Sel);
8674 if (Pos == PoolTable->end())
8677 ++Reader.NumMethodPoolTableHits;
8678 ++Reader.NumSelectorsRead;
8682 ++Reader.NumMethodPoolEntriesRead;
8684 if (Reader.DeserializationListener)
8690 InstanceMethods.append(
Data.Instance.rbegin(),
Data.Instance.rend());
8691 FactoryMethods.append(
Data.Factory.rbegin(),
Data.Factory.rend());
8692 InstanceBits =
Data.InstanceBits;
8693 FactoryBits =
Data.FactoryBits;
8694 InstanceHasMoreThanOneDecl =
Data.InstanceHasMoreThanOneDecl;
8695 FactoryHasMoreThanOneDecl =
Data.FactoryHasMoreThanOneDecl;
8701 return InstanceMethods;
8706 return FactoryMethods;
8713 return InstanceHasMoreThanOneDecl;
8731 unsigned &Generation = SelectorGeneration[Sel];
8732 unsigned PriorGeneration = Generation;
8734 SelectorOutOfDate[Sel] =
false;
8737 ++NumMethodPoolLookups;
8739 ModuleMgr.
visit(Visitor);
8745 ++NumMethodPoolHits;
8770 if (SelectorOutOfDate[Sel])
8778 for (
unsigned I = 0, N = KnownNamespaces.size(); I != N; ++I) {
8780 = dyn_cast_or_null<NamespaceDecl>(
GetDecl(KnownNamespaces[I])))
8781 Namespaces.push_back(Namespace);
8786 llvm::MapVector<NamedDecl *, SourceLocation> &Undefined) {
8787 for (
unsigned Idx = 0, N = UndefinedButUsed.size(); Idx != N;) {
8788 UndefinedButUsedDecl &
U = UndefinedButUsed[Idx++];
8791 Undefined.insert(std::make_pair(
D,
Loc));
8793 UndefinedButUsed.clear();
8799 for (
unsigned Idx = 0, N = DelayedDeleteExprs.size(); Idx != N;) {
8802 uint64_t Count = DelayedDeleteExprs[Idx++];
8803 for (uint64_t
C = 0;
C < Count; ++
C) {
8806 const bool IsArrayForm = DelayedDeleteExprs[Idx++];
8807 Exprs[FD].push_back(std::make_pair(DeleteLoc, IsArrayForm));
8814 for (
unsigned I = 0, N = TentativeDefinitions.size(); I != N; ++I) {
8815 VarDecl *Var = dyn_cast_or_null<VarDecl>(
GetDecl(TentativeDefinitions[I]));
8817 TentativeDefs.push_back(Var);
8819 TentativeDefinitions.clear();
8824 for (
unsigned I = 0, N = UnusedFileScopedDecls.size(); I != N; ++I) {
8826 = dyn_cast_or_null<DeclaratorDecl>(
GetDecl(UnusedFileScopedDecls[I]));
8830 UnusedFileScopedDecls.clear();
8835 for (
unsigned I = 0, N = DelegatingCtorDecls.size(); I != N; ++I) {
8837 = dyn_cast_or_null<CXXConstructorDecl>(
GetDecl(DelegatingCtorDecls[I]));
8841 DelegatingCtorDecls.clear();
8845 for (
unsigned I = 0, N = ExtVectorDecls.size(); I != N; ++I) {
8847 = dyn_cast_or_null<TypedefNameDecl>(
GetDecl(ExtVectorDecls[I]));
8851 ExtVectorDecls.clear();
8856 for (
unsigned I = 0, N = UnusedLocalTypedefNameCandidates.size(); I != N;
8859 GetDecl(UnusedLocalTypedefNameCandidates[I]));
8863 UnusedLocalTypedefNameCandidates.clear();
8868 for (
auto I : DeclsToCheckForDeferredDiags) {
8869 auto *
D = dyn_cast_or_null<Decl>(
GetDecl(I));
8873 DeclsToCheckForDeferredDiags.clear();
8878 if (ReferencedSelectorsData.empty())
8883 unsigned int DataSize = ReferencedSelectorsData.size()-1;
8885 while (I < DataSize) {
8889 Sels.push_back(std::make_pair(Sel, SelLoc));
8891 ReferencedSelectorsData.clear();
8896 if (WeakUndeclaredIdentifiers.empty())
8899 for (
unsigned I = 0, N = WeakUndeclaredIdentifiers.size(); I < N; ) {
8907 WeakIDs.push_back(std::make_pair(WeakId, WI));
8909 WeakUndeclaredIdentifiers.clear();
8913 for (
unsigned Idx = 0, N = VTableUses.size(); Idx < N; ) {
8915 VTableUse &TableInfo = VTableUses[Idx++];
8916 VT.
Record = dyn_cast_or_null<CXXRecordDecl>(
GetDecl(TableInfo.ID));
8919 VTables.push_back(VT);
8927 for (
unsigned Idx = 0, N = PendingInstantiations.size(); Idx < N;) {
8928 PendingInstantiation &Inst = PendingInstantiations[Idx++];
8932 Pending.push_back(std::make_pair(
D,
Loc));
8934 PendingInstantiations.clear();
8938 llvm::MapVector<
const FunctionDecl *, std::unique_ptr<LateParsedTemplate>>
8940 for (
auto &LPT : LateParsedTemplates) {
8943 for (
unsigned Idx = 0, N = LateParsed.size(); Idx < N;
8945 FunctionDecl *FD = ReadDeclAs<FunctionDecl>(*FMod, LateParsed, Idx);
8947 auto LT = std::make_unique<LateParsedTemplate>();
8952 assert(F &&
"No module");
8954 unsigned TokN = LateParsed[Idx++];
8955 LT->Toks.reserve(TokN);
8956 for (
unsigned T = 0;
T < TokN; ++
T)
8957 LT->Toks.push_back(
ReadToken(*F, LateParsed, Idx));
8959 LPTMap.insert(std::make_pair(FD, std::move(
LT)));
8963 LateParsedTemplates.clear();
8970 LambdaDeclarationsForMerging.insert(
8983 assert(ID &&
"Non-zero identifier ID required");
8984 unsigned Index = translateIdentifierIDToIndex(ID).second;
8985 assert(Index < IdentifiersLoaded.size() &&
"identifier ID out of range");
8986 IdentifiersLoaded[Index] = II;
8987 if (DeserializationListener)
9010 if (NumCurrentElementsDeserializing && !Decls) {
9011 PendingIdentifierInfos[II].append(DeclIDs.begin(), DeclIDs.end());
9015 for (
unsigned I = 0, N = DeclIDs.size(); I != N; ++I) {
9028 Decls->push_back(
D);
9035 pushExternalDeclIntoScope(
D, II);
9039std::pair<ModuleFile *, unsigned>
9040ASTReader::translateIdentifierIDToIndex(
IdentifierID ID)
const {
9042 return {
nullptr, 0};
9044 unsigned ModuleFileIndex = ID >> 32;
9045 unsigned LocalID = ID & llvm::maskTrailingOnes<IdentifierID>(32);
9047 assert(ModuleFileIndex &&
"not translating loaded IdentifierID?");
9059 if (IdentifiersLoaded.empty()) {
9060 Error(
"no identifier table in AST file");
9064 auto [M, Index] = translateIdentifierIDToIndex(ID);
9065 if (!IdentifiersLoaded[Index]) {
9066 assert(M !=
nullptr &&
"Untranslated Identifier ID?");
9069 const unsigned char *
Data =
9076 IdentifiersLoaded[Index] = &II;
9079 if (DeserializationListener)
9083 return IdentifiersLoaded[Index];
9095 ReadModuleOffsetMap(M);
9097 unsigned ModuleFileIndex = LocalID >> 32;
9098 LocalID &= llvm::maskTrailingOnes<IdentifierID>(32);
9101 assert(MF &&
"malformed identifier ID encoding?");
9103 if (!ModuleFileIndex)
9113 if (MacrosLoaded.empty()) {
9114 Error(
"no macro table in AST file");
9119 if (!MacrosLoaded[ID]) {
9122 assert(I != GlobalMacroMap.
end() &&
"Corrupted global macro map");
9128 if (DeserializationListener)
9133 return MacrosLoaded[ID];
9141 ReadModuleOffsetMap(M);
9145 assert(I != M.
MacroRemap.
end() &&
"Invalid index into macro index remap");
9147 return LocalID + I->second;
9156 ReadModuleOffsetMap(M);
9161 &&
"Invalid index into submodule index remap");
9163 return LocalID + I->second;
9168 assert(GlobalID == 0 &&
"Unhandled global submodule ID");
9172 if (GlobalID > SubmodulesLoaded.size()) {
9173 Error(
"submodule ID out of range in AST file");
9188 return I == GlobalSubmoduleMap.
end() ? nullptr : I->second;
9191 unsigned IndexFromEnd = ID >> 1;
9192 assert(IndexFromEnd &&
"got reference to unknown module file");
9209 auto I = llvm::find(PCHModules, M);
9210 assert(I != PCHModules.end() &&
"emitting reference to unknown file");
9211 return (I - PCHModules.end()) << 1;
9221 if (std::distance(std::begin(PCHChain), std::end(PCHChain))) {
9226 llvm::sys::path::parent_path(MF.
FileName),
9229 return std::nullopt;
9233 auto I = DefinitionSource.find(FD);
9234 if (I == DefinitionSource.end())
9247 if (ID > SelectorsLoaded.size()) {
9248 Error(
"selector ID out of range in AST file");
9252 if (SelectorsLoaded[ID - 1].getAsOpaquePtr() ==
nullptr) {
9255 assert(I != GlobalSelectorMap.
end() &&
"Corrupted global selector map");
9259 SelectorsLoaded[ID - 1] =
9261 if (DeserializationListener)
9262 DeserializationListener->
SelectorRead(ID, SelectorsLoaded[ID - 1]);
9265 return SelectorsLoaded[ID - 1];
9283 ReadModuleOffsetMap(M);
9288 &&
"Invalid index into selector index remap");
9290 return LocalID + I->second;
9295 switch (Name.getNameKind()) {
9321 NameInfo.
setName(readDeclarationName());
9333 unsigned NumTPLists =
readInt();
9338 for (
unsigned i = 0; i != NumTPLists; ++i)
9349 unsigned NumParams =
readInt();
9351 Params.reserve(NumParams);
9353 Params.push_back(readDeclAs<NamedDecl>());
9355 bool HasRequiresClause =
readBool();
9356 Expr *RequiresClause = HasRequiresClause ?
readExpr() :
nullptr;
9359 getContext(), TemplateLoc, LAngleLoc, Params, RAngleLoc, RequiresClause);
9360 return TemplateParams;
9365 bool Canonicalize) {
9366 unsigned NumTemplateArgs =
readInt();
9367 TemplArgs.reserve(NumTemplateArgs);
9368 while (NumTemplateArgs--)
9374 unsigned NumDecls =
readInt();
9376 while (NumDecls--) {
9388 bool inheritConstructors =
readBool();
9394 Result.setInheritConstructors(inheritConstructors);
9401 unsigned NumInitializers =
readInt();
9402 assert(NumInitializers &&
"wrote ctor initializers but have no inits");
9404 for (
unsigned i = 0; i != NumInitializers; ++i) {
9406 bool IsBaseVirtual =
false;
9422 Member = readDeclAs<FieldDecl>();
9426 IndirectMember = readDeclAs<IndirectFieldDecl>();
9437 BOMInit =
new (Context)
9439 RParenLoc, MemberOrEllipsisLoc);
9441 BOMInit =
new (Context)
9444 BOMInit =
new (Context)
9448 BOMInit =
new (Context)
9450 LParenLoc,
Init, RParenLoc);
9453 unsigned SourceOrder =
readInt();
9457 CtorInitializers[i] = BOMInit;
9460 return CtorInitializers;
9468 for (
unsigned I = 0; I != N; ++I) {
9469 auto Kind = readNestedNameSpecifierKind();
9501 Builder.Extend(Context,
9503 T->getTypeLoc(), ColonColonLoc);
9509 Builder.MakeGlobal(Context, ColonColonLoc);
9522 return Builder.getWithLocInContext(Context);
9533 const StringRef Blob) {
9534 unsigned Count =
Record[0];
9535 const char *Byte = Blob.data();
9536 llvm::BitVector Ret = llvm::BitVector(Count,
false);
9537 for (
unsigned I = 0; I < Count; ++Byte)
9538 for (
unsigned Bit = 0; Bit < 8 && I < Count; ++Bit, ++I)
9539 if (*Byte & (1 << Bit))
9551 unsigned Len =
Record[Idx++];
9567 if (!BaseDirectory.empty())
9574 unsigned Major =
Record[Idx++];
9575 unsigned Minor =
Record[Idx++];
9576 unsigned Subminor =
Record[Idx++];
9578 return VersionTuple(Major);
9580 return VersionTuple(Major, Minor - 1);
9581 return VersionTuple(Major, Minor - 1, Subminor - 1);
9592 return Diag(CurrentImportLoc, DiagID);
9606 if (WarnedStackExhausted)
9608 WarnedStackExhausted =
true;
9610 Diag(
Loc, diag::warn_stack_exhausted);
9622 assert((*CurrSwitchCaseStmts)[ID] ==
nullptr &&
9623 "Already have a SwitchCase with this ID");
9624 (*CurrSwitchCaseStmts)[ID] = SC;
9629 assert((*CurrSwitchCaseStmts)[ID] !=
nullptr &&
"No SwitchCase with this ID");
9630 return (*CurrSwitchCaseStmts)[ID];
9634 CurrSwitchCaseStmts->clear();
9639 std::vector<RawComment *> Comments;
9646 BitstreamCursor &Cursor = I->first;
9653 Cursor.advanceSkippingSubblocks(
9654 BitstreamCursor::AF_DontPopBlockAtEnd);
9656 Error(MaybeEntry.takeError());
9659 llvm::BitstreamEntry Entry = MaybeEntry.get();
9661 switch (Entry.Kind) {
9662 case llvm::BitstreamEntry::SubBlock:
9663 case llvm::BitstreamEntry::Error:
9664 Error(
"malformed block record in AST file");
9666 case llvm::BitstreamEntry::EndBlock:
9668 case llvm::BitstreamEntry::Record:
9676 if (!MaybeComment) {
9677 Error(MaybeComment.takeError());
9686 bool IsTrailingComment =
Record[Idx++];
9687 bool IsAlmostTrailingComment =
Record[Idx++];
9689 SR, Kind, IsTrailingComment, IsAlmostTrailingComment));
9695 llvm::DenseMap<FileID, std::map<unsigned, RawComment *>>
9696 FileToOffsetToComment;
9700 std::pair<FileID, unsigned>
Loc =
9716 assert(NumUserInputs <= NumInputs);
9717 unsigned N = IncludeSystem ? NumInputs : NumUserInputs;
9718 for (
unsigned I = 0; I < N; ++I) {
9719 bool IsSystem = I >= NumUserInputs;
9721 Visitor(IFI, IsSystem);
9726 bool IncludeSystem,
bool Complain,
9728 bool isSystem)> Visitor) {
9731 assert(NumUserInputs <= NumInputs);
9732 unsigned N = IncludeSystem ? NumInputs : NumUserInputs;
9733 for (
unsigned I = 0; I < N; ++I) {
9734 bool IsSystem = I >= NumUserInputs;
9735 InputFile IF = getInputFile(MF, I+1, Complain);
9736 Visitor(IF, IsSystem);
9744 for (
unsigned I = 0; I < NumInputs; ++I) {
9747 if (
auto FE = getInputFile(MF, I + 1).getFile())
9752void ASTReader::finishPendingActions() {
9754 !PendingIdentifierInfos.empty() || !PendingDeducedFunctionTypes.empty() ||
9755 !PendingDeducedVarTypes.empty() || !PendingIncompleteDeclChains.empty() ||
9756 !PendingDeclChains.empty() || !PendingMacroIDs.empty() ||
9757 !PendingDeclContextInfos.empty() || !PendingUpdateRecords.empty() ||
9758 !PendingObjCExtensionIvarRedeclarations.empty()) {
9761 using TopLevelDeclsMap =
9762 llvm::DenseMap<IdentifierInfo *, SmallVector<Decl *, 2>>;
9763 TopLevelDeclsMap TopLevelDecls;
9765 while (!PendingIdentifierInfos.empty()) {
9768 std::move(PendingIdentifierInfos.back().second);
9769 PendingIdentifierInfos.pop_back();
9776 for (
unsigned I = 0; I != PendingDeducedFunctionTypes.size(); ++I) {
9777 auto *FD = PendingDeducedFunctionTypes[I].first;
9778 FD->setType(
GetType(PendingDeducedFunctionTypes[I].second));
9780 if (
auto *DT = FD->getReturnType()->getContainedDeducedType()) {
9783 if (DT->isDeduced()) {
9784 PendingDeducedTypeUpdates.insert(
9785 {FD->getCanonicalDecl(), FD->getReturnType()});
9792 PendingUndeducedFunctionDecls.push_back(FD);
9796 PendingDeducedFunctionTypes.clear();
9800 for (
unsigned I = 0; I != PendingDeducedVarTypes.size(); ++I) {
9801 auto *VD = PendingDeducedVarTypes[I].first;
9802 VD->setType(
GetType(PendingDeducedVarTypes[I].second));
9804 PendingDeducedVarTypes.clear();
9808 for (
unsigned I = 0; I != PendingIncompleteDeclChains.size(); ++I) {
9809 markIncompleteDeclChain(PendingIncompleteDeclChains[I]);
9811 PendingIncompleteDeclChains.clear();
9814 for (
unsigned I = 0; I != PendingDeclChains.size(); ++I)
9815 loadPendingDeclChain(PendingDeclChains[I].first,
9816 PendingDeclChains[I].second);
9817 PendingDeclChains.clear();
9820 for (TopLevelDeclsMap::iterator TLD = TopLevelDecls.begin(),
9821 TLDEnd = TopLevelDecls.end(); TLD != TLDEnd; ++TLD) {
9823 for (
unsigned I = 0, N = TLD->second.size(); I != N; ++I) {
9824 pushExternalDeclIntoScope(cast<NamedDecl>(TLD->second[I]), II);
9829 for (
unsigned I = 0; I != PendingMacroIDs.size(); ++I) {
9832 GlobalIDs.swap(PendingMacroIDs.begin()[I].second);
9834 for (
unsigned IDIdx = 0, NumIDs = GlobalIDs.size(); IDIdx != NumIDs;
9836 const PendingMacroInfo &Info = GlobalIDs[IDIdx];
9837 if (!Info.M->isModule())
9841 for (
unsigned IDIdx = 0, NumIDs = GlobalIDs.size(); IDIdx != NumIDs;
9843 const PendingMacroInfo &Info = GlobalIDs[IDIdx];
9844 if (Info.M->isModule())
9848 PendingMacroIDs.clear();
9852 while (!PendingDeclContextInfos.empty()) {
9853 PendingDeclContextInfo Info = PendingDeclContextInfos.front();
9854 PendingDeclContextInfos.pop_front();
9857 Info.D->setDeclContextsImpl(SemaDC, LexicalDC,
getContext());
9861 while (!PendingUpdateRecords.empty()) {
9862 auto Update = PendingUpdateRecords.pop_back_val();
9863 ReadingKindTracker ReadingKind(Read_Decl, *
this);
9864 loadDeclUpdateRecords(
Update);
9867 while (!PendingObjCExtensionIvarRedeclarations.empty()) {
9868 auto ExtensionsPair = PendingObjCExtensionIvarRedeclarations.back().first;
9869 auto DuplicateIvars =
9870 PendingObjCExtensionIvarRedeclarations.back().second;
9871 llvm::DenseSet<std::pair<Decl *, Decl *>> NonEquivalentDecls;
9873 ExtensionsPair.first->getASTContext(),
9874 ExtensionsPair.second->getASTContext(), NonEquivalentDecls,
9878 if (Ctx.IsEquivalent(ExtensionsPair.first, ExtensionsPair.second)) {
9880 for (
auto IvarPair : DuplicateIvars) {
9881 ObjCIvarDecl *Ivar = IvarPair.first, *PrevIvar = IvarPair.second;
9883 Ivar->setDeclContextsImpl(PrevIvar->getDeclContext(),
9889 ExtensionsPair.first->setInvalidDecl();
9890 ExtensionsPair.second->getClassInterface()
9892 ->setIvarList(
nullptr);
9894 for (
auto IvarPair : DuplicateIvars) {
9895 Diag(IvarPair.first->getLocation(),
9896 diag::err_duplicate_ivar_declaration)
9897 << IvarPair.first->getIdentifier();
9898 Diag(IvarPair.second->getLocation(), diag::note_previous_definition);
9901 PendingObjCExtensionIvarRedeclarations.pop_back();
9907 assert(PendingFakeDefinitionData.empty() &&
9908 "faked up a class definition but never saw the real one");
9914 for (
Decl *
D : PendingDefinitions) {
9915 if (
TagDecl *TD = dyn_cast<TagDecl>(
D)) {
9916 if (
const TagType *TagT = dyn_cast<TagType>(TD->getTypeForDecl())) {
9921 if (
auto RD = dyn_cast<CXXRecordDecl>(
D)) {
9922 for (
auto *R = getMostRecentExistingDecl(RD); R;
9925 cast<CXXRecordDecl>(R)->isThisDeclarationADefinition() &&
9926 "declaration thinks it's the definition but it isn't");
9927 cast<CXXRecordDecl>(R)->DefinitionData = RD->DefinitionData;
9934 if (
auto ID = dyn_cast<ObjCInterfaceDecl>(
D)) {
9939 for (
auto *R = getMostRecentExistingDecl(ID); R; R = R->
getPreviousDecl())
9940 cast<ObjCInterfaceDecl>(R)->Data =
ID->Data;
9945 if (
auto PD = dyn_cast<ObjCProtocolDecl>(
D)) {
9946 for (
auto *R = getMostRecentExistingDecl(PD); R; R = R->
getPreviousDecl())
9947 cast<ObjCProtocolDecl>(R)->Data = PD->Data;
9952 auto RTD = cast<RedeclarableTemplateDecl>(
D)->getCanonicalDecl();
9953 for (
auto *R = getMostRecentExistingDecl(RTD); R; R = R->
getPreviousDecl())
9954 cast<RedeclarableTemplateDecl>(R)->Common = RTD->Common;
9956 PendingDefinitions.clear();
9962 for (PendingBodiesMap::iterator PB = PendingBodies.begin(),
9963 PBEnd = PendingBodies.end();
9964 PB != PBEnd; ++PB) {
9965 if (
FunctionDecl *FD = dyn_cast<FunctionDecl>(PB->first)) {
9975 if (
auto *RD = dyn_cast<CXXRecordDecl>(FD->getLexicalParent()))
9981 if (!
getContext().getLangOpts().Modules || !FD->hasBody(Defn)) {
9987 if (!FD->isLateTemplateParsed() &&
9988 !NonConstDefn->isLateTemplateParsed() &&
9993 FD->getODRHash() != NonConstDefn->getODRHash()) {
9994 if (!isa<CXXMethodDecl>(FD)) {
9995 PendingFunctionOdrMergeFailures[FD].push_back(NonConstDefn);
9996 }
else if (FD->getLexicalParent()->isFileContext() &&
9997 NonConstDefn->getLexicalParent()->isFileContext()) {
10001 PendingFunctionOdrMergeFailures[FD].push_back(NonConstDefn);
10012 PendingBodies.clear();
10015 for (
auto [RD, MD] : PendingAddedClassMembers) {
10016 RD->addedMember(MD);
10018 PendingAddedClassMembers.clear();
10021 for (
auto *ND : PendingMergedDefinitionsToDeduplicate)
10023 PendingMergedDefinitionsToDeduplicate.clear();
10026void ASTReader::diagnoseOdrViolations() {
10027 if (PendingOdrMergeFailures.empty() && PendingOdrMergeChecks.empty() &&
10028 PendingRecordOdrMergeFailures.empty() &&
10029 PendingFunctionOdrMergeFailures.empty() &&
10030 PendingEnumOdrMergeFailures.empty() &&
10031 PendingObjCInterfaceOdrMergeFailures.empty() &&
10032 PendingObjCProtocolOdrMergeFailures.empty())
10039 auto OdrMergeFailures = std::move(PendingOdrMergeFailures);
10040 PendingOdrMergeFailures.clear();
10041 for (
auto &Merge : OdrMergeFailures) {
10042 Merge.first->buildLookup();
10043 Merge.first->decls_begin();
10044 Merge.first->bases_begin();
10045 Merge.first->vbases_begin();
10046 for (
auto &RecordPair : Merge.second) {
10047 auto *RD = RecordPair.first;
10055 auto RecordOdrMergeFailures = std::move(PendingRecordOdrMergeFailures);
10056 PendingRecordOdrMergeFailures.clear();
10057 for (
auto &Merge : RecordOdrMergeFailures) {
10058 Merge.first->decls_begin();
10059 for (
auto &
D : Merge.second)
10064 auto ObjCInterfaceOdrMergeFailures =
10065 std::move(PendingObjCInterfaceOdrMergeFailures);
10066 PendingObjCInterfaceOdrMergeFailures.clear();
10067 for (
auto &Merge : ObjCInterfaceOdrMergeFailures) {
10068 Merge.first->decls_begin();
10069 for (
auto &InterfacePair : Merge.second)
10070 InterfacePair.first->decls_begin();
10074 auto FunctionOdrMergeFailures = std::move(PendingFunctionOdrMergeFailures);
10075 PendingFunctionOdrMergeFailures.clear();
10076 for (
auto &Merge : FunctionOdrMergeFailures) {
10077 Merge.first->buildLookup();
10078 Merge.first->decls_begin();
10079 Merge.first->getBody();
10080 for (
auto &FD : Merge.second) {
10088 auto EnumOdrMergeFailures = std::move(PendingEnumOdrMergeFailures);
10089 PendingEnumOdrMergeFailures.clear();
10090 for (
auto &Merge : EnumOdrMergeFailures) {
10091 Merge.first->decls_begin();
10092 for (
auto &
Enum : Merge.second) {
10093 Enum->decls_begin();
10098 auto ObjCProtocolOdrMergeFailures =
10099 std::move(PendingObjCProtocolOdrMergeFailures);
10100 PendingObjCProtocolOdrMergeFailures.clear();
10101 for (
auto &Merge : ObjCProtocolOdrMergeFailures) {
10102 Merge.first->decls_begin();
10103 for (
auto &ProtocolPair : Merge.second)
10104 ProtocolPair.first->decls_begin();
10113 while (!PendingOdrMergeChecks.empty()) {
10114 NamedDecl *
D = PendingOdrMergeChecks.pop_back_val();
10125 bool Found =
false;
10129 if (RI->getLexicalDeclContext() == CanonDef) {
10144 for (
auto *CanonMember : CanonDef->
decls()) {
10145 if (CanonMember->getCanonicalDecl() == DCanon) {
10154 if (
auto *ND = dyn_cast<NamedDecl>(CanonMember))
10155 if (ND->getDeclName() ==
D->getDeclName())
10156 Candidates.push_back(ND);
10162 if (!isa<TagDecl>(
D))
10167 Deserializing RecursionGuard(
this);
10169 std::string CanonDefModule =
10171 cast<Decl>(CanonDef));
10174 << CanonDef << CanonDefModule.empty() << CanonDefModule;
10176 if (Candidates.empty())
10177 Diag(cast<Decl>(CanonDef)->getLocation(),
10178 diag::note_module_odr_violation_no_possible_decls) <<
D;
10180 for (
unsigned I = 0, N = Candidates.size(); I != N; ++I)
10181 Diag(Candidates[I]->getLocation(),
10182 diag::note_module_odr_violation_possible_decl)
10186 DiagnosedOdrMergeFailures.insert(CanonDef);
10190 if (OdrMergeFailures.empty() && RecordOdrMergeFailures.empty() &&
10191 FunctionOdrMergeFailures.empty() && EnumOdrMergeFailures.empty() &&
10192 ObjCInterfaceOdrMergeFailures.empty() &&
10193 ObjCProtocolOdrMergeFailures.empty())
10200 for (
auto &Merge : OdrMergeFailures) {
10203 if (!DiagnosedOdrMergeFailures.insert(Merge.first).second)
10206 bool Diagnosed =
false;
10208 for (
auto &RecordPair : Merge.second) {
10209 if (DiagsEmitter.diagnoseMismatch(FirstRecord, RecordPair.first,
10210 RecordPair.second)) {
10223 Diag(Merge.first->getLocation(),
10224 diag::err_module_odr_violation_different_instantiations)
10231 for (
auto &Merge : RecordOdrMergeFailures) {
10234 if (!DiagnosedOdrMergeFailures.insert(Merge.first).second)
10238 bool Diagnosed =
false;
10239 for (
auto *SecondRecord : Merge.second) {
10240 if (DiagsEmitter.diagnoseMismatch(FirstRecord, SecondRecord)) {
10246 assert(Diagnosed &&
"Unable to emit ODR diagnostic.");
10250 for (
auto &Merge : FunctionOdrMergeFailures) {
10252 bool Diagnosed =
false;
10253 for (
auto &SecondFunction : Merge.second) {
10254 if (DiagsEmitter.diagnoseMismatch(FirstFunction, SecondFunction)) {
10260 assert(Diagnosed &&
"Unable to emit ODR diagnostic.");
10264 for (
auto &Merge : EnumOdrMergeFailures) {
10267 if (!DiagnosedOdrMergeFailures.insert(Merge.first).second)
10270 EnumDecl *FirstEnum = Merge.first;
10271 bool Diagnosed =
false;
10272 for (
auto &SecondEnum : Merge.second) {
10273 if (DiagsEmitter.diagnoseMismatch(FirstEnum, SecondEnum)) {
10279 assert(Diagnosed &&
"Unable to emit ODR diagnostic.");
10282 for (
auto &Merge : ObjCInterfaceOdrMergeFailures) {
10285 if (!DiagnosedOdrMergeFailures.insert(Merge.first).second)
10288 bool Diagnosed =
false;
10290 for (
auto &InterfacePair : Merge.second) {
10291 if (DiagsEmitter.diagnoseMismatch(FirstID, InterfacePair.first,
10292 InterfacePair.second)) {
10298 assert(Diagnosed &&
"Unable to emit ODR diagnostic.");
10301 for (
auto &Merge : ObjCProtocolOdrMergeFailures) {
10304 if (!DiagnosedOdrMergeFailures.insert(Merge.first).second)
10308 bool Diagnosed =
false;
10309 for (
auto &ProtocolPair : Merge.second) {
10310 if (DiagsEmitter.diagnoseMismatch(FirstProtocol, ProtocolPair.first,
10311 ProtocolPair.second)) {
10317 assert(Diagnosed &&
"Unable to emit ODR diagnostic.");
10322 if (++NumCurrentElementsDeserializing == 1 && ReadTimer.get())
10323 ReadTimer->startTimer();
10327 assert(NumCurrentElementsDeserializing &&
10328 "FinishedDeserializing not paired with StartedDeserializing");
10329 if (NumCurrentElementsDeserializing == 1) {
10332 finishPendingActions();
10334 --NumCurrentElementsDeserializing;
10336 if (NumCurrentElementsDeserializing == 0) {
10342 while (!PendingExceptionSpecUpdates.empty() ||
10343 !PendingDeducedTypeUpdates.empty()) {
10344 auto ESUpdates = std::move(PendingExceptionSpecUpdates);
10345 PendingExceptionSpecUpdates.clear();
10346 for (
auto Update : ESUpdates) {
10347 ProcessingUpdatesRAIIObj ProcessingUpdates(*
this);
10351 Listener->ResolvedExceptionSpec(cast<FunctionDecl>(
Update.second));
10352 for (
auto *Redecl :
Update.second->redecls())
10356 auto DTUpdates = std::move(PendingDeducedTypeUpdates);
10357 PendingDeducedTypeUpdates.clear();
10358 for (
auto Update : DTUpdates) {
10359 ProcessingUpdatesRAIIObj ProcessingUpdates(*
this);
10365 auto UDTUpdates = std::move(PendingUndeducedFunctionDecls);
10366 PendingUndeducedFunctionDecls.clear();
10370 (void)UndeducedFD->getMostRecentDecl();
10374 ReadTimer->stopTimer();
10376 diagnoseOdrViolations();
10381 PassInterestingDeclsToConsumer();
10388 auto It = PendingFakeLookupResults.find(II);
10389 if (It != PendingFakeLookupResults.end()) {
10390 for (
auto *ND : It->second)
10395 It->second.clear();
10401 }
else if (SemaObj->
TUScope) {
10413 ArrayRef<std::shared_ptr<ModuleFileExtension>> Extensions,
10414 StringRef isysroot,
10416 bool AllowASTWithCompilerErrors,
10417 bool AllowConfigurationMismatch,
bool ValidateSystemInputs,
10418 bool ValidateASTInputFilesContent,
bool UseGlobalIndex,
10419 std::unique_ptr<llvm::Timer> ReadTimer)
10423 SourceMgr(PP.getSourceManager()), FileMgr(PP.getFileManager()),
10424 PCHContainerRdr(PCHContainerRdr), Diags(PP.getDiagnostics()), PP(PP),
10425 ContextObj(Context), ModuleMgr(PP.getFileManager(), ModuleCache,
10426 PCHContainerRdr, PP.getHeaderSearchInfo()),
10427 DummyIdResolver(PP), ReadTimer(
std::move(ReadTimer)), isysroot(isysroot),
10428 DisableValidationKind(DisableValidationKind),
10429 AllowASTWithCompilerErrors(AllowASTWithCompilerErrors),
10430 AllowConfigurationMismatch(AllowConfigurationMismatch),
10431 ValidateSystemInputs(ValidateSystemInputs),
10432 ValidateASTInputFilesContent(ValidateASTInputFilesContent),
10433 UseGlobalIndex(UseGlobalIndex), CurrSwitchCaseStmts(&SwitchCaseStmts) {
10436 for (
const auto &Ext : Extensions) {
10437 auto BlockName = Ext->getExtensionMetadata().BlockName;
10438 auto Known = ModuleFileExtensions.find(BlockName);
10439 if (Known != ModuleFileExtensions.end()) {
10440 Diags.
Report(diag::warn_duplicate_module_file_extension)
10445 ModuleFileExtensions.insert({BlockName, Ext});
10450 if (OwnsDeserializationListener)
10451 delete DeserializationListener;
10455 return SemaObj ? SemaObj->
IdResolver : DummyIdResolver;
10459 unsigned AbbrevID) {
10462 return Cursor.readRecord(AbbrevID,
Record);
10479#define GEN_CLANG_CLAUSE_CLASS
10480#define CLAUSE_CLASS(Enum, Str, Class) void Visit##Class(Class *C);
10481#include "llvm/Frontend/OpenMP/OMP.inc"
10495 switch (llvm::omp::Clause(
Record.readInt())) {
10496 case llvm::omp::OMPC_if:
10499 case llvm::omp::OMPC_final:
10502 case llvm::omp::OMPC_num_threads:
10505 case llvm::omp::OMPC_safelen:
10508 case llvm::omp::OMPC_simdlen:
10511 case llvm::omp::OMPC_sizes: {
10512 unsigned NumSizes =
Record.readInt();
10516 case llvm::omp::OMPC_full:
10519 case llvm::omp::OMPC_partial:
10522 case llvm::omp::OMPC_allocator:
10525 case llvm::omp::OMPC_collapse:
10528 case llvm::omp::OMPC_default:
10531 case llvm::omp::OMPC_proc_bind:
10534 case llvm::omp::OMPC_schedule:
10537 case llvm::omp::OMPC_ordered:
10540 case llvm::omp::OMPC_nowait:
10543 case llvm::omp::OMPC_untied:
10546 case llvm::omp::OMPC_mergeable:
10549 case llvm::omp::OMPC_read:
10552 case llvm::omp::OMPC_write:
10555 case llvm::omp::OMPC_update:
10558 case llvm::omp::OMPC_capture:
10561 case llvm::omp::OMPC_compare:
10564 case llvm::omp::OMPC_fail:
10567 case llvm::omp::OMPC_seq_cst:
10570 case llvm::omp::OMPC_acq_rel:
10573 case llvm::omp::OMPC_absent: {
10574 unsigned NumKinds =
Record.readInt();
10578 case llvm::omp::OMPC_holds:
10581 case llvm::omp::OMPC_contains: {
10582 unsigned NumKinds =
Record.readInt();
10586 case llvm::omp::OMPC_no_openmp:
10589 case llvm::omp::OMPC_no_openmp_routines:
10592 case llvm::omp::OMPC_no_parallelism:
10595 case llvm::omp::OMPC_acquire:
10598 case llvm::omp::OMPC_release:
10601 case llvm::omp::OMPC_relaxed:
10604 case llvm::omp::OMPC_weak:
10607 case llvm::omp::OMPC_threads:
10610 case llvm::omp::OMPC_simd:
10613 case llvm::omp::OMPC_nogroup:
10616 case llvm::omp::OMPC_unified_address:
10619 case llvm::omp::OMPC_unified_shared_memory:
10622 case llvm::omp::OMPC_reverse_offload:
10625 case llvm::omp::OMPC_dynamic_allocators:
10628 case llvm::omp::OMPC_atomic_default_mem_order:
10631 case llvm::omp::OMPC_at:
10634 case llvm::omp::OMPC_severity:
10637 case llvm::omp::OMPC_message:
10640 case llvm::omp::OMPC_private:
10643 case llvm::omp::OMPC_firstprivate:
10646 case llvm::omp::OMPC_lastprivate:
10649 case llvm::omp::OMPC_shared:
10652 case llvm::omp::OMPC_reduction: {
10653 unsigned N =
Record.readInt();
10658 case llvm::omp::OMPC_task_reduction:
10661 case llvm::omp::OMPC_in_reduction:
10664 case llvm::omp::OMPC_linear:
10667 case llvm::omp::OMPC_aligned:
10670 case llvm::omp::OMPC_copyin:
10673 case llvm::omp::OMPC_copyprivate:
10676 case llvm::omp::OMPC_flush:
10679 case llvm::omp::OMPC_depobj:
10682 case llvm::omp::OMPC_depend: {
10683 unsigned NumVars =
Record.readInt();
10684 unsigned NumLoops =
Record.readInt();
10688 case llvm::omp::OMPC_device:
10691 case llvm::omp::OMPC_map: {
10700 case llvm::omp::OMPC_num_teams:
10703 case llvm::omp::OMPC_thread_limit:
10706 case llvm::omp::OMPC_priority:
10709 case llvm::omp::OMPC_grainsize:
10712 case llvm::omp::OMPC_num_tasks:
10715 case llvm::omp::OMPC_hint:
10718 case llvm::omp::OMPC_dist_schedule:
10721 case llvm::omp::OMPC_defaultmap:
10724 case llvm::omp::OMPC_to: {
10733 case llvm::omp::OMPC_from: {
10742 case llvm::omp::OMPC_use_device_ptr: {
10751 case llvm::omp::OMPC_use_device_addr: {
10760 case llvm::omp::OMPC_is_device_ptr: {
10769 case llvm::omp::OMPC_has_device_addr: {
10778 case llvm::omp::OMPC_allocate:
10781 case llvm::omp::OMPC_nontemporal:
10784 case llvm::omp::OMPC_inclusive:
10787 case llvm::omp::OMPC_exclusive:
10790 case llvm::omp::OMPC_order:
10793 case llvm::omp::OMPC_init:
10796 case llvm::omp::OMPC_use:
10799 case llvm::omp::OMPC_destroy:
10802 case llvm::omp::OMPC_novariants:
10805 case llvm::omp::OMPC_nocontext:
10808 case llvm::omp::OMPC_detach:
10811 case llvm::omp::OMPC_uses_allocators:
10814 case llvm::omp::OMPC_affinity:
10817 case llvm::omp::OMPC_filter:
10820 case llvm::omp::OMPC_bind:
10823 case llvm::omp::OMPC_align:
10826 case llvm::omp::OMPC_ompx_dyn_cgroup_mem:
10829 case llvm::omp::OMPC_doacross: {
10830 unsigned NumVars =
Record.readInt();
10831 unsigned NumLoops =
Record.readInt();
10835 case llvm::omp::OMPC_ompx_attribute:
10838 case llvm::omp::OMPC_ompx_bare:
10841#define OMP_CLAUSE_NO_CLASS(Enum, Str) \
10842 case llvm::omp::Enum: \
10844#include "llvm/Frontend/OpenMP/OMPKinds.def"
10848 assert(
C &&
"Unknown OMPClause type");
10851 C->setLocStart(
Record.readSourceLocation());
10852 C->setLocEnd(
Record.readSourceLocation());
10858 C->setPreInitStmt(
Record.readSubStmt(),
10864 C->setPostUpdateExpr(
Record.readSubExpr());
10867void OMPClauseReader::VisitOMPIfClause(
OMPIfClause *
C) {
10870 C->setNameModifierLoc(
Record.readSourceLocation());
10871 C->setColonLoc(
Record.readSourceLocation());
10872 C->setCondition(
Record.readSubExpr());
10873 C->setLParenLoc(
Record.readSourceLocation());
10878 C->setCondition(
Record.readSubExpr());
10879 C->setLParenLoc(
Record.readSourceLocation());
10884 C->setNumThreads(
Record.readSubExpr());
10885 C->setLParenLoc(
Record.readSourceLocation());
10889 C->setSafelen(
Record.readSubExpr());
10890 C->setLParenLoc(
Record.readSourceLocation());
10894 C->setSimdlen(
Record.readSubExpr());
10895 C->setLParenLoc(
Record.readSourceLocation());
10899 for (
Expr *&
E :
C->getSizesRefs())
10901 C->setLParenLoc(
Record.readSourceLocation());
10907 C->setFactor(
Record.readSubExpr());
10908 C->setLParenLoc(
Record.readSourceLocation());
10912 C->setAllocator(
Record.readExpr());
10913 C->setLParenLoc(
Record.readSourceLocation());
10917 C->setNumForLoops(
Record.readSubExpr());
10918 C->setLParenLoc(
Record.readSourceLocation());
10922 C->setDefaultKind(
static_cast<llvm::omp::DefaultKind
>(
Record.readInt()));
10923 C->setLParenLoc(
Record.readSourceLocation());
10924 C->setDefaultKindKwLoc(
Record.readSourceLocation());
10928 C->setProcBindKind(
static_cast<llvm::omp::ProcBindKind
>(
Record.readInt()));
10929 C->setLParenLoc(
Record.readSourceLocation());
10930 C->setProcBindKindKwLoc(
Record.readSourceLocation());
10935 C->setScheduleKind(
10937 C->setFirstScheduleModifier(
10939 C->setSecondScheduleModifier(
10941 C->setChunkSize(
Record.readSubExpr());
10942 C->setLParenLoc(
Record.readSourceLocation());
10943 C->setFirstScheduleModifierLoc(
Record.readSourceLocation());
10944 C->setSecondScheduleModifierLoc(
Record.readSourceLocation());
10945 C->setScheduleKindLoc(
Record.readSourceLocation());
10946 C->setCommaLoc(
Record.readSourceLocation());
10950 C->setNumForLoops(
Record.readSubExpr());
10951 for (
unsigned I = 0,
E =
C->NumberOfLoops; I <
E; ++I)
10952 C->setLoopNumIterations(I,
Record.readSubExpr());
10953 for (
unsigned I = 0,
E =
C->NumberOfLoops; I <
E; ++I)
10954 C->setLoopCounter(I,
Record.readSubExpr());
10955 C->setLParenLoc(
Record.readSourceLocation());
10959 C->setEventHandler(
Record.readSubExpr());
10960 C->setLParenLoc(
Record.readSourceLocation());
10969void OMPClauseReader::VisitOMPReadClause(
OMPReadClause *) {}
10974 if (
C->isExtended()) {
10975 C->setLParenLoc(
Record.readSourceLocation());
10976 C->setArgumentLoc(
Record.readSourceLocation());
10988 C->setLParenLoc(
Record.readSourceLocation());
10990 C->setFailParameterLoc(FailParameterLoc);
10992 C->setFailParameter(CKind);
10996 unsigned Count =
C->getDirectiveKinds().size();
10997 C->setLParenLoc(
Record.readSourceLocation());
10999 DKVec.reserve(Count);
11000 for (
unsigned I = 0; I < Count; I++) {
11003 C->setDirectiveKinds(DKVec);
11007 C->setExpr(
Record.readExpr());
11008 C->setLParenLoc(
Record.readSourceLocation());
11012 unsigned Count =
C->getDirectiveKinds().size();
11013 C->setLParenLoc(
Record.readSourceLocation());
11015 DKVec.reserve(Count);
11016 for (
unsigned I = 0; I < Count; I++) {
11019 C->setDirectiveKinds(DKVec);
11024void OMPClauseReader::VisitOMPNoOpenMPRoutinesClause(
11039void OMPClauseReader::VisitOMPWeakClause(
OMPWeakClause *) {}
11043void OMPClauseReader::VisitOMPSIMDClause(
OMPSIMDClause *) {}
11048 unsigned NumVars =
C->varlist_size();
11050 Vars.reserve(NumVars);
11051 for (
unsigned I = 0; I != NumVars; ++I)
11052 Vars.push_back(
Record.readSubExpr());
11053 C->setVarRefs(Vars);
11054 C->setIsTarget(
Record.readBool());
11055 C->setIsTargetSync(
Record.readBool());
11056 C->setLParenLoc(
Record.readSourceLocation());
11057 C->setVarLoc(
Record.readSourceLocation());
11061 C->setInteropVar(
Record.readSubExpr());
11062 C->setLParenLoc(
Record.readSourceLocation());
11063 C->setVarLoc(
Record.readSourceLocation());
11067 C->setInteropVar(
Record.readSubExpr());
11068 C->setLParenLoc(
Record.readSourceLocation());
11069 C->setVarLoc(
Record.readSourceLocation());
11074 C->setCondition(
Record.readSubExpr());
11075 C->setLParenLoc(
Record.readSourceLocation());
11080 C->setCondition(
Record.readSubExpr());
11081 C->setLParenLoc(
Record.readSourceLocation());
11086void OMPClauseReader::VisitOMPUnifiedSharedMemoryClause(
11095void OMPClauseReader::VisitOMPAtomicDefaultMemOrderClause(
11097 C->setAtomicDefaultMemOrderKind(
11099 C->setLParenLoc(
Record.readSourceLocation());
11100 C->setAtomicDefaultMemOrderKindKwLoc(
Record.readSourceLocation());
11103void OMPClauseReader::VisitOMPAtClause(
OMPAtClause *
C) {
11105 C->setLParenLoc(
Record.readSourceLocation());
11106 C->setAtKindKwLoc(
Record.readSourceLocation());
11111 C->setLParenLoc(
Record.readSourceLocation());
11112 C->setSeverityKindKwLoc(
Record.readSourceLocation());
11116 C->setMessageString(
Record.readSubExpr());
11117 C->setLParenLoc(
Record.readSourceLocation());
11121 C->setLParenLoc(
Record.readSourceLocation());
11122 unsigned NumVars =
C->varlist_size();
11124 Vars.reserve(NumVars);
11125 for (
unsigned i = 0; i != NumVars; ++i)
11126 Vars.push_back(
Record.readSubExpr());
11127 C->setVarRefs(Vars);
11129 for (
unsigned i = 0; i != NumVars; ++i)
11130 Vars.push_back(
Record.readSubExpr());
11131 C->setPrivateCopies(Vars);
11136 C->setLParenLoc(
Record.readSourceLocation());
11137 unsigned NumVars =
C->varlist_size();
11139 Vars.reserve(NumVars);
11140 for (
unsigned i = 0; i != NumVars; ++i)
11141 Vars.push_back(
Record.readSubExpr());
11142 C->setVarRefs(Vars);
11144 for (
unsigned i = 0; i != NumVars; ++i)
11145 Vars.push_back(
Record.readSubExpr());
11146 C->setPrivateCopies(Vars);
11148 for (
unsigned i = 0; i != NumVars; ++i)
11149 Vars.push_back(
Record.readSubExpr());
11155 C->setLParenLoc(
Record.readSourceLocation());
11157 C->setKindLoc(
Record.readSourceLocation());
11158 C->setColonLoc(
Record.readSourceLocation());
11159 unsigned NumVars =
C->varlist_size();
11161 Vars.reserve(NumVars);
11162 for (
unsigned i = 0; i != NumVars; ++i)
11163 Vars.push_back(
Record.readSubExpr());
11164 C->setVarRefs(Vars);
11166 for (
unsigned i = 0; i != NumVars; ++i)
11167 Vars.push_back(
Record.readSubExpr());
11168 C->setPrivateCopies(Vars);
11170 for (
unsigned i = 0; i != NumVars; ++i)
11171 Vars.push_back(
Record.readSubExpr());
11172 C->setSourceExprs(Vars);
11174 for (
unsigned i = 0; i != NumVars; ++i)
11175 Vars.push_back(
Record.readSubExpr());
11176 C->setDestinationExprs(Vars);
11178 for (
unsigned i = 0; i != NumVars; ++i)
11179 Vars.push_back(
Record.readSubExpr());
11180 C->setAssignmentOps(Vars);
11184 C->setLParenLoc(
Record.readSourceLocation());
11185 unsigned NumVars =
C->varlist_size();
11187 Vars.reserve(NumVars);
11188 for (
unsigned i = 0; i != NumVars; ++i)
11189 Vars.push_back(
Record.readSubExpr());
11190 C->setVarRefs(Vars);
11195 C->setLParenLoc(
Record.readSourceLocation());
11196 C->setModifierLoc(
Record.readSourceLocation());
11197 C->setColonLoc(
Record.readSourceLocation());
11200 C->setQualifierLoc(NNSL);
11201 C->setNameInfo(DNI);
11203 unsigned NumVars =
C->varlist_size();
11205 Vars.reserve(NumVars);
11206 for (
unsigned i = 0; i != NumVars; ++i)
11207 Vars.push_back(
Record.readSubExpr());
11208 C->setVarRefs(Vars);
11210 for (
unsigned i = 0; i != NumVars; ++i)
11211 Vars.push_back(
Record.readSubExpr());
11212 C->setPrivates(Vars);
11214 for (
unsigned i = 0; i != NumVars; ++i)
11215 Vars.push_back(
Record.readSubExpr());
11216 C->setLHSExprs(Vars);
11218 for (
unsigned i = 0; i != NumVars; ++i)
11219 Vars.push_back(
Record.readSubExpr());
11220 C->setRHSExprs(Vars);
11222 for (
unsigned i = 0; i != NumVars; ++i)
11223 Vars.push_back(
Record.readSubExpr());
11224 C->setReductionOps(Vars);
11225 if (
C->getModifier() == OMPC_REDUCTION_inscan) {
11227 for (
unsigned i = 0; i != NumVars; ++i)
11228 Vars.push_back(
Record.readSubExpr());
11229 C->setInscanCopyOps(Vars);
11231 for (
unsigned i = 0; i != NumVars; ++i)
11232 Vars.push_back(
Record.readSubExpr());
11233 C->setInscanCopyArrayTemps(Vars);
11235 for (
unsigned i = 0; i != NumVars; ++i)
11236 Vars.push_back(
Record.readSubExpr());
11237 C->setInscanCopyArrayElems(Vars);
11243 C->setLParenLoc(
Record.readSourceLocation());
11244 C->setColonLoc(
Record.readSourceLocation());
11247 C->setQualifierLoc(NNSL);
11248 C->setNameInfo(DNI);
11250 unsigned NumVars =
C->varlist_size();
11252 Vars.reserve(NumVars);
11253 for (
unsigned I = 0; I != NumVars; ++I)
11254 Vars.push_back(
Record.readSubExpr());
11255 C->setVarRefs(Vars);
11257 for (
unsigned I = 0; I != NumVars; ++I)
11258 Vars.push_back(
Record.readSubExpr());
11259 C->setPrivates(Vars);
11261 for (
unsigned I = 0; I != NumVars; ++I)
11262 Vars.push_back(
Record.readSubExpr());
11263 C->setLHSExprs(Vars);
11265 for (
unsigned I = 0; I != NumVars; ++I)
11266 Vars.push_back(
Record.readSubExpr());
11267 C->setRHSExprs(Vars);
11269 for (
unsigned I = 0; I != NumVars; ++I)
11270 Vars.push_back(
Record.readSubExpr());
11271 C->setReductionOps(Vars);
11276 C->setLParenLoc(
Record.readSourceLocation());
11277 C->setColonLoc(
Record.readSourceLocation());
11280 C->setQualifierLoc(NNSL);
11281 C->setNameInfo(DNI);
11283 unsigned NumVars =
C->varlist_size();
11285 Vars.reserve(NumVars);
11286 for (
unsigned I = 0; I != NumVars; ++I)
11287 Vars.push_back(
Record.readSubExpr());
11288 C->setVarRefs(Vars);
11290 for (
unsigned I = 0; I != NumVars; ++I)
11291 Vars.push_back(
Record.readSubExpr());
11292 C->setPrivates(Vars);
11294 for (
unsigned I = 0; I != NumVars; ++I)
11295 Vars.push_back(
Record.readSubExpr());
11296 C->setLHSExprs(Vars);
11298 for (
unsigned I = 0; I != NumVars; ++I)
11299 Vars.push_back(
Record.readSubExpr());
11300 C->setRHSExprs(Vars);
11302 for (
unsigned I = 0; I != NumVars; ++I)
11303 Vars.push_back(
Record.readSubExpr());
11304 C->setReductionOps(Vars);
11306 for (
unsigned I = 0; I != NumVars; ++I)
11307 Vars.push_back(
Record.readSubExpr());
11308 C->setTaskgroupDescriptors(Vars);
11313 C->setLParenLoc(
Record.readSourceLocation());
11314 C->setColonLoc(
Record.readSourceLocation());
11316 C->setModifierLoc(
Record.readSourceLocation());
11317 unsigned NumVars =
C->varlist_size();
11319 Vars.reserve(NumVars);
11320 for (
unsigned i = 0; i != NumVars; ++i)
11321 Vars.push_back(
Record.readSubExpr());
11322 C->setVarRefs(Vars);
11324 for (
unsigned i = 0; i != NumVars; ++i)
11325 Vars.push_back(
Record.readSubExpr());
11326 C->setPrivates(Vars);
11328 for (
unsigned i = 0; i != NumVars; ++i)
11329 Vars.push_back(
Record.readSubExpr());
11332 for (
unsigned i = 0; i != NumVars; ++i)
11333 Vars.push_back(
Record.readSubExpr());
11334 C->setUpdates(Vars);
11336 for (
unsigned i = 0; i != NumVars; ++i)
11337 Vars.push_back(
Record.readSubExpr());
11338 C->setFinals(Vars);
11339 C->setStep(
Record.readSubExpr());
11340 C->setCalcStep(
Record.readSubExpr());
11342 for (
unsigned I = 0; I != NumVars + 1; ++I)
11343 Vars.push_back(
Record.readSubExpr());
11344 C->setUsedExprs(Vars);
11348 C->setLParenLoc(
Record.readSourceLocation());
11349 C->setColonLoc(
Record.readSourceLocation());
11350 unsigned NumVars =
C->varlist_size();
11352 Vars.reserve(NumVars);
11353 for (
unsigned i = 0; i != NumVars; ++i)
11354 Vars.push_back(
Record.readSubExpr());
11355 C->setVarRefs(Vars);
11356 C->setAlignment(
Record.readSubExpr());
11360 C->setLParenLoc(
Record.readSourceLocation());
11361 unsigned NumVars =
C->varlist_size();
11363 Exprs.reserve(NumVars);
11364 for (
unsigned i = 0; i != NumVars; ++i)
11365 Exprs.push_back(
Record.readSubExpr());
11366 C->setVarRefs(Exprs);
11368 for (
unsigned i = 0; i != NumVars; ++i)
11369 Exprs.push_back(
Record.readSubExpr());
11370 C->setSourceExprs(Exprs);
11372 for (
unsigned i = 0; i != NumVars; ++i)
11373 Exprs.push_back(
Record.readSubExpr());
11374 C->setDestinationExprs(Exprs);
11376 for (
unsigned i = 0; i != NumVars; ++i)
11377 Exprs.push_back(
Record.readSubExpr());
11378 C->setAssignmentOps(Exprs);
11382 C->setLParenLoc(
Record.readSourceLocation());
11383 unsigned NumVars =
C->varlist_size();
11385 Exprs.reserve(NumVars);
11386 for (
unsigned i = 0; i != NumVars; ++i)
11387 Exprs.push_back(
Record.readSubExpr());
11388 C->setVarRefs(Exprs);
11390 for (
unsigned i = 0; i != NumVars; ++i)
11391 Exprs.push_back(
Record.readSubExpr());
11392 C->setSourceExprs(Exprs);
11394 for (
unsigned i = 0; i != NumVars; ++i)
11395 Exprs.push_back(
Record.readSubExpr());
11396 C->setDestinationExprs(Exprs);
11398 for (
unsigned i = 0; i != NumVars; ++i)
11399 Exprs.push_back(
Record.readSubExpr());
11400 C->setAssignmentOps(Exprs);
11404 C->setLParenLoc(
Record.readSourceLocation());
11405 unsigned NumVars =
C->varlist_size();
11407 Vars.reserve(NumVars);
11408 for (
unsigned i = 0; i != NumVars; ++i)
11409 Vars.push_back(
Record.readSubExpr());
11410 C->setVarRefs(Vars);
11414 C->setDepobj(
Record.readSubExpr());
11415 C->setLParenLoc(
Record.readSourceLocation());
11419 C->setLParenLoc(
Record.readSourceLocation());
11420 C->setModifier(
Record.readSubExpr());
11421 C->setDependencyKind(
11423 C->setDependencyLoc(
Record.readSourceLocation());
11424 C->setColonLoc(
Record.readSourceLocation());
11425 C->setOmpAllMemoryLoc(
Record.readSourceLocation());
11426 unsigned NumVars =
C->varlist_size();
11428 Vars.reserve(NumVars);
11429 for (
unsigned I = 0; I != NumVars; ++I)
11430 Vars.push_back(
Record.readSubExpr());
11431 C->setVarRefs(Vars);
11432 for (
unsigned I = 0,
E =
C->getNumLoops(); I <
E; ++I)
11433 C->setLoopData(I,
Record.readSubExpr());
11439 C->setDevice(
Record.readSubExpr());
11440 C->setModifierLoc(
Record.readSourceLocation());
11441 C->setLParenLoc(
Record.readSourceLocation());
11445 C->setLParenLoc(
Record.readSourceLocation());
11446 bool HasIteratorModifier =
false;
11448 C->setMapTypeModifier(
11450 C->setMapTypeModifierLoc(I,
Record.readSourceLocation());
11451 if (
C->getMapTypeModifier(I) == OMPC_MAP_MODIFIER_iterator)
11452 HasIteratorModifier =
true;
11454 C->setMapperQualifierLoc(
Record.readNestedNameSpecifierLoc());
11455 C->setMapperIdInfo(
Record.readDeclarationNameInfo());
11458 C->setMapLoc(
Record.readSourceLocation());
11459 C->setColonLoc(
Record.readSourceLocation());
11460 auto NumVars =
C->varlist_size();
11461 auto UniqueDecls =
C->getUniqueDeclarationsNum();
11462 auto TotalLists =
C->getTotalComponentListNum();
11463 auto TotalComponents =
C->getTotalComponentsNum();
11466 Vars.reserve(NumVars);
11467 for (
unsigned i = 0; i != NumVars; ++i)
11468 Vars.push_back(
Record.readExpr());
11469 C->setVarRefs(Vars);
11472 UDMappers.reserve(NumVars);
11473 for (
unsigned I = 0; I < NumVars; ++I)
11474 UDMappers.push_back(
Record.readExpr());
11475 C->setUDMapperRefs(UDMappers);
11477 if (HasIteratorModifier)
11478 C->setIteratorModifier(
Record.readExpr());
11481 Decls.reserve(UniqueDecls);
11482 for (
unsigned i = 0; i < UniqueDecls; ++i)
11484 C->setUniqueDecls(Decls);
11487 ListsPerDecl.reserve(UniqueDecls);
11488 for (
unsigned i = 0; i < UniqueDecls; ++i)
11489 ListsPerDecl.push_back(
Record.readInt());
11490 C->setDeclNumLists(ListsPerDecl);
11493 ListSizes.reserve(TotalLists);
11494 for (
unsigned i = 0; i < TotalLists; ++i)
11495 ListSizes.push_back(
Record.readInt());
11496 C->setComponentListSizes(ListSizes);
11499 Components.reserve(TotalComponents);
11500 for (
unsigned i = 0; i < TotalComponents; ++i) {
11503 Components.emplace_back(AssociatedExprPr, AssociatedDecl,
11506 C->setComponents(Components, ListSizes);
11510 C->setLParenLoc(
Record.readSourceLocation());
11511 C->setColonLoc(
Record.readSourceLocation());
11512 C->setAllocator(
Record.readSubExpr());
11513 unsigned NumVars =
C->varlist_size();
11515 Vars.reserve(NumVars);
11516 for (
unsigned i = 0; i != NumVars; ++i)
11517 Vars.push_back(
Record.readSubExpr());
11518 C->setVarRefs(Vars);
11523 C->setLParenLoc(
Record.readSourceLocation());
11524 unsigned NumVars =
C->varlist_size();
11526 Vars.reserve(NumVars);
11527 for (
unsigned I = 0; I != NumVars; ++I)
11528 Vars.push_back(
Record.readSubExpr());
11529 C->setVarRefs(Vars);
11534 C->setLParenLoc(
Record.readSourceLocation());
11535 unsigned NumVars =
C->varlist_size();
11537 Vars.reserve(NumVars);
11538 for (
unsigned I = 0; I != NumVars; ++I)
11539 Vars.push_back(
Record.readSubExpr());
11540 C->setVarRefs(Vars);
11545 C->setPriority(
Record.readSubExpr());
11546 C->setLParenLoc(
Record.readSourceLocation());
11552 C->setGrainsize(
Record.readSubExpr());
11553 C->setModifierLoc(
Record.readSourceLocation());
11554 C->setLParenLoc(
Record.readSourceLocation());
11560 C->setNumTasks(
Record.readSubExpr());
11561 C->setModifierLoc(
Record.readSourceLocation());
11562 C->setLParenLoc(
Record.readSourceLocation());
11566 C->setHint(
Record.readSubExpr());
11567 C->setLParenLoc(
Record.readSourceLocation());
11572 C->setDistScheduleKind(
11574 C->setChunkSize(
Record.readSubExpr());
11575 C->setLParenLoc(
Record.readSourceLocation());
11576 C->setDistScheduleKindLoc(
Record.readSourceLocation());
11577 C->setCommaLoc(
Record.readSourceLocation());
11581 C->setDefaultmapKind(
11583 C->setDefaultmapModifier(
11585 C->setLParenLoc(
Record.readSourceLocation());
11586 C->setDefaultmapModifierLoc(
Record.readSourceLocation());
11587 C->setDefaultmapKindLoc(
Record.readSourceLocation());
11590void OMPClauseReader::VisitOMPToClause(
OMPToClause *
C) {
11591 C->setLParenLoc(
Record.readSourceLocation());
11593 C->setMotionModifier(
11595 C->setMotionModifierLoc(I,
Record.readSourceLocation());
11597 C->setMapperQualifierLoc(
Record.readNestedNameSpecifierLoc());
11598 C->setMapperIdInfo(
Record.readDeclarationNameInfo());
11599 C->setColonLoc(
Record.readSourceLocation());
11600 auto NumVars =
C->varlist_size();
11601 auto UniqueDecls =
C->getUniqueDeclarationsNum();
11602 auto TotalLists =
C->getTotalComponentListNum();
11603 auto TotalComponents =
C->getTotalComponentsNum();
11606 Vars.reserve(NumVars);
11607 for (
unsigned i = 0; i != NumVars; ++i)
11608 Vars.push_back(
Record.readSubExpr());
11609 C->setVarRefs(Vars);
11612 UDMappers.reserve(NumVars);
11613 for (
unsigned I = 0; I < NumVars; ++I)
11614 UDMappers.push_back(
Record.readSubExpr());
11615 C->setUDMapperRefs(UDMappers);
11618 Decls.reserve(UniqueDecls);
11619 for (
unsigned i = 0; i < UniqueDecls; ++i)
11621 C->setUniqueDecls(Decls);
11624 ListsPerDecl.reserve(UniqueDecls);
11625 for (
unsigned i = 0; i < UniqueDecls; ++i)
11626 ListsPerDecl.push_back(
Record.readInt());
11627 C->setDeclNumLists(ListsPerDecl);
11630 ListSizes.reserve(TotalLists);
11631 for (
unsigned i = 0; i < TotalLists; ++i)
11632 ListSizes.push_back(
Record.readInt());
11633 C->setComponentListSizes(ListSizes);
11636 Components.reserve(TotalComponents);
11637 for (
unsigned i = 0; i < TotalComponents; ++i) {
11638 Expr *AssociatedExprPr =
Record.readSubExpr();
11639 bool IsNonContiguous =
Record.readBool();
11641 Components.emplace_back(AssociatedExprPr, AssociatedDecl, IsNonContiguous);
11643 C->setComponents(Components, ListSizes);
11647 C->setLParenLoc(
Record.readSourceLocation());
11649 C->setMotionModifier(
11651 C->setMotionModifierLoc(I,
Record.readSourceLocation());
11653 C->setMapperQualifierLoc(
Record.readNestedNameSpecifierLoc());
11654 C->setMapperIdInfo(
Record.readDeclarationNameInfo());
11655 C->setColonLoc(
Record.readSourceLocation());
11656 auto NumVars =
C->varlist_size();
11657 auto UniqueDecls =
C->getUniqueDeclarationsNum();
11658 auto TotalLists =
C->getTotalComponentListNum();
11659 auto TotalComponents =
C->getTotalComponentsNum();
11662 Vars.reserve(NumVars);
11663 for (
unsigned i = 0; i != NumVars; ++i)
11664 Vars.push_back(
Record.readSubExpr());
11665 C->setVarRefs(Vars);
11668 UDMappers.reserve(NumVars);
11669 for (
unsigned I = 0; I < NumVars; ++I)
11670 UDMappers.push_back(
Record.readSubExpr());
11671 C->setUDMapperRefs(UDMappers);
11674 Decls.reserve(UniqueDecls);
11675 for (
unsigned i = 0; i < UniqueDecls; ++i)
11677 C->setUniqueDecls(Decls);
11680 ListsPerDecl.reserve(UniqueDecls);
11681 for (
unsigned i = 0; i < UniqueDecls; ++i)
11682 ListsPerDecl.push_back(
Record.readInt());
11683 C->setDeclNumLists(ListsPerDecl);
11686 ListSizes.reserve(TotalLists);
11687 for (
unsigned i = 0; i < TotalLists; ++i)
11688 ListSizes.push_back(
Record.readInt());
11689 C->setComponentListSizes(ListSizes);
11692 Components.reserve(TotalComponents);
11693 for (
unsigned i = 0; i < TotalComponents; ++i) {
11694 Expr *AssociatedExprPr =
Record.readSubExpr();
11695 bool IsNonContiguous =
Record.readBool();
11697 Components.emplace_back(AssociatedExprPr, AssociatedDecl, IsNonContiguous);
11699 C->setComponents(Components, ListSizes);
11703 C->setLParenLoc(
Record.readSourceLocation());
11704 auto NumVars =
C->varlist_size();
11705 auto UniqueDecls =
C->getUniqueDeclarationsNum();
11706 auto TotalLists =
C->getTotalComponentListNum();
11707 auto TotalComponents =
C->getTotalComponentsNum();
11710 Vars.reserve(NumVars);
11711 for (
unsigned i = 0; i != NumVars; ++i)
11712 Vars.push_back(
Record.readSubExpr());
11713 C->setVarRefs(Vars);
11715 for (
unsigned i = 0; i != NumVars; ++i)
11716 Vars.push_back(
Record.readSubExpr());
11717 C->setPrivateCopies(Vars);
11719 for (
unsigned i = 0; i != NumVars; ++i)
11720 Vars.push_back(
Record.readSubExpr());
11724 Decls.reserve(UniqueDecls);
11725 for (
unsigned i = 0; i < UniqueDecls; ++i)
11727 C->setUniqueDecls(Decls);
11730 ListsPerDecl.reserve(UniqueDecls);
11731 for (
unsigned i = 0; i < UniqueDecls; ++i)
11732 ListsPerDecl.push_back(
Record.readInt());
11733 C->setDeclNumLists(ListsPerDecl);
11736 ListSizes.reserve(TotalLists);
11737 for (
unsigned i = 0; i < TotalLists; ++i)
11738 ListSizes.push_back(
Record.readInt());
11739 C->setComponentListSizes(ListSizes);
11742 Components.reserve(TotalComponents);
11743 for (
unsigned i = 0; i < TotalComponents; ++i) {
11744 auto *AssociatedExprPr =
Record.readSubExpr();
11746 Components.emplace_back(AssociatedExprPr, AssociatedDecl,
11749 C->setComponents(Components, ListSizes);
11753 C->setLParenLoc(
Record.readSourceLocation());
11754 auto NumVars =
C->varlist_size();
11755 auto UniqueDecls =
C->getUniqueDeclarationsNum();
11756 auto TotalLists =
C->getTotalComponentListNum();
11757 auto TotalComponents =
C->getTotalComponentsNum();
11760 Vars.reserve(NumVars);
11761 for (
unsigned i = 0; i != NumVars; ++i)
11762 Vars.push_back(
Record.readSubExpr());
11763 C->setVarRefs(Vars);
11766 Decls.reserve(UniqueDecls);
11767 for (
unsigned i = 0; i < UniqueDecls; ++i)
11769 C->setUniqueDecls(Decls);
11772 ListsPerDecl.reserve(UniqueDecls);
11773 for (
unsigned i = 0; i < UniqueDecls; ++i)
11774 ListsPerDecl.push_back(
Record.readInt());
11775 C->setDeclNumLists(ListsPerDecl);
11778 ListSizes.reserve(TotalLists);
11779 for (
unsigned i = 0; i < TotalLists; ++i)
11780 ListSizes.push_back(
Record.readInt());
11781 C->setComponentListSizes(ListSizes);
11784 Components.reserve(TotalComponents);
11785 for (
unsigned i = 0; i < TotalComponents; ++i) {
11786 Expr *AssociatedExpr =
Record.readSubExpr();
11788 Components.emplace_back(AssociatedExpr, AssociatedDecl,
11791 C->setComponents(Components, ListSizes);
11795 C->setLParenLoc(
Record.readSourceLocation());
11796 auto NumVars =
C->varlist_size();
11797 auto UniqueDecls =
C->getUniqueDeclarationsNum();
11798 auto TotalLists =
C->getTotalComponentListNum();
11799 auto TotalComponents =
C->getTotalComponentsNum();
11802 Vars.reserve(NumVars);
11803 for (
unsigned i = 0; i != NumVars; ++i)
11804 Vars.push_back(
Record.readSubExpr());
11805 C->setVarRefs(Vars);
11809 Decls.reserve(UniqueDecls);
11810 for (
unsigned i = 0; i < UniqueDecls; ++i)
11812 C->setUniqueDecls(Decls);
11815 ListsPerDecl.reserve(UniqueDecls);
11816 for (
unsigned i = 0; i < UniqueDecls; ++i)
11817 ListsPerDecl.push_back(
Record.readInt());
11818 C->setDeclNumLists(ListsPerDecl);
11821 ListSizes.reserve(TotalLists);
11822 for (
unsigned i = 0; i < TotalLists; ++i)
11823 ListSizes.push_back(
Record.readInt());
11824 C->setComponentListSizes(ListSizes);
11827 Components.reserve(TotalComponents);
11828 for (
unsigned i = 0; i < TotalComponents; ++i) {
11829 Expr *AssociatedExpr =
Record.readSubExpr();
11831 Components.emplace_back(AssociatedExpr, AssociatedDecl,
11834 C->setComponents(Components, ListSizes);
11838 C->setLParenLoc(
Record.readSourceLocation());
11839 auto NumVars =
C->varlist_size();
11840 auto UniqueDecls =
C->getUniqueDeclarationsNum();
11841 auto TotalLists =
C->getTotalComponentListNum();
11842 auto TotalComponents =
C->getTotalComponentsNum();
11845 Vars.reserve(NumVars);
11846 for (
unsigned I = 0; I != NumVars; ++I)
11847 Vars.push_back(
Record.readSubExpr());
11848 C->setVarRefs(Vars);
11852 Decls.reserve(UniqueDecls);
11853 for (
unsigned I = 0; I < UniqueDecls; ++I)
11855 C->setUniqueDecls(Decls);
11858 ListsPerDecl.reserve(UniqueDecls);
11859 for (
unsigned I = 0; I < UniqueDecls; ++I)
11860 ListsPerDecl.push_back(
Record.readInt());
11861 C->setDeclNumLists(ListsPerDecl);
11864 ListSizes.reserve(TotalLists);
11865 for (
unsigned i = 0; i < TotalLists; ++i)
11866 ListSizes.push_back(
Record.readInt());
11867 C->setComponentListSizes(ListSizes);
11870 Components.reserve(TotalComponents);
11871 for (
unsigned I = 0; I < TotalComponents; ++I) {
11872 Expr *AssociatedExpr =
Record.readSubExpr();
11874 Components.emplace_back(AssociatedExpr, AssociatedDecl,
11877 C->setComponents(Components, ListSizes);
11881 C->setLParenLoc(
Record.readSourceLocation());
11882 unsigned NumVars =
C->varlist_size();
11884 Vars.reserve(NumVars);
11885 for (
unsigned i = 0; i != NumVars; ++i)
11886 Vars.push_back(
Record.readSubExpr());
11887 C->setVarRefs(Vars);
11889 Vars.reserve(NumVars);
11890 for (
unsigned i = 0; i != NumVars; ++i)
11891 Vars.push_back(
Record.readSubExpr());
11892 C->setPrivateRefs(Vars);
11896 C->setLParenLoc(
Record.readSourceLocation());
11897 unsigned NumVars =
C->varlist_size();
11899 Vars.reserve(NumVars);
11900 for (
unsigned i = 0; i != NumVars; ++i)
11901 Vars.push_back(
Record.readSubExpr());
11902 C->setVarRefs(Vars);
11906 C->setLParenLoc(
Record.readSourceLocation());
11907 unsigned NumVars =
C->varlist_size();
11909 Vars.reserve(NumVars);
11910 for (
unsigned i = 0; i != NumVars; ++i)
11911 Vars.push_back(
Record.readSubExpr());
11912 C->setVarRefs(Vars);
11916 C->setLParenLoc(
Record.readSourceLocation());
11917 unsigned NumOfAllocators =
C->getNumberOfAllocators();
11919 Data.reserve(NumOfAllocators);
11920 for (
unsigned I = 0; I != NumOfAllocators; ++I) {
11922 D.Allocator =
Record.readSubExpr();
11923 D.AllocatorTraits =
Record.readSubExpr();
11924 D.LParenLoc =
Record.readSourceLocation();
11925 D.RParenLoc =
Record.readSourceLocation();
11927 C->setAllocatorsData(
Data);
11931 C->setLParenLoc(
Record.readSourceLocation());
11932 C->setModifier(
Record.readSubExpr());
11933 C->setColonLoc(
Record.readSourceLocation());
11934 unsigned NumOfLocators =
C->varlist_size();
11936 Locators.reserve(NumOfLocators);
11937 for (
unsigned I = 0; I != NumOfLocators; ++I)
11938 Locators.push_back(
Record.readSubExpr());
11939 C->setVarRefs(Locators);
11945 C->setLParenLoc(
Record.readSourceLocation());
11946 C->setKindKwLoc(
Record.readSourceLocation());
11947 C->setModifierKwLoc(
Record.readSourceLocation());
11952 C->setThreadID(
Record.readSubExpr());
11953 C->setLParenLoc(
Record.readSourceLocation());
11958 C->setLParenLoc(
Record.readSourceLocation());
11959 C->setBindKindLoc(
Record.readSourceLocation());
11963 C->setAlignment(
Record.readExpr());
11964 C->setLParenLoc(
Record.readSourceLocation());
11969 C->setSize(
Record.readSubExpr());
11970 C->setLParenLoc(
Record.readSourceLocation());
11974 C->setLParenLoc(
Record.readSourceLocation());
11975 C->setDependenceType(
11977 C->setDependenceLoc(
Record.readSourceLocation());
11978 C->setColonLoc(
Record.readSourceLocation());
11979 unsigned NumVars =
C->varlist_size();
11981 Vars.reserve(NumVars);
11982 for (
unsigned I = 0; I != NumVars; ++I)
11983 Vars.push_back(
Record.readSubExpr());
11984 C->setVarRefs(Vars);
11985 for (
unsigned I = 0,
E =
C->getNumLoops(); I <
E; ++I)
11986 C->setLoopData(I,
Record.readSubExpr());
11991 Record.readAttributes(Attrs);
11992 C->setAttrs(Attrs);
11993 C->setLocStart(
Record.readSourceLocation());
11994 C->setLParenLoc(
Record.readSourceLocation());
11995 C->setLocEnd(
Record.readSourceLocation());
12004 Set.Kind = readEnum<llvm::omp::TraitSet>();
12007 Selector.Kind = readEnum<llvm::omp::TraitSelector>();
12008 Selector.ScoreOrCondition =
nullptr;
12010 Selector.ScoreOrCondition = readExprRef();
12013 Property.Kind = readEnum<llvm::omp::TraitProperty>();
12022 if (Reader->ReadingKind == ASTReader::Read_Stmt) {
12027 for (
unsigned I = 0,
E =
Data->getNumClauses(); I <
E; ++I)
12029 Data->setClauses(Clauses);
12030 if (
Data->hasAssociatedStmt())
12032 for (
unsigned I = 0,
E =
Data->getNumChildren(); I <
E; ++I)
12037 unsigned NumVars =
readInt();
12039 for (
unsigned I = 0; I < NumVars; ++I)
12045 unsigned NumExprs =
readInt();
12047 for (
unsigned I = 0; I < NumExprs; ++I)
12057 switch (ClauseKind) {
12078 unsigned NumClauses =
readInt();
12080 for (
unsigned I = 0; I < NumClauses; ++I)
12139 LParenLoc, VarList, EndLoc);
12148 LParenLoc, IsReadOnly, VarList, EndLoc);
12157 LParenLoc, IsZero, VarList, EndLoc);
12166 LParenLoc, IsZero, VarList, EndLoc);
12172 AsyncExpr, EndLoc);
12180 DevNumExpr, QueuesLoc, QueueIdExprs,
12187 unsigned NumArchs =
readInt();
12189 for (
unsigned I = 0; I < NumArchs; ++I) {
12192 Archs.emplace_back(Ident,
Loc);
12196 LParenLoc, Archs, EndLoc);
12231 llvm_unreachable(
"Clause serialization not yet implemented");
12233 llvm_unreachable(
"Invalid Clause Kind");
12238 for (
unsigned I = 0; I < Clauses.size(); ++I)
Defines the clang::ASTContext interface.
ASTImporterLookupTable & LT
static unsigned moduleKindForDiagnostic(ModuleKind Kind)
static void PassObjCImplDeclToConsumer(ObjCImplDecl *ImplD, ASTConsumer *Consumer)
Under non-PCH compilation the consumer receives the objc methods before receiving the implementation,...
static llvm::Error doesntStartWithASTFileMagic(BitstreamCursor &Stream)
Whether Stream doesn't start with the AST/PCH file magic number 'CPCH'.
static bool isExtHandlingFromDiagsError(DiagnosticsEngine &Diags)
static bool checkModuleCachePath(llvm::vfs::FileSystem &VFS, StringRef SpecificModuleCachePath, StringRef ExistingModuleCachePath, StringRef ModuleFilename, DiagnosticsEngine *Diags, const LangOptions &LangOpts, const PreprocessorOptions &PPOpts)
Check that the specified and the existing module cache paths are equivalent.
static void updateModuleTimestamp(ModuleFile &MF)
static unsigned getModuleFileIndexForTypeID(serialization::TypeID ID)
static void collectMacroDefinitions(const PreprocessorOptions &PPOpts, MacroDefinitionsMap &Macros, SmallVectorImpl< StringRef > *MacroNames=nullptr)
Collect the macro definitions provided by the given preprocessor options.
static void markIdentifierFromAST(ASTReader &Reader, IdentifierInfo &II, bool IsModule)
static void moveMethodToBackOfGlobalList(Sema &S, ObjCMethodDecl *Method)
Move the given method to the back of the global list of methods.
static bool isDiagnosedResult(ASTReader::ASTReadResult ARR, unsigned Caps)
static bool isInterestingIdentifier(ASTReader &Reader, const IdentifierInfo &II, bool IsModule)
Whether the given identifier is "interesting".
static bool parseModuleFileExtensionMetadata(const SmallVectorImpl< uint64_t > &Record, StringRef Blob, ModuleFileExtensionMetadata &Metadata)
Parse a record and blob containing module file extension metadata.
static Module * getTopImportImplicitModule(ModuleManager &ModuleMgr, Preprocessor &PP)
Return the top import module if it is implicit, nullptr otherwise.
static bool checkPreprocessorOptions(const PreprocessorOptions &PPOpts, const PreprocessorOptions &ExistingPPOpts, StringRef ModuleFilename, bool ReadMacros, DiagnosticsEngine *Diags, FileManager &FileMgr, std::string &SuggestedPredefines, const LangOptions &LangOpts, OptionValidation Validation=OptionValidateContradictions)
Check the preprocessor options deserialized from the control block against the preprocessor options i...
static void addMethodsToPool(Sema &S, ArrayRef< ObjCMethodDecl * > Methods, ObjCMethodList &List)
Add the given set of methods to the method list.
static bool checkDiagnosticMappings(DiagnosticsEngine &StoredDiags, DiagnosticsEngine &Diags, StringRef ModuleFilename, bool IsSystem, bool SystemHeaderWarningsInModule, bool Complain)
static bool isPredefinedType(serialization::TypeID ID)
static bool readBit(unsigned &Bits)
static bool checkDiagnosticGroupMappings(DiagnosticsEngine &StoredDiags, DiagnosticsEngine &Diags, StringRef ModuleFilename, bool Complain)
static std::optional< Type::TypeClass > getTypeClassForCode(TypeCode code)
static std::pair< unsigned, unsigned > readULEBKeyDataLength(const unsigned char *&P)
Read ULEB-encoded key length and data length.
static LLVM_DUMP_METHOD void dumpModuleIDMap(StringRef Name, const ContinuousRangeMap< Key, ModuleFile *, InitialCapacity > &Map)
@ OptionValidateStrictMatches
@ OptionValidateContradictions
static bool checkTargetOptions(const TargetOptions &TargetOpts, const TargetOptions &ExistingTargetOpts, StringRef ModuleFilename, DiagnosticsEngine *Diags, bool AllowCompatibleDifferences=true)
Compare the given set of target options against an existing set of target options.
static bool checkLanguageOptions(const LangOptions &LangOpts, const LangOptions &ExistingLangOpts, StringRef ModuleFilename, DiagnosticsEngine *Diags, bool AllowCompatibleDifferences=true)
Compare the given set of language options against an existing set of language options.
#define CHECK_TARGET_OPT(Field, Name)
static ASTFileSignature readASTFileSignature(StringRef PCH)
Reads and return the signature record from PCH's control block, or else returns 0.
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...
static unsigned getIndexForTypeID(serialization::TypeID ID)
static uint64_t readULEB(const unsigned char *&P)
Defines the clang::ASTSourceDescriptor class, which abstracts clang modules and precompiled header fi...
static StringRef bytes(const std::vector< T, Allocator > &v)
Defines the Diagnostic-related interfaces.
enum clang::sema::@1653::IndirectLocalPathEntry::EntryKind Kind
static void dump(llvm::raw_ostream &OS, StringRef FunctionName, ArrayRef< CounterExpression > Expressions, ArrayRef< CounterMappingRegion > Regions)
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Defines the C++ template declaration subclasses.
Defines the Diagnostic IDs-related interfaces.
Defines the ExceptionSpecificationType enumeration and various utility functions.
Defines the clang::Expr interface and subclasses for C++ expressions.
Defines the clang::FileManager interface and associated types.
Defines the clang::FileSystemOptions interface.
llvm::DenseSet< const void * > Visited
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
static const Decl * getCanonicalDecl(const Decl *D)
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines the clang::LangOptions interface.
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.
llvm::MachO::FileType FileType
llvm::MachO::Record Record
Defines the clang::MacroInfo and clang::MacroDirective classes.
Defines the clang::Module class, which describes a module in the source code.
Defines types useful for describing an Objective-C runtime.
Defines some OpenACC-specific enums and functions.
This file defines OpenMP AST classes for clauses.
Defines some OpenMP-specific enums and functions.
Defines an enumeration for C++ overloaded operators.
Defines the clang::Preprocessor interface.
static std::string getName(const CallEvent &Call)
static std::string toString(const clang::SanitizerSet &Sanitizers)
Produce a string containing comma-separated names of sanitizers in Sanitizers set.
Defines the clang::SanitizerKind enum.
This file declares semantic analysis for CUDA constructs.
This file declares semantic analysis for Objective-C.
Defines the clang::SourceLocation class and associated facilities.
Defines implementation details of the clang::SourceManager class.
Defines the SourceManager interface.
Defines various enumerations that describe declaration and type specifiers.
Defines the clang::TargetOptions class.
Defines the clang::TokenKind enum and support functions.
Defines the clang::TypeLoc interface and its subclasses.
C Language Family Type Representation.
Defines version macros and version-related utility functions for Clang.
__DEVICE__ void * memcpy(void *__a, const void *__b, size_t __c)
ASTConsumer - This is an abstract interface that should be implemented by clients that read ASTs.
virtual void HandleInterestingDecl(DeclGroupRef D)
HandleInterestingDecl - Handle the specified interesting declaration.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
CanQualType ObjCBuiltinSelTy
TranslationUnitDecl * getTranslationUnitDecl() const
CanQualType ARCUnbridgedCastTy
TypedefDecl * getObjCClassDecl() const
Retrieve the typedef declaration corresponding to the predefined Objective-C 'Class' type.
TypedefDecl * getCFConstantStringDecl() const
CanQualType SatUnsignedFractTy
BuiltinTemplateDecl * getMakeIntegerSeqDecl() const
ExternCContextDecl * getExternCContextDecl() const
TypedefDecl * getObjCSelDecl() const
Retrieve the typedef corresponding to the predefined 'SEL' type in Objective-C.
CanQualType UnsignedShortAccumTy
TypedefDecl * getObjCInstanceTypeDecl()
Retrieve the typedef declaration corresponding to the Objective-C "instancetype" type.
QualType getAutoRRefDeductType() const
C++11 deduction pattern for 'auto &&' type.
TypedefDecl * getBuiltinMSVaListDecl() const
Retrieve the C type declaration corresponding to the predefined __builtin_ms_va_list type.
TypedefDecl * getObjCIdDecl() const
Retrieve the typedef corresponding to the predefined id type in Objective-C.
ASTMutationListener * getASTMutationListener() const
Retrieve a pointer to the AST mutation listener associated with this AST context, if any.
CanQualType SatLongAccumTy
void setsigjmp_bufDecl(TypeDecl *sigjmp_bufDecl)
Set the type for the C sigjmp_buf type.
CanQualType OMPArrayShapingTy
void setFILEDecl(TypeDecl *FILEDecl)
Set the type for the C FILE type.
CanQualType UnsignedLongFractTy
CanQualType OMPIteratorTy
RawCommentList Comments
All comments in this translation unit.
CanQualType SatShortFractTy
CanQualType SatUnsignedAccumTy
CanQualType ArraySectionTy
CanQualType ObjCBuiltinIdTy
RecordDecl * getCFConstantStringTagDecl() const
CanQualType UnsignedFractTy
CanQualType ObjCBuiltinClassTy
CanQualType UnresolvedTemplateTy
void setucontext_tDecl(TypeDecl *ucontext_tDecl)
Set the type for the C ucontext_t type.
OMPTraitInfo & getNewOMPTraitInfo()
Return a new OMPTraitInfo object owned by this context.
CanQualType UnsignedLongTy
CanQualType UnsignedLongAccumTy
CanQualType BoundMemberTy
CanQualType SatUnsignedShortFractTy
TypedefDecl * getInt128Decl() const
Retrieve the declaration for the 128-bit signed integer type.
CanQualType PseudoObjectTy
QualType getQualifiedType(SplitQualType split) const
Un-split a SplitQualType.
CanQualType OCLClkEventTy
void adjustExceptionSpec(FunctionDecl *FD, const FunctionProtoType::ExceptionSpecInfo &ESI, bool AsWritten=false)
Change the exception specification on a function once it is delay-parsed, instantiated,...
TypedefDecl * getUInt128Decl() const
Retrieve the declaration for the 128-bit unsigned integer type.
CanQualType SatUnsignedShortAccumTy
Decl * getVaListTagDecl() const
Retrieve the C type declaration corresponding to the predefined __va_list_tag type used to help defin...
CanQualType UnsignedInt128Ty
ObjCInterfaceDecl * getObjCProtocolDecl() const
Retrieve the Objective-C class declaration corresponding to the predefined Protocol class.
TypedefDecl * getBuiltinVaListDecl() const
Retrieve the C type declaration corresponding to the predefined __builtin_va_list type.
CanQualType UnsignedCharTy
CanQualType UnsignedShortFractTy
void * Allocate(size_t Size, unsigned Align=8) const
CanQualType UnsignedIntTy
TagDecl * getMSGuidTagDecl() const
Retrieve the implicitly-predeclared 'struct _GUID' declaration.
CanQualType UnsignedLongLongTy
CanQualType OCLReserveIDTy
CanQualType UnsignedShortTy
CanQualType SatUnsignedLongFractTy
void setcudaConfigureCallDecl(FunctionDecl *FD)
DiagnosticsEngine & getDiagnostics() const
CanQualType SatLongFractTy
CanQualType SatShortAccumTy
QualType getAutoDeductType() const
C++11 deduction pattern for 'auto' type.
CanQualType IncompleteMatrixIdxTy
void setjmp_bufDecl(TypeDecl *jmp_bufDecl)
Set the type for the C jmp_buf type.
BuiltinTemplateDecl * getTypePackElementDecl() const
CanQualType SatUnsignedLongAccumTy
void deduplicateMergedDefinitonsFor(NamedDecl *ND)
Clean up the merged definition list.
void adjustDeducedFunctionResultType(FunctionDecl *FD, QualType ResultType)
Change the result type of a function type once it is deduced.
void setPrimaryMergedDecl(Decl *D, Decl *Primary)
CanQualType UnsignedAccumTy
void setCFConstantStringType(QualType T)
virtual void MacroRead(serialization::MacroID ID, MacroInfo *MI)
A macro was read from the AST file.
virtual void SelectorRead(serialization::SelectorID iD, Selector Sel)
A selector was read from the AST file.
virtual void IdentifierRead(serialization::IdentifierID ID, IdentifierInfo *II)
An identifier was deserialized from the AST file.
An identifier-lookup iterator that enumerates all of the identifiers stored within a set of AST files...
ASTIdentifierIterator(const ASTReader &Reader, bool SkipModules=false)
StringRef Next() override
Retrieve the next string in the identifier table and advances the iterator for the following string.
Abstract interface for callback invocations by the ASTReader.
virtual void ReadModuleMapFile(StringRef ModuleMapPath)
virtual bool needsInputFileVisitation()
Returns true if this ASTReaderListener wants to receive the input files of the AST file via visitInpu...
virtual bool ReadTargetOptions(const TargetOptions &TargetOpts, StringRef ModuleFilename, bool Complain, bool AllowCompatibleDifferences)
Receives the target options.
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...
virtual bool ReadDiagnosticOptions(IntrusiveRefCntPtr< DiagnosticOptions > DiagOpts, StringRef ModuleFilename, bool Complain)
Receives the diagnostic options.
virtual bool ReadHeaderSearchPaths(const HeaderSearchOptions &HSOpts, bool Complain)
Receives the header search paths.
virtual bool ReadFileSystemOptions(const FileSystemOptions &FSOpts, bool Complain)
Receives the file system options.
virtual ~ASTReaderListener()
virtual bool ReadPreprocessorOptions(const PreprocessorOptions &PPOpts, StringRef ModuleFilename, bool ReadMacros, bool Complain, std::string &SuggestedPredefines)
Receives the preprocessor options.
virtual bool ReadHeaderSearchOptions(const HeaderSearchOptions &HSOpts, StringRef ModuleFilename, StringRef SpecificModuleCachePath, bool Complain)
Receives the header search options.
virtual void readModuleFileExtension(const ModuleFileExtensionMetadata &Metadata)
Indicates that a particular module file extension has been read.
virtual bool ReadLanguageOptions(const LangOptions &LangOpts, StringRef ModuleFilename, bool Complain, bool AllowCompatibleDifferences)
Receives the language options.
virtual void visitImport(StringRef ModuleName, StringRef Filename)
If needsImportVisitation returns true, this is called for each AST file imported by this AST file.
virtual void visitModuleFile(StringRef Filename, serialization::ModuleKind Kind)
This is called for each AST file loaded.
virtual bool needsImportVisitation() const
Returns true if this ASTReaderListener wants to receive the imports of the AST file via visitImport,...
virtual bool ReadFullVersionInformation(StringRef FullVersion)
Receives the full Clang version information.
virtual void ReadCounter(const serialization::ModuleFile &M, unsigned Value)
Receives COUNTER value.
virtual void ReadModuleName(StringRef ModuleName)
virtual bool needsSystemInputFileVisitation()
Returns true if this ASTReaderListener wants to receive the system input files of the AST file via vi...
Reads an AST files chain containing the contents of a translation unit.
std::optional< bool > isPreprocessedEntityInFileID(unsigned Index, FileID FID) override
Optionally returns true or false if the preallocated preprocessed entity with index Index came from f...
PreprocessedEntity * ReadPreprocessedEntity(unsigned Index) override
Read a preallocated preprocessed entity from the external source.
void markIdentifierUpToDate(const IdentifierInfo *II)
Note that this identifier is up-to-date.
void visitTopLevelModuleMaps(serialization::ModuleFile &MF, llvm::function_ref< void(FileEntryRef)> Visitor)
Visit all the top-level module maps loaded when building the given module file.
void setDeserializationListener(ASTDeserializationListener *Listener, bool TakeOwnership=false)
Set the AST deserialization listener.
serialization::SubmoduleID getGlobalSubmoduleID(ModuleFile &M, unsigned LocalID) const
Retrieve the global submodule ID given a module and its local ID number.
ExtKind hasExternalDefinitions(const Decl *D) override
IdentifierTable & getIdentifierTable()
Retrieve the identifier table associated with the preprocessor.
ModuleManager & getModuleManager()
Retrieve the module manager.
bool isDeclIDFromModule(GlobalDeclID ID, ModuleFile &M) const
Returns true if global DeclID ID originated from module M.
friend class ASTIdentifierIterator
bool ReadSLocEntry(int ID) override
Read the source location entry with index ID.
void RecordSwitchCaseID(SwitchCase *SC, unsigned ID)
Record that the given ID maps to the given switch-case statement.
DiagnosticBuilder Diag(unsigned DiagID) const
Report a diagnostic.
ASTContext & getContext()
Retrieve the AST context that this AST reader supplements.
Decl * ReadDecl(ModuleFile &F, const RecordDataImpl &R, unsigned &I)
Reads a declaration from the given position in a record in the given module.
static std::string ReadString(const RecordDataImpl &Record, unsigned &Idx)
void ReadDeclsToCheckForDeferredDiags(llvm::SmallSetVector< Decl *, 4 > &Decls) override
Read the set of decls to be checked for deferred diags.
void InitializeSema(Sema &S) override
Initialize the semantic source with the Sema instance being used to perform semantic analysis on the ...
@ ARR_Missing
The client can handle an AST file that cannot load because it is missing.
@ ARR_ConfigurationMismatch
The client can handle an AST file that cannot load because it's compiled configuration doesn't match ...
@ ARR_OutOfDate
The client can handle an AST file that cannot load because it is out-of-date relative to its input fi...
@ ARR_VersionMismatch
The client can handle an AST file that cannot load because it was built with a different version of C...
void ReadMismatchingDeleteExpressions(llvm::MapVector< FieldDecl *, llvm::SmallVector< std::pair< SourceLocation, bool >, 4 > > &Exprs) override
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.
SourceRange ReadSkippedRange(unsigned Index) override
Read a preallocated skipped range from the external source.
serialization::TypeID getGlobalTypeID(ModuleFile &F, serialization::LocalTypeID LocalID) const
Map a local type ID within a given AST file into a global type ID.
void dump()
Dump information about the AST reader to standard error.
void AssignedLambdaNumbering(const CXXRecordDecl *Lambda) override
Notify the external source that a lambda was assigned a mangling number.
MacroInfo * ReadMacroRecord(ModuleFile &F, uint64_t Offset)
Reads the macro record located at the given offset.
SmallVector< std::pair< llvm::BitstreamCursor, serialization::ModuleFile * >, 8 > CommentsCursors
Cursors for comments blocks.
Selector getLocalSelector(ModuleFile &M, unsigned LocalID)
Retrieve a selector from the given module with its local ID number.
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.
ModuleFile * getOwningModuleFile(const Decl *D) const
Retrieve the module file that owns the given declaration, or NULL if the declaration is not from a mo...
std::optional< ASTSourceDescriptor > getSourceDescriptor(unsigned ID) override
Return a descriptor for the corresponding module.
const serialization::reader::DeclContextLookupTable * getLoadedLookupTables(DeclContext *Primary) const
Get the loaded lookup tables for Primary, if any.
QualType getLocalType(ModuleFile &F, serialization::LocalTypeID LocalID)
Resolve a local type ID within a given AST file into a type.
void ClearSwitchCaseIDs()
SourceLocation ReadSourceLocation(ModuleFile &MF, RawLocEncoding Raw, LocSeq *Seq=nullptr) const
Read a source location from raw form.
void SetGloballyVisibleDecls(IdentifierInfo *II, const SmallVectorImpl< GlobalDeclID > &DeclIDs, SmallVectorImpl< Decl * > *Decls=nullptr)
Set the globally-visible declarations associated with the given identifier.
bool loadGlobalIndex()
Attempts to load the global index.
void ReadComments() override
Loads comments ranges.
SourceManager & getSourceManager() const
SourceLocation getSourceLocationForDeclID(GlobalDeclID ID)
Returns the source location for the decl ID.
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...
void finalizeForWriting()
Finalizes the AST reader's state before writing an AST file to disk.
Sema * getSema()
Retrieve the semantic analysis object used to analyze the translation unit in which the precompiled h...
CXXCtorInitializer ** GetExternalCXXCtorInitializers(uint64_t Offset) override
Read the contents of a CXXCtorInitializer array.
void visitInputFileInfos(serialization::ModuleFile &MF, bool IncludeSystem, llvm::function_ref< void(const serialization::InputFileInfo &IFI, bool IsSystem)> Visitor)
Visit all the input file infos of the given module file.
void StartTranslationUnit(ASTConsumer *Consumer) override
Function that will be invoked when we begin parsing a new translation unit involving this external AS...
LocalDeclID mapGlobalIDToModuleFileGlobalID(ModuleFile &M, GlobalDeclID GlobalID)
Map a global declaration ID into the declaration ID used to refer to this declaration within the give...
void resolvePendingMacro(IdentifierInfo *II, const PendingMacroInfo &PMInfo)
bool FindExternalVisibleDeclsByName(const DeclContext *DC, DeclarationName Name) override
Finds all the visible declarations with a given name.
void ReadTentativeDefinitions(SmallVectorImpl< VarDecl * > &TentativeDefs) override
Read the set of tentative definitions known to the external Sema source.
Decl * GetExternalDecl(GlobalDeclID ID) override
Resolve a declaration ID into a declaration, potentially building a new declaration.
GlobalDeclID ReadDeclID(ModuleFile &F, const RecordDataImpl &Record, unsigned &Idx)
Reads a declaration ID from the given position in a record in the given module.
llvm::Expected< SourceLocation::UIntTy > readSLocOffset(ModuleFile *F, unsigned Index)
Try to read the offset of the SLocEntry at the given index in the given module file.
void CompleteRedeclChain(const Decl *D) override
If any redeclarations of D have been imported since it was last checked, this digs out those redeclar...
static llvm::Error ReadBlockAbbrevs(llvm::BitstreamCursor &Cursor, unsigned BlockID, uint64_t *StartOfBlockOffset=nullptr)
ReadBlockAbbrevs - Enter a subblock of the specified BlockID with the specified cursor.
void SetIdentifierInfo(serialization::IdentifierID ID, IdentifierInfo *II)
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...
std::pair< unsigned, unsigned > findPreprocessedEntitiesInRange(SourceRange Range) override
Returns a pair of [Begin, End) indices of preallocated preprocessed entities that Range encompasses.
IdentifierInfo * get(StringRef Name) override
Retrieve the IdentifierInfo for the named identifier.
IdentifierInfo * getLocalIdentifier(ModuleFile &M, uint64_t LocalID)
void visitInputFiles(serialization::ModuleFile &MF, bool IncludeSystem, bool Complain, llvm::function_ref< void(const serialization::InputFile &IF, bool isSystem)> Visitor)
Visit all the input files of the given module file.
Module * getModule(unsigned ID) override
Retrieve the module that corresponds to the given module ID.
llvm::iterator_range< ModuleDeclIterator > getModuleFileLevelDecls(ModuleFile &Mod)
Stmt * GetExternalDeclStmt(uint64_t Offset) override
Resolve the offset of a statement into a statement.
Selector GetExternalSelector(serialization::SelectorID ID) override
Resolve a selector ID into a selector.
unsigned getTotalNumSelectors() const
Returns the number of selectors found in the chain.
MacroInfo * getMacro(serialization::MacroID ID)
Retrieve the macro with the given ID.
void ReadUndefinedButUsed(llvm::MapVector< NamedDecl *, SourceLocation > &Undefined) override
Load the set of used but not defined functions or variables with internal linkage,...
void ReadDelegatingConstructors(SmallVectorImpl< CXXConstructorDecl * > &Decls) override
Read the set of delegating constructors known to the external Sema source.
QualType GetType(serialization::TypeID ID)
Resolve a type ID into a type, potentially building a new type.
void addPendingMacro(IdentifierInfo *II, ModuleFile *M, uint32_t MacroDirectivesOffset)
Add a macro to deserialize its macro directive history.
SourceRange ReadSourceRange(ModuleFile &F, const RecordData &Record, unsigned &Idx, LocSeq *Seq=nullptr)
Read a source range.
GlobalDeclID getGlobalDeclID(ModuleFile &F, LocalDeclID LocalID) const
Map from a local declaration ID within a given module to a global declaration ID.
void ReadWeakUndeclaredIdentifiers(SmallVectorImpl< std::pair< IdentifierInfo *, WeakInfo > > &WeakIDs) override
Read the set of weak, undeclared identifiers known to the external Sema source.
void completeVisibleDeclsMap(const DeclContext *DC) override
Load all external visible decls in the given DeclContext.
void warnStackExhausted(SourceLocation Loc)
void ReadUnusedLocalTypedefNameCandidates(llvm::SmallSetVector< const TypedefNameDecl *, 4 > &Decls) override
Read the set of potentially unused typedefs known to the source.
IdentifierResolver & getIdResolver()
Get the identifier resolver used for name lookup / updates in the translation unit scope.
static bool readASTFileControlBlock(StringRef Filename, FileManager &FileMgr, const InMemoryModuleCache &ModuleCache, const PCHContainerReader &PCHContainerRdr, bool FindModuleFileExtensions, ASTReaderListener &Listener, bool ValidateDiagnosticOptions, unsigned ClientLoadCapabilities=ARR_ConfigurationMismatch|ARR_OutOfDate)
Read the control block for the named AST file.
void ReadExtVectorDecls(SmallVectorImpl< TypedefNameDecl * > &Decls) override
Read the set of ext_vector type declarations known to the external Sema source.
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,...
SmallVector< GlobalDeclID, 16 > PreloadedDeclIDs
std::pair< SourceLocation, StringRef > getModuleImportLoc(int ID) override
Retrieve the module import location and module name for the given source manager entry ID.
void ReadUnusedFileScopedDecls(SmallVectorImpl< const DeclaratorDecl * > &Decls) override
Read the set of unused file-scope declarations known to the external Sema source.
void ReadReferencedSelectors(SmallVectorImpl< std::pair< Selector, SourceLocation > > &Sels) override
Read the set of referenced selectors known to the external Sema source.
Selector DecodeSelector(serialization::SelectorID Idx)
ASTReadResult ReadAST(StringRef FileName, ModuleKind Type, SourceLocation ImportLoc, unsigned ClientLoadCapabilities, ModuleFile **NewLoadedModuleFile=nullptr)
Load the AST file designated by the given file name.
StringRef getOriginalSourceFile()
Retrieve the name of the original source file name for the primary module file.
std::string ReadPath(ModuleFile &F, const RecordData &Record, unsigned &Idx)
unsigned getModuleFileID(ModuleFile *M)
Get an ID for the given module file.
IdentifierInfo * DecodeIdentifierInfo(serialization::IdentifierID ID)
ASTReadResult
The result of reading the control block of an AST file, which can fail for various reasons.
@ Success
The control block was read successfully.
@ ConfigurationMismatch
The AST file was written with a different language/target configuration.
@ OutOfDate
The AST file is out-of-date relative to its input files, and needs to be regenerated.
@ Failure
The AST file itself appears corrupted.
@ VersionMismatch
The AST file was written by a different version of Clang.
@ HadErrors
The AST file has errors.
@ Missing
The AST file was missing.
static VersionTuple ReadVersionTuple(const RecordData &Record, unsigned &Idx)
Read a version tuple.
Token ReadToken(ModuleFile &M, const RecordDataImpl &Record, unsigned &Idx)
Reads a token out of a record.
SwitchCase * getSwitchCaseWithID(unsigned ID)
Retrieve the switch-case statement with the given ID.
serialization::IdentifierID getGlobalIdentifierID(ModuleFile &M, uint64_t LocalID)
void ReadLateParsedTemplates(llvm::MapVector< const FunctionDecl *, std::unique_ptr< LateParsedTemplate > > &LPTMap) override
Read the set of late parsed template functions for this source.
IdentifierIterator * getIdentifiers() override
Retrieve an iterator into the set of all identifiers in all loaded AST files.
void ReadUsedVTables(SmallVectorImpl< ExternalVTableUse > &VTables) override
Read the set of used vtables known to the external Sema source.
bool isGlobalIndexUnavailable() const
Determine whether we tried to load the global index, but failed, e.g., because it is out-of-date or d...
uint32_t GetNumExternalSelectors() override
Returns the number of selectors known to the external AST source.
void updateOutOfDateSelector(Selector Sel) override
Load the contents of the global method pool for a given selector if necessary.
Decl * GetExistingDecl(GlobalDeclID ID)
Resolve a declaration ID into a declaration.
static llvm::BitVector ReadBitVector(const RecordData &Record, const StringRef Blob)
ModuleFile * getLocalModuleFile(ModuleFile &M, unsigned ID) const
Retrieve the module file with a given local ID within the specified ModuleFile.
void LoadSelector(Selector Sel)
Load a selector from disk, registering its ID if it exists.
void ReadPragmaDiagnosticMappings(DiagnosticsEngine &Diag)
void makeNamesVisible(const HiddenNames &Names, Module *Owner)
Make the names within this set of hidden names visible.
void UpdateSema()
Update the state of Sema after loading some additional modules.
Decl * GetDecl(GlobalDeclID ID)
Resolve a declaration ID into a declaration, potentially building a new declaration.
ASTReader(Preprocessor &PP, InMemoryModuleCache &ModuleCache, ASTContext *Context, const PCHContainerReader &PCHContainerRdr, ArrayRef< std::shared_ptr< ModuleFileExtension > > Extensions, StringRef isysroot="", DisableValidationForModuleKind DisableValidationKind=DisableValidationForModuleKind::None, bool AllowASTWithCompilerErrors=false, bool AllowConfigurationMismatch=false, bool ValidateSystemInputs=false, bool ValidateASTInputFilesContent=false, bool UseGlobalIndex=true, std::unique_ptr< llvm::Timer > ReadTimer={})
Load the AST file and validate its contents against the given Preprocessor.
int getSLocEntryID(SourceLocation::UIntTy SLocOffset) override
Get the index ID for the loaded SourceLocation offset.
void ReadPendingInstantiations(SmallVectorImpl< std::pair< ValueDecl *, SourceLocation > > &Pending) override
Read the set of pending instantiations known to the external Sema source.
Preprocessor & getPreprocessor() const
Retrieve the preprocessor.
CXXTemporary * ReadCXXTemporary(ModuleFile &F, const RecordData &Record, unsigned &Idx)
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...
Module * getSubmodule(serialization::SubmoduleID GlobalID)
Retrieve the submodule that corresponds to a global submodule ID.
void PrintStats() override
Print some statistics about AST usage.
void mergeDefinitionVisibility(NamedDecl *Def, NamedDecl *MergedDef)
Note that MergedDef is a redefinition of the canonical definition Def, so Def should be visible whene...
serialization::SelectorID getGlobalSelectorID(ModuleFile &M, unsigned LocalID) const
Retrieve the global selector ID that corresponds to this the local selector ID in a given module.
void StartedDeserializing() override
Notify ASTReader that we started deserialization of a decl or type so until FinishedDeserializing is ...
void ReadMethodPool(Selector Sel) override
Load the contents of the global method pool for a given selector.
void InitializeContext()
Initializes the ASTContext.
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.
FileManager & getFileManager() const
static bool isAcceptableASTFile(StringRef Filename, FileManager &FileMgr, const InMemoryModuleCache &ModuleCache, const PCHContainerReader &PCHContainerRdr, const LangOptions &LangOpts, const TargetOptions &TargetOpts, const PreprocessorOptions &PPOpts, StringRef ExistingModuleCachePath, bool RequireStrictOptionMatches=false)
Determine whether the given AST file is acceptable to load into a translation unit with the given lan...
void FinishedDeserializing() override
Notify ASTReader that we finished the deserialization of a decl or type.
void updateOutOfDateIdentifier(const IdentifierInfo &II) override
Update an out-of-date identifier.
void ReadDefinedMacros() override
Read the set of macros defined by this external macro source.
HeaderFileInfo GetHeaderFileInfo(FileEntryRef FE) override
Read the header file information for the given file entry.
serialization::MacroID getGlobalMacroID(ModuleFile &M, unsigned LocalID)
Retrieve the global macro ID corresponding to the given local ID within the given module file.
An object for streaming information from a record.
bool readBool()
Read a boolean value, advancing Idx.
uint32_t readUInt32()
Read a 32-bit unsigned value; required to satisfy BasicReader.
llvm::APFloat readAPFloat(const llvm::fltSemantics &Sem)
Read an arbitrary constant value, advancing Idx.
TemplateArgumentLoc readTemplateArgumentLoc()
Reads a TemplateArgumentLoc, advancing Idx.
void readTypeLoc(TypeLoc TL, LocSeq *Seq=nullptr)
Reads the location information for a type.
void readUnresolvedSet(LazyASTUnresolvedSet &Set)
Read a UnresolvedSet structure, advancing Idx.
void readTemplateArgumentList(SmallVectorImpl< TemplateArgument > &TemplArgs, bool Canonicalize=false)
Read a template argument array, advancing Idx.
void readQualifierInfo(QualifierInfo &Info)
DeclarationNameLoc readDeclarationNameLoc(DeclarationName Name)
Read a declaration name, advancing Idx.
CXXBaseSpecifier readCXXBaseSpecifier()
Read a C++ base specifier, advancing Idx.
Expected< unsigned > readRecord(llvm::BitstreamCursor &Cursor, unsigned AbbrevID)
Reads a record with id AbbrevID from Cursor, resetting the internal state.
DeclarationNameInfo readDeclarationNameInfo()
IdentifierInfo * readIdentifier()
TemplateArgumentLocInfo readTemplateArgumentLocInfo(TemplateArgument::ArgKind Kind)
Reads a TemplateArgumentLocInfo appropriate for the given TemplateArgument kind, advancing Idx.
TemplateArgument readTemplateArgument(bool Canonicalize)
ASTContext & getContext()
Retrieve the AST context that this AST reader supplements.
TypeSourceInfo * readTypeSourceInfo()
Reads a declarator info from the given record, advancing Idx.
void readTemplateArgumentListInfo(TemplateArgumentListInfo &Result)
TypeCoupledDeclRefInfo readTypeCoupledDeclRefInfo()
void skipInts(unsigned N)
Skips the specified number of values.
GlobalDeclID readDeclID()
Reads a declaration ID from the given position in this record.
SourceRange readSourceRange(LocSeq *Seq=nullptr)
Read a source range, advancing Idx.
NestedNameSpecifierLoc readNestedNameSpecifierLoc()
Return a nested name specifier, advancing Idx.
ConceptReference * readConceptReference()
void readOMPChildren(OMPChildren *Data)
Read an OpenMP children, advancing Idx.
OMPClause * readOMPClause()
Read an OpenMP clause, advancing Idx.
void readOpenACCClauseList(MutableArrayRef< const OpenACCClause * > Clauses)
Read a list of OpenACC clauses into the passed SmallVector.
OMPTraitInfo * readOMPTraitInfo()
Read an OMPTraitInfo object, advancing Idx.
TemplateParameterList * readTemplateParameterList()
Read a template parameter list, advancing Idx.
OpenACCClause * readOpenACCClause()
Read an OpenACC clause, advancing Idx.
llvm::SmallVector< Expr * > readOpenACCVarList()
Read a list of Exprs used for a var-list.
CXXCtorInitializer ** readCXXCtorInitializers()
Read a CXXCtorInitializer array, advancing Idx.
Stmt * readStmt()
Reads a statement.
const ASTTemplateArgumentListInfo * readASTTemplateArgumentListInfo()
uint64_t readInt()
Returns the current value in this record, and advances to the next value.
Attr * readAttr()
Reads one attribute from the current stream position, advancing Idx.
Expr * readExpr()
Reads an expression.
SourceLocation readSourceLocation(LocSeq *Seq=nullptr)
Read a source location, advancing Idx.
llvm::SmallVector< Expr * > readOpenACCIntExprList()
Read a list of Exprs used for a int-expr-list.
Expr * readSubExpr()
Reads a sub-expression operand during statement reading.
Abstracts clang modules and precompiled header files and holds everything needed to generate debug in...
Wrapper for source info for array parameter types.
Wrapper for source info for arrays.
void setLBracketLoc(SourceLocation Loc)
void setRBracketLoc(SourceLocation Loc)
void setSizeExpr(Expr *Size)
void setRParenLoc(SourceLocation Loc)
void setLParenLoc(SourceLocation Loc)
void setKWLoc(SourceLocation Loc)
Attr - This represents one attribute.
Type source information for an attributed type.
void setAttr(const Attr *A)
void setConceptReference(ConceptReference *CR)
void setRParenLoc(SourceLocation Loc)
Type source information for an btf_tag attributed type.
Wrapper for source info for block pointers.
void setCaretLoc(SourceLocation Loc)
Wrapper for source info for builtin types.
void setWrittenTypeSpec(TypeSpecifierType written)
bool needsExtraLocalData() const
void setModeAttr(bool written)
void setBuiltinLoc(SourceLocation Loc)
void setWrittenWidthSpec(TypeSpecifierWidth written)
void setWrittenSignSpec(TypeSpecifierSign written)
Represents a base class of a C++ class.
Represents a C++ constructor within a class.
Represents a C++ base or member initializer.
void setSourceOrder(int Pos)
Set the source order of this initializer.
Represents a C++ destructor within a class.
Represents a C++ struct/union/class.
Decl * getLambdaContextDecl() const
Retrieve the declaration that provides additional context for a lambda, when the normal declaration c...
unsigned getLambdaIndexInContext() const
Retrieve the index of this lambda within the context declaration returned by getLambdaContextDecl().
base_class_iterator bases_begin()
base_class_iterator vbases_begin()
Represents a C++ temporary.
static CXXTemporary * Create(const ASTContext &C, const CXXDestructorDecl *Destructor)
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...
bool ReadFullVersionInformation(StringRef FullVersion) override
Receives the full Clang version information.
bool ReadHeaderSearchOptions(const HeaderSearchOptions &HSOpts, StringRef ModuleFilename, StringRef SpecificModuleCachePath, bool Complain) override
Receives the header search options.
bool ReadFileSystemOptions(const FileSystemOptions &FSOpts, bool Complain) override
Receives the file system options.
void ReadCounter(const serialization::ModuleFile &M, unsigned Value) override
Receives COUNTER value.
void ReadModuleMapFile(StringRef ModuleMapPath) override
bool ReadLanguageOptions(const LangOptions &LangOpts, StringRef ModuleFilename, bool Complain, bool AllowCompatibleDifferences) override
Receives the language options.
bool ReadTargetOptions(const TargetOptions &TargetOpts, StringRef ModuleFilename, bool Complain, bool AllowCompatibleDifferences) override
Receives the target options.
void ReadModuleName(StringRef ModuleName) override
bool needsInputFileVisitation() override
Returns true if this ASTReaderListener wants to receive the input files of the AST file via visitInpu...
bool ReadPreprocessorOptions(const PreprocessorOptions &PPOpts, StringRef ModuleFilename, bool ReadMacros, bool Complain, std::string &SuggestedPredefines) override
Receives the preprocessor options.
void readModuleFileExtension(const ModuleFileExtensionMetadata &Metadata) override
Indicates that a particular module file extension has been read.
void visitModuleFile(StringRef Filename, serialization::ModuleKind Kind) override
This is called for each AST file loaded.
bool ReadDiagnosticOptions(IntrusiveRefCntPtr< DiagnosticOptions > DiagOpts, StringRef ModuleFilename, bool Complain) override
Receives the diagnostic options.
bool needsSystemInputFileVisitation() override
Returns true if this ASTReaderListener wants to receive the system input files of the AST file via vi...
A reference to a concept and its template args, as it appears in the code.
static ConceptReference * Create(const ASTContext &C, NestedNameSpecifierLoc NNS, SourceLocation TemplateKWLoc, DeclarationNameInfo ConceptNameInfo, NamedDecl *FoundDecl, ConceptDecl *NamedConcept, const ASTTemplateArgumentListInfo *ArgsAsWritten)
const TypeClass * getTypePtr() const
An object that helps properly build a continuous range map from a set of values.
A map from continuous integer ranges to some value, with a very specialized interface.
void insertOrReplace(const value_type &Val)
typename Representation::const_iterator const_iterator
typename Representation::iterator iterator
Wrapper for source info for pointers decayed from arrays and functions.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
bool isDependentContext() const
Determines whether this context is dependent on a template parameter.
lookup_result lookup(DeclarationName Name) const
lookup - Find the declarations (if any) with the given Name in this context.
bool hasExternalVisibleStorage() const
Whether this DeclContext has external storage containing additional declarations that are visible in ...
DeclContext * getRedeclContext()
getRedeclContext - Retrieve the context in which an entity conflicts with other entities of the same ...
void setMustBuildLookupTable()
Mark that there are external lexical declarations that we need to include in our lookup table (and th...
bool hasExternalLexicalStorage() const
Whether this DeclContext has external storage containing additional declarations that are lexically i...
DeclContext * getPrimaryContext()
getPrimaryContext - There may be many different declarations of the same entity (including forward de...
decl_range decls() const
decls_begin/decls_end - Iterate over the declarations stored in this context.
void setHasExternalLexicalStorage(bool ES=true) const
State whether this DeclContext has external storage for declarations lexically in this context.
bool isDeclInLexicalTraversal(const Decl *D) const
Determine whether the given declaration is stored in the list of declarations lexically within this c...
decl_iterator decls_begin() const
unsigned getModuleFileIndex() const
DeclID getRawValue() const
unsigned getLocalDeclIndex() const
uint64_t DeclID
An ID number that refers to a declaration in an AST file.
Decl - This represents one declaration (or definition), e.g.
Decl * getPreviousDecl()
Retrieve the previous declaration that declares the same entity as this declaration,...
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
void setInvalidDecl(bool Invalid=true)
setInvalidDecl - Indicates the Decl had a semantic error.
bool isUnconditionallyVisible() const
Determine whether this declaration is definitely visible to name lookup, independent of whether the o...
Kind
Lists the kind of concrete classes of Decl.
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...
SourceLocation getLocation() const
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl.
DeclContext * getDeclContext()
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC).
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
GlobalDeclID getGlobalID() const
Retrieve the global declaration ID associated with this declaration, which specifies where this Decl ...
void setVisibleDespiteOwningModule()
Set that this declaration is globally visible, even if it came from a module that is not visible.
DeclarationNameLoc - Additional source/type location info for a declaration name.
static DeclarationNameLoc makeNamedTypeLoc(TypeSourceInfo *TInfo)
Construct location information for a constructor, destructor or conversion operator.
static DeclarationNameLoc makeCXXLiteralOperatorNameLoc(SourceLocation Loc)
Construct location information for a literal C++ operator.
static DeclarationNameLoc makeCXXOperatorNameLoc(SourceLocation BeginLoc, SourceLocation EndLoc)
Construct location information for a non-literal C++ operator.
The name of a declaration.
NameKind
The kind of the name stored in this DeclarationName.
@ CXXConversionFunctionName
Represents a ValueDecl that came out of a declarator.
void setRParenLoc(SourceLocation Loc)
void setDecltypeLoc(SourceLocation Loc)
void setTemplateNameLoc(SourceLocation Loc)
void setAttrNameLoc(SourceLocation loc)
void setAttrOperandParensRange(SourceRange range)
void setAttrExprOperand(Expr *e)
void setNameLoc(SourceLocation Loc)
void setElaboratedKeywordLoc(SourceLocation Loc)
void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
void setNameLoc(SourceLocation Loc)
void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
unsigned getNumArgs() const
void setTemplateKeywordLoc(SourceLocation Loc)
void setElaboratedKeywordLoc(SourceLocation Loc)
void setRAngleLoc(SourceLocation Loc)
void setLAngleLoc(SourceLocation Loc)
void setArgLocInfo(unsigned i, TemplateArgumentLocInfo AI)
void setTemplateNameLoc(SourceLocation Loc)
ArrayRef< TemplateArgument > template_arguments() const
void setNameLoc(SourceLocation Loc)
A little helper class used to produce diagnostics.
Carries a Clang diagnostic in an llvm::Error.
static llvm::Error create(SourceLocation Loc, PartialDiagnostic Diag)
Creates a new DiagnosticError that contains the given diagnostic at the given location.
bool wasUpgradedFromWarning() const
Whether this mapping attempted to map the diagnostic to a warning, but was overruled because the diag...
bool isErrorOrFatal() const
void setSeverity(diag::Severity Value)
static DiagnosticMapping deserialize(unsigned Bits)
Deserialize a mapping.
void setUpgradedFromWarning(bool Value)
Options for controlling the compiler diagnostics engine.
std::vector< std::string > SystemHeaderWarningsModules
The list of -Wsystem-headers-in-module=... options used to override whether -Wsystem-headers is enabl...
Concrete class used by the front-end to report problems and issues.
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.
DiagnosticOptions & getDiagnosticOptions() const
Retrieve the diagnostic options.
bool getEnableAllWarnings() const
Level
The level of the diagnostic, after it has been through mapping.
Level getDiagnosticLevel(unsigned DiagID, SourceLocation Loc) const
Based on the way the client configured the DiagnosticsEngine object, classify the specified diagnosti...
bool getSuppressSystemWarnings() const
bool getWarningsAsErrors() const
diag::Severity getExtensionHandlingBehavior() const
const IntrusiveRefCntPtr< DiagnosticIDs > & getDiagnosticIDs() const
StringRef getName() const
void setElaboratedKeywordLoc(SourceLocation Loc)
void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
Wrapper for source info for enum types.
This represents one expression.
RAII class for safely pairing a StartedDeserializing call with FinishedDeserializing.
MemoryBufferSizes getMemoryBufferSizes() const
Return the amount of memory used by memory buffers, breaking down by heap-backed versus mmap'ed memor...
uint32_t getGeneration() const
Get the current generation of this AST source.
Represents difference between two FPOptions values.
static FPOptionsOverride getFromOpaqueInt(storage_type I)
FPOptions applyOverrides(FPOptions Base)
static FPOptions getFromOpaqueInt(storage_type Value)
Represents a member of a struct/union/class.
A reference to a FileEntry that includes the name of the file as it was accessed by the FileManager's...
time_t getModificationTime() const
StringRef getName() const
The name of this FileEntry.
Cached information about one file (either on disk or in the virtual file system).
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
Implements support for file system lookup, file system caching, and directory search management.
llvm::vfs::FileSystem & getVirtualFileSystem() const
OptionalFileEntryRef getOptionalFileRef(StringRef Filename, bool OpenFile=false, bool CacheFailure=true)
Get a FileEntryRef if it exists, without doing anything on error.
llvm::ErrorOr< std::unique_ptr< llvm::MemoryBuffer > > getBufferForFile(FileEntryRef Entry, bool isVolatile=false, bool RequiresNullTerminator=true, std::optional< int64_t > MaybeLimit=std::nullopt)
Open the specified file as a MemoryBuffer, returning a new MemoryBuffer if successful,...
FileEntryRef getVirtualFileRef(StringRef Filename, off_t Size, time_t ModificationTime)
Retrieve a file entry for a "virtual" file that acts as if there were a file with the given name on d...
llvm::ErrorOr< const FileEntry * > getFile(StringRef Filename, bool OpenFile=false, bool CacheFailure=true)
Lookup, cache, and verify the specified file (real or virtual).
Keeps track of options that affect how file operations are performed.
std::string WorkingDir
If set, paths are resolved as if the working directory was set to the value of WorkingDir.
Represents a function declaration or definition.
void setLazyBody(uint64_t Offset)
Represents a prototype with parameter type info, e.g.
ExtProtoInfo getExtProtoInfo() const
Wrapper for source info for functions.
unsigned getNumParams() const
void setLocalRangeBegin(SourceLocation L)
void setLParenLoc(SourceLocation Loc)
void setParam(unsigned i, ParmVarDecl *VD)
void setRParenLoc(SourceLocation Loc)
void setLocalRangeEnd(SourceLocation L)
void setExceptionSpecRange(SourceRange R)
static std::pair< GlobalModuleIndex *, llvm::Error > readIndex(llvm::StringRef Path)
Read a global index file for the given directory.
One of these records is kept for each identifier that is lexed.
unsigned getBuiltinID() const
Return a value indicating whether this is a builtin function.
bool isCPlusPlusOperatorKeyword() const
tok::TokenKind getTokenID() const
If this is a source-language token (e.g.
bool hadMacroDefinition() const
Returns true if this identifier was #defined to some value at any moment.
void setIsPoisoned(bool Value=true)
setIsPoisoned - Mark this identifier as poisoned.
bool isFromAST() const
Return true if the identifier in its current state was loaded from an AST file.
bool isPoisoned() const
Return true if this token has been poisoned.
bool hasRevertedTokenIDToIdentifier() const
True if revertTokenIDToIdentifier() was called.
tok::NotableIdentifierKind getNotableIdentifierID() const
void setOutOfDate(bool OOD)
Set whether the information for this identifier is out of date with respect to the external source.
tok::ObjCKeywordKind getObjCKeywordID() const
Return the Objective-C keyword ID for the this identifier.
void setObjCOrBuiltinID(unsigned ID)
void revertTokenIDToIdentifier()
Revert TokenID to tok::identifier; used for GNU libstdc++ 4.2 compatibility.
bool isOutOfDate() const
Determine whether the information for this identifier is out of date with respect to the external sou...
void setChangedSinceDeserialization()
Note that this identifier has changed since it was loaded from an AST file.
void * getFETokenInfo() const
Get and set FETokenInfo.
StringRef getName() const
Return the actual identifier string.
bool isExtensionToken() const
get/setExtension - Initialize information about whether or not this language token is an extension.
An iterator that walks over all of the known identifiers in the lookup table.
IdentifierResolver - Keeps track of shadowed decls on enclosing scopes.
void RemoveDecl(NamedDecl *D)
RemoveDecl - Unlink the decl from its shadowed decl chain.
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...
llvm::iterator_range< iterator > decls(DeclarationName Name)
Returns a range of decls with the name 'Name'.
Implements an efficient mapping from strings to IdentifierInfo nodes.
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
In-memory cache for modules.
llvm::MemoryBuffer * lookupPCM(llvm::StringRef Filename) const
Get a pointer to the pCM if it exists; else nullptr.
Record the location of an inclusion directive, such as an #include or #import statement.
InclusionKind
The kind of inclusion directives known to the preprocessor.
Represents a field injected from an anonymous union/struct into the parent scope.
Wrapper for source info for injected class names of class templates.
void setAmpLoc(SourceLocation Loc)
PragmaMSPointersToMembersKind
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
clang::ObjCRuntime ObjCRuntime
SanitizerSet Sanitize
Set of enabled sanitizers.
CommentOptions CommentOpts
Options for parsing comments.
std::string OMPHostIRFile
Name of the IR file that contains the result of the OpenMP target host code generation.
std::vector< llvm::Triple > OMPTargetTriples
Triples of the OpenMP targets that the host code codegen should take into account in order to generat...
std::string CurrentModule
The name of the current module, of which the main source file is a part.
std::vector< std::string > ModuleFeatures
The names of any features to enable in module 'requires' decls in addition to the hard-coded list in ...
An UnresolvedSet-like class that might not have been loaded from the external AST source yet.
Used to hold and unique data used to represent #line information.
unsigned getLineTableFilenameID(StringRef Str)
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...
static LocalDeclID get(ASTReader &Reader, serialization::ModuleFile &MF, DeclID ID)
Record the location of a macro definition.
Encapsulates changes to the "macros namespace" (the location where the macro name became active,...
void setPrevious(MacroDirective *Prev)
Set previous definition of the macro with the same name.
Records the location of a macro expansion.
Encapsulates the data about a macro definition (e.g.
void setUsedForHeaderGuard(bool Val)
void setHasCommaPasting()
void setDefinitionEndLoc(SourceLocation EndLoc)
Set the location of the last token in the macro.
void setParameterList(ArrayRef< IdentifierInfo * > List, llvm::BumpPtrAllocator &PPAllocator)
Set the specified list of identifiers as the parameter list for this macro.
llvm::MutableArrayRef< Token > allocateTokens(unsigned NumTokens, llvm::BumpPtrAllocator &PPAllocator)
void setIsFunctionLike()
Function/Object-likeness.
void setIsC99Varargs()
Varargs querying methods. This can only be set for function-like macros.
void setIsUsed(bool Val)
Set the value of the IsUsed flag.
void setExpansionLoc(SourceLocation Loc)
void setAttrRowOperand(Expr *e)
void setAttrColumnOperand(Expr *e)
void setAttrOperandParensRange(SourceRange range)
void setAttrNameLoc(SourceLocation loc)
Wrapper for source info for member pointers.
void setStarLoc(SourceLocation Loc)
void setClassTInfo(TypeSourceInfo *TI)
void addLinkAsDependency(Module *Mod)
Make module to use export_as as the link dependency name if enough information is available or add it...
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 setUmbrellaDirAsWritten(Module *Mod, DirectoryEntryRef UmbrellaDir, const Twine &NameAsWritten, const Twine &PathRelativeToRootModuleDirectory)
Sets the umbrella directory of the given module to the given directory.
void setUmbrellaHeaderAsWritten(Module *Mod, FileEntryRef UmbrellaHeader, const Twine &NameAsWritten, const Twine &PathRelativeToRootModuleDirectory)
Sets the umbrella header of the given module to the given header.
llvm::DenseSet< FileEntryRef > AdditionalModMapsSet
void resolveLinkAsDependencies(Module *Mod)
Use PendingLinkAsModule information to mark top level link names that are going to be replaced by exp...
ModuleHeaderRole
Flags describing the role of a module header.
void addHeader(Module *Mod, Module::Header Header, ModuleHeaderRole Role, bool Imported=false)
Adds this header to the given module.
Describes a module or submodule.
StringRef getTopLevelModuleName() const
Retrieve the name of the top-level module.
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.
unsigned InferSubmodules
Whether we should infer submodules for this module based on the headers.
std::vector< std::string > ConfigMacros
The set of "configuration macros", which are macros that (intentionally) change how this module is bu...
unsigned IsUnimportable
Whether this module has declared itself unimportable, either because it's missing a requirement from ...
NameVisibilityKind NameVisibility
The visibility of names within this particular module.
NameVisibilityKind
Describes the visibility of the various names within a particular module.
@ Hidden
All of the names in this module are hidden.
@ AllVisible
All of the names in this module are visible.
SourceLocation DefinitionLoc
The location of the module definition.
SmallVector< UnresolvedHeaderDirective, 1 > MissingHeaders
Headers that are mentioned in the module map file but could not be found on the file system.
ModuleKind Kind
The kind of this module.
void addTopHeaderFilename(StringRef Filename)
Add a top-level header filename associated with this module.
bool isUnimportable() const
Determine whether this module has been declared unimportable.
void setASTFile(OptionalFileEntryRef File)
Set the serialized AST file for the top-level module of this module.
unsigned IsSystem
Whether this is a "system" module (which assumes that all headers in it are system headers).
std::string Name
The name of this module.
unsigned IsExternC
Whether this is an 'extern "C"' module (which implicitly puts all headers in it within an 'extern "C"...
unsigned ModuleMapIsPrivate
Whether this module came from a "private" module map, found next to a regular (public) module map.
llvm::SmallVector< LinkLibrary, 2 > LinkLibraries
The set of libraries or frameworks to link against when an entity from this module is used.
SmallVector< UnresolvedExportDecl, 2 > UnresolvedExports
The set of export declarations that have yet to be resolved.
std::optional< Header > getUmbrellaHeaderAsWritten() const
Retrieve the umbrella header as written.
SmallVector< Requirement, 2 > Requirements
The set of language features required to use this module.
OptionalDirectoryEntryRef Directory
The build directory of this module.
unsigned NamedModuleHasInit
Whether this C++20 named modules doesn't need an initializer.
unsigned ConfigMacrosExhaustive
Whether the set of configuration macros is exhaustive.
std::string PresumedModuleMapFile
The presumed file name for the module map defining this module.
ASTFileSignature Signature
The module signature.
unsigned InferExportWildcard
Whether, when inferring submodules, the inferr submodules should export all modules they import (e....
void getExportedModules(SmallVectorImpl< Module * > &Exported) const
Appends this module's list of exported modules to Exported.
std::vector< UnresolvedConflict > UnresolvedConflicts
The list of conflicts for which the module-id has not yet been resolved.
unsigned IsFromModuleFile
Whether this module was loaded from a module file.
llvm::PointerIntPair< Module *, 1, bool > ExportDecl
Describes an exported module.
std::optional< DirectoryName > getUmbrellaDirAsWritten() const
Retrieve the umbrella directory as written.
std::string ExportAsModule
The module through which entities defined in this module will eventually be exposed,...
unsigned IsAvailable
Whether this module is available in the current translation unit.
unsigned InferExplicitSubmodules
Whether, when inferring submodules, the inferred submodules should be explicit.
OptionalFileEntryRef getASTFile() const
The serialized AST file for this module, if one was created.
std::vector< Conflict > Conflicts
The list of conflicts.
This represents a decl that may have a name.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
Represents a C++ namespace alias.
Represent a C++ namespace.
Class that aids in the construction of nested-name-specifiers along with source-location information ...
A C++ nested-name-specifier augmented with source location information.
@ NamespaceAlias
A namespace alias, stored as a NamespaceAliasDecl*.
@ TypeSpec
A type, stored as a Type*.
@ TypeSpecWithTemplate
A type that was preceded by the 'template' keyword, stored as a Type*.
@ Super
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in.
@ Identifier
An identifier, stored as an IdentifierInfo*.
@ Global
The global specifier '::'. There is no stored value.
@ Namespace
A namespace, stored as a NamespaceDecl*.
static 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...
This represents the 'absent' clause in the '#pragma omp assume' directive.
static OMPAbsentClause * CreateEmpty(const ASTContext &C, unsigned NumKinds)
This represents 'acq_rel' clause in the '#pragma omp atomic|flush' directives.
This represents 'acquire' clause in the '#pragma omp atomic|flush' directives.
This represents clause 'affinity' in the '#pragma omp task'-based directives.
static OMPAffinityClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N locator items.
This represents the 'align' clause in the '#pragma omp allocate' directive.
This represents clause 'aligned' in the '#pragma omp ...' directives.
static OMPAlignedClause * CreateEmpty(const ASTContext &C, unsigned NumVars)
Creates an empty clause with the place for NumVars variables.
This represents clause 'allocate' in the '#pragma omp ...' directives.
static OMPAllocateClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N variables.
This represents 'allocator' clause in the '#pragma omp ...' directive.
This represents 'at' clause in the '#pragma omp error' directive.
This represents 'atomic_default_mem_order' clause in the '#pragma omp requires' directive.
This represents 'bind' clause in the '#pragma omp ...' directives.
static OMPBindClause * CreateEmpty(const ASTContext &C)
Build an empty 'bind' clause.
This represents 'capture' clause in the '#pragma omp atomic' directive.
Contains data for OpenMP directives: clauses, children expressions/statements (helpers for codegen) a...
void VisitOMPClauseWithPostUpdate(OMPClauseWithPostUpdate *C)
OMPClauseReader(ASTRecordReader &Record)
void VisitOMPClauseWithPreInit(OMPClauseWithPreInit *C)
RetTy Visit(PTR(OMPClause) S)
Class that handles post-update expression for some clauses, like 'lastprivate', 'reduction' etc.
Class that handles pre-initialization statement for some clauses, like 'schedule',...
This is a basic class for representing single OpenMP clause.
This represents 'collapse' clause in the '#pragma omp ...' directive.
This represents 'compare' clause in the '#pragma omp atomic' directive.
This represents the 'contains' clause in the '#pragma omp assume' directive.
static OMPContainsClause * CreateEmpty(const ASTContext &C, unsigned NumKinds)
This represents clause 'copyin' in the '#pragma omp ...' directives.
static OMPCopyinClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with N variables.
This represents clause 'copyprivate' in the '#pragma omp ...' directives.
static OMPCopyprivateClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with N variables.
This represents 'default' clause in the '#pragma omp ...' directive.
This represents 'defaultmap' clause in the '#pragma omp ...' directive.
This represents implicit clause 'depend' for the '#pragma omp task' directive.
static OMPDependClause * CreateEmpty(const ASTContext &C, unsigned N, unsigned NumLoops)
Creates an empty clause with N variables.
This represents implicit clause 'depobj' for the '#pragma omp depobj' directive.
static OMPDepobjClause * CreateEmpty(const ASTContext &C)
Creates an empty clause.
This represents 'destroy' clause in the '#pragma omp depobj' directive or the '#pragma omp interop' d...
This represents 'detach' clause in the '#pragma omp task' directive.
This represents 'device' clause in the '#pragma omp ...' directive.
This represents 'dist_schedule' clause in the '#pragma omp ...' directive.
This represents the 'doacross' clause for the '#pragma omp ordered' directive.
static OMPDoacrossClause * CreateEmpty(const ASTContext &C, unsigned N, unsigned NumLoops)
Creates an empty clause with N expressions.
This represents 'dynamic_allocators' clause in the '#pragma omp requires' directive.
This represents clause 'exclusive' in the '#pragma omp scan' directive.
static OMPExclusiveClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N variables.
This represents 'fail' clause in the '#pragma omp atomic' directive.
This represents 'filter' clause in the '#pragma omp ...' directive.
This represents 'final' clause in the '#pragma omp ...' directive.
This represents clause 'firstprivate' in the '#pragma omp ...' directives.
static OMPFirstprivateClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N variables.
This represents implicit clause 'flush' for the '#pragma omp flush' directive.
static OMPFlushClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with N variables.
This represents clause 'from' in the '#pragma omp ...' directives.
static OMPFromClause * CreateEmpty(const ASTContext &C, const OMPMappableExprListSizeTy &Sizes)
Creates an empty clause with the place for NumVars variables.
Representation of the 'full' clause of the '#pragma omp unroll' directive.
static OMPFullClause * CreateEmpty(const ASTContext &C)
Build an empty 'full' AST node for deserialization.
This represents 'grainsize' clause in the '#pragma omp ...' directive.
This represents clause 'has_device_ptr' in the '#pragma omp ...' directives.
static OMPHasDeviceAddrClause * CreateEmpty(const ASTContext &C, const OMPMappableExprListSizeTy &Sizes)
Creates an empty clause with the place for NumVars variables.
This represents 'hint' clause in the '#pragma omp ...' directive.
This represents the 'holds' clause in the '#pragma omp assume' directive.
This represents 'if' clause in the '#pragma omp ...' directive.
This represents clause 'in_reduction' in the '#pragma omp task' directives.
static OMPInReductionClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N variables.
This represents clause 'inclusive' in the '#pragma omp scan' directive.
static OMPInclusiveClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N variables.
This represents the 'init' clause in '#pragma omp ...' directives.
static OMPInitClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with N expressions.
This represents clause 'is_device_ptr' in the '#pragma omp ...' directives.
static OMPIsDevicePtrClause * CreateEmpty(const ASTContext &C, const OMPMappableExprListSizeTy &Sizes)
Creates an empty clause with the place for NumVars variables.
This represents clause 'lastprivate' in the '#pragma omp ...' directives.
static OMPLastprivateClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N variables.
This represents clause 'linear' in the '#pragma omp ...' directives.
static OMPLinearClause * CreateEmpty(const ASTContext &C, unsigned NumVars)
Creates an empty clause with the place for NumVars variables.
This represents clause 'map' in the '#pragma omp ...' directives.
static OMPMapClause * CreateEmpty(const ASTContext &C, const OMPMappableExprListSizeTy &Sizes)
Creates an empty clause with the place for NumVars original expressions, NumUniqueDeclarations declar...
This represents 'mergeable' clause in the '#pragma omp ...' directive.
This represents 'message' clause in the '#pragma omp error' directive.
This represents the 'no_openmp' clause in the '#pragma omp assume' directive.
This represents the 'no_openmp_routines' clause in the '#pragma omp assume' directive.
This represents the 'no_parallelism' clause in the '#pragma omp assume' directive.
This represents 'nocontext' clause in the '#pragma omp ...' directive.
This represents 'nogroup' clause in the '#pragma omp ...' directive.
This represents clause 'nontemporal' in the '#pragma omp ...' directives.
static OMPNontemporalClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N variables.
This represents 'novariants' clause in the '#pragma omp ...' directive.
This represents 'nowait' clause in the '#pragma omp ...' directive.
This represents 'num_tasks' clause in the '#pragma omp ...' directive.
This represents 'num_teams' clause in the '#pragma omp ...' directive.
static OMPNumTeamsClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with N variables.
This represents 'num_threads' clause in the '#pragma omp ...' directive.
This represents 'order' clause in the '#pragma omp ...' directive.
This represents 'ordered' clause in the '#pragma omp ...' directive.
static OMPOrderedClause * CreateEmpty(const ASTContext &C, unsigned NumLoops)
Build an empty clause.
Representation of the 'partial' clause of the '#pragma omp unroll' directive.
static OMPPartialClause * CreateEmpty(const ASTContext &C)
Build an empty 'partial' AST node for deserialization.
This represents 'priority' clause in the '#pragma omp ...' directive.
This represents clause 'private' in the '#pragma omp ...' directives.
static OMPPrivateClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N variables.
This represents 'proc_bind' clause in the '#pragma omp ...' directive.
This represents 'read' clause in the '#pragma omp atomic' directive.
This represents clause 'reduction' in the '#pragma omp ...' directives.
static OMPReductionClause * CreateEmpty(const ASTContext &C, unsigned N, OpenMPReductionClauseModifier Modifier)
Creates an empty clause with the place for N variables.
This represents 'relaxed' clause in the '#pragma omp atomic' directives.
This represents 'release' clause in the '#pragma omp atomic|flush' directives.
This represents 'reverse_offload' clause in the '#pragma omp requires' directive.
This represents 'simd' clause in the '#pragma omp ...' directive.
This represents 'safelen' clause in the '#pragma omp ...' directive.
This represents 'schedule' clause in the '#pragma omp ...' directive.
This represents 'seq_cst' clause in the '#pragma omp atomic' directive.
This represents 'severity' clause in the '#pragma omp error' directive.
This represents clause 'shared' in the '#pragma omp ...' directives.
static OMPSharedClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with N variables.
This represents 'simdlen' clause in the '#pragma omp ...' directive.
This represents the 'sizes' clause in the '#pragma omp tile' directive.
static OMPSizesClause * CreateEmpty(const ASTContext &C, unsigned NumSizes)
Build an empty 'sizes' AST node for deserialization.
This represents clause 'task_reduction' in the '#pragma omp taskgroup' directives.
static OMPTaskReductionClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N variables.
This represents 'thread_limit' clause in the '#pragma omp ...' directive.
static OMPThreadLimitClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with N variables.
This represents 'threads' clause in the '#pragma omp ...' directive.
This represents clause 'to' in the '#pragma omp ...' directives.
static OMPToClause * CreateEmpty(const ASTContext &C, const OMPMappableExprListSizeTy &Sizes)
Creates an empty clause with the place for NumVars variables.
Helper data structure representing the traits in a match clause of an declare variant or metadirectiv...
llvm::SmallVector< OMPTraitSet, 2 > Sets
The outermost level of selector sets.
This represents 'unified_address' clause in the '#pragma omp requires' directive.
This represents 'unified_shared_memory' clause in the '#pragma omp requires' directive.
This represents 'untied' clause in the '#pragma omp ...' directive.
This represents 'update' clause in the '#pragma omp atomic' directive.
static OMPUpdateClause * CreateEmpty(const ASTContext &C, bool IsExtended)
Creates an empty clause with the place for N variables.
This represents the 'use' clause in '#pragma omp ...' directives.
This represents clause 'use_device_addr' in the '#pragma omp ...' directives.
static OMPUseDeviceAddrClause * CreateEmpty(const ASTContext &C, const OMPMappableExprListSizeTy &Sizes)
Creates an empty clause with the place for NumVars variables.
This represents clause 'use_device_ptr' in the '#pragma omp ...' directives.
static OMPUseDevicePtrClause * CreateEmpty(const ASTContext &C, const OMPMappableExprListSizeTy &Sizes)
Creates an empty clause with the place for NumVars variables.
This represents clause 'uses_allocators' in the '#pragma omp target'-based directives.
static OMPUsesAllocatorsClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N allocators.
This represents 'weak' clause in the '#pragma omp atomic' directives.
This represents 'write' clause in the '#pragma omp atomic' directive.
This represents 'ompx_attribute' clause in a directive that might generate an outlined function.
This represents 'ompx_bare' clause in the '#pragma omp target teams ...' directive.
This represents 'ompx_dyn_cgroup_mem' clause in the '#pragma omp target ...' directive.
method_range methods() const
Represents an ObjC class declaration.
Wrapper for source info for ObjC interfaces.
void setNameLoc(SourceLocation Loc)
void setNameEndLoc(SourceLocation Loc)
Interfaces are the core concept in Objective-C for object oriented design.
ObjCIvarDecl - Represents an ObjC instance variable.
ObjCMethodDecl - Represents an instance or class method declaration.
bool hasBody() const override
Determine whether this method has a body.
Selector getSelector() const
bool isInstanceMethod() const
void setLazyBody(uint64_t Offset)
Wraps an ObjCPointerType with source location information.
void setStarLoc(SourceLocation Loc)
void setTypeArgsRAngleLoc(SourceLocation Loc)
unsigned getNumTypeArgs() const
unsigned getNumProtocols() const
void setTypeArgsLAngleLoc(SourceLocation Loc)
void setTypeArgTInfo(unsigned i, TypeSourceInfo *TInfo)
void setProtocolLAngleLoc(SourceLocation Loc)
void setProtocolRAngleLoc(SourceLocation Loc)
void setHasBaseTypeAsWritten(bool HasBaseType)
void setProtocolLoc(unsigned i, SourceLocation Loc)
Represents an Objective-C protocol declaration.
The basic abstraction for the target Objective-C runtime.
Kind
The basic Objective-C runtimes that we know about.
ProtocolLAngleLoc, ProtocolRAngleLoc, and the source locations for protocol qualifiers are stored aft...
unsigned getNumProtocols() const
void setProtocolLoc(unsigned i, SourceLocation Loc)
void setProtocolLAngleLoc(SourceLocation Loc)
void setProtocolRAngleLoc(SourceLocation Loc)
static OpenACCAsyncClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCAttachClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCAutoClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
This is the base type for all OpenACC Clauses.
static OpenACCCopyClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCopyInClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, bool IsReadOnly, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCopyOutClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, bool IsZero, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCreateClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, bool IsZero, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDefaultClause * Create(const ASTContext &C, OpenACCDefaultClauseKind K, SourceLocation BeginLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
static OpenACCDevicePtrClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDeviceTypeClause * Create(const ASTContext &C, OpenACCClauseKind K, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< DeviceTypeArgument > Archs, SourceLocation EndLoc)
static OpenACCFirstPrivateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCIfClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *ConditionExpr, SourceLocation EndLoc)
static OpenACCIndependentClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCNoCreateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCNumGangsClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > IntExprs, SourceLocation EndLoc)
static OpenACCNumWorkersClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCPresentClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCPrivateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCReductionClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, OpenACCReductionOperator Operator, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCSelfClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *ConditionExpr, SourceLocation EndLoc)
static OpenACCSeqClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCVectorLengthClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCWaitClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *DevNumExpr, SourceLocation QueuesLoc, ArrayRef< Expr * > QueueIdExprs, SourceLocation EndLoc)
This abstract interface provides operations for unwrapping containers for serialized ASTs (precompile...
virtual llvm::StringRef ExtractPCH(llvm::MemoryBufferRef Buffer) const =0
Returns the serialized AST inside the PCH container Buffer.
ASTReaderListener implementation to validate the information of the PCH file against an initialized P...
bool ReadLanguageOptions(const LangOptions &LangOpts, StringRef ModuleFilename, bool Complain, bool AllowCompatibleDifferences) override
Receives the language options.
bool ReadHeaderSearchOptions(const HeaderSearchOptions &HSOpts, StringRef ModuleFilename, StringRef SpecificModuleCachePath, bool Complain) override
Receives the header search options.
bool ReadDiagnosticOptions(IntrusiveRefCntPtr< DiagnosticOptions > DiagOpts, StringRef ModuleFilename, bool Complain) override
Receives the diagnostic options.
void ReadCounter(const serialization::ModuleFile &M, unsigned Value) override
Receives COUNTER value.
bool ReadPreprocessorOptions(const PreprocessorOptions &PPOpts, StringRef ModuleFilename, bool ReadMacros, bool Complain, std::string &SuggestedPredefines) override
Receives the preprocessor options.
bool ReadTargetOptions(const TargetOptions &TargetOpts, StringRef ModuleFilename, bool Complain, bool AllowCompatibleDifferences) override
Receives the target options.
void setEllipsisLoc(SourceLocation Loc)
void setEllipsisLoc(SourceLocation Loc)
void setRParenLoc(SourceLocation Loc)
void setLParenLoc(SourceLocation Loc)
Represents a parameter to a function.
void setKWLoc(SourceLocation Loc)
Wrapper for source info for pointers.
void setStarLoc(SourceLocation Loc)
Base class that describes a preprocessed entity, which may be a preprocessor directive or macro expan...
Iteration over the preprocessed entities.
A record of the steps taken while preprocessing a source file, including the various preprocessing di...
PreprocessorOptions - This class is used for passing the various options used in preprocessor initial...
std::vector< std::string > MacroIncludes
std::vector< std::string > Includes
ObjCXXARCStandardLibraryKind ObjCXXARCStandardLibrary
The Objective-C++ ARC standard library that we should support, by providing appropriate definitions t...
std::string PCHThroughHeader
If non-empty, the filename used in an #include directive in the primary source file (or command-line ...
bool DetailedRecord
Whether we should maintain a detailed record of all macro definitions and expansions.
std::string ImplicitPCHInclude
The implicit PCH included at the start of the translation unit, or empty.
bool AllowPCHWithDifferentModulesCachePath
When true, a PCH with modules cache path different to the current compilation will not be rejected.
bool UsePredefines
Initialize the preprocessor with the compiler and target specific predefines.
std::vector< std::pair< std::string, bool > > Macros
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
Module * getCurrentModule()
Retrieves the module that we're currently building, if any.
const TargetInfo & getTargetInfo() const
FileManager & getFileManager() const
PreprocessorOptions & getPreprocessorOpts() const
Retrieve the preprocessor options used to initialize this preprocessor.
HeaderSearch & getHeaderSearchInfo() const
IdentifierTable & getIdentifierTable()
const LangOptions & getLangOpts() const
void setCounterValue(unsigned V)
DiagnosticsEngine & getDiagnostics() const
A (possibly-)qualified type.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
Wrapper of type source information for a type with non-trivial direct qualifiers.
The collection of all-type qualifiers we support.
@ FastWidth
The width of the "fast" qualifier mask.
@ FastMask
The fast qualifier mask.
void setAmpAmpLoc(SourceLocation Loc)
Represents a struct/union/class.
Wrapper for source info for record types.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
This table allows us to fully hide how we implement multi-keyword caching.
Selector getNullarySelector(const IdentifierInfo *ID)
Selector getSelector(unsigned NumArgs, const IdentifierInfo **IIV)
Can create any sort of selector.
Selector getUnarySelector(const IdentifierInfo *ID)
Smart pointer class that efficiently represents Objective-C method names.
std::pair< iterator, bool > insert(std::pair< Selector, Lists > &&Val)
iterator find(Selector Sel)
llvm::DenseMap< Selector, Lists >::iterator iterator
std::pair< ObjCMethodList, ObjCMethodList > Lists
void addMethodToGlobalList(ObjCMethodList *List, ObjCMethodDecl *Method)
Add the given method to the list of globally-known methods.
GlobalMethodPool MethodPool
Method Pool - allows efficient lookup when typechecking messages to "id".
Sema - This implements semantic analysis and AST building for C.
Scope * TUScope
Translation Unit Scope - useful to Objective-C actions that need to lookup file scope declarations in...
void addExternalSource(ExternalSemaSource *E)
Registers an external source.
void warnStackExhausted(SourceLocation Loc)
Warn that the stack is nearly exhausted.
IdentifierResolver IdResolver
ASTReaderListenter implementation to set SuggestedPredefines of ASTReader which is required to use a ...
bool ReadPreprocessorOptions(const PreprocessorOptions &PPOpts, StringRef ModuleFilename, bool ReadMacros, bool Complain, std::string &SuggestedPredefines) override
Receives the preprocessor options.
This object establishes a SourceLocationSequence.
Serialized encoding of a sequence of SourceLocations.
Encodes a location in the source.
static SourceLocation getFromRawEncoding(UIntTy Encoding)
Turn a raw encoding of a SourceLocation object into a real SourceLocation.
bool isValid() const
Return true if this is a valid SourceLocation object.
SourceLocation getLocWithOffset(IntTy Offset) const
Return a source location with the specified offset from this SourceLocation.
This class handles loading and caching of source files into memory.
SourceLocation getFileLoc(SourceLocation Loc) const
Given Loc, if it is a macro location return the expansion location or the spelling location,...
void setExternalSLocEntrySource(ExternalSLocEntrySource *Source)
std::pair< FileID, unsigned > getDecomposedLoc(SourceLocation Loc) const
Decompose the specified location into a raw FileID + Offset pair.
bool isBeforeInTranslationUnit(SourceLocation LHS, SourceLocation RHS) const
Determines the order of 2 source locations in the translation unit.
A trivial tuple used to represent a source range.
SourceLocation getEnd() const
SourceLocation getBegin() const
One instance of this struct is kept for every file loaded or used.
OptionalFileEntryRef ContentsEntry
References the file which the contents were actually loaded from.
std::optional< llvm::MemoryBufferRef > getBufferIfLoaded() const
Return the buffer, only if it has been loaded.
unsigned BufferOverridden
Indicates whether the buffer itself was provided to override the actual file contents.
OptionalFileEntryRef OrigEntry
Reference to the file entry representing this ContentCache.
Information about a FileID, basically just the logical file that it represents and include stack info...
void setHasLineDirectives()
Set the flag that indicates that this FileID has line table entries associated with it.
Stmt - This represents one statement.
DiagnosticStorage * getStorage() const
Retrieve storage for this particular diagnostic.
Wrapper for substituted template type parameters.
Wrapper for substituted template type parameters.
Represents the declaration of a struct/union/class/enum.
bool isThisDeclarationADefinition() const
Return true if this declaration is a completion definition of the type.
TargetOptions & getTargetOpts() const
Retrieve the target options.
Options for controlling the target.
std::string Triple
The name of the target triple to compile for.
std::vector< std::string > Features
The list of target specific features to enable or disable – this should be a list of strings starting...
std::string ABI
If given, the name of the target ABI to use.
std::string TuneCPU
If given, the name of the target CPU to tune code for.
std::string CPU
If given, the name of the target CPU to generate code for.
std::vector< std::string > FeaturesAsWritten
The list of target specific features to enable or disable, as written on the command line.
A convenient class for passing around template argument information.
Location wrapper for a TemplateArgument.
Represents a template argument.
Expr * getAsExpr() const
Retrieve the template argument as an expression.
ArgKind
The kind of template argument we're storing.
@ Declaration
The template argument is a declaration that was provided for a pointer, reference,...
@ Template
The template argument is a template name that was provided for a template template parameter.
@ StructuralValue
The template argument is a non-type template argument that can't be represented by the special-case D...
@ Pack
The template argument is actually a parameter pack.
@ TemplateExpansion
The template argument is a pack expansion of a template name that was provided for a template templat...
@ NullPtr
The template argument is a null pointer or null pointer to member that was provided for a non-type te...
@ Type
The template argument is a type.
@ Null
Represents an empty template argument, e.g., one that has not been deduced.
@ Integral
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
@ Expression
The template argument is an expression, and we've not resolved it to one of the other forms yet,...
ArgKind getKind() const
Return the kind of stored template argument.
Stores a list of template parameters for a TemplateDecl and its derived classes.
static TemplateParameterList * Create(const ASTContext &C, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ArrayRef< NamedDecl * > Params, SourceLocation RAngleLoc, Expr *RequiresClause)
unsigned getNumArgs() const
void setArgLocInfo(unsigned i, TemplateArgumentLocInfo AI)
void setTemplateKeywordLoc(SourceLocation Loc)
void setTemplateNameLoc(SourceLocation Loc)
void setLAngleLoc(SourceLocation Loc)
void setRAngleLoc(SourceLocation Loc)
ArrayRef< TemplateArgument > template_arguments() const
Wrapper for template type parameters.
Token - This structure provides full information about a lexed token.
void setAnnotationEndLoc(SourceLocation L)
void setLength(unsigned Len)
void setKind(tok::TokenKind K)
tok::TokenKind getKind() const
void setLocation(SourceLocation L)
bool isAnnotation() const
Return true if this is any of tok::annot_* kind tokens.
void setAnnotationValue(void *val)
void startToken()
Reset all flags to cleared.
void setIdentifierInfo(IdentifierInfo *II)
void setFlag(TokenFlags Flag)
Set the specified flag.
[BoundsSafety] Represents information of declarations referenced by the arguments of the counted_by a...
void VisitArrayTypeLoc(ArrayTypeLoc)
void VisitFunctionTypeLoc(FunctionTypeLoc)
TypeLocReader(ASTRecordReader &Reader, LocSeq *Seq)
RetTy Visit(TypeLoc TyLoc)
Base wrapper for a particular "section" of type source info.
TypeLoc getNextTypeLoc() const
Get the next TypeLoc pointed by this TypeLoc, e.g for "int*" the TypeLoc is a PointerLoc and next Typ...
void setUnmodifiedTInfo(TypeSourceInfo *TI) const
A container of type source information.
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
void setNameLoc(SourceLocation Loc)
The base class of the type hierarchy.
const T * getAs() const
Member-template getAs<specific type>'.
Base class for declarations which introduce a typedef-name.
Wrapper for source info for typedefs.
void setLParenLoc(SourceLocation Loc)
void setTypeofLoc(SourceLocation Loc)
void setRParenLoc(SourceLocation Loc)
Wrapper for source info for unresolved typename using decls.
Wrapper for source info for types used via transparent aliases.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Represents a variable declaration or definition.
void setNameLoc(SourceLocation Loc)
Captures information about a #pragma weak directive.
Source location and bit offset of a declaration.
A key used when looking up entities by DeclarationName.
unsigned getHash() const
Compute a fingerprint of this key for use in on-disk hash table.
DeclarationNameKey()=default
Information about a module that has been loaded by the ASTReader.
const PPEntityOffset * PreprocessedEntityOffsets
void * IdentifierLookupTable
A pointer to an on-disk hash table of opaque type IdentifierHashTable.
void * SelectorLookupTable
A pointer to an on-disk hash table of opaque type ASTSelectorLookupTable.
std::vector< std::unique_ptr< ModuleFileExtensionReader > > ExtensionReaders
The list of extension readers that are attached to this module file.
SourceLocation DirectImportLoc
The source location where the module was explicitly or implicitly imported in the local translation u...
StringRef Data
The serialized bitstream data for this file.
const serialization::ObjCCategoriesInfo * ObjCCategoriesMap
Array of category list location information within this module file, sorted by the definition ID.
ContinuousRangeMap< uint32_t, int, 2 > PreprocessedEntityRemap
Remapping table for preprocessed entity IDs in this module.
int SLocEntryBaseID
The base ID in the source manager's view of this module.
serialization::IdentifierID BaseIdentifierID
Base identifier ID for identifiers local to this module.
serialization::PreprocessedEntityID BasePreprocessedEntityID
Base preprocessed entity ID for preprocessed entities local to this module.
serialization::TypeID BaseTypeIndex
Base type ID for types local to this module as represented in the global type ID space.
unsigned LocalNumObjCCategoriesInMap
The number of redeclaration info entries in ObjCCategoriesMap.
uint64_t MacroOffsetsBase
Base file offset for the offsets in MacroOffsets.
const llvm::support::unaligned_uint64_t * InputFileOffsets
Relative offsets for all of the input file entries in the AST file.
std::vector< unsigned > PreloadIdentifierOffsets
Offsets of identifiers that we're going to preload within IdentifierTableData.
unsigned LocalNumIdentifiers
The number of identifiers in this AST file.
llvm::BitstreamCursor DeclsCursor
DeclsCursor - This is a cursor to the start of the DECLTYPES_BLOCK block.
const unsigned char * IdentifierTableData
Actual data for the on-disk hash table of identifiers.
uint64_t SLocEntryOffsetsBase
Base file offset for the offsets in SLocEntryOffsets.
llvm::BitstreamCursor InputFilesCursor
The cursor to the start of the input-files block.
std::vector< InputFile > InputFilesLoaded
The input files that have been loaded from this AST file.
serialization::SelectorID BaseSelectorID
Base selector ID for selectors local to this module.
llvm::SetVector< ModuleFile * > ImportedBy
List of modules which depend on this module.
const char * HeaderFileInfoTableData
Actual data for the on-disk hash table of header file information.
SourceLocation ImportLoc
The source location where this module was first imported.
const serialization::unaligned_decl_id_t * FileSortedDecls
Array of file-level DeclIDs sorted by file.
const uint32_t * SLocEntryOffsets
Offsets for all of the source location entries in the AST file.
llvm::BitstreamCursor MacroCursor
The cursor to the start of the preprocessor block, which stores all of the macro definitions.
FileID OriginalSourceFileID
The file ID for the original source file that was used to build this AST file.
FileEntryRef File
The file entry for the module file.
std::string ActualOriginalSourceFileName
The actual original source file name that was used to build this AST file.
uint64_t PreprocessorDetailStartOffset
The offset of the start of the preprocessor detail cursor.
std::vector< InputFileInfo > InputFileInfosLoaded
The input file infos that have been loaded from this AST file.
unsigned LocalNumSubmodules
The number of submodules in this module.
SourceLocation FirstLoc
The first source location in this module.
ASTFileSignature ASTBlockHash
The signature of the AST block of the module file, this can be used to unique module files based on A...
uint64_t SourceManagerBlockStartOffset
The bit offset to the start of the SOURCE_MANAGER_BLOCK.
bool DidReadTopLevelSubmodule
Whether the top-level module has been read from the AST file.
std::string OriginalSourceFileName
The original source file name that was used to build the primary AST file, which may have been modifi...
bool isModule() const
Is this a module file for a module (rather than a PCH or similar).
bool HasTimestamps
Whether timestamps are included in this module file.
uint64_t InputFilesOffsetBase
Absolute offset of the start of the input-files block.
llvm::BitstreamCursor SLocEntryCursor
Cursor used to read source location entries.
unsigned NumPreprocessedEntities
bool RelocatablePCH
Whether this precompiled header is a relocatable PCH file.
const uint32_t * SelectorOffsets
Offsets into the selector lookup table's data array where each selector resides.
unsigned BaseDeclIndex
Base declaration index in ASTReader for declarations local to this module.
unsigned NumFileSortedDecls
unsigned LocalNumSLocEntries
The number of source location entries in this AST file.
void * HeaderFileInfoTable
The on-disk hash table that contains information about each of the header files.
unsigned Index
The index of this module in the list of modules.
unsigned NumUserInputFiles
llvm::BitstreamCursor Stream
The main bitstream cursor for the main block.
serialization::SubmoduleID BaseSubmoduleID
Base submodule ID for submodules local to this module.
uint64_t SizeInBits
The size of this file, in bits.
const UnalignedUInt64 * TypeOffsets
Offset of each type within the bitstream, indexed by the type ID, or the representation of a Type*.
uint64_t GlobalBitOffset
The global bit offset (or base) of this module.
bool StandardCXXModule
Whether this module file is a standard C++ module.
unsigned LocalNumTypes
The number of types in this AST file.
StringRef ModuleOffsetMap
The module offset map data for this file.
const PPSkippedRange * PreprocessedSkippedRangeOffsets
std::string FileName
The file name of the module file.
uint64_t InputFilesValidationTimestamp
If non-zero, specifies the time when we last validated input files.
llvm::BitstreamCursor PreprocessorDetailCursor
The cursor to the start of the (optional) detailed preprocessing record block.
SourceLocation::UIntTy SLocEntryBaseOffset
The base offset in the source manager's view of this module.
std::string ModuleMapPath
const DeclOffset * DeclOffsets
Offset of each declaration within the bitstream, indexed by the declaration ID (-1).
std::string getTimestampFilename() const
uint64_t MacroStartOffset
The offset of the start of the set of defined macros.
ASTFileSignature Signature
The signature of the module file, which may be used instead of the size and modification time to iden...
unsigned LocalNumMacros
The number of macros in this AST file.
unsigned NumPreprocessedSkippedRanges
const unsigned char * SelectorLookupTableData
A pointer to the character data that comprises the selector table.
void dump()
Dump debugging output for this module.
unsigned LocalNumDecls
The number of declarations in this AST file.
unsigned LocalNumHeaderFileInfos
The number of local HeaderFileInfo structures.
llvm::BitVector SearchPathUsage
The bit vector denoting usage of each header search entry (true = used).
unsigned Generation
The generation of which this module file is a part.
const uint32_t * IdentifierOffsets
Offsets into the identifier table data.
ContinuousRangeMap< uint32_t, int, 2 > SelectorRemap
Remapping table for selector IDs in this module.
ContinuousRangeMap< uint32_t, int, 2 > MacroRemap
Remapping table for macro IDs in this module.
const uint32_t * MacroOffsets
Offsets of macros in the preprocessor block.
uint64_t ASTBlockStartOffset
The bit offset of the AST block of this module.
ContinuousRangeMap< uint32_t, int, 2 > SubmoduleRemap
Remapping table for submodule IDs in this module.
llvm::BitVector VFSUsage
The bit vector denoting usage of each VFS entry (true = used).
uint64_t DeclsBlockStartOffset
The offset to the start of the DECLTYPES_BLOCK block.
SmallVector< uint64_t, 8 > PragmaDiagMappings
Diagnostic IDs and their mappings that the user changed.
unsigned BasePreprocessedSkippedRangeID
Base ID for preprocessed skipped ranges local to this module.
unsigned LocalNumSelectors
The number of selectors new to this file.
ModuleKind Kind
The type of this module.
std::string ModuleName
The name of the module.
serialization::MacroID BaseMacroID
Base macro ID for macros local to this module.
SmallVector< uint64_t, 1 > ObjCCategories
The Objective-C category lists for categories known to this module.
std::string BaseDirectory
The base directory of the module.
llvm::SmallVector< ModuleFile *, 16 > TransitiveImports
List of modules which this modules dependent on.
Manages the set of modules loaded by an AST reader.
ModuleFile & getPrimaryModule()
Returns the primary module associated with the manager, that is, the first module loaded.
AddModuleResult
The result of attempting to add a new module.
@ Missing
The module file is missing.
@ OutOfDate
The module file is out-of-date.
@ NewlyLoaded
The module file was just loaded in response to this call.
@ AlreadyLoaded
The module file had already been loaded.
llvm::iterator_range< SmallVectorImpl< ModuleFile * >::const_iterator > pch_modules() const
A range covering the PCH and preamble module files loaded.
ModuleReverseIterator rbegin()
Reverse iterator to traverse all loaded modules.
void visit(llvm::function_ref< bool(ModuleFile &M)> Visitor, llvm::SmallPtrSetImpl< ModuleFile * > *ModuleFilesHit=nullptr)
Visit each of the modules.
unsigned size() const
Number of modules loaded.
Source range/offset of a preprocessed entity.
uint32_t getOffset() const
RawLocEncoding getBegin() const
RawLocEncoding getEnd() const
Source range of a skipped preprocessor region.
RawLocEncoding getBegin() const
RawLocEncoding getEnd() const
unsigned getFactoryBits() const
ReadMethodPoolVisitor(ASTReader &Reader, Selector Sel, unsigned PriorGeneration)
ArrayRef< ObjCMethodDecl * > getInstanceMethods() const
Retrieve the instance methods found by this visitor.
ArrayRef< ObjCMethodDecl * > getFactoryMethods() const
Retrieve the instance methods found by this visitor.
bool instanceHasMoreThanOneDecl() const
bool operator()(ModuleFile &M)
bool factoryHasMoreThanOneDecl() const
unsigned getInstanceBits() const
static TypeIdx fromTypeID(TypeID ID)
32 aligned uint64_t in the AST file.
static std::pair< unsigned, unsigned > ReadKeyDataLength(const unsigned char *&d)
static hash_value_type ComputeHash(const internal_key_type &a)
StringRef internal_key_type
static internal_key_type ReadKey(const unsigned char *d, unsigned n)
Class that performs lookup for an identifier stored in an AST file.
IdentifierID ReadIdentifierID(const unsigned char *d)
data_type ReadData(const internal_key_type &k, const unsigned char *d, unsigned DataLen)
Class that performs lookup for a selector's entries in the global method pool stored in an AST file.
internal_key_type ReadKey(const unsigned char *d, unsigned)
data_type ReadData(Selector, const unsigned char *d, unsigned DataLen)
static std::pair< unsigned, unsigned > ReadKeyDataLength(const unsigned char *&d)
static hash_value_type ComputeHash(Selector Sel)
PredefinedTypeIDs
Predefined type IDs.
CtorInitializerType
The different kinds of data that can occur in a CtorInitializer.
const unsigned NUM_PREDEF_TYPE_IDS
The number of predefined type IDs that are reserved for the PREDEF_TYPE_* constants.
const unsigned NumSpecialTypeIDs
The number of special type IDs.
TypeCode
Record codes for each kind of type.
@ PREDEF_TYPE_LONG_ACCUM_ID
The 'long _Accum' type.
@ PREDEF_TYPE_SAMPLER_ID
OpenCL sampler type.
@ PREDEF_TYPE_INT128_ID
The '__int128_t' type.
@ PREDEF_TYPE_CHAR32_ID
The C++ 'char32_t' type.
@ PREDEF_TYPE_SAT_SHORT_ACCUM_ID
The '_Sat short _Accum' type.
@ PREDEF_TYPE_IBM128_ID
The '__ibm128' type.
@ PREDEF_TYPE_SHORT_FRACT_ID
The 'short _Fract' type.
@ PREDEF_TYPE_AUTO_RREF_DEDUCT
The "auto &&" deduction type.
@ PREDEF_TYPE_BOUND_MEMBER
The placeholder type for bound member functions.
@ PREDEF_TYPE_LONGLONG_ID
The (signed) 'long long' type.
@ PREDEF_TYPE_FRACT_ID
The '_Fract' type.
@ PREDEF_TYPE_ARC_UNBRIDGED_CAST
ARC's unbridged-cast placeholder type.
@ PREDEF_TYPE_USHORT_FRACT_ID
The 'unsigned short _Fract' type.
@ PREDEF_TYPE_SAT_ULONG_FRACT_ID
The '_Sat unsigned long _Fract' type.
@ PREDEF_TYPE_BOOL_ID
The 'bool' or '_Bool' type.
@ PREDEF_TYPE_SAT_LONG_ACCUM_ID
The '_Sat long _Accum' type.
@ PREDEF_TYPE_SAT_LONG_FRACT_ID
The '_Sat long _Fract' type.
@ PREDEF_TYPE_SAT_SHORT_FRACT_ID
The '_Sat short _Fract' type.
@ PREDEF_TYPE_CHAR_U_ID
The 'char' type, when it is unsigned.
@ PREDEF_TYPE_RESERVE_ID_ID
OpenCL reserve_id type.
@ PREDEF_TYPE_SAT_ACCUM_ID
The '_Sat _Accum' type.
@ PREDEF_TYPE_BUILTIN_FN
The placeholder type for builtin functions.
@ PREDEF_TYPE_SHORT_ACCUM_ID
The 'short _Accum' type.
@ PREDEF_TYPE_FLOAT_ID
The 'float' type.
@ PREDEF_TYPE_QUEUE_ID
OpenCL queue type.
@ PREDEF_TYPE_INT_ID
The (signed) 'int' type.
@ PREDEF_TYPE_OBJC_SEL
The ObjC 'SEL' type.
@ PREDEF_TYPE_BFLOAT16_ID
The '__bf16' type.
@ PREDEF_TYPE_WCHAR_ID
The C++ 'wchar_t' type.
@ PREDEF_TYPE_UCHAR_ID
The 'unsigned char' type.
@ PREDEF_TYPE_UACCUM_ID
The 'unsigned _Accum' type.
@ PREDEF_TYPE_SCHAR_ID
The 'signed char' type.
@ PREDEF_TYPE_CHAR_S_ID
The 'char' type, when it is signed.
@ PREDEF_TYPE_NULLPTR_ID
The type of 'nullptr'.
@ PREDEF_TYPE_ULONG_FRACT_ID
The 'unsigned long _Fract' type.
@ PREDEF_TYPE_FLOAT16_ID
The '_Float16' type.
@ PREDEF_TYPE_UINT_ID
The 'unsigned int' type.
@ PREDEF_TYPE_FLOAT128_ID
The '__float128' type.
@ PREDEF_TYPE_OBJC_ID
The ObjC 'id' type.
@ PREDEF_TYPE_CHAR16_ID
The C++ 'char16_t' type.
@ PREDEF_TYPE_ARRAY_SECTION
The placeholder type for an array section.
@ PREDEF_TYPE_ULONGLONG_ID
The 'unsigned long long' type.
@ PREDEF_TYPE_SAT_UFRACT_ID
The '_Sat unsigned _Fract' type.
@ PREDEF_TYPE_USHORT_ID
The 'unsigned short' type.
@ PREDEF_TYPE_SHORT_ID
The (signed) 'short' type.
@ PREDEF_TYPE_OMP_ARRAY_SHAPING
The placeholder type for OpenMP array shaping operation.
@ PREDEF_TYPE_DEPENDENT_ID
The placeholder type for dependent types.
@ PREDEF_TYPE_LONGDOUBLE_ID
The 'long double' type.
@ PREDEF_TYPE_DOUBLE_ID
The 'double' type.
@ PREDEF_TYPE_UINT128_ID
The '__uint128_t' type.
@ PREDEF_TYPE_HALF_ID
The OpenCL 'half' / ARM NEON __fp16 type.
@ PREDEF_TYPE_VOID_ID
The void type.
@ PREDEF_TYPE_SAT_USHORT_FRACT_ID
The '_Sat unsigned short _Fract' type.
@ PREDEF_TYPE_ACCUM_ID
The '_Accum' type.
@ PREDEF_TYPE_SAT_FRACT_ID
The '_Sat _Fract' type.
@ PREDEF_TYPE_NULL_ID
The NULL type.
@ PREDEF_TYPE_USHORT_ACCUM_ID
The 'unsigned short _Accum' type.
@ PREDEF_TYPE_CHAR8_ID
The C++ 'char8_t' type.
@ PREDEF_TYPE_UFRACT_ID
The 'unsigned _Fract' type.
@ PREDEF_TYPE_OVERLOAD_ID
The placeholder type for overloaded function sets.
@ PREDEF_TYPE_INCOMPLETE_MATRIX_IDX
A placeholder type for incomplete matrix index operations.
@ PREDEF_TYPE_UNRESOLVED_TEMPLATE
The placeholder type for unresolved templates.
@ PREDEF_TYPE_SAT_USHORT_ACCUM_ID
The '_Sat unsigned short _Accum' type.
@ PREDEF_TYPE_LONG_ID
The (signed) 'long' type.
@ PREDEF_TYPE_SAT_ULONG_ACCUM_ID
The '_Sat unsigned long _Accum' type.
@ PREDEF_TYPE_LONG_FRACT_ID
The 'long _Fract' type.
@ PREDEF_TYPE_UNKNOWN_ANY
The 'unknown any' placeholder type.
@ PREDEF_TYPE_OMP_ITERATOR
The placeholder type for OpenMP iterator expression.
@ PREDEF_TYPE_PSEUDO_OBJECT
The pseudo-object placeholder type.
@ PREDEF_TYPE_OBJC_CLASS
The ObjC 'Class' type.
@ PREDEF_TYPE_ULONG_ID
The 'unsigned long' type.
@ PREDEF_TYPE_SAT_UACCUM_ID
The '_Sat unsigned _Accum' type.
@ PREDEF_TYPE_CLK_EVENT_ID
OpenCL clk event type.
@ PREDEF_TYPE_EVENT_ID
OpenCL event type.
@ PREDEF_TYPE_ULONG_ACCUM_ID
The 'unsigned long _Accum' type.
@ PREDEF_TYPE_AUTO_DEDUCT
The "auto" deduction type.
@ CTOR_INITIALIZER_MEMBER
@ CTOR_INITIALIZER_DELEGATING
@ CTOR_INITIALIZER_INDIRECT_MEMBER
@ DECL_CXX_BASE_SPECIFIERS
A record containing CXXBaseSpecifiers.
@ DECL_CONTEXT_LEXICAL
A record that stores the set of declarations that are lexically stored within a given DeclContext.
@ DECL_CXX_CTOR_INITIALIZERS
A record containing CXXCtorInitializers.
@ DECL_CONTEXT_VISIBLE
A record that stores the set of declarations that are visible from a given DeclContext.
@ TYPE_EXT_QUAL
An ExtQualType record.
@ SPECIAL_TYPE_OBJC_SEL_REDEFINITION
Objective-C "SEL" redefinition type.
@ SPECIAL_TYPE_UCONTEXT_T
C ucontext_t typedef type.
@ SPECIAL_TYPE_JMP_BUF
C jmp_buf typedef type.
@ SPECIAL_TYPE_FILE
C FILE typedef type.
@ SPECIAL_TYPE_SIGJMP_BUF
C sigjmp_buf typedef type.
@ SPECIAL_TYPE_OBJC_CLASS_REDEFINITION
Objective-C "Class" redefinition type.
@ SPECIAL_TYPE_CF_CONSTANT_STRING
CFConstantString type.
@ SPECIAL_TYPE_OBJC_ID_REDEFINITION
Objective-C "id" redefinition type.
Defines the clang::TargetInfo interface.
CharacteristicKind
Indicates whether a file or directory holds normal user code, system code, or system code which is im...
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
Severity
Enum values that allow the client to map NOTEs, WARNINGs, and EXTENSIONs to either Ignore (nothing),...
@ Warning
Present this diagnostic as a warning.
@ Error
Present this diagnostic as an error.
IncludeDirGroup
IncludeDirGroup - Identifies the group an include Entry belongs to, representing its relative positiv...
llvm::OnDiskChainedHashTable< HeaderFileInfoTrait > HeaderFileInfoLookupTable
The on-disk hash table used for known header files.
llvm::OnDiskIterableChainedHashTable< ASTIdentifierLookupTrait > ASTIdentifierLookupTable
The on-disk hash table used to contain information about all of the identifiers in the program.
llvm::OnDiskChainedHashTable< ASTSelectorLookupTrait > ASTSelectorLookupTable
The on-disk hash table used for the global method pool.
uint64_t TypeID
An ID number that refers to a type in an AST file.
@ EXTENSION_METADATA
Metadata describing this particular extension.
llvm::support::detail::packed_endian_specific_integral< serialization::DeclID, llvm::endianness::native, llvm::support::unaligned > unaligned_decl_id_t
@ SUBMODULE_EXCLUDED_HEADER
Specifies a header that has been explicitly excluded from this submodule.
@ SUBMODULE_TOPHEADER
Specifies a top-level header that falls into this (sub)module.
@ SUBMODULE_PRIVATE_TEXTUAL_HEADER
Specifies a header that is private to this submodule but must be textually included.
@ SUBMODULE_HEADER
Specifies a header that falls into this (sub)module.
@ SUBMODULE_EXPORT_AS
Specifies the name of the module that will eventually re-export the entities in this module.
@ SUBMODULE_UMBRELLA_DIR
Specifies an umbrella directory.
@ SUBMODULE_UMBRELLA_HEADER
Specifies the umbrella header used to create this module, if any.
@ SUBMODULE_METADATA
Metadata for submodules as a whole.
@ SUBMODULE_REQUIRES
Specifies a required feature.
@ SUBMODULE_PRIVATE_HEADER
Specifies a header that is private to this submodule.
@ SUBMODULE_IMPORTS
Specifies the submodules that are imported by this submodule.
@ SUBMODULE_CONFLICT
Specifies a conflict with another module.
@ SUBMODULE_INITIALIZERS
Specifies some declarations with initializers that must be emitted to initialize the module.
@ SUBMODULE_DEFINITION
Defines the major attributes of a submodule, including its name and parent.
@ SUBMODULE_LINK_LIBRARY
Specifies a library or framework to link against.
@ SUBMODULE_CONFIG_MACRO
Specifies a configuration macro for this module.
@ SUBMODULE_EXPORTS
Specifies the submodules that are re-exported from this submodule.
@ SUBMODULE_TEXTUAL_HEADER
Specifies a header that is part of the module but must be textually included.
@ SUBMODULE_AFFECTING_MODULES
Specifies affecting modules that were not imported.
TypeID LocalTypeID
Same with TypeID except that the LocalTypeID is only meaningful with the corresponding ModuleFile.
const unsigned int NUM_PREDEF_IDENT_IDS
The number of predefined identifier IDs.
uint32_t SubmoduleID
An ID number that refers to a submodule in a module file.
OptionsRecordTypes
Record types that occur within the options block inside the control block.
@ FILE_SYSTEM_OPTIONS
Record code for the filesystem options table.
@ TARGET_OPTIONS
Record code for the target options table.
@ PREPROCESSOR_OPTIONS
Record code for the preprocessor options table.
@ HEADER_SEARCH_OPTIONS
Record code for the headers search options table.
@ LANGUAGE_OPTIONS
Record code for the language options table.
uint32_t SelectorID
An ID number that refers to an ObjC selector in an AST file.
const unsigned int NUM_PREDEF_PP_ENTITY_IDS
The number of predefined preprocessed entity IDs.
uint32_t PreprocessedEntityID
An ID number that refers to an entity in the detailed preprocessing record.
const unsigned int NUM_PREDEF_SUBMODULE_IDS
The number of predefined submodule IDs.
@ SUBMODULE_BLOCK_ID
The block containing the submodule structure.
@ PREPROCESSOR_DETAIL_BLOCK_ID
The block containing the detailed preprocessing record.
@ AST_BLOCK_ID
The AST block, which acts as a container around the full AST block.
@ SOURCE_MANAGER_BLOCK_ID
The block containing information about the source manager.
@ CONTROL_BLOCK_ID
The control block, which contains all of the information that needs to be validated prior to committi...
@ DECLTYPES_BLOCK_ID
The block containing the definitions of all of the types and decls used within the AST file.
@ PREPROCESSOR_BLOCK_ID
The block containing information about the preprocessor.
@ COMMENTS_BLOCK_ID
The block containing comments.
@ UNHASHED_CONTROL_BLOCK_ID
A block with unhashed content.
@ EXTENSION_BLOCK_ID
A block containing a module file extension.
@ OPTIONS_BLOCK_ID
The block of configuration options, used to check that a module is being used in a configuration comp...
@ INPUT_FILES_BLOCK_ID
The block of input files, which were used as inputs to create this AST file.
CommentRecordTypes
Record types used within a comments block.
@ SM_SLOC_FILE_ENTRY
Describes a source location entry (SLocEntry) for a file.
@ SM_SLOC_BUFFER_BLOB_COMPRESSED
Describes a zlib-compressed blob that contains the data for a buffer entry.
@ SM_SLOC_BUFFER_ENTRY
Describes a source location entry (SLocEntry) for a buffer.
@ SM_SLOC_BUFFER_BLOB
Describes a blob that contains the data for a buffer entry.
@ SM_SLOC_EXPANSION_ENTRY
Describes a source location entry (SLocEntry) for a macro expansion.
const unsigned int NUM_PREDEF_SELECTOR_IDS
The number of predefined selector IDs.
bool needsAnonymousDeclarationNumber(const NamedDecl *D)
Determine whether the given declaration needs an anonymous declaration number.
const unsigned VERSION_MAJOR
AST file major version number supported by this version of Clang.
DeclIDBase::DeclID DeclID
An ID number that refers to a declaration in an AST file.
PreprocessorRecordTypes
Record types used within a preprocessor block.
@ PP_TOKEN
Describes one token.
@ PP_MACRO_FUNCTION_LIKE
A function-like macro definition.
@ PP_MACRO_OBJECT_LIKE
An object-like macro definition.
@ PP_MACRO_DIRECTIVE_HISTORY
The macro directives history for a particular identifier.
@ PP_MODULE_MACRO
A macro directive exported by a module.
ControlRecordTypes
Record types that occur within the control block.
@ MODULE_MAP_FILE
Record code for the module map file that was used to build this AST file.
@ MODULE_DIRECTORY
Record code for the module build directory.
@ IMPORTS
Record code for the list of other AST files imported by this AST file.
@ ORIGINAL_FILE_ID
Record code for file ID of the file or buffer that was used to generate the AST file.
@ MODULE_NAME
Record code for the module name.
@ ORIGINAL_FILE
Record code for the original file that was used to generate the AST file, including both its file ID ...
@ INPUT_FILE_OFFSETS
Offsets into the input-files block where input files reside.
@ METADATA
AST file metadata, including the AST file version number and information about the compiler used to b...
UnhashedControlBlockRecordTypes
Record codes for the unhashed control block.
@ DIAGNOSTIC_OPTIONS
Record code for the diagnostic options table.
@ HEADER_SEARCH_ENTRY_USAGE
Record code for the indices of used header search entries.
@ AST_BLOCK_HASH
Record code for the content hash of the AST block.
@ DIAG_PRAGMA_MAPPINGS
Record code for #pragma diagnostic mappings.
@ SIGNATURE
Record code for the signature that identifiers this AST file.
@ HEADER_SEARCH_PATHS
Record code for the headers search paths.
@ VFS_USAGE
Record code for the indices of used VFSs.
InputFileRecordTypes
Record types that occur within the input-files block inside the control block.
@ INPUT_FILE_HASH
The input file content hash.
@ INPUT_FILE
An input file.
PreprocessorDetailRecordTypes
Record types used within a preprocessor detail block.
@ PPD_INCLUSION_DIRECTIVE
Describes an inclusion directive within the preprocessing record.
@ PPD_MACRO_EXPANSION
Describes a macro expansion within the preprocessing record.
@ PPD_MACRO_DEFINITION
Describes a macro definition within the preprocessing record.
ModuleKind
Specifies the kind of module that has been loaded.
@ MK_PCH
File is a PCH file treated as such.
@ MK_Preamble
File is a PCH file treated as the preamble.
@ MK_MainFile
File is a PCH file treated as the actual main file.
@ MK_ExplicitModule
File is an explicitly-loaded module.
@ MK_ImplicitModule
File is an implicitly-loaded module.
@ MK_PrebuiltModule
File is from a prebuilt module path.
uint64_t IdentifierID
An ID number that refers to an identifier in an AST file.
const unsigned int NUM_PREDEF_MACRO_IDS
The number of predefined macro IDs.
ASTRecordTypes
Record types that occur within the AST block itself.
@ DECL_UPDATE_OFFSETS
Record for offsets of DECL_UPDATES records for declarations that were modified after being deserializ...
@ STATISTICS
Record code for the extra statistics we gather while generating an AST file.
@ FLOAT_CONTROL_PRAGMA_OPTIONS
Record code for #pragma float_control options.
@ KNOWN_NAMESPACES
Record code for the set of known namespaces, which are used for typo correction.
@ SPECIAL_TYPES
Record code for the set of non-builtin, special types.
@ PENDING_IMPLICIT_INSTANTIATIONS
Record code for pending implicit instantiations.
@ TYPE_OFFSET
Record code for the offsets of each type.
@ DELEGATING_CTORS
The list of delegating constructor declarations.
@ PP_ASSUME_NONNULL_LOC
ID 66 used to be the list of included files.
@ EXT_VECTOR_DECLS
Record code for the set of ext_vector type names.
@ OPENCL_EXTENSIONS
Record code for enabled OpenCL extensions.
@ FP_PRAGMA_OPTIONS
Record code for floating point #pragma options.
@ PP_UNSAFE_BUFFER_USAGE
Record code for #pragma clang unsafe_buffer_usage begin/end.
@ VTABLE_USES
Record code for the array of VTable uses.
@ LATE_PARSED_TEMPLATE
Record code for late parsed template functions.
@ DECLS_TO_CHECK_FOR_DEFERRED_DIAGS
Record code for the Decls to be checked for deferred diags.
@ DECL_OFFSET
Record code for the offsets of each decl.
@ SOURCE_MANAGER_LINE_TABLE
Record code for the source manager line table information, which stores information about #line direc...
@ PP_COUNTER_VALUE
The value of the next COUNTER to dispense.
@ DELETE_EXPRS_TO_ANALYZE
Delete expressions that will be analyzed later.
@ UPDATE_VISIBLE
Record code for an update to a decl context's lookup table.
@ CUDA_PRAGMA_FORCE_HOST_DEVICE_DEPTH
Number of unmatched #pragma clang cuda_force_host_device begin directives we've seen.
@ MACRO_OFFSET
Record code for the table of offsets of each macro ID.
@ PPD_ENTITIES_OFFSETS
Record code for the table of offsets to entries in the preprocessing record.
@ VTABLES_TO_EMIT
Record code for vtables to emit.
@ IDENTIFIER_OFFSET
Record code for the table of offsets of each identifier ID.
@ OBJC_CATEGORIES
Record code for the array of Objective-C categories (including extensions).
@ METHOD_POOL
Record code for the Objective-C method pool,.
@ DELAYED_NAMESPACE_LEXICAL_VISIBLE_RECORD
Record code for lexical and visible block for delayed namespace in reduced BMI.
@ PP_CONDITIONAL_STACK
The stack of open #ifs/#ifdefs recorded in a preamble.
@ REFERENCED_SELECTOR_POOL
Record code for referenced selector pool.
@ SOURCE_LOCATION_OFFSETS
Record code for the table of offsets into the block of source-location information.
@ WEAK_UNDECLARED_IDENTIFIERS
Record code for weak undeclared identifiers.
@ UNDEFINED_BUT_USED
Record code for undefined but used functions and variables that need a definition in this TU.
@ FILE_SORTED_DECLS
Record code for a file sorted array of DeclIDs in a module.
@ MSSTRUCT_PRAGMA_OPTIONS
Record code for #pragma ms_struct options.
@ TENTATIVE_DEFINITIONS
Record code for the array of tentative definitions.
@ UNUSED_FILESCOPED_DECLS
Record code for the array of unused file scoped decls.
@ ALIGN_PACK_PRAGMA_OPTIONS
Record code for #pragma align/pack options.
@ IMPORTED_MODULES
Record code for an array of all of the (sub)modules that were imported by the AST file.
@ SELECTOR_OFFSETS
Record code for the table of offsets into the Objective-C method pool.
@ UNUSED_LOCAL_TYPEDEF_NAME_CANDIDATES
Record code for potentially unused local typedef names.
@ EAGERLY_DESERIALIZED_DECLS
Record code for the array of eagerly deserialized decls.
@ INTERESTING_IDENTIFIERS
A list of "interesting" identifiers.
@ HEADER_SEARCH_TABLE
Record code for header search information.
@ OBJC_CATEGORIES_MAP
Record code for map of Objective-C class definition IDs to the ObjC categories in a module that are a...
@ CUDA_SPECIAL_DECL_REFS
Record code for special CUDA declarations.
@ TU_UPDATE_LEXICAL
Record code for an update to the TU's lexically contained declarations.
@ PPD_SKIPPED_RANGES
A table of skipped ranges within the preprocessing record.
@ IDENTIFIER_TABLE
Record code for the identifier table.
@ SEMA_DECL_REFS
Record code for declarations that Sema keeps references of.
@ OPTIMIZE_PRAGMA_OPTIONS
Record code for #pragma optimize options.
@ MODULE_OFFSET_MAP
Record code for the remapping information used to relate loaded modules to the various offsets and ID...
@ POINTERS_TO_MEMBERS_PRAGMA_OPTIONS
Record code for #pragma ms_struct options.
uint32_t MacroID
An ID number that refers to a macro in an AST file.
unsigned ComputeHash(Selector Sel)
TokenKind
Provides a simple uniform namespace for tokens from all C languages.
The JSON file list parser is used to communicate input to InstallAPI.
OpenACCClauseKind
Represents the kind of an OpenACC clause.
@ Auto
'auto' clause, allowed on 'loop' directives.
@ Bind
'bind' clause, allowed on routine constructs.
@ Gang
'gang' clause, allowed on 'loop' and Combined constructs.
@ Wait
'wait' clause, allowed on Compute, Data, 'update', and Combined constructs.
@ DevicePtr
'deviceptr' clause, allowed on Compute and Combined Constructs, plus 'data' and 'declare'.
@ PCopyOut
'copyout' clause alias 'pcopyout'. Preserved for diagnostic purposes.
@ VectorLength
'vector_length' clause, allowed on 'parallel', 'kernels', 'parallel loop', and 'kernels loop' constru...
@ Async
'async' clause, allowed on Compute, Data, 'update', 'wait', and Combined constructs.
@ PresentOrCreate
'create' clause alias 'present_or_create'.
@ Collapse
'collapse' clause, allowed on 'loop' and Combined constructs.
@ NoHost
'nohost' clause, allowed on 'routine' directives.
@ PresentOrCopy
'copy' clause alias 'present_or_copy'. Preserved for diagnostic purposes.
@ DeviceNum
'device_num' clause, allowed on 'init', 'shutdown', and 'set' constructs.
@ Private
'private' clause, allowed on 'parallel', 'serial', 'loop', 'parallel loop', and 'serial loop' constru...
@ Invalid
Represents an invalid clause, for the purposes of parsing.
@ Vector
'vector' clause, allowed on 'loop', Combined, and 'routine' directives.
@ Copy
'copy' clause, allowed on Compute and Combined Constructs, plus 'data' and 'declare'.
@ Worker
'worker' clause, allowed on 'loop', Combined, and 'routine' directives.
@ Create
'create' clause, allowed on Compute and Combined constructs, plus 'data', 'enter data',...
@ DeviceType
'device_type' clause, allowed on Compute, 'data', 'init', 'shutdown', 'set', update',...
@ DefaultAsync
'default_async' clause, allowed on 'set' construct.
@ Attach
'attach' clause, allowed on Compute and Combined constructs, plus 'data' and 'enter data'.
@ NumGangs
'num_gangs' clause, allowed on 'parallel', 'kernels', parallel loop', and 'kernels loop' constructs.
@ If
'if' clause, allowed on all the Compute Constructs, Data Constructs, Executable Constructs,...
@ Default
'default' clause, allowed on parallel, serial, kernel (and compound) constructs.
@ UseDevice
'use_device' clause, allowed on 'host_data' construct.
@ NoCreate
'no_create' clause, allowed on allowed on Compute and Combined constructs, plus 'data'.
@ PresentOrCopyOut
'copyout' clause alias 'present_or_copyout'.
@ Link
'link' clause, allowed on 'declare' construct.
@ Reduction
'reduction' clause, allowed on Parallel, Serial, Loop, and the combined constructs.
@ Self
'self' clause, allowed on Compute and Combined Constructs, plus 'update'.
@ CopyOut
'copyout' clause, allowed on Compute and Combined constructs, plus 'data', 'exit data',...
@ Seq
'seq' clause, allowed on 'loop' and 'routine' directives.
@ FirstPrivate
'firstprivate' clause, allowed on 'parallel', 'serial', 'parallel loop', and 'serial loop' constructs...
@ Host
'host' clause, allowed on 'update' construct.
@ PCopy
'copy' clause alias 'pcopy'. Preserved for diagnostic purposes.
@ Tile
'tile' clause, allowed on 'loop' and Combined constructs.
@ PCopyIn
'copyin' clause alias 'pcopyin'. Preserved for diagnostic purposes.
@ DeviceResident
'device_resident' clause, allowed on the 'declare' construct.
@ PCreate
'create' clause alias 'pcreate'. Preserved for diagnostic purposes.
@ Present
'present' clause, allowed on Compute and Combined constructs, plus 'data' and 'declare'.
@ DType
'dtype' clause, an alias for 'device_type', stored separately for diagnostic purposes.
@ CopyIn
'copyin' clause, allowed on Compute and Combined constructs, plus 'data', 'enter data',...
@ Device
'device' clause, allowed on the 'update' construct.
@ Independent
'independent' clause, allowed on 'loop' directives.
@ NumWorkers
'num_workers' clause, allowed on 'parallel', 'kernels', parallel loop', and 'kernels loop' constructs...
@ IfPresent
'if_present' clause, allowed on 'host_data' and 'update' directives.
@ Detach
'detach' clause, allowed on the 'exit data' construct.
@ Delete
'delete' clause, allowed on the 'exit data' construct.
@ PresentOrCopyIn
'copyin' clause alias 'present_or_copyin'.
@ Finalize
'finalize' clause, allowed on 'exit data' directive.
TypeSpecifierType
Specifies the kind of type.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
SanitizerMask getPPTransparentSanitizers()
Return the sanitizers which do not affect preprocessing.
if(T->getSizeExpr()) TRY_TO(TraverseStmt(const_cast< Expr * >(T -> getSizeExpr())))
llvm::omp::Directive OpenMPDirectiveKind
OpenMP directives.
OpenMPDefaultmapClauseModifier
OpenMP modifiers for 'defaultmap' clause.
OpenMPOrderClauseModifier
OpenMP modifiers for 'order' clause.
void ProcessWarningOptions(DiagnosticsEngine &Diags, const DiagnosticOptions &Opts, bool ReportDiags=true)
ProcessWarningOptions - Initialize the diagnostic client and process the warning options specified on...
OpenMPAtClauseKind
OpenMP attributes for 'at' clause.
OpenMPReductionClauseModifier
OpenMP modifiers for 'reduction' clause.
OpenMPScheduleClauseModifier
OpenMP modifiers for 'schedule' clause.
llvm::omp::Clause OpenMPClauseKind
OpenMP clauses.
OpenMPDistScheduleClauseKind
OpenMP attributes for 'dist_schedule' clause.
OpenMPDoacrossClauseModifier
OpenMP dependence types for 'doacross' clause.
static constexpr unsigned NumberOfOMPMapClauseModifiers
Number of allowed map-type-modifiers.
const unsigned int NUM_PREDEF_DECL_IDS
The number of declaration IDs that are predefined.
ObjCXXARCStandardLibraryKind
Enumerate the kinds of standard library that.
PredefinedDeclIDs
Predefined declaration IDs.
@ PREDEF_DECL_CF_CONSTANT_STRING_TAG_ID
The internal '__NSConstantString' tag type.
@ PREDEF_DECL_TRANSLATION_UNIT_ID
The translation unit.
@ PREDEF_DECL_TYPE_PACK_ELEMENT_ID
The internal '__type_pack_element' template.
@ PREDEF_DECL_OBJC_CLASS_ID
The Objective-C 'Class' type.
@ PREDEF_DECL_BUILTIN_MS_GUID_ID
The predeclared '_GUID' struct.
@ PREDEF_DECL_OBJC_INSTANCETYPE_ID
The internal 'instancetype' typedef.
@ PREDEF_DECL_OBJC_PROTOCOL_ID
The Objective-C 'Protocol' type.
@ PREDEF_DECL_UNSIGNED_INT_128_ID
The unsigned 128-bit integer type.
@ PREDEF_DECL_OBJC_SEL_ID
The Objective-C 'SEL' type.
@ PREDEF_DECL_INT_128_ID
The signed 128-bit integer type.
@ PREDEF_DECL_VA_LIST_TAG
The internal '__va_list_tag' struct, if any.
@ PREDEF_DECL_BUILTIN_MS_VA_LIST_ID
The internal '__builtin_ms_va_list' typedef.
@ PREDEF_DECL_CF_CONSTANT_STRING_ID
The internal '__NSConstantString' typedef.
@ PREDEF_DECL_NULL_ID
The NULL declaration.
@ PREDEF_DECL_BUILTIN_VA_LIST_ID
The internal '__builtin_va_list' typedef.
@ PREDEF_DECL_EXTERN_C_CONTEXT_ID
The extern "C" context.
@ PREDEF_DECL_OBJC_ID_ID
The Objective-C 'id' type.
@ PREDEF_DECL_MAKE_INTEGER_SEQ_ID
The internal '__make_integer_seq' template.
@ Property
The type of a property.
@ Result
The result type of a method or function.
OpenMPBindClauseKind
OpenMP bindings for the 'bind' clause.
OpenMPLastprivateModifier
OpenMP 'lastprivate' clause modifier.
OpenMPDependClauseKind
OpenMP attributes for 'depend' clause.
OpenMPGrainsizeClauseModifier
OpenMPNumTasksClauseModifier
OpenMPSeverityClauseKind
OpenMP attributes for 'severity' clause.
static constexpr unsigned NumberOfOMPMotionModifiers
Number of allowed motion-modifiers.
TypeSpecifierWidth
Specifies the width of a type, e.g., short, long, or long long.
OpenMPMotionModifierKind
OpenMP modifier kind for 'to' or 'from' clause.
OpenMPDefaultmapClauseKind
OpenMP attributes for 'defaultmap' clause.
OpenMPLinearClauseKind
OpenMP attributes for 'linear' clause.
TypeSpecifierSign
Specifies the signedness of a type, e.g., signed or unsigned.
const FunctionProtoType * T
DisableValidationForModuleKind
Whether to disable the normal validation performed on precompiled headers and module files when they ...
@ None
Perform validation, don't disable it.
@ PCH
Disable validation for a precompiled header and the modules it depends on.
@ Module
Disable validation for module files.
bool shouldSkipCheckingODR(const Decl *D)
std::string getClangFullRepositoryVersion()
Retrieves the full repository version that is an amalgamation of the information in getClangRepositor...
OpenMPAtomicDefaultMemOrderClauseKind
OpenMP attributes for 'atomic_default_mem_order' clause.
@ Success
Template argument deduction was successful.
U cast(CodeGen::Address addr)
@ None
The alignment was not explicit in code.
OpenMPDeviceClauseModifier
OpenMP modifiers for 'device' clause.
OpenMPMapModifierKind
OpenMP modifier kind for 'map' clause.
@ Enum
The "enum" keyword introduces the elaborated-type-specifier.
OpenMPOrderClauseKind
OpenMP attributes for 'order' clause.
OpenMPScheduleClauseKind
OpenMP attributes for 'schedule' clause.
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
OpenMPMapClauseKind
OpenMP mapping kind for 'map' clause.
The signature of a module, which is a hash of the AST content.
static constexpr size_t size
static ASTFileSignature create(std::array< uint8_t, 20 > Bytes)
static ASTFileSignature createDummy()
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>".
static const ASTTemplateArgumentListInfo * Create(const ASTContext &C, const TemplateArgumentListInfo &List)
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...
DeclarationName getName() const
getName - Returns the embedded declaration name.
void setLoc(SourceLocation L)
setLoc - Sets the main location of the declaration name.
void setInfo(const DeclarationNameLoc &Info)
void setName(DeclarationName N)
setName - Sets the embedded declaration name.
A simple structure that captures a vtable use for the purposes of the ExternalSemaSource.
ExceptionSpecInfo ExceptionSpec
static LineEntry get(unsigned Offs, unsigned Line, int Filename, SrcMgr::CharacteristicKind FileKind, unsigned IncludeOffset)
A conflict between two modules.
Module * Other
The module that this module conflicts with.
std::string Message
The message provided to the user when there is a conflict.
A library or framework to link against when an entity from this module is used.
This structure contains all sizes needed for by an OMPMappableExprListClause.
unsigned NumComponentLists
Number of component lists.
unsigned NumVars
Number of expressions listed.
unsigned NumUniqueDeclarations
Number of unique base declarations.
unsigned NumComponents
Total number of expression components.
Data for list of allocators.
a linked list of methods with the same selector name but different signatures.
A struct with extended info about a syntactic name qualifier, to be used for the case of out-of-line ...
TemplateParameterList ** TemplParamLists
A new-allocated array of size NumTemplParamLists, containing pointers to the "outer" template paramet...
NestedNameSpecifierLoc QualifierLoc
unsigned NumTemplParamLists
The number of "outer" template parameter lists.
void clear(SanitizerMask K=SanitizerKind::All)
Disable the sanitizers specified in K.
SanitizerMask Mask
Bitmask of enabled sanitizers.
Helper class that saves the current stream position and then restores it when destroyed.
PragmaMsStackAction Action
Location information for a TemplateArgument.
Describes the categories of an Objective-C class.
void insert(GlobalDeclID ID)