96#include "llvm/ADT/APFloat.h"
97#include "llvm/ADT/APInt.h"
98#include "llvm/ADT/ArrayRef.h"
99#include "llvm/ADT/DenseMap.h"
100#include "llvm/ADT/FoldingSet.h"
101#include "llvm/ADT/IntrusiveRefCntPtr.h"
102#include "llvm/ADT/STLExtras.h"
103#include "llvm/ADT/ScopeExit.h"
104#include "llvm/ADT/Sequence.h"
105#include "llvm/ADT/SmallPtrSet.h"
106#include "llvm/ADT/SmallVector.h"
107#include "llvm/ADT/StringExtras.h"
108#include "llvm/ADT/StringMap.h"
109#include "llvm/ADT/StringRef.h"
110#include "llvm/ADT/iterator_range.h"
111#include "llvm/Bitstream/BitstreamReader.h"
112#include "llvm/Support/Compiler.h"
113#include "llvm/Support/Compression.h"
114#include "llvm/Support/DJB.h"
115#include "llvm/Support/Endian.h"
116#include "llvm/Support/Error.h"
117#include "llvm/Support/ErrorHandling.h"
118#include "llvm/Support/LEB128.h"
119#include "llvm/Support/MemoryBuffer.h"
120#include "llvm/Support/Path.h"
121#include "llvm/Support/SaveAndRestore.h"
122#include "llvm/Support/TimeProfiler.h"
123#include "llvm/Support/Timer.h"
124#include "llvm/Support/VersionTuple.h"
125#include "llvm/Support/raw_ostream.h"
126#include "llvm/TargetParser/Triple.h"
139#include <system_error>
144using namespace clang;
147using llvm::BitstreamCursor;
155 return First->ReadFullVersionInformation(FullVersion) ||
156 Second->ReadFullVersionInformation(FullVersion);
160 First->ReadModuleName(ModuleName);
161 Second->ReadModuleName(ModuleName);
165 First->ReadModuleMapFile(ModuleMapPath);
166 Second->ReadModuleMapFile(ModuleMapPath);
170 const LangOptions &LangOpts, StringRef ModuleFilename,
bool Complain,
171 bool AllowCompatibleDifferences) {
172 return First->ReadLanguageOptions(LangOpts, ModuleFilename, Complain,
173 AllowCompatibleDifferences) ||
174 Second->ReadLanguageOptions(LangOpts, ModuleFilename, Complain,
175 AllowCompatibleDifferences);
179 const CodeGenOptions &CGOpts, StringRef ModuleFilename,
bool Complain,
180 bool AllowCompatibleDifferences) {
181 return First->ReadCodeGenOptions(CGOpts, ModuleFilename, Complain,
182 AllowCompatibleDifferences) ||
183 Second->ReadCodeGenOptions(CGOpts, ModuleFilename, Complain,
184 AllowCompatibleDifferences);
188 const TargetOptions &TargetOpts, StringRef ModuleFilename,
bool Complain,
189 bool AllowCompatibleDifferences) {
190 return First->ReadTargetOptions(TargetOpts, ModuleFilename, Complain,
191 AllowCompatibleDifferences) ||
192 Second->ReadTargetOptions(TargetOpts, ModuleFilename, Complain,
193 AllowCompatibleDifferences);
198 return First->ReadDiagnosticOptions(DiagOpts, ModuleFilename, Complain) ||
199 Second->ReadDiagnosticOptions(DiagOpts, ModuleFilename, Complain);
205 return First->ReadFileSystemOptions(FSOpts, Complain) ||
206 Second->ReadFileSystemOptions(FSOpts, Complain);
211 StringRef SpecificModuleCachePath,
bool Complain) {
212 return First->ReadHeaderSearchOptions(HSOpts, ModuleFilename,
213 SpecificModuleCachePath, Complain) ||
214 Second->ReadHeaderSearchOptions(HSOpts, ModuleFilename,
215 SpecificModuleCachePath, Complain);
220 bool ReadMacros,
bool Complain, std::string &SuggestedPredefines) {
221 return First->ReadPreprocessorOptions(PPOpts, ModuleFilename, ReadMacros,
222 Complain, SuggestedPredefines) ||
223 Second->ReadPreprocessorOptions(PPOpts, ModuleFilename, ReadMacros,
224 Complain, SuggestedPredefines);
229 First->ReadCounter(M,
Value);
230 Second->ReadCounter(M,
Value);
234 return First->needsInputFileVisitation() ||
235 Second->needsInputFileVisitation();
239 return First->needsSystemInputFileVisitation() ||
240 Second->needsSystemInputFileVisitation();
245 First->visitModuleFile(
Filename, Kind);
246 Second->visitModuleFile(
Filename, Kind);
252 bool isExplicitModule) {
253 bool Continue =
false;
254 if (First->needsInputFileVisitation() &&
255 (!isSystem || First->needsSystemInputFileVisitation()))
256 Continue |= First->visitInputFile(
Filename, isSystem, isOverridden,
258 if (Second->needsInputFileVisitation() &&
259 (!isSystem || Second->needsSystemInputFileVisitation()))
260 Continue |= Second->visitInputFile(
Filename, isSystem, isOverridden,
267 First->readModuleFileExtension(Metadata);
268 Second->readModuleFileExtension(Metadata);
287 StringRef ModuleFilename,
289 bool AllowCompatibleDifferences =
true) {
293#define LANGOPT(Name, Bits, Default, Compatibility, Description) \
294 if constexpr (CK::Compatibility != CK::Benign) { \
295 if ((CK::Compatibility == CK::NotCompatible) || \
296 (CK::Compatibility == CK::Compatible && \
297 !AllowCompatibleDifferences)) { \
298 if (ExistingLangOpts.Name != LangOpts.Name) { \
301 Diags->Report(diag::err_ast_file_langopt_mismatch) \
302 << Description << LangOpts.Name << ExistingLangOpts.Name \
305 Diags->Report(diag::err_ast_file_langopt_value_mismatch) \
306 << Description << ModuleFilename; \
313#define VALUE_LANGOPT(Name, Bits, Default, Compatibility, Description) \
314 if constexpr (CK::Compatibility != CK::Benign) { \
315 if ((CK::Compatibility == CK::NotCompatible) || \
316 (CK::Compatibility == CK::Compatible && \
317 !AllowCompatibleDifferences)) { \
318 if (ExistingLangOpts.Name != LangOpts.Name) { \
320 Diags->Report(diag::err_ast_file_langopt_value_mismatch) \
321 << Description << ModuleFilename; \
327#define ENUM_LANGOPT(Name, Type, Bits, Default, Compatibility, Description) \
328 if constexpr (CK::Compatibility != CK::Benign) { \
329 if ((CK::Compatibility == CK::NotCompatible) || \
330 (CK::Compatibility == CK::Compatible && \
331 !AllowCompatibleDifferences)) { \
332 if (ExistingLangOpts.get##Name() != LangOpts.get##Name()) { \
334 Diags->Report(diag::err_ast_file_langopt_value_mismatch) \
335 << Description << ModuleFilename; \
341#include "clang/Basic/LangOptions.def"
345 Diags->
Report(diag::err_ast_file_langopt_value_mismatch)
346 <<
"module features" << ModuleFilename;
352 Diags->
Report(diag::err_ast_file_langopt_value_mismatch)
353 <<
"target Objective-C runtime" << ModuleFilename;
360 Diags->
Report(diag::err_ast_file_langopt_value_mismatch)
361 <<
"block command names" << ModuleFilename;
369 if (!AllowCompatibleDifferences) {
373 ExistingSanitizers.
clear(ModularSanitizers);
374 ImportedSanitizers.
clear(ModularSanitizers);
375 if (ExistingSanitizers.
Mask != ImportedSanitizers.
Mask) {
376 const std::string Flag =
"-fsanitize=";
378#define SANITIZER(NAME, ID) \
380 bool InExistingModule = ExistingSanitizers.has(SanitizerKind::ID); \
381 bool InImportedModule = ImportedSanitizers.has(SanitizerKind::ID); \
382 if (InExistingModule != InImportedModule) \
383 Diags->Report(diag::err_ast_file_targetopt_feature_mismatch) \
384 << InExistingModule << ModuleFilename << (Flag + NAME); \
386#include "clang/Basic/Sanitizers.def"
397 StringRef ModuleFilename,
399 bool AllowCompatibleDifferences =
true) {
403#define CODEGENOPT(Name, Bits, Default, Compatibility) \
404 if constexpr (CK::Compatibility != CK::Benign) { \
405 if ((CK::Compatibility == CK::NotCompatible) || \
406 (CK::Compatibility == CK::Compatible && \
407 !AllowCompatibleDifferences)) { \
408 if (ExistingCGOpts.Name != CGOpts.Name) { \
411 Diags->Report(diag::err_ast_file_codegenopt_mismatch) \
412 << #Name << CGOpts.Name << ExistingCGOpts.Name \
415 Diags->Report(diag::err_ast_file_codegenopt_value_mismatch) \
416 << #Name << ModuleFilename; \
423#define VALUE_CODEGENOPT(Name, Bits, Default, Compatibility) \
424 if constexpr (CK::Compatibility != CK::Benign) { \
425 if ((CK::Compatibility == CK::NotCompatible) || \
426 (CK::Compatibility == CK::Compatible && \
427 !AllowCompatibleDifferences)) { \
428 if (ExistingCGOpts.Name != CGOpts.Name) { \
430 Diags->Report(diag::err_ast_file_codegenopt_value_mismatch) \
431 << #Name << ModuleFilename; \
436#define ENUM_CODEGENOPT(Name, Type, Bits, Default, Compatibility) \
437 if constexpr (CK::Compatibility != CK::Benign) { \
438 if ((CK::Compatibility == CK::NotCompatible) || \
439 (CK::Compatibility == CK::Compatible && \
440 !AllowCompatibleDifferences)) { \
441 if (ExistingCGOpts.get##Name() != CGOpts.get##Name()) { \
443 Diags->Report(diag::err_ast_file_codegenopt_value_mismatch) \
444 << #Name << ModuleFilename; \
449#define DEBUGOPT(Name, Bits, Default, Compatibility)
450#define VALUE_DEBUGOPT(Name, Bits, Default, Compatibility)
451#define ENUM_DEBUGOPT(Name, Type, Bits, Default, Compatibility)
452#include "clang/Basic/CodeGenOptions.def"
465 StringRef ModuleFilename,
467 bool AllowCompatibleDifferences =
true) {
468#define CHECK_TARGET_OPT(Field, Name) \
469 if (TargetOpts.Field != ExistingTargetOpts.Field) { \
471 Diags->Report(diag::err_ast_file_targetopt_mismatch) \
472 << ModuleFilename << Name << TargetOpts.Field \
473 << ExistingTargetOpts.Field; \
484 if (!AllowCompatibleDifferences) {
489#undef CHECK_TARGET_OPT
497 llvm::sort(ExistingFeatures);
498 llvm::sort(ReadFeatures);
504 ExistingFeatures.begin(), ExistingFeatures.end(), ReadFeatures.begin(),
505 ReadFeatures.end(), std::back_inserter(UnmatchedExistingFeatures));
506 std::set_difference(ReadFeatures.begin(), ReadFeatures.end(),
507 ExistingFeatures.begin(), ExistingFeatures.end(),
508 std::back_inserter(UnmatchedReadFeatures));
512 if (AllowCompatibleDifferences && UnmatchedReadFeatures.empty())
516 for (StringRef
Feature : UnmatchedReadFeatures)
517 Diags->
Report(diag::err_ast_file_targetopt_feature_mismatch)
518 <<
false << ModuleFilename <<
Feature;
519 for (StringRef
Feature : UnmatchedExistingFeatures)
520 Diags->
Report(diag::err_ast_file_targetopt_feature_mismatch)
521 <<
true << ModuleFilename <<
Feature;
524 return !UnmatchedReadFeatures.empty() || !UnmatchedExistingFeatures.empty();
528 StringRef ModuleFilename,
bool Complain,
529 bool AllowCompatibleDifferences) {
532 Complain ? &Reader.Diags :
nullptr,
533 AllowCompatibleDifferences);
537 StringRef ModuleFilename,
bool Complain,
538 bool AllowCompatibleDifferences) {
541 Complain ? &Reader.Diags :
nullptr,
542 AllowCompatibleDifferences);
546 StringRef ModuleFilename,
bool Complain,
547 bool AllowCompatibleDifferences) {
550 Complain ? &Reader.Diags :
nullptr,
551 AllowCompatibleDifferences);
556using MacroDefinitionsMap =
557 llvm::StringMap<std::pair<StringRef,
bool >>;
558using DeclsMap = llvm::DenseMap<DeclarationName, SmallVector<NamedDecl *, 8>>;
564 StringRef ModuleFilename,
574 for (
auto DiagIDMappingPair : MappingSource->getDiagnosticMappings()) {
583 Diags.
Report(diag::err_ast_file_diagopt_mismatch)
585 ->getWarningOptionForDiag(DiagID)
605 StringRef ModuleFilename,
bool IsSystem,
606 bool SystemHeaderWarningsInModule,
615 !SystemHeaderWarningsInModule) {
617 Diags.
Report(diag::err_ast_file_diagopt_mismatch)
618 <<
"-Wsystem-headers" << ModuleFilename;
625 Diags.
Report(diag::err_ast_file_diagopt_mismatch)
626 <<
"-Werror" << ModuleFilename;
633 Diags.
Report(diag::err_ast_file_diagopt_mismatch)
634 <<
"-Weverything -Werror" << ModuleFilename;
641 Diags.
Report(diag::err_ast_file_diagopt_mismatch)
642 <<
"-pedantic-errors" << ModuleFilename;
667 assert(!ModuleName.empty() &&
"diagnostic options read before module name");
671 assert(M &&
"missing module");
676 StringRef ModuleFilename,
680 auto Diags = llvm::makeIntrusiveRefCnt<DiagnosticsEngine>(DiagIDs, DiagOpts);
688 assert(ModuleMgr.
size() >= 1 &&
"what ASTFile is this then");
697 bool SystemHeaderWarningsInModule =
704 TopM->
IsSystem, SystemHeaderWarningsInModule,
712 MacroDefinitionsMap &Macros,
714 for (
unsigned I = 0, N = PPOpts.
Macros.size(); I != N; ++I) {
716 bool IsUndef = PPOpts.
Macros[I].second;
718 std::pair<StringRef, StringRef> MacroPair =
Macro.split(
'=');
719 StringRef MacroName = MacroPair.first;
720 StringRef MacroBody = MacroPair.second;
724 auto [It, Inserted] = Macros.try_emplace(MacroName);
725 if (MacroNames && Inserted)
726 MacroNames->push_back(MacroName);
728 It->second = std::make_pair(
"",
true);
733 if (MacroName.size() ==
Macro.size())
737 StringRef::size_type End = MacroBody.find_first_of(
"\n\r");
738 MacroBody = MacroBody.substr(0, End);
741 auto [It, Inserted] = Macros.try_emplace(MacroName);
742 if (MacroNames && Inserted)
743 MacroNames->push_back(MacroName);
744 It->second = std::make_pair(MacroBody,
false);
768 std::string &SuggestedPredefines,
const LangOptions &LangOpts,
772 MacroDefinitionsMap ASTFileMacros;
774 MacroDefinitionsMap ExistingMacros;
777 &ExistingMacroNames);
781 SuggestedPredefines +=
"# 1 \"<command line>\" 1\n";
783 for (
unsigned I = 0, N = ExistingMacroNames.size(); I != N; ++I) {
785 StringRef MacroName = ExistingMacroNames[I];
786 std::pair<StringRef, bool> Existing = ExistingMacros[MacroName];
789 llvm::StringMap<std::pair<StringRef,
bool >>::iterator Known =
790 ASTFileMacros.find(MacroName);
796 Diags->
Report(diag::err_ast_file_macro_def_undef)
797 << MacroName <<
true << ModuleFilename;
805 if (Existing.second) {
806 SuggestedPredefines +=
"#undef ";
807 SuggestedPredefines += MacroName.str();
808 SuggestedPredefines +=
'\n';
810 SuggestedPredefines +=
"#define ";
811 SuggestedPredefines += MacroName.str();
812 SuggestedPredefines +=
' ';
813 SuggestedPredefines += Existing.first.str();
814 SuggestedPredefines +=
'\n';
821 if (Existing.second != Known->second.second) {
823 Diags->
Report(diag::err_ast_file_macro_def_undef)
824 << MacroName << Known->second.second << ModuleFilename;
831 if (Existing.second || Existing.first == Known->second.first) {
832 ASTFileMacros.erase(Known);
838 Diags->
Report(diag::err_ast_file_macro_def_conflict)
839 << MacroName << Known->second.first << Existing.first
846 SuggestedPredefines +=
"# 1 \"<built-in>\" 2\n";
851 for (
const auto &MacroName : ASTFileMacros.keys()) {
853 Diags->
Report(diag::err_ast_file_macro_def_undef)
854 << MacroName <<
false << ModuleFilename;
865 Diags->
Report(diag::err_ast_file_undef)
872 if (LangOpts.Modules &&
876 Diags->
Report(diag::err_ast_file_pp_detailed_record)
883 for (
unsigned I = 0, N = ExistingPPOpts.
Includes.size(); I != N; ++I) {
890 SuggestedPredefines +=
"#include \"";
891 SuggestedPredefines +=
File;
892 SuggestedPredefines +=
"\"\n";
902 SuggestedPredefines +=
"#include \"";
903 SuggestedPredefines +=
File;
904 SuggestedPredefines +=
"\"\n";
907 for (
unsigned I = 0, N = ExistingPPOpts.
MacroIncludes.size(); I != N; ++I) {
912 SuggestedPredefines +=
"#__include_macros \"";
913 SuggestedPredefines +=
File;
914 SuggestedPredefines +=
"\"\n##\n";
921 StringRef ModuleFilename,
922 bool ReadMacros,
bool Complain,
923 std::string &SuggestedPredefines) {
927 PPOpts, ExistingPPOpts, ModuleFilename, ReadMacros,
934 bool ReadMacros,
bool Complain, std::string &SuggestedPredefines) {
936 ModuleFilename, ReadMacros,
nullptr,
946 StringRef SpecificModuleCachePath,
947 StringRef ExistingModuleCachePath,
948 StringRef ModuleFilename,
953 SpecificModuleCachePath == ExistingModuleCachePath)
956 VFS.equivalent(SpecificModuleCachePath, ExistingModuleCachePath);
957 if (EqualOrErr && *EqualOrErr)
960 Diags->
Report(diag::err_ast_file_modulecache_mismatch)
961 << SpecificModuleCachePath << ExistingModuleCachePath << ModuleFilename;
966 StringRef ModuleFilename,
967 StringRef SpecificModuleCachePath,
972 Complain ? &Reader.Diags :
nullptr, PP.
getLangOpts(),
986 const char *Error =
nullptr;
988 uint64_t Val = llvm::decodeULEB128(
P, &Length,
nullptr, &Error);
990 llvm::report_fatal_error(Error);
996static std::pair<unsigned, unsigned>
999 if ((
unsigned)KeyLen != KeyLen)
1000 llvm::report_fatal_error(
"key too large");
1003 if ((
unsigned)DataLen != DataLen)
1004 llvm::report_fatal_error(
"data too large");
1006 return std::make_pair(KeyLen, DataLen);
1010 bool TakeOwnership) {
1011 DeserializationListener = Listener;
1012 OwnsDeserializationListener = TakeOwnership;
1023 Reader.ReadModuleOffsetMap(MF);
1025 unsigned ModuleFileIndex =
ID.getModuleFileIndex();
1032 assert(OwningModuleFile);
1036 if (!ModuleFileIndex)
1052std::pair<unsigned, unsigned>
1059 using namespace llvm::support;
1062 unsigned N = endian::readNext<uint16_t, llvm::endianness::little>(d);
1064 F, endian::readNext<IdentifierID, llvm::endianness::little>(d));
1071 Args.push_back(FirstII);
1072 for (
unsigned I = 1; I != N; ++I)
1073 Args.push_back(Reader.getLocalIdentifier(
1074 F, endian::readNext<IdentifierID, llvm::endianness::little>(d)));
1082 using namespace llvm::support;
1086 Result.ID = Reader.getGlobalSelectorID(
1087 F, endian::readNext<uint32_t, llvm::endianness::little>(d));
1088 unsigned FullInstanceBits =
1089 endian::readNext<uint16_t, llvm::endianness::little>(d);
1090 unsigned FullFactoryBits =
1091 endian::readNext<uint16_t, llvm::endianness::little>(d);
1092 Result.InstanceBits = FullInstanceBits & 0x3;
1093 Result.InstanceHasMoreThanOneDecl = (FullInstanceBits >> 2) & 0x1;
1094 Result.FactoryBits = FullFactoryBits & 0x3;
1095 Result.FactoryHasMoreThanOneDecl = (FullFactoryBits >> 2) & 0x1;
1096 unsigned NumInstanceMethods = FullInstanceBits >> 3;
1097 unsigned NumFactoryMethods = FullFactoryBits >> 3;
1100 for (
unsigned I = 0; I != NumInstanceMethods; ++I) {
1104 endian::readNext<DeclID, llvm::endianness::little>(d))))
1109 for (
unsigned I = 0; I != NumFactoryMethods; ++I) {
1113 endian::readNext<DeclID, llvm::endianness::little>(d))))
1121 return llvm::djbHash(a);
1124std::pair<unsigned, unsigned>
1131 assert(n >= 2 && d[n-1] ==
'\0');
1132 return StringRef((
const char*) d, n-1);
1138 bool IsInteresting =
1149 bool Value = Bits & 0x1;
1155 using namespace llvm::support;
1158 endian::readNext<IdentifierID, llvm::endianness::little>(d);
1159 return Reader.getGlobalIdentifierID(F, RawID >> 1);
1172 const unsigned char* d,
1174 using namespace llvm::support;
1177 endian::readNext<IdentifierID, llvm::endianness::little>(d);
1178 bool IsInteresting = RawID & 0x01;
1188 II = &Reader.getIdentifierTable().getOwn(k);
1191 bool IsModule = Reader.getPreprocessor().getCurrentModule() !=
nullptr;
1193 Reader.markIdentifierUpToDate(II);
1195 IdentifierID ID = Reader.getGlobalIdentifierID(F, RawID);
1196 if (!IsInteresting) {
1199 Reader.SetIdentifierInfo(ID, II);
1203 unsigned ObjCOrBuiltinID =
1204 endian::readNext<uint16_t, llvm::endianness::little>(d);
1205 unsigned Bits = endian::readNext<uint16_t, llvm::endianness::little>(d);
1206 bool CPlusPlusOperatorKeyword =
readBit(Bits);
1207 bool HasRevertedTokenIDToIdentifier =
readBit(Bits);
1208 bool Poisoned =
readBit(Bits);
1209 bool ExtensionToken =
readBit(Bits);
1210 bool HasMacroDefinition =
readBit(Bits);
1212 assert(Bits == 0 &&
"Extra bits in the identifier?");
1213 DataLen -=
sizeof(uint16_t) * 2;
1217 if (HasRevertedTokenIDToIdentifier && II->
getTokenID() != tok::identifier)
1222 "Incorrect extension token flag");
1223 (void)ExtensionToken;
1227 "Incorrect C++ operator keyword flag");
1228 (void)CPlusPlusOperatorKeyword;
1232 if (HasMacroDefinition) {
1233 uint32_t MacroDirectivesOffset =
1234 endian::readNext<uint32_t, llvm::endianness::little>(d);
1237 if (MacroDirectivesOffset)
1238 Reader.addPendingMacro(II, &F, MacroDirectivesOffset);
1240 hasMacroDefinitionInDependencies =
true;
1243 Reader.SetIdentifierInfo(ID, II);
1249 for (; DataLen > 0; DataLen -=
sizeof(
DeclID))
1250 DeclIDs.push_back(Reader.getGlobalDeclID(
1253 endian::readNext<DeclID, llvm::endianness::little>(d))));
1254 Reader.SetGloballyVisibleDecls(II, DeclIDs);
1261 : Kind(Name.getNameKind()) {
1264 Data = (uint64_t)Name.getAsIdentifierInfo();
1269 Data = (uint64_t)Name.getObjCSelector().getAsOpaquePtr();
1272 Data = Name.getCXXOverloadedOperator();
1275 Data = (uint64_t)Name.getCXXLiteralIdentifier();
1278 Data = (uint64_t)Name.getCXXDeductionGuideTemplate()
1279 ->getDeclName().getAsIdentifierInfo();
1291 llvm::FoldingSetNodeID ID;
1292 ID.AddInteger(Kind);
1315 return ID.computeStableHash();
1319ASTDeclContextNameLookupTraitBase::ReadFileRef(
const unsigned char *&d) {
1320 using namespace llvm::support;
1322 uint32_t ModuleFileID =
1323 endian::readNext<uint32_t, llvm::endianness::little>(d);
1324 return Reader.getLocalModuleFile(F, ModuleFileID);
1327std::pair<unsigned, unsigned>
1328ASTDeclContextNameLookupTraitBase::ReadKeyDataLength(
const unsigned char *&d) {
1333ASTDeclContextNameLookupTraitBase::ReadKeyBase(
const unsigned char *&d) {
1334 using namespace llvm::support;
1342 Data = (uint64_t)Reader.getLocalIdentifier(
1343 F, endian::readNext<IdentifierID, llvm::endianness::little>(d));
1348 Data = (uint64_t)Reader
1350 F, endian::readNext<uint32_t, llvm::endianness::little>(d))
1368ASTDeclContextNameLookupTrait::ReadKey(
const unsigned char *d,
unsigned) {
1369 return ReadKeyBase(d);
1372void ASTDeclContextNameLookupTraitBase::ReadDataIntoImpl(
1374 using namespace llvm::support;
1376 for (
unsigned NumDecls = DataLen /
sizeof(
DeclID); NumDecls; --NumDecls) {
1378 Reader, F, endian::readNext<DeclID, llvm::endianness::little>(d));
1379 Val.
insert(Reader.getGlobalDeclID(F, ID));
1384 const unsigned char *d,
1387 ReadDataIntoImpl(d, DataLen, Val);
1392 llvm::FoldingSetNodeID ID;
1393 ID.AddInteger(Key.first.getHash());
1394 ID.AddInteger(Key.second);
1395 return ID.computeStableHash();
1406 return {Name, *ModuleHash};
1412 unsigned PrimaryModuleHash =
1413 llvm::support::endian::readNext<uint32_t, llvm::endianness::little>(d);
1414 return {Name, PrimaryModuleHash};
1418 const unsigned char *d,
1421 ReadDataIntoImpl(d, DataLen, Val);
1425LazySpecializationInfoLookupTrait::ReadFileRef(
const unsigned char *&d) {
1426 using namespace llvm::support;
1428 uint32_t ModuleFileID =
1429 endian::readNext<uint32_t, llvm::endianness::little, unaligned>(d);
1430 return Reader.getLocalModuleFile(F, ModuleFileID);
1434LazySpecializationInfoLookupTrait::ReadKey(
const unsigned char *d,
unsigned) {
1435 using namespace llvm::support;
1436 return endian::readNext<uint32_t, llvm::endianness::little, unaligned>(d);
1439std::pair<unsigned, unsigned>
1440LazySpecializationInfoLookupTrait::ReadKeyDataLength(
const unsigned char *&d) {
1445 const unsigned char *d,
1448 using namespace llvm::support;
1450 for (
unsigned NumDecls =
1452 NumDecls; --NumDecls) {
1455 endian::readNext<DeclID, llvm::endianness::little, unaligned>(d));
1456 Val.
insert(Reader.getGlobalDeclID(F, LocalID));
1460bool ASTReader::ReadLexicalDeclContextStorage(
ModuleFile &M,
1461 BitstreamCursor &Cursor,
1464 assert(Offset != 0);
1467 if (llvm::Error Err = Cursor.JumpToBit(Offset)) {
1468 Error(std::move(Err));
1476 Error(MaybeCode.takeError());
1479 unsigned Code = MaybeCode.get();
1482 if (!MaybeRecCode) {
1483 Error(MaybeRecCode.takeError());
1486 unsigned RecCode = MaybeRecCode.get();
1488 Error(
"Expected lexical block");
1492 assert(!isa<TranslationUnitDecl>(DC) &&
1493 "expected a TU_UPDATE_LEXICAL record for TU");
1498 auto &Lex = LexicalDecls[DC];
1500 Lex = std::make_pair(
1503 Blob.size() /
sizeof(
DeclID)));
1509bool ASTReader::ReadVisibleDeclContextStorage(
1511 ASTReader::VisibleDeclContextStorageKind VisibleKind) {
1512 assert(Offset != 0);
1515 if (llvm::Error Err =
Cursor.JumpToBit(Offset)) {
1516 Error(std::move(Err));
1524 Error(MaybeCode.takeError());
1527 unsigned Code = MaybeCode.get();
1530 if (!MaybeRecCode) {
1531 Error(MaybeRecCode.takeError());
1534 unsigned RecCode = MaybeRecCode.get();
1535 switch (VisibleKind) {
1536 case VisibleDeclContextStorageKind::GenerallyVisible:
1538 Error(
"Expected visible lookup table block");
1542 case VisibleDeclContextStorageKind::ModuleLocalVisible:
1544 Error(
"Expected module local visible lookup table block");
1548 case VisibleDeclContextStorageKind::TULocalVisible:
1550 Error(
"Expected TU local lookup table block");
1558 auto *
Data = (
const unsigned char*)Blob.data();
1559 switch (VisibleKind) {
1560 case VisibleDeclContextStorageKind::GenerallyVisible:
1561 PendingVisibleUpdates[
ID].push_back(UpdateData{&M,
Data});
1563 case VisibleDeclContextStorageKind::ModuleLocalVisible:
1564 PendingModuleLocalVisibleUpdates[
ID].push_back(UpdateData{&M,
Data});
1566 case VisibleDeclContextStorageKind::TULocalVisible:
1568 TULocalUpdates[
ID].push_back(UpdateData{&M,
Data});
1574void ASTReader::AddSpecializations(
const Decl *
D,
const unsigned char *
Data,
1578 IsPartial ? PartialSpecializationsLookups : SpecializationsLookups;
1583bool ASTReader::ReadSpecializations(
ModuleFile &M, BitstreamCursor &Cursor,
1584 uint64_t Offset,
Decl *
D,
bool IsPartial) {
1585 assert(Offset != 0);
1588 if (llvm::Error Err =
Cursor.JumpToBit(Offset)) {
1589 Error(std::move(Err));
1597 Error(MaybeCode.takeError());
1600 unsigned Code = MaybeCode.get();
1603 if (!MaybeRecCode) {
1604 Error(MaybeRecCode.takeError());
1607 unsigned RecCode = MaybeRecCode.get();
1610 Error(
"Expected decl specs block");
1614 auto *
Data = (
const unsigned char *)Blob.data();
1615 AddSpecializations(
D,
Data, M, IsPartial);
1619void ASTReader::Error(StringRef Msg)
const {
1620 Error(diag::err_fe_ast_file_malformed, Msg);
1621 if (PP.getLangOpts().Modules &&
1622 !PP.getHeaderSearchInfo().getModuleCachePath().empty()) {
1623 Diag(diag::note_module_cache_path)
1624 << PP.getHeaderSearchInfo().getModuleCachePath();
1628void ASTReader::Error(
unsigned DiagID, StringRef Arg1, StringRef Arg2,
1629 StringRef Arg3)
const {
1630 Diag(DiagID) << Arg1 << Arg2 << Arg3;
1634struct AlreadyReportedDiagnosticError
1635 : llvm::ErrorInfo<AlreadyReportedDiagnosticError> {
1638 void log(raw_ostream &OS)
const override {
1639 llvm_unreachable(
"reporting an already-reported diagnostic error");
1642 std::error_code convertToErrorCode()
const override {
1643 return llvm::inconvertibleErrorCode();
1647char AlreadyReportedDiagnosticError::ID = 0;
1650void ASTReader::Error(llvm::Error &&Err)
const {
1652 std::move(Err), [](AlreadyReportedDiagnosticError &) {},
1653 [&](llvm::ErrorInfoBase &
E) {
return Error(
E.message()); });
1666 std::map<int, int> FileIDs;
1668 for (
unsigned I = 0;
Record[Idx]; ++I) {
1676 std::vector<LineEntry> Entries;
1677 while (Idx <
Record.size()) {
1681 unsigned NumEntries =
Record[Idx++];
1682 assert(NumEntries &&
"no line entries for file ID");
1684 Entries.reserve(NumEntries);
1685 for (
unsigned I = 0; I != NumEntries; ++I) {
1686 unsigned FileOffset =
Record[Idx++];
1687 unsigned LineNo =
Record[Idx++];
1688 int FilenameID = FileIDs[
Record[Idx++]];
1691 unsigned IncludeOffset =
Record[Idx++];
1693 FileKind, IncludeOffset));
1700llvm::Error ASTReader::ReadSourceManagerBlock(
ModuleFile &F) {
1701 using namespace SrcMgr;
1709 SLocEntryCursor = F.
Stream;
1712 if (llvm::Error Err = F.
Stream.SkipBlock())
1723 SLocEntryCursor.advanceSkippingSubblocks();
1725 return MaybeE.takeError();
1726 llvm::BitstreamEntry
E = MaybeE.get();
1729 case llvm::BitstreamEntry::SubBlock:
1730 case llvm::BitstreamEntry::Error:
1731 return llvm::createStringError(std::errc::illegal_byte_sequence,
1732 "malformed block record in AST file");
1733 case llvm::BitstreamEntry::EndBlock:
1734 return llvm::Error::success();
1735 case llvm::BitstreamEntry::Record:
1744 SLocEntryCursor.readRecord(
E.ID,
Record, &Blob);
1746 return MaybeRecord.takeError();
1747 switch (MaybeRecord.get()) {
1755 return llvm::Error::success();
1766 return std::move(Err);
1770 return MaybeEntry.takeError();
1772 llvm::BitstreamEntry Entry = MaybeEntry.get();
1773 if (Entry.Kind != llvm::BitstreamEntry::Record)
1774 return llvm::createStringError(
1775 std::errc::illegal_byte_sequence,
1776 "incorrectly-formatted source location entry in AST file");
1782 return MaybeSLOC.takeError();
1784 switch (MaybeSLOC.get()) {
1786 return llvm::createStringError(
1787 std::errc::illegal_byte_sequence,
1788 "incorrectly-formatted source location entry in AST file");
1798 GlobalSLocOffsetMap.find(SourceManager::MaxLoadedOffset - SLocOffset - 1);
1799 assert(SLocMapI != GlobalSLocOffsetMap.end() &&
1800 "Corrupted global sloc offset map");
1805 auto It = llvm::upper_bound(
1808 int ID = F->SLocEntryBaseID + LocalIndex;
1809 std::size_t Index = -ID - 2;
1810 if (!SourceMgr.SLocEntryOffsetLoaded[Index]) {
1811 assert(!SourceMgr.SLocEntryLoaded[Index]);
1812 auto MaybeEntryOffset = readSLocOffset(F, LocalIndex);
1813 if (!MaybeEntryOffset) {
1814 Error(MaybeEntryOffset.takeError());
1818 SourceMgr.LoadedSLocEntryTable[Index] =
1819 SrcMgr::SLocEntry::getOffsetOnly(*MaybeEntryOffset);
1820 SourceMgr.SLocEntryOffsetLoaded[Index] = true;
1822 return Offset < SourceMgr.LoadedSLocEntryTable[Index].getOffset();
1837 if (
unsigned(-ID) - 2 >= getTotalNumSLocs() || ID > 0) {
1838 Error(
"source location entry ID out-of-range for AST file");
1844 auto ReadBuffer = [
this](
1845 BitstreamCursor &SLocEntryCursor,
1846 StringRef Name) -> std::unique_ptr<llvm::MemoryBuffer> {
1851 Error(MaybeCode.takeError());
1854 unsigned Code = MaybeCode.get();
1857 SLocEntryCursor.readRecord(Code,
Record, &Blob);
1858 if (!MaybeRecCode) {
1859 Error(MaybeRecCode.takeError());
1862 unsigned RecCode = MaybeRecCode.get();
1867 const llvm::compression::Format F =
1868 Blob.size() > 0 && Blob.data()[0] == 0x78
1869 ? llvm::compression::Format::Zlib
1870 : llvm::compression::Format::Zstd;
1871 if (
const char *Reason = llvm::compression::getReasonIfUnsupported(F)) {
1876 if (llvm::Error
E = llvm::compression::decompress(
1877 F, llvm::arrayRefFromStringRef(Blob), Decompressed,
Record[0])) {
1878 Error(
"could not decompress embedded file contents: " +
1879 llvm::toString(std::move(
E)));
1882 return llvm::MemoryBuffer::getMemBufferCopy(
1883 llvm::toStringRef(Decompressed), Name);
1885 return llvm::MemoryBuffer::getMemBuffer(Blob.drop_back(1), Name,
true);
1887 Error(
"AST record has invalid code");
1892 ModuleFile *F = GlobalSLocEntryMap.find(-ID)->second;
1896 Error(std::move(Err));
1903 ++NumSLocEntriesRead;
1906 Error(MaybeEntry.takeError());
1909 llvm::BitstreamEntry Entry = MaybeEntry.get();
1911 if (Entry.Kind != llvm::BitstreamEntry::Record) {
1912 Error(
"incorrectly-formatted source location entry in AST file");
1919 SLocEntryCursor.readRecord(Entry.ID,
Record, &Blob);
1921 Error(MaybeSLOC.takeError());
1924 switch (MaybeSLOC.get()) {
1926 Error(
"incorrectly-formatted source location entry in AST file");
1932 unsigned InputID =
Record[4];
1933 InputFile IF = getInputFile(*F, InputID);
1946 IncludeLoc = getImportLocation(F);
1950 FileID FID = SourceMgr.createFileID(*
File, IncludeLoc, FileCharacter, ID,
1953 FileInfo.NumCreatedFIDs =
Record[5];
1957 unsigned NumFileDecls =
Record[7];
1958 if (NumFileDecls && ContextObj) {
1960 assert(F->
FileSortedDecls &&
"FILE_SORTED_DECLS not encountered yet ?");
1966 SourceMgr.getOrCreateContentCache(*
File, isSystem(FileCharacter));
1970 auto Buffer = ReadBuffer(SLocEntryCursor,
File->getName());
1973 SourceMgr.overrideFileContents(*
File, std::move(Buffer));
1980 const char *Name = Blob.data();
1981 unsigned Offset =
Record[0];
1986 IncludeLoc = getImportLocation(F);
1989 auto Buffer = ReadBuffer(SLocEntryCursor, Name);
1992 FileID FID = SourceMgr.createFileID(std::move(Buffer), FileCharacter, ID,
1993 BaseOffset + Offset, IncludeLoc);
1995 auto &FileInfo = SourceMgr.getSLocEntry(FID).getFile();
1996 FileInfo.setHasLineDirectives();
2005 SourceMgr.createExpansionLoc(SpellingLoc, ExpansionBegin, ExpansionEnd,
2019 if (
unsigned(-ID) - 2 >= getTotalNumSLocs() || ID > 0) {
2020 Error(
"source location entry ID out-of-range for AST file");
2025 ModuleFile *M = GlobalSLocEntryMap.find(-ID)->second;
2043 assert(SourceMgr.getMainFileID().isValid() &&
"missing main file");
2044 return SourceMgr.getLocForStartOfFile(SourceMgr.getMainFileID());
2054 uint64_t *StartOfBlockOffset) {
2055 if (llvm::Error Err = Cursor.EnterSubBlock(BlockID))
2058 if (StartOfBlockOffset)
2059 *StartOfBlockOffset = Cursor.GetCurrentBitNo();
2062 uint64_t Offset = Cursor.GetCurrentBitNo();
2065 return MaybeCode.takeError();
2066 unsigned Code = MaybeCode.get();
2069 if (Code != llvm::bitc::DEFINE_ABBREV) {
2070 if (llvm::Error Err = Cursor.JumpToBit(Offset))
2072 return llvm::Error::success();
2074 if (llvm::Error Err = Cursor.ReadAbbrevRecord())
2090 case tok::annot_pragma_loop_hint: {
2093 Info->Option = ReadToken(M,
Record, Idx);
2094 unsigned NumTokens =
Record[Idx++];
2096 Toks.reserve(NumTokens);
2097 for (
unsigned I = 0; I < NumTokens; ++I)
2098 Toks.push_back(ReadToken(M,
Record, Idx));
2099 Info->Toks =
llvm::ArrayRef(Toks).copy(PP.getPreprocessorAllocator());
2103 case tok::annot_pragma_pack: {
2106 auto SlotLabel = ReadString(
Record, Idx);
2108 llvm::StringRef(SlotLabel).copy(PP.getPreprocessorAllocator());
2109 Info->Alignment = ReadToken(M,
Record, Idx);
2114 case tok::annot_pragma_openmp:
2115 case tok::annot_pragma_openmp_end:
2116 case tok::annot_pragma_unused:
2117 case tok::annot_pragma_openacc:
2118 case tok::annot_pragma_openacc_end:
2119 case tok::annot_repl_input_end:
2122 llvm_unreachable(
"missing deserialization code for annotation token");
2139 if (llvm::Error Err = Stream.JumpToBit(Offset)) {
2141 consumeError(std::move(Err));
2153 unsigned Flags = BitstreamCursor::AF_DontPopBlockAtEnd;
2155 Stream.advanceSkippingSubblocks(Flags);
2157 Error(MaybeEntry.takeError());
2160 llvm::BitstreamEntry Entry = MaybeEntry.get();
2162 switch (Entry.Kind) {
2163 case llvm::BitstreamEntry::SubBlock:
2164 case llvm::BitstreamEntry::Error:
2165 Error(
"malformed block record in AST file");
2167 case llvm::BitstreamEntry::EndBlock:
2169 case llvm::BitstreamEntry::Record:
2180 Error(MaybeRecType.takeError());
2196 unsigned NextIndex = 1;
2203 PP.getPreprocessorAllocator());
2206 bool isC99VarArgs =
Record[NextIndex++];
2207 bool isGNUVarArgs =
Record[NextIndex++];
2208 bool hasCommaPasting =
Record[NextIndex++];
2209 MacroParams.clear();
2210 unsigned NumArgs =
Record[NextIndex++];
2211 for (
unsigned i = 0; i != NumArgs; ++i)
2212 MacroParams.push_back(getLocalIdentifier(F,
Record[NextIndex++]));
2226 if (NextIndex + 1 ==
Record.size() && PP.getPreprocessingRecord() &&
2230 GlobalID = getGlobalPreprocessedEntityID(F,
Record[NextIndex]);
2232 PreprocessingRecord::PPEntityID PPID =
2233 PPRec.getPPEntityID(GlobalID - 1,
true);
2235 PPRec.getPreprocessedEntity(PPID));
2237 PPRec.RegisterMacroDefinition(
Macro, PPDef);
2248 if (MacroTokens.empty()) {
2249 Error(
"unexpected number of macro tokens for a macro in AST file");
2254 MacroTokens[0] = ReadToken(F,
Record, Idx);
2255 MacroTokens = MacroTokens.drop_front();
2264 unsigned LocalID)
const {
2266 ReadModuleOffsetMap(M);
2271 &&
"Invalid index into preprocessed entity index remap");
2273 return LocalID + I->second;
2277HeaderFileInfoTrait::getFile(
const internal_key_type &Key) {
2288 uint8_t buf[
sizeof(ikey.
Size) +
sizeof(ikey.
ModTime)];
2291 return llvm::xxh3_64bits(buf);
2312 return FEA && FEA == FEB;
2315std::pair<unsigned, unsigned>
2316HeaderFileInfoTrait::ReadKeyDataLength(
const unsigned char*& d) {
2321HeaderFileInfoTrait::ReadKey(
const unsigned char *d,
unsigned) {
2322 using namespace llvm::support;
2325 ikey.
Size = off_t(endian::readNext<uint64_t, llvm::endianness::little>(d));
2327 time_t(endian::readNext<uint64_t, llvm::endianness::little>(d));
2336 using namespace llvm::support;
2338 const unsigned char *End = d + DataLen;
2340 unsigned Flags = *d++;
2343 bool Included = (Flags >> 6) & 0x01;
2345 if ((FE = getFile(key)))
2348 Reader.getPreprocessor().getIncludedFiles().insert(*FE);
2351 HFI.
isImport |= (Flags >> 5) & 0x01;
2353 HFI.
DirInfo = (Flags >> 1) & 0x07;
2355 M, endian::readNext<IdentifierID, llvm::endianness::little>(d));
2357 assert((End - d) % 4 == 0 &&
2358 "Wrong data length in HeaderFileInfo deserialization");
2360 uint32_t LocalSMID =
2361 endian::readNext<uint32_t, llvm::endianness::little>(d);
2367 SubmoduleID GlobalSMID = Reader.getGlobalSubmoduleID(M, LocalSMID);
2368 Module *Mod = Reader.getSubmodule(GlobalSMID);
2370 Reader.getPreprocessor().getHeaderSearchInfo().getModuleMap();
2372 if (FE || (FE = getFile(key))) {
2375 ModMap.
addHeader(Mod, H, HeaderRole,
true);
2387 uint32_t MacroDirectivesOffset) {
2388 assert(NumCurrentElementsDeserializing > 0 &&
"Missing deserialization guard");
2389 PendingMacroIDs[II].push_back(PendingMacroInfo(M, MacroDirectivesOffset));
2396 for (
ModuleFile &I : llvm::reverse(ModuleMgr)) {
2397 BitstreamCursor &MacroCursor = I.MacroCursor;
2400 if (MacroCursor.getBitcodeBytes().empty())
2403 BitstreamCursor Cursor = MacroCursor;
2404 if (llvm::Error Err = Cursor.JumpToBit(I.MacroStartOffset)) {
2405 Error(std::move(Err));
2413 Error(MaybeE.takeError());
2416 llvm::BitstreamEntry
E = MaybeE.get();
2419 case llvm::BitstreamEntry::SubBlock:
2420 case llvm::BitstreamEntry::Error:
2421 Error(
"malformed block record in AST file");
2423 case llvm::BitstreamEntry::EndBlock:
2426 case llvm::BitstreamEntry::Record: {
2430 Error(MaybeRecord.takeError());
2433 switch (MaybeRecord.get()) {
2441 updateOutOfDateIdentifier(*II);
2460 class IdentifierLookupVisitor {
2463 unsigned PriorGeneration;
2464 unsigned &NumIdentifierLookups;
2465 unsigned &NumIdentifierLookupHits;
2469 IdentifierLookupVisitor(StringRef Name,
unsigned PriorGeneration,
2470 unsigned &NumIdentifierLookups,
2471 unsigned &NumIdentifierLookupHits)
2473 PriorGeneration(PriorGeneration),
2474 NumIdentifierLookups(NumIdentifierLookups),
2475 NumIdentifierLookupHits(NumIdentifierLookupHits) {}
2489 ++NumIdentifierLookups;
2490 ASTIdentifierLookupTable::iterator Pos =
2491 IdTable->find_hashed(Name, NameHash, &Trait);
2492 if (Pos == IdTable->end())
2498 ++NumIdentifierLookupHits;
2500 if (Trait.hasMoreInformationInDependencies()) {
2518 unsigned PriorGeneration = 0;
2519 if (getContext().getLangOpts().Modules)
2520 PriorGeneration = IdentifierGeneration[&II];
2526 if (!loadGlobalIndex()) {
2527 if (GlobalIndex->lookupIdentifier(II.
getName(), Hits)) {
2532 IdentifierLookupVisitor Visitor(II.
getName(), PriorGeneration,
2533 NumIdentifierLookups,
2534 NumIdentifierLookupHits);
2535 ModuleMgr.visit(Visitor, HitsPtr);
2536 markIdentifierUpToDate(&II);
2546 if (getContext().getLangOpts().Modules)
2547 IdentifierGeneration[II] = getGeneration();
2551 const PendingMacroInfo &PMInfo) {
2556 if (llvm::Error Err =
2558 Error(std::move(Err));
2562 struct ModuleMacroRecord {
2575 Cursor.advance(BitstreamCursor::AF_DontPopBlockAtEnd);
2577 Error(MaybeEntry.takeError());
2580 llvm::BitstreamEntry Entry = MaybeEntry.get();
2582 if (Entry.Kind != llvm::BitstreamEntry::Record) {
2583 Error(
"malformed block record in AST file");
2590 Error(MaybePP.takeError());
2598 ModuleMacros.push_back(ModuleMacroRecord());
2599 auto &Info = ModuleMacros.back();
2600 Info.SubModID = getGlobalSubmoduleID(M,
Record[0]);
2601 Info.MI = getMacro(getGlobalMacroID(M,
Record[1]));
2602 for (
int I = 2, N =
Record.size(); I != N; ++I)
2603 Info.Overrides.push_back(getGlobalSubmoduleID(M,
Record[I]));
2608 Error(
"malformed block record in AST file");
2619 std::reverse(ModuleMacros.begin(), ModuleMacros.end());
2621 for (
auto &MMR : ModuleMacros) {
2623 for (
unsigned ModID : MMR.Overrides) {
2624 Module *Mod = getSubmodule(ModID);
2625 auto *
Macro = PP.getModuleMacro(Mod, II);
2626 assert(
Macro &&
"missing definition for overridden macro");
2627 Overrides.push_back(
Macro);
2630 bool Inserted =
false;
2631 Module *Owner = getSubmodule(MMR.SubModID);
2632 PP.addModuleMacro(Owner, II, MMR.MI, Overrides, Inserted);
2643 unsigned Idx = 0, N =
Record.size();
2651 MD = PP.AllocateDefMacroDirective(MI,
Loc);
2655 MD = PP.AllocateUndefMacroDirective(
Loc);
2658 bool isPublic =
Record[Idx++];
2659 MD = PP.AllocateVisibilityMacroDirective(
Loc, isPublic);
2671 PP.setLoadedMacroDirective(II, Earliest, Latest);
2674bool ASTReader::shouldDisableValidationForFile(
2697static std::pair<StringRef, StringRef>
2699 const StringRef InputBlob) {
2700 uint16_t AsRequestedLength =
Record[7];
2701 return {InputBlob.substr(0, AsRequestedLength),
2702 InputBlob.substr(AsRequestedLength)};
2720 consumeError(std::move(Err));
2726 consumeError(MaybeCode.takeError());
2728 unsigned Code = MaybeCode.get();
2734 "invalid record type for input file");
2737 consumeError(
Maybe.takeError());
2740 assert(
Record[0] == ID &&
"Bogus stored ID or offset");
2748 auto [UnresolvedFilenameAsRequested, UnresolvedFilename] =
2752 ? UnresolvedFilenameAsRequested
2753 : UnresolvedFilename;
2757 consumeError(MaybeEntry.takeError());
2758 llvm::BitstreamEntry Entry = MaybeEntry.get();
2759 assert(Entry.Kind == llvm::BitstreamEntry::Record &&
2760 "expected record type for input file hash");
2765 "invalid record type for input file hash");
2768 consumeError(
Maybe.takeError());
2797 consumeError(std::move(Err));
2813 PP.getHeaderSearchInfo().getHeaderSearchOpts();
2826 if ((Overridden || Transient || SkipChecks) && !
File)
2831 std::string ErrorStr =
"could not find file '";
2833 ErrorStr +=
"' referenced by AST file '";
2849 if ((!Overridden && !Transient) && !SkipChecks &&
2850 SM.isFileOverridden(*
File)) {
2864 enum ModificationKind {
2870 std::optional<int64_t> Old = std::nullopt;
2871 std::optional<int64_t>
New = std::nullopt;
2873 auto HasInputContentChanged = [&](Change OriginalChange) {
2874 assert(ValidateASTInputFilesContent &&
2875 "We should only check the content of the inputs with "
2876 "ValidateASTInputFilesContent enabled.");
2878 if (StoredContentHash == 0)
2879 return OriginalChange;
2882 if (!MemBuffOrError) {
2884 return OriginalChange;
2885 std::string ErrorStr =
"could not get buffer for file '";
2886 ErrorStr +=
File->getName();
2889 return OriginalChange;
2892 auto ContentHash = xxh3_64bits(MemBuffOrError.get()->getBuffer());
2893 if (StoredContentHash ==
static_cast<uint64_t>(ContentHash))
2894 return Change{Change::None};
2896 return Change{Change::Content};
2898 auto HasInputFileChanged = [&]() {
2899 if (StoredSize !=
File->getSize())
2900 return Change{Change::Size, StoredSize,
File->getSize()};
2901 if (!shouldDisableValidationForFile(F) && StoredTime &&
2902 StoredTime !=
File->getModificationTime()) {
2903 Change MTimeChange = {Change::ModTime, StoredTime,
2904 File->getModificationTime()};
2908 if (ValidateASTInputFilesContent)
2909 return HasInputContentChanged(MTimeChange);
2913 return Change{Change::None};
2916 bool IsOutOfDate =
false;
2917 auto FileChange = SkipChecks ? Change{Change::None} : HasInputFileChanged();
2923 FileChange = HasInputContentChanged(FileChange);
2929 if (!StoredTime && ValidateASTInputFilesContent &&
2930 FileChange.Kind == Change::None)
2931 FileChange = HasInputContentChanged(FileChange);
2934 if (!Overridden && FileChange.Kind != Change::None) {
2938 while (!ImportStack.back()->ImportedBy.empty())
2939 ImportStack.push_back(ImportStack.back()->ImportedBy[0]);
2942 StringRef TopLevelASTFileName(ImportStack.back()->FileName);
2943 Diag(diag::err_fe_ast_file_modified)
2945 << TopLevelASTFileName << FileChange.Kind
2946 << (FileChange.Old && FileChange.New)
2947 << llvm::itostr(FileChange.Old.value_or(0))
2948 << llvm::itostr(FileChange.New.value_or(0));
2951 if (ImportStack.size() > 1) {
2952 Diag(diag::note_ast_file_required_by)
2953 << *
Filename << ImportStack[0]->FileName;
2954 for (
unsigned I = 1; I < ImportStack.size(); ++I)
2955 Diag(diag::note_ast_file_required_by)
2956 << ImportStack[I - 1]->FileName << ImportStack[I]->FileName;
2959 Diag(diag::note_ast_file_rebuild_required) << TopLevelASTFileName;
2974ASTReader::TemporarilyOwnedStringRef
2980ASTReader::TemporarilyOwnedStringRef
2983 assert(Buf.capacity() != 0 &&
"Overlapping ResolveImportedPath calls");
2985 if (Prefix.empty() ||
Path.empty() || llvm::sys::path::is_absolute(
Path) ||
2986 Path ==
"<built-in>" ||
Path ==
"<command line>")
2990 llvm::sys::path::append(Buf, Prefix,
Path);
2991 StringRef ResolvedPath{Buf.data(), Buf.size()};
2992 return {ResolvedPath, Buf};
2998 return ResolveImportedPathAndAllocate(Buf,
P, ModF.
BaseDirectory);
3004 auto ResolvedPath = ResolveImportedPath(Buf,
P, Prefix);
3005 return ResolvedPath->str();
3020 llvm_unreachable(
"unknown ASTReadResult");
3024 BitstreamCursor &Stream, StringRef
Filename,
3025 unsigned ClientLoadCapabilities,
bool AllowCompatibleConfigurationMismatch,
3029 consumeError(std::move(Err));
3040 consumeError(MaybeEntry.takeError());
3043 llvm::BitstreamEntry Entry = MaybeEntry.get();
3045 switch (Entry.Kind) {
3046 case llvm::BitstreamEntry::Error:
3047 case llvm::BitstreamEntry::SubBlock:
3050 case llvm::BitstreamEntry::EndBlock:
3053 case llvm::BitstreamEntry::Record:
3061 if (!MaybeRecordType) {
3063 consumeError(MaybeRecordType.takeError());
3068 bool Complain = (ClientLoadCapabilities & ARR_ConfigurationMismatch) == 0;
3070 AllowCompatibleConfigurationMismatch))
3071 Result = ConfigurationMismatch;
3076 bool Complain = (ClientLoadCapabilities & ARR_ConfigurationMismatch) == 0;
3078 AllowCompatibleConfigurationMismatch))
3079 Result = ConfigurationMismatch;
3084 bool Complain = (ClientLoadCapabilities & ARR_ConfigurationMismatch) == 0;
3086 AllowCompatibleConfigurationMismatch))
3087 Result = ConfigurationMismatch;
3092 bool Complain = (ClientLoadCapabilities & ARR_ConfigurationMismatch) == 0;
3093 if (!AllowCompatibleConfigurationMismatch &&
3094 ParseFileSystemOptions(
Record, Complain, Listener))
3095 Result = ConfigurationMismatch;
3100 bool Complain = (ClientLoadCapabilities & ARR_ConfigurationMismatch) == 0;
3101 if (!AllowCompatibleConfigurationMismatch &&
3103 Result = ConfigurationMismatch;
3108 bool Complain = (ClientLoadCapabilities & ARR_ConfigurationMismatch) == 0;
3109 if (!AllowCompatibleConfigurationMismatch &&
3111 SuggestedPredefines))
3112 Result = ConfigurationMismatch;
3122 unsigned ClientLoadCapabilities) {
3123 BitstreamCursor &Stream = F.
Stream;
3126 Error(std::move(Err));
3136 bool HasReadUnhashedControlBlock =
false;
3137 auto readUnhashedControlBlockOnce = [&]() {
3138 if (!HasReadUnhashedControlBlock) {
3139 HasReadUnhashedControlBlock =
true;
3140 if (ASTReadResult
Result =
3141 readUnhashedControlBlock(F, ImportedBy, ClientLoadCapabilities))
3147 bool DisableValidation = shouldDisableValidationForFile(F);
3151 unsigned NumInputs = 0;
3152 unsigned NumUserInputs = 0;
3153 StringRef BaseDirectoryAsWritten;
3157 Error(MaybeEntry.takeError());
3160 llvm::BitstreamEntry Entry = MaybeEntry.get();
3162 switch (Entry.Kind) {
3163 case llvm::BitstreamEntry::Error:
3164 Error(
"malformed block record in AST file");
3166 case llvm::BitstreamEntry::EndBlock: {
3169 if (ASTReadResult
Result = readUnhashedControlBlockOnce())
3174 PP.getHeaderSearchInfo().getHeaderSearchOpts();
3181 bool Complain = (ClientLoadCapabilities & ARR_OutOfDate) == 0;
3187 unsigned N = ValidateSystemInputs ? NumInputs : NumUserInputs;
3191 N = ForceValidateUserInputs ? NumUserInputs : 0;
3193 for (
unsigned I = 0; I < N; ++I) {
3194 InputFile IF = getInputFile(F, I+1, Complain);
3206 for (
unsigned I = 0; I < N; ++I) {
3207 bool IsSystem = I >= NumUserInputs;
3209 auto FilenameAsRequested = ResolveImportedPath(
3212 *FilenameAsRequested, IsSystem, FI.
Overridden,
3220 case llvm::BitstreamEntry::SubBlock:
3224 if (llvm::Error Err = Stream.SkipBlock()) {
3225 Error(std::move(Err));
3229 Error(
"malformed block record in AST file");
3239 if (Listener && !ImportedBy) {
3245 bool AllowCompatibleConfigurationMismatch =
3249 ReadOptionsBlock(Stream, F.
FileName, ClientLoadCapabilities,
3250 AllowCompatibleConfigurationMismatch, *Listener,
3251 SuggestedPredefines);
3253 Error(
"malformed block record in AST file");
3257 if (DisableValidation ||
3258 (AllowConfigurationMismatch &&
Result == ConfigurationMismatch))
3266 }
else if (llvm::Error Err = Stream.SkipBlock()) {
3267 Error(std::move(Err));
3273 if (llvm::Error Err = Stream.SkipBlock()) {
3274 Error(std::move(Err));
3280 case llvm::BitstreamEntry::Record:
3289 Stream.readRecord(Entry.ID,
Record, &Blob);
3290 if (!MaybeRecordType) {
3291 Error(MaybeRecordType.takeError());
3297 if ((ClientLoadCapabilities & ARR_VersionMismatch) == 0)
3299 : diag::err_ast_file_version_too_new)
3304 bool hasErrors =
Record[7];
3305 if (hasErrors && !DisableValidation) {
3308 if ((ClientLoadCapabilities & ARR_TreatModuleWithErrorsAsOutOfDate) &&
3309 canRecoverFromOutOfDate(F.
FileName, ClientLoadCapabilities))
3312 if (!AllowASTWithCompilerErrors) {
3313 Diag(diag::err_ast_file_with_compiler_errors)
3319 Diags.ErrorOccurred =
true;
3320 Diags.UncompilableErrorOccurred =
true;
3321 Diags.UnrecoverableErrorOccurred =
true;
3334 StringRef ASTBranch = Blob;
3335 if (StringRef(CurBranch) != ASTBranch && !DisableValidation) {
3336 if ((ClientLoadCapabilities & ARR_VersionMismatch) == 0)
3337 Diag(diag::err_ast_file_different_branch)
3349 if (ASTReadResult
Result = readUnhashedControlBlockOnce())
3359 auto [ImportLoc, ImportModuleFileIndex] =
3360 ReadUntranslatedSourceLocation(
Record[Idx++]);
3362 assert(ImportModuleFileIndex == 0);
3364 StringRef ImportedName = ReadStringBlob(
Record, Idx, Blob);
3366 bool IsImportingStdCXXModule =
Record[Idx++];
3368 off_t StoredSize = 0;
3369 time_t StoredModTime = 0;
3371 std::string ImportedFile;
3372 std::string StoredFile;
3373 bool IgnoreImportedByNote =
false;
3382 ImportedFile = PP.getHeaderSearchInfo().getPrebuiltModuleFileName(
3383 ImportedName, !IsImportingStdCXXModule);
3385 if (IsImportingStdCXXModule && ImportedFile.empty()) {
3386 Diag(diag::err_failed_to_find_module_file) << ImportedName;
3390 if (!IsImportingStdCXXModule) {
3391 StoredSize = (off_t)
Record[Idx++];
3392 StoredModTime = (time_t)
Record[Idx++];
3396 SignatureBytes.end());
3401 StoredFile = ReadPathBlob(BaseDirectoryAsWritten,
Record, Idx, Blob);
3402 if (ImportedFile.empty()) {
3403 ImportedFile = StoredFile;
3404 }
else if (!getDiags().isIgnored(
3405 diag::warn_module_file_mapping_mismatch,
3406 CurrentImportLoc)) {
3407 auto ImportedFileRef =
3408 PP.getFileManager().getOptionalFileRef(ImportedFile);
3409 auto StoredFileRef =
3410 PP.getFileManager().getOptionalFileRef(StoredFile);
3411 if ((ImportedFileRef && StoredFileRef) &&
3412 (*ImportedFileRef != *StoredFileRef)) {
3413 Diag(diag::warn_module_file_mapping_mismatch)
3414 << ImportedFile << StoredFile;
3415 Diag(diag::note_module_file_imported_by)
3417 IgnoreImportedByNote =
true;
3424 unsigned Capabilities = ClientLoadCapabilities;
3425 if ((ClientLoadCapabilities & ARR_OutOfDate) == 0)
3426 Capabilities &= ~ARR_Missing;
3429 auto Result = ReadASTCore(ImportedFile, ImportedKind, ImportLoc, &F,
3430 Loaded, StoredSize, StoredModTime,
3431 StoredSignature, Capabilities);
3436 if (IsImportingStdCXXModule) {
3437 if (
const auto *Imported =
3438 getModuleManager().lookupByFileName(ImportedFile);
3439 Imported !=
nullptr && Imported->ModuleName != ImportedName) {
3440 Diag(diag::err_failed_to_find_module_file) << ImportedName;
3446 bool recompilingFinalized =
Result == OutOfDate &&
3447 (Capabilities & ARR_OutOfDate) &&
3450 .getInMemoryModuleCache()
3452 if (!IgnoreImportedByNote &&
3454 Diag(diag::note_module_file_imported_by)
3458 case Failure:
return Failure;
3461 case OutOfDate:
return OutOfDate;
3463 case ConfigurationMismatch:
return ConfigurationMismatch;
3464 case HadErrors:
return HadErrors;
3483 Diag(diag::remark_module_import)
3485 << (ImportedBy ? StringRef(ImportedBy->
ModuleName) : StringRef());
3491 if (ASTReadResult
Result = readUnhashedControlBlockOnce())
3499 BaseDirectoryAsWritten = Blob;
3501 "MODULE_DIRECTORY found before MODULE_NAME");
3503 if (!PP.getPreprocessorOpts().ModulesCheckRelocated)
3507 Module *M = PP.getHeaderSearchInfo().lookupModule(
3514 if (!
bool(PP.getPreprocessorOpts().DisablePCHOrModuleValidation &
3517 auto BuildDir = PP.getFileManager().getOptionalDirectoryRef(Blob);
3518 if (!BuildDir || *BuildDir != M->
Directory) {
3519 if (!canRecoverFromOutOfDate(F.
FileName, ClientLoadCapabilities))
3520 Diag(diag::err_imported_module_relocated)
3531 if (ASTReadResult
Result =
3532 ReadModuleMapFileBlock(
Record, F, ImportedBy, ClientLoadCapabilities))
3538 NumUserInputs =
Record[1];
3540 (
const llvm::support::unaligned_uint64_t *)Blob.data();
3549llvm::Error ASTReader::ReadASTBlock(
ModuleFile &F,
3550 unsigned ClientLoadCapabilities) {
3551 BitstreamCursor &Stream = F.
Stream;
3553 if (llvm::Error Err = Stream.EnterSubBlock(
AST_BLOCK_ID))
3562 return MaybeEntry.takeError();
3563 llvm::BitstreamEntry Entry = MaybeEntry.get();
3565 switch (Entry.Kind) {
3566 case llvm::BitstreamEntry::Error:
3567 return llvm::createStringError(
3568 std::errc::illegal_byte_sequence,
3569 "error at end of module block in AST file");
3570 case llvm::BitstreamEntry::EndBlock:
3582 return llvm::Error::success();
3583 case llvm::BitstreamEntry::SubBlock:
3591 if (llvm::Error Err = Stream.SkipBlock())
3593 if (llvm::Error Err = ReadBlockAbbrevs(
3600 if (!PP.getExternalSource())
3601 PP.setExternalSource(
this);
3603 if (llvm::Error Err = Stream.SkipBlock())
3605 if (llvm::Error Err =
3614 if (llvm::Error Err = Stream.SkipBlock()) {
3623 if (!PP.getPreprocessingRecord())
3624 PP.createPreprocessingRecord();
3625 if (!PP.getPreprocessingRecord()->getExternalSource())
3626 PP.getPreprocessingRecord()->SetExternalSource(*
this);
3630 if (llvm::Error Err = ReadSourceManagerBlock(F))
3635 if (llvm::Error Err = ReadSubmoduleBlock(F, ClientLoadCapabilities))
3640 BitstreamCursor
C = Stream;
3642 if (llvm::Error Err = Stream.SkipBlock())
3646 CommentsCursors.push_back(std::make_pair(
C, &F));
3651 if (llvm::Error Err = Stream.SkipBlock())
3657 case llvm::BitstreamEntry::Record:
3666 Stream.readRecord(Entry.ID,
Record, &Blob);
3667 if (!MaybeRecordType)
3668 return MaybeRecordType.takeError();
3700 return llvm::createStringError(
3701 std::errc::illegal_byte_sequence,
3702 "duplicate TYPE_OFFSET record in AST file");
3715 return llvm::createStringError(
3716 std::errc::illegal_byte_sequence,
3717 "duplicate DECL_OFFSET record in AST file");
3729 DeclContext *TU = ContextObj->getTranslationUnitDecl();
3730 LexicalContents Contents(
3732 static_cast<unsigned int>(Blob.size() /
sizeof(
DeclID)));
3733 TULexicalDecls.push_back(std::make_pair(&F, Contents));
3741 auto *
Data = (
const unsigned char*)Blob.data();
3742 PendingVisibleUpdates[
ID].push_back(UpdateData{&F,
Data});
3745 if (
Decl *
D = GetExistingDecl(ID))
3746 PendingUpdateRecords.push_back(
3747 PendingUpdateRecord(ID,
D,
false));
3754 auto *
Data = (
const unsigned char *)Blob.data();
3755 PendingModuleLocalVisibleUpdates[
ID].push_back(UpdateData{&F,
Data});
3758 if (
Decl *
D = GetExistingDecl(ID))
3759 PendingUpdateRecords.push_back(
3760 PendingUpdateRecord(ID,
D,
false));
3769 auto *
Data = (
const unsigned char *)Blob.data();
3770 TULocalUpdates[
ID].push_back(UpdateData{&F,
Data});
3773 if (
Decl *
D = GetExistingDecl(ID))
3774 PendingUpdateRecords.push_back(
3775 PendingUpdateRecord(ID,
D,
false));
3782 auto *
Data = (
const unsigned char *)Blob.data();
3783 PendingSpecializationsUpdates[
ID].push_back(UpdateData{&F,
Data});
3786 if (
Decl *
D = GetExistingDecl(ID))
3787 PendingUpdateRecords.push_back(
3788 PendingUpdateRecord(ID,
D,
false));
3795 auto *
Data = (
const unsigned char *)Blob.data();
3796 PendingPartialSpecializationsUpdates[
ID].push_back(UpdateData{&F,
Data});
3799 if (
Decl *
D = GetExistingDecl(ID))
3800 PendingUpdateRecords.push_back(
3801 PendingUpdateRecord(ID,
D,
false));
3807 reinterpret_cast<const unsigned char *
>(Blob.data());
3815 PP.getIdentifierTable().setExternalIdentifierLookup(
this);
3821 return llvm::createStringError(
3822 std::errc::illegal_byte_sequence,
3823 "duplicate IDENTIFIER_OFFSET record in AST file");
3829 IdentifiersLoaded.resize(IdentifiersLoaded.size()
3841 for (
unsigned I = 0, N =
Record.size(); I != N; )
3842 EagerlyDeserializedDecls.push_back(ReadDeclID(F,
Record, I));
3849 getContext().getLangOpts().BuildingPCHWithObjectFile)
3850 for (
unsigned I = 0, N =
Record.size(); I != N; )
3851 EagerlyDeserializedDecls.push_back(ReadDeclID(F,
Record, I));
3855 if (SpecialTypes.empty()) {
3856 for (
unsigned I = 0, N =
Record.size(); I != N; ++I)
3857 SpecialTypes.push_back(getGlobalTypeID(F,
Record[I]));
3864 if (SpecialTypes.size() !=
Record.size())
3865 return llvm::createStringError(std::errc::illegal_byte_sequence,
3866 "invalid special-types record");
3868 for (
unsigned I = 0, N =
Record.size(); I != N; ++I) {
3870 if (!SpecialTypes[I])
3871 SpecialTypes[I] =
ID;
3878 TotalNumStatements +=
Record[0];
3879 TotalNumMacros +=
Record[1];
3880 TotalLexicalDeclContexts +=
Record[2];
3881 TotalVisibleDeclContexts +=
Record[3];
3882 TotalModuleLocalVisibleDeclContexts +=
Record[4];
3883 TotalTULocalVisibleDeclContexts +=
Record[5];
3887 for (
unsigned I = 0, N =
Record.size(); I != N; )
3888 UnusedFileScopedDecls.push_back(ReadDeclID(F,
Record, I));
3892 for (
unsigned I = 0, N =
Record.size(); I != N; )
3893 DelegatingCtorDecls.push_back(ReadDeclID(F,
Record, I));
3897 if (
Record.size() % 3 != 0)
3898 return llvm::createStringError(std::errc::illegal_byte_sequence,
3899 "invalid weak identifiers record");
3903 WeakUndeclaredIdentifiers.clear();
3906 for (
unsigned I = 0, N =
Record.size(); I < N; ) {
3907 WeakUndeclaredIdentifiers.push_back(
3908 getGlobalIdentifierID(F,
Record[I++]));
3909 WeakUndeclaredIdentifiers.push_back(
3910 getGlobalIdentifierID(F,
Record[I++]));
3911 WeakUndeclaredIdentifiers.push_back(
3912 ReadSourceLocation(F,
Record, I).getRawEncoding());
3919 unsigned LocalBaseSelectorID =
Record[1];
3925 GlobalSelectorMap.insert(std::make_pair(getTotalNumSelectors()+1, &F));
3930 std::make_pair(LocalBaseSelectorID,
3942 = ASTSelectorLookupTable::Create(
3946 TotalNumMethodPoolEntries +=
Record[1];
3951 for (
unsigned Idx = 0, N =
Record.size() - 1; Idx < N; ) {
3952 ReferencedSelectorsData.push_back(getGlobalSelectorID(F,
3954 ReferencedSelectorsData.push_back(ReadSourceLocation(F,
Record, Idx).
3963 PP.setPreambleRecordedPragmaAssumeNonNullLoc(
3964 ReadSourceLocation(F,
Record, Idx));
3972 while (Idx <
Record.size())
3973 SrcLocs.push_back(ReadSourceLocation(F,
Record, Idx));
3974 PP.setDeserializedSafeBufferOptOutMap(SrcLocs);
3981 unsigned Idx = 0, End =
Record.size() - 1;
3982 bool ReachedEOFWhileSkipping =
Record[Idx++];
3983 std::optional<Preprocessor::PreambleSkipInfo> SkipInfo;
3984 if (ReachedEOFWhileSkipping) {
3987 bool FoundNonSkipPortion =
Record[Idx++];
3988 bool FoundElse =
Record[Idx++];
3990 SkipInfo.emplace(HashToken, IfTokenLoc, FoundNonSkipPortion,
3991 FoundElse, ElseLoc);
3995 auto Loc = ReadSourceLocation(F,
Record, Idx);
3996 bool WasSkipping =
Record[Idx++];
3997 bool FoundNonSkip =
Record[Idx++];
3998 bool FoundElse =
Record[Idx++];
3999 ConditionalStack.push_back(
4000 {
Loc, WasSkipping, FoundNonSkip, FoundElse});
4002 PP.setReplayablePreambleConditionalStack(ConditionalStack, SkipInfo);
4007 if (!
Record.empty() && Listener)
4026 SourceMgr.noteSLocAddressSpaceUsage(Diags);
4027 return llvm::createStringError(std::errc::invalid_argument,
4028 "ran out of source locations");
4033 unsigned RangeStart =
4035 GlobalSLocEntryMap.insert(std::make_pair(RangeStart, &F));
4040 GlobalSLocOffsetMap.insert(
4042 - SLocSpaceSize,&F));
4053 ParseLineTable(F,
Record);
4057 for (
unsigned I = 0, N =
Record.size(); I != N; )
4058 ExtVectorDecls.push_back(ReadDeclID(F,
Record, I));
4062 if (
Record.size() % 3 != 0)
4063 return llvm::createStringError(std::errc::illegal_byte_sequence,
4064 "Invalid VTABLE_USES record");
4071 for (
unsigned Idx = 0, N =
Record.size(); Idx != N; ) {
4072 VTableUses.push_back(
4073 {ReadDeclID(F,
Record, Idx),
4074 ReadSourceLocation(F,
Record, Idx).getRawEncoding(),
4081 if (
Record.size() % 2 != 0)
4082 return llvm::createStringError(
4083 std::errc::illegal_byte_sequence,
4084 "Invalid PENDING_IMPLICIT_INSTANTIATIONS block");
4086 for (
unsigned I = 0, N =
Record.size(); I != N; ) {
4087 PendingInstantiations.push_back(
4088 {ReadDeclID(F,
Record, I),
4089 ReadSourceLocation(F,
Record, I).getRawEncoding()});
4095 return llvm::createStringError(std::errc::illegal_byte_sequence,
4096 "Invalid SEMA_DECL_REFS block");
4097 for (
unsigned I = 0, N =
Record.size(); I != N; )
4098 SemaDeclRefs.push_back(ReadDeclID(F,
Record, I));
4106 unsigned LocalBasePreprocessedEntityID =
Record[0];
4108 unsigned StartingID;
4109 if (!PP.getPreprocessingRecord())
4110 PP.createPreprocessingRecord();
4111 if (!PP.getPreprocessingRecord()->getExternalSource())
4112 PP.getPreprocessingRecord()->SetExternalSource(*
this);
4114 = PP.getPreprocessingRecord()
4121 GlobalPreprocessedEntityMap.insert(std::make_pair(StartingID, &F));
4126 std::make_pair(LocalBasePreprocessedEntityID,
4138 if (!PP.getPreprocessingRecord())
4139 PP.createPreprocessingRecord();
4140 if (!PP.getPreprocessingRecord()->getExternalSource())
4141 PP.getPreprocessingRecord()->SetExternalSource(*
this);
4146 GlobalSkippedRangeMap.insert(
4152 if (
Record.size() % 2 != 0)
4153 return llvm::createStringError(
4154 std::errc::illegal_byte_sequence,
4155 "invalid DECL_UPDATE_OFFSETS block in AST file");
4156 for (
unsigned I = 0, N =
Record.size(); I != N; ) {
4158 DeclUpdateOffsets[
ID].push_back(std::make_pair(&F,
Record[I++]));
4162 if (
Decl *
D = GetExistingDecl(ID))
4163 PendingUpdateRecords.push_back(
4164 PendingUpdateRecord(ID,
D,
false));
4169 if (
Record.size() % 5 != 0)
4170 return llvm::createStringError(
4171 std::errc::illegal_byte_sequence,
4172 "invalid DELAYED_NAMESPACE_LEXICAL_VISIBLE_RECORD block in AST "
4174 for (
unsigned I = 0, N =
Record.size(); I != N; ) {
4178 assert(BaseOffset &&
"Invalid DeclsBlockStartOffset for module file!");
4181 LocalLexicalOffset ? BaseOffset + LocalLexicalOffset : 0;
4184 LocalVisibleOffset ? BaseOffset + LocalVisibleOffset : 0;
4187 LocalModuleLocalOffset ? BaseOffset + LocalModuleLocalOffset : 0;
4190 TULocalLocalOffset ? BaseOffset + TULocalLocalOffset : 0;
4192 DelayedNamespaceOffsetMap[
ID] = {
4193 {VisibleOffset, TULocalOffset, ModuleLocalOffset}, LexicalOffset};
4195 assert(!GetExistingDecl(ID) &&
4196 "We shouldn't load the namespace in the front of delayed "
4197 "namespace lexical and visible block");
4203 for (
unsigned I = 0, N =
Record.size(); I != N; ) {
4205 auto &RelatedDecls = RelatedDeclsMap[
ID];
4206 unsigned NN =
Record[I++];
4207 RelatedDecls.reserve(NN);
4208 for (
unsigned II = 0; II < NN; II++)
4209 RelatedDecls.push_back(ReadDeclID(F,
Record, I));
4215 return llvm::createStringError(
4216 std::errc::illegal_byte_sequence,
4217 "duplicate OBJC_CATEGORIES_MAP record in AST file");
4230 CUDASpecialDeclRefs.clear();
4231 for (
unsigned I = 0, N =
Record.size(); I != N; )
4232 CUDASpecialDeclRefs.push_back(ReadDeclID(F,
Record, I));
4244 PP.getHeaderSearchInfo().SetExternalSource(
this);
4245 if (!PP.getHeaderSearchInfo().getExternalLookup())
4246 PP.getHeaderSearchInfo().SetExternalLookup(
this);
4252 FPPragmaOptions.swap(
Record);
4256 for (
unsigned I = 0, N =
Record.size(); I != N; )
4257 DeclsWithEffectsToVerify.push_back(ReadDeclID(F,
Record, I));
4261 for (
unsigned I = 0,
E =
Record.size(); I !=
E; ) {
4262 auto Name = ReadString(
Record, I);
4263 auto &OptInfo = OpenCLExtensions.OptMap[Name];
4264 OptInfo.Supported =
Record[I++] != 0;
4265 OptInfo.Enabled =
Record[I++] != 0;
4266 OptInfo.WithPragma =
Record[I++] != 0;
4267 OptInfo.Avail =
Record[I++];
4268 OptInfo.Core =
Record[I++];
4269 OptInfo.Opt =
Record[I++];
4274 for (
unsigned I = 0, N =
Record.size(); I != N; )
4275 TentativeDefinitions.push_back(ReadDeclID(F,
Record, I));
4279 for (
unsigned I = 0, N =
Record.size(); I != N; )
4280 KnownNamespaces.push_back(ReadDeclID(F,
Record, I));
4284 if (
Record.size() % 2 != 0)
4285 return llvm::createStringError(std::errc::illegal_byte_sequence,
4286 "invalid undefined-but-used record");
4287 for (
unsigned I = 0, N =
Record.size(); I != N; ) {
4288 UndefinedButUsed.push_back(
4289 {ReadDeclID(F,
Record, I),
4290 ReadSourceLocation(F,
Record, I).getRawEncoding()});
4295 for (
unsigned I = 0, N =
Record.size(); I != N;) {
4296 DelayedDeleteExprs.push_back(ReadDeclID(F,
Record, I).getRawValue());
4298 DelayedDeleteExprs.push_back(Count);
4299 for (uint64_t
C = 0;
C < Count; ++
C) {
4300 DelayedDeleteExprs.push_back(ReadSourceLocation(F,
Record, I).getRawEncoding());
4301 bool IsArrayForm =
Record[I++] == 1;
4302 DelayedDeleteExprs.push_back(IsArrayForm);
4309 getContext().getLangOpts().BuildingPCHWithObjectFile)
4310 for (
unsigned I = 0, N =
Record.size(); I != N;)
4311 VTablesToEmit.push_back(ReadDeclID(F,
Record, I));
4319 for (
unsigned I = 0, N =
Record.size(); I != N; ) {
4320 unsigned GlobalID = getGlobalSubmoduleID(F,
Record[I++]);
4323 PendingImportedModules.push_back(ImportedSubmodule(GlobalID,
Loc));
4324 if (DeserializationListener)
4325 DeserializationListener->ModuleImportRead(GlobalID,
Loc);
4333 return llvm::createStringError(
4334 std::errc::illegal_byte_sequence,
4335 "duplicate MACRO_OFFSET record in AST file");
4338 unsigned LocalBaseMacroID =
Record[1];
4344 GlobalMacroMap.insert(std::make_pair(getTotalNumMacros() + 1, &F));
4348 std::make_pair(LocalBaseMacroID,
4357 LateParsedTemplates.emplace_back(
4358 std::piecewise_construct, std::forward_as_tuple(&F),
4364 return llvm::createStringError(std::errc::illegal_byte_sequence,
4365 "invalid pragma optimize record");
4366 OptimizeOffPragmaLocation = ReadSourceLocation(F,
Record[0]);
4371 return llvm::createStringError(std::errc::illegal_byte_sequence,
4372 "invalid pragma ms_struct record");
4373 PragmaMSStructState =
Record[0];
4378 return llvm::createStringError(
4379 std::errc::illegal_byte_sequence,
4380 "invalid pragma pointers to members record");
4381 PragmaMSPointersToMembersState =
Record[0];
4382 PointersToMembersPragmaLocation = ReadSourceLocation(F,
Record[1]);
4386 for (
unsigned I = 0, N =
Record.size(); I != N; )
4387 UnusedLocalTypedefNameCandidates.push_back(ReadDeclID(F,
Record, I));
4392 return llvm::createStringError(std::errc::illegal_byte_sequence,
4393 "invalid cuda pragma options record");
4394 ForceHostDeviceDepth =
Record[0];
4399 return llvm::createStringError(std::errc::illegal_byte_sequence,
4400 "invalid pragma pack record");
4401 PragmaAlignPackCurrentValue = ReadAlignPackInfo(
Record[0]);
4402 PragmaAlignPackCurrentLocation = ReadSourceLocation(F,
Record[1]);
4403 unsigned NumStackEntries =
Record[2];
4406 PragmaAlignPackStack.clear();
4407 for (
unsigned I = 0; I < NumStackEntries; ++I) {
4408 PragmaAlignPackStackEntry Entry;
4409 Entry.Value = ReadAlignPackInfo(
Record[Idx++]);
4410 Entry.Location = ReadSourceLocation(F,
Record[Idx++]);
4411 Entry.PushLocation = ReadSourceLocation(F,
Record[Idx++]);
4412 PragmaAlignPackStrings.push_back(ReadString(
Record, Idx));
4413 Entry.SlotLabel = PragmaAlignPackStrings.back();
4414 PragmaAlignPackStack.push_back(Entry);
4421 return llvm::createStringError(std::errc::illegal_byte_sequence,
4422 "invalid pragma float control record");
4424 FpPragmaCurrentLocation = ReadSourceLocation(F,
Record[1]);
4425 unsigned NumStackEntries =
Record[2];
4428 FpPragmaStack.clear();
4429 for (
unsigned I = 0; I < NumStackEntries; ++I) {
4430 FpPragmaStackEntry Entry;
4432 Entry.Location = ReadSourceLocation(F,
Record[Idx++]);
4433 Entry.PushLocation = ReadSourceLocation(F,
Record[Idx++]);
4434 FpPragmaStrings.push_back(ReadString(
Record, Idx));
4435 Entry.SlotLabel = FpPragmaStrings.back();
4436 FpPragmaStack.push_back(Entry);
4442 for (
unsigned I = 0, N =
Record.size(); I != N; )
4443 DeclsToCheckForDeferredDiags.insert(ReadDeclID(F,
Record, I));
4449void ASTReader::ReadModuleOffsetMap(
ModuleFile &F)
const {
4464 assert(ImportedModuleVector.empty());
4466 while (
Data < DataEnd) {
4470 using namespace llvm::support;
4472 endian::readNext<uint8_t, llvm::endianness::little>(
Data));
4473 uint16_t Len = endian::readNext<uint16_t, llvm::endianness::little>(
Data);
4474 StringRef Name = StringRef((
const char*)
Data, Len);
4478 ? ModuleMgr.lookupByModuleName(Name)
4479 : ModuleMgr.lookupByFileName(Name));
4481 std::string Msg =
"refers to unknown module, cannot find ";
4482 Msg.append(std::string(Name));
4487 ImportedModuleVector.push_back(OM);
4490 endian::readNext<uint32_t, llvm::endianness::little>(
Data);
4491 uint32_t PreprocessedEntityIDOffset =
4492 endian::readNext<uint32_t, llvm::endianness::little>(
Data);
4494 endian::readNext<uint32_t, llvm::endianness::little>(
Data);
4496 endian::readNext<uint32_t, llvm::endianness::little>(
Data);
4499 RemapBuilder &Remap) {
4500 constexpr uint32_t None = std::numeric_limits<uint32_t>::max();
4502 Remap.insert(std::make_pair(Offset,
4503 static_cast<int>(BaseOffset - Offset)));
4506 mapOffset(MacroIDOffset, OM->
BaseMacroID, MacroRemap);
4508 PreprocessedEntityRemap);
4517 unsigned ClientLoadCapabilities) {
4526 "MODULE_NAME should come before MODULE_MAP_FILE");
4527 if (PP.getPreprocessorOpts().ModulesCheckRelocated &&
4533 auto &Map = PP.getHeaderSearchInfo().getModuleMap();
4535 M ? Map.getModuleMapFileForUniquing(M) : std::nullopt;
4537 if (!
bool(PP.getPreprocessorOpts().DisablePCHOrModuleValidation &
4540 if (!canRecoverFromOutOfDate(F.
FileName, ClientLoadCapabilities)) {
4541 if (
auto ASTFE = M ? M->
getASTFile() : std::nullopt) {
4544 << ASTFE->getName();
4548 Diag(diag::err_imported_module_not_found)
4556 Diag(diag::note_imported_by_pch_module_not_found)
4563 assert(M && M->
Name == F.
ModuleName &&
"found module with different name");
4567 if (!StoredModMap || *StoredModMap != ModMap) {
4568 assert(ModMap &&
"found module is missing module map file");
4570 "top-level import should be verified");
4572 if (!canRecoverFromOutOfDate(F.
FileName, ClientLoadCapabilities))
4573 Diag(diag::err_imported_module_modmap_changed)
4580 for (
unsigned I = 0, N =
Record[Idx++]; I < N; ++I) {
4585 if (!canRecoverFromOutOfDate(F.
FileName, ClientLoadCapabilities))
4586 Error(
"could not find file '" +
Filename +
"' referenced by AST file");
4589 AdditionalStoredMaps.insert(*SF);
4594 if (
auto *AdditionalModuleMaps = Map.getAdditionalModuleMapFiles(M)) {
4598 if (!AdditionalStoredMaps.erase(ModMap)) {
4599 if (!canRecoverFromOutOfDate(F.
FileName, ClientLoadCapabilities))
4600 Diag(diag::err_module_different_modmap)
4610 if (!canRecoverFromOutOfDate(F.
FileName, ClientLoadCapabilities))
4611 Diag(diag::err_module_different_modmap)
4625 SemaObjC::GlobalMethodPool::iterator Known =
4632 : Known->second.second;
4634 for (
ObjCMethodList *List = &Start; List; List = List->getNext()) {
4636 if (List->getMethod() ==
Method) {
4644 if (List->getNext())
4645 List->setMethod(List->getNext()->getMethod());
4653 for (
Decl *
D : Names) {
4657 if (wasHidden && SemaObj) {
4670 Stack.push_back(Mod);
4671 while (!Stack.empty()) {
4672 Mod = Stack.pop_back_val();
4674 if (NameVisibility <= Mod->NameVisibility) {
4690 HiddenNamesMapType::iterator Hidden = HiddenNamesMap.find(Mod);
4691 if (Hidden != HiddenNamesMap.end()) {
4693 HiddenNamesMap.erase(Hidden);
4695 assert(!HiddenNamesMap.contains(Mod) &&
4696 "making names visible added hidden names");
4703 I = Exports.begin(),
E = Exports.end(); I !=
E; ++I) {
4705 if (
Visited.insert(Exported).second)
4706 Stack.push_back(Exported);
4721 getContext().mergeDefinitionIntoModule(
4724 PendingMergedDefinitionsToDeduplicate.insert(Def);
4733 if (TriedLoadingGlobalIndex || !UseGlobalIndex ||
4734 !PP.getLangOpts().Modules)
4738 TriedLoadingGlobalIndex =
true;
4739 StringRef ModuleCachePath
4740 = getPreprocessor().getHeaderSearchInfo().getModuleCachePath();
4741 std::pair<GlobalModuleIndex *, llvm::Error>
Result =
4743 if (llvm::Error Err = std::move(
Result.second)) {
4745 consumeError(std::move(Err));
4749 GlobalIndex.reset(
Result.first);
4750 ModuleMgr.setGlobalIndex(GlobalIndex.get());
4755 return PP.getLangOpts().Modules && UseGlobalIndex &&
4756 !hasGlobalIndex() && TriedLoadingGlobalIndex;
4767 consumeError(MaybeEntry.takeError());
4770 llvm::BitstreamEntry Entry = MaybeEntry.get();
4772 switch (Entry.Kind) {
4773 case llvm::BitstreamEntry::Error:
4774 case llvm::BitstreamEntry::EndBlock:
4777 case llvm::BitstreamEntry::Record:
4783 consumeError(Skipped.takeError());
4787 case llvm::BitstreamEntry::SubBlock:
4788 if (Entry.ID == BlockID) {
4789 if (llvm::Error Err = Cursor.EnterSubBlock(BlockID)) {
4791 consumeError(std::move(Err));
4798 if (llvm::Error Err = Cursor.SkipBlock()) {
4800 consumeError(std::move(Err));
4809 unsigned ClientLoadCapabilities,
4811 llvm::TimeTraceScope scope(
"ReadAST",
FileName);
4815 CurrentDeserializingModuleKind,
Type);
4821 unsigned PreviousGeneration = 0;
4823 PreviousGeneration = incrementGeneration(*ContextObj);
4825 unsigned NumModules = ModuleMgr.size();
4830 ClientLoadCapabilities)) {
4831 ModuleMgr.removeModules(ModuleMgr.begin() + NumModules);
4835 GlobalIndex.reset();
4836 ModuleMgr.setGlobalIndex(
nullptr);
4840 if (NewLoadedModuleFile && !Loaded.empty())
4841 *NewLoadedModuleFile = Loaded.back().Mod;
4852 for (ImportedModule &M : Loaded) {
4854 llvm::TimeTraceScope Scope2(
"Read Loaded AST", F.
ModuleName);
4857 if (llvm::Error Err = ReadASTBlock(F, ClientLoadCapabilities)) {
4858 Error(std::move(Err));
4864 Error(diag::err_module_file_missing_top_level_submodule, F.
FileName);
4870 if (llvm::Error Err = ReadExtensionBlock(F)) {
4871 Error(std::move(Err));
4884 for (ImportedModule &M : Loaded) {
4900 if (!PP.getLangOpts().CPlusPlus) {
4907 auto It = PP.getIdentifierTable().find(Key);
4908 if (It == PP.getIdentifierTable().end())
4917 II = &PP.getIdentifierTable().getOwn(Key);
4928 SetIdentifierInfo(ID, II);
4935 for (
auto &
Id : PP.getIdentifierTable())
4936 Id.second->setOutOfDate(
true);
4939 for (
const auto &Sel : SelectorGeneration)
4940 SelectorOutOfDate[Sel.first] =
true;
4944 for (ImportedModule &M : Loaded) {
4947 ModuleMgr.moduleFileAccepted(&F);
4956 F.
ImportLoc = TranslateSourceLocation(*M.ImportedBy, M.ImportLoc);
4960 for (
unsigned I = 0, N = UnresolvedModuleRefs.size(); I != N; ++I) {
4961 UnresolvedModuleRef &
Unresolved = UnresolvedModuleRefs[I];
4963 Module *ResolvedMod = getSubmodule(GlobalID);
4966 case UnresolvedModuleRef::Conflict:
4969 Conflict.
Other = ResolvedMod;
4971 Unresolved.Mod->Conflicts.push_back(Conflict);
4975 case UnresolvedModuleRef::Import:
4980 case UnresolvedModuleRef::Affecting:
4982 Unresolved.Mod->AffectingClangModules.insert(ResolvedMod);
4985 case UnresolvedModuleRef::Export:
4992 UnresolvedModuleRefs.clear();
4999 InitializeContext();
5004 if (DeserializationListener)
5005 DeserializationListener->ReaderInitialized(
this);
5007 ModuleFile &PrimaryModule = ModuleMgr.getPrimaryModule();
5022 for (
unsigned I = 0, N = ObjCClassesLoaded.size(); I != N; ++I) {
5023 loadObjCCategories(ObjCClassesLoaded[I]->getGlobalID(),
5024 ObjCClassesLoaded[I], PreviousGeneration);
5029 PP.getHeaderSearchInfo().getHeaderSearchOpts();
5034 for (
unsigned I = 0, N = Loaded.size(); I != N; ++I) {
5035 ImportedModule &M = Loaded[I];
5038 getModuleManager().getModuleCache().updateModuleTimestamp(
5053 if (!Stream.canSkipToPos(4))
5054 return llvm::createStringError(
5055 std::errc::illegal_byte_sequence,
5056 "file too small to contain precompiled file magic");
5057 for (
unsigned C : {
'C',
'P',
'C',
'H'})
5060 return llvm::createStringError(
5061 std::errc::illegal_byte_sequence,
5062 "file doesn't start with precompiled file magic");
5064 return Res.takeError();
5065 return llvm::Error::success();
5080 llvm_unreachable(
"unknown module kind");
5084ASTReader::ReadASTCore(StringRef
FileName,
5089 off_t ExpectedSize, time_t ExpectedModTime,
5091 unsigned ClientLoadCapabilities) {
5093 std::string ErrorStr;
5095 = ModuleMgr.addModule(
FileName,
Type, ImportLoc, ImportedBy,
5096 getGeneration(), ExpectedSize, ExpectedModTime,
5100 switch (AddResult) {
5102 Diag(diag::remark_module_import)
5104 << (ImportedBy ? StringRef(ImportedBy->
ModuleName) : StringRef());
5114 if (ClientLoadCapabilities & ARR_Missing)
5118 Diag(diag::err_ast_file_not_found)
5126 if (ClientLoadCapabilities & ARR_OutOfDate)
5130 Diag(diag::err_ast_file_out_of_date)
5136 assert(M &&
"Missing module file");
5138 bool ShouldFinalizePCM =
false;
5139 auto FinalizeOrDropPCM = llvm::make_scope_exit([&]() {
5140 auto &MC = getModuleManager().getModuleCache().getInMemoryModuleCache();
5141 if (ShouldFinalizePCM)
5147 BitstreamCursor &Stream = F.
Stream;
5148 Stream = BitstreamCursor(PCHContainerRdr.ExtractPCH(*F.Buffer));
5149 F.SizeInBits = F.Buffer->getBufferSize() * 8;
5153 Diag(diag::err_ast_file_invalid)
5159 bool HaveReadControlBlock =
false;
5163 Error(MaybeEntry.takeError());
5166 llvm::BitstreamEntry Entry = MaybeEntry.get();
5168 switch (Entry.Kind) {
5169 case llvm::BitstreamEntry::Error:
5170 case llvm::BitstreamEntry::Record:
5171 case llvm::BitstreamEntry::EndBlock:
5172 Error(
"invalid record at top-level of AST file");
5175 case llvm::BitstreamEntry::SubBlock:
5181 HaveReadControlBlock =
true;
5182 switch (ReadControlBlock(F, Loaded, ImportedBy, ClientLoadCapabilities)) {
5190 F.ModuleName.empty()) {
5192 if (
Result != OutOfDate ||
5193 (ClientLoadCapabilities & ARR_OutOfDate) == 0)
5199 case Failure:
return Failure;
5200 case Missing:
return Missing;
5201 case OutOfDate:
return OutOfDate;
5203 case ConfigurationMismatch:
return ConfigurationMismatch;
5204 case HadErrors:
return HadErrors;
5209 if (!HaveReadControlBlock) {
5210 if ((ClientLoadCapabilities & ARR_VersionMismatch) == 0)
5211 Diag(diag::err_ast_file_version_too_old)
5217 Loaded.push_back(ImportedModule(M, ImportedBy, ImportLoc));
5218 ShouldFinalizePCM =
true;
5222 if (llvm::Error Err = Stream.SkipBlock()) {
5223 Error(std::move(Err));
5230 llvm_unreachable(
"unexpected break; expected return");
5234ASTReader::readUnhashedControlBlock(
ModuleFile &F,
bool WasImportedBy,
5235 unsigned ClientLoadCapabilities) {
5237 PP.getHeaderSearchInfo().getHeaderSearchOpts();
5238 bool AllowCompatibleConfigurationMismatch =
5240 bool DisableValidation = shouldDisableValidationForFile(F);
5242 ASTReadResult
Result = readUnhashedControlBlockImpl(
5244 AllowCompatibleConfigurationMismatch, Listener.get(),
5249 if (DisableValidation || WasImportedBy ||
5250 (AllowConfigurationMismatch &&
Result == ConfigurationMismatch))
5254 Error(
"malformed block record in AST file");
5277 if (getModuleManager().getModuleCache().getInMemoryModuleCache().isPCMFinal(
5279 Diag(diag::warn_module_system_bit_conflict) << F.
FileName;
5289 unsigned ClientLoadCapabilities,
bool AllowCompatibleConfigurationMismatch,
5292 BitstreamCursor Stream(StreamData);
5297 consumeError(std::move(Err));
5312 consumeError(MaybeEntry.takeError());
5315 llvm::BitstreamEntry Entry = MaybeEntry.get();
5317 switch (Entry.Kind) {
5318 case llvm::BitstreamEntry::Error:
5319 case llvm::BitstreamEntry::SubBlock:
5322 case llvm::BitstreamEntry::EndBlock:
5325 case llvm::BitstreamEntry::Record:
5334 Stream.readRecord(Entry.ID,
Record, &Blob);
5335 if (!MaybeRecordType) {
5344 "Dummy AST file signature not backpatched in ASTWriter.");
5351 "Dummy AST block hash not backpatched in ASTWriter.");
5355 bool Complain = (ClientLoadCapabilities & ARR_OutOfDate) == 0;
5356 if (Listener && ValidateDiagnosticOptions &&
5357 !AllowCompatibleConfigurationMismatch &&
5363 bool Complain = (ClientLoadCapabilities & ARR_ConfigurationMismatch) == 0;
5364 if (Listener && !AllowCompatibleConfigurationMismatch &&
5365 ParseHeaderSearchPaths(
Record, Complain, *Listener))
5366 Result = ConfigurationMismatch;
5395 if (
Record.size() < 4)
return true;
5400 unsigned BlockNameLen =
Record[2];
5401 unsigned UserInfoLen =
Record[3];
5403 if (BlockNameLen + UserInfoLen > Blob.size())
return true;
5405 Metadata.
BlockName = std::string(Blob.data(), Blob.data() + BlockNameLen);
5406 Metadata.
UserInfo = std::string(Blob.data() + BlockNameLen,
5407 Blob.data() + BlockNameLen + UserInfoLen);
5411llvm::Error ASTReader::ReadExtensionBlock(
ModuleFile &F) {
5412 BitstreamCursor &Stream = F.
Stream;
5418 return MaybeEntry.takeError();
5419 llvm::BitstreamEntry Entry = MaybeEntry.get();
5421 switch (Entry.Kind) {
5422 case llvm::BitstreamEntry::SubBlock:
5423 if (llvm::Error Err = Stream.SkipBlock())
5426 case llvm::BitstreamEntry::EndBlock:
5427 return llvm::Error::success();
5428 case llvm::BitstreamEntry::Error:
5429 return llvm::createStringError(std::errc::illegal_byte_sequence,
5430 "malformed block record in AST file");
5431 case llvm::BitstreamEntry::Record:
5438 Stream.readRecord(Entry.ID,
Record, &Blob);
5440 return MaybeRecCode.takeError();
5441 switch (MaybeRecCode.get()) {
5445 return llvm::createStringError(
5446 std::errc::illegal_byte_sequence,
5447 "malformed EXTENSION_METADATA in AST file");
5450 auto Known = ModuleFileExtensions.find(Metadata.
BlockName);
5451 if (Known == ModuleFileExtensions.end())
break;
5454 if (
auto Reader = Known->second->createExtensionReader(Metadata, *
this,
5464 llvm_unreachable(
"ReadExtensionBlock should return from while loop");
5468 assert(ContextObj &&
"no context to initialize");
5472 if (DeserializationListener)
5473 DeserializationListener->DeclRead(
5483 if (!Context.CFConstantStringTypeDecl)
5490 Error(
"FILE type is NULL");
5494 if (!Context.FILEDecl) {
5500 Error(
"Invalid FILE type in AST file");
5509 QualType Jmp_bufType = GetType(Jmp_buf);
5510 if (Jmp_bufType.
isNull()) {
5511 Error(
"jmp_buf type is NULL");
5515 if (!Context.jmp_bufDecl) {
5521 Error(
"Invalid jmp_buf type in AST file");
5530 QualType Sigjmp_bufType = GetType(Sigjmp_buf);
5531 if (Sigjmp_bufType.
isNull()) {
5532 Error(
"sigjmp_buf type is NULL");
5536 if (!Context.sigjmp_bufDecl) {
5541 assert(Tag &&
"Invalid sigjmp_buf type in AST file");
5548 if (Context.ObjCIdRedefinitionType.
isNull())
5549 Context.ObjCIdRedefinitionType = GetType(ObjCIdRedef);
5552 if (
TypeID ObjCClassRedef =
5554 if (Context.ObjCClassRedefinitionType.
isNull())
5555 Context.ObjCClassRedefinitionType = GetType(ObjCClassRedef);
5558 if (
TypeID ObjCSelRedef =
5560 if (Context.ObjCSelRedefinitionType.
isNull())
5561 Context.ObjCSelRedefinitionType = GetType(ObjCSelRedef);
5565 QualType Ucontext_tType = GetType(Ucontext_t);
5566 if (Ucontext_tType.
isNull()) {
5567 Error(
"ucontext_t type is NULL");
5571 if (!Context.ucontext_tDecl) {
5576 assert(Tag &&
"Invalid ucontext_t type in AST file");
5586 if (!CUDASpecialDeclRefs.empty()) {
5587 assert(CUDASpecialDeclRefs.size() == 1 &&
"More decl refs than expected!");
5589 cast<FunctionDecl>(GetDecl(CUDASpecialDeclRefs[0])));
5594 for (
auto &Import : PendingImportedModules) {
5595 if (
Module *Imported = getSubmodule(Import.ID)) {
5598 if (Import.ImportLoc.isValid())
5599 PP.makeModuleVisible(Imported, Import.ImportLoc);
5606 PendingImportedModulesSema.append(PendingImportedModules);
5607 PendingImportedModules.clear();
5617 BitstreamCursor Stream(
PCH);
5620 consumeError(std::move(Err));
5632 Stream.advanceSkippingSubblocks();
5635 consumeError(MaybeEntry.takeError());
5638 llvm::BitstreamEntry Entry = MaybeEntry.get();
5640 if (Entry.Kind != llvm::BitstreamEntry::Record)
5648 consumeError(MaybeRecord.takeError());
5654 "Dummy AST file signature not backpatched in ASTWriter.");
5664 const std::string &ASTFileName,
FileManager &FileMgr,
5672 Diags.
Report(diag::err_fe_unable_to_read_pch_file)
5673 << ASTFileName << Buffer.getError().message();
5674 return std::string();
5678 BitstreamCursor Stream(PCHContainerRdr.
ExtractPCH(**Buffer));
5682 Diags.
Report(diag::err_fe_not_a_pch_file) << ASTFileName << std::move(Err);
5683 return std::string();
5688 Diags.
Report(diag::err_fe_pch_malformed_block) << ASTFileName;
5689 return std::string();
5696 Stream.advanceSkippingSubblocks();
5699 consumeError(MaybeEntry.takeError());
5700 return std::string();
5702 llvm::BitstreamEntry Entry = MaybeEntry.get();
5704 if (Entry.Kind == llvm::BitstreamEntry::EndBlock)
5705 return std::string();
5707 if (Entry.Kind != llvm::BitstreamEntry::Record) {
5708 Diags.
Report(diag::err_fe_pch_malformed_block) << ASTFileName;
5709 return std::string();
5717 consumeError(MaybeRecord.takeError());
5718 return std::string();
5732 std::string ExistingModuleCachePath;
5734 bool StrictOptionMatches;
5737 SimplePCHValidator(
const LangOptions &ExistingLangOpts,
5741 StringRef ExistingModuleCachePath,
FileManager &FileMgr,
5742 bool StrictOptionMatches)
5743 : ExistingLangOpts(ExistingLangOpts), ExistingCGOpts(ExistingCGOpts),
5744 ExistingTargetOpts(ExistingTargetOpts),
5745 ExistingPPOpts(ExistingPPOpts),
5746 ExistingModuleCachePath(ExistingModuleCachePath), FileMgr(FileMgr),
5747 StrictOptionMatches(StrictOptionMatches) {}
5749 bool ReadLanguageOptions(
const LangOptions &LangOpts,
5750 StringRef ModuleFilename,
bool Complain,
5751 bool AllowCompatibleDifferences)
override {
5753 nullptr, AllowCompatibleDifferences);
5757 StringRef ModuleFilename,
bool Complain,
5758 bool AllowCompatibleDifferences)
override {
5760 nullptr, AllowCompatibleDifferences);
5764 StringRef ModuleFilename,
bool Complain,
5765 bool AllowCompatibleDifferences)
override {
5767 nullptr, AllowCompatibleDifferences);
5771 StringRef ModuleFilename,
5772 StringRef SpecificModuleCachePath,
5773 bool Complain)
override {
5775 SpecificModuleCachePath,
5776 ExistingModuleCachePath, ModuleFilename,
5777 nullptr, ExistingLangOpts, ExistingPPOpts);
5781 StringRef ModuleFilename,
bool ReadMacros,
5783 std::string &SuggestedPredefines)
override {
5785 PPOpts, ExistingPPOpts, ModuleFilename, ReadMacros,
nullptr,
5786 FileMgr, SuggestedPredefines, ExistingLangOpts,
5798 unsigned ClientLoadCapabilities) {
5800 std::unique_ptr<llvm::MemoryBuffer> OwnedBuffer;
5801 llvm::MemoryBuffer *Buffer =
5813 OwnedBuffer = std::move(*BufferOrErr);
5814 Buffer = OwnedBuffer.get();
5818 StringRef Bytes = PCHContainerRdr.
ExtractPCH(*Buffer);
5819 BitstreamCursor Stream(Bytes);
5823 consumeError(std::move(Err));
5834 BitstreamCursor InputFilesCursor;
5835 uint64_t InputFilesOffsetBase = 0;
5838 std::string ModuleDir;
5839 bool DoneWithControlBlock =
false;
5841 PathBuf.reserve(256);
5846 AdditionalPathBuf.reserve(256);
5847 while (!DoneWithControlBlock) {
5851 consumeError(MaybeEntry.takeError());
5854 llvm::BitstreamEntry Entry = MaybeEntry.get();
5856 switch (Entry.Kind) {
5857 case llvm::BitstreamEntry::SubBlock: {
5860 std::string IgnoredSuggestedPredefines;
5861 if (ReadOptionsBlock(Stream,
Filename, ClientLoadCapabilities,
5863 Listener, IgnoredSuggestedPredefines) !=
Success)
5869 InputFilesCursor = Stream;
5870 if (llvm::Error Err = Stream.SkipBlock()) {
5872 consumeError(std::move(Err));
5875 if (NeedsInputFiles &&
5878 InputFilesOffsetBase = InputFilesCursor.GetCurrentBitNo();
5882 if (llvm::Error Err = Stream.SkipBlock()) {
5884 consumeError(std::move(Err));
5893 case llvm::BitstreamEntry::EndBlock:
5894 DoneWithControlBlock =
true;
5897 case llvm::BitstreamEntry::Error:
5900 case llvm::BitstreamEntry::Record:
5904 if (DoneWithControlBlock)
break;
5909 Stream.readRecord(Entry.ID,
Record, &Blob);
5910 if (!MaybeRecCode) {
5925 ModuleDir = std::string(Blob);
5929 std::string PathStr = ReadString(
Record, Idx);
5930 auto Path = ResolveImportedPath(PathBuf, PathStr, ModuleDir);
5935 if (!NeedsInputFiles)
5938 unsigned NumInputFiles =
Record[0];
5939 unsigned NumUserFiles =
Record[1];
5940 const llvm::support::unaligned_uint64_t *InputFileOffs =
5941 (
const llvm::support::unaligned_uint64_t *)Blob.data();
5942 for (
unsigned I = 0; I != NumInputFiles; ++I) {
5944 bool isSystemFile = I >= NumUserFiles;
5946 if (isSystemFile && !NeedsSystemInputFiles)
5949 BitstreamCursor &Cursor = InputFilesCursor;
5951 if (llvm::Error Err =
5952 Cursor.JumpToBit(InputFilesOffsetBase + InputFileOffs[I])) {
5954 consumeError(std::move(Err));
5960 consumeError(MaybeCode.takeError());
5962 unsigned Code = MaybeCode.get();
5966 bool shouldContinue =
false;
5968 Cursor.readRecord(Code,
Record, &Blob);
5969 if (!MaybeRecordType) {
5971 consumeError(MaybeRecordType.takeError());
5977 bool Overridden =
static_cast<bool>(
Record[3]);
5978 auto [UnresolvedFilenameAsRequested, UnresolvedFilename] =
5980 auto FilenameAsRequestedBuf = ResolveImportedPath(
5981 PathBuf, UnresolvedFilenameAsRequested, ModuleDir);
5983 if (UnresolvedFilename.empty())
5984 Filename = *FilenameAsRequestedBuf;
5986 auto FilenameBuf = ResolveImportedPath(
5987 AdditionalPathBuf, UnresolvedFilename, ModuleDir);
5991 *FilenameAsRequestedBuf,
Filename, isSystemFile, Overridden,
5995 if (!shouldContinue)
6014 StringRef ModuleName = ReadStringBlob(
Record, Idx, Blob);
6016 bool IsStandardCXXModule =
Record[Idx++];
6020 if (IsStandardCXXModule) {
6030 StringRef FilenameStr = ReadStringBlob(
Record, Idx, Blob);
6031 auto Filename = ResolveImportedPath(PathBuf, FilenameStr, ModuleDir);
6043 if (FindModuleFileExtensions) {
6044 BitstreamCursor SavedStream = Stream;
6046 bool DoneWithExtensionBlock =
false;
6047 while (!DoneWithExtensionBlock) {
6053 llvm::BitstreamEntry Entry = MaybeEntry.get();
6055 switch (Entry.Kind) {
6056 case llvm::BitstreamEntry::SubBlock:
6057 if (llvm::Error Err = Stream.SkipBlock()) {
6059 consumeError(std::move(Err));
6064 case llvm::BitstreamEntry::EndBlock:
6065 DoneWithExtensionBlock =
true;
6068 case llvm::BitstreamEntry::Error:
6071 case llvm::BitstreamEntry::Record:
6078 Stream.readRecord(Entry.ID,
Record, &Blob);
6079 if (!MaybeRecCode) {
6083 switch (MaybeRecCode.get()) {
6095 Stream = std::move(SavedStream);
6099 if (readUnhashedControlBlockImpl(
6100 nullptr, Bytes,
Filename, ClientLoadCapabilities,
6102 ValidateDiagnosticOptions) !=
Success)
6113 bool RequireStrictOptionMatches) {
6114 SimplePCHValidator validator(LangOpts, CGOpts, TargetOpts, PPOpts,
6115 ExistingModuleCachePath, FileMgr,
6116 RequireStrictOptionMatches);
6117 return !readASTFileControlBlock(
Filename, FileMgr, ModCache, PCHContainerRdr,
6122llvm::Error ASTReader::ReadSubmoduleBlock(
ModuleFile &F,
6123 unsigned ClientLoadCapabilities) {
6128 ModuleMap &ModMap = PP.getHeaderSearchInfo().getModuleMap();
6133 auto CreateModule = !KnowsTopLevelModule
6138 Module *CurrentModule =
nullptr;
6142 F.
Stream.advanceSkippingSubblocks();
6144 return MaybeEntry.takeError();
6145 llvm::BitstreamEntry Entry = MaybeEntry.get();
6147 switch (Entry.Kind) {
6148 case llvm::BitstreamEntry::SubBlock:
6149 case llvm::BitstreamEntry::Error:
6150 return llvm::createStringError(std::errc::illegal_byte_sequence,
6151 "malformed block record in AST file");
6152 case llvm::BitstreamEntry::EndBlock:
6153 return llvm::Error::success();
6154 case llvm::BitstreamEntry::Record:
6164 return MaybeKind.takeError();
6165 unsigned Kind = MaybeKind.get();
6168 return llvm::createStringError(
6169 std::errc::illegal_byte_sequence,
6170 "submodule metadata record should be at beginning of block");
6185 return llvm::createStringError(std::errc::illegal_byte_sequence,
6186 "malformed module definition");
6188 StringRef Name = Blob;
6195 bool IsFramework =
Record[Idx++];
6196 bool IsExplicit =
Record[Idx++];
6197 bool IsSystem =
Record[Idx++];
6198 bool IsExternC =
Record[Idx++];
6199 bool InferSubmodules =
Record[Idx++];
6200 bool InferExplicitSubmodules =
Record[Idx++];
6201 bool InferExportWildcard =
Record[Idx++];
6202 bool ConfigMacrosExhaustive =
Record[Idx++];
6203 bool ModuleMapIsPrivate =
Record[Idx++];
6204 bool NamedModuleHasInit =
Record[Idx++];
6206 Module *ParentModule =
nullptr;
6208 ParentModule = getSubmodule(
Parent);
6210 CurrentModule = std::invoke(CreateModule, &ModMap, Name, ParentModule,
6211 IsFramework, IsExplicit);
6214 if (GlobalIndex >= SubmodulesLoaded.size() ||
6215 SubmodulesLoaded[GlobalIndex])
6216 return llvm::createStringError(std::errc::invalid_argument,
6217 "too many submodules");
6219 if (!ParentModule) {
6222 if (!
bool(PP.getPreprocessorOpts().DisablePCHOrModuleValidation &
6224 assert(CurFile != F.
File &&
"ModuleManager did not de-duplicate");
6226 Diag(diag::err_module_file_conflict)
6230 auto CurModMapFile =
6233 if (CurModMapFile && ModMapFile && CurModMapFile != ModMapFile)
6234 Diag(diag::note_module_file_conflict)
6235 << CurModMapFile->getName() << ModMapFile->getName();
6237 return llvm::make_error<AlreadyReportedDiagnosticError>();
6256 if (InferredAllowedBy.
isValid())
6266 if (DeserializationListener)
6267 DeserializationListener->ModuleRead(GlobalID, CurrentModule);
6269 SubmodulesLoaded[GlobalIndex] = CurrentModule;
6294 auto Filename = ResolveImportedPath(PathBuf, Blob, F);
6295 if (
auto Umbrella = PP.getFileManager().getOptionalFileRef(*
Filename)) {
6323 auto HeaderName = ResolveImportedPath(PathBuf, Blob, F);
6330 auto Dirname = ResolveImportedPath(PathBuf, Blob, F);
6332 PP.getFileManager().getOptionalDirectoryRef(*Dirname)) {
6344 unsigned LocalBaseSubmoduleID =
Record[1];
6348 GlobalSubmoduleMap.insert(std::make_pair(getTotalNumSubmodules()+1,&F));
6353 std::make_pair(LocalBaseSubmoduleID,
6362 for (
unsigned Idx = 0; Idx !=
Record.size(); ++Idx) {
6367 Unresolved.Kind = UnresolvedModuleRef::Import;
6374 for (
unsigned Idx = 0; Idx !=
Record.size(); ++Idx) {
6379 Unresolved.Kind = UnresolvedModuleRef::Affecting;
6386 for (
unsigned Idx = 0; Idx + 1 <
Record.size(); Idx += 2) {
6391 Unresolved.Kind = UnresolvedModuleRef::Export;
6403 PP.getTargetInfo());
6421 Unresolved.Kind = UnresolvedModuleRef::Conflict;
6432 for (
unsigned I = 0; I <
Record.size(); )
6433 Inits.push_back(ReadDeclID(F,
Record, I));
6434 ContextObj->addLazyModuleInitializers(CurrentModule, Inits);
6453bool ASTReader::ParseLanguageOptions(
const RecordData &
Record,
6454 StringRef ModuleFilename,
bool Complain,
6456 bool AllowCompatibleDifferences) {
6459#define LANGOPT(Name, Bits, Default, Compatibility, Description) \
6460 LangOpts.Name = Record[Idx++];
6461#define ENUM_LANGOPT(Name, Type, Bits, Default, Compatibility, Description) \
6462 LangOpts.set##Name(static_cast<LangOptions::Type>(Record[Idx++]));
6463#include "clang/Basic/LangOptions.def"
6464#define SANITIZER(NAME, ID) \
6465 LangOpts.Sanitize.set(SanitizerKind::ID, Record[Idx++]);
6466#include "clang/Basic/Sanitizers.def"
6468 for (
unsigned N =
Record[Idx++]; N; --N)
6472 VersionTuple runtimeVersion = ReadVersionTuple(
Record, Idx);
6478 for (
unsigned N =
Record[Idx++]; N; --N) {
6480 ReadString(
Record, Idx));
6485 for (
unsigned N =
Record[Idx++]; N; --N) {
6492 AllowCompatibleDifferences);
6495bool ASTReader::ParseCodeGenOptions(
const RecordData &
Record,
6496 StringRef ModuleFilename,
bool Complain,
6498 bool AllowCompatibleDifferences) {
6502#define CODEGENOPT(Name, Bits, Default, Compatibility) \
6503 if constexpr (CK::Compatibility != CK::Benign) \
6504 CGOpts.Name = static_cast<unsigned>(Record[Idx++]);
6505#define ENUM_CODEGENOPT(Name, Type, Bits, Default, Compatibility) \
6506 if constexpr (CK::Compatibility != CK::Benign) \
6507 CGOpts.set##Name(static_cast<clang::CodeGenOptions::Type>(Record[Idx++]));
6508#define DEBUGOPT(Name, Bits, Default, Compatibility)
6509#define VALUE_DEBUGOPT(Name, Bits, Default, Compatibility)
6510#define ENUM_DEBUGOPT(Name, Type, Bits, Default, Compatibility)
6511#include "clang/Basic/CodeGenOptions.def"
6514 AllowCompatibleDifferences);
6517bool ASTReader::ParseTargetOptions(
const RecordData &
Record,
6518 StringRef ModuleFilename,
bool Complain,
6520 bool AllowCompatibleDifferences) {
6524 TargetOpts.
CPU = ReadString(
Record, Idx);
6526 TargetOpts.
ABI = ReadString(
Record, Idx);
6527 for (
unsigned N =
Record[Idx++]; N; --N) {
6530 for (
unsigned N =
Record[Idx++]; N; --N) {
6535 AllowCompatibleDifferences);
6538bool ASTReader::ParseDiagnosticOptions(
const RecordData &
Record,
6539 StringRef ModuleFilename,
bool Complain,
6543#define DIAGOPT(Name, Bits, Default) DiagOpts.Name = Record[Idx++];
6544#define ENUM_DIAGOPT(Name, Type, Bits, Default) \
6545 DiagOpts.set##Name(static_cast<Type>(Record[Idx++]));
6546#include "clang/Basic/DiagnosticOptions.def"
6548 for (
unsigned N =
Record[Idx++]; N; --N)
6550 for (
unsigned N =
Record[Idx++]; N; --N)
6556bool ASTReader::ParseFileSystemOptions(
const RecordData &
Record,
bool Complain,
6564bool ASTReader::ParseHeaderSearchOptions(
const RecordData &
Record,
6565 StringRef ModuleFilename,
6583 std::string SpecificModuleCachePath = ReadString(
Record, Idx);
6586 SpecificModuleCachePath, Complain);
6589bool ASTReader::ParseHeaderSearchPaths(
const RecordData &
Record,
bool Complain,
6595 for (
unsigned N =
Record[Idx++]; N; --N) {
6599 bool IsFramework =
Record[Idx++];
6600 bool IgnoreSysRoot =
Record[Idx++];
6606 for (
unsigned N =
Record[Idx++]; N; --N) {
6607 std::string Prefix = ReadString(
Record, Idx);
6608 bool IsSystemHeader =
Record[Idx++];
6613 for (
unsigned N =
Record[Idx++]; N; --N) {
6614 std::string VFSOverlayFile = ReadString(
Record, Idx);
6621bool ASTReader::ParsePreprocessorOptions(
const RecordData &
Record,
6622 StringRef ModuleFilename,
6625 std::string &SuggestedPredefines) {
6630 bool ReadMacros =
Record[Idx++];
6632 for (
unsigned N =
Record[Idx++]; N; --N) {
6634 bool IsUndef =
Record[Idx++];
6635 PPOpts.
Macros.push_back(std::make_pair(
Macro, IsUndef));
6640 for (
unsigned N =
Record[Idx++]; N; --N) {
6645 for (
unsigned N =
Record[Idx++]; N; --N) {
6654 SuggestedPredefines.clear();
6656 Complain, SuggestedPredefines);
6659std::pair<ModuleFile *, unsigned>
6660ASTReader::getModulePreprocessedEntity(
unsigned GlobalIndex) {
6661 GlobalPreprocessedEntityMapType::iterator
6662 I = GlobalPreprocessedEntityMap.find(GlobalIndex);
6663 assert(I != GlobalPreprocessedEntityMap.end() &&
6664 "Corrupted global preprocessed entity map");
6667 return std::make_pair(M, LocalIndex);
6670llvm::iterator_range<PreprocessingRecord::iterator>
6671ASTReader::getModulePreprocessedEntities(
ModuleFile &Mod)
const {
6680bool ASTReader::canRecoverFromOutOfDate(StringRef ModuleFileName,
6681 unsigned int ClientLoadCapabilities) {
6682 return ClientLoadCapabilities & ARR_OutOfDate &&
6685 .getInMemoryModuleCache()
6686 .isPCMFinal(ModuleFileName);
6689llvm::iterator_range<ASTReader::ModuleDeclIterator>
6691 return llvm::make_range(
6698 auto I = GlobalSkippedRangeMap.find(GlobalIndex);
6699 assert(I != GlobalSkippedRangeMap.end() &&
6700 "Corrupted global skipped range map");
6703 assert(LocalIndex < M->NumPreprocessedSkippedRanges);
6706 ReadSourceLocation(*M, RawRange.
getEnd()));
6713 std::pair<ModuleFile *, unsigned> PPInfo = getModulePreprocessedEntity(Index);
6715 unsigned LocalIndex = PPInfo.second;
6718 if (!PP.getPreprocessingRecord()) {
6719 Error(
"no preprocessing record");
6726 Error(std::move(Err));
6733 Error(MaybeEntry.takeError());
6736 llvm::BitstreamEntry Entry = MaybeEntry.get();
6738 if (Entry.Kind != llvm::BitstreamEntry::Record)
6743 ReadSourceLocation(M, PPOffs.
getEnd()));
6749 if (!MaybeRecType) {
6750 Error(MaybeRecType.takeError());
6755 bool isBuiltin =
Record[0];
6759 Name = getLocalIdentifier(M,
Record[1]);
6762 getGlobalPreprocessedEntityID(M,
Record[1]);
6763 Def = cast<MacroDefinitionRecord>(
6764 PPRec.getLoadedPreprocessedEntity(GlobalID - 1));
6782 if (DeserializationListener)
6783 DeserializationListener->MacroDefinitionRead(PPID, MD);
6789 const char *FullFileNameStart = Blob.data() +
Record[0];
6790 StringRef FullFileName(FullFileNameStart, Blob.size() -
Record[0]);
6792 if (!FullFileName.empty())
6793 File = PP.getFileManager().getOptionalFileRef(FullFileName);
6800 StringRef(Blob.data(),
Record[0]),
6808 llvm_unreachable(
"Invalid PreprocessorDetailRecordTypes");
6818 GlobalSLocOffsetMapType::const_iterator SLocMapI)
const {
6820 for (GlobalSLocOffsetMapType::const_iterator
6821 EndI = GlobalSLocOffsetMap.end(); SLocMapI != EndI; ++SLocMapI) {
6827 return getTotalNumPreprocessedEntities();
6832struct PPEntityComp {
6862 bool EndsAfter)
const {
6863 if (SourceMgr.isLocalSourceLocation(
Loc))
6864 return getTotalNumPreprocessedEntities();
6866 GlobalSLocOffsetMapType::const_iterator SLocMapI = GlobalSLocOffsetMap.find(
6867 SourceManager::MaxLoadedOffset -
Loc.getOffset() - 1);
6868 assert(SLocMapI != GlobalSLocOffsetMap.end() &&
6869 "Corrupted global sloc offset map");
6871 if (SLocMapI->second->NumPreprocessedEntities == 0)
6872 return findNextPreprocessedEntity(SLocMapI);
6883 pp_iterator
First = pp_begin;
6887 PPI = std::upper_bound(pp_begin, pp_end,
Loc,
6888 PPEntityComp(*
this, M));
6897 std::advance(PPI,
Half);
6898 if (SourceMgr.isBeforeInTranslationUnit(
6899 ReadSourceLocation(M, PPI->getEnd()),
Loc)) {
6902 Count = Count -
Half - 1;
6909 return findNextPreprocessedEntity(SLocMapI);
6916std::pair<unsigned, unsigned>
6919 return std::make_pair(0,0);
6925 return std::make_pair(BeginID, EndID);
6935 std::pair<ModuleFile *, unsigned> PPInfo = getModulePreprocessedEntity(Index);
6937 unsigned LocalIndex = PPInfo.second;
6944 if (SourceMgr.isInFileID(SourceMgr.getFileLoc(
Loc), FID))
6953 class HeaderFileInfoVisitor {
6955 std::optional<HeaderFileInfo> HFI;
6958 explicit HeaderFileInfoVisitor(
FileEntryRef FE) : FE(FE) {}
6967 HeaderFileInfoLookupTable::iterator Pos = Table->find(FE);
6968 if (Pos == Table->end())
6975 std::optional<HeaderFileInfo> getHeaderFileInfo()
const {
return HFI; }
6981 HeaderFileInfoVisitor Visitor(FE);
6982 ModuleMgr.visit(Visitor);
6983 if (std::optional<HeaderFileInfo> HFI = Visitor.getHeaderFileInfo())
6990 using DiagState = DiagnosticsEngine::DiagState;
7001 auto ReadDiagState = [&](
const DiagState &BasedOn,
7002 bool IncludeNonPragmaStates) {
7003 unsigned BackrefID =
Record[Idx++];
7005 return DiagStates[BackrefID - 1];
7008 Diag.DiagStates.push_back(BasedOn);
7009 DiagState *NewState = &
Diag.DiagStates.back();
7010 DiagStates.push_back(NewState);
7011 unsigned Size =
Record[Idx++];
7012 assert(Idx + Size * 2 <=
Record.size() &&
7013 "Invalid data, not enough diag/map pairs");
7015 unsigned DiagID =
Record[Idx++];
7018 if (!NewMapping.
isPragma() && !IncludeNonPragmaStates)
7031 Mapping = NewMapping;
7037 DiagState *FirstState;
7042 FirstState =
Diag.DiagStatesByLoc.FirstDiagState;
7043 DiagStates.push_back(FirstState);
7047 "Invalid data, unexpected backref in initial state");
7049 assert(Idx <
Record.size() &&
7050 "Invalid data, not enough state change pairs in initial state");
7055 unsigned Flags =
Record[Idx++];
7056 DiagState Initial(*
Diag.getDiagnosticIDs());
7057 Initial.SuppressSystemWarnings = Flags & 1; Flags >>= 1;
7058 Initial.ErrorsAsFatal = Flags & 1; Flags >>= 1;
7059 Initial.WarningsAsErrors = Flags & 1; Flags >>= 1;
7060 Initial.EnableAllWarnings = Flags & 1; Flags >>= 1;
7061 Initial.IgnoreAllWarnings = Flags & 1; Flags >>= 1;
7063 FirstState = ReadDiagState(Initial,
true);
7071 .StateTransitions.push_back({FirstState, 0});
7076 FirstState = ReadDiagState(*
Diag.DiagStatesByLoc.CurDiagState,
false);
7080 unsigned NumLocations =
Record[Idx++];
7081 while (NumLocations--) {
7082 assert(Idx <
Record.size() &&
7083 "Invalid data, missing pragma diagnostic states");
7085 assert(FID.
isValid() &&
"invalid FileID for transition");
7086 unsigned Transitions =
Record[Idx++];
7092 auto &F =
Diag.DiagStatesByLoc.Files[FID];
7093 F.StateTransitions.reserve(F.StateTransitions.size() + Transitions);
7094 for (
unsigned I = 0; I != Transitions; ++I) {
7095 unsigned Offset =
Record[Idx++];
7096 auto *State = ReadDiagState(*FirstState,
false);
7097 F.StateTransitions.push_back({State, Offset});
7102 assert(Idx <
Record.size() &&
7103 "Invalid data, missing final pragma diagnostic state");
7105 auto *CurState = ReadDiagState(*FirstState,
false);
7108 Diag.DiagStatesByLoc.CurDiagState = CurState;
7109 Diag.DiagStatesByLoc.CurDiagStateLoc = CurStateLoc;
7114 auto &
T =
Diag.DiagStatesByLoc.Files[NullFile].StateTransitions;
7116 T.push_back({CurState, 0});
7118 T[0].State = CurState;
7127ASTReader::RecordLocation ASTReader::TypeCursorForIndex(
TypeID ID) {
7128 auto [M, Index] = translateTypeIDToIndex(ID);
7135#define TYPE_BIT_CODE(CLASS_ID, CODE_ID, CODE_VALUE) \
7136 case TYPE_##CODE_ID: return Type::CLASS_ID;
7137#include "clang/Serialization/TypeBitCodes.def"
7139 return std::nullopt;
7150 assert(ContextObj &&
"reading type with no AST context");
7152 RecordLocation
Loc = TypeCursorForIndex(ID);
7153 BitstreamCursor &DeclsCursor =
Loc.F->DeclsCursor;
7159 ReadingKindTracker ReadingKind(Read_Type, *
this);
7162 Deserializing AType(
this);
7164 if (llvm::Error Err = DeclsCursor.JumpToBit(
Loc.Offset)) {
7165 Error(std::move(Err));
7170 Error(RawCode.takeError());
7177 Error(Code.takeError());
7188 Error(
"Unexpected code for type");
7193 return TypeReader.read(*maybeClass);
7222#define ABSTRACT_TYPELOC(CLASS, PARENT)
7223#define TYPELOC(CLASS, PARENT) \
7224 void Visit##CLASS##TypeLoc(CLASS##TypeLoc TyLoc);
7225#include "clang/AST/TypeLocNodes.def"
7292 if (Reader.readBool())
7299 VisitArrayTypeLoc(TL);
7303 VisitArrayTypeLoc(TL);
7307 VisitArrayTypeLoc(TL);
7310void TypeLocReader::VisitDependentSizedArrayTypeLoc(
7312 VisitArrayTypeLoc(TL);
7315void TypeLocReader::VisitDependentAddressSpaceTypeLoc(
7323void TypeLocReader::VisitDependentSizedExtVectorTypeLoc(
7332void TypeLocReader::VisitDependentVectorTypeLoc(
7348void TypeLocReader::VisitDependentSizedMatrixTypeLoc(
7362 for (
unsigned i = 0, e = TL.
getNumParams(); i != e; ++i) {
7368 VisitFunctionTypeLoc(TL);
7372 VisitFunctionTypeLoc(TL);
7379 TL.
set(ElaboratedKeywordLoc, QualifierLoc, NameLoc);
7382void TypeLocReader::VisitUsingTypeLoc(
UsingTypeLoc TL) {
7386 TL.
set(ElaboratedKeywordLoc, QualifierLoc, NameLoc);
7393 TL.
set(ElaboratedKeywordLoc, QualifierLoc, NameLoc);
7426 auto NNS = readNestedNameSpecifierLoc();
7427 auto TemplateKWLoc = readSourceLocation();
7428 auto ConceptNameLoc = readDeclarationNameInfo();
7429 auto FoundDecl = readDeclAs<NamedDecl>();
7430 auto NamedConcept = readDeclAs<ConceptDecl>();
7432 getContext(), NNS, TemplateKWLoc, ConceptNameLoc, FoundDecl, NamedConcept,
7433 (readBool() ? readASTTemplateArgumentListInfo() :
nullptr));
7437void TypeLocReader::VisitAutoTypeLoc(
AutoTypeLoc TL) {
7439 if (Reader.readBool())
7441 if (Reader.readBool())
7445void TypeLocReader::VisitDeducedTemplateSpecializationTypeLoc(
7459 VisitTagTypeLoc(TL);
7463 VisitTagTypeLoc(TL);
7466void TypeLocReader::VisitEnumTypeLoc(
EnumTypeLoc TL) { VisitTagTypeLoc(TL); }
7480void TypeLocReader::VisitHLSLAttributedResourceTypeLoc(
7493void TypeLocReader::VisitSubstTemplateTypeParmTypeLoc(
7498void TypeLocReader::VisitSubstTemplateTypeParmPackTypeLoc(
7503void TypeLocReader::VisitSubstBuiltinTemplatePackTypeLoc(
7508void TypeLocReader::VisitTemplateSpecializationTypeLoc(
7516 TL.
set(ElaboratedKeywordLoc, QualifierLoc, TemplateKeywordLoc, NameLoc,
7517 LAngleLoc, RAngleLoc);
7520 Args[I] = Reader.readTemplateArgumentLocInfo(
7524void TypeLocReader::VisitParenTypeLoc(
ParenTypeLoc TL) {
7535void TypeLocReader::VisitDependentTemplateSpecializationTypeLoc(
7545 Reader.readTemplateArgumentLocInfo(
7589void TypeLocReader::VisitPipeTypeLoc(
PipeTypeLoc TL) {
7597void TypeLocReader::VisitDependentBitIntTypeLoc(
7617 TypeSourceInfo *TInfo = getContext().CreateTypeSourceInfo(InfoTy);
7636std::pair<ModuleFile *, unsigned>
7639 "Predefined type shouldn't be in TypesLoaded");
7641 assert(ModuleFileIndex &&
"Untranslated Local Decl?");
7643 ModuleFile *OwningModuleFile = &getModuleManager()[ModuleFileIndex - 1];
7644 assert(OwningModuleFile &&
7645 "untranslated type ID or local type ID shouldn't be in TypesLoaded");
7647 return {OwningModuleFile,
7652 assert(ContextObj &&
"reading type with no AST context");
7663 llvm_unreachable(
"Invalid predefined type");
7852#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
7853 case PREDEF_TYPE_##Id##_ID: \
7854 T = Context.SingletonId; \
7856#include "clang/Basic/OpenCLImageTypes.def"
7857#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
7858 case PREDEF_TYPE_##Id##_ID: \
7859 T = Context.Id##Ty; \
7861#include "clang/Basic/OpenCLExtensionTypes.def"
7901#define SVE_TYPE(Name, Id, SingletonId) \
7902 case PREDEF_TYPE_##Id##_ID: \
7903 T = Context.SingletonId; \
7905#include "clang/Basic/AArch64ACLETypes.def"
7906#define PPC_VECTOR_TYPE(Name, Id, Size) \
7907 case PREDEF_TYPE_##Id##_ID: \
7908 T = Context.Id##Ty; \
7910#include "clang/Basic/PPCTypes.def"
7911#define RVV_TYPE(Name, Id, SingletonId) \
7912 case PREDEF_TYPE_##Id##_ID: \
7913 T = Context.SingletonId; \
7915#include "clang/Basic/RISCVVTypes.def"
7916#define WASM_TYPE(Name, Id, SingletonId) \
7917 case PREDEF_TYPE_##Id##_ID: \
7918 T = Context.SingletonId; \
7920#include "clang/Basic/WebAssemblyReferenceTypes.def"
7921#define AMDGPU_TYPE(Name, Id, SingletonId, Width, Align) \
7922 case PREDEF_TYPE_##Id##_ID: \
7923 T = Context.SingletonId; \
7925#include "clang/Basic/AMDGPUTypes.def"
7926#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) \
7927 case PREDEF_TYPE_##Id##_ID: \
7928 T = Context.SingletonId; \
7930#include "clang/Basic/HLSLIntangibleTypes.def"
7933 assert(!
T.isNull() &&
"Unknown predefined type");
7934 return T.withFastQualifiers(FastQuals);
7937 unsigned Index = translateTypeIDToIndex(ID).second;
7939 assert(Index < TypesLoaded.size() &&
"Type index out-of-range");
7940 if (TypesLoaded[Index].isNull()) {
7941 TypesLoaded[Index] = readTypeRecord(ID);
7942 if (TypesLoaded[Index].isNull())
7945 TypesLoaded[Index]->setFromAST();
7946 if (DeserializationListener)
7948 TypesLoaded[Index]);
7951 return TypesLoaded[Index].withFastQualifiers(FastQuals);
7955 return GetType(getGlobalTypeID(F, LocalID));
7964 ReadModuleOffsetMap(F);
7967 LocalID &= llvm::maskTrailingOnes<TypeID>(32);
7969 if (ModuleFileIndex == 0)
7974 ModuleFileIndex = MF.
Index + 1;
7975 return ((uint64_t)ModuleFileIndex << 32) | LocalID;
7984 return readTypeSourceInfo();
7991 ? readSourceLocation()
7994 TemplateNameLoc, EllipsisLoc);
8005 llvm_unreachable(
"unexpected template argument loc");
8020 Result.setLAngleLoc(readSourceLocation());
8021 Result.setRAngleLoc(readSourceLocation());
8022 unsigned NumArgsAsWritten = readInt();
8023 for (
unsigned i = 0; i != NumArgsAsWritten; ++i)
8024 Result.addArgument(readTemplateArgumentLoc());
8030 readTemplateArgumentListInfo(
Result);
8037 if (NumCurrentElementsDeserializing) {
8042 PendingIncompleteDeclChains.push_back(
const_cast<Decl*
>(
D));
8047 assert(isa<TranslationUnitDecl>(
D) &&
"Not a TU?");
8058 if (isa<TranslationUnitDecl, NamespaceDecl, RecordDecl, EnumDecl>(DC)) {
8060 if (!getContext().getLangOpts().
CPlusPlus &&
8061 isa<TranslationUnitDecl>(DC)) {
8065 auto *II = Name.getAsIdentifierInfo();
8066 assert(II &&
"non-identifier name in C?");
8067 if (II->isOutOfDate())
8068 updateOutOfDateIdentifier(*II);
8074 auto *DC = cast<DeclContext>(DCDecl);
8076 FindExternalLexicalDecls(
8084 if (
auto *CTSD = dyn_cast<ClassTemplateSpecializationDecl>(
D)) {
8085 Template = CTSD->getSpecializedTemplate();
8086 Args = CTSD->getTemplateArgs().asArray();
8087 }
else if (
auto *VTSD = dyn_cast<VarTemplateSpecializationDecl>(
D)) {
8088 Template = VTSD->getSpecializedTemplate();
8089 Args = VTSD->getTemplateArgs().asArray();
8090 }
else if (
auto *FD = dyn_cast<FunctionDecl>(
D)) {
8091 if (
auto *Tmplt = FD->getPrimaryTemplate()) {
8093 Args = FD->getTemplateSpecializationArgs()->asArray();
8101 Template->loadLazySpecializationsImpl();
8103 Template->loadLazySpecializationsImpl(Args);
8109 RecordLocation
Loc = getLocalBitOffset(Offset);
8110 BitstreamCursor &Cursor =
Loc.F->DeclsCursor;
8112 if (llvm::Error Err = Cursor.JumpToBit(
Loc.Offset)) {
8113 Error(std::move(Err));
8116 ReadingKindTracker ReadingKind(Read_Decl, *
this);
8121 Error(MaybeCode.takeError());
8124 unsigned Code = MaybeCode.get();
8128 if (!MaybeRecCode) {
8129 Error(MaybeRecCode.takeError());
8133 Error(
"malformed AST file: missing C++ ctor initializers");
8137 return Record.readCXXCtorInitializers();
8141 assert(ContextObj &&
"reading base specifiers with no AST context");
8144 RecordLocation
Loc = getLocalBitOffset(Offset);
8145 BitstreamCursor &Cursor =
Loc.F->DeclsCursor;
8147 if (llvm::Error Err = Cursor.JumpToBit(
Loc.Offset)) {
8148 Error(std::move(Err));
8151 ReadingKindTracker ReadingKind(Read_Decl, *
this);
8156 Error(MaybeCode.takeError());
8159 unsigned Code = MaybeCode.get();
8163 if (!MaybeRecCode) {
8164 Error(MaybeCode.takeError());
8167 unsigned RecCode = MaybeRecCode.get();
8170 Error(
"malformed AST file: missing C++ base specifiers");
8174 unsigned NumBases =
Record.readInt();
8177 for (
unsigned I = 0; I != NumBases; ++I)
8178 Bases[I] =
Record.readCXXBaseSpecifier();
8191 ReadModuleOffsetMap(F);
8194 OwningModuleFileIndex == 0
8198 if (OwningModuleFileIndex == 0)
8201 uint64_t NewModuleFileIndex = OwningModuleFile->
Index + 1;
8210 unsigned ModuleFileIndex = ID.getModuleFileIndex();
8211 return M.
Index == ModuleFileIndex - 1;
8219 uint64_t ModuleFileIndex = ID.getModuleFileIndex();
8220 assert(ModuleFileIndex &&
"Untranslated Local Decl?");
8222 return &getModuleManager()[ModuleFileIndex - 1];
8236 if (
Decl *
D = GetExistingDecl(ID))
8240 DeclCursorForID(ID,
Loc);
8245 assert(ContextObj &&
"reading predefined decl without AST context");
8247 Decl *NewLoaded =
nullptr;
8256 if (Context.ObjCIdDecl)
8257 return Context.ObjCIdDecl;
8262 if (Context.ObjCSelDecl)
8263 return Context.ObjCSelDecl;
8268 if (Context.ObjCClassDecl)
8269 return Context.ObjCClassDecl;
8274 if (Context.ObjCProtocolClassDecl)
8275 return Context.ObjCProtocolClassDecl;
8280 if (Context.Int128Decl)
8281 return Context.Int128Decl;
8286 if (Context.UInt128Decl)
8287 return Context.UInt128Decl;
8292 if (Context.ObjCInstanceTypeDecl)
8293 return Context.ObjCInstanceTypeDecl;
8298 if (Context.BuiltinVaListDecl)
8299 return Context.BuiltinVaListDecl;
8310 if (Context.BuiltinMSVaListDecl)
8311 return Context.BuiltinMSVaListDecl;
8320 if (Context.ExternCContext)
8321 return Context.ExternCContext;
8326 if (Context.CFConstantStringTypeDecl)
8327 return Context.CFConstantStringTypeDecl;
8332 if (Context.CFConstantStringTagDecl)
8333 return Context.CFConstantStringTagDecl;
8340#define BuiltinTemplate(BTName) \
8341 case PREDEF_DECL##BTName##_ID: \
8342 if (Context.Decl##BTName) \
8343 return Context.Decl##BTName; \
8344 NewLoaded = Context.get##BTName##Decl(); \
8346#include "clang/Basic/BuiltinTemplates.inc"
8349 llvm_unreachable(
"Invalid decl ID");
8353 assert(NewLoaded &&
"Failed to load predefined decl?");
8355 if (DeserializationListener)
8356 DeserializationListener->PredefinedDeclBuilt(ID, NewLoaded);
8361unsigned ASTReader::translateGlobalDeclIDToIndex(
GlobalDeclID GlobalID)
const {
8362 ModuleFile *OwningModuleFile = getOwningModuleFile(GlobalID);
8363 if (!OwningModuleFile) {
8372 assert(ContextObj &&
"reading decl with no AST context");
8381 Merged.push_back(ID);
8386 unsigned Index = translateGlobalDeclIDToIndex(ID);
8388 if (Index >= DeclsLoaded.size()) {
8389 assert(0 &&
"declaration ID out-of-range for AST file");
8390 Error(
"declaration ID out-of-range for AST file");
8394 return DeclsLoaded[Index];
8399 return GetExistingDecl(ID);
8401 unsigned Index = translateGlobalDeclIDToIndex(ID);
8403 if (Index >= DeclsLoaded.size()) {
8404 assert(0 &&
"declaration ID out-of-range for AST file");
8405 Error(
"declaration ID out-of-range for AST file");
8409 if (!DeclsLoaded[Index]) {
8411 if (DeserializationListener)
8412 DeserializationListener->DeclRead(ID, DeclsLoaded[Index]);
8415 return DeclsLoaded[Index];
8424 ReadModuleOffsetMap(M);
8426 ModuleFile *Owner = getOwningModuleFile(GlobalID);
8434 uint64_t OrignalModuleFileIndex = 0;
8437 OrignalModuleFileIndex = I + 1;
8441 if (!OrignalModuleFileIndex)
8449 if (Idx >=
Record.size()) {
8450 Error(
"Corrupted AST file");
8464 ClearSwitchCaseIDs();
8467 RecordLocation
Loc = getLocalBitOffset(Offset);
8468 if (llvm::Error Err =
Loc.F->DeclsCursor.JumpToBit(
Loc.Offset)) {
8469 Error(std::move(Err));
8472 assert(NumCurrentElementsDeserializing == 0 &&
8473 "should not be called while already deserializing");
8475 return ReadStmtFromStream(*
Loc.F);
8478bool ASTReader::LoadExternalSpecializationsImpl(SpecLookupTableTy &SpecLookups,
8482 auto It = SpecLookups.find(
D);
8483 if (It == SpecLookups.end())
8489 It->second.Table.findAll();
8493 SpecLookups.erase(It);
8495 bool NewSpecsFound =
false;
8496 Deserializing LookupResults(
this);
8497 for (
auto &Info : Infos) {
8498 if (GetExistingDecl(Info))
8500 NewSpecsFound =
true;
8504 return NewSpecsFound;
8510 CompleteRedeclChain(
D);
8511 bool NewSpecsFound =
8512 LoadExternalSpecializationsImpl(PartialSpecializationsLookups,
D);
8514 return NewSpecsFound;
8516 NewSpecsFound |= LoadExternalSpecializationsImpl(SpecializationsLookups,
D);
8517 return NewSpecsFound;
8520bool ASTReader::LoadExternalSpecializationsImpl(
8521 SpecLookupTableTy &SpecLookups,
const Decl *
D,
8525 auto It = SpecLookups.find(
D);
8526 if (It == SpecLookups.end())
8529 llvm::TimeTraceScope TimeScope(
"Load External Specializations for ", [&] {
8531 llvm::raw_string_ostream OS(Name);
8532 auto *ND = cast<NamedDecl>(
D);
8533 ND->getNameForDiagnostic(OS, ND->getASTContext().getPrintingPolicy(),
8538 Deserializing LookupResults(
this);
8543 It->second.Table.find(HashValue);
8545 bool NewSpecsFound =
false;
8546 for (
auto &Info : Infos) {
8547 if (GetExistingDecl(Info))
8549 NewSpecsFound =
true;
8553 return NewSpecsFound;
8560 bool NewDeclsFound = LoadExternalSpecializationsImpl(
8561 PartialSpecializationsLookups,
D, TemplateArgs);
8563 LoadExternalSpecializationsImpl(SpecializationsLookups,
D, TemplateArgs);
8565 return NewDeclsFound;
8574 assert(LexicalDecls.size() % 2 == 0 &&
"expected an even number of entries");
8575 for (
int I = 0, N = LexicalDecls.size(); I != N; I += 2) {
8577 if (!IsKindWeWant(K))
8580 auto ID = (
DeclID) + LexicalDecls[I + 1];
8585 if (PredefsVisited[ID])
8588 PredefsVisited[ID] =
true;
8592 assert(
D->
getKind() == K &&
"wrong kind for lexical decl");
8599 if (isa<TranslationUnitDecl>(DC)) {
8600 for (
const auto &Lexical : TULexicalDecls)
8601 Visit(Lexical.first, Lexical.second);
8603 auto I = LexicalDecls.find(DC);
8604 if (I != LexicalDecls.end())
8605 Visit(I->second.first, I->second.second);
8608 ++NumLexicalDeclContextsRead;
8613class UnalignedDeclIDComp {
8619 : Reader(Reader), Mod(M) {}
8647 unsigned Offset,
unsigned Length,
8651 llvm::DenseMap<FileID, FileDeclsInfo>::iterator I = FileDeclIDs.find(
File);
8652 if (I == FileDeclIDs.end())
8655 FileDeclsInfo &DInfo = I->second;
8656 if (DInfo.Decls.empty())
8660 BeginLoc =
SM.getLocForStartOfFile(
File).getLocWithOffset(Offset);
8663 UnalignedDeclIDComp DIDComp(*
this, *DInfo.Mod);
8665 llvm::lower_bound(DInfo.Decls, BeginLoc, DIDComp);
8666 if (BeginIt != DInfo.Decls.begin())
8672 while (BeginIt != DInfo.Decls.begin() &&
8673 GetDecl(getGlobalDeclID(*DInfo.Mod,
8675 ->isTopLevelDeclInObjCContainer())
8679 llvm::upper_bound(DInfo.Decls, EndLoc, DIDComp);
8680 if (EndIt != DInfo.Decls.end())
8685 Decls.push_back(GetDecl(getGlobalDeclID(
8693 "DeclContext has no visible decls in storage");
8701 auto Find = [&,
this](
auto &&Table,
auto &&Key) {
8703 NamedDecl *ND = cast<NamedDecl>(GetDecl(ID));
8705 Decls.push_back(ND);
8713 if (
auto It = Lookups.find(DC); It != Lookups.end()) {
8714 ++NumVisibleDeclContextsRead;
8715 Find(It->second.Table, Name);
8718 auto FindModuleLocalLookup = [&,
this](
Module *NamedModule) {
8719 if (
auto It = ModuleLocalLookups.find(DC); It != ModuleLocalLookups.end()) {
8720 ++NumModuleLocalVisibleDeclContexts;
8721 Find(It->second.Table, std::make_pair(Name, NamedModule));
8724 if (
auto *NamedModule =
8725 OriginalDC ? cast<Decl>(OriginalDC)->getTopLevelOwningNamedModule()
8727 FindModuleLocalLookup(NamedModule);
8732 if (ContextObj && ContextObj->getCurrentNamedModule())
8733 FindModuleLocalLookup(ContextObj->getCurrentNamedModule());
8735 if (
auto It = TULocalLookups.find(DC); It != TULocalLookups.end()) {
8736 ++NumTULocalVisibleDeclContexts;
8737 Find(It->second.Table, Name);
8740 SetExternalVisibleDeclsForName(DC, Name, Decls);
8741 return !Decls.empty();
8750 auto findAll = [&](
auto &LookupTables,
unsigned &NumRead) {
8751 auto It = LookupTables.find(DC);
8752 if (It == LookupTables.end())
8758 NamedDecl *ND = cast<NamedDecl>(GetDecl(ID));
8765 findAll(Lookups, NumVisibleDeclContextsRead);
8766 findAll(ModuleLocalLookups, NumModuleLocalVisibleDeclContexts);
8767 findAll(TULocalLookups, NumTULocalVisibleDeclContexts);
8769 for (DeclsMap::iterator I = Decls.begin(),
E = Decls.end(); I !=
E; ++I) {
8770 SetExternalVisibleDeclsForName(DC, I->first, I->second);
8772 const_cast<DeclContext *
>(DC)->setHasExternalVisibleStorage(
false);
8777 auto I = Lookups.find(Primary);
8778 return I == Lookups.end() ? nullptr : &I->second;
8783 auto I = ModuleLocalLookups.find(Primary);
8784 return I == ModuleLocalLookups.end() ? nullptr : &I->second;
8789 auto I = TULocalLookups.find(Primary);
8790 return I == TULocalLookups.end() ? nullptr : &I->second;
8797 IsPartial ? PartialSpecializationsLookups : SpecializationsLookups;
8798 auto I = LookupTable.find(
D);
8799 return I == LookupTable.end() ? nullptr : &I->second;
8804 return PartialSpecializationsLookups.contains(
D) ||
8805 SpecializationsLookups.contains(
D);
8814 assert(ImplD && Consumer);
8816 for (
auto *I : ImplD->
methods())
8822void ASTReader::PassInterestingDeclToConsumer(
Decl *
D) {
8830 Consumer->HandleVTable(RD);
8834 this->Consumer = Consumer;
8837 PassInterestingDeclsToConsumer();
8839 if (DeserializationListener)
8840 DeserializationListener->ReaderInitialized(
this);
8844 std::fprintf(stderr,
"*** AST File Statistics:\n");
8846 unsigned NumTypesLoaded =
8847 TypesLoaded.size() - llvm::count(TypesLoaded.materialized(),
QualType());
8848 unsigned NumDeclsLoaded =
8849 DeclsLoaded.size() -
8850 llvm::count(DeclsLoaded.materialized(), (
Decl *)
nullptr);
8851 unsigned NumIdentifiersLoaded =
8852 IdentifiersLoaded.size() -
8854 unsigned NumMacrosLoaded =
8855 MacrosLoaded.size() - llvm::count(MacrosLoaded, (
MacroInfo *)
nullptr);
8856 unsigned NumSelectorsLoaded =
8857 SelectorsLoaded.size() - llvm::count(SelectorsLoaded,
Selector());
8859 if (
unsigned TotalNumSLocEntries = getTotalNumSLocs())
8860 std::fprintf(stderr,
" %u/%u source location entries read (%f%%)\n",
8861 NumSLocEntriesRead, TotalNumSLocEntries,
8862 ((
float)NumSLocEntriesRead/TotalNumSLocEntries * 100));
8863 if (!TypesLoaded.empty())
8864 std::fprintf(stderr,
" %u/%u types read (%f%%)\n",
8865 NumTypesLoaded, (
unsigned)TypesLoaded.size(),
8866 ((
float)NumTypesLoaded/TypesLoaded.size() * 100));
8867 if (!DeclsLoaded.empty())
8868 std::fprintf(stderr,
" %u/%u declarations read (%f%%)\n",
8869 NumDeclsLoaded, (
unsigned)DeclsLoaded.size(),
8870 ((
float)NumDeclsLoaded/DeclsLoaded.size() * 100));
8871 if (!IdentifiersLoaded.empty())
8872 std::fprintf(stderr,
" %u/%u identifiers read (%f%%)\n",
8873 NumIdentifiersLoaded, (
unsigned)IdentifiersLoaded.size(),
8874 ((
float)NumIdentifiersLoaded/IdentifiersLoaded.size() * 100));
8875 if (!MacrosLoaded.empty())
8876 std::fprintf(stderr,
" %u/%u macros read (%f%%)\n",
8877 NumMacrosLoaded, (
unsigned)MacrosLoaded.size(),
8878 ((
float)NumMacrosLoaded/MacrosLoaded.size() * 100));
8879 if (!SelectorsLoaded.empty())
8880 std::fprintf(stderr,
" %u/%u selectors read (%f%%)\n",
8881 NumSelectorsLoaded, (
unsigned)SelectorsLoaded.size(),
8882 ((
float)NumSelectorsLoaded/SelectorsLoaded.size() * 100));
8883 if (TotalNumStatements)
8884 std::fprintf(stderr,
" %u/%u statements read (%f%%)\n",
8885 NumStatementsRead, TotalNumStatements,
8886 ((
float)NumStatementsRead/TotalNumStatements * 100));
8888 std::fprintf(stderr,
" %u/%u macros read (%f%%)\n",
8889 NumMacrosRead, TotalNumMacros,
8890 ((
float)NumMacrosRead/TotalNumMacros * 100));
8891 if (TotalLexicalDeclContexts)
8892 std::fprintf(stderr,
" %u/%u lexical declcontexts read (%f%%)\n",
8893 NumLexicalDeclContextsRead, TotalLexicalDeclContexts,
8894 ((
float)NumLexicalDeclContextsRead/TotalLexicalDeclContexts
8896 if (TotalVisibleDeclContexts)
8897 std::fprintf(stderr,
" %u/%u visible declcontexts read (%f%%)\n",
8898 NumVisibleDeclContextsRead, TotalVisibleDeclContexts,
8899 ((
float)NumVisibleDeclContextsRead/TotalVisibleDeclContexts
8901 if (TotalModuleLocalVisibleDeclContexts)
8903 stderr,
" %u/%u module local visible declcontexts read (%f%%)\n",
8904 NumModuleLocalVisibleDeclContexts, TotalModuleLocalVisibleDeclContexts,
8905 ((
float)NumModuleLocalVisibleDeclContexts /
8906 TotalModuleLocalVisibleDeclContexts * 100));
8907 if (TotalTULocalVisibleDeclContexts)
8908 std::fprintf(stderr,
" %u/%u visible declcontexts in GMF read (%f%%)\n",
8909 NumTULocalVisibleDeclContexts, TotalTULocalVisibleDeclContexts,
8910 ((
float)NumTULocalVisibleDeclContexts /
8911 TotalTULocalVisibleDeclContexts * 100));
8912 if (TotalNumMethodPoolEntries)
8913 std::fprintf(stderr,
" %u/%u method pool entries read (%f%%)\n",
8914 NumMethodPoolEntriesRead, TotalNumMethodPoolEntries,
8915 ((
float)NumMethodPoolEntriesRead/TotalNumMethodPoolEntries
8917 if (NumMethodPoolLookups)
8918 std::fprintf(stderr,
" %u/%u method pool lookups succeeded (%f%%)\n",
8919 NumMethodPoolHits, NumMethodPoolLookups,
8920 ((
float)NumMethodPoolHits/NumMethodPoolLookups * 100.0));
8921 if (NumMethodPoolTableLookups)
8922 std::fprintf(stderr,
" %u/%u method pool table lookups succeeded (%f%%)\n",
8923 NumMethodPoolTableHits, NumMethodPoolTableLookups,
8924 ((
float)NumMethodPoolTableHits/NumMethodPoolTableLookups
8926 if (NumIdentifierLookupHits)
8927 std::fprintf(stderr,
8928 " %u / %u identifier table lookups succeeded (%f%%)\n",
8929 NumIdentifierLookupHits, NumIdentifierLookups,
8930 (
double)NumIdentifierLookupHits*100.0/NumIdentifierLookups);
8933 std::fprintf(stderr,
"\n");
8934 GlobalIndex->printStats();
8937 std::fprintf(stderr,
"\n");
8939 std::fprintf(stderr,
"\n");
8942template<
typename Key,
typename ModuleFile,
unsigned InitialCapacity>
8943LLVM_DUMP_METHOD
static void
8946 InitialCapacity> &Map) {
8947 if (Map.begin() == Map.end())
8952 llvm::errs() << Name <<
":\n";
8953 for (
typename MapType::const_iterator I = Map.begin(), IEnd = Map.end();
8955 llvm::errs() <<
" " << (
DeclID)I->first <<
" -> " << I->second->FileName
8960 llvm::errs() <<
"*** PCH/ModuleFile Remappings:\n";
8962 dumpModuleIDMap(
"Global source location entry map", GlobalSLocEntryMap);
8967 GlobalPreprocessedEntityMap);
8969 llvm::errs() <<
"\n*** PCH/Modules Loaded:";
8978 if (llvm::MemoryBuffer *buf = I.Buffer) {
8979 size_t bytes = buf->getBufferSize();
8980 switch (buf->getBufferKind()) {
8981 case llvm::MemoryBuffer::MemoryBuffer_Malloc:
8984 case llvm::MemoryBuffer::MemoryBuffer_MMap:
9000 pushExternalDeclIntoScope(
D,
D->getDeclName());
9002 PreloadedDeclIDs.clear();
9005 if (!FPPragmaOptions.empty()) {
9006 assert(FPPragmaOptions.size() == 1 &&
"Wrong number of FP_PRAGMA_OPTIONS");
9009 SemaObj->CurFPFeatures =
9014 Decl *
D = GetDecl(ID);
9015 if (
auto *FD = dyn_cast<FunctionDecl>(
D))
9016 SemaObj->addDeclWithEffects(FD, FD->getFunctionEffects());
9017 else if (
auto *BD = dyn_cast<BlockDecl>(
D))
9018 SemaObj->addDeclWithEffects(BD, BD->getFunctionEffects());
9020 llvm_unreachable(
"unexpected Decl type in DeclsWithEffectsToVerify");
9022 DeclsWithEffectsToVerify.clear();
9024 SemaObj->OpenCLFeatures = OpenCLExtensions;
9030 assert(SemaObj &&
"no Sema to update");
9034 if (!SemaDeclRefs.empty()) {
9035 assert(SemaDeclRefs.size() % 3 == 0);
9036 for (
unsigned I = 0; I != SemaDeclRefs.size(); I += 3) {
9037 if (!SemaObj->StdNamespace)
9038 SemaObj->StdNamespace = SemaDeclRefs[I].getRawValue();
9039 if (!SemaObj->StdBadAlloc)
9040 SemaObj->StdBadAlloc = SemaDeclRefs[I + 1].getRawValue();
9041 if (!SemaObj->StdAlignValT)
9042 SemaObj->StdAlignValT = SemaDeclRefs[I + 2].getRawValue();
9044 SemaDeclRefs.clear();
9049 if(OptimizeOffPragmaLocation.isValid())
9050 SemaObj->ActOnPragmaOptimize(
false, OptimizeOffPragmaLocation);
9051 if (PragmaMSStructState != -1)
9053 if (PointersToMembersPragmaLocation.isValid()) {
9054 SemaObj->ActOnPragmaMSPointersToMembers(
9056 PragmaMSPointersToMembersState,
9057 PointersToMembersPragmaLocation);
9059 SemaObj->CUDA().ForceHostDeviceDepth = ForceHostDeviceDepth;
9061 if (PragmaAlignPackCurrentValue) {
9065 bool DropFirst =
false;
9066 if (!PragmaAlignPackStack.empty() &&
9067 PragmaAlignPackStack.front().Location.isInvalid()) {
9068 assert(PragmaAlignPackStack.front().Value ==
9069 SemaObj->AlignPackStack.DefaultValue &&
9070 "Expected a default alignment value");
9071 SemaObj->AlignPackStack.Stack.emplace_back(
9072 PragmaAlignPackStack.front().SlotLabel,
9073 SemaObj->AlignPackStack.CurrentValue,
9074 SemaObj->AlignPackStack.CurrentPragmaLocation,
9075 PragmaAlignPackStack.front().PushLocation);
9078 for (
const auto &Entry :
9079 llvm::ArrayRef(PragmaAlignPackStack).drop_front(DropFirst ? 1 : 0)) {
9080 SemaObj->AlignPackStack.Stack.emplace_back(
9081 Entry.SlotLabel, Entry.Value, Entry.Location, Entry.PushLocation);
9083 if (PragmaAlignPackCurrentLocation.isInvalid()) {
9084 assert(*PragmaAlignPackCurrentValue ==
9085 SemaObj->AlignPackStack.DefaultValue &&
9086 "Expected a default align and pack value");
9089 SemaObj->AlignPackStack.CurrentValue = *PragmaAlignPackCurrentValue;
9090 SemaObj->AlignPackStack.CurrentPragmaLocation =
9091 PragmaAlignPackCurrentLocation;
9094 if (FpPragmaCurrentValue) {
9098 bool DropFirst =
false;
9099 if (!FpPragmaStack.empty() && FpPragmaStack.front().Location.isInvalid()) {
9100 assert(FpPragmaStack.front().Value ==
9101 SemaObj->FpPragmaStack.DefaultValue &&
9102 "Expected a default pragma float_control value");
9103 SemaObj->FpPragmaStack.Stack.emplace_back(
9104 FpPragmaStack.front().SlotLabel, SemaObj->FpPragmaStack.CurrentValue,
9105 SemaObj->FpPragmaStack.CurrentPragmaLocation,
9106 FpPragmaStack.front().PushLocation);
9109 for (
const auto &Entry :
9111 SemaObj->FpPragmaStack.Stack.emplace_back(
9112 Entry.SlotLabel, Entry.Value, Entry.Location, Entry.PushLocation);
9113 if (FpPragmaCurrentLocation.isInvalid()) {
9114 assert(*FpPragmaCurrentValue == SemaObj->FpPragmaStack.DefaultValue &&
9115 "Expected a default pragma float_control value");
9118 SemaObj->FpPragmaStack.CurrentValue = *FpPragmaCurrentValue;
9119 SemaObj->FpPragmaStack.CurrentPragmaLocation = FpPragmaCurrentLocation;
9124 for (
auto &Import : PendingImportedModulesSema) {
9125 if (Import.ImportLoc.isInvalid())
9127 if (
Module *Imported = getSubmodule(Import.ID)) {
9128 SemaObj->makeModuleVisible(Imported, Import.ImportLoc);
9131 PendingImportedModulesSema.clear();
9138 IdentifierLookupVisitor Visitor(Name, 0,
9139 NumIdentifierLookups,
9140 NumIdentifierLookupHits);
9146 if (PP.getLangOpts().CPlusPlus) {
9147 for (
auto *F : ModuleMgr.pch_modules())
9155 if (!loadGlobalIndex()) {
9156 if (GlobalIndex->lookupIdentifier(Name, Hits)) {
9161 ModuleMgr.visit(Visitor, HitsPtr);
9165 markIdentifierUpToDate(II);
9183 ASTIdentifierLookupTable::key_iterator Current;
9187 ASTIdentifierLookupTable::key_iterator End;
9194 bool SkipModules =
false);
9196 StringRef Next()
override;
9203 : Reader(Reader), Index(Reader.ModuleMgr.size()), SkipModules(SkipModules) {
9207 while (Current == End) {
9219 Current = IdTable->key_begin();
9220 End = IdTable->key_end();
9225 StringRef
Result = *Current;
9234 std::unique_ptr<IdentifierIterator> Current;
9235 std::unique_ptr<IdentifierIterator> Queued;
9238 ChainedIdentifierIterator(std::unique_ptr<IdentifierIterator>
First,
9239 std::unique_ptr<IdentifierIterator> Second)
9240 : Current(
std::move(
First)), Queued(
std::move(Second)) {}
9242 StringRef Next()
override {
9246 StringRef result = Current->Next();
9247 if (!result.empty())
9252 std::swap(Current, Queued);
9261 std::unique_ptr<IdentifierIterator> ReaderIter(
9263 std::unique_ptr<IdentifierIterator> ModulesIter(
9264 GlobalIndex->createIdentifierIterator());
9265 return new ChainedIdentifierIterator(std::move(ReaderIter),
9266 std::move(ModulesIter));
9273namespace serialization {
9278 unsigned PriorGeneration;
9279 unsigned InstanceBits = 0;
9280 unsigned FactoryBits = 0;
9281 bool InstanceHasMoreThanOneDecl =
false;
9282 bool FactoryHasMoreThanOneDecl =
false;
9288 unsigned PriorGeneration)
9289 : Reader(Reader), Sel(Sel), PriorGeneration(PriorGeneration) {}
9299 ++Reader.NumMethodPoolTableLookups;
9302 ASTSelectorLookupTable::iterator Pos = PoolTable->find(Sel);
9303 if (Pos == PoolTable->end())
9306 ++Reader.NumMethodPoolTableHits;
9307 ++Reader.NumSelectorsRead;
9311 ++Reader.NumMethodPoolEntriesRead;
9313 if (Reader.DeserializationListener)
9319 InstanceMethods.append(
Data.Instance.rbegin(),
Data.Instance.rend());
9320 FactoryMethods.append(
Data.Factory.rbegin(),
Data.Factory.rend());
9321 InstanceBits =
Data.InstanceBits;
9322 FactoryBits =
Data.FactoryBits;
9323 InstanceHasMoreThanOneDecl =
Data.InstanceHasMoreThanOneDecl;
9324 FactoryHasMoreThanOneDecl =
Data.FactoryHasMoreThanOneDecl;
9330 return InstanceMethods;
9335 return FactoryMethods;
9342 return InstanceHasMoreThanOneDecl;
9360 unsigned &Generation = SelectorGeneration[Sel];
9361 unsigned PriorGeneration = Generation;
9363 SelectorOutOfDate[Sel] =
false;
9366 ++NumMethodPoolLookups;
9368 ModuleMgr.
visit(Visitor);
9374 ++NumMethodPoolHits;
9395 if (SelectorOutOfDate[Sel])
9403 for (
unsigned I = 0, N = KnownNamespaces.size(); I != N; ++I) {
9405 = dyn_cast_or_null<NamespaceDecl>(
GetDecl(KnownNamespaces[I])))
9406 Namespaces.push_back(Namespace);
9411 llvm::MapVector<NamedDecl *, SourceLocation> &
Undefined) {
9412 for (
unsigned Idx = 0, N = UndefinedButUsed.size(); Idx != N;) {
9413 UndefinedButUsedDecl &
U = UndefinedButUsed[Idx++];
9418 UndefinedButUsed.clear();
9424 for (
unsigned Idx = 0, N = DelayedDeleteExprs.size(); Idx != N;) {
9427 uint64_t Count = DelayedDeleteExprs[Idx++];
9428 for (uint64_t
C = 0;
C < Count; ++
C) {
9431 const bool IsArrayForm = DelayedDeleteExprs[Idx++];
9432 Exprs[FD].push_back(std::make_pair(DeleteLoc, IsArrayForm));
9439 for (
unsigned I = 0, N = TentativeDefinitions.size(); I != N; ++I) {
9440 VarDecl *Var = dyn_cast_or_null<VarDecl>(
GetDecl(TentativeDefinitions[I]));
9442 TentativeDefs.push_back(Var);
9444 TentativeDefinitions.clear();
9449 for (
unsigned I = 0, N = UnusedFileScopedDecls.size(); I != N; ++I) {
9451 = dyn_cast_or_null<DeclaratorDecl>(
GetDecl(UnusedFileScopedDecls[I]));
9455 UnusedFileScopedDecls.clear();
9460 for (
unsigned I = 0, N = DelegatingCtorDecls.size(); I != N; ++I) {
9462 = dyn_cast_or_null<CXXConstructorDecl>(
GetDecl(DelegatingCtorDecls[I]));
9466 DelegatingCtorDecls.clear();
9470 for (
unsigned I = 0, N = ExtVectorDecls.size(); I != N; ++I) {
9472 = dyn_cast_or_null<TypedefNameDecl>(
GetDecl(ExtVectorDecls[I]));
9476 ExtVectorDecls.clear();
9481 for (
unsigned I = 0, N = UnusedLocalTypedefNameCandidates.size(); I != N;
9484 GetDecl(UnusedLocalTypedefNameCandidates[I]));
9488 UnusedLocalTypedefNameCandidates.clear();
9493 for (
auto I : DeclsToCheckForDeferredDiags) {
9494 auto *
D = dyn_cast_or_null<Decl>(
GetDecl(I));
9498 DeclsToCheckForDeferredDiags.clear();
9503 if (ReferencedSelectorsData.empty())
9508 unsigned int DataSize = ReferencedSelectorsData.size()-1;
9510 while (I < DataSize) {
9514 Sels.push_back(std::make_pair(Sel, SelLoc));
9516 ReferencedSelectorsData.clear();
9521 if (WeakUndeclaredIdentifiers.empty())
9524 for (
unsigned I = 0, N = WeakUndeclaredIdentifiers.size(); I < N; ) {
9532 WeakIDs.push_back(std::make_pair(WeakId, WI));
9534 WeakUndeclaredIdentifiers.clear();
9538 for (
unsigned Idx = 0, N = VTableUses.size(); Idx < N; ) {
9540 VTableUse &TableInfo = VTableUses[Idx++];
9541 VT.
Record = dyn_cast_or_null<CXXRecordDecl>(
GetDecl(TableInfo.ID));
9544 VTables.push_back(VT);
9552 for (
unsigned Idx = 0, N = PendingInstantiations.size(); Idx < N;) {
9553 PendingInstantiation &Inst = PendingInstantiations[Idx++];
9557 Pending.push_back(std::make_pair(
D,
Loc));
9559 PendingInstantiations.clear();
9563 llvm::MapVector<
const FunctionDecl *, std::unique_ptr<LateParsedTemplate>>
9565 for (
auto &LPT : LateParsedTemplates) {
9568 for (
unsigned Idx = 0, N = LateParsed.size(); Idx < N;
9570 FunctionDecl *FD = ReadDeclAs<FunctionDecl>(*FMod, LateParsed, Idx);
9572 auto LT = std::make_unique<LateParsedTemplate>();
9577 assert(F &&
"No module");
9579 unsigned TokN = LateParsed[Idx++];
9580 LT->Toks.reserve(TokN);
9581 for (
unsigned T = 0;
T < TokN; ++
T)
9582 LT->Toks.push_back(
ReadToken(*F, LateParsed, Idx));
9584 LPTMap.insert(std::make_pair(FD, std::move(
LT)));
9588 LateParsedTemplates.clear();
9600 if (
auto Iter = LambdaDeclarationsForMerging.find(LambdaInfo);
9601 Iter != LambdaDeclarationsForMerging.end() &&
9604 cast<CXXRecordDecl>(
Iter->second)->getMostRecentDecl();
9611 LambdaDeclarationsForMerging.insert({LambdaInfo, Lambda});
9620 assert(ID &&
"Non-zero identifier ID required");
9621 unsigned Index = translateIdentifierIDToIndex(ID).second;
9622 assert(Index < IdentifiersLoaded.size() &&
"identifier ID out of range");
9623 IdentifiersLoaded[Index] = II;
9624 if (DeserializationListener)
9647 if (NumCurrentElementsDeserializing && !Decls) {
9648 PendingIdentifierInfos[II].append(DeclIDs.begin(), DeclIDs.end());
9652 for (
unsigned I = 0, N = DeclIDs.size(); I != N; ++I) {
9665 Decls->push_back(
D);
9672 pushExternalDeclIntoScope(
D, II);
9676std::pair<ModuleFile *, unsigned>
9677ASTReader::translateIdentifierIDToIndex(
IdentifierID ID)
const {
9679 return {
nullptr, 0};
9681 unsigned ModuleFileIndex = ID >> 32;
9682 unsigned LocalID = ID & llvm::maskTrailingOnes<IdentifierID>(32);
9684 assert(ModuleFileIndex &&
"not translating loaded IdentifierID?");
9696 if (IdentifiersLoaded.empty()) {
9697 Error(
"no identifier table in AST file");
9701 auto [M, Index] = translateIdentifierIDToIndex(ID);
9702 if (!IdentifiersLoaded[Index]) {
9703 assert(M !=
nullptr &&
"Untranslated Identifier ID?");
9706 const unsigned char *
Data =
9713 IdentifiersLoaded[Index] = &II;
9716 if (DeserializationListener)
9720 return IdentifiersLoaded[Index];
9732 ReadModuleOffsetMap(M);
9734 unsigned ModuleFileIndex = LocalID >> 32;
9735 LocalID &= llvm::maskTrailingOnes<IdentifierID>(32);
9738 assert(MF &&
"malformed identifier ID encoding?");
9740 if (!ModuleFileIndex)
9750 if (MacrosLoaded.empty()) {
9751 Error(
"no macro table in AST file");
9756 if (!MacrosLoaded[ID]) {
9759 assert(I != GlobalMacroMap.
end() &&
"Corrupted global macro map");
9765 if (DeserializationListener)
9770 return MacrosLoaded[ID];
9778 ReadModuleOffsetMap(M);
9782 assert(I != M.
MacroRemap.
end() &&
"Invalid index into macro index remap");
9784 return LocalID + I->second;
9793 ReadModuleOffsetMap(M);
9798 &&
"Invalid index into submodule index remap");
9800 return LocalID + I->second;
9805 assert(GlobalID == 0 &&
"Unhandled global submodule ID");
9809 if (GlobalID > SubmodulesLoaded.size()) {
9810 Error(
"submodule ID out of range in AST file");
9825 return I == GlobalSubmoduleMap.
end() ? nullptr : I->second;
9828 int IndexFromEnd =
static_cast<int>(ID >> 1);
9829 assert(IndexFromEnd &&
"got reference to unknown module file");
9846 auto I = llvm::find(PCHModules, M);
9847 assert(I != PCHModules.end() &&
"emitting reference to unknown file");
9848 return std::distance(I, PCHModules.end()) << 1;
9858 if (std::distance(std::begin(PCHChain), std::end(PCHChain))) {
9863 llvm::sys::path::parent_path(MF.
FileName),
9866 return std::nullopt;
9870 auto I = DefinitionSource.find(FD);
9871 if (I == DefinitionSource.end())
9877 return ThisDeclarationWasADefinitionSet.contains(FD);
9888 if (ID > SelectorsLoaded.size()) {
9889 Error(
"selector ID out of range in AST file");
9893 if (SelectorsLoaded[ID - 1].getAsOpaquePtr() ==
nullptr) {
9896 assert(I != GlobalSelectorMap.
end() &&
"Corrupted global selector map");
9900 SelectorsLoaded[ID - 1] =
9902 if (DeserializationListener)
9903 DeserializationListener->
SelectorRead(ID, SelectorsLoaded[ID - 1]);
9906 return SelectorsLoaded[ID - 1];
9924 ReadModuleOffsetMap(M);
9929 &&
"Invalid index into selector index remap");
9931 return LocalID + I->second;
9936 switch (Name.getNameKind()) {
9962 NameInfo.
setName(readDeclarationName());
9983 unsigned NumTPLists =
readInt();
9988 for (
unsigned i = 0; i != NumTPLists; ++i)
9999 unsigned NumParams =
readInt();
10001 Params.reserve(NumParams);
10002 while (NumParams--)
10003 Params.push_back(readDeclAs<NamedDecl>());
10005 bool HasRequiresClause =
readBool();
10006 Expr *RequiresClause = HasRequiresClause ?
readExpr() :
nullptr;
10009 getContext(), TemplateLoc, LAngleLoc, Params, RAngleLoc, RequiresClause);
10010 return TemplateParams;
10015 bool Canonicalize) {
10016 unsigned NumTemplateArgs =
readInt();
10017 TemplArgs.reserve(NumTemplateArgs);
10018 while (NumTemplateArgs--)
10024 unsigned NumDecls =
readInt();
10026 while (NumDecls--) {
10038 bool inheritConstructors =
readBool();
10044 Result.setInheritConstructors(inheritConstructors);
10051 unsigned NumInitializers =
readInt();
10052 assert(NumInitializers &&
"wrote ctor initializers but have no inits");
10054 for (
unsigned i = 0; i != NumInitializers; ++i) {
10056 bool IsBaseVirtual =
false;
10072 Member = readDeclAs<FieldDecl>();
10076 IndirectMember = readDeclAs<IndirectFieldDecl>();
10087 BOMInit =
new (Context)
10089 RParenLoc, MemberOrEllipsisLoc);
10091 BOMInit =
new (Context)
10094 BOMInit =
new (Context)
10098 BOMInit =
new (Context)
10100 LParenLoc,
Init, RParenLoc);
10103 unsigned SourceOrder =
readInt();
10107 CtorInitializers[i] = BOMInit;
10110 return CtorInitializers;
10118 for (
unsigned I = 0; I != N; ++I) {
10119 auto Kind = readNestedNameSpecifierKind();
10122 auto *NS = readDeclAs<NamespaceBaseDecl>();
10133 Builder.Make(Context,
T->getTypeLoc(), ColonColonLoc);
10139 Builder.MakeGlobal(Context, ColonColonLoc);
10151 llvm_unreachable(
"unexpected null nested name specifier");
10155 return Builder.getWithLocInContext(Context);
10166 const StringRef Blob) {
10167 unsigned Count =
Record[0];
10168 const char *Byte = Blob.data();
10169 llvm::BitVector Ret = llvm::BitVector(Count,
false);
10170 for (
unsigned I = 0; I < Count; ++Byte)
10171 for (
unsigned Bit = 0; Bit < 8 && I < Count; ++Bit, ++I)
10172 if (*Byte & (1 << Bit))
10179 return llvm::APFloat(Sem,
readAPInt());
10184 unsigned Len =
Record[Idx++];
10192 unsigned Len =
Record[Idx++];
10193 StringRef
Result = Blob.substr(0, Len);
10194 Blob = Blob.substr(Len);
10218 unsigned Major =
Record[Idx++];
10219 unsigned Minor =
Record[Idx++];
10220 unsigned Subminor =
Record[Idx++];
10222 return VersionTuple(Major);
10224 return VersionTuple(Major, Minor - 1);
10225 return VersionTuple(Major, Minor - 1, Subminor - 1);
10236 return Diag(CurrentImportLoc, DiagID);
10244 llvm::function_ref<
void()> Fn) {
10263 assert((*CurrSwitchCaseStmts)[ID] ==
nullptr &&
10264 "Already have a SwitchCase with this ID");
10265 (*CurrSwitchCaseStmts)[ID] = SC;
10270 assert((*CurrSwitchCaseStmts)[ID] !=
nullptr &&
"No SwitchCase with this ID");
10271 return (*CurrSwitchCaseStmts)[ID];
10275 CurrSwitchCaseStmts->clear();
10280 std::vector<RawComment *> Comments;
10287 BitstreamCursor &Cursor = I->first;
10294 Cursor.advanceSkippingSubblocks(
10295 BitstreamCursor::AF_DontPopBlockAtEnd);
10297 Error(MaybeEntry.takeError());
10300 llvm::BitstreamEntry Entry = MaybeEntry.get();
10302 switch (Entry.Kind) {
10303 case llvm::BitstreamEntry::SubBlock:
10304 case llvm::BitstreamEntry::Error:
10305 Error(
"malformed block record in AST file");
10307 case llvm::BitstreamEntry::EndBlock:
10309 case llvm::BitstreamEntry::Record:
10317 if (!MaybeComment) {
10318 Error(MaybeComment.takeError());
10327 bool IsTrailingComment =
Record[Idx++];
10328 bool IsAlmostTrailingComment =
Record[Idx++];
10329 Comments.push_back(
new (Context)
RawComment(
10330 SR, Kind, IsTrailingComment, IsAlmostTrailingComment));
10354 assert(NumUserInputs <= NumInputs);
10355 unsigned N = IncludeSystem ? NumInputs : NumUserInputs;
10356 for (
unsigned I = 0; I < N; ++I) {
10357 bool IsSystem = I >= NumUserInputs;
10359 Visitor(IFI, IsSystem);
10364 bool IncludeSystem,
bool Complain,
10366 bool isSystem)> Visitor) {
10369 assert(NumUserInputs <= NumInputs);
10370 unsigned N = IncludeSystem ? NumInputs : NumUserInputs;
10371 for (
unsigned I = 0; I < N; ++I) {
10372 bool IsSystem = I >= NumUserInputs;
10373 InputFile IF = getInputFile(MF, I+1, Complain);
10374 Visitor(IF, IsSystem);
10382 for (
unsigned I = 0; I < NumInputs; ++I) {
10385 if (
auto FE = getInputFile(MF, I + 1).getFile())
10390void ASTReader::finishPendingActions() {
10391 while (!PendingIdentifierInfos.empty() ||
10392 !PendingDeducedFunctionTypes.empty() ||
10393 !PendingDeducedVarTypes.empty() || !PendingDeclChains.empty() ||
10394 !PendingMacroIDs.empty() || !PendingDeclContextInfos.empty() ||
10395 !PendingUpdateRecords.empty() ||
10396 !PendingObjCExtensionIvarRedeclarations.empty()) {
10399 using TopLevelDeclsMap =
10400 llvm::DenseMap<IdentifierInfo *, SmallVector<Decl *, 2>>;
10401 TopLevelDeclsMap TopLevelDecls;
10403 while (!PendingIdentifierInfos.empty()) {
10406 std::move(PendingIdentifierInfos.back().second);
10407 PendingIdentifierInfos.pop_back();
10414 for (
unsigned I = 0; I != PendingDeducedFunctionTypes.size(); ++I) {
10415 auto *FD = PendingDeducedFunctionTypes[I].first;
10416 FD->setType(
GetType(PendingDeducedFunctionTypes[I].second));
10418 if (
auto *DT = FD->getReturnType()->getContainedDeducedType()) {
10421 if (DT->isDeduced()) {
10422 PendingDeducedTypeUpdates.insert(
10423 {FD->getCanonicalDecl(), FD->getReturnType()});
10430 PendingUndeducedFunctionDecls.push_back(FD);
10434 PendingDeducedFunctionTypes.clear();
10438 for (
unsigned I = 0; I != PendingDeducedVarTypes.size(); ++I) {
10439 auto *VD = PendingDeducedVarTypes[I].first;
10440 VD->setType(
GetType(PendingDeducedVarTypes[I].second));
10442 PendingDeducedVarTypes.clear();
10445 for (
unsigned I = 0; I != PendingDeclChains.size(); ++I)
10446 loadPendingDeclChain(PendingDeclChains[I].first,
10447 PendingDeclChains[I].second);
10448 PendingDeclChains.clear();
10451 for (TopLevelDeclsMap::iterator TLD = TopLevelDecls.begin(),
10452 TLDEnd = TopLevelDecls.end(); TLD != TLDEnd; ++TLD) {
10454 for (
unsigned I = 0, N = TLD->second.size(); I != N; ++I) {
10455 pushExternalDeclIntoScope(cast<NamedDecl>(TLD->second[I]), II);
10460 for (
unsigned I = 0; I != PendingMacroIDs.size(); ++I) {
10463 GlobalIDs.swap(PendingMacroIDs.begin()[I].second);
10465 for (
unsigned IDIdx = 0, NumIDs = GlobalIDs.size(); IDIdx != NumIDs;
10467 const PendingMacroInfo &Info = GlobalIDs[IDIdx];
10468 if (!Info.M->isModule())
10472 for (
unsigned IDIdx = 0, NumIDs = GlobalIDs.size(); IDIdx != NumIDs;
10474 const PendingMacroInfo &Info = GlobalIDs[IDIdx];
10475 if (Info.M->isModule())
10479 PendingMacroIDs.clear();
10483 while (!PendingDeclContextInfos.empty()) {
10484 PendingDeclContextInfo Info = PendingDeclContextInfos.front();
10485 PendingDeclContextInfos.pop_front();
10488 Info.D->setDeclContextsImpl(SemaDC, LexicalDC,
getContext());
10492 while (!PendingUpdateRecords.empty()) {
10493 auto Update = PendingUpdateRecords.pop_back_val();
10494 ReadingKindTracker ReadingKind(Read_Decl, *
this);
10495 loadDeclUpdateRecords(
Update);
10498 while (!PendingObjCExtensionIvarRedeclarations.empty()) {
10499 auto ExtensionsPair = PendingObjCExtensionIvarRedeclarations.back().first;
10500 auto DuplicateIvars =
10501 PendingObjCExtensionIvarRedeclarations.back().second;
10504 ContextObj->
getLangOpts(), ExtensionsPair.first->getASTContext(),
10505 ExtensionsPair.second->getASTContext(), NonEquivalentDecls,
10509 if (Ctx.IsEquivalent(ExtensionsPair.first, ExtensionsPair.second)) {
10511 for (
auto IvarPair : DuplicateIvars) {
10512 ObjCIvarDecl *Ivar = IvarPair.first, *PrevIvar = IvarPair.second;
10514 Ivar->setDeclContextsImpl(PrevIvar->getDeclContext(),
10520 ExtensionsPair.first->setInvalidDecl();
10521 ExtensionsPair.second->getClassInterface()
10523 ->setIvarList(
nullptr);
10525 for (
auto IvarPair : DuplicateIvars) {
10526 Diag(IvarPair.first->getLocation(),
10527 diag::err_duplicate_ivar_declaration)
10528 << IvarPair.first->getIdentifier();
10529 Diag(IvarPair.second->getLocation(), diag::note_previous_definition);
10532 PendingObjCExtensionIvarRedeclarations.pop_back();
10538 assert(PendingFakeDefinitionData.empty() &&
10539 "faked up a class definition but never saw the real one");
10545 for (
Decl *
D : PendingDefinitions) {
10546 if (
TagDecl *TD = dyn_cast<TagDecl>(
D)) {
10547 if (
auto *RD = dyn_cast<CXXRecordDecl>(TD)) {
10548 for (
auto *R = getMostRecentExistingDecl(RD); R;
10551 cast<CXXRecordDecl>(R)->isThisDeclarationADefinition() &&
10552 "declaration thinks it's the definition but it isn't");
10553 cast<CXXRecordDecl>(R)->DefinitionData = RD->DefinitionData;
10560 if (
auto ID = dyn_cast<ObjCInterfaceDecl>(
D)) {
10565 for (
auto *R = getMostRecentExistingDecl(ID); R; R = R->
getPreviousDecl())
10566 cast<ObjCInterfaceDecl>(R)->Data =
ID->Data;
10571 if (
auto PD = dyn_cast<ObjCProtocolDecl>(
D)) {
10572 for (
auto *R = getMostRecentExistingDecl(PD); R; R = R->
getPreviousDecl())
10573 cast<ObjCProtocolDecl>(R)->Data = PD->Data;
10578 auto RTD = cast<RedeclarableTemplateDecl>(
D)->getCanonicalDecl();
10579 for (
auto *R = getMostRecentExistingDecl(RTD); R; R = R->
getPreviousDecl())
10580 cast<RedeclarableTemplateDecl>(R)->Common = RTD->Common;
10582 PendingDefinitions.clear();
10584 for (
auto [
D,
Previous] : PendingWarningForDuplicatedDefsInModuleUnits) {
10585 auto hasDefinitionImpl = [
this](
Decl *
D,
auto hasDefinitionImpl) {
10586 if (
auto *VD = dyn_cast<VarDecl>(
D))
10587 return VD->isThisDeclarationADefinition() ||
10588 VD->isThisDeclarationADemotedDefinition();
10590 if (
auto *TD = dyn_cast<TagDecl>(
D))
10591 return TD->isThisDeclarationADefinition() ||
10592 TD->isThisDeclarationADemotedDefinition();
10594 if (
auto *FD = dyn_cast<FunctionDecl>(
D))
10595 return FD->isThisDeclarationADefinition() || PendingBodies.count(FD);
10597 if (
auto *RTD = dyn_cast<RedeclarableTemplateDecl>(
D))
10598 return hasDefinitionImpl(RTD->getTemplatedDecl(), hasDefinitionImpl);
10605 return hasDefinitionImpl(
D, hasDefinitionImpl);
10621 PendingWarningForDuplicatedDefsInModuleUnits.clear();
10627 for (PendingBodiesMap::iterator PB = PendingBodies.begin(),
10628 PBEnd = PendingBodies.end();
10629 PB != PBEnd; ++PB) {
10630 if (
FunctionDecl *FD = dyn_cast<FunctionDecl>(PB->first)) {
10633 if (!
getContext().getLangOpts().Modules || !FD->hasBody(Defn)) {
10639 if (!FD->isLateTemplateParsed() &&
10640 !NonConstDefn->isLateTemplateParsed() &&
10645 FD->getODRHash() != NonConstDefn->getODRHash()) {
10646 if (!isa<CXXMethodDecl>(FD)) {
10647 PendingFunctionOdrMergeFailures[FD].push_back(NonConstDefn);
10648 }
else if (FD->getLexicalParent()->isFileContext() &&
10649 NonConstDefn->getLexicalParent()->isFileContext()) {
10653 PendingFunctionOdrMergeFailures[FD].push_back(NonConstDefn);
10664 PendingBodies.clear();
10667 for (
auto [RD, MD] : PendingAddedClassMembers) {
10668 RD->addedMember(MD);
10670 PendingAddedClassMembers.clear();
10673 for (
auto *ND : PendingMergedDefinitionsToDeduplicate)
10675 PendingMergedDefinitionsToDeduplicate.clear();
10679 for (
Decl *
D : PendingIncompleteDeclChains)
10680 markIncompleteDeclChain(
D);
10681 PendingIncompleteDeclChains.clear();
10683 assert(PendingIdentifierInfos.empty() &&
10684 "Should be empty at the end of finishPendingActions");
10685 assert(PendingDeducedFunctionTypes.empty() &&
10686 "Should be empty at the end of finishPendingActions");
10687 assert(PendingDeducedVarTypes.empty() &&
10688 "Should be empty at the end of finishPendingActions");
10689 assert(PendingDeclChains.empty() &&
10690 "Should be empty at the end of finishPendingActions");
10691 assert(PendingMacroIDs.empty() &&
10692 "Should be empty at the end of finishPendingActions");
10693 assert(PendingDeclContextInfos.empty() &&
10694 "Should be empty at the end of finishPendingActions");
10695 assert(PendingUpdateRecords.empty() &&
10696 "Should be empty at the end of finishPendingActions");
10697 assert(PendingObjCExtensionIvarRedeclarations.empty() &&
10698 "Should be empty at the end of finishPendingActions");
10699 assert(PendingFakeDefinitionData.empty() &&
10700 "Should be empty at the end of finishPendingActions");
10701 assert(PendingDefinitions.empty() &&
10702 "Should be empty at the end of finishPendingActions");
10703 assert(PendingWarningForDuplicatedDefsInModuleUnits.empty() &&
10704 "Should be empty at the end of finishPendingActions");
10705 assert(PendingBodies.empty() &&
10706 "Should be empty at the end of finishPendingActions");
10707 assert(PendingAddedClassMembers.empty() &&
10708 "Should be empty at the end of finishPendingActions");
10709 assert(PendingMergedDefinitionsToDeduplicate.empty() &&
10710 "Should be empty at the end of finishPendingActions");
10711 assert(PendingIncompleteDeclChains.empty() &&
10712 "Should be empty at the end of finishPendingActions");
10715void ASTReader::diagnoseOdrViolations() {
10716 if (PendingOdrMergeFailures.empty() && PendingOdrMergeChecks.empty() &&
10717 PendingRecordOdrMergeFailures.empty() &&
10718 PendingFunctionOdrMergeFailures.empty() &&
10719 PendingEnumOdrMergeFailures.empty() &&
10720 PendingObjCInterfaceOdrMergeFailures.empty() &&
10721 PendingObjCProtocolOdrMergeFailures.empty())
10728 auto OdrMergeFailures = std::move(PendingOdrMergeFailures);
10729 PendingOdrMergeFailures.clear();
10730 for (
auto &Merge : OdrMergeFailures) {
10731 Merge.first->buildLookup();
10732 Merge.first->decls_begin();
10733 Merge.first->bases_begin();
10734 Merge.first->vbases_begin();
10735 for (
auto &RecordPair : Merge.second) {
10736 auto *RD = RecordPair.first;
10744 auto RecordOdrMergeFailures = std::move(PendingRecordOdrMergeFailures);
10745 PendingRecordOdrMergeFailures.clear();
10746 for (
auto &Merge : RecordOdrMergeFailures) {
10747 Merge.first->decls_begin();
10748 for (
auto &
D : Merge.second)
10753 auto ObjCInterfaceOdrMergeFailures =
10754 std::move(PendingObjCInterfaceOdrMergeFailures);
10755 PendingObjCInterfaceOdrMergeFailures.clear();
10756 for (
auto &Merge : ObjCInterfaceOdrMergeFailures) {
10757 Merge.first->decls_begin();
10758 for (
auto &InterfacePair : Merge.second)
10759 InterfacePair.first->decls_begin();
10763 auto FunctionOdrMergeFailures = std::move(PendingFunctionOdrMergeFailures);
10764 PendingFunctionOdrMergeFailures.clear();
10765 for (
auto &Merge : FunctionOdrMergeFailures) {
10766 Merge.first->buildLookup();
10767 Merge.first->decls_begin();
10768 Merge.first->getBody();
10769 for (
auto &FD : Merge.second) {
10777 auto EnumOdrMergeFailures = std::move(PendingEnumOdrMergeFailures);
10778 PendingEnumOdrMergeFailures.clear();
10779 for (
auto &Merge : EnumOdrMergeFailures) {
10780 Merge.first->decls_begin();
10781 for (
auto &
Enum : Merge.second) {
10782 Enum->decls_begin();
10787 auto ObjCProtocolOdrMergeFailures =
10788 std::move(PendingObjCProtocolOdrMergeFailures);
10789 PendingObjCProtocolOdrMergeFailures.clear();
10790 for (
auto &Merge : ObjCProtocolOdrMergeFailures) {
10791 Merge.first->decls_begin();
10792 for (
auto &ProtocolPair : Merge.second)
10793 ProtocolPair.first->decls_begin();
10802 while (!PendingOdrMergeChecks.empty()) {
10803 NamedDecl *
D = PendingOdrMergeChecks.pop_back_val();
10814 bool Found =
false;
10818 if (RI->getLexicalDeclContext() == CanonDef) {
10833 for (
auto *CanonMember : CanonDef->
decls()) {
10834 if (CanonMember->getCanonicalDecl() == DCanon) {
10843 if (
auto *ND = dyn_cast<NamedDecl>(CanonMember))
10844 if (ND->getDeclName() ==
D->getDeclName())
10845 Candidates.push_back(ND);
10851 if (!isa<TagDecl>(
D))
10856 Deserializing RecursionGuard(
this);
10858 std::string CanonDefModule =
10860 cast<Decl>(CanonDef));
10863 << CanonDef << CanonDefModule.empty() << CanonDefModule;
10865 if (Candidates.empty())
10866 Diag(cast<Decl>(CanonDef)->getLocation(),
10867 diag::note_module_odr_violation_no_possible_decls) <<
D;
10869 for (
unsigned I = 0, N = Candidates.size(); I != N; ++I)
10870 Diag(Candidates[I]->getLocation(),
10871 diag::note_module_odr_violation_possible_decl)
10875 DiagnosedOdrMergeFailures.insert(CanonDef);
10879 if (OdrMergeFailures.empty() && RecordOdrMergeFailures.empty() &&
10880 FunctionOdrMergeFailures.empty() && EnumOdrMergeFailures.empty() &&
10881 ObjCInterfaceOdrMergeFailures.empty() &&
10882 ObjCProtocolOdrMergeFailures.empty())
10889 for (
auto &Merge : OdrMergeFailures) {
10892 if (!DiagnosedOdrMergeFailures.insert(Merge.first).second)
10895 bool Diagnosed =
false;
10897 for (
auto &RecordPair : Merge.second) {
10898 if (DiagsEmitter.diagnoseMismatch(FirstRecord, RecordPair.first,
10899 RecordPair.second)) {
10912 Diag(Merge.first->getLocation(),
10913 diag::err_module_odr_violation_different_instantiations)
10920 for (
auto &Merge : RecordOdrMergeFailures) {
10923 if (!DiagnosedOdrMergeFailures.insert(Merge.first).second)
10927 bool Diagnosed =
false;
10928 for (
auto *SecondRecord : Merge.second) {
10929 if (DiagsEmitter.diagnoseMismatch(FirstRecord, SecondRecord)) {
10935 assert(Diagnosed &&
"Unable to emit ODR diagnostic.");
10939 for (
auto &Merge : FunctionOdrMergeFailures) {
10941 bool Diagnosed =
false;
10942 for (
auto &SecondFunction : Merge.second) {
10943 if (DiagsEmitter.diagnoseMismatch(FirstFunction, SecondFunction)) {
10949 assert(Diagnosed &&
"Unable to emit ODR diagnostic.");
10953 for (
auto &Merge : EnumOdrMergeFailures) {
10956 if (!DiagnosedOdrMergeFailures.insert(Merge.first).second)
10959 EnumDecl *FirstEnum = Merge.first;
10960 bool Diagnosed =
false;
10961 for (
auto &SecondEnum : Merge.second) {
10962 if (DiagsEmitter.diagnoseMismatch(FirstEnum, SecondEnum)) {
10968 assert(Diagnosed &&
"Unable to emit ODR diagnostic.");
10971 for (
auto &Merge : ObjCInterfaceOdrMergeFailures) {
10974 if (!DiagnosedOdrMergeFailures.insert(Merge.first).second)
10977 bool Diagnosed =
false;
10979 for (
auto &InterfacePair : Merge.second) {
10980 if (DiagsEmitter.diagnoseMismatch(FirstID, InterfacePair.first,
10981 InterfacePair.second)) {
10987 assert(Diagnosed &&
"Unable to emit ODR diagnostic.");
10990 for (
auto &Merge : ObjCProtocolOdrMergeFailures) {
10993 if (!DiagnosedOdrMergeFailures.insert(Merge.first).second)
10997 bool Diagnosed =
false;
10998 for (
auto &ProtocolPair : Merge.second) {
10999 if (DiagsEmitter.diagnoseMismatch(FirstProtocol, ProtocolPair.first,
11000 ProtocolPair.second)) {
11006 assert(Diagnosed &&
"Unable to emit ODR diagnostic.");
11011 if (llvm::Timer *
T = ReadTimer.get();
11012 ++NumCurrentElementsDeserializing == 1 &&
T)
11013 ReadTimeRegion.emplace(
T);
11017 assert(NumCurrentElementsDeserializing &&
11018 "FinishedDeserializing not paired with StartedDeserializing");
11019 if (NumCurrentElementsDeserializing == 1) {
11022 finishPendingActions();
11024 --NumCurrentElementsDeserializing;
11026 if (NumCurrentElementsDeserializing == 0) {
11030 SaveAndRestore GuardPassingDeclsToConsumer(CanPassDeclsToConsumer,
11038 while (!PendingExceptionSpecUpdates.empty() ||
11039 !PendingDeducedTypeUpdates.empty() ||
11040 !PendingUndeducedFunctionDecls.empty()) {
11041 auto ESUpdates = std::move(PendingExceptionSpecUpdates);
11042 PendingExceptionSpecUpdates.clear();
11043 for (
auto Update : ESUpdates) {
11044 ProcessingUpdatesRAIIObj ProcessingUpdates(*
this);
11048 Listener->ResolvedExceptionSpec(cast<FunctionDecl>(
Update.second));
11049 for (
auto *Redecl :
Update.second->redecls())
11053 auto DTUpdates = std::move(PendingDeducedTypeUpdates);
11054 PendingDeducedTypeUpdates.clear();
11055 for (
auto Update : DTUpdates) {
11056 ProcessingUpdatesRAIIObj ProcessingUpdates(*
this);
11063 auto UDTUpdates = std::move(PendingUndeducedFunctionDecls);
11064 PendingUndeducedFunctionDecls.clear();
11068 (void)UndeducedFD->getMostRecentDecl();
11071 ReadTimeRegion.reset();
11073 diagnoseOdrViolations();
11079 PassInterestingDeclsToConsumer();
11086 auto It = PendingFakeLookupResults.find(II);
11087 if (It != PendingFakeLookupResults.end()) {
11088 for (
auto *ND : It->second)
11093 It->second.clear();
11099 }
else if (SemaObj->
TUScope) {
11112 ArrayRef<std::shared_ptr<ModuleFileExtension>> Extensions,
11113 StringRef isysroot,
11115 bool AllowASTWithCompilerErrors,
11116 bool AllowConfigurationMismatch,
bool ValidateSystemInputs,
11117 bool ForceValidateUserInputs,
11118 bool ValidateASTInputFilesContent,
bool UseGlobalIndex,
11119 std::unique_ptr<llvm::Timer> ReadTimer)
11123 SourceMgr(PP.getSourceManager()), FileMgr(PP.getFileManager()),
11124 PCHContainerRdr(PCHContainerRdr), Diags(PP.getDiagnostics()),
11125 StackHandler(Diags), PP(PP), ContextObj(Context),
11126 CodeGenOpts(CodeGenOpts),
11127 ModuleMgr(PP.getFileManager(), ModCache, PCHContainerRdr,
11128 PP.getHeaderSearchInfo()),
11129 DummyIdResolver(PP), ReadTimer(
std::move(ReadTimer)), isysroot(isysroot),
11130 DisableValidationKind(DisableValidationKind),
11131 AllowASTWithCompilerErrors(AllowASTWithCompilerErrors),
11132 AllowConfigurationMismatch(AllowConfigurationMismatch),
11133 ValidateSystemInputs(ValidateSystemInputs),
11134 ForceValidateUserInputs(ForceValidateUserInputs),
11135 ValidateASTInputFilesContent(ValidateASTInputFilesContent),
11136 UseGlobalIndex(UseGlobalIndex), CurrSwitchCaseStmts(&SwitchCaseStmts) {
11139 PathBuf.reserve(256);
11141 for (
const auto &Ext : Extensions) {
11142 auto BlockName = Ext->getExtensionMetadata().BlockName;
11143 auto Known = ModuleFileExtensions.find(BlockName);
11144 if (Known != ModuleFileExtensions.end()) {
11145 Diags.
Report(diag::warn_duplicate_module_file_extension)
11150 ModuleFileExtensions.insert({BlockName, Ext});
11155 if (OwnsDeserializationListener)
11156 delete DeserializationListener;
11160 return SemaObj ? SemaObj->
IdResolver : DummyIdResolver;
11164 unsigned AbbrevID) {
11167 return Cursor.readRecord(AbbrevID,
Record);
11184#define GEN_CLANG_CLAUSE_CLASS
11185#define CLAUSE_CLASS(Enum, Str, Class) void Visit##Class(Class *C);
11186#include "llvm/Frontend/OpenMP/OMP.inc"
11200 switch (llvm::omp::Clause(
Record.readInt())) {
11201 case llvm::omp::OMPC_if:
11204 case llvm::omp::OMPC_final:
11207 case llvm::omp::OMPC_num_threads:
11210 case llvm::omp::OMPC_safelen:
11213 case llvm::omp::OMPC_simdlen:
11216 case llvm::omp::OMPC_sizes: {
11217 unsigned NumSizes =
Record.readInt();
11221 case llvm::omp::OMPC_permutation: {
11222 unsigned NumLoops =
Record.readInt();
11226 case llvm::omp::OMPC_full:
11229 case llvm::omp::OMPC_partial:
11232 case llvm::omp::OMPC_allocator:
11235 case llvm::omp::OMPC_collapse:
11238 case llvm::omp::OMPC_default:
11241 case llvm::omp::OMPC_proc_bind:
11244 case llvm::omp::OMPC_schedule:
11247 case llvm::omp::OMPC_ordered:
11250 case llvm::omp::OMPC_nowait:
11253 case llvm::omp::OMPC_untied:
11256 case llvm::omp::OMPC_mergeable:
11259 case llvm::omp::OMPC_read:
11262 case llvm::omp::OMPC_write:
11265 case llvm::omp::OMPC_update:
11268 case llvm::omp::OMPC_capture:
11271 case llvm::omp::OMPC_compare:
11274 case llvm::omp::OMPC_fail:
11277 case llvm::omp::OMPC_seq_cst:
11280 case llvm::omp::OMPC_acq_rel:
11283 case llvm::omp::OMPC_absent: {
11284 unsigned NumKinds =
Record.readInt();
11288 case llvm::omp::OMPC_holds:
11291 case llvm::omp::OMPC_contains: {
11292 unsigned NumKinds =
Record.readInt();
11296 case llvm::omp::OMPC_no_openmp:
11299 case llvm::omp::OMPC_no_openmp_routines:
11302 case llvm::omp::OMPC_no_openmp_constructs:
11305 case llvm::omp::OMPC_no_parallelism:
11308 case llvm::omp::OMPC_acquire:
11311 case llvm::omp::OMPC_release:
11314 case llvm::omp::OMPC_relaxed:
11317 case llvm::omp::OMPC_weak:
11320 case llvm::omp::OMPC_threads:
11323 case llvm::omp::OMPC_simd:
11326 case llvm::omp::OMPC_nogroup:
11329 case llvm::omp::OMPC_unified_address:
11332 case llvm::omp::OMPC_unified_shared_memory:
11335 case llvm::omp::OMPC_reverse_offload:
11338 case llvm::omp::OMPC_dynamic_allocators:
11341 case llvm::omp::OMPC_atomic_default_mem_order:
11344 case llvm::omp::OMPC_self_maps:
11347 case llvm::omp::OMPC_at:
11350 case llvm::omp::OMPC_severity:
11353 case llvm::omp::OMPC_message:
11356 case llvm::omp::OMPC_private:
11359 case llvm::omp::OMPC_firstprivate:
11362 case llvm::omp::OMPC_lastprivate:
11365 case llvm::omp::OMPC_shared:
11368 case llvm::omp::OMPC_reduction: {
11369 unsigned N =
Record.readInt();
11374 case llvm::omp::OMPC_task_reduction:
11377 case llvm::omp::OMPC_in_reduction:
11380 case llvm::omp::OMPC_linear:
11383 case llvm::omp::OMPC_aligned:
11386 case llvm::omp::OMPC_copyin:
11389 case llvm::omp::OMPC_copyprivate:
11392 case llvm::omp::OMPC_flush:
11395 case llvm::omp::OMPC_depobj:
11398 case llvm::omp::OMPC_depend: {
11399 unsigned NumVars =
Record.readInt();
11400 unsigned NumLoops =
Record.readInt();
11404 case llvm::omp::OMPC_device:
11407 case llvm::omp::OMPC_map: {
11416 case llvm::omp::OMPC_num_teams:
11419 case llvm::omp::OMPC_thread_limit:
11422 case llvm::omp::OMPC_priority:
11425 case llvm::omp::OMPC_grainsize:
11428 case llvm::omp::OMPC_num_tasks:
11431 case llvm::omp::OMPC_hint:
11434 case llvm::omp::OMPC_dist_schedule:
11437 case llvm::omp::OMPC_defaultmap:
11440 case llvm::omp::OMPC_to: {
11449 case llvm::omp::OMPC_from: {
11458 case llvm::omp::OMPC_use_device_ptr: {
11467 case llvm::omp::OMPC_use_device_addr: {
11476 case llvm::omp::OMPC_is_device_ptr: {
11485 case llvm::omp::OMPC_has_device_addr: {
11494 case llvm::omp::OMPC_allocate:
11497 case llvm::omp::OMPC_nontemporal:
11500 case llvm::omp::OMPC_inclusive:
11503 case llvm::omp::OMPC_exclusive:
11506 case llvm::omp::OMPC_order:
11509 case llvm::omp::OMPC_init:
11512 case llvm::omp::OMPC_use:
11515 case llvm::omp::OMPC_destroy:
11518 case llvm::omp::OMPC_novariants:
11521 case llvm::omp::OMPC_nocontext:
11524 case llvm::omp::OMPC_detach:
11527 case llvm::omp::OMPC_uses_allocators:
11530 case llvm::omp::OMPC_affinity:
11533 case llvm::omp::OMPC_filter:
11536 case llvm::omp::OMPC_bind:
11539 case llvm::omp::OMPC_align:
11542 case llvm::omp::OMPC_ompx_dyn_cgroup_mem:
11545 case llvm::omp::OMPC_doacross: {
11546 unsigned NumVars =
Record.readInt();
11547 unsigned NumLoops =
Record.readInt();
11551 case llvm::omp::OMPC_ompx_attribute:
11554 case llvm::omp::OMPC_ompx_bare:
11557#define OMP_CLAUSE_NO_CLASS(Enum, Str) \
11558 case llvm::omp::Enum: \
11560#include "llvm/Frontend/OpenMP/OMPKinds.def"
11564 assert(
C &&
"Unknown OMPClause type");
11567 C->setLocStart(
Record.readSourceLocation());
11568 C->setLocEnd(
Record.readSourceLocation());
11574 C->setPreInitStmt(
Record.readSubStmt(),
11580 C->setPostUpdateExpr(
Record.readSubExpr());
11583void OMPClauseReader::VisitOMPIfClause(
OMPIfClause *
C) {
11586 C->setNameModifierLoc(
Record.readSourceLocation());
11587 C->setColonLoc(
Record.readSourceLocation());
11588 C->setCondition(
Record.readSubExpr());
11589 C->setLParenLoc(
Record.readSourceLocation());
11594 C->setCondition(
Record.readSubExpr());
11595 C->setLParenLoc(
Record.readSourceLocation());
11601 C->setNumThreads(
Record.readSubExpr());
11602 C->setModifierLoc(
Record.readSourceLocation());
11603 C->setLParenLoc(
Record.readSourceLocation());
11607 C->setSafelen(
Record.readSubExpr());
11608 C->setLParenLoc(
Record.readSourceLocation());
11612 C->setSimdlen(
Record.readSubExpr());
11613 C->setLParenLoc(
Record.readSourceLocation());
11617 for (
Expr *&
E :
C->getSizesRefs())
11619 C->setLParenLoc(
Record.readSourceLocation());
11623 for (
Expr *&
E :
C->getArgsRefs())
11625 C->setLParenLoc(
Record.readSourceLocation());
11631 C->setFactor(
Record.readSubExpr());
11632 C->setLParenLoc(
Record.readSourceLocation());
11636 C->setAllocator(
Record.readExpr());
11637 C->setLParenLoc(
Record.readSourceLocation());
11641 C->setNumForLoops(
Record.readSubExpr());
11642 C->setLParenLoc(
Record.readSourceLocation());
11646 C->setDefaultKind(
static_cast<llvm::omp::DefaultKind
>(
Record.readInt()));
11647 C->setLParenLoc(
Record.readSourceLocation());
11648 C->setDefaultKindKwLoc(
Record.readSourceLocation());
11652 C->setProcBindKind(
static_cast<llvm::omp::ProcBindKind
>(
Record.readInt()));
11653 C->setLParenLoc(
Record.readSourceLocation());
11654 C->setProcBindKindKwLoc(
Record.readSourceLocation());
11659 C->setScheduleKind(
11661 C->setFirstScheduleModifier(
11663 C->setSecondScheduleModifier(
11665 C->setChunkSize(
Record.readSubExpr());
11666 C->setLParenLoc(
Record.readSourceLocation());
11667 C->setFirstScheduleModifierLoc(
Record.readSourceLocation());
11668 C->setSecondScheduleModifierLoc(
Record.readSourceLocation());
11669 C->setScheduleKindLoc(
Record.readSourceLocation());
11670 C->setCommaLoc(
Record.readSourceLocation());
11674 C->setNumForLoops(
Record.readSubExpr());
11675 for (
unsigned I = 0,
E =
C->NumberOfLoops; I <
E; ++I)
11676 C->setLoopNumIterations(I,
Record.readSubExpr());
11677 for (
unsigned I = 0,
E =
C->NumberOfLoops; I <
E; ++I)
11678 C->setLoopCounter(I,
Record.readSubExpr());
11679 C->setLParenLoc(
Record.readSourceLocation());
11683 C->setEventHandler(
Record.readSubExpr());
11684 C->setLParenLoc(
Record.readSourceLocation());
11693void OMPClauseReader::VisitOMPReadClause(
OMPReadClause *) {}
11698 if (
C->isExtended()) {
11699 C->setLParenLoc(
Record.readSourceLocation());
11700 C->setArgumentLoc(
Record.readSourceLocation());
11712 C->setLParenLoc(
Record.readSourceLocation());
11714 C->setFailParameterLoc(FailParameterLoc);
11716 C->setFailParameter(CKind);
11720 unsigned Count =
C->getDirectiveKinds().size();
11721 C->setLParenLoc(
Record.readSourceLocation());
11723 DKVec.reserve(Count);
11724 for (
unsigned I = 0; I < Count; I++) {
11727 C->setDirectiveKinds(DKVec);
11731 C->setExpr(
Record.readExpr());
11732 C->setLParenLoc(
Record.readSourceLocation());
11736 unsigned Count =
C->getDirectiveKinds().size();
11737 C->setLParenLoc(
Record.readSourceLocation());
11739 DKVec.reserve(Count);
11740 for (
unsigned I = 0; I < Count; I++) {
11743 C->setDirectiveKinds(DKVec);
11748void OMPClauseReader::VisitOMPNoOpenMPRoutinesClause(
11751void OMPClauseReader::VisitOMPNoOpenMPConstructsClause(
11766void OMPClauseReader::VisitOMPWeakClause(
OMPWeakClause *) {}
11770void OMPClauseReader::VisitOMPSIMDClause(
OMPSIMDClause *) {}
11775 unsigned NumVars =
C->varlist_size();
11777 Vars.reserve(NumVars);
11778 for (
unsigned I = 0; I != NumVars; ++I)
11779 Vars.push_back(
Record.readSubExpr());
11780 C->setVarRefs(Vars);
11781 C->setIsTarget(
Record.readBool());
11782 C->setIsTargetSync(
Record.readBool());
11783 C->setLParenLoc(
Record.readSourceLocation());
11784 C->setVarLoc(
Record.readSourceLocation());
11788 C->setInteropVar(
Record.readSubExpr());
11789 C->setLParenLoc(
Record.readSourceLocation());
11790 C->setVarLoc(
Record.readSourceLocation());
11794 C->setInteropVar(
Record.readSubExpr());
11795 C->setLParenLoc(
Record.readSourceLocation());
11796 C->setVarLoc(
Record.readSourceLocation());
11801 C->setCondition(
Record.readSubExpr());
11802 C->setLParenLoc(
Record.readSourceLocation());
11807 C->setCondition(
Record.readSubExpr());
11808 C->setLParenLoc(
Record.readSourceLocation());
11813void OMPClauseReader::VisitOMPUnifiedSharedMemoryClause(
11822void OMPClauseReader::VisitOMPAtomicDefaultMemOrderClause(
11824 C->setAtomicDefaultMemOrderKind(
11826 C->setLParenLoc(
Record.readSourceLocation());
11827 C->setAtomicDefaultMemOrderKindKwLoc(
Record.readSourceLocation());
11832void OMPClauseReader::VisitOMPAtClause(
OMPAtClause *
C) {
11834 C->setLParenLoc(
Record.readSourceLocation());
11835 C->setAtKindKwLoc(
Record.readSourceLocation());
11840 C->setLParenLoc(
Record.readSourceLocation());
11841 C->setSeverityKindKwLoc(
Record.readSourceLocation());
11846 C->setMessageString(
Record.readSubExpr());
11847 C->setLParenLoc(
Record.readSourceLocation());
11851 C->setLParenLoc(
Record.readSourceLocation());
11852 unsigned NumVars =
C->varlist_size();
11854 Vars.reserve(NumVars);
11855 for (
unsigned i = 0; i != NumVars; ++i)
11856 Vars.push_back(
Record.readSubExpr());
11857 C->setVarRefs(Vars);
11859 for (
unsigned i = 0; i != NumVars; ++i)
11860 Vars.push_back(
Record.readSubExpr());
11861 C->setPrivateCopies(Vars);
11866 C->setLParenLoc(
Record.readSourceLocation());
11867 unsigned NumVars =
C->varlist_size();
11869 Vars.reserve(NumVars);
11870 for (
unsigned i = 0; i != NumVars; ++i)
11871 Vars.push_back(
Record.readSubExpr());
11872 C->setVarRefs(Vars);
11874 for (
unsigned i = 0; i != NumVars; ++i)
11875 Vars.push_back(
Record.readSubExpr());
11876 C->setPrivateCopies(Vars);
11878 for (
unsigned i = 0; i != NumVars; ++i)
11879 Vars.push_back(
Record.readSubExpr());
11885 C->setLParenLoc(
Record.readSourceLocation());
11887 C->setKindLoc(
Record.readSourceLocation());
11888 C->setColonLoc(
Record.readSourceLocation());
11889 unsigned NumVars =
C->varlist_size();
11891 Vars.reserve(NumVars);
11892 for (
unsigned i = 0; i != NumVars; ++i)
11893 Vars.push_back(
Record.readSubExpr());
11894 C->setVarRefs(Vars);
11896 for (
unsigned i = 0; i != NumVars; ++i)
11897 Vars.push_back(
Record.readSubExpr());
11898 C->setPrivateCopies(Vars);
11900 for (
unsigned i = 0; i != NumVars; ++i)
11901 Vars.push_back(
Record.readSubExpr());
11902 C->setSourceExprs(Vars);
11904 for (
unsigned i = 0; i != NumVars; ++i)
11905 Vars.push_back(
Record.readSubExpr());
11906 C->setDestinationExprs(Vars);
11908 for (
unsigned i = 0; i != NumVars; ++i)
11909 Vars.push_back(
Record.readSubExpr());
11910 C->setAssignmentOps(Vars);
11914 C->setLParenLoc(
Record.readSourceLocation());
11915 unsigned NumVars =
C->varlist_size();
11917 Vars.reserve(NumVars);
11918 for (
unsigned i = 0; i != NumVars; ++i)
11919 Vars.push_back(
Record.readSubExpr());
11920 C->setVarRefs(Vars);
11925 C->setLParenLoc(
Record.readSourceLocation());
11926 C->setModifierLoc(
Record.readSourceLocation());
11927 C->setColonLoc(
Record.readSourceLocation());
11930 C->setQualifierLoc(NNSL);
11931 C->setNameInfo(DNI);
11933 unsigned NumVars =
C->varlist_size();
11935 Vars.reserve(NumVars);
11936 for (
unsigned i = 0; i != NumVars; ++i)
11937 Vars.push_back(
Record.readSubExpr());
11938 C->setVarRefs(Vars);
11940 for (
unsigned i = 0; i != NumVars; ++i)
11941 Vars.push_back(
Record.readSubExpr());
11942 C->setPrivates(Vars);
11944 for (
unsigned i = 0; i != NumVars; ++i)
11945 Vars.push_back(
Record.readSubExpr());
11946 C->setLHSExprs(Vars);
11948 for (
unsigned i = 0; i != NumVars; ++i)
11949 Vars.push_back(
Record.readSubExpr());
11950 C->setRHSExprs(Vars);
11952 for (
unsigned i = 0; i != NumVars; ++i)
11953 Vars.push_back(
Record.readSubExpr());
11954 C->setReductionOps(Vars);
11955 if (
C->getModifier() == OMPC_REDUCTION_inscan) {
11957 for (
unsigned i = 0; i != NumVars; ++i)
11958 Vars.push_back(
Record.readSubExpr());
11959 C->setInscanCopyOps(Vars);
11961 for (
unsigned i = 0; i != NumVars; ++i)
11962 Vars.push_back(
Record.readSubExpr());
11963 C->setInscanCopyArrayTemps(Vars);
11965 for (
unsigned i = 0; i != NumVars; ++i)
11966 Vars.push_back(
Record.readSubExpr());
11967 C->setInscanCopyArrayElems(Vars);
11969 unsigned NumFlags =
Record.readInt();
11971 Flags.reserve(NumFlags);
11972 for ([[maybe_unused]]
unsigned I : llvm::seq<unsigned>(NumFlags))
11973 Flags.push_back(
Record.readInt());
11974 C->setPrivateVariableReductionFlags(Flags);
11979 C->setLParenLoc(
Record.readSourceLocation());
11980 C->setColonLoc(
Record.readSourceLocation());
11983 C->setQualifierLoc(NNSL);
11984 C->setNameInfo(DNI);
11986 unsigned NumVars =
C->varlist_size();
11988 Vars.reserve(NumVars);
11989 for (
unsigned I = 0; I != NumVars; ++I)
11990 Vars.push_back(
Record.readSubExpr());
11991 C->setVarRefs(Vars);
11993 for (
unsigned I = 0; I != NumVars; ++I)
11994 Vars.push_back(
Record.readSubExpr());
11995 C->setPrivates(Vars);
11997 for (
unsigned I = 0; I != NumVars; ++I)
11998 Vars.push_back(
Record.readSubExpr());
11999 C->setLHSExprs(Vars);
12001 for (
unsigned I = 0; I != NumVars; ++I)
12002 Vars.push_back(
Record.readSubExpr());
12003 C->setRHSExprs(Vars);
12005 for (
unsigned I = 0; I != NumVars; ++I)
12006 Vars.push_back(
Record.readSubExpr());
12007 C->setReductionOps(Vars);
12012 C->setLParenLoc(
Record.readSourceLocation());
12013 C->setColonLoc(
Record.readSourceLocation());
12016 C->setQualifierLoc(NNSL);
12017 C->setNameInfo(DNI);
12019 unsigned NumVars =
C->varlist_size();
12021 Vars.reserve(NumVars);
12022 for (
unsigned I = 0; I != NumVars; ++I)
12023 Vars.push_back(
Record.readSubExpr());
12024 C->setVarRefs(Vars);
12026 for (
unsigned I = 0; I != NumVars; ++I)
12027 Vars.push_back(
Record.readSubExpr());
12028 C->setPrivates(Vars);
12030 for (
unsigned I = 0; I != NumVars; ++I)
12031 Vars.push_back(
Record.readSubExpr());
12032 C->setLHSExprs(Vars);
12034 for (
unsigned I = 0; I != NumVars; ++I)
12035 Vars.push_back(
Record.readSubExpr());
12036 C->setRHSExprs(Vars);
12038 for (
unsigned I = 0; I != NumVars; ++I)
12039 Vars.push_back(
Record.readSubExpr());
12040 C->setReductionOps(Vars);
12042 for (
unsigned I = 0; I != NumVars; ++I)
12043 Vars.push_back(
Record.readSubExpr());
12044 C->setTaskgroupDescriptors(Vars);
12049 C->setLParenLoc(
Record.readSourceLocation());
12050 C->setColonLoc(
Record.readSourceLocation());
12052 C->setModifierLoc(
Record.readSourceLocation());
12053 unsigned NumVars =
C->varlist_size();
12055 Vars.reserve(NumVars);
12056 for (
unsigned i = 0; i != NumVars; ++i)
12057 Vars.push_back(
Record.readSubExpr());
12058 C->setVarRefs(Vars);
12060 for (
unsigned i = 0; i != NumVars; ++i)
12061 Vars.push_back(
Record.readSubExpr());
12062 C->setPrivates(Vars);
12064 for (
unsigned i = 0; i != NumVars; ++i)
12065 Vars.push_back(
Record.readSubExpr());
12068 for (
unsigned i = 0; i != NumVars; ++i)
12069 Vars.push_back(
Record.readSubExpr());
12070 C->setUpdates(Vars);
12072 for (
unsigned i = 0; i != NumVars; ++i)
12073 Vars.push_back(
Record.readSubExpr());
12074 C->setFinals(Vars);
12075 C->setStep(
Record.readSubExpr());
12076 C->setCalcStep(
Record.readSubExpr());
12078 for (
unsigned I = 0; I != NumVars + 1; ++I)
12079 Vars.push_back(
Record.readSubExpr());
12080 C->setUsedExprs(Vars);
12084 C->setLParenLoc(
Record.readSourceLocation());
12085 C->setColonLoc(
Record.readSourceLocation());
12086 unsigned NumVars =
C->varlist_size();
12088 Vars.reserve(NumVars);
12089 for (
unsigned i = 0; i != NumVars; ++i)
12090 Vars.push_back(
Record.readSubExpr());
12091 C->setVarRefs(Vars);
12092 C->setAlignment(
Record.readSubExpr());
12096 C->setLParenLoc(
Record.readSourceLocation());
12097 unsigned NumVars =
C->varlist_size();
12099 Exprs.reserve(NumVars);
12100 for (
unsigned i = 0; i != NumVars; ++i)
12101 Exprs.push_back(
Record.readSubExpr());
12102 C->setVarRefs(Exprs);
12104 for (
unsigned i = 0; i != NumVars; ++i)
12105 Exprs.push_back(
Record.readSubExpr());
12106 C->setSourceExprs(Exprs);
12108 for (
unsigned i = 0; i != NumVars; ++i)
12109 Exprs.push_back(
Record.readSubExpr());
12110 C->setDestinationExprs(Exprs);
12112 for (
unsigned i = 0; i != NumVars; ++i)
12113 Exprs.push_back(
Record.readSubExpr());
12114 C->setAssignmentOps(Exprs);
12118 C->setLParenLoc(
Record.readSourceLocation());
12119 unsigned NumVars =
C->varlist_size();
12121 Exprs.reserve(NumVars);
12122 for (
unsigned i = 0; i != NumVars; ++i)
12123 Exprs.push_back(
Record.readSubExpr());
12124 C->setVarRefs(Exprs);
12126 for (
unsigned i = 0; i != NumVars; ++i)
12127 Exprs.push_back(
Record.readSubExpr());
12128 C->setSourceExprs(Exprs);
12130 for (
unsigned i = 0; i != NumVars; ++i)
12131 Exprs.push_back(
Record.readSubExpr());
12132 C->setDestinationExprs(Exprs);
12134 for (
unsigned i = 0; i != NumVars; ++i)
12135 Exprs.push_back(
Record.readSubExpr());
12136 C->setAssignmentOps(Exprs);
12140 C->setLParenLoc(
Record.readSourceLocation());
12141 unsigned NumVars =
C->varlist_size();
12143 Vars.reserve(NumVars);
12144 for (
unsigned i = 0; i != NumVars; ++i)
12145 Vars.push_back(
Record.readSubExpr());
12146 C->setVarRefs(Vars);
12150 C->setDepobj(
Record.readSubExpr());
12151 C->setLParenLoc(
Record.readSourceLocation());
12155 C->setLParenLoc(
Record.readSourceLocation());
12156 C->setModifier(
Record.readSubExpr());
12157 C->setDependencyKind(
12159 C->setDependencyLoc(
Record.readSourceLocation());
12160 C->setColonLoc(
Record.readSourceLocation());
12161 C->setOmpAllMemoryLoc(
Record.readSourceLocation());
12162 unsigned NumVars =
C->varlist_size();
12164 Vars.reserve(NumVars);
12165 for (
unsigned I = 0; I != NumVars; ++I)
12166 Vars.push_back(
Record.readSubExpr());
12167 C->setVarRefs(Vars);
12168 for (
unsigned I = 0,
E =
C->getNumLoops(); I <
E; ++I)
12169 C->setLoopData(I,
Record.readSubExpr());
12175 C->setDevice(
Record.readSubExpr());
12176 C->setModifierLoc(
Record.readSourceLocation());
12177 C->setLParenLoc(
Record.readSourceLocation());
12181 C->setLParenLoc(
Record.readSourceLocation());
12182 bool HasIteratorModifier =
false;
12184 C->setMapTypeModifier(
12186 C->setMapTypeModifierLoc(I,
Record.readSourceLocation());
12187 if (
C->getMapTypeModifier(I) == OMPC_MAP_MODIFIER_iterator)
12188 HasIteratorModifier =
true;
12190 C->setMapperQualifierLoc(
Record.readNestedNameSpecifierLoc());
12191 C->setMapperIdInfo(
Record.readDeclarationNameInfo());
12194 C->setMapLoc(
Record.readSourceLocation());
12195 C->setColonLoc(
Record.readSourceLocation());
12196 auto NumVars =
C->varlist_size();
12197 auto UniqueDecls =
C->getUniqueDeclarationsNum();
12198 auto TotalLists =
C->getTotalComponentListNum();
12199 auto TotalComponents =
C->getTotalComponentsNum();
12202 Vars.reserve(NumVars);
12203 for (
unsigned i = 0; i != NumVars; ++i)
12204 Vars.push_back(
Record.readExpr());
12205 C->setVarRefs(Vars);
12208 UDMappers.reserve(NumVars);
12209 for (
unsigned I = 0; I < NumVars; ++I)
12210 UDMappers.push_back(
Record.readExpr());
12211 C->setUDMapperRefs(UDMappers);
12213 if (HasIteratorModifier)
12214 C->setIteratorModifier(
Record.readExpr());
12217 Decls.reserve(UniqueDecls);
12218 for (
unsigned i = 0; i < UniqueDecls; ++i)
12220 C->setUniqueDecls(Decls);
12223 ListsPerDecl.reserve(UniqueDecls);
12224 for (
unsigned i = 0; i < UniqueDecls; ++i)
12225 ListsPerDecl.push_back(
Record.readInt());
12226 C->setDeclNumLists(ListsPerDecl);
12229 ListSizes.reserve(TotalLists);
12230 for (
unsigned i = 0; i < TotalLists; ++i)
12231 ListSizes.push_back(
Record.readInt());
12232 C->setComponentListSizes(ListSizes);
12235 Components.reserve(TotalComponents);
12236 for (
unsigned i = 0; i < TotalComponents; ++i) {
12239 Components.emplace_back(AssociatedExprPr, AssociatedDecl,
12242 C->setComponents(Components, ListSizes);
12248 C->setLParenLoc(
Record.readSourceLocation());
12249 C->setColonLoc(
Record.readSourceLocation());
12250 C->setAllocator(
Record.readSubExpr());
12251 C->setAlignment(
Record.readSubExpr());
12252 unsigned NumVars =
C->varlist_size();
12254 Vars.reserve(NumVars);
12255 for (
unsigned i = 0; i != NumVars; ++i)
12256 Vars.push_back(
Record.readSubExpr());
12257 C->setVarRefs(Vars);
12262 C->setLParenLoc(
Record.readSourceLocation());
12263 unsigned NumVars =
C->varlist_size();
12265 Vars.reserve(NumVars);
12266 for (
unsigned I = 0; I != NumVars; ++I)
12267 Vars.push_back(
Record.readSubExpr());
12268 C->setVarRefs(Vars);
12273 C->setLParenLoc(
Record.readSourceLocation());
12274 unsigned NumVars =
C->varlist_size();
12276 Vars.reserve(NumVars);
12277 for (
unsigned I = 0; I != NumVars; ++I)
12278 Vars.push_back(
Record.readSubExpr());
12279 C->setVarRefs(Vars);
12284 C->setPriority(
Record.readSubExpr());
12285 C->setLParenLoc(
Record.readSourceLocation());
12291 C->setGrainsize(
Record.readSubExpr());
12292 C->setModifierLoc(
Record.readSourceLocation());
12293 C->setLParenLoc(
Record.readSourceLocation());
12299 C->setNumTasks(
Record.readSubExpr());
12300 C->setModifierLoc(
Record.readSourceLocation());
12301 C->setLParenLoc(
Record.readSourceLocation());
12305 C->setHint(
Record.readSubExpr());
12306 C->setLParenLoc(
Record.readSourceLocation());
12311 C->setDistScheduleKind(
12313 C->setChunkSize(
Record.readSubExpr());
12314 C->setLParenLoc(
Record.readSourceLocation());
12315 C->setDistScheduleKindLoc(
Record.readSourceLocation());
12316 C->setCommaLoc(
Record.readSourceLocation());
12320 C->setDefaultmapKind(
12322 C->setDefaultmapModifier(
12324 C->setLParenLoc(
Record.readSourceLocation());
12325 C->setDefaultmapModifierLoc(
Record.readSourceLocation());
12326 C->setDefaultmapKindLoc(
Record.readSourceLocation());
12329void OMPClauseReader::VisitOMPToClause(
OMPToClause *
C) {
12330 C->setLParenLoc(
Record.readSourceLocation());
12332 C->setMotionModifier(
12334 C->setMotionModifierLoc(I,
Record.readSourceLocation());
12336 C->setMapperQualifierLoc(
Record.readNestedNameSpecifierLoc());
12337 C->setMapperIdInfo(
Record.readDeclarationNameInfo());
12338 C->setColonLoc(
Record.readSourceLocation());
12339 auto NumVars =
C->varlist_size();
12340 auto UniqueDecls =
C->getUniqueDeclarationsNum();
12341 auto TotalLists =
C->getTotalComponentListNum();
12342 auto TotalComponents =
C->getTotalComponentsNum();
12345 Vars.reserve(NumVars);
12346 for (
unsigned i = 0; i != NumVars; ++i)
12347 Vars.push_back(
Record.readSubExpr());
12348 C->setVarRefs(Vars);
12351 UDMappers.reserve(NumVars);
12352 for (
unsigned I = 0; I < NumVars; ++I)
12353 UDMappers.push_back(
Record.readSubExpr());
12354 C->setUDMapperRefs(UDMappers);
12357 Decls.reserve(UniqueDecls);
12358 for (
unsigned i = 0; i < UniqueDecls; ++i)
12360 C->setUniqueDecls(Decls);
12363 ListsPerDecl.reserve(UniqueDecls);
12364 for (
unsigned i = 0; i < UniqueDecls; ++i)
12365 ListsPerDecl.push_back(
Record.readInt());
12366 C->setDeclNumLists(ListsPerDecl);
12369 ListSizes.reserve(TotalLists);
12370 for (
unsigned i = 0; i < TotalLists; ++i)
12371 ListSizes.push_back(
Record.readInt());
12372 C->setComponentListSizes(ListSizes);
12375 Components.reserve(TotalComponents);
12376 for (
unsigned i = 0; i < TotalComponents; ++i) {
12377 Expr *AssociatedExprPr =
Record.readSubExpr();
12378 bool IsNonContiguous =
Record.readBool();
12380 Components.emplace_back(AssociatedExprPr, AssociatedDecl, IsNonContiguous);
12382 C->setComponents(Components, ListSizes);
12386 C->setLParenLoc(
Record.readSourceLocation());
12388 C->setMotionModifier(
12390 C->setMotionModifierLoc(I,
Record.readSourceLocation());
12392 C->setMapperQualifierLoc(
Record.readNestedNameSpecifierLoc());
12393 C->setMapperIdInfo(
Record.readDeclarationNameInfo());
12394 C->setColonLoc(
Record.readSourceLocation());
12395 auto NumVars =
C->varlist_size();
12396 auto UniqueDecls =
C->getUniqueDeclarationsNum();
12397 auto TotalLists =
C->getTotalComponentListNum();
12398 auto TotalComponents =
C->getTotalComponentsNum();
12401 Vars.reserve(NumVars);
12402 for (
unsigned i = 0; i != NumVars; ++i)
12403 Vars.push_back(
Record.readSubExpr());
12404 C->setVarRefs(Vars);
12407 UDMappers.reserve(NumVars);
12408 for (
unsigned I = 0; I < NumVars; ++I)
12409 UDMappers.push_back(
Record.readSubExpr());
12410 C->setUDMapperRefs(UDMappers);
12413 Decls.reserve(UniqueDecls);
12414 for (
unsigned i = 0; i < UniqueDecls; ++i)
12416 C->setUniqueDecls(Decls);
12419 ListsPerDecl.reserve(UniqueDecls);
12420 for (
unsigned i = 0; i < UniqueDecls; ++i)
12421 ListsPerDecl.push_back(
Record.readInt());
12422 C->setDeclNumLists(ListsPerDecl);
12425 ListSizes.reserve(TotalLists);
12426 for (
unsigned i = 0; i < TotalLists; ++i)
12427 ListSizes.push_back(
Record.readInt());
12428 C->setComponentListSizes(ListSizes);
12431 Components.reserve(TotalComponents);
12432 for (
unsigned i = 0; i < TotalComponents; ++i) {
12433 Expr *AssociatedExprPr =
Record.readSubExpr();
12434 bool IsNonContiguous =
Record.readBool();
12436 Components.emplace_back(AssociatedExprPr, AssociatedDecl, IsNonContiguous);
12438 C->setComponents(Components, ListSizes);
12442 C->setLParenLoc(
Record.readSourceLocation());
12443 auto NumVars =
C->varlist_size();
12444 auto UniqueDecls =
C->getUniqueDeclarationsNum();
12445 auto TotalLists =
C->getTotalComponentListNum();
12446 auto TotalComponents =
C->getTotalComponentsNum();
12449 Vars.reserve(NumVars);
12450 for (
unsigned i = 0; i != NumVars; ++i)
12451 Vars.push_back(
Record.readSubExpr());
12452 C->setVarRefs(Vars);
12454 for (
unsigned i = 0; i != NumVars; ++i)
12455 Vars.push_back(
Record.readSubExpr());
12456 C->setPrivateCopies(Vars);
12458 for (
unsigned i = 0; i != NumVars; ++i)
12459 Vars.push_back(
Record.readSubExpr());
12463 Decls.reserve(UniqueDecls);
12464 for (
unsigned i = 0; i < UniqueDecls; ++i)
12466 C->setUniqueDecls(Decls);
12469 ListsPerDecl.reserve(UniqueDecls);
12470 for (
unsigned i = 0; i < UniqueDecls; ++i)
12471 ListsPerDecl.push_back(
Record.readInt());
12472 C->setDeclNumLists(ListsPerDecl);
12475 ListSizes.reserve(TotalLists);
12476 for (
unsigned i = 0; i < TotalLists; ++i)
12477 ListSizes.push_back(
Record.readInt());
12478 C->setComponentListSizes(ListSizes);
12481 Components.reserve(TotalComponents);
12482 for (
unsigned i = 0; i < TotalComponents; ++i) {
12483 auto *AssociatedExprPr =
Record.readSubExpr();
12485 Components.emplace_back(AssociatedExprPr, AssociatedDecl,
12488 C->setComponents(Components, ListSizes);
12492 C->setLParenLoc(
Record.readSourceLocation());
12493 auto NumVars =
C->varlist_size();
12494 auto UniqueDecls =
C->getUniqueDeclarationsNum();
12495 auto TotalLists =
C->getTotalComponentListNum();
12496 auto TotalComponents =
C->getTotalComponentsNum();
12499 Vars.reserve(NumVars);
12500 for (
unsigned i = 0; i != NumVars; ++i)
12501 Vars.push_back(
Record.readSubExpr());
12502 C->setVarRefs(Vars);
12505 Decls.reserve(UniqueDecls);
12506 for (
unsigned i = 0; i < UniqueDecls; ++i)
12508 C->setUniqueDecls(Decls);
12511 ListsPerDecl.reserve(UniqueDecls);
12512 for (
unsigned i = 0; i < UniqueDecls; ++i)
12513 ListsPerDecl.push_back(
Record.readInt());
12514 C->setDeclNumLists(ListsPerDecl);
12517 ListSizes.reserve(TotalLists);
12518 for (
unsigned i = 0; i < TotalLists; ++i)
12519 ListSizes.push_back(
Record.readInt());
12520 C->setComponentListSizes(ListSizes);
12523 Components.reserve(TotalComponents);
12524 for (
unsigned i = 0; i < TotalComponents; ++i) {
12525 Expr *AssociatedExpr =
Record.readSubExpr();
12527 Components.emplace_back(AssociatedExpr, AssociatedDecl,
12530 C->setComponents(Components, ListSizes);
12534 C->setLParenLoc(
Record.readSourceLocation());
12535 auto NumVars =
C->varlist_size();
12536 auto UniqueDecls =
C->getUniqueDeclarationsNum();
12537 auto TotalLists =
C->getTotalComponentListNum();
12538 auto TotalComponents =
C->getTotalComponentsNum();
12541 Vars.reserve(NumVars);
12542 for (
unsigned i = 0; i != NumVars; ++i)
12543 Vars.push_back(
Record.readSubExpr());
12544 C->setVarRefs(Vars);
12548 Decls.reserve(UniqueDecls);
12549 for (
unsigned i = 0; i < UniqueDecls; ++i)
12551 C->setUniqueDecls(Decls);
12554 ListsPerDecl.reserve(UniqueDecls);
12555 for (
unsigned i = 0; i < UniqueDecls; ++i)
12556 ListsPerDecl.push_back(
Record.readInt());
12557 C->setDeclNumLists(ListsPerDecl);
12560 ListSizes.reserve(TotalLists);
12561 for (
unsigned i = 0; i < TotalLists; ++i)
12562 ListSizes.push_back(
Record.readInt());
12563 C->setComponentListSizes(ListSizes);
12566 Components.reserve(TotalComponents);
12567 for (
unsigned i = 0; i < TotalComponents; ++i) {
12568 Expr *AssociatedExpr =
Record.readSubExpr();
12570 Components.emplace_back(AssociatedExpr, AssociatedDecl,
12573 C->setComponents(Components, ListSizes);
12577 C->setLParenLoc(
Record.readSourceLocation());
12578 auto NumVars =
C->varlist_size();
12579 auto UniqueDecls =
C->getUniqueDeclarationsNum();
12580 auto TotalLists =
C->getTotalComponentListNum();
12581 auto TotalComponents =
C->getTotalComponentsNum();
12584 Vars.reserve(NumVars);
12585 for (
unsigned I = 0; I != NumVars; ++I)
12586 Vars.push_back(
Record.readSubExpr());
12587 C->setVarRefs(Vars);
12591 Decls.reserve(UniqueDecls);
12592 for (
unsigned I = 0; I < UniqueDecls; ++I)
12594 C->setUniqueDecls(Decls);
12597 ListsPerDecl.reserve(UniqueDecls);
12598 for (
unsigned I = 0; I < UniqueDecls; ++I)
12599 ListsPerDecl.push_back(
Record.readInt());
12600 C->setDeclNumLists(ListsPerDecl);
12603 ListSizes.reserve(TotalLists);
12604 for (
unsigned i = 0; i < TotalLists; ++i)
12605 ListSizes.push_back(
Record.readInt());
12606 C->setComponentListSizes(ListSizes);
12609 Components.reserve(TotalComponents);
12610 for (
unsigned I = 0; I < TotalComponents; ++I) {
12611 Expr *AssociatedExpr =
Record.readSubExpr();
12613 Components.emplace_back(AssociatedExpr, AssociatedDecl,
12616 C->setComponents(Components, ListSizes);
12620 C->setLParenLoc(
Record.readSourceLocation());
12621 unsigned NumVars =
C->varlist_size();
12623 Vars.reserve(NumVars);
12624 for (
unsigned i = 0; i != NumVars; ++i)
12625 Vars.push_back(
Record.readSubExpr());
12626 C->setVarRefs(Vars);
12628 Vars.reserve(NumVars);
12629 for (
unsigned i = 0; i != NumVars; ++i)
12630 Vars.push_back(
Record.readSubExpr());
12631 C->setPrivateRefs(Vars);
12635 C->setLParenLoc(
Record.readSourceLocation());
12636 unsigned NumVars =
C->varlist_size();
12638 Vars.reserve(NumVars);
12639 for (
unsigned i = 0; i != NumVars; ++i)
12640 Vars.push_back(
Record.readSubExpr());
12641 C->setVarRefs(Vars);
12645 C->setLParenLoc(
Record.readSourceLocation());
12646 unsigned NumVars =
C->varlist_size();
12648 Vars.reserve(NumVars);
12649 for (
unsigned i = 0; i != NumVars; ++i)
12650 Vars.push_back(
Record.readSubExpr());
12651 C->setVarRefs(Vars);
12655 C->setLParenLoc(
Record.readSourceLocation());
12656 unsigned NumOfAllocators =
C->getNumberOfAllocators();
12658 Data.reserve(NumOfAllocators);
12659 for (
unsigned I = 0; I != NumOfAllocators; ++I) {
12661 D.Allocator =
Record.readSubExpr();
12662 D.AllocatorTraits =
Record.readSubExpr();
12663 D.LParenLoc =
Record.readSourceLocation();
12664 D.RParenLoc =
Record.readSourceLocation();
12666 C->setAllocatorsData(
Data);
12670 C->setLParenLoc(
Record.readSourceLocation());
12671 C->setModifier(
Record.readSubExpr());
12672 C->setColonLoc(
Record.readSourceLocation());
12673 unsigned NumOfLocators =
C->varlist_size();
12675 Locators.reserve(NumOfLocators);
12676 for (
unsigned I = 0; I != NumOfLocators; ++I)
12677 Locators.push_back(
Record.readSubExpr());
12678 C->setVarRefs(Locators);
12684 C->setLParenLoc(
Record.readSourceLocation());
12685 C->setKindKwLoc(
Record.readSourceLocation());
12686 C->setModifierKwLoc(
Record.readSourceLocation());
12691 C->setThreadID(
Record.readSubExpr());
12692 C->setLParenLoc(
Record.readSourceLocation());
12697 C->setLParenLoc(
Record.readSourceLocation());
12698 C->setBindKindLoc(
Record.readSourceLocation());
12702 C->setAlignment(
Record.readExpr());
12703 C->setLParenLoc(
Record.readSourceLocation());
12708 C->setSize(
Record.readSubExpr());
12709 C->setLParenLoc(
Record.readSourceLocation());
12713 C->setLParenLoc(
Record.readSourceLocation());
12714 C->setDependenceType(
12716 C->setDependenceLoc(
Record.readSourceLocation());
12717 C->setColonLoc(
Record.readSourceLocation());
12718 unsigned NumVars =
C->varlist_size();
12720 Vars.reserve(NumVars);
12721 for (
unsigned I = 0; I != NumVars; ++I)
12722 Vars.push_back(
Record.readSubExpr());
12723 C->setVarRefs(Vars);
12724 for (
unsigned I = 0,
E =
C->getNumLoops(); I <
E; ++I)
12725 C->setLoopData(I,
Record.readSubExpr());
12730 Record.readAttributes(Attrs);
12731 C->setAttrs(Attrs);
12732 C->setLocStart(
Record.readSourceLocation());
12733 C->setLParenLoc(
Record.readSourceLocation());
12734 C->setLocEnd(
Record.readSourceLocation());
12743 Set.Kind = readEnum<llvm::omp::TraitSet>();
12746 Selector.Kind = readEnum<llvm::omp::TraitSelector>();
12747 Selector.ScoreOrCondition =
nullptr;
12749 Selector.ScoreOrCondition = readExprRef();
12752 Property.Kind = readEnum<llvm::omp::TraitProperty>();
12761 if (Reader->ReadingKind == ASTReader::Read_Stmt) {
12766 for (
unsigned I = 0,
E =
Data->getNumClauses(); I <
E; ++I)
12768 Data->setClauses(Clauses);
12769 if (
Data->hasAssociatedStmt())
12771 for (
unsigned I = 0,
E =
Data->getNumChildren(); I <
E; ++I)
12776 unsigned NumVars =
readInt();
12778 for (
unsigned I = 0; I < NumVars; ++I)
12784 unsigned NumExprs =
readInt();
12786 for (
unsigned I = 0; I < NumExprs; ++I)
12796 switch (ClauseKind) {
12811 bool isConditionExprClause =
readBool();
12812 if (isConditionExprClause) {
12817 unsigned NumVars =
readInt();
12819 for (
unsigned I = 0; I < NumVars; ++I)
12826 unsigned NumClauses =
readInt();
12828 for (
unsigned I = 0; I < NumClauses; ++I)
12862 for (
unsigned I = 0; I < VarList.size(); ++I)
12863 RecipeList.push_back(readDeclAs<VarDecl>());
12866 VarList, RecipeList, EndLoc);
12884 for (
unsigned I = 0; I < VarList.size(); ++I) {
12885 VarDecl *Recipe = readDeclAs<VarDecl>();
12886 VarDecl *RecipeTemp = readDeclAs<VarDecl>();
12887 RecipeList.push_back({Recipe, RecipeTemp});
12891 VarList, RecipeList, EndLoc);
12942 LParenLoc, ModList, VarList, EndLoc);
12951 LParenLoc, ModList, VarList, EndLoc);
12960 LParenLoc, ModList, VarList, EndLoc);
12969 LParenLoc, ModList, VarList, EndLoc);
12975 AsyncExpr, EndLoc);
12983 DevNumExpr, QueuesLoc, QueueIdExprs,
12990 unsigned NumArchs =
readInt();
12992 for (
unsigned I = 0; I < NumArchs; ++I) {
12995 Archs.emplace_back(
Loc, Ident);
12999 LParenLoc, Archs, EndLoc);
13007 for (
unsigned I = 0; I < VarList.size(); ++I) {
13008 VarDecl *Recipe = readDeclAs<VarDecl>();
13010 RecipeList.push_back({Recipe});
13014 VarList, RecipeList, EndLoc);
13033 HasForce, LoopCount, EndLoc);
13037 unsigned NumClauses =
readInt();
13039 for (
unsigned I = 0; I < NumClauses; ++I)
13042 SizeExprs, EndLoc);
13046 unsigned NumExprs =
readInt();
13049 for (
unsigned I = 0; I < NumExprs; ++I) {
13050 GangKinds.push_back(readEnum<OpenACCGangKind>());
13055 GangKinds, Exprs, EndLoc);
13061 WorkerExpr, EndLoc);
13067 VectorExpr, EndLoc);
13079 LParenLoc, VarList, EndLoc);
13087 cast<StringLiteral>(
readExpr()), EndLoc);
13093 llvm_unreachable(
"Clause serialization not yet implemented");
13095 llvm_unreachable(
"Invalid Clause Kind");
13100 for (
unsigned I = 0; I < Clauses.size(); ++I)
13105 unsigned NumVars =
readInt();
13106 A->Clauses.resize(NumVars);
13113 llvm::FoldingSetNodeID ID;
13114 ID.AddString(PrimaryModuleName);
13115 return ID.computeStableHash();
13120 return std::nullopt;
13123 return std::nullopt;
13126 return std::nullopt;
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 bool checkCodegenOptions(const CodeGenOptions &CGOpts, const CodeGenOptions &ExistingCGOpts, StringRef ModuleFilename, DiagnosticsEngine *Diags, bool AllowCompatibleDifferences=true)
static llvm::Error doesntStartWithASTFileMagic(BitstreamCursor &Stream)
Whether Stream doesn't start with the AST 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 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 unsigned getStableHashForModuleName(StringRef PrimaryModuleName)
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.
static std::pair< StringRef, StringRef > getUnresolvedInputFilenames(const ASTReader::RecordData &Record, const StringRef InputBlob)
#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::@1840::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.
static bool hasDefinition(const ObjCObjectPointerType *ObjPtr)
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.
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.
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
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
const LangOptions & getLangOpts() const
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 * getMSTypeInfoTagDecl() const
Retrieve the implicitly-predeclared 'struct type_info' declaration.
TagDecl * getMSGuidTagDecl() const
Retrieve the implicitly-predeclared 'struct _GUID' declaration.
CanQualType UnsignedLongLongTy
CanQualType OCLReserveIDTy
CanQualType UnsignedShortTy
CanQualType SatUnsignedLongFractTy
void setcudaConfigureCallDecl(FunctionDecl *FD)
void deduplicateMergedDefinitionsFor(NamedDecl *ND)
Clean up the merged definition list.
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.
CanQualType SatUnsignedLongAccumTy
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 ReadDiagnosticOptions(DiagnosticOptions &DiagOpts, StringRef ModuleFilename, bool Complain)
Receives the diagnostic options.
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 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...
virtual bool ReadCodeGenOptions(const CodeGenOptions &CGOpts, StringRef ModuleFilename, bool Complain, bool AllowCompatibleDifferences)
Receives the codegen options.
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.
std::string ReadPathBlob(StringRef BaseDirectory, const RecordData &Record, unsigned &Idx, StringRef &Blob)
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.
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()
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
const serialization::reader::ModuleLocalLookupTable * getModuleLocalLookupTables(DeclContext *Primary) const
SourceLocation getSourceLocationForDeclID(GlobalDeclID ID)
Returns the source location for the decl ID.
const CodeGenOptions & getCodeGenOpts() const
void makeModuleVisible(Module *Mod, Module::NameVisibilityKind NameVisibility, SourceLocation ImportLoc)
Make the entities in the given module and any of its (non-explicit) submodules visible to name lookup...
SourceRange ReadSourceRange(ModuleFile &F, const RecordData &Record, unsigned &Idx)
Read a source range.
bool LoadExternalSpecializations(const Decl *D, bool OnlyPartial) override
Load all the external specializations for the Decl.
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...
static std::string ResolveImportedPathAndAllocate(SmallString< 0 > &Buf, StringRef Path, ModuleFile &ModF)
Resolve Path in the context of module file M.
static StringRef ReadStringBlob(const RecordDataImpl &Record, unsigned &Idx, StringRef &Blob)
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)
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.
bool haveUnloadedSpecializations(const Decl *D) const
If we have any unloaded specialization for D.
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.
static bool isAcceptableASTFile(StringRef Filename, FileManager &FileMgr, const ModuleCache &ModCache, const PCHContainerReader &PCHContainerRdr, const LangOptions &LangOpts, const CodeGenOptions &CGOpts, 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...
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.
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 AssignedLambdaNumbering(CXXRecordDecl *Lambda) override
Notify the external source that a lambda was assigned a mangling number.
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 ModuleCache &ModCache, 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.
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.
bool FindExternalVisibleDeclsByName(const DeclContext *DC, DeclarationName Name, const DeclContext *OriginalDC) override
Finds all the visible declarations with a given name.
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.
static TemporarilyOwnedStringRef ResolveImportedPath(SmallString< 0 > &Buf, StringRef Path, ModuleFile &ModF)
Resolve Path in the context of module file M.
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.
ASTReader(Preprocessor &PP, ModuleCache &ModCache, ASTContext *Context, const PCHContainerReader &PCHContainerRdr, const CodeGenOptions &CodeGenOpts, ArrayRef< std::shared_ptr< ModuleFileExtension > > Extensions, StringRef isysroot="", DisableValidationForModuleKind DisableValidationKind=DisableValidationForModuleKind::None, bool AllowASTWithCompilerErrors=false, bool AllowConfigurationMismatch=false, bool ValidateSystemInputs=false, bool ForceValidateUserInputs=true, bool ValidateASTInputFilesContent=false, bool UseGlobalIndex=true, std::unique_ptr< llvm::Timer > ReadTimer={})
Load the AST file and validate its contents against the given Preprocessor.
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.
int getSLocEntryID(SourceLocation::UIntTy SLocOffset) override
Get the index ID for the loaded SourceLocation offset.
SourceLocation ReadSourceLocation(ModuleFile &MF, RawLocEncoding Raw) const
Read a source location from raw form.
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.
serialization::reader::LazySpecializationInfoLookupTable * getLoadedSpecializationsLookupTables(const Decl *D, bool IsPartial)
Get the loaded specializations lookup tables for D, if any.
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 runWithSufficientStackSpace(SourceLocation Loc, llvm::function_ref< void()> Fn)
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.
const serialization::reader::DeclContextLookupTable * getTULocalLookupTables(DeclContext *Primary) const
FileManager & getFileManager() const
bool wasThisDeclarationADefinition(const FunctionDecl *FD) override
True if this function declaration was a definition before in its own module.
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.
SourceRange readSourceRange()
Read a source range, advancing Idx.
SourceLocation readSourceLocation()
Read a source location, advancing Idx.
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()
void readTypeLoc(TypeLoc TL)
Reads the location information for a type.
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.
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, during statement reading.
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.
SpirvOperand readHLSLSpirvOperand()
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.
void readOpenACCRoutineDeclAttr(OpenACCRoutineDeclAttr *A)
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 ReadCodeGenOptions(const CodeGenOptions &CGOpts, StringRef ModuleFilename, bool Complain, bool AllowCompatibleDifferences) override
Receives the codegen options.
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 needsSystemInputFileVisitation() override
Returns true if this ASTReaderListener wants to receive the system input files of the AST file via vi...
bool ReadDiagnosticOptions(DiagnosticOptions &DiagOpts, StringRef ModuleFilename, bool Complain) override
Receives the diagnostic options.
CompatibilityKind
For ASTs produced with different option value, signifies their level of compatibility.
CodeGenOptions - Track various options which control how the code is optimized and passed to the back...
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, TemplateDecl *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...
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.
bool isCanonicalDecl() const
Whether this particular Decl is a canonical one.
Module * getOwningModule() const
Get the module that owns this declaration (for visibility purposes).
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 setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
void setElaboratedKeywordLoc(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.
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 > Remarks
The list of -R... options used to alter the diagnostic mappings, with the prefixes removed.
std::vector< std::string > Warnings
The list of -W... options used to alter the diagnostic mappings, with the prefixes removed.
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 set(SourceLocation ElaboratedKeywordLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation NameLoc)
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.
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
llvm::ErrorOr< std::unique_ptr< llvm::MemoryBuffer > > getBufferForFile(FileEntryRef Entry, bool isVolatile=false, bool RequiresNullTerminator=true, std::optional< int64_t > MaybeLimit=std::nullopt, bool IsText=true)
Open the specified file as a MemoryBuffer, returning a new MemoryBuffer if successful,...
OptionalFileEntryRef getOptionalFileRef(StringRef Filename, bool OpenFile=false, bool CacheFailure=true)
Get a FileEntryRef if it exists, without doing anything on error.
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...
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.
Type source information for HLSL attributed resource type.
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.
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
CompatibilityKind
For ASTs produced with different option value, signifies their level of compatibility.
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 setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
The module cache used for compiling modules implicitly.
virtual InMemoryModuleCache & getInMemoryModuleCache()=0
Returns this process's view of the module cache.
void addLinkAsDependency(Module *Mod)
Make module to use export_as as the link dependency name if enough information is available or add it...
void setUmbrellaDirAsWritten(Module *Mod, DirectoryEntryRef UmbrellaDir, const Twine &NameAsWritten, const Twine &PathRelativeToRootModuleDirectory)
Sets the umbrella directory of the given module to the given directory.
OptionalFileEntryRef getContainingModuleMapFile(const Module *Module) const
Module * findModule(StringRef Name) const
Retrieve a module with the given name.
void setInferredModuleAllowedBy(Module *M, FileID ModMapFID)
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
Module * findOrCreateModuleFirst(StringRef Name, Module *Parent, bool IsFramework, bool IsExplicit)
Call ModuleMap::findOrCreateModule and throw away the information whether the module was found or cre...
Module * createModule(StringRef Name, Module *Parent, bool IsFramework, bool IsExplicit)
Create new submodule, assuming it does not exist.
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.
bool isHeaderLikeModule() const
Is this module have similar semantics as headers.
OptionalDirectoryEntryRef Directory
The build directory of this module.
unsigned NamedModuleHasInit
Whether this C++20 named modules doesn't need an initializer.
StringRef getPrimaryModuleInterfaceName() const
Get the primary module interface name from a partition.
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.
bool isGlobalModule() const
Does this Module scope describe a fragment of the global module within some C++ module.
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.
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.
@ MicrosoftSuper
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in.
@ Global
The global specifier '::'. There is no stored value.
@ Type
A type, stored as a Type*.
@ Namespace
A namespace-like entity, stored as a NamespaceBaseDecl*.
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 the 'message' clause in the '#pragma omp error' and the '#pragma omp parallel' direct...
This represents the 'no_openmp' clause in the '#pragma omp assume' directive.
This represents the 'no_openmp_constructs' clause in the.
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 class represents the 'permutation' clause in the '#pragma omp interchange' directive.
static OMPPermutationClause * CreateEmpty(const ASTContext &C, unsigned NumLoops)
Build an empty 'permutation' 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 'self_maps' clause in the '#pragma omp requires' directive.
This represents 'seq_cst' clause in the '#pragma omp atomic|flush' directives.
This represents the 'severity' clause in the '#pragma omp error' and the '#pragma omp parallel' direc...
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.
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)
static OpenACCBindClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, const IdentifierInfo *ID, SourceLocation EndLoc)
This is the base type for all OpenACC Clauses.
static OpenACCCollapseClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, bool HasForce, Expr *LoopCount, SourceLocation EndLoc)
static OpenACCCopyClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, OpenACCModifierKind Mods, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCopyInClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, OpenACCModifierKind Mods, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCopyOutClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, OpenACCModifierKind Mods, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCreateClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, OpenACCModifierKind Mods, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDefaultAsyncClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCDefaultClause * Create(const ASTContext &C, OpenACCDefaultClauseKind K, SourceLocation BeginLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
static OpenACCDeleteClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDetachClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDeviceClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDeviceNumClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCDevicePtrClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDeviceResidentClause * 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 OpenACCFinalizeClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCFirstPrivateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, ArrayRef< OpenACCFirstPrivateRecipe > InitRecipes, SourceLocation EndLoc)
static OpenACCGangClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< OpenACCGangKind > GangKinds, ArrayRef< Expr * > IntExprs, SourceLocation EndLoc)
static OpenACCHostClause * 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 OpenACCIfPresentClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCIndependentClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCLinkClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCNoCreateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCNoHostClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, 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, ArrayRef< VarDecl * > InitRecipes, SourceLocation EndLoc)
static OpenACCReductionClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, OpenACCReductionOperator Operator, ArrayRef< Expr * > VarList, ArrayRef< OpenACCReductionRecipe > Recipes, 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 OpenACCTileClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > SizeExprs, SourceLocation EndLoc)
static OpenACCUseDeviceClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCVectorClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, 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)
static OpenACCWorkerClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, 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 ReadDiagnosticOptions(DiagnosticOptions &DiagOpts, StringRef ModuleFilename, bool Complain) override
Receives the diagnostic options.
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.
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 ReadCodeGenOptions(const CodeGenOptions &CGOpts, StringRef ModuleFilename, bool Complain, bool AllowCompatibleDifferences) override
Receives the codegen 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
HeaderSearch & getHeaderSearchInfo() const
IdentifierTable & getIdentifierTable()
const PreprocessorOptions & getPreprocessorOpts() const
Retrieve the preprocessor options used to initialize this preprocessor.
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...
Declaration of a redeclarable template.
decl_type * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
void setPreviousDecl(decl_type *PrevDecl)
Set the previous declaration.
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.
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.
void addExternalSource(IntrusiveRefCntPtr< ExternalSemaSource > E)
Registers an external source.
Scope * TUScope
Translation Unit Scope - useful to Objective-C actions that need to lookup file scope declarations in...
void runWithSufficientStackSpace(SourceLocation Loc, llvm::function_ref< void()> Fn)
Run some code with "sufficient" stack space.
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.
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.
FileIDAndOffset getDecomposedLoc(SourceLocation Loc) const
Decompose the specified location into a raw FileID + Offset pair.
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)
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
Instances of this class represent operands to a SPIR-V type instruction.
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.
void runWithSufficientStackSpace(SourceLocation Loc, llvm::function_ref< void()> Fn)
Run some code with "sufficient" stack space.
Stmt - This represents one statement.
Wrapper for substituted template type parameters.
Wrapper for substituted template type parameters.
Wrapper for substituted template type parameters.
Represents the declaration of a struct/union/class/enum.
void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
void setNameLoc(SourceLocation Loc)
void setElaboratedKeywordLoc(SourceLocation Loc)
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
MutableArrayRef< TemplateArgumentLocInfo > getArgLocInfos()
void set(SourceLocation ElaboratedKeywordLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKeywordLoc, SourceLocation NameLoc, SourceLocation LAngleLoc, SourceLocation RAngleLoc)
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...
TypeLocReader(ASTRecordReader &Reader)
void VisitArrayTypeLoc(ArrayTypeLoc)
void VisitFunctionTypeLoc(FunctionTypeLoc)
void VisitTagTypeLoc(TagTypeLoc TL)
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).
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)
Class that performs lookup to specialized decls.
std::pair< DeclarationName, const Module * > external_key_type
void ReadDataInto(internal_key_type, const unsigned char *d, unsigned DataLen, data_type_builder &Val)
std::pair< DeclarationNameKey, unsigned > internal_key_type
internal_key_type ReadKey(const unsigned char *d, unsigned)
static hash_value_type ComputeHash(const internal_key_type &Key)
static internal_key_type GetInternalKey(const external_key_type &Key)
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_PARTIAL_SPECIALIZATIONS
@ DECL_CONTEXT_TU_LOCAL_VISIBLE
A record that stores the set of declarations that are only visible to the TU.
@ 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_MODULE_LOCAL_VISIBLE
A record containing the set of declarations that are only visible from DeclContext in the same module...
@ 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...
internal::Matcher< T > findAll(const internal::Matcher< T > &Matcher)
Matches if the node or any descendant matches.
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.
@ CODEGEN_OPTIONS
Record code for the codegen 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.
unsigned StableHashForTemplateArguments(llvm::ArrayRef< TemplateArgument > Args)
Calculate a stable hash value for template arguments.
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.
@ 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 ...
@ IMPORT
Record code for another AST file imported by this AST file.
@ 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.
@ CXX_ADDED_TEMPLATE_SPECIALIZATION
@ 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.
@ CXX_ADDED_TEMPLATE_PARTIAL_SPECIALIZATION
@ DECLS_WITH_EFFECTS_TO_VERIFY
Record code for Sema's vector of functions/blocks with effects to be verified.
@ 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.
@ RELATED_DECLS_MAP
Record code for related declarations that have to be deserialized together from the same module.
@ 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.
@ UPDATE_MODULE_LOCAL_VISIBLE
@ 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.
@ UPDATE_TU_LOCAL_VISIBLE
@ 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.
TypeSpecifierType
Specifies the kind of type.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
bool isa(CodeGen::Address addr)
SanitizerMask getPPTransparentSanitizers()
Return the sanitizers which do not affect preprocessing.
std::pair< FileID, unsigned > FileIDAndOffset
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.
@ Success
Annotation was successful.
OpenMPAtClauseKind
OpenMP attributes for 'at' clause.
OpenMPReductionClauseModifier
OpenMP modifiers for 'reduction' clause.
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'.
@ Shortloop
'shortloop' is represented in the ACC.td file, but isn't present in the standard.
@ 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.
OpenMPScheduleClauseModifier
OpenMP modifiers for 'schedule' clause.
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
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.
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_OBJC_CLASS_ID
The Objective-C 'Class' type.
@ PREDEF_DECL_BUILTIN_MS_GUID_ID
The predeclared '_GUID' struct.
@ PREDEF_DECL_BUILTIN_MS_TYPE_INFO_TAG_ID
The predeclared 'type_info' 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.
@ NUM_PREDEF_DECL_IDS
The number of declaration IDs that are predefined.
@ 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.
@ 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.
@ Template
We are parsing a template declaration.
OpenMPDependClauseKind
OpenMP attributes for 'depend' clause.
OpenMPGrainsizeClauseModifier
OpenMPNumTasksClauseModifier
OpenMPSeverityClauseKind
OpenMP attributes for 'severity' clause.
void ProcessWarningOptions(DiagnosticsEngine &Diags, const DiagnosticOptions &Opts, llvm::vfs::FileSystem &VFS, bool ReportDiags=true)
ProcessWarningOptions - Initialize the diagnostic client and process the warning options specified on...
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.
OpenMPAllocateClauseModifier
OpenMP modifiers for 'allocate' 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...
OpenMPNumThreadsClauseModifier
OpenMPAtomicDefaultMemOrderClauseKind
OpenMP attributes for 'atomic_default_mem_order' clause.
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.
UnsignedOrNone getPrimaryModuleHash(const Module *M)
Calculate a hash value for the primary module name of the given module.
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
llvm::DenseSet< std::tuple< Decl *, Decl *, int > > NonEquivalentDeclSet
Store declaration pairs already found to be non-equivalent.
Location information for a TemplateArgument.
Describes the categories of an Objective-C class.
void insert(GlobalDeclID ID)
void insert(LazySpecializationInfo Info)