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) {
530 const LangOptions &ExistingLangOpts = PP.getLangOpts();
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) {
548 const TargetOptions &ExistingTargetOpts = PP.getTargetInfo().getTargetOpts();
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);
684 PP.getFileManager().getVirtualFileSystem(),
688 assert(ModuleMgr.
size() >= 1 &&
"what ASTFile is this then");
694 Module *Importer = PP.getCurrentModule();
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,
928 Complain ? &Reader.Diags :
nullptr, PP.getFileManager(),
929 SuggestedPredefines, PP.getLangOpts());
934 bool ReadMacros,
bool Complain, std::string &SuggestedPredefines) {
936 ModuleFilename, ReadMacros,
nullptr,
937 PP.getFileManager(), SuggestedPredefines,
946 llvm::vfs::FileSystem &VFS, StringRef SpecificModuleCachePath,
947 StringRef ExistingModuleCachePath, StringRef ASTFilename,
952 SpecificModuleCachePath == ExistingModuleCachePath)
955 VFS.equivalent(SpecificModuleCachePath, ExistingModuleCachePath);
956 if (EqualOrErr && *EqualOrErr)
964 if (EqualOrErr && *EqualOrErr)
965 Diags->
Report(clang::diag::warn_ast_file_config_mismatch) << ASTFilename;
967 Diags->
Report(diag::err_ast_file_modulecache_mismatch)
968 << SpecificModuleCachePath << ExistingModuleCachePath << ASTFilename;
974 StringRef ASTFilename,
975 StringRef SpecificModuleCachePath,
977 const HeaderSearch &HeaderSearchInfo = PP.getHeaderSearchInfo();
979 Reader.getFileManager().getVirtualFileSystem(), SpecificModuleCachePath,
981 Complain ? &Reader.Diags :
nullptr, PP.getLangOpts(),
986 PP.setCounterValue(
Value);
995 const char *
Error =
nullptr;
997 uint64_t Val = llvm::decodeULEB128(P, &Length,
nullptr, &
Error);
999 llvm::report_fatal_error(
Error);
1005static std::pair<unsigned, unsigned>
1008 if ((
unsigned)KeyLen != KeyLen)
1009 llvm::report_fatal_error(
"key too large");
1012 if ((
unsigned)DataLen != DataLen)
1013 llvm::report_fatal_error(
"data too large");
1015 return std::make_pair(KeyLen, DataLen);
1019 bool TakeOwnership) {
1020 DeserializationListener = Listener;
1021 OwnsDeserializationListener = TakeOwnership;
1032 Reader.ReadModuleOffsetMap(MF);
1034 unsigned ModuleFileIndex =
ID.getModuleFileIndex();
1035 unsigned LocalDeclID =
ID.getLocalDeclIndex();
1041 assert(OwningModuleFile);
1045 if (!ModuleFileIndex)
1048 assert(LocalDeclID < LocalNumDecls);
1056 unsigned ModuleFileIndex,
unsigned LocalDeclID) {
1061std::pair<unsigned, unsigned>
1068 using namespace llvm::support;
1071 unsigned N = endian::readNext<uint16_t, llvm::endianness::little>(d);
1073 F, endian::readNext<IdentifierID, llvm::endianness::little>(d));
1080 Args.push_back(FirstII);
1081 for (
unsigned I = 1; I != N; ++I)
1082 Args.push_back(Reader.getLocalIdentifier(
1083 F, endian::readNext<IdentifierID, llvm::endianness::little>(d)));
1091 using namespace llvm::support;
1095 Result.ID = Reader.getGlobalSelectorID(
1096 F, endian::readNext<uint32_t, llvm::endianness::little>(d));
1097 unsigned FullInstanceBits =
1098 endian::readNext<uint16_t, llvm::endianness::little>(d);
1099 unsigned FullFactoryBits =
1100 endian::readNext<uint16_t, llvm::endianness::little>(d);
1101 Result.InstanceBits = FullInstanceBits & 0x3;
1102 Result.InstanceHasMoreThanOneDecl = (FullInstanceBits >> 2) & 0x1;
1103 Result.FactoryBits = FullFactoryBits & 0x3;
1104 Result.FactoryHasMoreThanOneDecl = (FullFactoryBits >> 2) & 0x1;
1105 unsigned NumInstanceMethods = FullInstanceBits >> 3;
1106 unsigned NumFactoryMethods = FullFactoryBits >> 3;
1109 for (
unsigned I = 0; I != NumInstanceMethods; ++I) {
1113 endian::readNext<DeclID, llvm::endianness::little>(d))))
1118 for (
unsigned I = 0; I != NumFactoryMethods; ++I) {
1122 endian::readNext<DeclID, llvm::endianness::little>(d))))
1130 return llvm::djbHash(a);
1133std::pair<unsigned, unsigned>
1140 assert(n >= 2 && d[n-1] ==
'\0');
1141 return StringRef((
const char*) d, n-1);
1147 bool IsInteresting =
1158 bool Value = Bits & 0x1;
1164 using namespace llvm::support;
1167 endian::readNext<IdentifierID, llvm::endianness::little>(d);
1168 return Reader.getGlobalIdentifierID(F, RawID >> 1);
1181 const unsigned char* d,
1183 using namespace llvm::support;
1186 endian::readNext<IdentifierID, llvm::endianness::little>(d);
1187 bool IsInteresting = RawID & 0x01;
1197 II = &Reader.getIdentifierTable().getOwn(k);
1200 bool IsModule = Reader.getPreprocessor().getCurrentModule() !=
nullptr;
1202 Reader.markIdentifierUpToDate(II);
1204 IdentifierID ID = Reader.getGlobalIdentifierID(F, RawID);
1205 if (!IsInteresting) {
1208 Reader.SetIdentifierInfo(ID, II);
1212 unsigned ObjCOrBuiltinID =
1213 endian::readNext<uint16_t, llvm::endianness::little>(d);
1214 unsigned Bits = endian::readNext<uint16_t, llvm::endianness::little>(d);
1215 bool CPlusPlusOperatorKeyword =
readBit(Bits);
1216 bool HasRevertedTokenIDToIdentifier =
readBit(Bits);
1217 bool Poisoned =
readBit(Bits);
1218 bool ExtensionToken =
readBit(Bits);
1219 bool HasMacroDefinition =
readBit(Bits);
1221 assert(Bits == 0 &&
"Extra bits in the identifier?");
1222 DataLen -=
sizeof(uint16_t) * 2;
1226 if (HasRevertedTokenIDToIdentifier && II->
getTokenID() != tok::identifier)
1231 "Incorrect extension token flag");
1232 (void)ExtensionToken;
1236 "Incorrect C++ operator keyword flag");
1237 (void)CPlusPlusOperatorKeyword;
1241 if (HasMacroDefinition) {
1242 uint32_t MacroDirectivesOffset =
1243 endian::readNext<uint32_t, llvm::endianness::little>(d);
1246 if (MacroDirectivesOffset)
1247 Reader.addPendingMacro(II, &F, MacroDirectivesOffset);
1249 hasMacroDefinitionInDependencies =
true;
1252 Reader.SetIdentifierInfo(ID, II);
1258 for (; DataLen > 0; DataLen -=
sizeof(
DeclID))
1259 DeclIDs.push_back(Reader.getGlobalDeclID(
1262 endian::readNext<DeclID, llvm::endianness::little>(d))));
1263 Reader.SetGloballyVisibleDecls(II, DeclIDs);
1270 : Kind(Name.getNameKind()) {
1300 llvm::FoldingSetNodeID ID;
1301 ID.AddInteger(Kind);
1324 return ID.computeStableHash();
1329 using namespace llvm::support;
1331 uint32_t ModuleFileID =
1332 endian::readNext<uint32_t, llvm::endianness::little>(d);
1333 return Reader.getLocalModuleFile(
F, ModuleFileID);
1336std::pair<unsigned, unsigned>
1343 using namespace llvm::support;
1352 F, endian::readNext<IdentifierID, llvm::endianness::little>(d));
1359 F, endian::readNext<uint32_t, llvm::endianness::little>(d))
1383 using namespace llvm::support;
1385 for (
unsigned NumDecls = DataLen /
sizeof(
DeclID); NumDecls; --NumDecls) {
1387 Reader,
F, endian::readNext<DeclID, llvm::endianness::little>(d));
1393 const unsigned char *d,
1401 llvm::FoldingSetNodeID ID;
1402 ID.AddInteger(Key.first.getHash());
1403 ID.AddInteger(Key.second);
1404 return ID.computeStableHash();
1415 return {Name, *ModuleHash};
1421 unsigned PrimaryModuleHash =
1422 llvm::support::endian::readNext<uint32_t, llvm::endianness::little>(d);
1423 return {Name, PrimaryModuleHash};
1427 const unsigned char *d,
1435 using namespace llvm::support;
1437 uint32_t ModuleFileID =
1438 endian::readNext<uint32_t, llvm::endianness::little, unaligned>(d);
1439 return Reader.getLocalModuleFile(F, ModuleFileID);
1444 using namespace llvm::support;
1445 return endian::readNext<uint32_t, llvm::endianness::little, unaligned>(d);
1448std::pair<unsigned, unsigned>
1454 const unsigned char *d,
1457 using namespace llvm::support;
1459 for (
unsigned NumDecls =
1461 NumDecls; --NumDecls) {
1464 endian::readNext<DeclID, llvm::endianness::little, unaligned>(d));
1465 Val.
insert(Reader.getGlobalDeclID(F, LocalID));
1469bool ASTReader::ReadLexicalDeclContextStorage(
ModuleFile &M,
1470 BitstreamCursor &Cursor,
1473 assert(Offset != 0);
1476 if (llvm::Error Err = Cursor.JumpToBit(Offset)) {
1477 Error(std::move(Err));
1485 Error(MaybeCode.takeError());
1488 unsigned Code = MaybeCode.get();
1491 if (!MaybeRecCode) {
1492 Error(MaybeRecCode.takeError());
1495 unsigned RecCode = MaybeRecCode.get();
1497 Error(
"Expected lexical block");
1502 "expected a TU_UPDATE_LEXICAL record for TU");
1507 auto &Lex = LexicalDecls[DC];
1509 Lex = std::make_pair(
1512 Blob.size() /
sizeof(
DeclID)));
1518bool ASTReader::ReadVisibleDeclContextStorage(
1519 ModuleFile &M, BitstreamCursor &Cursor, uint64_t Offset, GlobalDeclID ID,
1520 ASTReader::VisibleDeclContextStorageKind VisibleKind) {
1521 assert(Offset != 0);
1523 SavedStreamPosition SavedPosition(Cursor);
1524 if (llvm::Error Err =
Cursor.JumpToBit(Offset)) {
1525 Error(std::move(Err));
1531 Expected<unsigned> MaybeCode =
Cursor.ReadCode();
1533 Error(MaybeCode.takeError());
1536 unsigned Code = MaybeCode.get();
1538 Expected<unsigned> MaybeRecCode =
Cursor.readRecord(Code,
Record, &Blob);
1539 if (!MaybeRecCode) {
1540 Error(MaybeRecCode.takeError());
1543 unsigned RecCode = MaybeRecCode.get();
1544 switch (VisibleKind) {
1545 case VisibleDeclContextStorageKind::GenerallyVisible:
1547 Error(
"Expected visible lookup table block");
1551 case VisibleDeclContextStorageKind::ModuleLocalVisible:
1553 Error(
"Expected module local visible lookup table block");
1557 case VisibleDeclContextStorageKind::TULocalVisible:
1559 Error(
"Expected TU local lookup table block");
1567 auto *
Data = (
const unsigned char*)Blob.data();
1568 switch (VisibleKind) {
1569 case VisibleDeclContextStorageKind::GenerallyVisible:
1570 PendingVisibleUpdates[
ID].push_back(UpdateData{&M,
Data});
1572 case VisibleDeclContextStorageKind::ModuleLocalVisible:
1573 PendingModuleLocalVisibleUpdates[
ID].push_back(UpdateData{&M,
Data});
1575 case VisibleDeclContextStorageKind::TULocalVisible:
1577 TULocalUpdates[
ID].push_back(UpdateData{&M,
Data});
1583void ASTReader::AddSpecializations(
const Decl *D,
const unsigned char *
Data,
1587 IsPartial ? PartialSpecializationsLookups : SpecializationsLookups;
1588 SpecLookups[D].Table.add(&M,
Data,
1592bool ASTReader::ReadSpecializations(
ModuleFile &M, BitstreamCursor &Cursor,
1593 uint64_t Offset, Decl *D,
bool IsPartial) {
1594 assert(Offset != 0);
1596 SavedStreamPosition SavedPosition(Cursor);
1597 if (llvm::Error Err =
Cursor.JumpToBit(Offset)) {
1598 Error(std::move(Err));
1604 Expected<unsigned> MaybeCode =
Cursor.ReadCode();
1606 Error(MaybeCode.takeError());
1609 unsigned Code = MaybeCode.get();
1611 Expected<unsigned> MaybeRecCode =
Cursor.readRecord(Code,
Record, &Blob);
1612 if (!MaybeRecCode) {
1613 Error(MaybeRecCode.takeError());
1616 unsigned RecCode = MaybeRecCode.get();
1619 Error(
"Expected decl specs block");
1623 auto *
Data = (
const unsigned char *)Blob.data();
1624 AddSpecializations(D,
Data, M, IsPartial);
1628void ASTReader::Error(StringRef Msg)
const {
1629 Error(diag::err_fe_ast_file_malformed, Msg);
1630 if (PP.getLangOpts().Modules &&
1631 !PP.getHeaderSearchInfo().getModuleCachePath().empty()) {
1632 Diag(diag::note_module_cache_path)
1633 << PP.getHeaderSearchInfo().getModuleCachePath();
1637void ASTReader::Error(
unsigned DiagID, StringRef Arg1, StringRef Arg2,
1638 StringRef Arg3)
const {
1639 Diag(DiagID) << Arg1 << Arg2 << Arg3;
1643struct AlreadyReportedDiagnosticError
1644 : llvm::ErrorInfo<AlreadyReportedDiagnosticError> {
1647 void log(raw_ostream &OS)
const override {
1648 llvm_unreachable(
"reporting an already-reported diagnostic error");
1651 std::error_code convertToErrorCode()
const override {
1652 return llvm::inconvertibleErrorCode();
1656char AlreadyReportedDiagnosticError::ID = 0;
1659void ASTReader::Error(llvm::Error &&Err)
const {
1661 std::move(Err), [](AlreadyReportedDiagnosticError &) {},
1662 [&](llvm::ErrorInfoBase &E) {
return Error(E.message()); });
1672 LineTableInfo &LineTable = SourceMgr.getLineTable();
1675 std::map<int, int> FileIDs;
1677 for (
unsigned I = 0;
Record[Idx]; ++I) {
1679 auto Filename = ReadPath(F,
Record, Idx);
1685 std::vector<LineEntry> Entries;
1686 while (Idx <
Record.size()) {
1687 FileID FID = ReadFileID(F,
Record, Idx);
1690 unsigned NumEntries =
Record[Idx++];
1691 assert(NumEntries &&
"no line entries for file ID");
1693 Entries.reserve(NumEntries);
1694 for (
unsigned I = 0; I != NumEntries; ++I) {
1695 unsigned FileOffset =
Record[Idx++];
1696 unsigned LineNo =
Record[Idx++];
1697 int FilenameID = FileIDs[
Record[Idx++]];
1700 unsigned IncludeOffset =
Record[Idx++];
1702 FileKind, IncludeOffset));
1709llvm::Error ASTReader::ReadSourceManagerBlock(
ModuleFile &F) {
1710 using namespace SrcMgr;
1718 SLocEntryCursor = F.
Stream;
1721 if (llvm::Error Err = F.
Stream.SkipBlock())
1731 Expected<llvm::BitstreamEntry> MaybeE =
1732 SLocEntryCursor.advanceSkippingSubblocks();
1734 return MaybeE.takeError();
1735 llvm::BitstreamEntry E = MaybeE.get();
1738 case llvm::BitstreamEntry::SubBlock:
1739 case llvm::BitstreamEntry::Error:
1740 return llvm::createStringError(std::errc::illegal_byte_sequence,
1741 "malformed block record in AST file");
1742 case llvm::BitstreamEntry::EndBlock:
1743 return llvm::Error::success();
1744 case llvm::BitstreamEntry::Record:
1752 Expected<unsigned> MaybeRecord =
1753 SLocEntryCursor.readRecord(E.ID,
Record, &Blob);
1755 return MaybeRecord.takeError();
1756 switch (MaybeRecord.get()) {
1764 return llvm::Error::success();
1769llvm::Expected<SourceLocation::UIntTy>
1775 return std::move(Err);
1779 return MaybeEntry.takeError();
1781 llvm::BitstreamEntry Entry = MaybeEntry.get();
1782 if (Entry.Kind != llvm::BitstreamEntry::Record)
1783 return llvm::createStringError(
1784 std::errc::illegal_byte_sequence,
1785 "incorrectly-formatted source location entry in AST file");
1791 return MaybeSLOC.takeError();
1793 switch (MaybeSLOC.get()) {
1795 return llvm::createStringError(
1796 std::errc::illegal_byte_sequence,
1797 "incorrectly-formatted source location entry in AST file");
1807 GlobalSLocOffsetMap.find(SourceManager::MaxLoadedOffset - SLocOffset - 1);
1808 assert(SLocMapI != GlobalSLocOffsetMap.end() &&
1809 "Corrupted global sloc offset map");
1814 auto It = llvm::upper_bound(
1817 int ID = F->SLocEntryBaseID + LocalIndex;
1818 std::size_t Index = -ID - 2;
1819 if (!SourceMgr.SLocEntryOffsetLoaded[Index]) {
1820 assert(!SourceMgr.SLocEntryLoaded[Index]);
1821 auto MaybeEntryOffset = readSLocOffset(F, LocalIndex);
1822 if (!MaybeEntryOffset) {
1823 Error(MaybeEntryOffset.takeError());
1827 SourceMgr.LoadedSLocEntryTable[Index] =
1828 SrcMgr::SLocEntry::getOffsetOnly(*MaybeEntryOffset);
1829 SourceMgr.SLocEntryOffsetLoaded[Index] = true;
1831 return Offset < SourceMgr.LoadedSLocEntryTable[Index].getOffset();
1847 Error(
"source location entry ID out-of-range for AST file");
1853 auto ReadBuffer = [
this](
1854 BitstreamCursor &SLocEntryCursor,
1855 StringRef Name) -> std::unique_ptr<llvm::MemoryBuffer> {
1860 Error(MaybeCode.takeError());
1863 unsigned Code = MaybeCode.get();
1866 SLocEntryCursor.readRecord(Code,
Record, &Blob);
1867 if (!MaybeRecCode) {
1868 Error(MaybeRecCode.takeError());
1871 unsigned RecCode = MaybeRecCode.get();
1876 const llvm::compression::Format F =
1877 Blob.size() > 0 && Blob.data()[0] == 0x78
1878 ? llvm::compression::Format::Zlib
1879 : llvm::compression::Format::Zstd;
1880 if (
const char *Reason = llvm::compression::getReasonIfUnsupported(F)) {
1885 if (llvm::Error E = llvm::compression::decompress(
1886 F, llvm::arrayRefFromStringRef(Blob), Decompressed,
Record[0])) {
1887 Error(
"could not decompress embedded file contents: " +
1888 llvm::toString(std::move(E)));
1891 return llvm::MemoryBuffer::getMemBufferCopy(
1892 llvm::toStringRef(Decompressed), Name);
1894 return llvm::MemoryBuffer::getMemBuffer(Blob.drop_back(1), Name,
true);
1896 Error(
"AST record has invalid code");
1901 ModuleFile *F = GlobalSLocEntryMap.find(-ID)->second;
1905 Error(std::move(Err));
1912 ++NumSLocEntriesRead;
1915 Error(MaybeEntry.takeError());
1918 llvm::BitstreamEntry Entry = MaybeEntry.get();
1920 if (Entry.Kind != llvm::BitstreamEntry::Record) {
1921 Error(
"incorrectly-formatted source location entry in AST file");
1928 SLocEntryCursor.readRecord(Entry.ID,
Record, &Blob);
1930 Error(MaybeSLOC.takeError());
1933 switch (MaybeSLOC.get()) {
1935 Error(
"incorrectly-formatted source location entry in AST file");
1941 unsigned InputID =
Record[4];
1942 InputFile IF = getInputFile(*F, InputID);
1955 IncludeLoc = getImportLocation(F);
1959 FileID FID = SourceMgr.createFileID(*
File, IncludeLoc, FileCharacter, ID,
1962 FileInfo.NumCreatedFIDs =
Record[5];
1966 unsigned NumFileDecls =
Record[7];
1967 if (NumFileDecls && ContextObj) {
1969 assert(F->
FileSortedDecls &&
"FILE_SORTED_DECLS not encountered yet ?");
1975 SourceMgr.getOrCreateContentCache(*
File, isSystem(FileCharacter));
1979 auto Buffer = ReadBuffer(SLocEntryCursor,
File->getName());
1982 SourceMgr.overrideFileContents(*
File, std::move(Buffer));
1989 const char *Name = Blob.data();
1990 unsigned Offset =
Record[0];
1995 IncludeLoc = getImportLocation(F);
1998 auto Buffer = ReadBuffer(SLocEntryCursor, Name);
2001 FileID FID = SourceMgr.createFileID(std::move(Buffer), FileCharacter, ID,
2002 BaseOffset + Offset, IncludeLoc);
2004 auto &FileInfo = SourceMgr.getSLocEntry(FID).getFile();
2005 FileInfo.setHasLineDirectives();
2014 SourceMgr.createExpansionLoc(SpellingLoc, ExpansionBegin, ExpansionEnd,
2029 Error(
"source location entry ID out-of-range for AST file");
2034 ModuleFile *M = GlobalSLocEntryMap.find(-ID)->second;
2052 assert(SourceMgr.getMainFileID().isValid() &&
"missing main file");
2053 return SourceMgr.getLocForStartOfFile(SourceMgr.getMainFileID());
2063 uint64_t *StartOfBlockOffset) {
2064 if (llvm::Error Err = Cursor.EnterSubBlock(BlockID))
2067 if (StartOfBlockOffset)
2068 *StartOfBlockOffset = Cursor.GetCurrentBitNo();
2071 uint64_t Offset = Cursor.GetCurrentBitNo();
2074 return MaybeCode.takeError();
2075 unsigned Code = MaybeCode.get();
2078 if (Code != llvm::bitc::DEFINE_ABBREV) {
2079 if (llvm::Error Err = Cursor.JumpToBit(Offset))
2081 return llvm::Error::success();
2083 if (llvm::Error Err = Cursor.ReadAbbrevRecord())
2096 if (
Tok.isAnnotation()) {
2098 switch (
Tok.getKind()) {
2099 case tok::annot_pragma_loop_hint: {
2103 unsigned NumTokens =
Record[Idx++];
2105 Toks.reserve(NumTokens);
2106 for (
unsigned I = 0; I < NumTokens; ++I)
2108 Info->Toks =
llvm::ArrayRef(Toks).copy(PP.getPreprocessorAllocator());
2109 Tok.setAnnotationValue(
static_cast<void *
>(Info));
2112 case tok::annot_pragma_pack: {
2117 llvm::StringRef(SlotLabel).copy(PP.getPreprocessorAllocator());
2119 Tok.setAnnotationValue(
static_cast<void *
>(Info));
2123 case tok::annot_pragma_openmp:
2124 case tok::annot_pragma_openmp_end:
2125 case tok::annot_pragma_unused:
2126 case tok::annot_pragma_openacc:
2127 case tok::annot_pragma_openacc_end:
2128 case tok::annot_repl_input_end:
2131 llvm_unreachable(
"missing deserialization code for annotation token");
2136 Tok.setIdentifierInfo(II);
2148 if (llvm::Error Err = Stream.JumpToBit(Offset)) {
2150 consumeError(std::move(Err));
2162 unsigned Flags = BitstreamCursor::AF_DontPopBlockAtEnd;
2164 Stream.advanceSkippingSubblocks(Flags);
2166 Error(MaybeEntry.takeError());
2169 llvm::BitstreamEntry Entry = MaybeEntry.get();
2171 switch (Entry.Kind) {
2172 case llvm::BitstreamEntry::SubBlock:
2173 case llvm::BitstreamEntry::Error:
2174 Error(
"malformed block record in AST file");
2176 case llvm::BitstreamEntry::EndBlock:
2178 case llvm::BitstreamEntry::Record:
2189 Error(MaybeRecType.takeError());
2205 unsigned NextIndex = 1;
2207 MacroInfo *MI = PP.AllocateMacroInfo(Loc);
2212 PP.getPreprocessorAllocator());
2215 bool isC99VarArgs =
Record[NextIndex++];
2216 bool isGNUVarArgs =
Record[NextIndex++];
2217 bool hasCommaPasting =
Record[NextIndex++];
2218 MacroParams.clear();
2219 unsigned NumArgs =
Record[NextIndex++];
2220 for (
unsigned i = 0; i != NumArgs; ++i)
2235 if (NextIndex + 1 ==
Record.size() && PP.getPreprocessingRecord() &&
2240 unsigned Index = translatePreprocessedEntityIDToIndex(GlobalID);
2242 PreprocessingRecord::PPEntityID PPID =
2243 PPRec.getPPEntityID(Index,
true);
2245 PPRec.getPreprocessedEntity(PPID));
2247 PPRec.RegisterMacroDefinition(
Macro, PPDef);
2258 if (MacroTokens.empty()) {
2259 Error(
"unexpected number of macro tokens for a macro in AST file");
2265 MacroTokens = MacroTokens.drop_front();
2276 ReadModuleOffsetMap(M);
2278 unsigned ModuleFileIndex = LocalID >> 32;
2279 LocalID &= llvm::maskTrailingOnes<PreprocessedEntityID>(32);
2282 assert(MF &&
"malformed identifier ID encoding?");
2284 if (!ModuleFileIndex) {
2293HeaderFileInfoTrait::getFile(
const internal_key_type &Key) {
2296 return FileMgr.getOptionalFileRef(Key.Filename);
2300 return FileMgr.getOptionalFileRef(*Resolved);
2304 uint8_t buf[
sizeof(ikey.
Size) +
sizeof(ikey.
ModTime)];
2307 return llvm::xxh3_64bits(buf);
2328 return FEA && FEA == FEB;
2331std::pair<unsigned, unsigned>
2338 using namespace llvm::support;
2341 ikey.
Size = off_t(endian::readNext<uint64_t, llvm::endianness::little>(d));
2343 time_t(endian::readNext<uint64_t, llvm::endianness::little>(d));
2352 using namespace llvm::support;
2354 const unsigned char *End = d + DataLen;
2356 unsigned Flags = *d++;
2359 bool Included = (Flags >> 6) & 0x01;
2361 if ((FE = getFile(key)))
2364 Reader.getPreprocessor().getIncludedFiles().insert(*FE);
2367 HFI.
isImport |= (Flags >> 5) & 0x01;
2369 HFI.
DirInfo = (Flags >> 1) & 0x07;
2371 M, endian::readNext<IdentifierID, llvm::endianness::little>(d));
2373 assert((End - d) % 4 == 0 &&
2374 "Wrong data length in HeaderFileInfo deserialization");
2376 uint32_t LocalSMID =
2377 endian::readNext<uint32_t, llvm::endianness::little>(d);
2383 SubmoduleID GlobalSMID = Reader.getGlobalSubmoduleID(M, LocalSMID);
2384 Module *Mod = Reader.getSubmodule(GlobalSMID);
2386 Reader.getPreprocessor().getHeaderSearchInfo().getModuleMap();
2388 if (FE || (FE = getFile(key))) {
2391 ModMap.
addHeader(Mod, H, HeaderRole,
true);
2403 uint32_t MacroDirectivesOffset) {
2404 assert(NumCurrentElementsDeserializing > 0 &&
"Missing deserialization guard");
2405 PendingMacroIDs[II].push_back(PendingMacroInfo(M, MacroDirectivesOffset));
2412 for (
ModuleFile &I : llvm::reverse(ModuleMgr)) {
2413 BitstreamCursor &MacroCursor = I.MacroCursor;
2416 if (MacroCursor.getBitcodeBytes().empty())
2419 BitstreamCursor Cursor = MacroCursor;
2420 if (llvm::Error Err = Cursor.JumpToBit(I.MacroStartOffset)) {
2421 Error(std::move(Err));
2429 Error(MaybeE.takeError());
2432 llvm::BitstreamEntry E = MaybeE.get();
2435 case llvm::BitstreamEntry::SubBlock:
2436 case llvm::BitstreamEntry::Error:
2437 Error(
"malformed block record in AST file");
2439 case llvm::BitstreamEntry::EndBlock:
2442 case llvm::BitstreamEntry::Record: {
2446 Error(MaybeRecord.takeError());
2449 switch (MaybeRecord.get()) {
2476 class IdentifierLookupVisitor {
2479 unsigned PriorGeneration;
2480 unsigned &NumIdentifierLookups;
2481 unsigned &NumIdentifierLookupHits;
2485 IdentifierLookupVisitor(StringRef Name,
unsigned PriorGeneration,
2486 unsigned &NumIdentifierLookups,
2487 unsigned &NumIdentifierLookupHits)
2489 PriorGeneration(PriorGeneration),
2490 NumIdentifierLookups(NumIdentifierLookups),
2491 NumIdentifierLookupHits(NumIdentifierLookupHits) {}
2505 ++NumIdentifierLookups;
2506 ASTIdentifierLookupTable::iterator Pos =
2507 IdTable->find_hashed(Name, NameHash, &Trait);
2508 if (Pos == IdTable->end())
2514 ++NumIdentifierLookupHits;
2516 if (Trait.hasMoreInformationInDependencies()) {
2525 IdentifierInfo *getIdentifierInfo()
const {
return Found; }
2534 unsigned PriorGeneration = 0;
2536 PriorGeneration = IdentifierGeneration[&II];
2543 if (GlobalIndex->lookupIdentifier(II.
getName(), Hits)) {
2548 IdentifierLookupVisitor Visitor(II.
getName(), PriorGeneration,
2549 NumIdentifierLookups,
2550 NumIdentifierLookupHits);
2551 ModuleMgr.visit(Visitor, HitsPtr);
2568 uint64_t ModuleFileIndex =
Record[Idx++] << 32;
2569 uint64_t LocalIndex =
Record[Idx++];
2574 const PendingMacroInfo &PMInfo) {
2579 if (llvm::Error Err =
2581 Error(std::move(Err));
2585 struct ModuleMacroRecord {
2598 Cursor.advance(BitstreamCursor::AF_DontPopBlockAtEnd);
2600 Error(MaybeEntry.takeError());
2603 llvm::BitstreamEntry Entry = MaybeEntry.get();
2605 if (Entry.Kind != llvm::BitstreamEntry::Record) {
2606 Error(
"malformed block record in AST file");
2613 Error(MaybePP.takeError());
2621 ModuleMacros.push_back(ModuleMacroRecord());
2622 auto &Info = ModuleMacros.back();
2626 for (
int I = Idx, N =
Record.size(); I != N; ++I)
2632 Error(
"malformed block record in AST file");
2643 std::reverse(ModuleMacros.begin(), ModuleMacros.end());
2645 for (
auto &MMR : ModuleMacros) {
2647 for (
unsigned ModID : MMR.Overrides) {
2649 auto *
Macro = PP.getModuleMacro(Mod, II);
2650 assert(
Macro &&
"missing definition for overridden macro");
2651 Overrides.push_back(
Macro);
2654 bool Inserted =
false;
2656 PP.addModuleMacro(Owner, II, MMR.MI, Overrides, Inserted);
2667 unsigned Idx = 0, N =
Record.size();
2675 MD = PP.AllocateDefMacroDirective(MI, Loc);
2679 MD = PP.AllocateUndefMacroDirective(Loc);
2682 bool isPublic =
Record[Idx++];
2683 MD = PP.AllocateVisibilityMacroDirective(Loc, isPublic);
2695 PP.setLoadedMacroDirective(II, Earliest, Latest);
2698bool ASTReader::shouldDisableValidationForFile(
2721static std::pair<StringRef, StringRef>
2723 const StringRef InputBlob) {
2724 uint16_t AsRequestedLength =
Record[7];
2725 return {InputBlob.substr(0, AsRequestedLength),
2726 InputBlob.substr(AsRequestedLength)};
2740 SavedStreamPosition SavedPosition(Cursor);
2744 consumeError(std::move(Err));
2747 Expected<unsigned> MaybeCode =
Cursor.ReadCode();
2750 consumeError(MaybeCode.takeError());
2752 unsigned Code = MaybeCode.get();
2756 if (Expected<unsigned> Maybe =
Cursor.readRecord(Code,
Record, &Blob))
2758 "invalid record type for input file");
2761 consumeError(
Maybe.takeError());
2764 assert(
Record[0] == ID &&
"Bogus stored ID or offset");
2772 auto [UnresolvedFilenameAsRequested, UnresolvedFilename] =
2776 ? UnresolvedFilenameAsRequested
2777 : UnresolvedFilename;
2779 Expected<llvm::BitstreamEntry> MaybeEntry =
Cursor.advance();
2781 consumeError(MaybeEntry.takeError());
2782 llvm::BitstreamEntry Entry = MaybeEntry.get();
2783 assert(Entry.Kind == llvm::BitstreamEntry::Record &&
2784 "expected record type for input file hash");
2787 if (Expected<unsigned> Maybe =
Cursor.readRecord(Entry.ID,
Record))
2789 "invalid record type for input file hash");
2792 consumeError(
Maybe.takeError());
2817 SavedStreamPosition SavedPosition(Cursor);
2821 consumeError(std::move(Err));
2836 const HeaderSearchOptions &HSOpts =
2837 PP.getHeaderSearchInfo().getHeaderSearchOpts();
2850 if ((Overridden || Transient || SkipChecks) && !
File)
2855 std::string ErrorStr =
"could not find file '";
2856 ErrorStr += *Filename;
2857 ErrorStr +=
"' referenced by AST file '";
2871 SourceManager &
SM = getSourceManager();
2873 if ((!Overridden && !Transient) && !SkipChecks &&
2874 SM.isFileOverridden(*
File)) {
2876 Error(diag::err_fe_pch_file_overridden, *Filename);
2888 enum ModificationKind {
2894 std::optional<int64_t> Old = std::nullopt;
2895 std::optional<int64_t>
New = std::nullopt;
2897 auto HasInputContentChanged = [&](Change OriginalChange) {
2898 assert(ValidateASTInputFilesContent &&
2899 "We should only check the content of the inputs with "
2900 "ValidateASTInputFilesContent enabled.");
2902 if (StoredContentHash == 0)
2903 return OriginalChange;
2906 if (!MemBuffOrError) {
2908 return OriginalChange;
2909 std::string ErrorStr =
"could not get buffer for file '";
2910 ErrorStr +=
File->getName();
2913 return OriginalChange;
2916 auto ContentHash = xxh3_64bits(MemBuffOrError.get()->getBuffer());
2917 if (StoredContentHash ==
static_cast<uint64_t>(ContentHash))
2918 return Change{Change::None};
2920 return Change{Change::Content};
2922 auto HasInputFileChanged = [&]() {
2923 if (StoredSize !=
File->getSize())
2924 return Change{Change::Size, StoredSize,
File->getSize()};
2925 if (!shouldDisableValidationForFile(F) && StoredTime &&
2926 StoredTime !=
File->getModificationTime()) {
2927 Change MTimeChange = {Change::ModTime, StoredTime,
2928 File->getModificationTime()};
2932 if (ValidateASTInputFilesContent)
2933 return HasInputContentChanged(MTimeChange);
2937 return Change{Change::None};
2940 bool IsOutOfDate =
false;
2941 auto FileChange = SkipChecks ? Change{Change::None} : HasInputFileChanged();
2947 FileChange = HasInputContentChanged(FileChange);
2953 if (!StoredTime && ValidateASTInputFilesContent &&
2954 FileChange.Kind == Change::None)
2955 FileChange = HasInputContentChanged(FileChange);
2958 if (!Overridden && FileChange.Kind != Change::None) {
2961 SmallVector<ModuleFile *, 4> ImportStack(1, &F);
2962 while (!ImportStack.back()->ImportedBy.empty())
2963 ImportStack.push_back(ImportStack.back()->ImportedBy[0]);
2966 StringRef TopLevelASTFileName(ImportStack.back()->FileName);
2967 Diag(diag::err_fe_ast_file_modified)
2969 << TopLevelASTFileName << FileChange.Kind
2970 << (FileChange.Old && FileChange.New)
2971 << llvm::itostr(FileChange.Old.value_or(0))
2972 << llvm::itostr(FileChange.New.value_or(0));
2975 if (ImportStack.size() > 1) {
2976 Diag(diag::note_ast_file_required_by)
2977 << *Filename << ImportStack[0]->FileName;
2978 for (
unsigned I = 1; I < ImportStack.size(); ++I)
2979 Diag(diag::note_ast_file_required_by)
2980 << ImportStack[I - 1]->FileName << ImportStack[I]->FileName;
2983 Diag(diag::note_ast_file_rebuild_required) << TopLevelASTFileName;
2998ASTReader::TemporarilyOwnedStringRef
3004ASTReader::TemporarilyOwnedStringRef
3007 assert(Buf.capacity() != 0 &&
"Overlapping ResolveImportedPath calls");
3009 if (Prefix.empty() || Path.empty() || llvm::sys::path::is_absolute(Path) ||
3010 Path ==
"<built-in>" || Path ==
"<command line>")
3014 llvm::sys::path::append(Buf, Prefix, Path);
3015 StringRef ResolvedPath{Buf.data(), Buf.size()};
3016 return {ResolvedPath, Buf};
3029 return ResolvedPath->str();
3044 llvm_unreachable(
"unknown ASTReadResult");
3048 BitstreamCursor &Stream, StringRef Filename,
3049 unsigned ClientLoadCapabilities,
bool AllowCompatibleConfigurationMismatch,
3050 ASTReaderListener &Listener, std::string &SuggestedPredefines) {
3053 consumeError(std::move(Err));
3061 Expected<llvm::BitstreamEntry> MaybeEntry = Stream.advance();
3064 consumeError(MaybeEntry.takeError());
3067 llvm::BitstreamEntry Entry = MaybeEntry.get();
3069 switch (Entry.Kind) {
3070 case llvm::BitstreamEntry::Error:
3071 case llvm::BitstreamEntry::SubBlock:
3074 case llvm::BitstreamEntry::EndBlock:
3077 case llvm::BitstreamEntry::Record:
3084 Expected<unsigned> MaybeRecordType = Stream.readRecord(Entry.ID,
Record);
3085 if (!MaybeRecordType) {
3087 consumeError(MaybeRecordType.takeError());
3092 bool Complain = (ClientLoadCapabilities & ARR_ConfigurationMismatch) == 0;
3093 if (ParseLanguageOptions(
Record, Filename, Complain, Listener,
3094 AllowCompatibleConfigurationMismatch))
3095 Result = ConfigurationMismatch;
3100 bool Complain = (ClientLoadCapabilities & ARR_ConfigurationMismatch) == 0;
3101 if (ParseCodeGenOptions(
Record, Filename, Complain, Listener,
3102 AllowCompatibleConfigurationMismatch))
3103 Result = ConfigurationMismatch;
3108 bool Complain = (ClientLoadCapabilities & ARR_ConfigurationMismatch) == 0;
3109 if (ParseTargetOptions(
Record, Filename, Complain, Listener,
3110 AllowCompatibleConfigurationMismatch))
3111 Result = ConfigurationMismatch;
3116 bool Complain = (ClientLoadCapabilities & ARR_ConfigurationMismatch) == 0;
3117 if (!AllowCompatibleConfigurationMismatch &&
3118 ParseFileSystemOptions(
Record, Complain, Listener))
3119 Result = ConfigurationMismatch;
3124 bool Complain = (ClientLoadCapabilities & ARR_ConfigurationMismatch) == 0;
3125 if (!AllowCompatibleConfigurationMismatch &&
3126 ParseHeaderSearchOptions(
Record, Filename, Complain, Listener))
3127 Result = ConfigurationMismatch;
3132 bool Complain = (ClientLoadCapabilities & ARR_ConfigurationMismatch) == 0;
3133 if (!AllowCompatibleConfigurationMismatch &&
3134 ParsePreprocessorOptions(
Record, Filename, Complain, Listener,
3135 SuggestedPredefines))
3136 Result = ConfigurationMismatch;
3144 SmallVectorImpl<ImportedModule> &Loaded,
3146 unsigned ClientLoadCapabilities) {
3147 BitstreamCursor &Stream = F.
Stream;
3150 Error(std::move(Err));
3160 bool HasReadUnhashedControlBlock =
false;
3161 auto readUnhashedControlBlockOnce = [&]() {
3162 if (!HasReadUnhashedControlBlock) {
3163 HasReadUnhashedControlBlock =
true;
3164 if (ASTReadResult
Result =
3165 readUnhashedControlBlock(F, ImportedBy, ClientLoadCapabilities))
3171 bool DisableValidation = shouldDisableValidationForFile(F);
3175 unsigned NumInputs = 0;
3176 unsigned NumUserInputs = 0;
3177 StringRef BaseDirectoryAsWritten;
3179 Expected<llvm::BitstreamEntry> MaybeEntry = Stream.advance();
3181 Error(MaybeEntry.takeError());
3184 llvm::BitstreamEntry Entry = MaybeEntry.get();
3186 switch (Entry.Kind) {
3187 case llvm::BitstreamEntry::Error:
3188 Error(
"malformed block record in AST file");
3190 case llvm::BitstreamEntry::EndBlock: {
3193 if (ASTReadResult
Result = readUnhashedControlBlockOnce())
3197 const HeaderSearchOptions &HSOpts =
3198 PP.getHeaderSearchInfo().getHeaderSearchOpts();
3205 bool Complain = (ClientLoadCapabilities & ARR_OutOfDate) == 0;
3211 unsigned N = ValidateSystemInputs ? NumInputs : NumUserInputs;
3215 N = ForceValidateUserInputs ? NumUserInputs : 0;
3218 Diag(diag::remark_module_validation)
3221 for (
unsigned I = 0; I < N; ++I) {
3222 InputFile IF = getInputFile(F, I+1, Complain);
3234 for (
unsigned I = 0; I < N; ++I) {
3235 bool IsSystem = I >= NumUserInputs;
3237 auto FilenameAsRequested = ResolveImportedPath(
3240 *FilenameAsRequested, IsSystem, FI.
Overridden,
3248 case llvm::BitstreamEntry::SubBlock:
3252 if (llvm::Error Err = Stream.SkipBlock()) {
3253 Error(std::move(Err));
3257 Error(
"malformed block record in AST file");
3267 if (Listener && !ImportedBy) {
3273 bool AllowCompatibleConfigurationMismatch =
3277 ReadOptionsBlock(Stream, F.
FileName, ClientLoadCapabilities,
3278 AllowCompatibleConfigurationMismatch, *Listener,
3279 SuggestedPredefines);
3281 Error(
"malformed block record in AST file");
3285 if (DisableValidation ||
3286 (AllowConfigurationMismatch &&
Result == ConfigurationMismatch))
3294 }
else if (llvm::Error Err = Stream.SkipBlock()) {
3295 Error(std::move(Err));
3301 if (llvm::Error Err = Stream.SkipBlock()) {
3302 Error(std::move(Err));
3308 case llvm::BitstreamEntry::Record:
3316 Expected<unsigned> MaybeRecordType =
3317 Stream.readRecord(Entry.ID,
Record, &Blob);
3318 if (!MaybeRecordType) {
3319 Error(MaybeRecordType.takeError());
3325 if ((ClientLoadCapabilities & ARR_VersionMismatch) == 0)
3327 : diag::err_ast_file_version_too_new)
3332 bool hasErrors =
Record[7];
3333 if (hasErrors && !DisableValidation) {
3336 if ((ClientLoadCapabilities & ARR_TreatModuleWithErrorsAsOutOfDate) &&
3337 canRecoverFromOutOfDate(F.
FileName, ClientLoadCapabilities))
3340 if (!AllowASTWithCompilerErrors) {
3341 Diag(diag::err_ast_file_with_compiler_errors)
3347 Diags.ErrorOccurred =
true;
3348 Diags.UncompilableErrorOccurred =
true;
3349 Diags.UnrecoverableErrorOccurred =
true;
3362 StringRef ASTBranch = Blob;
3363 if (StringRef(CurBranch) != ASTBranch && !DisableValidation) {
3364 if ((ClientLoadCapabilities & ARR_VersionMismatch) == 0)
3365 Diag(diag::err_ast_file_different_branch)
3377 if (ASTReadResult
Result = readUnhashedControlBlockOnce())
3387 auto [ImportLoc, ImportModuleFileIndex] =
3388 ReadUntranslatedSourceLocation(
Record[Idx++]);
3390 assert(ImportModuleFileIndex == 0);
3392 StringRef ImportedName = ReadStringBlob(
Record, Idx, Blob);
3394 bool IsImportingStdCXXModule =
Record[Idx++];
3396 off_t StoredSize = 0;
3397 time_t StoredModTime = 0;
3398 ASTFileSignature StoredSignature;
3399 std::string ImportedFile;
3400 std::string StoredFile;
3401 bool IgnoreImportedByNote =
false;
3410 ImportedFile = PP.getHeaderSearchInfo().getPrebuiltModuleFileName(
3411 ImportedName, !IsImportingStdCXXModule);
3413 if (IsImportingStdCXXModule && ImportedFile.empty()) {
3414 Diag(diag::err_failed_to_find_module_file) << ImportedName;
3418 if (!IsImportingStdCXXModule) {
3419 StoredSize = (off_t)
Record[Idx++];
3420 StoredModTime = (time_t)
Record[Idx++];
3424 SignatureBytes.end());
3429 StoredFile = ReadPathBlob(BaseDirectoryAsWritten,
Record, Idx, Blob);
3430 if (ImportedFile.empty()) {
3431 ImportedFile = StoredFile;
3432 }
else if (!getDiags().isIgnored(
3433 diag::warn_module_file_mapping_mismatch,
3434 CurrentImportLoc)) {
3435 auto ImportedFileRef =
3436 PP.getFileManager().getOptionalFileRef(ImportedFile);
3437 auto StoredFileRef =
3438 PP.getFileManager().getOptionalFileRef(StoredFile);
3439 if ((ImportedFileRef && StoredFileRef) &&
3440 (*ImportedFileRef != *StoredFileRef)) {
3441 Diag(diag::warn_module_file_mapping_mismatch)
3442 << ImportedFile << StoredFile;
3443 Diag(diag::note_module_file_imported_by)
3445 IgnoreImportedByNote =
true;
3452 unsigned Capabilities = ClientLoadCapabilities;
3453 if ((ClientLoadCapabilities & ARR_OutOfDate) == 0)
3454 Capabilities &= ~ARR_Missing;
3457 auto Result = ReadASTCore(ImportedFile, ImportedKind, ImportLoc, &F,
3458 Loaded, StoredSize, StoredModTime,
3459 StoredSignature, Capabilities);
3464 if (IsImportingStdCXXModule) {
3465 if (
const auto *Imported =
3466 getModuleManager().lookupByFileName(ImportedFile);
3467 Imported !=
nullptr && Imported->ModuleName != ImportedName) {
3468 Diag(diag::err_failed_to_find_module_file) << ImportedName;
3474 bool recompilingFinalized =
Result == OutOfDate &&
3475 (Capabilities & ARR_OutOfDate) &&
3478 .getInMemoryModuleCache()
3480 if (!IgnoreImportedByNote &&
3482 Diag(diag::note_module_file_imported_by)
3486 case Failure:
return Failure;
3489 case OutOfDate:
return OutOfDate;
3491 case ConfigurationMismatch:
return ConfigurationMismatch;
3492 case HadErrors:
return HadErrors;
3511 Diag(diag::remark_module_import)
3513 << (ImportedBy ? StringRef(ImportedBy->
ModuleName) : StringRef());
3519 if (ASTReadResult
Result = readUnhashedControlBlockOnce())
3527 BaseDirectoryAsWritten = Blob;
3529 "MODULE_DIRECTORY found before MODULE_NAME");
3531 if (!PP.getPreprocessorOpts().ModulesCheckRelocated)
3535 Module *M = PP.getHeaderSearchInfo().lookupModule(
3542 if (!
bool(PP.getPreprocessorOpts().DisablePCHOrModuleValidation &
3545 auto BuildDir = PP.getFileManager().getOptionalDirectoryRef(Blob);
3546 if (!BuildDir || *BuildDir != M->
Directory) {
3547 if (!canRecoverFromOutOfDate(F.
FileName, ClientLoadCapabilities))
3548 Diag(diag::err_imported_module_relocated)
3559 if (ASTReadResult
Result =
3560 ReadModuleMapFileBlock(
Record, F, ImportedBy, ClientLoadCapabilities))
3566 NumUserInputs =
Record[1];
3568 (
const llvm::support::unaligned_uint64_t *)Blob.data();
3577llvm::Error ASTReader::ReadASTBlock(
ModuleFile &F,
3578 unsigned ClientLoadCapabilities) {
3579 BitstreamCursor &Stream = F.
Stream;
3581 if (llvm::Error Err = Stream.EnterSubBlock(
AST_BLOCK_ID))
3588 Expected<llvm::BitstreamEntry> MaybeEntry = Stream.advance();
3590 return MaybeEntry.takeError();
3591 llvm::BitstreamEntry Entry = MaybeEntry.get();
3593 switch (Entry.Kind) {
3594 case llvm::BitstreamEntry::Error:
3595 return llvm::createStringError(
3596 std::errc::illegal_byte_sequence,
3597 "error at end of module block in AST file");
3598 case llvm::BitstreamEntry::EndBlock:
3604 if (ASTContext *Ctx = ContextObj) {
3605 DeclContext *DC = Ctx->getTranslationUnitDecl();
3610 return llvm::Error::success();
3611 case llvm::BitstreamEntry::SubBlock:
3619 if (llvm::Error Err = Stream.SkipBlock())
3621 if (llvm::Error Err = ReadBlockAbbrevs(
3628 if (!PP.getExternalSource())
3629 PP.setExternalSource(
this);
3631 if (llvm::Error Err = Stream.SkipBlock())
3633 if (llvm::Error Err =
3642 if (llvm::Error Err = Stream.SkipBlock()) {
3651 if (!PP.getPreprocessingRecord())
3652 PP.createPreprocessingRecord();
3653 if (!PP.getPreprocessingRecord()->getExternalSource())
3654 PP.getPreprocessingRecord()->SetExternalSource(*
this);
3658 if (llvm::Error Err = ReadSourceManagerBlock(F))
3663 if (llvm::Error Err = ReadSubmoduleBlock(F, ClientLoadCapabilities))
3668 BitstreamCursor
C = Stream;
3670 if (llvm::Error Err = Stream.SkipBlock())
3674 CommentsCursors.push_back(std::make_pair(
C, &F));
3679 if (llvm::Error Err = Stream.SkipBlock())
3685 case llvm::BitstreamEntry::Record:
3693 Expected<unsigned> MaybeRecordType =
3694 Stream.readRecord(Entry.ID,
Record, &Blob);
3695 if (!MaybeRecordType)
3696 return MaybeRecordType.takeError();
3701 switch (RecordType) {
3722 switch (RecordType) {
3728 return llvm::createStringError(
3729 std::errc::illegal_byte_sequence,
3730 "duplicate TYPE_OFFSET record in AST file");
3743 return llvm::createStringError(
3744 std::errc::illegal_byte_sequence,
3745 "duplicate DECL_OFFSET record in AST file");
3757 DeclContext *TU = ContextObj->getTranslationUnitDecl();
3758 LexicalContents Contents(
3760 static_cast<unsigned int>(Blob.size() /
sizeof(
DeclID)));
3761 TULexicalDecls.push_back(std::make_pair(&F, Contents));
3768 GlobalDeclID
ID = ReadDeclID(F,
Record, Idx);
3769 auto *
Data = (
const unsigned char*)Blob.data();
3770 PendingVisibleUpdates[
ID].push_back(UpdateData{&F,
Data});
3773 if (Decl *D = GetExistingDecl(ID))
3774 PendingUpdateRecords.push_back(
3775 PendingUpdateRecord(ID, D,
false));
3781 GlobalDeclID
ID = ReadDeclID(F,
Record, Idx);
3782 auto *
Data = (
const unsigned char *)Blob.data();
3783 PendingModuleLocalVisibleUpdates[
ID].push_back(UpdateData{&F,
Data});
3786 if (Decl *D = GetExistingDecl(ID))
3787 PendingUpdateRecords.push_back(
3788 PendingUpdateRecord(ID, D,
false));
3796 GlobalDeclID
ID = ReadDeclID(F,
Record, Idx);
3797 auto *
Data = (
const unsigned char *)Blob.data();
3798 TULocalUpdates[
ID].push_back(UpdateData{&F,
Data});
3801 if (Decl *D = GetExistingDecl(ID))
3802 PendingUpdateRecords.push_back(
3803 PendingUpdateRecord(ID, D,
false));
3809 GlobalDeclID
ID = ReadDeclID(F,
Record, Idx);
3810 auto *
Data = (
const unsigned char *)Blob.data();
3811 PendingSpecializationsUpdates[
ID].push_back(UpdateData{&F,
Data});
3814 if (Decl *D = GetExistingDecl(ID))
3815 PendingUpdateRecords.push_back(
3816 PendingUpdateRecord(ID, D,
false));
3822 GlobalDeclID
ID = ReadDeclID(F,
Record, Idx);
3823 auto *
Data = (
const unsigned char *)Blob.data();
3824 PendingPartialSpecializationsUpdates[
ID].push_back(UpdateData{&F,
Data});
3827 if (Decl *D = GetExistingDecl(ID))
3828 PendingUpdateRecords.push_back(
3829 PendingUpdateRecord(ID, D,
false));
3835 reinterpret_cast<const unsigned char *
>(Blob.data());
3841 ASTIdentifierLookupTrait(*
this, F));
3843 PP.getIdentifierTable().setExternalIdentifierLookup(
this);
3849 return llvm::createStringError(
3850 std::errc::illegal_byte_sequence,
3851 "duplicate IDENTIFIER_OFFSET record in AST file");
3857 IdentifiersLoaded.resize(IdentifiersLoaded.size()
3869 for (
unsigned I = 0, N =
Record.size(); I != N; )
3870 EagerlyDeserializedDecls.push_back(ReadDeclID(F,
Record, I));
3877 getContext().getLangOpts().BuildingPCHWithObjectFile)
3878 for (
unsigned I = 0, N =
Record.size(); I != N; )
3879 EagerlyDeserializedDecls.push_back(ReadDeclID(F,
Record, I));
3883 if (SpecialTypes.empty()) {
3884 for (
unsigned I = 0, N =
Record.size(); I != N; ++I)
3885 SpecialTypes.push_back(getGlobalTypeID(F,
Record[I]));
3892 if (SpecialTypes.size() !=
Record.size())
3893 return llvm::createStringError(std::errc::illegal_byte_sequence,
3894 "invalid special-types record");
3896 for (
unsigned I = 0, N =
Record.size(); I != N; ++I) {
3898 if (!SpecialTypes[I])
3899 SpecialTypes[I] =
ID;
3906 TotalNumStatements +=
Record[0];
3907 TotalNumMacros +=
Record[1];
3908 TotalLexicalDeclContexts +=
Record[2];
3909 TotalVisibleDeclContexts +=
Record[3];
3910 TotalModuleLocalVisibleDeclContexts +=
Record[4];
3911 TotalTULocalVisibleDeclContexts +=
Record[5];
3915 for (
unsigned I = 0, N =
Record.size(); I != N; )
3916 UnusedFileScopedDecls.push_back(ReadDeclID(F,
Record, I));
3920 for (
unsigned I = 0, N =
Record.size(); I != N; )
3921 DelegatingCtorDecls.push_back(ReadDeclID(F,
Record, I));
3925 if (
Record.size() % 3 != 0)
3926 return llvm::createStringError(std::errc::illegal_byte_sequence,
3927 "invalid weak identifiers record");
3931 WeakUndeclaredIdentifiers.clear();
3934 for (
unsigned I = 0, N =
Record.size(); I < N; ) {
3935 WeakUndeclaredIdentifiers.push_back(
3936 getGlobalIdentifierID(F,
Record[I++]));
3937 WeakUndeclaredIdentifiers.push_back(
3938 getGlobalIdentifierID(F,
Record[I++]));
3939 WeakUndeclaredIdentifiers.push_back(
3940 ReadSourceLocation(F,
Record, I).getRawEncoding());
3947 unsigned LocalBaseSelectorID =
Record[1];
3953 GlobalSelectorMap.insert(std::make_pair(getTotalNumSelectors()+1, &F));
3958 std::make_pair(LocalBaseSelectorID,
3970 = ASTSelectorLookupTable::Create(
3973 ASTSelectorLookupTrait(*
this, F));
3974 TotalNumMethodPoolEntries +=
Record[1];
3979 for (
unsigned Idx = 0, N =
Record.size() - 1; Idx < N; ) {
3980 ReferencedSelectorsData.push_back(getGlobalSelectorID(F,
3982 ReferencedSelectorsData.push_back(ReadSourceLocation(F,
Record, Idx).
3991 PP.setPreambleRecordedPragmaAssumeNonNullLoc(
3992 ReadSourceLocation(F,
Record, Idx));
3998 SmallVector<SourceLocation, 64> SrcLocs;
4000 while (Idx <
Record.size())
4001 SrcLocs.push_back(ReadSourceLocation(F,
Record, Idx));
4002 PP.setDeserializedSafeBufferOptOutMap(SrcLocs);
4009 unsigned Idx = 0, End =
Record.size() - 1;
4010 bool ReachedEOFWhileSkipping =
Record[Idx++];
4011 std::optional<Preprocessor::PreambleSkipInfo> SkipInfo;
4012 if (ReachedEOFWhileSkipping) {
4013 SourceLocation HashToken = ReadSourceLocation(F,
Record, Idx);
4014 SourceLocation IfTokenLoc = ReadSourceLocation(F,
Record, Idx);
4015 bool FoundNonSkipPortion =
Record[Idx++];
4016 bool FoundElse =
Record[Idx++];
4017 SourceLocation ElseLoc = ReadSourceLocation(F,
Record, Idx);
4018 SkipInfo.emplace(HashToken, IfTokenLoc, FoundNonSkipPortion,
4019 FoundElse, ElseLoc);
4021 SmallVector<PPConditionalInfo, 4> ConditionalStack;
4023 auto Loc = ReadSourceLocation(F,
Record, Idx);
4024 bool WasSkipping =
Record[Idx++];
4025 bool FoundNonSkip =
Record[Idx++];
4026 bool FoundElse =
Record[Idx++];
4027 ConditionalStack.push_back(
4028 {Loc, WasSkipping, FoundNonSkip, FoundElse});
4030 PP.setReplayablePreambleConditionalStack(ConditionalStack, SkipInfo);
4035 if (!
Record.empty() && Listener)
4053 Diags.Report(SourceLocation(), diag::remark_sloc_usage);
4054 SourceMgr.noteSLocAddressSpaceUsage(Diags);
4055 return llvm::createStringError(std::errc::invalid_argument,
4056 "ran out of source locations");
4061 unsigned RangeStart =
4063 GlobalSLocEntryMap.insert(std::make_pair(RangeStart, &F));
4068 GlobalSLocOffsetMap.insert(
4070 - SLocSpaceSize,&F));
4081 ParseLineTable(F,
Record);
4085 for (
unsigned I = 0, N =
Record.size(); I != N; )
4086 ExtVectorDecls.push_back(ReadDeclID(F,
Record, I));
4090 if (
Record.size() % 3 != 0)
4091 return llvm::createStringError(std::errc::illegal_byte_sequence,
4092 "Invalid VTABLE_USES record");
4099 for (
unsigned Idx = 0, N =
Record.size(); Idx != N; ) {
4100 VTableUses.push_back(
4101 {ReadDeclID(F,
Record, Idx),
4102 ReadSourceLocation(F,
Record, Idx).getRawEncoding(),
4109 if (
Record.size() % 2 != 0)
4110 return llvm::createStringError(
4111 std::errc::illegal_byte_sequence,
4112 "Invalid PENDING_IMPLICIT_INSTANTIATIONS block");
4117 for (
unsigned I = 0, N =
Record.size(); I != N; ) {
4118 PendingInstantiations.push_back(
4119 {ReadDeclID(F,
Record, I),
4120 ReadSourceLocation(F,
Record, I).getRawEncoding()});
4127 return llvm::createStringError(std::errc::illegal_byte_sequence,
4128 "Invalid SEMA_DECL_REFS block");
4129 for (
unsigned I = 0, N =
Record.size(); I != N; )
4130 SemaDeclRefs.push_back(ReadDeclID(F,
Record, I));
4138 unsigned StartingID;
4139 if (!PP.getPreprocessingRecord())
4140 PP.createPreprocessingRecord();
4141 if (!PP.getPreprocessingRecord()->getExternalSource())
4142 PP.getPreprocessingRecord()->SetExternalSource(*
this);
4144 = PP.getPreprocessingRecord()
4151 GlobalPreprocessedEntityMap.insert(std::make_pair(StartingID, &F));
4162 if (!PP.getPreprocessingRecord())
4163 PP.createPreprocessingRecord();
4164 if (!PP.getPreprocessingRecord()->getExternalSource())
4165 PP.getPreprocessingRecord()->SetExternalSource(*
this);
4170 GlobalSkippedRangeMap.insert(
4176 if (
Record.size() % 2 != 0)
4177 return llvm::createStringError(
4178 std::errc::illegal_byte_sequence,
4179 "invalid DECL_UPDATE_OFFSETS block in AST file");
4180 for (
unsigned I = 0, N =
Record.size(); I != N; ) {
4181 GlobalDeclID
ID = ReadDeclID(F,
Record, I);
4182 DeclUpdateOffsets[
ID].push_back(std::make_pair(&F,
Record[I++]));
4186 if (Decl *D = GetExistingDecl(ID))
4187 PendingUpdateRecords.push_back(
4188 PendingUpdateRecord(ID, D,
false));
4193 if (
Record.size() % 5 != 0)
4194 return llvm::createStringError(
4195 std::errc::illegal_byte_sequence,
4196 "invalid DELAYED_NAMESPACE_LEXICAL_VISIBLE_RECORD block in AST "
4198 for (
unsigned I = 0, N =
Record.size(); I != N; ) {
4199 GlobalDeclID
ID = ReadDeclID(F,
Record, I);
4202 assert(BaseOffset &&
"Invalid DeclsBlockStartOffset for module file!");
4205 LocalLexicalOffset ? BaseOffset + LocalLexicalOffset : 0;
4208 LocalVisibleOffset ? BaseOffset + LocalVisibleOffset : 0;
4211 LocalModuleLocalOffset ? BaseOffset + LocalModuleLocalOffset : 0;
4214 TULocalLocalOffset ? BaseOffset + TULocalLocalOffset : 0;
4216 DelayedNamespaceOffsetMap[
ID] = {
4217 {VisibleOffset, ModuleLocalOffset, TULocalOffset}, LexicalOffset};
4219 assert(!GetExistingDecl(ID) &&
4220 "We shouldn't load the namespace in the front of delayed "
4221 "namespace lexical and visible block");
4227 for (
unsigned I = 0, N =
Record.size(); I != N; ) {
4228 GlobalDeclID
ID = ReadDeclID(F,
Record, I);
4229 auto &RelatedDecls = RelatedDeclsMap[
ID];
4230 unsigned NN =
Record[I++];
4231 RelatedDecls.reserve(NN);
4232 for (
unsigned II = 0; II < NN; II++)
4233 RelatedDecls.push_back(ReadDeclID(F,
Record, I));
4239 return llvm::createStringError(
4240 std::errc::illegal_byte_sequence,
4241 "duplicate OBJC_CATEGORIES_MAP record in AST file");
4254 CUDASpecialDeclRefs.clear();
4255 for (
unsigned I = 0, N =
Record.size(); I != N; )
4256 CUDASpecialDeclRefs.push_back(ReadDeclID(F,
Record, I));
4266 HeaderFileInfoTrait(*
this, F));
4268 PP.getHeaderSearchInfo().SetExternalSource(
this);
4269 if (!PP.getHeaderSearchInfo().getExternalLookup())
4270 PP.getHeaderSearchInfo().SetExternalLookup(
this);
4276 FPPragmaOptions.swap(
Record);
4280 for (
unsigned I = 0, N =
Record.size(); I != N; )
4281 DeclsWithEffectsToVerify.push_back(ReadDeclID(F,
Record, I));
4285 for (
unsigned I = 0, E =
Record.size(); I != E; ) {
4286 auto Name = ReadString(
Record, I);
4287 auto &OptInfo = OpenCLExtensions.OptMap[Name];
4288 OptInfo.Supported =
Record[I++] != 0;
4289 OptInfo.Enabled =
Record[I++] != 0;
4290 OptInfo.WithPragma =
Record[I++] != 0;
4291 OptInfo.Avail =
Record[I++];
4292 OptInfo.Core =
Record[I++];
4293 OptInfo.Opt =
Record[I++];
4298 for (
unsigned I = 0, N =
Record.size(); I != N; )
4299 TentativeDefinitions.push_back(ReadDeclID(F,
Record, I));
4303 for (
unsigned I = 0, N =
Record.size(); I != N; )
4304 KnownNamespaces.push_back(ReadDeclID(F,
Record, I));
4308 if (
Record.size() % 2 != 0)
4309 return llvm::createStringError(std::errc::illegal_byte_sequence,
4310 "invalid undefined-but-used record");
4311 for (
unsigned I = 0, N =
Record.size(); I != N; ) {
4312 UndefinedButUsed.push_back(
4313 {ReadDeclID(F,
Record, I),
4314 ReadSourceLocation(F,
Record, I).getRawEncoding()});
4319 for (
unsigned I = 0, N =
Record.size(); I != N;) {
4320 DelayedDeleteExprs.push_back(ReadDeclID(F,
Record, I).getRawValue());
4322 DelayedDeleteExprs.push_back(Count);
4323 for (uint64_t
C = 0;
C < Count; ++
C) {
4324 DelayedDeleteExprs.push_back(ReadSourceLocation(F,
Record, I).getRawEncoding());
4325 bool IsArrayForm =
Record[I++] == 1;
4326 DelayedDeleteExprs.push_back(IsArrayForm);
4333 getContext().getLangOpts().BuildingPCHWithObjectFile)
4334 for (
unsigned I = 0, N =
Record.size(); I != N;)
4335 VTablesToEmit.push_back(ReadDeclID(F,
Record, I));
4343 for (
unsigned I = 0, N =
Record.size(); I != N; ) {
4344 unsigned GlobalID = getGlobalSubmoduleID(F,
Record[I++]);
4345 SourceLocation Loc = ReadSourceLocation(F,
Record, I);
4347 PendingImportedModules.push_back(ImportedSubmodule(GlobalID, Loc));
4348 if (DeserializationListener)
4349 DeserializationListener->ModuleImportRead(GlobalID, Loc);
4357 return llvm::createStringError(
4358 std::errc::illegal_byte_sequence,
4359 "duplicate MACRO_OFFSET record in AST file");
4371 LateParsedTemplates.emplace_back(
4372 std::piecewise_construct, std::forward_as_tuple(&F),
4378 return llvm::createStringError(std::errc::illegal_byte_sequence,
4379 "invalid pragma optimize record");
4380 OptimizeOffPragmaLocation = ReadSourceLocation(F,
Record[0]);
4385 return llvm::createStringError(std::errc::illegal_byte_sequence,
4386 "invalid pragma ms_struct record");
4387 PragmaMSStructState =
Record[0];
4392 return llvm::createStringError(
4393 std::errc::illegal_byte_sequence,
4394 "invalid pragma pointers to members record");
4395 PragmaMSPointersToMembersState =
Record[0];
4396 PointersToMembersPragmaLocation = ReadSourceLocation(F,
Record[1]);
4400 for (
unsigned I = 0, N =
Record.size(); I != N; )
4401 UnusedLocalTypedefNameCandidates.push_back(ReadDeclID(F,
Record, I));
4406 return llvm::createStringError(std::errc::illegal_byte_sequence,
4407 "invalid cuda pragma options record");
4408 ForceHostDeviceDepth =
Record[0];
4413 return llvm::createStringError(std::errc::illegal_byte_sequence,
4414 "invalid pragma pack record");
4415 PragmaAlignPackCurrentValue = ReadAlignPackInfo(
Record[0]);
4416 PragmaAlignPackCurrentLocation = ReadSourceLocation(F,
Record[1]);
4417 unsigned NumStackEntries =
Record[2];
4420 PragmaAlignPackStack.clear();
4421 for (
unsigned I = 0; I < NumStackEntries; ++I) {
4422 PragmaAlignPackStackEntry Entry;
4423 Entry.Value = ReadAlignPackInfo(
Record[Idx++]);
4424 Entry.Location = ReadSourceLocation(F,
Record[Idx++]);
4425 Entry.PushLocation = ReadSourceLocation(F,
Record[Idx++]);
4426 PragmaAlignPackStrings.push_back(ReadString(
Record, Idx));
4427 Entry.SlotLabel = PragmaAlignPackStrings.back();
4428 PragmaAlignPackStack.push_back(Entry);
4435 return llvm::createStringError(std::errc::illegal_byte_sequence,
4436 "invalid pragma float control record");
4438 FpPragmaCurrentLocation = ReadSourceLocation(F,
Record[1]);
4439 unsigned NumStackEntries =
Record[2];
4442 FpPragmaStack.clear();
4443 for (
unsigned I = 0; I < NumStackEntries; ++I) {
4444 FpPragmaStackEntry Entry;
4446 Entry.Location = ReadSourceLocation(F,
Record[Idx++]);
4447 Entry.PushLocation = ReadSourceLocation(F,
Record[Idx++]);
4448 FpPragmaStrings.push_back(ReadString(
Record, Idx));
4449 Entry.SlotLabel = FpPragmaStrings.back();
4450 FpPragmaStack.push_back(Entry);
4456 for (
unsigned I = 0, N =
Record.size(); I != N; )
4457 DeclsToCheckForDeferredDiags.insert(ReadDeclID(F,
Record, I));
4461 unsigned NumRecords =
Record.front();
4463 if (
Record.size() - 1 != NumRecords)
4464 return llvm::createStringError(std::errc::illegal_byte_sequence,
4465 "invalid rvv intrinsic pragma record");
4467 if (RISCVVecIntrinsicPragma.empty())
4468 RISCVVecIntrinsicPragma.append(NumRecords, 0);
4471 for (
unsigned i = 0; i < NumRecords; ++i)
4472 RISCVVecIntrinsicPragma[i] |=
Record[i + 1];
4479void ASTReader::ReadModuleOffsetMap(
ModuleFile &F)
const {
4492 assert(ImportedModuleVector.empty());
4494 while (
Data < DataEnd) {
4498 using namespace llvm::support;
4500 endian::readNext<uint8_t, llvm::endianness::little>(
Data));
4501 uint16_t Len = endian::readNext<uint16_t, llvm::endianness::little>(
Data);
4502 StringRef Name = StringRef((
const char*)
Data, Len);
4506 ? ModuleMgr.lookupByModuleName(Name)
4507 : ModuleMgr.lookupByFileName(Name));
4509 std::string Msg =
"refers to unknown module, cannot find ";
4510 Msg.append(std::string(Name));
4515 ImportedModuleVector.push_back(OM);
4518 endian::readNext<uint32_t, llvm::endianness::little>(
Data);
4520 endian::readNext<uint32_t, llvm::endianness::little>(
Data);
4523 RemapBuilder &Remap) {
4524 constexpr uint32_t None = std::numeric_limits<uint32_t>::max();
4526 Remap.insert(std::make_pair(Offset,
4527 static_cast<int>(BaseOffset - Offset)));
4538 unsigned ClientLoadCapabilities) {
4547 "MODULE_NAME should come before MODULE_MAP_FILE");
4548 if (PP.getPreprocessorOpts().ModulesCheckRelocated &&
4554 auto &Map = PP.getHeaderSearchInfo().getModuleMap();
4556 M ? Map.getModuleMapFileForUniquing(M) : std::nullopt;
4558 if (!
bool(PP.getPreprocessorOpts().DisablePCHOrModuleValidation &
4561 if (!canRecoverFromOutOfDate(F.
FileName, ClientLoadCapabilities)) {
4562 if (
auto ASTFE = M ? M->
getASTFile() : std::nullopt) {
4565 << ASTFE->getName();
4569 Diag(diag::err_imported_module_not_found)
4576 if (ImportedBy && ImportedBy->
Kind ==
MK_PCH)
4577 Diag(diag::note_imported_by_pch_module_not_found)
4584 assert(M && M->
Name == F.
ModuleName &&
"found module with different name");
4588 if (!StoredModMap || *StoredModMap != ModMap) {
4589 assert(ModMap &&
"found module is missing module map file");
4591 "top-level import should be verified");
4593 if (!canRecoverFromOutOfDate(F.
FileName, ClientLoadCapabilities))
4594 Diag(diag::err_imported_module_modmap_changed)
4601 for (
unsigned I = 0, N =
Record[Idx++]; I < N; ++I) {
4603 std::string Filename = ReadPath(F,
Record, Idx);
4606 if (!canRecoverFromOutOfDate(F.
FileName, ClientLoadCapabilities))
4607 Error(
"could not find file '" + Filename +
"' referenced by AST file");
4610 AdditionalStoredMaps.insert(*SF);
4615 if (
auto *AdditionalModuleMaps = Map.getAdditionalModuleMapFiles(M)) {
4616 for (FileEntryRef ModMap : *AdditionalModuleMaps) {
4619 if (!AdditionalStoredMaps.erase(ModMap)) {
4620 if (!canRecoverFromOutOfDate(F.
FileName, ClientLoadCapabilities))
4621 Diag(diag::err_module_different_modmap)
4630 for (FileEntryRef ModMap : AdditionalStoredMaps) {
4631 if (!canRecoverFromOutOfDate(F.
FileName, ClientLoadCapabilities))
4632 Diag(diag::err_module_different_modmap)
4646 SemaObjC::GlobalMethodPool::iterator Known =
4652 ObjCMethodList &Start = Method->isInstanceMethod()? Known->second.first
4653 : Known->second.second;
4657 if (List->getMethod() == Method) {
4665 if (List->getNext())
4666 List->setMethod(List->getNext()->getMethod());
4668 List->setMethod(Method);
4674 for (
Decl *D : Names) {
4678 if (wasHidden && SemaObj) {
4691 Stack.push_back(Mod);
4692 while (!Stack.empty()) {
4693 Mod = Stack.pop_back_val();
4695 if (NameVisibility <= Mod->NameVisibility) {
4711 HiddenNamesMapType::iterator Hidden = HiddenNamesMap.find(Mod);
4712 if (Hidden != HiddenNamesMap.end()) {
4713 auto HiddenNames = std::move(*Hidden);
4714 HiddenNamesMap.erase(Hidden);
4716 assert(!HiddenNamesMap.contains(Mod) &&
4717 "making names visible added hidden names");
4724 I = Exports.begin(), E = Exports.end(); I != E; ++I) {
4726 if (Visited.insert(Exported).second)
4727 Stack.push_back(Exported);
4745 PendingMergedDefinitionsToDeduplicate.insert(Def);
4754 if (TriedLoadingGlobalIndex || !UseGlobalIndex ||
4755 !PP.getLangOpts().Modules)
4759 TriedLoadingGlobalIndex =
true;
4760 StringRef ModuleCachePath
4762 std::pair<GlobalModuleIndex *, llvm::Error>
Result =
4764 if (llvm::Error Err = std::move(
Result.second)) {
4766 consumeError(std::move(Err));
4770 GlobalIndex.reset(
Result.first);
4771 ModuleMgr.setGlobalIndex(GlobalIndex.get());
4776 return PP.getLangOpts().Modules && UseGlobalIndex &&
4788 consumeError(MaybeEntry.takeError());
4791 llvm::BitstreamEntry Entry = MaybeEntry.get();
4793 switch (Entry.Kind) {
4794 case llvm::BitstreamEntry::Error:
4795 case llvm::BitstreamEntry::EndBlock:
4798 case llvm::BitstreamEntry::Record:
4804 consumeError(Skipped.takeError());
4808 case llvm::BitstreamEntry::SubBlock:
4809 if (Entry.ID == BlockID) {
4810 if (llvm::Error Err = Cursor.EnterSubBlock(BlockID)) {
4812 consumeError(std::move(Err));
4819 if (llvm::Error Err = Cursor.SkipBlock()) {
4821 consumeError(std::move(Err));
4830 unsigned ClientLoadCapabilities,
4832 llvm::TimeTraceScope scope(
"ReadAST",
FileName);
4836 CurrentDeserializingModuleKind,
Type);
4842 unsigned PreviousGeneration = 0;
4846 unsigned NumModules = ModuleMgr.size();
4851 ClientLoadCapabilities)) {
4852 ModuleMgr.removeModules(ModuleMgr.begin() + NumModules);
4856 GlobalIndex.reset();
4857 ModuleMgr.setGlobalIndex(
nullptr);
4861 if (NewLoadedModuleFile && !Loaded.empty())
4862 *NewLoadedModuleFile = Loaded.back().Mod;
4873 for (ImportedModule &M : Loaded) {
4875 llvm::TimeTraceScope Scope2(
"Read Loaded AST", F.
ModuleName);
4878 if (llvm::Error Err = ReadASTBlock(F, ClientLoadCapabilities)) {
4879 Error(std::move(Err));
4885 Error(diag::err_module_file_missing_top_level_submodule, F.
FileName);
4891 if (llvm::Error Err = ReadExtensionBlock(F)) {
4892 Error(std::move(Err));
4905 for (ImportedModule &M : Loaded) {
4921 if (!PP.getLangOpts().CPlusPlus) {
4928 auto It = PP.getIdentifierTable().find(Key);
4929 if (It == PP.getIdentifierTable().end())
4938 II = &PP.getIdentifierTable().getOwn(Key);
4956 for (
auto &Id : PP.getIdentifierTable())
4957 Id.second->setOutOfDate(
true);
4960 for (
const auto &Sel : SelectorGeneration)
4961 SelectorOutOfDate[Sel.first] =
true;
4965 for (ImportedModule &M : Loaded) {
4968 ModuleMgr.moduleFileAccepted(&F);
4981 for (
unsigned I = 0, N = UnresolvedModuleRefs.size(); I != N; ++I) {
4982 UnresolvedModuleRef &
Unresolved = UnresolvedModuleRefs[I];
4987 case UnresolvedModuleRef::Conflict:
4990 Conflict.
Other = ResolvedMod;
4992 Unresolved.Mod->Conflicts.push_back(Conflict);
4996 case UnresolvedModuleRef::Import:
5001 case UnresolvedModuleRef::Affecting:
5003 Unresolved.Mod->AffectingClangModules.insert(ResolvedMod);
5006 case UnresolvedModuleRef::Export:
5013 UnresolvedModuleRefs.clear();
5025 if (DeserializationListener)
5026 DeserializationListener->ReaderInitialized(
this);
5028 ModuleFile &PrimaryModule = ModuleMgr.getPrimaryModule();
5043 for (
unsigned I = 0, N = ObjCClassesLoaded.size(); I != N; ++I) {
5044 loadObjCCategories(ObjCClassesLoaded[I]->getGlobalID(),
5045 ObjCClassesLoaded[I], PreviousGeneration);
5050 PP.getHeaderSearchInfo().getHeaderSearchOpts();
5055 for (
unsigned I = 0, N = Loaded.size(); I != N; ++I) {
5056 ImportedModule &M = Loaded[I];
5074 if (!Stream.canSkipToPos(4))
5075 return llvm::createStringError(
5076 std::errc::illegal_byte_sequence,
5077 "file too small to contain precompiled file magic");
5078 for (
unsigned C : {
'C',
'P',
'C',
'H'})
5081 return llvm::createStringError(
5082 std::errc::illegal_byte_sequence,
5083 "file doesn't start with precompiled file magic");
5085 return Res.takeError();
5086 return llvm::Error::success();
5101 llvm_unreachable(
"unknown module kind");
5105ASTReader::ReadASTCore(StringRef
FileName,
5107 SourceLocation ImportLoc,
5109 SmallVectorImpl<ImportedModule> &Loaded,
5110 off_t ExpectedSize, time_t ExpectedModTime,
5111 ASTFileSignature ExpectedSignature,
5112 unsigned ClientLoadCapabilities) {
5114 std::string ErrorStr;
5116 = ModuleMgr.addModule(
FileName,
Type, ImportLoc, ImportedBy,
5117 getGeneration(), ExpectedSize, ExpectedModTime,
5121 switch (AddResult) {
5123 Diag(diag::remark_module_import)
5125 << (ImportedBy ? StringRef(ImportedBy->
ModuleName) : StringRef());
5135 if (ClientLoadCapabilities & ARR_Missing)
5139 Diag(diag::err_ast_file_not_found)
5147 if (ClientLoadCapabilities & ARR_OutOfDate)
5151 Diag(diag::err_ast_file_out_of_date)
5157 assert(M &&
"Missing module file");
5159 bool ShouldFinalizePCM =
false;
5160 llvm::scope_exit FinalizeOrDropPCM([&]() {
5161 auto &MC = getModuleManager().getModuleCache().getInMemoryModuleCache();
5162 if (ShouldFinalizePCM)
5168 BitstreamCursor &Stream = F.Stream;
5169 Stream = BitstreamCursor(PCHContainerRdr.ExtractPCH(*F.Buffer));
5170 F.SizeInBits = F.Buffer->getBufferSize() * 8;
5174 Diag(diag::err_ast_file_invalid)
5180 bool HaveReadControlBlock =
false;
5182 Expected<llvm::BitstreamEntry> MaybeEntry = Stream.advance();
5184 Error(MaybeEntry.takeError());
5187 llvm::BitstreamEntry Entry = MaybeEntry.get();
5189 switch (Entry.Kind) {
5190 case llvm::BitstreamEntry::Error:
5191 case llvm::BitstreamEntry::Record:
5192 case llvm::BitstreamEntry::EndBlock:
5193 Error(
"invalid record at top-level of AST file");
5196 case llvm::BitstreamEntry::SubBlock:
5202 HaveReadControlBlock =
true;
5203 switch (ReadControlBlock(F, Loaded, ImportedBy, ClientLoadCapabilities)) {
5211 F.ModuleName.empty()) {
5213 if (
Result != OutOfDate ||
5214 (ClientLoadCapabilities & ARR_OutOfDate) == 0)
5220 case Failure:
return Failure;
5221 case Missing:
return Missing;
5222 case OutOfDate:
return OutOfDate;
5224 case ConfigurationMismatch:
return ConfigurationMismatch;
5225 case HadErrors:
return HadErrors;
5230 if (!HaveReadControlBlock) {
5231 if ((ClientLoadCapabilities & ARR_VersionMismatch) == 0)
5232 Diag(diag::err_ast_file_version_too_old)
5238 Loaded.push_back(ImportedModule(M, ImportedBy, ImportLoc));
5239 ShouldFinalizePCM =
true;
5243 if (llvm::Error Err = Stream.SkipBlock()) {
5244 Error(std::move(Err));
5251 llvm_unreachable(
"unexpected break; expected return");
5255ASTReader::readUnhashedControlBlock(
ModuleFile &F,
bool WasImportedBy,
5256 unsigned ClientLoadCapabilities) {
5257 const HeaderSearchOptions &HSOpts =
5258 PP.getHeaderSearchInfo().getHeaderSearchOpts();
5259 bool AllowCompatibleConfigurationMismatch =
5261 bool DisableValidation = shouldDisableValidationForFile(F);
5263 ASTReadResult
Result = readUnhashedControlBlockImpl(
5265 AllowCompatibleConfigurationMismatch, Listener.get(),
5270 if (DisableValidation || WasImportedBy ||
5271 (AllowConfigurationMismatch &&
Result == ConfigurationMismatch))
5275 Error(
"malformed block record in AST file");
5298 if (getModuleManager().getModuleCache().getInMemoryModuleCache().isPCMFinal(
5300 Diag(diag::warn_module_system_bit_conflict) << F.
FileName;
5309 ModuleFile *F, llvm::StringRef StreamData, StringRef Filename,
5310 unsigned ClientLoadCapabilities,
bool AllowCompatibleConfigurationMismatch,
5311 ASTReaderListener *Listener,
bool ValidateDiagnosticOptions) {
5313 BitstreamCursor Stream(StreamData);
5318 consumeError(std::move(Err));
5330 Expected<llvm::BitstreamEntry> MaybeEntry = Stream.advance();
5333 consumeError(MaybeEntry.takeError());
5336 llvm::BitstreamEntry Entry = MaybeEntry.get();
5338 switch (Entry.Kind) {
5339 case llvm::BitstreamEntry::Error:
5340 case llvm::BitstreamEntry::SubBlock:
5343 case llvm::BitstreamEntry::EndBlock:
5346 case llvm::BitstreamEntry::Record:
5354 Expected<unsigned> MaybeRecordType =
5355 Stream.readRecord(Entry.ID,
Record, &Blob);
5356 if (!MaybeRecordType) {
5365 "Dummy AST file signature not backpatched in ASTWriter.");
5372 "Dummy AST block hash not backpatched in ASTWriter.");
5376 bool Complain = (ClientLoadCapabilities & ARR_OutOfDate) == 0;
5377 if (Listener && ValidateDiagnosticOptions &&
5378 !AllowCompatibleConfigurationMismatch &&
5379 ParseDiagnosticOptions(
Record, Filename, Complain, *Listener))
5384 bool Complain = (ClientLoadCapabilities & ARR_ConfigurationMismatch) == 0;
5385 if (Listener && !AllowCompatibleConfigurationMismatch &&
5386 ParseHeaderSearchPaths(
Record, Complain, *Listener))
5387 Result = ConfigurationMismatch;
5416 if (
Record.size() < 4)
return true;
5421 unsigned BlockNameLen =
Record[2];
5422 unsigned UserInfoLen =
Record[3];
5424 if (BlockNameLen + UserInfoLen > Blob.size())
return true;
5426 Metadata.
BlockName = std::string(Blob.data(), Blob.data() + BlockNameLen);
5427 Metadata.
UserInfo = std::string(Blob.data() + BlockNameLen,
5428 Blob.data() + BlockNameLen + UserInfoLen);
5432llvm::Error ASTReader::ReadExtensionBlock(
ModuleFile &F) {
5433 BitstreamCursor &Stream = F.
Stream;
5437 Expected<llvm::BitstreamEntry> MaybeEntry = Stream.advance();
5439 return MaybeEntry.takeError();
5440 llvm::BitstreamEntry Entry = MaybeEntry.get();
5442 switch (Entry.Kind) {
5443 case llvm::BitstreamEntry::SubBlock:
5444 if (llvm::Error Err = Stream.SkipBlock())
5447 case llvm::BitstreamEntry::EndBlock:
5448 return llvm::Error::success();
5449 case llvm::BitstreamEntry::Error:
5450 return llvm::createStringError(std::errc::illegal_byte_sequence,
5451 "malformed block record in AST file");
5452 case llvm::BitstreamEntry::Record:
5458 Expected<unsigned> MaybeRecCode =
5459 Stream.readRecord(Entry.ID,
Record, &Blob);
5461 return MaybeRecCode.takeError();
5462 switch (MaybeRecCode.get()) {
5464 ModuleFileExtensionMetadata Metadata;
5466 return llvm::createStringError(
5467 std::errc::illegal_byte_sequence,
5468 "malformed EXTENSION_METADATA in AST file");
5471 auto Known = ModuleFileExtensions.find(Metadata.
BlockName);
5472 if (Known == ModuleFileExtensions.end())
break;
5475 if (
auto Reader = Known->second->createExtensionReader(Metadata, *
this,
5485 llvm_unreachable(
"ReadExtensionBlock should return from while loop");
5489 assert(ContextObj &&
"no context to initialize");
5493 if (DeserializationListener)
5494 DeserializationListener->DeclRead(
5496 Context.getTranslationUnitDecl());
5504 if (!Context.CFConstantStringTypeDecl)
5505 Context.setCFConstantStringType(
GetType(String));
5510 if (FileType.isNull()) {
5511 Error(
"FILE type is NULL");
5515 if (!Context.FILEDecl) {
5517 Context.setFILEDecl(
Typedef->getDecl());
5519 const TagType *Tag = FileType->getAs<TagType>();
5521 Error(
"Invalid FILE type in AST file");
5524 Context.setFILEDecl(Tag->getDecl());
5531 if (Jmp_bufType.
isNull()) {
5532 Error(
"jmp_buf type is NULL");
5536 if (!Context.jmp_bufDecl) {
5538 Context.setjmp_bufDecl(
Typedef->getDecl());
5540 const TagType *Tag = Jmp_bufType->
getAs<TagType>();
5542 Error(
"Invalid jmp_buf type in AST file");
5545 Context.setjmp_bufDecl(Tag->getDecl());
5552 if (Sigjmp_bufType.
isNull()) {
5553 Error(
"sigjmp_buf type is NULL");
5557 if (!Context.sigjmp_bufDecl) {
5559 Context.setsigjmp_bufDecl(
Typedef->getDecl());
5561 const TagType *Tag = Sigjmp_bufType->
getAs<TagType>();
5562 assert(Tag &&
"Invalid sigjmp_buf type in AST file");
5563 Context.setsigjmp_bufDecl(Tag->getDecl());
5569 if (Context.ObjCIdRedefinitionType.isNull())
5570 Context.ObjCIdRedefinitionType =
GetType(ObjCIdRedef);
5573 if (
TypeID ObjCClassRedef =
5575 if (Context.ObjCClassRedefinitionType.isNull())
5576 Context.ObjCClassRedefinitionType =
GetType(ObjCClassRedef);
5579 if (
TypeID ObjCSelRedef =
5581 if (Context.ObjCSelRedefinitionType.isNull())
5582 Context.ObjCSelRedefinitionType =
GetType(ObjCSelRedef);
5587 if (Ucontext_tType.
isNull()) {
5588 Error(
"ucontext_t type is NULL");
5592 if (!Context.ucontext_tDecl) {
5594 Context.setucontext_tDecl(
Typedef->getDecl());
5596 const TagType *Tag = Ucontext_tType->
getAs<TagType>();
5597 assert(Tag &&
"Invalid ucontext_t type in AST file");
5598 Context.setucontext_tDecl(Tag->getDecl());
5607 if (!CUDASpecialDeclRefs.empty()) {
5608 assert(CUDASpecialDeclRefs.size() == 3 &&
"More decl refs than expected!");
5609 Context.setcudaConfigureCallDecl(
5610 cast_or_null<FunctionDecl>(
GetDecl(CUDASpecialDeclRefs[0])));
5611 Context.setcudaGetParameterBufferDecl(
5612 cast_or_null<FunctionDecl>(
GetDecl(CUDASpecialDeclRefs[1])));
5613 Context.setcudaLaunchDeviceDecl(
5614 cast_or_null<FunctionDecl>(
GetDecl(CUDASpecialDeclRefs[2])));
5619 for (
auto &Import : PendingImportedModules) {
5623 if (Import.ImportLoc.isValid())
5624 PP.makeModuleVisible(Imported, Import.ImportLoc);
5631 PendingImportedModulesSema.append(PendingImportedModules);
5632 PendingImportedModules.clear();
5642 BitstreamCursor Stream(
PCH);
5645 consumeError(std::move(Err));
5657 Stream.advanceSkippingSubblocks();
5660 consumeError(MaybeEntry.takeError());
5663 llvm::BitstreamEntry Entry = MaybeEntry.get();
5665 if (Entry.Kind != llvm::BitstreamEntry::Record)
5673 consumeError(MaybeRecord.takeError());
5679 "Dummy AST file signature not backpatched in ASTWriter.");
5689 const std::string &ASTFileName,
FileManager &FileMgr,
5692 auto Buffer = FileMgr.getBufferForFile(ASTFileName,
false,
5697 Diags.Report(diag::err_fe_unable_to_read_pch_file)
5698 << ASTFileName << Buffer.getError().message();
5699 return std::string();
5703 BitstreamCursor Stream(PCHContainerRdr.ExtractPCH(**Buffer));
5707 Diags.Report(diag::err_fe_not_a_pch_file) << ASTFileName << std::move(Err);
5708 return std::string();
5713 Diags.Report(diag::err_fe_pch_malformed_block) << ASTFileName;
5714 return std::string();
5721 Stream.advanceSkippingSubblocks();
5724 consumeError(MaybeEntry.takeError());
5725 return std::string();
5727 llvm::BitstreamEntry Entry = MaybeEntry.get();
5729 if (Entry.Kind == llvm::BitstreamEntry::EndBlock)
5730 return std::string();
5732 if (Entry.Kind != llvm::BitstreamEntry::Record) {
5733 Diags.Report(diag::err_fe_pch_malformed_block) << ASTFileName;
5734 return std::string();
5742 consumeError(MaybeRecord.takeError());
5743 return std::string();
5758 std::string ExistingModuleCachePath;
5760 bool StrictOptionMatches;
5763 SimplePCHValidator(
const LangOptions &ExistingLangOpts,
5769 bool StrictOptionMatches)
5770 : ExistingLangOpts(ExistingLangOpts), ExistingCGOpts(ExistingCGOpts),
5771 ExistingTargetOpts(ExistingTargetOpts),
5772 ExistingPPOpts(ExistingPPOpts), ExistingHSOpts(ExistingHSOpts),
5773 ExistingModuleCachePath(ExistingModuleCachePath),
FileMgr(
FileMgr),
5774 StrictOptionMatches(StrictOptionMatches) {}
5776 bool ReadLanguageOptions(
const LangOptions &LangOpts,
5777 StringRef ModuleFilename,
bool Complain,
5778 bool AllowCompatibleDifferences)
override {
5780 nullptr, AllowCompatibleDifferences);
5783 bool ReadCodeGenOptions(
const CodeGenOptions &CGOpts,
5784 StringRef ModuleFilename,
bool Complain,
5785 bool AllowCompatibleDifferences)
override {
5787 nullptr, AllowCompatibleDifferences);
5790 bool ReadTargetOptions(
const TargetOptions &TargetOpts,
5791 StringRef ModuleFilename,
bool Complain,
5792 bool AllowCompatibleDifferences)
override {
5794 nullptr, AllowCompatibleDifferences);
5797 bool ReadHeaderSearchOptions(
const HeaderSearchOptions &HSOpts,
5798 StringRef ASTFilename,
5799 StringRef SpecificModuleCachePath,
5800 bool Complain)
override {
5803 ExistingModuleCachePath, ASTFilename,
nullptr, ExistingLangOpts,
5804 ExistingPPOpts, ExistingHSOpts, HSOpts);
5807 bool ReadPreprocessorOptions(
const PreprocessorOptions &PPOpts,
5808 StringRef ModuleFilename,
bool ReadMacros,
5810 std::string &SuggestedPredefines)
override {
5812 PPOpts, ExistingPPOpts, ModuleFilename, ReadMacros,
nullptr,
5813 FileMgr, SuggestedPredefines, ExistingLangOpts,
5825 unsigned ClientLoadCapabilities) {
5827 std::unique_ptr<llvm::MemoryBuffer> OwnedBuffer;
5828 llvm::MemoryBuffer *Buffer =
5838 Filename ==
"-" ? FileMgr.getSTDIN() : FileMgr.getFileRef(Filename);
5840 llvm::consumeError(Entry.takeError());
5843 auto BufferOrErr = FileMgr.getBufferForFile(*Entry);
5846 OwnedBuffer = std::move(*BufferOrErr);
5847 Buffer = OwnedBuffer.get();
5851 StringRef Bytes = PCHContainerRdr.ExtractPCH(*Buffer);
5852 BitstreamCursor Stream(Bytes);
5856 consumeError(std::move(Err));
5864 bool NeedsInputFiles = Listener.needsInputFileVisitation();
5865 bool NeedsSystemInputFiles = Listener.needsSystemInputFileVisitation();
5866 bool NeedsImports = Listener.needsImportVisitation();
5867 BitstreamCursor InputFilesCursor;
5868 uint64_t InputFilesOffsetBase = 0;
5871 std::string ModuleDir;
5872 bool DoneWithControlBlock =
false;
5874 PathBuf.reserve(256);
5879 AdditionalPathBuf.reserve(256);
5880 while (!DoneWithControlBlock) {
5884 consumeError(MaybeEntry.takeError());
5887 llvm::BitstreamEntry Entry = MaybeEntry.get();
5889 switch (Entry.Kind) {
5890 case llvm::BitstreamEntry::SubBlock: {
5893 std::string IgnoredSuggestedPredefines;
5894 if (ReadOptionsBlock(Stream, Filename, ClientLoadCapabilities,
5896 Listener, IgnoredSuggestedPredefines) !=
Success)
5902 InputFilesCursor = Stream;
5903 if (llvm::Error Err = Stream.SkipBlock()) {
5905 consumeError(std::move(Err));
5908 if (NeedsInputFiles &&
5911 InputFilesOffsetBase = InputFilesCursor.GetCurrentBitNo();
5915 if (llvm::Error Err = Stream.SkipBlock()) {
5917 consumeError(std::move(Err));
5926 case llvm::BitstreamEntry::EndBlock:
5927 DoneWithControlBlock =
true;
5930 case llvm::BitstreamEntry::Error:
5933 case llvm::BitstreamEntry::Record:
5937 if (DoneWithControlBlock)
break;
5942 Stream.readRecord(Entry.ID,
Record, &Blob);
5943 if (!MaybeRecCode) {
5951 if (Listener.ReadFullVersionInformation(Blob))
5955 Listener.ReadModuleName(Blob);
5958 ModuleDir = std::string(Blob);
5964 Listener.ReadModuleMapFile(*Path);
5968 if (!NeedsInputFiles)
5971 unsigned NumInputFiles =
Record[0];
5972 unsigned NumUserFiles =
Record[1];
5973 const llvm::support::unaligned_uint64_t *InputFileOffs =
5974 (
const llvm::support::unaligned_uint64_t *)Blob.data();
5975 for (
unsigned I = 0; I != NumInputFiles; ++I) {
5977 bool isSystemFile = I >= NumUserFiles;
5979 if (isSystemFile && !NeedsSystemInputFiles)
5982 BitstreamCursor &Cursor = InputFilesCursor;
5984 if (llvm::Error Err =
5985 Cursor.JumpToBit(InputFilesOffsetBase + InputFileOffs[I])) {
5987 consumeError(std::move(Err));
5993 consumeError(MaybeCode.takeError());
5995 unsigned Code = MaybeCode.get();
5999 bool shouldContinue =
false;
6001 Cursor.readRecord(Code,
Record, &Blob);
6002 if (!MaybeRecordType) {
6004 consumeError(MaybeRecordType.takeError());
6010 time_t StoredTime =
static_cast<time_t
>(
Record[2]);
6011 bool Overridden =
static_cast<bool>(
Record[3]);
6012 auto [UnresolvedFilenameAsRequested, UnresolvedFilename] =
6015 PathBuf, UnresolvedFilenameAsRequested, ModuleDir);
6017 if (UnresolvedFilename.empty())
6018 Filename = *FilenameAsRequestedBuf;
6021 AdditionalPathBuf, UnresolvedFilename, ModuleDir);
6022 Filename = *FilenameBuf;
6024 shouldContinue = Listener.visitInputFileAsRequested(
6025 *FilenameAsRequestedBuf, Filename, isSystemFile, Overridden,
6029 if (!shouldContinue)
6050 bool IsStandardCXXModule =
Record[Idx++];
6054 if (IsStandardCXXModule) {
6055 Listener.visitImport(ModuleName,
"");
6066 Listener.visitImport(ModuleName, *Filename);
6077 if (FindModuleFileExtensions) {
6078 BitstreamCursor SavedStream = Stream;
6080 bool DoneWithExtensionBlock =
false;
6081 while (!DoneWithExtensionBlock) {
6087 llvm::BitstreamEntry Entry = MaybeEntry.get();
6089 switch (Entry.Kind) {
6090 case llvm::BitstreamEntry::SubBlock:
6091 if (llvm::Error Err = Stream.SkipBlock()) {
6093 consumeError(std::move(Err));
6098 case llvm::BitstreamEntry::EndBlock:
6099 DoneWithExtensionBlock =
true;
6102 case llvm::BitstreamEntry::Error:
6105 case llvm::BitstreamEntry::Record:
6112 Stream.readRecord(Entry.ID,
Record, &Blob);
6113 if (!MaybeRecCode) {
6117 switch (MaybeRecCode.get()) {
6123 Listener.readModuleFileExtension(Metadata);
6129 Stream = std::move(SavedStream);
6133 if (readUnhashedControlBlockImpl(
6134 nullptr, Bytes, Filename, ClientLoadCapabilities,
6136 ValidateDiagnosticOptions) !=
Success)
6147 StringRef ExistingModuleCachePath,
bool RequireStrictOptionMatches) {
6148 SimplePCHValidator validator(LangOpts, CGOpts, TargetOpts, PPOpts, HSOpts,
6149 ExistingModuleCachePath, FileMgr,
6150 RequireStrictOptionMatches);
6156llvm::Error ASTReader::ReadSubmoduleBlock(
ModuleFile &F,
6157 unsigned ClientLoadCapabilities) {
6162 ModuleMap &ModMap = PP.getHeaderSearchInfo().getModuleMap();
6167 auto CreateModule = !KnowsTopLevelModule
6172 Module *CurrentModule =
nullptr;
6176 F.
Stream.advanceSkippingSubblocks();
6178 return MaybeEntry.takeError();
6179 llvm::BitstreamEntry Entry = MaybeEntry.get();
6181 switch (Entry.Kind) {
6182 case llvm::BitstreamEntry::SubBlock:
6183 case llvm::BitstreamEntry::Error:
6184 return llvm::createStringError(std::errc::illegal_byte_sequence,
6185 "malformed block record in AST file");
6186 case llvm::BitstreamEntry::EndBlock:
6187 return llvm::Error::success();
6188 case llvm::BitstreamEntry::Record:
6198 return MaybeKind.takeError();
6199 unsigned Kind = MaybeKind.get();
6202 return llvm::createStringError(
6203 std::errc::illegal_byte_sequence,
6204 "submodule metadata record should be at beginning of block");
6219 return llvm::createStringError(std::errc::illegal_byte_sequence,
6220 "malformed module definition");
6222 StringRef Name = Blob;
6229 bool IsFramework =
Record[Idx++];
6230 bool IsExplicit =
Record[Idx++];
6231 bool IsSystem =
Record[Idx++];
6232 bool IsExternC =
Record[Idx++];
6233 bool InferSubmodules =
Record[Idx++];
6234 bool InferExplicitSubmodules =
Record[Idx++];
6235 bool InferExportWildcard =
Record[Idx++];
6236 bool ConfigMacrosExhaustive =
Record[Idx++];
6237 bool ModuleMapIsPrivate =
Record[Idx++];
6238 bool NamedModuleHasInit =
Record[Idx++];
6240 Module *ParentModule =
nullptr;
6242 ParentModule = getSubmodule(Parent);
6244 CurrentModule = std::invoke(CreateModule, &ModMap, Name, ParentModule,
6245 IsFramework, IsExplicit);
6248 if (GlobalIndex >= SubmodulesLoaded.size() ||
6249 SubmodulesLoaded[GlobalIndex])
6250 return llvm::createStringError(std::errc::invalid_argument,
6251 "too many submodules");
6253 if (!ParentModule) {
6256 if (!
bool(PP.getPreprocessorOpts().DisablePCHOrModuleValidation &
6258 assert(CurFile != F.
File &&
"ModuleManager did not de-duplicate");
6260 Diag(diag::err_module_file_conflict)
6264 auto CurModMapFile =
6267 if (CurModMapFile && ModMapFile && CurModMapFile != ModMapFile)
6268 Diag(diag::note_module_file_conflict)
6269 << CurModMapFile->getName() << ModMapFile->getName();
6271 return llvm::make_error<AlreadyReportedDiagnosticError>();
6290 if (InferredAllowedBy.
isValid())
6300 if (DeserializationListener)
6301 DeserializationListener->ModuleRead(GlobalID, CurrentModule);
6303 SubmodulesLoaded[GlobalIndex] = CurrentModule;
6328 auto Filename = ResolveImportedPath(PathBuf, Blob, F);
6329 if (
auto Umbrella = PP.getFileManager().getOptionalFileRef(*Filename)) {
6357 auto HeaderName = ResolveImportedPath(PathBuf, Blob, F);
6364 auto Dirname = ResolveImportedPath(PathBuf, Blob, F);
6366 PP.getFileManager().getOptionalDirectoryRef(*Dirname)) {
6378 unsigned LocalBaseSubmoduleID =
Record[1];
6382 GlobalSubmoduleMap.insert(std::make_pair(getTotalNumSubmodules()+1,&F));
6387 std::make_pair(LocalBaseSubmoduleID,
6396 for (
unsigned Idx = 0; Idx !=
Record.size(); ++Idx) {
6408 for (
unsigned Idx = 0; Idx !=
Record.size(); ++Idx) {
6420 for (
unsigned Idx = 0; Idx + 1 <
Record.size(); Idx += 2) {
6437 PP.getTargetInfo());
6443 Module::LinkLibrary(std::string(Blob),
Record[0]));
6467 SmallVector<GlobalDeclID, 16> Inits;
6468 for (
unsigned I = 0; I <
Record.size(); )
6469 Inits.push_back(ReadDeclID(F,
Record, I));
6470 ContextObj->addLazyModuleInitializers(CurrentModule, Inits);
6490bool ASTReader::ParseLanguageOptions(
const RecordData &
Record,
6491 StringRef ModuleFilename,
bool Complain,
6492 ASTReaderListener &Listener,
6493 bool AllowCompatibleDifferences) {
6494 LangOptions LangOpts;
6496#define LANGOPT(Name, Bits, Default, Compatibility, Description) \
6497 LangOpts.Name = Record[Idx++];
6498#define ENUM_LANGOPT(Name, Type, Bits, Default, Compatibility, Description) \
6499 LangOpts.set##Name(static_cast<LangOptions::Type>(Record[Idx++]));
6500#include "clang/Basic/LangOptions.def"
6501#define SANITIZER(NAME, ID) \
6502 LangOpts.Sanitize.set(SanitizerKind::ID, Record[Idx++]);
6503#include "clang/Basic/Sanitizers.def"
6505 for (
unsigned N =
Record[Idx++]; N; --N)
6509 VersionTuple runtimeVersion = ReadVersionTuple(
Record, Idx);
6510 LangOpts.
ObjCRuntime = ObjCRuntime(runtimeKind, runtimeVersion);
6515 for (
unsigned N =
Record[Idx++]; N; --N) {
6517 ReadString(
Record, Idx));
6522 for (
unsigned N =
Record[Idx++]; N; --N) {
6529 AllowCompatibleDifferences);
6532bool ASTReader::ParseCodeGenOptions(
const RecordData &
Record,
6533 StringRef ModuleFilename,
bool Complain,
6534 ASTReaderListener &Listener,
6535 bool AllowCompatibleDifferences) {
6537 CodeGenOptions CGOpts;
6539#define CODEGENOPT(Name, Bits, Default, Compatibility) \
6540 if constexpr (CK::Compatibility != CK::Benign) \
6541 CGOpts.Name = static_cast<unsigned>(Record[Idx++]);
6542#define ENUM_CODEGENOPT(Name, Type, Bits, Default, Compatibility) \
6543 if constexpr (CK::Compatibility != CK::Benign) \
6544 CGOpts.set##Name(static_cast<clang::CodeGenOptions::Type>(Record[Idx++]));
6545#define DEBUGOPT(Name, Bits, Default, Compatibility)
6546#define VALUE_DEBUGOPT(Name, Bits, Default, Compatibility)
6547#define ENUM_DEBUGOPT(Name, Type, Bits, Default, Compatibility)
6548#include "clang/Basic/CodeGenOptions.def"
6551 AllowCompatibleDifferences);
6554bool ASTReader::ParseTargetOptions(
const RecordData &
Record,
6555 StringRef ModuleFilename,
bool Complain,
6556 ASTReaderListener &Listener,
6557 bool AllowCompatibleDifferences) {
6559 TargetOptions TargetOpts;
6561 TargetOpts.
CPU = ReadString(
Record, Idx);
6563 TargetOpts.
ABI = ReadString(
Record, Idx);
6564 for (
unsigned N =
Record[Idx++]; N; --N) {
6567 for (
unsigned N =
Record[Idx++]; N; --N) {
6572 AllowCompatibleDifferences);
6575bool ASTReader::ParseDiagnosticOptions(
const RecordData &
Record,
6576 StringRef ModuleFilename,
bool Complain,
6577 ASTReaderListener &Listener) {
6578 DiagnosticOptions DiagOpts;
6580#define DIAGOPT(Name, Bits, Default) DiagOpts.Name = Record[Idx++];
6581#define ENUM_DIAGOPT(Name, Type, Bits, Default) \
6582 DiagOpts.set##Name(static_cast<Type>(Record[Idx++]));
6583#include "clang/Basic/DiagnosticOptions.def"
6585 for (
unsigned N =
Record[Idx++]; N; --N)
6587 for (
unsigned N =
Record[Idx++]; N; --N)
6593bool ASTReader::ParseFileSystemOptions(
const RecordData &
Record,
bool Complain,
6594 ASTReaderListener &Listener) {
6595 FileSystemOptions FSOpts;
6601bool ASTReader::ParseHeaderSearchOptions(
const RecordData &
Record,
6602 StringRef ModuleFilename,
6604 ASTReaderListener &Listener) {
6605 HeaderSearchOptions HSOpts;
6620 std::string SpecificModuleCachePath = ReadString(
Record, Idx);
6623 SpecificModuleCachePath, Complain);
6626bool ASTReader::ParseHeaderSearchPaths(
const RecordData &
Record,
bool Complain,
6627 ASTReaderListener &Listener) {
6628 HeaderSearchOptions HSOpts;
6632 for (
unsigned N =
Record[Idx++]; N; --N) {
6633 std::string Path = ReadString(
Record, Idx);
6636 bool IsFramework =
Record[Idx++];
6637 bool IgnoreSysRoot =
Record[Idx++];
6638 HSOpts.
UserEntries.emplace_back(std::move(Path), Group, IsFramework,
6643 for (
unsigned N =
Record[Idx++]; N; --N) {
6644 std::string Prefix = ReadString(
Record, Idx);
6645 bool IsSystemHeader =
Record[Idx++];
6650 for (
unsigned N =
Record[Idx++]; N; --N) {
6651 std::string VFSOverlayFile = ReadString(
Record, Idx);
6658bool ASTReader::ParsePreprocessorOptions(
const RecordData &
Record,
6659 StringRef ModuleFilename,
6661 ASTReaderListener &Listener,
6662 std::string &SuggestedPredefines) {
6663 PreprocessorOptions PPOpts;
6667 bool ReadMacros =
Record[Idx++];
6669 for (
unsigned N =
Record[Idx++]; N; --N) {
6671 bool IsUndef =
Record[Idx++];
6672 PPOpts.
Macros.push_back(std::make_pair(
Macro, IsUndef));
6677 for (
unsigned N =
Record[Idx++]; N; --N) {
6682 for (
unsigned N =
Record[Idx++]; N; --N) {
6691 SuggestedPredefines.clear();
6693 Complain, SuggestedPredefines);
6696std::pair<ModuleFile *, unsigned>
6697ASTReader::getModulePreprocessedEntity(
unsigned GlobalIndex) {
6698 GlobalPreprocessedEntityMapType::iterator
6699 I = GlobalPreprocessedEntityMap.find(GlobalIndex);
6700 assert(I != GlobalPreprocessedEntityMap.end() &&
6701 "Corrupted global preprocessed entity map");
6704 return std::make_pair(M, LocalIndex);
6707llvm::iterator_range<PreprocessingRecord::iterator>
6708ASTReader::getModulePreprocessedEntities(
ModuleFile &Mod)
const {
6709 if (PreprocessingRecord *PPRec = PP.getPreprocessingRecord())
6713 return llvm::make_range(PreprocessingRecord::iterator(),
6714 PreprocessingRecord::iterator());
6717bool ASTReader::canRecoverFromOutOfDate(StringRef ModuleFileName,
6718 unsigned int ClientLoadCapabilities) {
6719 return ClientLoadCapabilities & ARR_OutOfDate &&
6722 .getInMemoryModuleCache()
6723 .isPCMFinal(ModuleFileName);
6726llvm::iterator_range<ASTReader::ModuleDeclIterator>
6728 return llvm::make_range(
6735 auto I = GlobalSkippedRangeMap.find(GlobalIndex);
6736 assert(I != GlobalSkippedRangeMap.end() &&
6737 "Corrupted global skipped range map");
6740 assert(LocalIndex < M->NumPreprocessedSkippedRanges);
6744 assert(Range.isValid());
6750 unsigned ModuleFileIndex = ID >> 32;
6751 assert(ModuleFileIndex &&
"not translating loaded MacroID?");
6752 assert(getModuleManager().size() > ModuleFileIndex - 1);
6753 ModuleFile &MF = getModuleManager()[ModuleFileIndex - 1];
6755 ID &= llvm::maskTrailingOnes<PreprocessedEntityID>(32);
6760 std::pair<ModuleFile *, unsigned> PPInfo = getModulePreprocessedEntity(Index);
6762 unsigned LocalIndex = PPInfo.second;
6767 if (!PP.getPreprocessingRecord()) {
6768 Error(
"no preprocessing record");
6775 Error(std::move(Err));
6782 Error(MaybeEntry.takeError());
6785 llvm::BitstreamEntry Entry = MaybeEntry.get();
6787 if (Entry.Kind != llvm::BitstreamEntry::Record)
6798 if (!MaybeRecType) {
6799 Error(MaybeRecType.takeError());
6804 bool isBuiltin =
Record[0];
6812 unsigned Index = translatePreprocessedEntityIDToIndex(GlobalID);
6832 if (DeserializationListener)
6833 DeserializationListener->MacroDefinitionRead(PPID, MD);
6839 const char *FullFileNameStart = Blob.data() +
Record[0];
6840 StringRef FullFileName(FullFileNameStart, Blob.size() -
Record[0]);
6842 if (!FullFileName.empty())
6843 File = PP.getFileManager().getOptionalFileRef(FullFileName);
6850 StringRef(Blob.data(),
Record[0]),
6858 llvm_unreachable(
"Invalid PreprocessorDetailRecordTypes");
6867unsigned ASTReader::findNextPreprocessedEntity(
6868 GlobalSLocOffsetMapType::const_iterator SLocMapI)
const {
6870 for (GlobalSLocOffsetMapType::const_iterator
6871 EndI = GlobalSLocOffsetMap.end(); SLocMapI != EndI; ++SLocMapI) {
6877 return getTotalNumPreprocessedEntities();
6882struct PPEntityComp {
6883 const ASTReader &Reader;
6886 PPEntityComp(
const ASTReader &Reader, ModuleFile &M) : Reader(Reader), M(M) {}
6888 bool operator()(
const PPEntityOffset &L,
const PPEntityOffset &R)
const {
6889 SourceLocation LHS = getLoc(L);
6890 SourceLocation RHS = getLoc(R);
6894 bool operator()(
const PPEntityOffset &L, SourceLocation RHS)
const {
6895 SourceLocation LHS = getLoc(L);
6899 bool operator()(SourceLocation LHS,
const PPEntityOffset &R)
const {
6900 SourceLocation RHS = getLoc(R);
6904 SourceLocation getLoc(
const PPEntityOffset &PPE)
const {
6911unsigned ASTReader::findPreprocessedEntity(SourceLocation Loc,
6912 bool EndsAfter)
const {
6913 if (SourceMgr.isLocalSourceLocation(Loc))
6914 return getTotalNumPreprocessedEntities();
6916 GlobalSLocOffsetMapType::const_iterator SLocMapI = GlobalSLocOffsetMap.find(
6917 SourceManager::MaxLoadedOffset - Loc.getOffset() - 1);
6918 assert(SLocMapI != GlobalSLocOffsetMap.end() &&
6919 "Corrupted global sloc offset map");
6921 if (SLocMapI->second->NumPreprocessedEntities == 0)
6922 return findNextPreprocessedEntity(SLocMapI);
6933 pp_iterator
First = pp_begin;
6937 PPI = std::upper_bound(pp_begin, pp_end, Loc,
6938 PPEntityComp(*
this, M));
6947 std::advance(PPI,
Half);
6948 if (SourceMgr.isBeforeInTranslationUnit(
6949 ReadSourceLocation(M, PPI->getEnd()), Loc)) {
6952 Count = Count -
Half - 1;
6959 return findNextPreprocessedEntity(SLocMapI);
6966std::pair<unsigned, unsigned>
6968 if (Range.isInvalid())
6969 return std::make_pair(0,0);
6970 assert(!SourceMgr.isBeforeInTranslationUnit(Range.getEnd(),Range.getBegin()));
6972 unsigned BeginID = findPreprocessedEntity(Range.getBegin(),
false);
6973 unsigned EndID = findPreprocessedEntity(Range.getEnd(),
true);
6974 return std::make_pair(BeginID, EndID);
6984 std::pair<ModuleFile *, unsigned> PPInfo = getModulePreprocessedEntity(Index);
6986 unsigned LocalIndex = PPInfo.second;
6993 if (SourceMgr.isInFileID(SourceMgr.getFileLoc(Loc), FID))
7002 class HeaderFileInfoVisitor {
7004 std::optional<HeaderFileInfo> HFI;
7007 explicit HeaderFileInfoVisitor(
FileEntryRef FE) : FE(FE) {}
7016 HeaderFileInfoLookupTable::iterator Pos = Table->find(FE);
7017 if (Pos == Table->end())
7024 std::optional<HeaderFileInfo> getHeaderFileInfo()
const {
return HFI; }
7030 HeaderFileInfoVisitor Visitor(FE);
7031 ModuleMgr.visit(Visitor);
7032 if (std::optional<HeaderFileInfo> HFI = Visitor.getHeaderFileInfo())
7039 using DiagState = DiagnosticsEngine::DiagState;
7050 auto ReadDiagState = [&](
const DiagState &BasedOn,
7051 bool IncludeNonPragmaStates) {
7052 unsigned BackrefID =
Record[Idx++];
7054 return DiagStates[BackrefID - 1];
7057 Diag.DiagStates.push_back(BasedOn);
7058 DiagState *NewState = &
Diag.DiagStates.back();
7059 DiagStates.push_back(NewState);
7060 unsigned Size =
Record[Idx++];
7061 assert(Idx + Size * 2 <=
Record.size() &&
7062 "Invalid data, not enough diag/map pairs");
7064 unsigned DiagID =
Record[Idx++];
7067 if (!NewMapping.
isPragma() && !IncludeNonPragmaStates)
7080 Mapping = NewMapping;
7086 DiagState *FirstState;
7091 FirstState =
Diag.DiagStatesByLoc.FirstDiagState;
7092 DiagStates.push_back(FirstState);
7096 "Invalid data, unexpected backref in initial state");
7098 assert(Idx <
Record.size() &&
7099 "Invalid data, not enough state change pairs in initial state");
7104 unsigned Flags =
Record[Idx++];
7105 DiagState Initial(*
Diag.getDiagnosticIDs());
7106 Initial.SuppressSystemWarnings = Flags & 1; Flags >>= 1;
7107 Initial.ErrorsAsFatal = Flags & 1; Flags >>= 1;
7108 Initial.WarningsAsErrors = Flags & 1; Flags >>= 1;
7109 Initial.EnableAllWarnings = Flags & 1; Flags >>= 1;
7110 Initial.IgnoreAllWarnings = Flags & 1; Flags >>= 1;
7112 FirstState = ReadDiagState(Initial,
true);
7120 .StateTransitions.push_back({FirstState, 0});
7125 FirstState = ReadDiagState(*
Diag.DiagStatesByLoc.CurDiagState,
false);
7129 unsigned NumLocations =
Record[Idx++];
7130 while (NumLocations--) {
7131 assert(Idx <
Record.size() &&
7132 "Invalid data, missing pragma diagnostic states");
7134 assert(FID.
isValid() &&
"invalid FileID for transition");
7135 unsigned Transitions =
Record[Idx++];
7141 auto &F =
Diag.DiagStatesByLoc.Files[FID];
7142 F.StateTransitions.reserve(F.StateTransitions.size() + Transitions);
7143 for (
unsigned I = 0; I != Transitions; ++I) {
7144 unsigned Offset =
Record[Idx++];
7145 auto *State = ReadDiagState(*FirstState,
false);
7146 F.StateTransitions.push_back({State, Offset});
7151 assert(Idx <
Record.size() &&
7152 "Invalid data, missing final pragma diagnostic state");
7154 auto *CurState = ReadDiagState(*FirstState,
false);
7157 Diag.DiagStatesByLoc.CurDiagState = CurState;
7158 Diag.DiagStatesByLoc.CurDiagStateLoc = CurStateLoc;
7163 auto &
T =
Diag.DiagStatesByLoc.Files[NullFile].StateTransitions;
7165 T.push_back({CurState, 0});
7167 T[0].State = CurState;
7176ASTReader::RecordLocation ASTReader::TypeCursorForIndex(
TypeID ID) {
7177 auto [M, Index] = translateTypeIDToIndex(ID);
7184#define TYPE_BIT_CODE(CLASS_ID, CODE_ID, CODE_VALUE) \
7185 case TYPE_##CODE_ID: return Type::CLASS_ID;
7186#include "clang/Serialization/TypeBitCodes.def"
7188 return std::nullopt;
7198QualType ASTReader::readTypeRecord(
TypeID ID) {
7199 assert(ContextObj &&
"reading type with no AST context");
7200 ASTContext &Context = *ContextObj;
7201 RecordLocation Loc = TypeCursorForIndex(ID);
7202 BitstreamCursor &DeclsCursor = Loc.F->DeclsCursor;
7206 SavedStreamPosition SavedPosition(DeclsCursor);
7208 ReadingKindTracker ReadingKind(Read_Type, *
this);
7211 Deserializing AType(
this);
7213 if (llvm::Error Err = DeclsCursor.JumpToBit(Loc.Offset)) {
7214 Error(std::move(Err));
7217 Expected<unsigned> RawCode = DeclsCursor.ReadCode();
7219 Error(RawCode.takeError());
7223 ASTRecordReader
Record(*
this, *Loc.F);
7224 Expected<unsigned> Code =
Record.readRecord(DeclsCursor, RawCode.get());
7226 Error(Code.takeError());
7230 QualType baseType =
Record.readQualType();
7231 Qualifiers quals =
Record.readQualifiers();
7237 Error(
"Unexpected code for type");
7241 serialization::AbstractTypeReader<ASTRecordReader> TypeReader(
Record);
7242 return TypeReader.read(*maybeClass);
7250 SourceLocation readSourceLocation() {
return Reader.readSourceLocation(); }
7251 SourceRange readSourceRange() {
return Reader.readSourceRange(); }
7254 return Reader.readTypeSourceInfo();
7258 return Reader.readNestedNameSpecifierLoc();
7262 return Reader.readAttr();
7271#define ABSTRACT_TYPELOC(CLASS, PARENT)
7272#define TYPELOC(CLASS, PARENT) \
7273 void Visit##CLASS##TypeLoc(CLASS##TypeLoc TyLoc);
7274#include "clang/AST/TypeLocNodes.def"
7283void TypeLocReader::VisitQualifiedTypeLoc(QualifiedTypeLoc TL) {
7287void TypeLocReader::VisitBuiltinTypeLoc(BuiltinTypeLoc TL) {
7297void TypeLocReader::VisitComplexTypeLoc(ComplexTypeLoc TL) {
7301void TypeLocReader::VisitPointerTypeLoc(PointerTypeLoc TL) {
7305void TypeLocReader::VisitDecayedTypeLoc(DecayedTypeLoc TL) {
7309void TypeLocReader::VisitAdjustedTypeLoc(AdjustedTypeLoc TL) {
7313void TypeLocReader::VisitArrayParameterTypeLoc(ArrayParameterTypeLoc TL) {
7317void TypeLocReader::VisitMacroQualifiedTypeLoc(MacroQualifiedTypeLoc TL) {
7321void TypeLocReader::VisitBlockPointerTypeLoc(BlockPointerTypeLoc TL) {
7325void TypeLocReader::VisitLValueReferenceTypeLoc(LValueReferenceTypeLoc TL) {
7329void TypeLocReader::VisitRValueReferenceTypeLoc(RValueReferenceTypeLoc TL) {
7333void TypeLocReader::VisitMemberPointerTypeLoc(MemberPointerTypeLoc TL) {
7341 if (Reader.readBool())
7348 VisitArrayTypeLoc(TL);
7352 VisitArrayTypeLoc(TL);
7355void TypeLocReader::VisitVariableArrayTypeLoc(VariableArrayTypeLoc TL) {
7356 VisitArrayTypeLoc(TL);
7359void TypeLocReader::VisitDependentSizedArrayTypeLoc(
7360 DependentSizedArrayTypeLoc TL) {
7361 VisitArrayTypeLoc(TL);
7364void TypeLocReader::VisitDependentAddressSpaceTypeLoc(
7365 DependentAddressSpaceTypeLoc TL) {
7372void TypeLocReader::VisitDependentSizedExtVectorTypeLoc(
7373 DependentSizedExtVectorTypeLoc TL) {
7377void TypeLocReader::VisitVectorTypeLoc(VectorTypeLoc TL) {
7381void TypeLocReader::VisitDependentVectorTypeLoc(
7382 DependentVectorTypeLoc TL) {
7386void TypeLocReader::VisitExtVectorTypeLoc(ExtVectorTypeLoc TL) {
7390void TypeLocReader::VisitConstantMatrixTypeLoc(ConstantMatrixTypeLoc TL) {
7397void TypeLocReader::VisitDependentSizedMatrixTypeLoc(
7398 DependentSizedMatrixTypeLoc TL) {
7411 for (
unsigned i = 0, e = TL.
getNumParams(); i != e; ++i) {
7417 VisitFunctionTypeLoc(TL);
7421 VisitFunctionTypeLoc(TL);
7424void TypeLocReader::VisitUnresolvedUsingTypeLoc(UnresolvedUsingTypeLoc TL) {
7425 SourceLocation ElaboratedKeywordLoc = readSourceLocation();
7426 NestedNameSpecifierLoc QualifierLoc = ReadNestedNameSpecifierLoc();
7427 SourceLocation NameLoc = readSourceLocation();
7428 TL.
set(ElaboratedKeywordLoc, QualifierLoc, NameLoc);
7431void TypeLocReader::VisitUsingTypeLoc(UsingTypeLoc TL) {
7432 SourceLocation ElaboratedKeywordLoc = readSourceLocation();
7433 NestedNameSpecifierLoc QualifierLoc = ReadNestedNameSpecifierLoc();
7434 SourceLocation NameLoc = readSourceLocation();
7435 TL.
set(ElaboratedKeywordLoc, QualifierLoc, NameLoc);
7438void TypeLocReader::VisitTypedefTypeLoc(TypedefTypeLoc TL) {
7439 SourceLocation ElaboratedKeywordLoc = readSourceLocation();
7440 NestedNameSpecifierLoc QualifierLoc = ReadNestedNameSpecifierLoc();
7441 SourceLocation NameLoc = readSourceLocation();
7442 TL.
set(ElaboratedKeywordLoc, QualifierLoc, NameLoc);
7445void TypeLocReader::VisitTypeOfExprTypeLoc(TypeOfExprTypeLoc TL) {
7451void TypeLocReader::VisitTypeOfTypeLoc(TypeOfTypeLoc TL) {
7458void TypeLocReader::VisitDecltypeTypeLoc(DecltypeTypeLoc TL) {
7463void TypeLocReader::VisitPackIndexingTypeLoc(PackIndexingTypeLoc TL) {
7467void TypeLocReader::VisitUnaryTransformTypeLoc(UnaryTransformTypeLoc TL) {
7481 getContext(), NNS, TemplateKWLoc, ConceptNameLoc, FoundDecl, NamedConcept,
7486void TypeLocReader::VisitAutoTypeLoc(
AutoTypeLoc TL) {
7488 if (Reader.readBool())
7490 if (Reader.readBool())
7494void TypeLocReader::VisitDeducedTemplateSpecializationTypeLoc(
7508 VisitTagTypeLoc(TL);
7512 VisitTagTypeLoc(TL);
7515void TypeLocReader::VisitEnumTypeLoc(EnumTypeLoc TL) { VisitTagTypeLoc(TL); }
7517void TypeLocReader::VisitAttributedTypeLoc(AttributedTypeLoc TL) {
7521void TypeLocReader::VisitCountAttributedTypeLoc(CountAttributedTypeLoc TL) {
7525void TypeLocReader::VisitBTFTagAttributedTypeLoc(BTFTagAttributedTypeLoc TL) {
7529void TypeLocReader::VisitHLSLAttributedResourceTypeLoc(
7530 HLSLAttributedResourceTypeLoc TL) {
7534void TypeLocReader::VisitHLSLInlineSpirvTypeLoc(HLSLInlineSpirvTypeLoc TL) {
7538void TypeLocReader::VisitTemplateTypeParmTypeLoc(TemplateTypeParmTypeLoc TL) {
7542void TypeLocReader::VisitSubstTemplateTypeParmTypeLoc(
7543 SubstTemplateTypeParmTypeLoc TL) {
7547void TypeLocReader::VisitSubstTemplateTypeParmPackTypeLoc(
7548 SubstTemplateTypeParmPackTypeLoc TL) {
7552void TypeLocReader::VisitSubstBuiltinTemplatePackTypeLoc(
7553 SubstBuiltinTemplatePackTypeLoc TL) {
7557void TypeLocReader::VisitTemplateSpecializationTypeLoc(
7558 TemplateSpecializationTypeLoc TL) {
7559 SourceLocation ElaboratedKeywordLoc = readSourceLocation();
7560 NestedNameSpecifierLoc QualifierLoc = ReadNestedNameSpecifierLoc();
7561 SourceLocation TemplateKeywordLoc = readSourceLocation();
7562 SourceLocation NameLoc = readSourceLocation();
7563 SourceLocation LAngleLoc = readSourceLocation();
7564 SourceLocation RAngleLoc = readSourceLocation();
7565 TL.
set(ElaboratedKeywordLoc, QualifierLoc, TemplateKeywordLoc, NameLoc,
7566 LAngleLoc, RAngleLoc);
7567 MutableArrayRef<TemplateArgumentLocInfo> Args = TL.
getArgLocInfos();
7568 for (
unsigned I = 0, E = TL.
getNumArgs(); I != E; ++I)
7569 Args[I] = Reader.readTemplateArgumentLocInfo(
7570 TL.
getTypePtr()->template_arguments()[I].getKind());
7573void TypeLocReader::VisitParenTypeLoc(ParenTypeLoc TL) {
7578void TypeLocReader::VisitDependentNameTypeLoc(DependentNameTypeLoc TL) {
7584void TypeLocReader::VisitPackExpansionTypeLoc(PackExpansionTypeLoc TL) {
7588void TypeLocReader::VisitObjCInterfaceTypeLoc(ObjCInterfaceTypeLoc TL) {
7593void TypeLocReader::VisitObjCTypeParamTypeLoc(ObjCTypeParamTypeLoc TL) {
7602void TypeLocReader::VisitObjCObjectTypeLoc(ObjCObjectTypeLoc TL) {
7614void TypeLocReader::VisitObjCObjectPointerTypeLoc(ObjCObjectPointerTypeLoc TL) {
7618void TypeLocReader::VisitAtomicTypeLoc(AtomicTypeLoc TL) {
7624void TypeLocReader::VisitPipeTypeLoc(PipeTypeLoc TL) {
7628void TypeLocReader::VisitBitIntTypeLoc(clang::BitIntTypeLoc TL) {
7632void TypeLocReader::VisitDependentBitIntTypeLoc(
7633 clang::DependentBitIntTypeLoc TL) {
7637void TypeLocReader::VisitPredefinedSugarTypeLoc(PredefinedSugarTypeLoc TL) {
7671std::pair<ModuleFile *, unsigned>
7674 "Predefined type shouldn't be in TypesLoaded");
7676 assert(ModuleFileIndex &&
"Untranslated Local Decl?");
7678 ModuleFile *OwningModuleFile = &getModuleManager()[ModuleFileIndex - 1];
7679 assert(OwningModuleFile &&
7680 "untranslated type ID or local type ID shouldn't be in TypesLoaded");
7682 return {OwningModuleFile,
7687 assert(ContextObj &&
"reading type with no AST context");
7698 llvm_unreachable(
"Invalid predefined type");
7714 T = Context.UnsignedCharTy;
7717 T = Context.UnsignedShortTy;
7720 T = Context.UnsignedIntTy;
7723 T = Context.UnsignedLongTy;
7726 T = Context.UnsignedLongLongTy;
7729 T = Context.UnsignedInt128Ty;
7732 T = Context.SignedCharTy;
7735 T = Context.WCharTy;
7738 T = Context.ShortTy;
7747 T = Context.LongLongTy;
7750 T = Context.Int128Ty;
7753 T = Context.BFloat16Ty;
7759 T = Context.FloatTy;
7762 T = Context.DoubleTy;
7765 T = Context.LongDoubleTy;
7768 T = Context.ShortAccumTy;
7771 T = Context.AccumTy;
7774 T = Context.LongAccumTy;
7777 T = Context.UnsignedShortAccumTy;
7780 T = Context.UnsignedAccumTy;
7783 T = Context.UnsignedLongAccumTy;
7786 T = Context.ShortFractTy;
7789 T = Context.FractTy;
7792 T = Context.LongFractTy;
7795 T = Context.UnsignedShortFractTy;
7798 T = Context.UnsignedFractTy;
7801 T = Context.UnsignedLongFractTy;
7804 T = Context.SatShortAccumTy;
7807 T = Context.SatAccumTy;
7810 T = Context.SatLongAccumTy;
7813 T = Context.SatUnsignedShortAccumTy;
7816 T = Context.SatUnsignedAccumTy;
7819 T = Context.SatUnsignedLongAccumTy;
7822 T = Context.SatShortFractTy;
7825 T = Context.SatFractTy;
7828 T = Context.SatLongFractTy;
7831 T = Context.SatUnsignedShortFractTy;
7834 T = Context.SatUnsignedFractTy;
7837 T = Context.SatUnsignedLongFractTy;
7840 T = Context.Float16Ty;
7843 T = Context.Float128Ty;
7846 T = Context.Ibm128Ty;
7849 T = Context.OverloadTy;
7852 T = Context.UnresolvedTemplateTy;
7855 T = Context.BoundMemberTy;
7858 T = Context.PseudoObjectTy;
7861 T = Context.DependentTy;
7864 T = Context.UnknownAnyTy;
7867 T = Context.NullPtrTy;
7870 T = Context.Char8Ty;
7873 T = Context.Char16Ty;
7876 T = Context.Char32Ty;
7879 T = Context.ObjCBuiltinIdTy;
7882 T = Context.ObjCBuiltinClassTy;
7885 T = Context.ObjCBuiltinSelTy;
7887#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
7888 case PREDEF_TYPE_##Id##_ID: \
7889 T = Context.SingletonId; \
7891#include "clang/Basic/OpenCLImageTypes.def"
7892#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
7893 case PREDEF_TYPE_##Id##_ID: \
7894 T = Context.Id##Ty; \
7896#include "clang/Basic/OpenCLExtensionTypes.def"
7898 T = Context.OCLSamplerTy;
7901 T = Context.OCLEventTy;
7904 T = Context.OCLClkEventTy;
7907 T = Context.OCLQueueTy;
7910 T = Context.OCLReserveIDTy;
7913 T = Context.getAutoDeductType();
7916 T = Context.getAutoRRefDeductType();
7919 T = Context.ARCUnbridgedCastTy;
7922 T = Context.BuiltinFnTy;
7925 T = Context.IncompleteMatrixIdxTy;
7928 T = Context.ArraySectionTy;
7931 T = Context.OMPArrayShapingTy;
7934 T = Context.OMPIteratorTy;
7936#define SVE_TYPE(Name, Id, SingletonId) \
7937 case PREDEF_TYPE_##Id##_ID: \
7938 T = Context.SingletonId; \
7940#include "clang/Basic/AArch64ACLETypes.def"
7941#define PPC_VECTOR_TYPE(Name, Id, Size) \
7942 case PREDEF_TYPE_##Id##_ID: \
7943 T = Context.Id##Ty; \
7945#include "clang/Basic/PPCTypes.def"
7946#define RVV_TYPE(Name, Id, SingletonId) \
7947 case PREDEF_TYPE_##Id##_ID: \
7948 T = Context.SingletonId; \
7950#include "clang/Basic/RISCVVTypes.def"
7951#define WASM_TYPE(Name, Id, SingletonId) \
7952 case PREDEF_TYPE_##Id##_ID: \
7953 T = Context.SingletonId; \
7955#include "clang/Basic/WebAssemblyReferenceTypes.def"
7956#define AMDGPU_TYPE(Name, Id, SingletonId, Width, Align) \
7957 case PREDEF_TYPE_##Id##_ID: \
7958 T = Context.SingletonId; \
7960#include "clang/Basic/AMDGPUTypes.def"
7961#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) \
7962 case PREDEF_TYPE_##Id##_ID: \
7963 T = Context.SingletonId; \
7965#include "clang/Basic/HLSLIntangibleTypes.def"
7968 assert(!
T.isNull() &&
"Unknown predefined type");
7969 return T.withFastQualifiers(FastQuals);
7972 unsigned Index = translateTypeIDToIndex(ID).second;
7974 assert(Index < TypesLoaded.size() &&
"Type index out-of-range");
7975 if (TypesLoaded[Index].isNull()) {
7976 TypesLoaded[Index] = readTypeRecord(ID);
7977 if (TypesLoaded[Index].isNull())
7980 TypesLoaded[Index]->setFromAST();
7981 if (DeserializationListener)
7983 TypesLoaded[Index]);
7986 return TypesLoaded[Index].withFastQualifiers(FastQuals);
7999 ReadModuleOffsetMap(F);
8002 LocalID &= llvm::maskTrailingOnes<TypeID>(32);
8004 if (ModuleFileIndex == 0)
8009 ModuleFileIndex = MF.
Index + 1;
8010 return ((uint64_t)ModuleFileIndex << 32) | LocalID;
8029 TemplateNameLoc, EllipsisLoc);
8040 llvm_unreachable(
"unexpected template argument loc");
8057 unsigned NumArgsAsWritten =
readInt();
8058 for (
unsigned i = 0; i != NumArgsAsWritten; ++i)
8072 if (NumCurrentElementsDeserializing) {
8077 PendingIncompleteDeclChains.push_back(
const_cast<Decl*
>(D));
8100 auto *II = Name.getAsIdentifierInfo();
8101 assert(II &&
"non-identifier name in C?");
8102 if (II->isOutOfDate())
8119 if (
auto *CTSD = dyn_cast<ClassTemplateSpecializationDecl>(D)) {
8120 Template = CTSD->getSpecializedTemplate();
8121 Args = CTSD->getTemplateArgs().asArray();
8122 }
else if (
auto *VTSD = dyn_cast<VarTemplateSpecializationDecl>(D)) {
8123 Template = VTSD->getSpecializedTemplate();
8124 Args = VTSD->getTemplateArgs().asArray();
8125 }
else if (
auto *FD = dyn_cast<FunctionDecl>(D)) {
8126 if (
auto *Tmplt = FD->getPrimaryTemplate()) {
8128 Args = FD->getTemplateSpecializationArgs()->asArray();
8136 Template->loadLazySpecializationsImpl();
8138 Template->loadLazySpecializationsImpl(Args);
8144 RecordLocation Loc = getLocalBitOffset(Offset);
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(MaybeRecCode.takeError());
8168 Error(
"malformed AST file: missing C++ ctor initializers");
8172 return Record.readCXXCtorInitializers();
8176 assert(ContextObj &&
"reading base specifiers with no AST context");
8179 RecordLocation Loc = getLocalBitOffset(Offset);
8182 if (llvm::Error Err = Cursor.JumpToBit(Loc.Offset)) {
8183 Error(std::move(Err));
8186 ReadingKindTracker ReadingKind(Read_Decl, *
this);
8191 Error(MaybeCode.takeError());
8194 unsigned Code = MaybeCode.get();
8198 if (!MaybeRecCode) {
8199 Error(MaybeCode.takeError());
8202 unsigned RecCode = MaybeRecCode.get();
8205 Error(
"malformed AST file: missing C++ base specifiers");
8209 unsigned NumBases =
Record.readInt();
8212 for (
unsigned I = 0; I != NumBases; ++I)
8213 Bases[I] =
Record.readCXXBaseSpecifier();
8226 ReadModuleOffsetMap(F);
8229 OwningModuleFileIndex == 0
8233 if (OwningModuleFileIndex == 0)
8236 uint64_t NewModuleFileIndex = OwningModuleFile->
Index + 1;
8245 unsigned ModuleFileIndex = ID.getModuleFileIndex();
8246 return M.
Index == ModuleFileIndex - 1;
8254 uint64_t ModuleFileIndex = ID.getModuleFileIndex();
8255 assert(ModuleFileIndex &&
"Untranslated Local Decl?");
8275 DeclCursorForID(ID, Loc);
8280 assert(ContextObj &&
"reading predefined decl without AST context");
8282 Decl *NewLoaded =
nullptr;
8288 return Context.getTranslationUnitDecl();
8291 if (Context.ObjCIdDecl)
8292 return Context.ObjCIdDecl;
8293 NewLoaded = Context.getObjCIdDecl();
8297 if (Context.ObjCSelDecl)
8298 return Context.ObjCSelDecl;
8299 NewLoaded = Context.getObjCSelDecl();
8303 if (Context.ObjCClassDecl)
8304 return Context.ObjCClassDecl;
8305 NewLoaded = Context.getObjCClassDecl();
8309 if (Context.ObjCProtocolClassDecl)
8310 return Context.ObjCProtocolClassDecl;
8311 NewLoaded = Context.getObjCProtocolDecl();
8315 if (Context.Int128Decl)
8316 return Context.Int128Decl;
8317 NewLoaded = Context.getInt128Decl();
8321 if (Context.UInt128Decl)
8322 return Context.UInt128Decl;
8323 NewLoaded = Context.getUInt128Decl();
8327 if (Context.ObjCInstanceTypeDecl)
8328 return Context.ObjCInstanceTypeDecl;
8329 NewLoaded = Context.getObjCInstanceTypeDecl();
8333 if (Context.BuiltinVaListDecl)
8334 return Context.BuiltinVaListDecl;
8335 NewLoaded = Context.getBuiltinVaListDecl();
8339 if (Context.VaListTagDecl)
8340 return Context.VaListTagDecl;
8341 NewLoaded = Context.getVaListTagDecl();
8345 if (Context.BuiltinMSVaListDecl)
8346 return Context.BuiltinMSVaListDecl;
8347 NewLoaded = Context.getBuiltinMSVaListDecl();
8352 return Context.getMSGuidTagDecl();
8355 if (Context.ExternCContext)
8356 return Context.ExternCContext;
8357 NewLoaded = Context.getExternCContextDecl();
8361 if (Context.CFConstantStringTypeDecl)
8362 return Context.CFConstantStringTypeDecl;
8363 NewLoaded = Context.getCFConstantStringDecl();
8367 if (Context.CFConstantStringTagDecl)
8368 return Context.CFConstantStringTagDecl;
8369 NewLoaded = Context.getCFConstantStringTagDecl();
8373 return Context.getMSTypeInfoTagDecl();
8375#define BuiltinTemplate(BTName) \
8376 case PREDEF_DECL##BTName##_ID: \
8377 if (Context.Decl##BTName) \
8378 return Context.Decl##BTName; \
8379 NewLoaded = Context.get##BTName##Decl(); \
8381#include "clang/Basic/BuiltinTemplates.inc"
8384 llvm_unreachable(
"Invalid decl ID");
8388 assert(NewLoaded &&
"Failed to load predefined decl?");
8390 if (DeserializationListener)
8391 DeserializationListener->PredefinedDeclBuilt(ID, NewLoaded);
8396unsigned ASTReader::translateGlobalDeclIDToIndex(GlobalDeclID GlobalID)
const {
8397 ModuleFile *OwningModuleFile = getOwningModuleFile(GlobalID);
8398 if (!OwningModuleFile) {
8407 assert(ContextObj &&
"reading decl with no AST context");
8416 Merged.push_back(ID);
8421 unsigned Index = translateGlobalDeclIDToIndex(ID);
8423 if (Index >= DeclsLoaded.size()) {
8424 assert(0 &&
"declaration ID out-of-range for AST file");
8425 Error(
"declaration ID out-of-range for AST file");
8429 return DeclsLoaded[Index];
8436 unsigned Index = translateGlobalDeclIDToIndex(ID);
8438 if (Index >= DeclsLoaded.size()) {
8439 assert(0 &&
"declaration ID out-of-range for AST file");
8440 Error(
"declaration ID out-of-range for AST file");
8444 if (!DeclsLoaded[Index]) {
8446 if (DeserializationListener)
8447 DeserializationListener->DeclRead(ID, DeclsLoaded[Index]);
8450 return DeclsLoaded[Index];
8459 ReadModuleOffsetMap(M);
8469 uint64_t OrignalModuleFileIndex = 0;
8472 OrignalModuleFileIndex = I + 1;
8476 if (!OrignalModuleFileIndex)
8484 if (Idx >=
Record.size()) {
8485 Error(
"Corrupted AST file");
8502 RecordLocation Loc = getLocalBitOffset(Offset);
8503 if (llvm::Error Err = Loc.F->
DeclsCursor.JumpToBit(Loc.Offset)) {
8504 Error(std::move(Err));
8507 assert(NumCurrentElementsDeserializing == 0 &&
8508 "should not be called while already deserializing");
8510 return ReadStmtFromStream(*Loc.F);
8513bool ASTReader::LoadExternalSpecializationsImpl(SpecLookupTableTy &SpecLookups,
8517 auto It = SpecLookups.find(D);
8518 if (It == SpecLookups.end())
8524 It->second.Table.findAll();
8528 SpecLookups.erase(It);
8530 bool NewSpecsFound =
false;
8531 Deserializing LookupResults(
this);
8532 for (
auto &Info : Infos) {
8533 if (GetExistingDecl(Info))
8535 NewSpecsFound =
true;
8539 return NewSpecsFound;
8546 bool NewSpecsFound =
8547 LoadExternalSpecializationsImpl(PartialSpecializationsLookups, D);
8549 return NewSpecsFound;
8551 NewSpecsFound |= LoadExternalSpecializationsImpl(SpecializationsLookups, D);
8552 return NewSpecsFound;
8555bool ASTReader::LoadExternalSpecializationsImpl(
8556 SpecLookupTableTy &SpecLookups,
const Decl *D,
8561 if (
auto It = SpecLookups.find(D); It != SpecLookups.end())
8562 LookupTable = &It->getSecond();
8568 llvm::TimeTraceScope TimeScope(
"Load External Specializations for ", [&] {
8570 llvm::raw_string_ostream OS(Name);
8572 ND->getNameForDiagnostic(OS, ND->getASTContext().getPrintingPolicy(),
8577 Deserializing LookupResults(
this);
8582 LookupTable->
Table.find(HashValue);
8584 bool NewSpecsFound =
false;
8585 for (
auto &Info : Infos) {
8586 if (GetExistingDecl(Info))
8588 NewSpecsFound =
true;
8592 return NewSpecsFound;
8599 bool NewDeclsFound = LoadExternalSpecializationsImpl(
8600 PartialSpecializationsLookups, D, TemplateArgs);
8602 LoadExternalSpecializationsImpl(SpecializationsLookups, D, TemplateArgs);
8604 return NewDeclsFound;
8612 auto Visit = [&] (
ModuleFile *M, LexicalContents LexicalDecls) {
8613 assert(LexicalDecls.size() % 2 == 0 &&
"expected an even number of entries");
8614 for (
int I = 0, N = LexicalDecls.size(); I != N; I += 2) {
8616 if (!IsKindWeWant(K))
8619 auto ID = (
DeclID) + LexicalDecls[I + 1];
8624 if (PredefsVisited[ID])
8627 PredefsVisited[ID] =
true;
8631 assert(D->
getKind() == K &&
"wrong kind for lexical decl");
8639 for (
const auto &Lexical : TULexicalDecls)
8640 Visit(Lexical.first, Lexical.second);
8642 auto I = LexicalDecls.find(DC);
8643 if (I != LexicalDecls.end())
8644 Visit(I->second.first, I->second.second);
8647 ++NumLexicalDeclContextsRead;
8652class UnalignedDeclIDComp {
8658 : Reader(Reader), Mod(M) {}
8667 SourceLocation RHS = getLocation(R);
8672 SourceLocation LHS = getLocation(L);
8686 unsigned Offset,
unsigned Length,
8690 llvm::DenseMap<FileID, FileDeclsInfo>::iterator I = FileDeclIDs.find(
File);
8691 if (I == FileDeclIDs.end())
8694 FileDeclsInfo &DInfo = I->second;
8695 if (DInfo.Decls.empty())
8699 BeginLoc =
SM.getLocForStartOfFile(
File).getLocWithOffset(Offset);
8702 UnalignedDeclIDComp DIDComp(*
this, *DInfo.Mod);
8704 llvm::lower_bound(DInfo.Decls, BeginLoc, DIDComp);
8705 if (BeginIt != DInfo.Decls.begin())
8711 while (BeginIt != DInfo.Decls.begin() &&
8714 ->isTopLevelDeclInObjCContainer())
8718 llvm::upper_bound(DInfo.Decls, EndLoc, DIDComp);
8719 if (EndIt != DInfo.Decls.end())
8732 "DeclContext has no visible decls in storage");
8740 auto Find = [&,
this](
auto &&Table,
auto &&Key) {
8744 Decls.push_back(ND);
8752 if (
auto It = Lookups.find(DC); It != Lookups.end()) {
8753 ++NumVisibleDeclContextsRead;
8754 Find(It->second.Table, Name);
8757 auto FindModuleLocalLookup = [&,
this](
Module *NamedModule) {
8758 if (
auto It = ModuleLocalLookups.find(DC); It != ModuleLocalLookups.end()) {
8759 ++NumModuleLocalVisibleDeclContexts;
8760 Find(It->second.Table, std::make_pair(Name, NamedModule));
8763 if (
auto *NamedModule =
8764 OriginalDC ?
cast<Decl>(OriginalDC)->getTopLevelOwningNamedModule()
8766 FindModuleLocalLookup(NamedModule);
8771 if (ContextObj && ContextObj->getCurrentNamedModule())
8772 FindModuleLocalLookup(ContextObj->getCurrentNamedModule());
8774 if (
auto It = TULocalLookups.find(DC); It != TULocalLookups.end()) {
8775 ++NumTULocalVisibleDeclContexts;
8776 Find(It->second.Table, Name);
8780 return !Decls.empty();
8789 auto findAll = [&](
auto &LookupTables,
unsigned &NumRead) {
8790 auto It = LookupTables.find(DC);
8791 if (It == LookupTables.end())
8804 findAll(Lookups, NumVisibleDeclContextsRead);
8805 findAll(ModuleLocalLookups, NumModuleLocalVisibleDeclContexts);
8806 findAll(TULocalLookups, NumTULocalVisibleDeclContexts);
8808 for (DeclsMap::iterator I = Decls.begin(), E = Decls.end(); I != E; ++I) {
8811 const_cast<DeclContext *
>(DC)->setHasExternalVisibleStorage(
false);
8816 auto I = Lookups.find(Primary);
8817 return I == Lookups.end() ?
nullptr : &I->second;
8822 auto I = ModuleLocalLookups.find(Primary);
8823 return I == ModuleLocalLookups.end() ?
nullptr : &I->second;
8828 auto I = TULocalLookups.find(Primary);
8829 return I == TULocalLookups.end() ?
nullptr : &I->second;
8836 IsPartial ? PartialSpecializationsLookups : SpecializationsLookups;
8837 auto I = LookupTable.find(D);
8838 return I == LookupTable.end() ?
nullptr : &I->second;
8843 return PartialSpecializationsLookups.contains(D) ||
8844 SpecializationsLookups.contains(D);
8853 assert(ImplD && Consumer);
8855 for (
auto *I : ImplD->
methods())
8861void ASTReader::PassInterestingDeclToConsumer(Decl *D) {
8862 if (ObjCImplDecl *ImplD = dyn_cast<ObjCImplDecl>(D))
8865 Consumer->HandleInterestingDecl(DeclGroupRef(D));
8868void ASTReader::PassVTableToConsumer(CXXRecordDecl *RD) {
8869 Consumer->HandleVTable(RD);
8873 this->Consumer = Consumer;
8876 PassInterestingDeclsToConsumer();
8878 if (DeserializationListener)
8879 DeserializationListener->ReaderInitialized(
this);
8883 std::fprintf(
stderr,
"*** AST File Statistics:\n");
8885 unsigned NumTypesLoaded =
8886 TypesLoaded.size() - llvm::count(TypesLoaded.materialized(),
QualType());
8887 unsigned NumDeclsLoaded =
8888 DeclsLoaded.size() -
8889 llvm::count(DeclsLoaded.materialized(), (
Decl *)
nullptr);
8890 unsigned NumIdentifiersLoaded =
8891 IdentifiersLoaded.size() -
8893 unsigned NumMacrosLoaded =
8894 MacrosLoaded.size() - llvm::count(MacrosLoaded, (
MacroInfo *)
nullptr);
8895 unsigned NumSelectorsLoaded =
8896 SelectorsLoaded.size() - llvm::count(SelectorsLoaded,
Selector());
8899 std::fprintf(
stderr,
" %u/%u source location entries read (%f%%)\n",
8900 NumSLocEntriesRead, TotalNumSLocEntries,
8901 ((
float)NumSLocEntriesRead/TotalNumSLocEntries * 100));
8902 if (!TypesLoaded.empty())
8903 std::fprintf(
stderr,
" %u/%u types read (%f%%)\n",
8904 NumTypesLoaded, (
unsigned)TypesLoaded.size(),
8905 ((
float)NumTypesLoaded/TypesLoaded.size() * 100));
8906 if (!DeclsLoaded.empty())
8907 std::fprintf(
stderr,
" %u/%u declarations read (%f%%)\n",
8908 NumDeclsLoaded, (
unsigned)DeclsLoaded.size(),
8909 ((
float)NumDeclsLoaded/DeclsLoaded.size() * 100));
8910 if (!IdentifiersLoaded.empty())
8911 std::fprintf(
stderr,
" %u/%u identifiers read (%f%%)\n",
8912 NumIdentifiersLoaded, (
unsigned)IdentifiersLoaded.size(),
8913 ((
float)NumIdentifiersLoaded/IdentifiersLoaded.size() * 100));
8914 if (!MacrosLoaded.empty())
8915 std::fprintf(
stderr,
" %u/%u macros read (%f%%)\n",
8916 NumMacrosLoaded, (
unsigned)MacrosLoaded.size(),
8917 ((
float)NumMacrosLoaded/MacrosLoaded.size() * 100));
8918 if (!SelectorsLoaded.empty())
8919 std::fprintf(
stderr,
" %u/%u selectors read (%f%%)\n",
8920 NumSelectorsLoaded, (
unsigned)SelectorsLoaded.size(),
8921 ((
float)NumSelectorsLoaded/SelectorsLoaded.size() * 100));
8922 if (TotalNumStatements)
8923 std::fprintf(
stderr,
" %u/%u statements read (%f%%)\n",
8924 NumStatementsRead, TotalNumStatements,
8925 ((
float)NumStatementsRead/TotalNumStatements * 100));
8927 std::fprintf(
stderr,
" %u/%u macros read (%f%%)\n",
8928 NumMacrosRead, TotalNumMacros,
8929 ((
float)NumMacrosRead/TotalNumMacros * 100));
8930 if (TotalLexicalDeclContexts)
8931 std::fprintf(
stderr,
" %u/%u lexical declcontexts read (%f%%)\n",
8932 NumLexicalDeclContextsRead, TotalLexicalDeclContexts,
8933 ((
float)NumLexicalDeclContextsRead/TotalLexicalDeclContexts
8935 if (TotalVisibleDeclContexts)
8936 std::fprintf(
stderr,
" %u/%u visible declcontexts read (%f%%)\n",
8937 NumVisibleDeclContextsRead, TotalVisibleDeclContexts,
8938 ((
float)NumVisibleDeclContextsRead/TotalVisibleDeclContexts
8940 if (TotalModuleLocalVisibleDeclContexts)
8942 stderr,
" %u/%u module local visible declcontexts read (%f%%)\n",
8943 NumModuleLocalVisibleDeclContexts, TotalModuleLocalVisibleDeclContexts,
8944 ((
float)NumModuleLocalVisibleDeclContexts /
8945 TotalModuleLocalVisibleDeclContexts * 100));
8946 if (TotalTULocalVisibleDeclContexts)
8947 std::fprintf(
stderr,
" %u/%u visible declcontexts in GMF read (%f%%)\n",
8948 NumTULocalVisibleDeclContexts, TotalTULocalVisibleDeclContexts,
8949 ((
float)NumTULocalVisibleDeclContexts /
8950 TotalTULocalVisibleDeclContexts * 100));
8951 if (TotalNumMethodPoolEntries)
8952 std::fprintf(
stderr,
" %u/%u method pool entries read (%f%%)\n",
8953 NumMethodPoolEntriesRead, TotalNumMethodPoolEntries,
8954 ((
float)NumMethodPoolEntriesRead/TotalNumMethodPoolEntries
8956 if (NumMethodPoolLookups)
8957 std::fprintf(
stderr,
" %u/%u method pool lookups succeeded (%f%%)\n",
8958 NumMethodPoolHits, NumMethodPoolLookups,
8959 ((
float)NumMethodPoolHits/NumMethodPoolLookups * 100.0));
8960 if (NumMethodPoolTableLookups)
8961 std::fprintf(
stderr,
" %u/%u method pool table lookups succeeded (%f%%)\n",
8962 NumMethodPoolTableHits, NumMethodPoolTableLookups,
8963 ((
float)NumMethodPoolTableHits/NumMethodPoolTableLookups
8965 if (NumIdentifierLookupHits)
8967 " %u / %u identifier table lookups succeeded (%f%%)\n",
8968 NumIdentifierLookupHits, NumIdentifierLookups,
8969 (
double)NumIdentifierLookupHits*100.0/NumIdentifierLookups);
8972 std::fprintf(
stderr,
"\n");
8973 GlobalIndex->printStats();
8976 std::fprintf(
stderr,
"\n");
8978 std::fprintf(
stderr,
"\n");
8981template<
typename Key,
typename ModuleFile,
unsigned InitialCapacity>
8982LLVM_DUMP_METHOD
static void
8985 InitialCapacity> &Map) {
8986 if (Map.begin() == Map.end())
8991 llvm::errs() << Name <<
":\n";
8992 for (
typename MapType::const_iterator I = Map.begin(), IEnd = Map.end();
8994 llvm::errs() <<
" " << (
DeclID)I->first <<
" -> " << I->second->FileName
8999 llvm::errs() <<
"*** PCH/ModuleFile Remappings:\n";
9001 dumpModuleIDMap(
"Global source location entry map", GlobalSLocEntryMap);
9005 GlobalPreprocessedEntityMap);
9007 llvm::errs() <<
"\n*** PCH/Modules Loaded:";
9016 if (llvm::MemoryBuffer *buf = I.Buffer) {
9017 size_t bytes = buf->getBufferSize();
9018 switch (buf->getBufferKind()) {
9019 case llvm::MemoryBuffer::MemoryBuffer_Malloc:
9022 case llvm::MemoryBuffer::MemoryBuffer_MMap:
9043 if (!FPPragmaOptions.empty()) {
9044 assert(FPPragmaOptions.size() == 1 &&
"Wrong number of FP_PRAGMA_OPTIONS");
9047 SemaObj->CurFPFeatures =
9053 if (
auto *FD = dyn_cast<FunctionDecl>(D))
9054 SemaObj->addDeclWithEffects(FD, FD->getFunctionEffects());
9055 else if (
auto *BD = dyn_cast<BlockDecl>(D))
9056 SemaObj->addDeclWithEffects(BD, BD->getFunctionEffects());
9058 llvm_unreachable(
"unexpected Decl type in DeclsWithEffectsToVerify");
9060 DeclsWithEffectsToVerify.clear();
9062 SemaObj->OpenCLFeatures = OpenCLExtensions;
9068 assert(SemaObj &&
"no Sema to update");
9072 if (!SemaDeclRefs.empty()) {
9073 assert(SemaDeclRefs.size() % 3 == 0);
9074 for (
unsigned I = 0; I != SemaDeclRefs.size(); I += 3) {
9075 if (!SemaObj->StdNamespace)
9076 SemaObj->StdNamespace = SemaDeclRefs[I].getRawValue();
9077 if (!SemaObj->StdBadAlloc)
9078 SemaObj->StdBadAlloc = SemaDeclRefs[I + 1].getRawValue();
9079 if (!SemaObj->StdAlignValT)
9080 SemaObj->StdAlignValT = SemaDeclRefs[I + 2].getRawValue();
9082 SemaDeclRefs.clear();
9087 if(OptimizeOffPragmaLocation.isValid())
9088 SemaObj->ActOnPragmaOptimize(
false, OptimizeOffPragmaLocation);
9089 if (PragmaMSStructState != -1)
9091 if (PointersToMembersPragmaLocation.isValid()) {
9092 SemaObj->ActOnPragmaMSPointersToMembers(
9094 PragmaMSPointersToMembersState,
9095 PointersToMembersPragmaLocation);
9097 SemaObj->CUDA().ForceHostDeviceDepth = ForceHostDeviceDepth;
9098 if (!RISCVVecIntrinsicPragma.empty()) {
9099 assert(RISCVVecIntrinsicPragma.size() == 3 &&
9100 "Wrong number of RISCVVecIntrinsicPragma");
9101 SemaObj->RISCV().DeclareRVVBuiltins = RISCVVecIntrinsicPragma[0];
9102 SemaObj->RISCV().DeclareSiFiveVectorBuiltins = RISCVVecIntrinsicPragma[1];
9103 SemaObj->RISCV().DeclareAndesVectorBuiltins = RISCVVecIntrinsicPragma[2];
9106 if (PragmaAlignPackCurrentValue) {
9110 bool DropFirst =
false;
9111 if (!PragmaAlignPackStack.empty() &&
9112 PragmaAlignPackStack.front().Location.isInvalid()) {
9113 assert(PragmaAlignPackStack.front().Value ==
9114 SemaObj->AlignPackStack.DefaultValue &&
9115 "Expected a default alignment value");
9116 SemaObj->AlignPackStack.Stack.emplace_back(
9117 PragmaAlignPackStack.front().SlotLabel,
9118 SemaObj->AlignPackStack.CurrentValue,
9119 SemaObj->AlignPackStack.CurrentPragmaLocation,
9120 PragmaAlignPackStack.front().PushLocation);
9123 for (
const auto &Entry :
9124 llvm::ArrayRef(PragmaAlignPackStack).drop_front(DropFirst ? 1 : 0)) {
9125 SemaObj->AlignPackStack.Stack.emplace_back(
9126 Entry.SlotLabel, Entry.Value, Entry.Location, Entry.PushLocation);
9128 if (PragmaAlignPackCurrentLocation.isInvalid()) {
9129 assert(*PragmaAlignPackCurrentValue ==
9130 SemaObj->AlignPackStack.DefaultValue &&
9131 "Expected a default align and pack value");
9134 SemaObj->AlignPackStack.CurrentValue = *PragmaAlignPackCurrentValue;
9135 SemaObj->AlignPackStack.CurrentPragmaLocation =
9136 PragmaAlignPackCurrentLocation;
9139 if (FpPragmaCurrentValue) {
9143 bool DropFirst =
false;
9144 if (!FpPragmaStack.empty() && FpPragmaStack.front().Location.isInvalid()) {
9145 assert(FpPragmaStack.front().Value ==
9146 SemaObj->FpPragmaStack.DefaultValue &&
9147 "Expected a default pragma float_control value");
9148 SemaObj->FpPragmaStack.Stack.emplace_back(
9149 FpPragmaStack.front().SlotLabel, SemaObj->FpPragmaStack.CurrentValue,
9150 SemaObj->FpPragmaStack.CurrentPragmaLocation,
9151 FpPragmaStack.front().PushLocation);
9154 for (
const auto &Entry :
9156 SemaObj->FpPragmaStack.Stack.emplace_back(
9157 Entry.SlotLabel, Entry.Value, Entry.Location, Entry.PushLocation);
9158 if (FpPragmaCurrentLocation.isInvalid()) {
9159 assert(*FpPragmaCurrentValue == SemaObj->FpPragmaStack.DefaultValue &&
9160 "Expected a default pragma float_control value");
9163 SemaObj->FpPragmaStack.CurrentValue = *FpPragmaCurrentValue;
9164 SemaObj->FpPragmaStack.CurrentPragmaLocation = FpPragmaCurrentLocation;
9169 for (
auto &Import : PendingImportedModulesSema) {
9170 if (Import.ImportLoc.isInvalid())
9173 SemaObj->makeModuleVisible(Imported, Import.ImportLoc);
9176 PendingImportedModulesSema.clear();
9183 IdentifierLookupVisitor Visitor(Name, 0,
9184 NumIdentifierLookups,
9185 NumIdentifierLookupHits);
9191 if (PP.getLangOpts().CPlusPlus) {
9192 for (
auto *F : ModuleMgr.pch_modules())
9201 if (GlobalIndex->lookupIdentifier(Name, Hits)) {
9206 ModuleMgr.visit(Visitor, HitsPtr);
9228 ASTIdentifierLookupTable::key_iterator Current;
9232 ASTIdentifierLookupTable::key_iterator End;
9239 bool SkipModules =
false);
9241 StringRef
Next()
override;
9248 : Reader(Reader), Index(Reader.ModuleMgr.size()), SkipModules(SkipModules) {
9252 while (Current == End) {
9264 Current = IdTable->key_begin();
9265 End = IdTable->key_end();
9270 StringRef
Result = *Current;
9279 std::unique_ptr<IdentifierIterator> Current;
9280 std::unique_ptr<IdentifierIterator> Queued;
9283 ChainedIdentifierIterator(std::unique_ptr<IdentifierIterator>
First,
9284 std::unique_ptr<IdentifierIterator> Second)
9285 : Current(
std::move(
First)), Queued(
std::move(Second)) {}
9287 StringRef
Next()
override {
9291 StringRef result = Current->Next();
9292 if (!result.empty())
9297 std::swap(Current, Queued);
9306 std::unique_ptr<IdentifierIterator> ReaderIter(
9308 std::unique_ptr<IdentifierIterator> ModulesIter(
9309 GlobalIndex->createIdentifierIterator());
9310 return new ChainedIdentifierIterator(std::move(ReaderIter),
9311 std::move(ModulesIter));
9323 unsigned PriorGeneration;
9324 unsigned InstanceBits = 0;
9325 unsigned FactoryBits = 0;
9326 bool InstanceHasMoreThanOneDecl =
false;
9327 bool FactoryHasMoreThanOneDecl =
false;
9333 unsigned PriorGeneration)
9334 : Reader(Reader), Sel(Sel), PriorGeneration(PriorGeneration) {}
9344 ++Reader.NumMethodPoolTableLookups;
9347 ASTSelectorLookupTable::iterator Pos = PoolTable->find(Sel);
9348 if (Pos == PoolTable->end())
9351 ++Reader.NumMethodPoolTableHits;
9352 ++Reader.NumSelectorsRead;
9356 ++Reader.NumMethodPoolEntriesRead;
9358 if (Reader.DeserializationListener)
9359 Reader.DeserializationListener->SelectorRead(
Data.ID, Sel);
9364 InstanceMethods.append(
Data.Instance.rbegin(),
Data.Instance.rend());
9365 FactoryMethods.append(
Data.Factory.rbegin(),
Data.Factory.rend());
9366 InstanceBits =
Data.InstanceBits;
9367 FactoryBits =
Data.FactoryBits;
9368 InstanceHasMoreThanOneDecl =
Data.InstanceHasMoreThanOneDecl;
9369 FactoryHasMoreThanOneDecl =
Data.FactoryHasMoreThanOneDecl;
9375 return InstanceMethods;
9380 return FactoryMethods;
9387 return InstanceHasMoreThanOneDecl;
9405 unsigned &Generation = SelectorGeneration[Sel];
9406 unsigned PriorGeneration = Generation;
9408 SelectorOutOfDate[Sel] =
false;
9411 ++NumMethodPoolLookups;
9413 ModuleMgr.visit(Visitor);
9419 ++NumMethodPoolHits;
9440 if (SelectorOutOfDate[Sel])
9448 for (
unsigned I = 0, N = KnownNamespaces.size(); I != N; ++I) {
9450 = dyn_cast_or_null<NamespaceDecl>(
GetDecl(KnownNamespaces[I])))
9451 Namespaces.push_back(Namespace);
9456 llvm::MapVector<NamedDecl *, SourceLocation> &
Undefined) {
9457 for (
unsigned Idx = 0, N = UndefinedButUsed.size(); Idx != N;) {
9458 UndefinedButUsedDecl &
U = UndefinedButUsed[Idx++];
9461 Undefined.insert(std::make_pair(D, Loc));
9463 UndefinedButUsed.clear();
9469 for (
unsigned Idx = 0, N = DelayedDeleteExprs.size(); Idx != N;) {
9472 uint64_t Count = DelayedDeleteExprs[Idx++];
9473 for (uint64_t
C = 0;
C < Count; ++
C) {
9476 const bool IsArrayForm = DelayedDeleteExprs[Idx++];
9477 Exprs[FD].push_back(std::make_pair(DeleteLoc, IsArrayForm));
9484 for (
unsigned I = 0, N = TentativeDefinitions.size(); I != N; ++I) {
9485 VarDecl *Var = dyn_cast_or_null<VarDecl>(
GetDecl(TentativeDefinitions[I]));
9487 TentativeDefs.push_back(Var);
9489 TentativeDefinitions.clear();
9494 for (
unsigned I = 0, N = UnusedFileScopedDecls.size(); I != N; ++I) {
9496 = dyn_cast_or_null<DeclaratorDecl>(
GetDecl(UnusedFileScopedDecls[I]));
9500 UnusedFileScopedDecls.clear();
9505 for (
unsigned I = 0, N = DelegatingCtorDecls.size(); I != N; ++I) {
9507 = dyn_cast_or_null<CXXConstructorDecl>(
GetDecl(DelegatingCtorDecls[I]));
9511 DelegatingCtorDecls.clear();
9515 for (
unsigned I = 0, N = ExtVectorDecls.size(); I != N; ++I) {
9517 = dyn_cast_or_null<TypedefNameDecl>(
GetDecl(ExtVectorDecls[I]));
9521 ExtVectorDecls.clear();
9526 for (
unsigned I = 0, N = UnusedLocalTypedefNameCandidates.size(); I != N;
9529 GetDecl(UnusedLocalTypedefNameCandidates[I]));
9533 UnusedLocalTypedefNameCandidates.clear();
9538 for (
auto I : DeclsToCheckForDeferredDiags) {
9539 auto *D = dyn_cast_or_null<Decl>(
GetDecl(I));
9543 DeclsToCheckForDeferredDiags.clear();
9548 if (ReferencedSelectorsData.empty())
9553 unsigned int DataSize = ReferencedSelectorsData.size()-1;
9555 while (I < DataSize) {
9559 Sels.push_back(std::make_pair(Sel, SelLoc));
9561 ReferencedSelectorsData.clear();
9566 if (WeakUndeclaredIdentifiers.empty())
9569 for (
unsigned I = 0, N = WeakUndeclaredIdentifiers.size(); I < N; ) {
9577 WeakIDs.push_back(std::make_pair(WeakId, WI));
9579 WeakUndeclaredIdentifiers.clear();
9583 for (
unsigned Idx = 0, N = VTableUses.size(); Idx < N; ) {
9585 VTableUse &TableInfo = VTableUses[Idx++];
9586 VT.
Record = dyn_cast_or_null<CXXRecordDecl>(
GetDecl(TableInfo.ID));
9589 VTables.push_back(VT);
9597 for (
unsigned Idx = 0, N = PendingInstantiations.size(); Idx < N;) {
9598 PendingInstantiation &Inst = PendingInstantiations[Idx++];
9602 Pending.push_back(std::make_pair(D, Loc));
9604 PendingInstantiations.clear();
9608 llvm::MapVector<
const FunctionDecl *, std::unique_ptr<LateParsedTemplate>>
9610 for (
auto &LPT : LateParsedTemplates) {
9613 for (
unsigned Idx = 0, N = LateParsed.size(); Idx < N;
9617 auto LT = std::make_unique<LateParsedTemplate>();
9618 LT->D =
ReadDecl(*FMod, LateParsed, Idx);
9622 assert(F &&
"No module");
9624 unsigned TokN = LateParsed[Idx++];
9625 LT->Toks.reserve(TokN);
9626 for (
unsigned T = 0;
T < TokN; ++
T)
9627 LT->Toks.push_back(
ReadToken(*F, LateParsed, Idx));
9629 LPTMap.insert(std::make_pair(FD, std::move(LT)));
9633 LateParsedTemplates.clear();
9645 if (
auto Iter = LambdaDeclarationsForMerging.find(LambdaInfo);
9646 Iter != LambdaDeclarationsForMerging.end() &&
9647 Iter->second->isFromASTFile() && Lambda->
getFirstDecl() == Lambda) {
9656 LambdaDeclarationsForMerging.insert({LambdaInfo, Lambda});
9665 assert(ID &&
"Non-zero identifier ID required");
9666 unsigned Index = translateIdentifierIDToIndex(ID).second;
9667 assert(Index < IdentifiersLoaded.size() &&
"identifier ID out of range");
9668 IdentifiersLoaded[Index] = II;
9669 if (DeserializationListener)
9670 DeserializationListener->IdentifierRead(ID, II);
9692 if (NumCurrentElementsDeserializing && !Decls) {
9693 PendingIdentifierInfos[II].append(DeclIDs.begin(), DeclIDs.end());
9697 for (
unsigned I = 0, N = DeclIDs.size(); I != N; ++I) {
9710 Decls->push_back(D);
9717 pushExternalDeclIntoScope(D, II);
9721std::pair<ModuleFile *, unsigned>
9722ASTReader::translateIdentifierIDToIndex(
IdentifierID ID)
const {
9724 return {
nullptr, 0};
9726 unsigned ModuleFileIndex = ID >> 32;
9727 unsigned LocalID = ID & llvm::maskTrailingOnes<IdentifierID>(32);
9729 assert(ModuleFileIndex &&
"not translating loaded IdentifierID?");
9741 if (IdentifiersLoaded.empty()) {
9742 Error(
"no identifier table in AST file");
9746 auto [M, Index] = translateIdentifierIDToIndex(ID);
9747 if (!IdentifiersLoaded[Index]) {
9748 assert(M !=
nullptr &&
"Untranslated Identifier ID?");
9751 const unsigned char *
Data =
9757 auto &II = PP.getIdentifierTable().get(Key);
9758 IdentifiersLoaded[Index] = &II;
9761 if (DeserializationListener)
9762 DeserializationListener->IdentifierRead(ID, &II);
9765 return IdentifiersLoaded[Index];
9777 ReadModuleOffsetMap(M);
9779 unsigned ModuleFileIndex = LocalID >> 32;
9780 LocalID &= llvm::maskTrailingOnes<IdentifierID>(32);
9783 assert(MF &&
"malformed identifier ID encoding?");
9785 if (!ModuleFileIndex)
9791std::pair<ModuleFile *, unsigned>
9792ASTReader::translateMacroIDToIndex(
MacroID ID)
const {
9794 return {
nullptr, 0};
9796 unsigned ModuleFileIndex = ID >> 32;
9797 assert(ModuleFileIndex &&
"not translating loaded MacroID?");
9801 unsigned LocalID = ID & llvm::maskTrailingOnes<MacroID>(32);
9810 if (MacrosLoaded.empty()) {
9811 Error(
"no macro table in AST file");
9815 auto [M, Index] = translateMacroIDToIndex(ID);
9816 if (!MacrosLoaded[Index]) {
9817 assert(M !=
nullptr &&
"Untranslated Macro ID?");
9823 if (DeserializationListener)
9824 DeserializationListener->MacroRead(ID, MacrosLoaded[Index]);
9827 return MacrosLoaded[Index];
9835 ReadModuleOffsetMap(M);
9837 unsigned ModuleFileIndex = LocalID >> 32;
9838 LocalID &= llvm::maskTrailingOnes<MacroID>(32);
9841 assert(MF &&
"malformed identifier ID encoding?");
9843 if (!ModuleFileIndex) {
9848 return (
static_cast<MacroID>(MF->
Index + 1) << 32) | LocalID;
9857 ReadModuleOffsetMap(M);
9862 &&
"Invalid index into submodule index remap");
9864 return LocalID + I->second;
9869 assert(GlobalID == 0 &&
"Unhandled global submodule ID");
9873 if (GlobalID > SubmodulesLoaded.size()) {
9874 Error(
"submodule ID out of range in AST file");
9889 return I == GlobalSubmoduleMap.end() ?
nullptr : I->second;
9892 int IndexFromEnd =
static_cast<int>(ID >> 1);
9893 assert(IndexFromEnd &&
"got reference to unknown module file");
9910 auto I = llvm::find(PCHModules, M);
9911 assert(I != PCHModules.end() &&
"emitting reference to unknown file");
9912 return std::distance(I, PCHModules.end()) << 1;
9921 const auto &PCHChain = ModuleMgr.pch_modules();
9922 if (std::distance(std::begin(PCHChain), std::end(PCHChain))) {
9923 ModuleFile &MF = ModuleMgr.getPrimaryModule();
9927 llvm::sys::path::parent_path(MF.
FileName),
9930 return std::nullopt;
9934 auto I = DefinitionSource.find(FD);
9935 if (I == DefinitionSource.end())
9941 return ThisDeclarationWasADefinitionSet.contains(FD);
9952 if (ID > SelectorsLoaded.size()) {
9953 Error(
"selector ID out of range in AST file");
9957 if (SelectorsLoaded[ID - 1].getAsOpaquePtr() ==
nullptr) {
9960 assert(I != GlobalSelectorMap.end() &&
"Corrupted global selector map");
9964 SelectorsLoaded[ID - 1] =
9966 if (DeserializationListener)
9967 DeserializationListener->SelectorRead(ID, SelectorsLoaded[ID - 1]);
9970 return SelectorsLoaded[ID - 1];
9988 ReadModuleOffsetMap(M);
9993 &&
"Invalid index into selector index remap");
9995 return LocalID + I->second;
10026 NameInfo.
setName(readDeclarationName());
10040 SpirvOperand Op(SpirvOperand::SpirvOperandKind(Kind), ResultType,
Value);
10041 assert(Op.isValid());
10047 unsigned NumTPLists =
readInt();
10052 for (
unsigned i = 0; i != NumTPLists; ++i)
10063 unsigned NumParams =
readInt();
10065 Params.reserve(NumParams);
10066 while (NumParams--)
10069 bool HasRequiresClause =
readBool();
10070 Expr *RequiresClause = HasRequiresClause ?
readExpr() :
nullptr;
10073 getContext(), TemplateLoc, LAngleLoc, Params, RAngleLoc, RequiresClause);
10074 return TemplateParams;
10079 bool Canonicalize) {
10080 unsigned NumTemplateArgs =
readInt();
10081 TemplArgs.reserve(NumTemplateArgs);
10082 while (NumTemplateArgs--)
10088 unsigned NumDecls =
readInt();
10090 while (NumDecls--) {
10102 bool inheritConstructors =
readBool();
10108 Result.setInheritConstructors(inheritConstructors);
10115 unsigned NumInitializers =
readInt();
10116 assert(NumInitializers &&
"wrote ctor initializers but have no inits");
10118 for (
unsigned i = 0; i != NumInitializers; ++i) {
10120 bool IsBaseVirtual =
false;
10151 BOMInit =
new (Context)
10153 RParenLoc, MemberOrEllipsisLoc);
10155 BOMInit =
new (Context)
10158 BOMInit =
new (Context)
10162 BOMInit =
new (Context)
10164 LParenLoc,
Init, RParenLoc);
10167 unsigned SourceOrder =
readInt();
10171 CtorInitializers[i] = BOMInit;
10174 return CtorInitializers;
10182 for (
unsigned I = 0; I != N; ++I) {
10183 auto Kind = readNestedNameSpecifierKind();
10188 Builder.Extend(Context, NS, Range.getBegin(), Range.getEnd());
10197 Builder.Make(Context,
T->getTypeLoc(), ColonColonLoc);
10203 Builder.MakeGlobal(Context, ColonColonLoc);
10210 Builder.MakeMicrosoftSuper(Context, RD, Range.getBegin(), Range.getEnd());
10215 llvm_unreachable(
"unexpected null nested name specifier");
10230 const StringRef Blob) {
10231 unsigned Count =
Record[0];
10232 const char *Byte = Blob.data();
10233 llvm::BitVector Ret = llvm::BitVector(Count,
false);
10234 for (
unsigned I = 0; I < Count; ++Byte)
10235 for (
unsigned Bit = 0; Bit < 8 && I < Count; ++Bit, ++I)
10236 if (*Byte & (1 << Bit))
10243 return llvm::APFloat(Sem,
readAPInt());
10248 unsigned Len =
Record[Idx++];
10256 unsigned Len =
Record[Idx++];
10257 StringRef
Result = Blob.substr(0, Len);
10258 Blob = Blob.substr(Len);
10282 unsigned Major =
Record[Idx++];
10283 unsigned Minor =
Record[Idx++];
10284 unsigned Subminor =
Record[Idx++];
10286 return VersionTuple(Major);
10288 return VersionTuple(Major, Minor - 1);
10289 return VersionTuple(Major, Minor - 1, Subminor - 1);
10300 return Diag(CurrentImportLoc, DiagID);
10304 return Diags.Report(Loc, DiagID);
10308 llvm::function_ref<
void()> Fn) {
10311 SemaObj->runWithSufficientStackSpace(Loc, Fn);
10315 StackHandler.runWithSufficientStackSpace(Loc, Fn);
10321 return PP.getIdentifierTable();
10327 assert((*CurrSwitchCaseStmts)[ID] ==
nullptr &&
10328 "Already have a SwitchCase with this ID");
10329 (*CurrSwitchCaseStmts)[ID] = SC;
10334 assert((*CurrSwitchCaseStmts)[ID] !=
nullptr &&
"No SwitchCase with this ID");
10335 return (*CurrSwitchCaseStmts)[ID];
10339 CurrSwitchCaseStmts->clear();
10344 std::vector<RawComment *> Comments;
10351 BitstreamCursor &Cursor = I->first;
10358 Cursor.advanceSkippingSubblocks(
10359 BitstreamCursor::AF_DontPopBlockAtEnd);
10361 Error(MaybeEntry.takeError());
10364 llvm::BitstreamEntry Entry = MaybeEntry.get();
10366 switch (Entry.Kind) {
10367 case llvm::BitstreamEntry::SubBlock:
10368 case llvm::BitstreamEntry::Error:
10369 Error(
"malformed block record in AST file");
10371 case llvm::BitstreamEntry::EndBlock:
10373 case llvm::BitstreamEntry::Record:
10381 if (!MaybeComment) {
10382 Error(MaybeComment.takeError());
10391 bool IsTrailingComment =
Record[Idx++];
10392 bool IsAlmostTrailingComment =
Record[Idx++];
10393 Comments.push_back(
new (Context)
RawComment(
10394 SR, Kind, IsTrailingComment, IsAlmostTrailingComment));
10404 if (Loc.first.isValid())
10405 Context.Comments.OrderedComments[Loc.first].emplace(Loc.second,
C);
10418 assert(NumUserInputs <= NumInputs);
10419 unsigned N = IncludeSystem ? NumInputs : NumUserInputs;
10420 for (
unsigned I = 0; I < N; ++I) {
10421 bool IsSystem = I >= NumUserInputs;
10423 Visitor(IFI, IsSystem);
10428 bool IncludeSystem,
bool Complain,
10430 bool isSystem)> Visitor) {
10433 assert(NumUserInputs <= NumInputs);
10434 unsigned N = IncludeSystem ? NumInputs : NumUserInputs;
10435 for (
unsigned I = 0; I < N; ++I) {
10436 bool IsSystem = I >= NumUserInputs;
10437 InputFile IF = getInputFile(MF, I+1, Complain);
10438 Visitor(IF, IsSystem);
10446 for (
unsigned I = 0; I < NumInputs; ++I) {
10449 if (
auto FE = getInputFile(MF, I + 1).getFile())
10454void ASTReader::finishPendingActions() {
10455 while (!PendingIdentifierInfos.empty() ||
10456 !PendingDeducedFunctionTypes.empty() ||
10457 !PendingDeducedVarTypes.empty() || !PendingDeclChains.empty() ||
10458 !PendingMacroIDs.empty() || !PendingDeclContextInfos.empty() ||
10459 !PendingUpdateRecords.empty() ||
10460 !PendingObjCExtensionIvarRedeclarations.empty()) {
10463 using TopLevelDeclsMap =
10464 llvm::DenseMap<IdentifierInfo *, SmallVector<Decl *, 2>>;
10465 TopLevelDeclsMap TopLevelDecls;
10467 while (!PendingIdentifierInfos.empty()) {
10470 std::move(PendingIdentifierInfos.back().second);
10471 PendingIdentifierInfos.pop_back();
10478 for (
unsigned I = 0; I != PendingDeducedFunctionTypes.size(); ++I) {
10479 auto *FD = PendingDeducedFunctionTypes[I].first;
10480 FD->setType(
GetType(PendingDeducedFunctionTypes[I].second));
10482 if (
auto *DT = FD->getReturnType()->getContainedDeducedType()) {
10485 if (DT->isDeduced()) {
10486 PendingDeducedTypeUpdates.insert(
10487 {FD->getCanonicalDecl(), FD->getReturnType()});
10494 PendingUndeducedFunctionDecls.push_back(FD);
10498 PendingDeducedFunctionTypes.clear();
10502 for (
unsigned I = 0; I != PendingDeducedVarTypes.size(); ++I) {
10503 auto *VD = PendingDeducedVarTypes[I].first;
10504 VD->setType(
GetType(PendingDeducedVarTypes[I].second));
10506 PendingDeducedVarTypes.clear();
10509 for (
unsigned I = 0; I != PendingDeclChains.size(); ++I)
10510 loadPendingDeclChain(PendingDeclChains[I].first,
10511 PendingDeclChains[I].second);
10512 PendingDeclChains.clear();
10515 for (TopLevelDeclsMap::iterator TLD = TopLevelDecls.begin(),
10516 TLDEnd = TopLevelDecls.end(); TLD != TLDEnd; ++TLD) {
10517 IdentifierInfo *II = TLD->first;
10518 for (
unsigned I = 0, N = TLD->second.size(); I != N; ++I) {
10524 for (
unsigned I = 0; I != PendingMacroIDs.size(); ++I) {
10525 IdentifierInfo *II = PendingMacroIDs.begin()[I].first;
10526 SmallVector<PendingMacroInfo, 2> GlobalIDs;
10527 GlobalIDs.swap(PendingMacroIDs.begin()[I].second);
10529 for (
unsigned IDIdx = 0, NumIDs = GlobalIDs.size(); IDIdx != NumIDs;
10531 const PendingMacroInfo &Info = GlobalIDs[IDIdx];
10532 if (!Info.M->isModule())
10536 for (
unsigned IDIdx = 0, NumIDs = GlobalIDs.size(); IDIdx != NumIDs;
10538 const PendingMacroInfo &Info = GlobalIDs[IDIdx];
10539 if (Info.M->isModule())
10543 PendingMacroIDs.clear();
10547 while (!PendingDeclContextInfos.empty()) {
10548 PendingDeclContextInfo Info = PendingDeclContextInfos.front();
10549 PendingDeclContextInfos.pop_front();
10552 Info.D->setDeclContextsImpl(SemaDC, LexicalDC,
getContext());
10556 while (!PendingUpdateRecords.empty()) {
10557 auto Update = PendingUpdateRecords.pop_back_val();
10558 ReadingKindTracker ReadingKind(Read_Decl, *
this);
10559 loadDeclUpdateRecords(
Update);
10562 while (!PendingObjCExtensionIvarRedeclarations.empty()) {
10563 auto ExtensionsPair = PendingObjCExtensionIvarRedeclarations.back().first;
10564 auto DuplicateIvars =
10565 PendingObjCExtensionIvarRedeclarations.back().second;
10567 StructuralEquivalenceContext Ctx(
10568 ContextObj->getLangOpts(), ExtensionsPair.first->getASTContext(),
10569 ExtensionsPair.second->getASTContext(), NonEquivalentDecls,
10573 if (Ctx.IsEquivalent(ExtensionsPair.first, ExtensionsPair.second)) {
10575 for (
auto IvarPair : DuplicateIvars) {
10576 ObjCIvarDecl *Ivar = IvarPair.first, *PrevIvar = IvarPair.second;
10578 Ivar->setDeclContextsImpl(PrevIvar->getDeclContext(),
10584 ExtensionsPair.first->setInvalidDecl();
10585 ExtensionsPair.second->getClassInterface()
10587 ->setIvarList(
nullptr);
10589 for (
auto IvarPair : DuplicateIvars) {
10590 Diag(IvarPair.first->getLocation(),
10591 diag::err_duplicate_ivar_declaration)
10592 << IvarPair.first->getIdentifier();
10593 Diag(IvarPair.second->getLocation(), diag::note_previous_definition);
10596 PendingObjCExtensionIvarRedeclarations.pop_back();
10602 assert(PendingFakeDefinitionData.empty() &&
10603 "faked up a class definition but never saw the real one");
10609 for (Decl *D : PendingDefinitions) {
10610 if (TagDecl *TD = dyn_cast<TagDecl>(D)) {
10611 if (
auto *RD = dyn_cast<CXXRecordDecl>(TD)) {
10612 for (
auto *R = getMostRecentExistingDecl(RD); R;
10613 R = R->getPreviousDecl()) {
10616 "declaration thinks it's the definition but it isn't");
10624 if (
auto ID = dyn_cast<ObjCInterfaceDecl>(D)) {
10629 for (
auto *R = getMostRecentExistingDecl(ID); R; R = R->getPreviousDecl())
10635 if (
auto PD = dyn_cast<ObjCProtocolDecl>(D)) {
10636 for (
auto *R = getMostRecentExistingDecl(PD); R; R = R->getPreviousDecl())
10643 for (
auto *R = getMostRecentExistingDecl(RTD); R; R = R->getPreviousDecl())
10646 PendingDefinitions.clear();
10648 for (
auto [D,
Previous] : PendingWarningForDuplicatedDefsInModuleUnits) {
10649 auto hasDefinitionImpl = [
this](
Decl *D,
auto hasDefinitionImpl) {
10650 if (
auto *VD = dyn_cast<VarDecl>(D))
10651 return VD->isThisDeclarationADefinition() ||
10652 VD->isThisDeclarationADemotedDefinition();
10654 if (
auto *TD = dyn_cast<TagDecl>(D))
10655 return TD->isThisDeclarationADefinition() ||
10656 TD->isThisDeclarationADemotedDefinition();
10658 if (
auto *FD = dyn_cast<FunctionDecl>(D))
10659 return FD->isThisDeclarationADefinition() || PendingBodies.count(FD);
10661 if (
auto *RTD = dyn_cast<RedeclarableTemplateDecl>(D))
10662 return hasDefinitionImpl(RTD->getTemplatedDecl(), hasDefinitionImpl);
10669 return hasDefinitionImpl(D, hasDefinitionImpl);
10685 PendingWarningForDuplicatedDefsInModuleUnits.clear();
10691 for (PendingBodiesMap::iterator PB = PendingBodies.begin(),
10692 PBEnd = PendingBodies.end();
10693 PB != PBEnd; ++PB) {
10694 if (FunctionDecl *FD = dyn_cast<FunctionDecl>(PB->first)) {
10696 const FunctionDecl *Defn =
nullptr;
10697 if (!
getContext().getLangOpts().Modules || !FD->hasBody(Defn)) {
10698 FD->setLazyBody(PB->second);
10700 auto *NonConstDefn =
const_cast<FunctionDecl*
>(Defn);
10703 if (!FD->isLateTemplateParsed() &&
10704 !NonConstDefn->isLateTemplateParsed() &&
10709 FD->getODRHash() != NonConstDefn->getODRHash()) {
10711 PendingFunctionOdrMergeFailures[FD].push_back(NonConstDefn);
10712 }
else if (FD->getLexicalParent()->isFileContext() &&
10713 NonConstDefn->getLexicalParent()->isFileContext()) {
10717 PendingFunctionOdrMergeFailures[FD].push_back(NonConstDefn);
10728 PendingBodies.clear();
10731 for (
auto [RD, MD] : PendingAddedClassMembers) {
10732 RD->addedMember(MD);
10734 PendingAddedClassMembers.clear();
10737 for (
auto *ND : PendingMergedDefinitionsToDeduplicate)
10739 PendingMergedDefinitionsToDeduplicate.clear();
10743 for (Decl *D : PendingIncompleteDeclChains)
10744 markIncompleteDeclChain(D);
10745 PendingIncompleteDeclChains.clear();
10747 assert(PendingIdentifierInfos.empty() &&
10748 "Should be empty at the end of finishPendingActions");
10749 assert(PendingDeducedFunctionTypes.empty() &&
10750 "Should be empty at the end of finishPendingActions");
10751 assert(PendingDeducedVarTypes.empty() &&
10752 "Should be empty at the end of finishPendingActions");
10753 assert(PendingDeclChains.empty() &&
10754 "Should be empty at the end of finishPendingActions");
10755 assert(PendingMacroIDs.empty() &&
10756 "Should be empty at the end of finishPendingActions");
10757 assert(PendingDeclContextInfos.empty() &&
10758 "Should be empty at the end of finishPendingActions");
10759 assert(PendingUpdateRecords.empty() &&
10760 "Should be empty at the end of finishPendingActions");
10761 assert(PendingObjCExtensionIvarRedeclarations.empty() &&
10762 "Should be empty at the end of finishPendingActions");
10763 assert(PendingFakeDefinitionData.empty() &&
10764 "Should be empty at the end of finishPendingActions");
10765 assert(PendingDefinitions.empty() &&
10766 "Should be empty at the end of finishPendingActions");
10767 assert(PendingWarningForDuplicatedDefsInModuleUnits.empty() &&
10768 "Should be empty at the end of finishPendingActions");
10769 assert(PendingBodies.empty() &&
10770 "Should be empty at the end of finishPendingActions");
10771 assert(PendingAddedClassMembers.empty() &&
10772 "Should be empty at the end of finishPendingActions");
10773 assert(PendingMergedDefinitionsToDeduplicate.empty() &&
10774 "Should be empty at the end of finishPendingActions");
10775 assert(PendingIncompleteDeclChains.empty() &&
10776 "Should be empty at the end of finishPendingActions");
10779void ASTReader::diagnoseOdrViolations() {
10780 if (PendingOdrMergeFailures.empty() && PendingOdrMergeChecks.empty() &&
10781 PendingRecordOdrMergeFailures.empty() &&
10782 PendingFunctionOdrMergeFailures.empty() &&
10783 PendingEnumOdrMergeFailures.empty() &&
10784 PendingObjCInterfaceOdrMergeFailures.empty() &&
10785 PendingObjCProtocolOdrMergeFailures.empty())
10792 auto OdrMergeFailures = std::move(PendingOdrMergeFailures);
10793 PendingOdrMergeFailures.clear();
10794 for (
auto &Merge : OdrMergeFailures) {
10795 Merge.first->buildLookup();
10796 Merge.first->decls_begin();
10797 Merge.first->bases_begin();
10798 Merge.first->vbases_begin();
10799 for (
auto &RecordPair : Merge.second) {
10800 auto *RD = RecordPair.first;
10808 auto RecordOdrMergeFailures = std::move(PendingRecordOdrMergeFailures);
10809 PendingRecordOdrMergeFailures.clear();
10810 for (
auto &Merge : RecordOdrMergeFailures) {
10811 Merge.first->decls_begin();
10812 for (
auto &D : Merge.second)
10817 auto ObjCInterfaceOdrMergeFailures =
10818 std::move(PendingObjCInterfaceOdrMergeFailures);
10819 PendingObjCInterfaceOdrMergeFailures.clear();
10820 for (
auto &Merge : ObjCInterfaceOdrMergeFailures) {
10821 Merge.first->decls_begin();
10822 for (
auto &InterfacePair : Merge.second)
10823 InterfacePair.first->decls_begin();
10827 auto FunctionOdrMergeFailures = std::move(PendingFunctionOdrMergeFailures);
10828 PendingFunctionOdrMergeFailures.clear();
10829 for (
auto &Merge : FunctionOdrMergeFailures) {
10830 Merge.first->buildLookup();
10831 Merge.first->decls_begin();
10832 Merge.first->getBody();
10833 for (
auto &FD : Merge.second) {
10841 auto EnumOdrMergeFailures = std::move(PendingEnumOdrMergeFailures);
10842 PendingEnumOdrMergeFailures.clear();
10843 for (
auto &Merge : EnumOdrMergeFailures) {
10844 Merge.first->decls_begin();
10845 for (
auto &
Enum : Merge.second) {
10846 Enum->decls_begin();
10851 auto ObjCProtocolOdrMergeFailures =
10852 std::move(PendingObjCProtocolOdrMergeFailures);
10853 PendingObjCProtocolOdrMergeFailures.clear();
10854 for (
auto &Merge : ObjCProtocolOdrMergeFailures) {
10855 Merge.first->decls_begin();
10856 for (
auto &ProtocolPair : Merge.second)
10857 ProtocolPair.first->decls_begin();
10866 while (!PendingOdrMergeChecks.empty()) {
10867 NamedDecl *D = PendingOdrMergeChecks.pop_back_val();
10878 bool Found =
false;
10881 for (
auto *RI : D->
redecls()) {
10882 if (RI->getLexicalDeclContext() == CanonDef) {
10896 llvm::SmallVector<const NamedDecl*, 4> Candidates;
10897 for (
auto *CanonMember : CanonDef->
decls()) {
10898 if (CanonMember->getCanonicalDecl() == DCanon) {
10907 if (
auto *ND = dyn_cast<NamedDecl>(CanonMember))
10909 Candidates.push_back(ND);
10922 std::string CanonDefModule =
10927 << CanonDef << CanonDefModule.empty() << CanonDefModule;
10929 if (Candidates.empty())
10931 diag::note_module_odr_violation_no_possible_decls) << D;
10933 for (
unsigned I = 0, N = Candidates.size(); I != N; ++I)
10934 Diag(Candidates[I]->getLocation(),
10935 diag::note_module_odr_violation_possible_decl)
10939 DiagnosedOdrMergeFailures.insert(CanonDef);
10943 if (OdrMergeFailures.empty() && RecordOdrMergeFailures.empty() &&
10944 FunctionOdrMergeFailures.empty() && EnumOdrMergeFailures.empty() &&
10945 ObjCInterfaceOdrMergeFailures.empty() &&
10946 ObjCProtocolOdrMergeFailures.empty())
10949 ODRDiagsEmitter DiagsEmitter(Diags,
getContext(),
10953 for (
auto &Merge : OdrMergeFailures) {
10956 if (!DiagnosedOdrMergeFailures.insert(Merge.first).second)
10959 bool Diagnosed =
false;
10960 CXXRecordDecl *FirstRecord = Merge.first;
10961 for (
auto &RecordPair : Merge.second) {
10962 if (DiagsEmitter.diagnoseMismatch(FirstRecord, RecordPair.first,
10963 RecordPair.second)) {
10976 Diag(Merge.first->getLocation(),
10977 diag::err_module_odr_violation_different_instantiations)
10984 for (
auto &Merge : RecordOdrMergeFailures) {
10987 if (!DiagnosedOdrMergeFailures.insert(Merge.first).second)
10990 RecordDecl *FirstRecord = Merge.first;
10991 bool Diagnosed =
false;
10992 for (
auto *SecondRecord : Merge.second) {
10993 if (DiagsEmitter.diagnoseMismatch(FirstRecord, SecondRecord)) {
10999 assert(Diagnosed &&
"Unable to emit ODR diagnostic.");
11003 for (
auto &Merge : FunctionOdrMergeFailures) {
11004 FunctionDecl *FirstFunction = Merge.first;
11005 bool Diagnosed =
false;
11006 for (
auto &SecondFunction : Merge.second) {
11007 if (DiagsEmitter.diagnoseMismatch(FirstFunction, SecondFunction)) {
11013 assert(Diagnosed &&
"Unable to emit ODR diagnostic.");
11017 for (
auto &Merge : EnumOdrMergeFailures) {
11020 if (!DiagnosedOdrMergeFailures.insert(Merge.first).second)
11023 EnumDecl *FirstEnum = Merge.first;
11024 bool Diagnosed =
false;
11025 for (
auto &SecondEnum : Merge.second) {
11026 if (DiagsEmitter.diagnoseMismatch(FirstEnum, SecondEnum)) {
11032 assert(Diagnosed &&
"Unable to emit ODR diagnostic.");
11035 for (
auto &Merge : ObjCInterfaceOdrMergeFailures) {
11038 if (!DiagnosedOdrMergeFailures.insert(Merge.first).second)
11041 bool Diagnosed =
false;
11042 ObjCInterfaceDecl *FirstID = Merge.first;
11043 for (
auto &InterfacePair : Merge.second) {
11044 if (DiagsEmitter.diagnoseMismatch(FirstID, InterfacePair.first,
11045 InterfacePair.second)) {
11051 assert(Diagnosed &&
"Unable to emit ODR diagnostic.");
11054 for (
auto &Merge : ObjCProtocolOdrMergeFailures) {
11057 if (!DiagnosedOdrMergeFailures.insert(Merge.first).second)
11060 ObjCProtocolDecl *FirstProtocol = Merge.first;
11061 bool Diagnosed =
false;
11062 for (
auto &ProtocolPair : Merge.second) {
11063 if (DiagsEmitter.diagnoseMismatch(FirstProtocol, ProtocolPair.first,
11064 ProtocolPair.second)) {
11070 assert(Diagnosed &&
"Unable to emit ODR diagnostic.");
11075 if (llvm::Timer *
T = ReadTimer.get();
11076 ++NumCurrentElementsDeserializing == 1 &&
T)
11077 ReadTimeRegion.emplace(
T);
11081 assert(NumCurrentElementsDeserializing &&
11082 "FinishedDeserializing not paired with StartedDeserializing");
11083 if (NumCurrentElementsDeserializing == 1) {
11086 finishPendingActions();
11088 --NumCurrentElementsDeserializing;
11090 if (NumCurrentElementsDeserializing == 0) {
11094 SaveAndRestore GuardPassingDeclsToConsumer(CanPassDeclsToConsumer,
11102 while (!PendingExceptionSpecUpdates.empty() ||
11103 !PendingDeducedTypeUpdates.empty() ||
11104 !PendingUndeducedFunctionDecls.empty()) {
11105 auto ESUpdates = std::move(PendingExceptionSpecUpdates);
11106 PendingExceptionSpecUpdates.clear();
11107 for (
auto Update : ESUpdates) {
11108 ProcessingUpdatesRAIIObj ProcessingUpdates(*
this);
11111 if (
auto *Listener =
getContext().getASTMutationListener())
11113 for (
auto *Redecl :
Update.second->redecls())
11117 auto DTUpdates = std::move(PendingDeducedTypeUpdates);
11118 PendingDeducedTypeUpdates.clear();
11119 for (
auto Update : DTUpdates) {
11120 ProcessingUpdatesRAIIObj ProcessingUpdates(*
this);
11127 auto UDTUpdates = std::move(PendingUndeducedFunctionDecls);
11128 PendingUndeducedFunctionDecls.clear();
11132 (void)UndeducedFD->getMostRecentDecl();
11135 ReadTimeRegion.reset();
11137 diagnoseOdrViolations();
11143 PassInterestingDeclsToConsumer();
11150 auto It = PendingFakeLookupResults.find(II);
11151 if (It != PendingFakeLookupResults.end()) {
11152 for (
auto *ND : It->second)
11157 It->second.clear();
11161 if (SemaObj->IdResolver.tryAddTopLevelDecl(D, Name) && SemaObj->TUScope) {
11162 SemaObj->TUScope->AddDecl(D);
11163 }
else if (SemaObj->TUScope) {
11167 if (llvm::is_contained(SemaObj->IdResolver.decls(Name), D))
11168 SemaObj->TUScope->AddDecl(D);
11176 ArrayRef<std::shared_ptr<ModuleFileExtension>> Extensions,
11177 StringRef isysroot,
11179 bool AllowASTWithCompilerErrors,
11180 bool AllowConfigurationMismatch,
bool ValidateSystemInputs,
11181 bool ForceValidateUserInputs,
11182 bool ValidateASTInputFilesContent,
bool UseGlobalIndex,
11183 std::unique_ptr<llvm::Timer> ReadTimer)
11188 PCHContainerRdr(PCHContainerRdr), Diags(PP.getDiagnostics()),
11189 StackHandler(Diags), PP(PP), ContextObj(Context),
11190 CodeGenOpts(CodeGenOpts),
11192 PP.getHeaderSearchInfo()),
11193 DummyIdResolver(PP), ReadTimer(
std::move(ReadTimer)), isysroot(isysroot),
11194 DisableValidationKind(DisableValidationKind),
11195 AllowASTWithCompilerErrors(AllowASTWithCompilerErrors),
11196 AllowConfigurationMismatch(AllowConfigurationMismatch),
11197 ValidateSystemInputs(ValidateSystemInputs),
11198 ForceValidateUserInputs(ForceValidateUserInputs),
11199 ValidateASTInputFilesContent(ValidateASTInputFilesContent),
11200 UseGlobalIndex(UseGlobalIndex), CurrSwitchCaseStmts(&SwitchCaseStmts) {
11201 SourceMgr.setExternalSLocEntrySource(
this);
11203 PathBuf.reserve(256);
11205 for (
const auto &Ext : Extensions) {
11206 auto BlockName = Ext->getExtensionMetadata().BlockName;
11207 auto Known = ModuleFileExtensions.find(BlockName);
11208 if (Known != ModuleFileExtensions.end()) {
11209 Diags.Report(diag::warn_duplicate_module_file_extension)
11214 ModuleFileExtensions.insert({BlockName, Ext});
11219 if (OwnsDeserializationListener)
11220 delete DeserializationListener;
11224 return SemaObj ? SemaObj->IdResolver : DummyIdResolver;
11228 unsigned AbbrevID) {
11231 return Cursor.readRecord(AbbrevID, Record);
11247 : Record(Record), Context(Record.getContext()) {}
11248#define GEN_CLANG_CLAUSE_CLASS
11249#define CLAUSE_CLASS(Enum, Str, Class) void Visit##Class(Class *C);
11250#include "llvm/Frontend/OpenMP/OMP.inc"
11264 switch (llvm::omp::Clause(Record.readInt())) {
11265 case llvm::omp::OMPC_if:
11268 case llvm::omp::OMPC_final:
11271 case llvm::omp::OMPC_num_threads:
11274 case llvm::omp::OMPC_safelen:
11277 case llvm::omp::OMPC_simdlen:
11280 case llvm::omp::OMPC_sizes: {
11281 unsigned NumSizes = Record.readInt();
11285 case llvm::omp::OMPC_permutation: {
11286 unsigned NumLoops = Record.readInt();
11290 case llvm::omp::OMPC_full:
11293 case llvm::omp::OMPC_partial:
11296 case llvm::omp::OMPC_looprange:
11299 case llvm::omp::OMPC_allocator:
11302 case llvm::omp::OMPC_collapse:
11305 case llvm::omp::OMPC_default:
11308 case llvm::omp::OMPC_proc_bind:
11311 case llvm::omp::OMPC_schedule:
11314 case llvm::omp::OMPC_ordered:
11317 case llvm::omp::OMPC_nowait:
11320 case llvm::omp::OMPC_untied:
11323 case llvm::omp::OMPC_mergeable:
11326 case llvm::omp::OMPC_threadset:
11329 case llvm::omp::OMPC_read:
11332 case llvm::omp::OMPC_write:
11335 case llvm::omp::OMPC_update:
11338 case llvm::omp::OMPC_capture:
11341 case llvm::omp::OMPC_compare:
11344 case llvm::omp::OMPC_fail:
11347 case llvm::omp::OMPC_seq_cst:
11350 case llvm::omp::OMPC_acq_rel:
11353 case llvm::omp::OMPC_absent: {
11354 unsigned NumKinds = Record.readInt();
11358 case llvm::omp::OMPC_holds:
11361 case llvm::omp::OMPC_contains: {
11362 unsigned NumKinds = Record.readInt();
11366 case llvm::omp::OMPC_no_openmp:
11369 case llvm::omp::OMPC_no_openmp_routines:
11372 case llvm::omp::OMPC_no_openmp_constructs:
11375 case llvm::omp::OMPC_no_parallelism:
11378 case llvm::omp::OMPC_acquire:
11381 case llvm::omp::OMPC_release:
11384 case llvm::omp::OMPC_relaxed:
11387 case llvm::omp::OMPC_weak:
11390 case llvm::omp::OMPC_threads:
11393 case llvm::omp::OMPC_simd:
11396 case llvm::omp::OMPC_nogroup:
11399 case llvm::omp::OMPC_unified_address:
11402 case llvm::omp::OMPC_unified_shared_memory:
11405 case llvm::omp::OMPC_reverse_offload:
11408 case llvm::omp::OMPC_dynamic_allocators:
11411 case llvm::omp::OMPC_atomic_default_mem_order:
11414 case llvm::omp::OMPC_self_maps:
11417 case llvm::omp::OMPC_at:
11420 case llvm::omp::OMPC_severity:
11423 case llvm::omp::OMPC_message:
11426 case llvm::omp::OMPC_private:
11429 case llvm::omp::OMPC_firstprivate:
11432 case llvm::omp::OMPC_lastprivate:
11435 case llvm::omp::OMPC_shared:
11438 case llvm::omp::OMPC_reduction: {
11439 unsigned N = Record.readInt();
11444 case llvm::omp::OMPC_task_reduction:
11447 case llvm::omp::OMPC_in_reduction:
11450 case llvm::omp::OMPC_linear:
11453 case llvm::omp::OMPC_aligned:
11456 case llvm::omp::OMPC_copyin:
11459 case llvm::omp::OMPC_copyprivate:
11462 case llvm::omp::OMPC_flush:
11465 case llvm::omp::OMPC_depobj:
11468 case llvm::omp::OMPC_depend: {
11469 unsigned NumVars = Record.readInt();
11470 unsigned NumLoops = Record.readInt();
11474 case llvm::omp::OMPC_device:
11477 case llvm::omp::OMPC_map: {
11479 Sizes.
NumVars = Record.readInt();
11486 case llvm::omp::OMPC_num_teams:
11489 case llvm::omp::OMPC_thread_limit:
11492 case llvm::omp::OMPC_priority:
11495 case llvm::omp::OMPC_grainsize:
11498 case llvm::omp::OMPC_num_tasks:
11501 case llvm::omp::OMPC_hint:
11504 case llvm::omp::OMPC_dist_schedule:
11507 case llvm::omp::OMPC_defaultmap:
11510 case llvm::omp::OMPC_to: {
11512 Sizes.
NumVars = Record.readInt();
11519 case llvm::omp::OMPC_from: {
11521 Sizes.
NumVars = Record.readInt();
11528 case llvm::omp::OMPC_use_device_ptr: {
11530 Sizes.
NumVars = Record.readInt();
11537 case llvm::omp::OMPC_use_device_addr: {
11539 Sizes.
NumVars = Record.readInt();
11546 case llvm::omp::OMPC_is_device_ptr: {
11548 Sizes.
NumVars = Record.readInt();
11555 case llvm::omp::OMPC_has_device_addr: {
11557 Sizes.
NumVars = Record.readInt();
11564 case llvm::omp::OMPC_allocate:
11567 case llvm::omp::OMPC_nontemporal:
11570 case llvm::omp::OMPC_inclusive:
11573 case llvm::omp::OMPC_exclusive:
11576 case llvm::omp::OMPC_order:
11579 case llvm::omp::OMPC_init:
11582 case llvm::omp::OMPC_use:
11585 case llvm::omp::OMPC_destroy:
11588 case llvm::omp::OMPC_novariants:
11591 case llvm::omp::OMPC_nocontext:
11594 case llvm::omp::OMPC_detach:
11597 case llvm::omp::OMPC_uses_allocators:
11600 case llvm::omp::OMPC_affinity:
11603 case llvm::omp::OMPC_filter:
11606 case llvm::omp::OMPC_bind:
11609 case llvm::omp::OMPC_align:
11612 case llvm::omp::OMPC_ompx_dyn_cgroup_mem:
11615 case llvm::omp::OMPC_dyn_groupprivate:
11618 case llvm::omp::OMPC_doacross: {
11619 unsigned NumVars = Record.readInt();
11620 unsigned NumLoops = Record.readInt();
11624 case llvm::omp::OMPC_ompx_attribute:
11627 case llvm::omp::OMPC_ompx_bare:
11630#define OMP_CLAUSE_NO_CLASS(Enum, Str) \
11631 case llvm::omp::Enum: \
11633#include "llvm/Frontend/OpenMP/OMPKinds.def"
11637 assert(
C &&
"Unknown OMPClause type");
11640 C->setLocStart(Record.readSourceLocation());
11641 C->setLocEnd(Record.readSourceLocation());
11647 C->setPreInitStmt(Record.readSubStmt(),
11653 C->setPostUpdateExpr(Record.readSubExpr());
11656void OMPClauseReader::VisitOMPIfClause(
OMPIfClause *
C) {
11659 C->setNameModifierLoc(
Record.readSourceLocation());
11660 C->setColonLoc(
Record.readSourceLocation());
11661 C->setCondition(
Record.readSubExpr());
11662 C->setLParenLoc(
Record.readSourceLocation());
11667 C->setCondition(
Record.readSubExpr());
11668 C->setLParenLoc(
Record.readSourceLocation());
11674 C->setNumThreads(Record.readSubExpr());
11675 C->setModifierLoc(Record.readSourceLocation());
11676 C->setLParenLoc(Record.readSourceLocation());
11680 C->setSafelen(Record.readSubExpr());
11681 C->setLParenLoc(Record.readSourceLocation());
11685 C->setSimdlen(Record.readSubExpr());
11686 C->setLParenLoc(Record.readSourceLocation());
11690 for (Expr *&E :
C->getSizesRefs())
11691 E = Record.readSubExpr();
11692 C->setLParenLoc(Record.readSourceLocation());
11696 for (Expr *&E :
C->getArgsRefs())
11697 E = Record.readSubExpr();
11698 C->setLParenLoc(Record.readSourceLocation());
11704 C->setFactor(Record.readSubExpr());
11705 C->setLParenLoc(Record.readSourceLocation());
11709 C->setFirst(Record.readSubExpr());
11710 C->setCount(Record.readSubExpr());
11711 C->setLParenLoc(Record.readSourceLocation());
11712 C->setFirstLoc(Record.readSourceLocation());
11713 C->setCountLoc(Record.readSourceLocation());
11717 C->setAllocator(Record.readExpr());
11718 C->setLParenLoc(Record.readSourceLocation());
11722 C->setNumForLoops(Record.readSubExpr());
11723 C->setLParenLoc(Record.readSourceLocation());
11727 C->setDefaultKind(
static_cast<llvm::omp::DefaultKind
>(Record.readInt()));
11728 C->setLParenLoc(Record.readSourceLocation());
11729 C->setDefaultKindKwLoc(Record.readSourceLocation());
11730 C->setDefaultVariableCategory(
11732 C->setDefaultVariableCategoryLocation(Record.readSourceLocation());
11738 C->setLParenLoc(Record.readSourceLocation());
11739 SourceLocation ThreadsetKindLoc = Record.readSourceLocation();
11740 C->setThreadsetKindLoc(ThreadsetKindLoc);
11743 C->setThreadsetKind(TKind);
11747 C->setProcBindKind(
static_cast<llvm::omp::ProcBindKind
>(Record.readInt()));
11748 C->setLParenLoc(Record.readSourceLocation());
11749 C->setProcBindKindKwLoc(Record.readSourceLocation());
11754 C->setScheduleKind(
11756 C->setFirstScheduleModifier(
11758 C->setSecondScheduleModifier(
11760 C->setChunkSize(Record.readSubExpr());
11761 C->setLParenLoc(Record.readSourceLocation());
11762 C->setFirstScheduleModifierLoc(Record.readSourceLocation());
11763 C->setSecondScheduleModifierLoc(Record.readSourceLocation());
11764 C->setScheduleKindLoc(Record.readSourceLocation());
11765 C->setCommaLoc(Record.readSourceLocation());
11769 C->setNumForLoops(Record.readSubExpr());
11770 for (
unsigned I = 0, E =
C->NumberOfLoops; I < E; ++I)
11771 C->setLoopNumIterations(I, Record.readSubExpr());
11772 for (
unsigned I = 0, E =
C->NumberOfLoops; I < E; ++I)
11773 C->setLoopCounter(I, Record.readSubExpr());
11774 C->setLParenLoc(Record.readSourceLocation());
11778 C->setEventHandler(Record.readSubExpr());
11779 C->setLParenLoc(Record.readSourceLocation());
11783 C->setCondition(Record.readSubExpr());
11784 C->setLParenLoc(Record.readSourceLocation());
11791void OMPClauseReader::VisitOMPReadClause(
OMPReadClause *) {}
11796 if (
C->isExtended()) {
11797 C->setLParenLoc(Record.readSourceLocation());
11798 C->setArgumentLoc(Record.readSourceLocation());
11810 C->setLParenLoc(Record.readSourceLocation());
11811 SourceLocation FailParameterLoc = Record.readSourceLocation();
11812 C->setFailParameterLoc(FailParameterLoc);
11814 C->setFailParameter(CKind);
11818 unsigned Count =
C->getDirectiveKinds().size();
11819 C->setLParenLoc(Record.readSourceLocation());
11820 llvm::SmallVector<OpenMPDirectiveKind, 4> DKVec;
11821 DKVec.reserve(Count);
11822 for (
unsigned I = 0; I < Count; I++) {
11825 C->setDirectiveKinds(DKVec);
11829 C->setExpr(Record.readExpr());
11830 C->setLParenLoc(Record.readSourceLocation());
11834 unsigned Count =
C->getDirectiveKinds().size();
11835 C->setLParenLoc(Record.readSourceLocation());
11836 llvm::SmallVector<OpenMPDirectiveKind, 4> DKVec;
11837 DKVec.reserve(Count);
11838 for (
unsigned I = 0; I < Count; I++) {
11841 C->setDirectiveKinds(DKVec);
11846void OMPClauseReader::VisitOMPNoOpenMPRoutinesClause(
11849void OMPClauseReader::VisitOMPNoOpenMPConstructsClause(
11864void OMPClauseReader::VisitOMPWeakClause(
OMPWeakClause *) {}
11868void OMPClauseReader::VisitOMPSIMDClause(
OMPSIMDClause *) {}
11873 unsigned NumVars =
C->varlist_size();
11874 SmallVector<Expr *, 16> Vars;
11875 Vars.reserve(NumVars);
11876 for (
unsigned I = 0; I != NumVars; ++I)
11877 Vars.push_back(Record.readSubExpr());
11878 C->setVarRefs(Vars);
11879 C->setIsTarget(Record.readBool());
11880 C->setIsTargetSync(Record.readBool());
11881 C->setLParenLoc(Record.readSourceLocation());
11882 C->setVarLoc(Record.readSourceLocation());
11886 C->setInteropVar(Record.readSubExpr());
11887 C->setLParenLoc(Record.readSourceLocation());
11888 C->setVarLoc(Record.readSourceLocation());
11892 C->setInteropVar(Record.readSubExpr());
11893 C->setLParenLoc(Record.readSourceLocation());
11894 C->setVarLoc(Record.readSourceLocation());
11899 C->setCondition(Record.readSubExpr());
11900 C->setLParenLoc(Record.readSourceLocation());
11905 C->setCondition(Record.readSubExpr());
11906 C->setLParenLoc(Record.readSourceLocation());
11911void OMPClauseReader::VisitOMPUnifiedSharedMemoryClause(
11920void OMPClauseReader::VisitOMPAtomicDefaultMemOrderClause(
11922 C->setAtomicDefaultMemOrderKind(
11924 C->setLParenLoc(Record.readSourceLocation());
11925 C->setAtomicDefaultMemOrderKindKwLoc(Record.readSourceLocation());
11930void OMPClauseReader::VisitOMPAtClause(
OMPAtClause *
C) {
11932 C->setLParenLoc(Record.readSourceLocation());
11933 C->setAtKindKwLoc(Record.readSourceLocation());
11938 C->setLParenLoc(Record.readSourceLocation());
11939 C->setSeverityKindKwLoc(Record.readSourceLocation());
11944 C->setMessageString(Record.readSubExpr());
11945 C->setLParenLoc(Record.readSourceLocation());
11949 C->setLParenLoc(Record.readSourceLocation());
11950 unsigned NumVars =
C->varlist_size();
11951 SmallVector<Expr *, 16> Vars;
11952 Vars.reserve(NumVars);
11953 for (
unsigned i = 0; i != NumVars; ++i)
11954 Vars.push_back(Record.readSubExpr());
11955 C->setVarRefs(Vars);
11957 for (
unsigned i = 0; i != NumVars; ++i)
11958 Vars.push_back(Record.readSubExpr());
11959 C->setPrivateCopies(Vars);
11964 C->setLParenLoc(Record.readSourceLocation());
11965 unsigned NumVars =
C->varlist_size();
11966 SmallVector<Expr *, 16> Vars;
11967 Vars.reserve(NumVars);
11968 for (
unsigned i = 0; i != NumVars; ++i)
11969 Vars.push_back(Record.readSubExpr());
11970 C->setVarRefs(Vars);
11972 for (
unsigned i = 0; i != NumVars; ++i)
11973 Vars.push_back(Record.readSubExpr());
11974 C->setPrivateCopies(Vars);
11976 for (
unsigned i = 0; i != NumVars; ++i)
11977 Vars.push_back(Record.readSubExpr());
11983 C->setLParenLoc(Record.readSourceLocation());
11985 C->setKindLoc(Record.readSourceLocation());
11986 C->setColonLoc(Record.readSourceLocation());
11987 unsigned NumVars =
C->varlist_size();
11988 SmallVector<Expr *, 16> Vars;
11989 Vars.reserve(NumVars);
11990 for (
unsigned i = 0; i != NumVars; ++i)
11991 Vars.push_back(Record.readSubExpr());
11992 C->setVarRefs(Vars);
11994 for (
unsigned i = 0; i != NumVars; ++i)
11995 Vars.push_back(Record.readSubExpr());
11996 C->setPrivateCopies(Vars);
11998 for (
unsigned i = 0; i != NumVars; ++i)
11999 Vars.push_back(Record.readSubExpr());
12000 C->setSourceExprs(Vars);
12002 for (
unsigned i = 0; i != NumVars; ++i)
12003 Vars.push_back(Record.readSubExpr());
12004 C->setDestinationExprs(Vars);
12006 for (
unsigned i = 0; i != NumVars; ++i)
12007 Vars.push_back(Record.readSubExpr());
12008 C->setAssignmentOps(Vars);
12012 C->setLParenLoc(Record.readSourceLocation());
12013 unsigned NumVars =
C->varlist_size();
12014 SmallVector<Expr *, 16> Vars;
12015 Vars.reserve(NumVars);
12016 for (
unsigned i = 0; i != NumVars; ++i)
12017 Vars.push_back(Record.readSubExpr());
12018 C->setVarRefs(Vars);
12023 C->setLParenLoc(Record.readSourceLocation());
12024 C->setModifierLoc(Record.readSourceLocation());
12025 C->setColonLoc(Record.readSourceLocation());
12026 NestedNameSpecifierLoc NNSL = Record.readNestedNameSpecifierLoc();
12027 DeclarationNameInfo DNI = Record.readDeclarationNameInfo();
12028 C->setQualifierLoc(NNSL);
12029 C->setNameInfo(DNI);
12031 unsigned NumVars =
C->varlist_size();
12032 SmallVector<Expr *, 16> Vars;
12033 Vars.reserve(NumVars);
12034 for (
unsigned i = 0; i != NumVars; ++i)
12035 Vars.push_back(Record.readSubExpr());
12036 C->setVarRefs(Vars);
12038 for (
unsigned i = 0; i != NumVars; ++i)
12039 Vars.push_back(Record.readSubExpr());
12040 C->setPrivates(Vars);
12042 for (
unsigned i = 0; i != NumVars; ++i)
12043 Vars.push_back(Record.readSubExpr());
12044 C->setLHSExprs(Vars);
12046 for (
unsigned i = 0; i != NumVars; ++i)
12047 Vars.push_back(Record.readSubExpr());
12048 C->setRHSExprs(Vars);
12050 for (
unsigned i = 0; i != NumVars; ++i)
12051 Vars.push_back(Record.readSubExpr());
12052 C->setReductionOps(Vars);
12053 if (
C->getModifier() == OMPC_REDUCTION_inscan) {
12055 for (
unsigned i = 0; i != NumVars; ++i)
12056 Vars.push_back(Record.readSubExpr());
12057 C->setInscanCopyOps(Vars);
12059 for (
unsigned i = 0; i != NumVars; ++i)
12060 Vars.push_back(Record.readSubExpr());
12061 C->setInscanCopyArrayTemps(Vars);
12063 for (
unsigned i = 0; i != NumVars; ++i)
12064 Vars.push_back(Record.readSubExpr());
12065 C->setInscanCopyArrayElems(Vars);
12067 unsigned NumFlags = Record.readInt();
12068 SmallVector<bool, 16> Flags;
12069 Flags.reserve(NumFlags);
12070 for ([[maybe_unused]]
unsigned I : llvm::seq<unsigned>(NumFlags))
12071 Flags.push_back(Record.readInt());
12072 C->setPrivateVariableReductionFlags(Flags);
12077 C->setLParenLoc(Record.readSourceLocation());
12078 C->setColonLoc(Record.readSourceLocation());
12079 NestedNameSpecifierLoc NNSL = Record.readNestedNameSpecifierLoc();
12080 DeclarationNameInfo DNI = Record.readDeclarationNameInfo();
12081 C->setQualifierLoc(NNSL);
12082 C->setNameInfo(DNI);
12084 unsigned NumVars =
C->varlist_size();
12085 SmallVector<Expr *, 16> Vars;
12086 Vars.reserve(NumVars);
12087 for (
unsigned I = 0; I != NumVars; ++I)
12088 Vars.push_back(Record.readSubExpr());
12089 C->setVarRefs(Vars);
12091 for (
unsigned I = 0; I != NumVars; ++I)
12092 Vars.push_back(Record.readSubExpr());
12093 C->setPrivates(Vars);
12095 for (
unsigned I = 0; I != NumVars; ++I)
12096 Vars.push_back(Record.readSubExpr());
12097 C->setLHSExprs(Vars);
12099 for (
unsigned I = 0; I != NumVars; ++I)
12100 Vars.push_back(Record.readSubExpr());
12101 C->setRHSExprs(Vars);
12103 for (
unsigned I = 0; I != NumVars; ++I)
12104 Vars.push_back(Record.readSubExpr());
12105 C->setReductionOps(Vars);
12110 C->setLParenLoc(Record.readSourceLocation());
12111 C->setColonLoc(Record.readSourceLocation());
12112 NestedNameSpecifierLoc NNSL = Record.readNestedNameSpecifierLoc();
12113 DeclarationNameInfo DNI = Record.readDeclarationNameInfo();
12114 C->setQualifierLoc(NNSL);
12115 C->setNameInfo(DNI);
12117 unsigned NumVars =
C->varlist_size();
12118 SmallVector<Expr *, 16> Vars;
12119 Vars.reserve(NumVars);
12120 for (
unsigned I = 0; I != NumVars; ++I)
12121 Vars.push_back(Record.readSubExpr());
12122 C->setVarRefs(Vars);
12124 for (
unsigned I = 0; I != NumVars; ++I)
12125 Vars.push_back(Record.readSubExpr());
12126 C->setPrivates(Vars);
12128 for (
unsigned I = 0; I != NumVars; ++I)
12129 Vars.push_back(Record.readSubExpr());
12130 C->setLHSExprs(Vars);
12132 for (
unsigned I = 0; I != NumVars; ++I)
12133 Vars.push_back(Record.readSubExpr());
12134 C->setRHSExprs(Vars);
12136 for (
unsigned I = 0; I != NumVars; ++I)
12137 Vars.push_back(Record.readSubExpr());
12138 C->setReductionOps(Vars);
12140 for (
unsigned I = 0; I != NumVars; ++I)
12141 Vars.push_back(Record.readSubExpr());
12142 C->setTaskgroupDescriptors(Vars);
12147 C->setLParenLoc(Record.readSourceLocation());
12148 C->setColonLoc(Record.readSourceLocation());
12150 C->setModifierLoc(Record.readSourceLocation());
12151 unsigned NumVars =
C->varlist_size();
12152 SmallVector<Expr *, 16> Vars;
12153 Vars.reserve(NumVars);
12154 for (
unsigned i = 0; i != NumVars; ++i)
12155 Vars.push_back(Record.readSubExpr());
12156 C->setVarRefs(Vars);
12158 for (
unsigned i = 0; i != NumVars; ++i)
12159 Vars.push_back(Record.readSubExpr());
12160 C->setPrivates(Vars);
12162 for (
unsigned i = 0; i != NumVars; ++i)
12163 Vars.push_back(Record.readSubExpr());
12166 for (
unsigned i = 0; i != NumVars; ++i)
12167 Vars.push_back(Record.readSubExpr());
12168 C->setUpdates(Vars);
12170 for (
unsigned i = 0; i != NumVars; ++i)
12171 Vars.push_back(Record.readSubExpr());
12172 C->setFinals(Vars);
12173 C->setStep(Record.readSubExpr());
12174 C->setCalcStep(Record.readSubExpr());
12176 for (
unsigned I = 0; I != NumVars + 1; ++I)
12177 Vars.push_back(Record.readSubExpr());
12178 C->setUsedExprs(Vars);
12182 C->setLParenLoc(Record.readSourceLocation());
12183 C->setColonLoc(Record.readSourceLocation());
12184 unsigned NumVars =
C->varlist_size();
12185 SmallVector<Expr *, 16> Vars;
12186 Vars.reserve(NumVars);
12187 for (
unsigned i = 0; i != NumVars; ++i)
12188 Vars.push_back(Record.readSubExpr());
12189 C->setVarRefs(Vars);
12190 C->setAlignment(Record.readSubExpr());
12194 C->setLParenLoc(Record.readSourceLocation());
12195 unsigned NumVars =
C->varlist_size();
12196 SmallVector<Expr *, 16> Exprs;
12197 Exprs.reserve(NumVars);
12198 for (
unsigned i = 0; i != NumVars; ++i)
12199 Exprs.push_back(Record.readSubExpr());
12200 C->setVarRefs(Exprs);
12202 for (
unsigned i = 0; i != NumVars; ++i)
12203 Exprs.push_back(Record.readSubExpr());
12204 C->setSourceExprs(Exprs);
12206 for (
unsigned i = 0; i != NumVars; ++i)
12207 Exprs.push_back(Record.readSubExpr());
12208 C->setDestinationExprs(Exprs);
12210 for (
unsigned i = 0; i != NumVars; ++i)
12211 Exprs.push_back(Record.readSubExpr());
12212 C->setAssignmentOps(Exprs);
12216 C->setLParenLoc(Record.readSourceLocation());
12217 unsigned NumVars =
C->varlist_size();
12218 SmallVector<Expr *, 16> Exprs;
12219 Exprs.reserve(NumVars);
12220 for (
unsigned i = 0; i != NumVars; ++i)
12221 Exprs.push_back(Record.readSubExpr());
12222 C->setVarRefs(Exprs);
12224 for (
unsigned i = 0; i != NumVars; ++i)
12225 Exprs.push_back(Record.readSubExpr());
12226 C->setSourceExprs(Exprs);
12228 for (
unsigned i = 0; i != NumVars; ++i)
12229 Exprs.push_back(Record.readSubExpr());
12230 C->setDestinationExprs(Exprs);
12232 for (
unsigned i = 0; i != NumVars; ++i)
12233 Exprs.push_back(Record.readSubExpr());
12234 C->setAssignmentOps(Exprs);
12238 C->setLParenLoc(Record.readSourceLocation());
12239 unsigned NumVars =
C->varlist_size();
12240 SmallVector<Expr *, 16> Vars;
12241 Vars.reserve(NumVars);
12242 for (
unsigned i = 0; i != NumVars; ++i)
12243 Vars.push_back(Record.readSubExpr());
12244 C->setVarRefs(Vars);
12248 C->setDepobj(Record.readSubExpr());
12249 C->setLParenLoc(Record.readSourceLocation());
12253 C->setLParenLoc(Record.readSourceLocation());
12254 C->setModifier(Record.readSubExpr());
12255 C->setDependencyKind(
12257 C->setDependencyLoc(Record.readSourceLocation());
12258 C->setColonLoc(Record.readSourceLocation());
12259 C->setOmpAllMemoryLoc(Record.readSourceLocation());
12260 unsigned NumVars =
C->varlist_size();
12261 SmallVector<Expr *, 16> Vars;
12262 Vars.reserve(NumVars);
12263 for (
unsigned I = 0; I != NumVars; ++I)
12264 Vars.push_back(Record.readSubExpr());
12265 C->setVarRefs(Vars);
12266 for (
unsigned I = 0, E =
C->getNumLoops(); I < E; ++I)
12267 C->setLoopData(I, Record.readSubExpr());
12273 C->setDevice(Record.readSubExpr());
12274 C->setModifierLoc(Record.readSourceLocation());
12275 C->setLParenLoc(Record.readSourceLocation());
12279 C->setLParenLoc(Record.readSourceLocation());
12280 bool HasIteratorModifier =
false;
12282 C->setMapTypeModifier(
12284 C->setMapTypeModifierLoc(I, Record.readSourceLocation());
12285 if (
C->getMapTypeModifier(I) == OMPC_MAP_MODIFIER_iterator)
12286 HasIteratorModifier =
true;
12288 C->setMapperQualifierLoc(Record.readNestedNameSpecifierLoc());
12289 C->setMapperIdInfo(Record.readDeclarationNameInfo());
12292 C->setMapLoc(Record.readSourceLocation());
12293 C->setColonLoc(Record.readSourceLocation());
12294 auto NumVars =
C->varlist_size();
12295 auto UniqueDecls =
C->getUniqueDeclarationsNum();
12296 auto TotalLists =
C->getTotalComponentListNum();
12297 auto TotalComponents =
C->getTotalComponentsNum();
12299 SmallVector<Expr *, 16> Vars;
12300 Vars.reserve(NumVars);
12301 for (
unsigned i = 0; i != NumVars; ++i)
12302 Vars.push_back(Record.readExpr());
12303 C->setVarRefs(Vars);
12305 SmallVector<Expr *, 16> UDMappers;
12306 UDMappers.reserve(NumVars);
12307 for (
unsigned I = 0; I < NumVars; ++I)
12308 UDMappers.push_back(Record.readExpr());
12309 C->setUDMapperRefs(UDMappers);
12311 if (HasIteratorModifier)
12312 C->setIteratorModifier(Record.readExpr());
12314 SmallVector<ValueDecl *, 16> Decls;
12315 Decls.reserve(UniqueDecls);
12316 for (
unsigned i = 0; i < UniqueDecls; ++i)
12317 Decls.push_back(Record.readDeclAs<ValueDecl>());
12318 C->setUniqueDecls(Decls);
12320 SmallVector<unsigned, 16> ListsPerDecl;
12321 ListsPerDecl.reserve(UniqueDecls);
12322 for (
unsigned i = 0; i < UniqueDecls; ++i)
12323 ListsPerDecl.push_back(Record.readInt());
12324 C->setDeclNumLists(ListsPerDecl);
12326 SmallVector<unsigned, 32> ListSizes;
12327 ListSizes.reserve(TotalLists);
12328 for (
unsigned i = 0; i < TotalLists; ++i)
12329 ListSizes.push_back(Record.readInt());
12330 C->setComponentListSizes(ListSizes);
12332 SmallVector<OMPClauseMappableExprCommon::MappableComponent, 32> Components;
12333 Components.reserve(TotalComponents);
12334 for (
unsigned i = 0; i < TotalComponents; ++i) {
12335 Expr *AssociatedExprPr = Record.readExpr();
12336 auto *AssociatedDecl = Record.readDeclAs<ValueDecl>();
12337 Components.emplace_back(AssociatedExprPr, AssociatedDecl,
12340 C->setComponents(Components, ListSizes);
12346 C->setLParenLoc(Record.readSourceLocation());
12347 C->setColonLoc(Record.readSourceLocation());
12348 C->setAllocator(Record.readSubExpr());
12349 C->setAlignment(Record.readSubExpr());
12350 unsigned NumVars =
C->varlist_size();
12351 SmallVector<Expr *, 16> Vars;
12352 Vars.reserve(NumVars);
12353 for (
unsigned i = 0; i != NumVars; ++i)
12354 Vars.push_back(Record.readSubExpr());
12355 C->setVarRefs(Vars);
12360 C->setLParenLoc(Record.readSourceLocation());
12361 unsigned NumVars =
C->varlist_size();
12362 SmallVector<Expr *, 16> Vars;
12363 Vars.reserve(NumVars);
12364 for (
unsigned I = 0; I != NumVars; ++I)
12365 Vars.push_back(Record.readSubExpr());
12366 C->setVarRefs(Vars);
12371 C->setLParenLoc(Record.readSourceLocation());
12372 unsigned NumVars =
C->varlist_size();
12373 SmallVector<Expr *, 16> Vars;
12374 Vars.reserve(NumVars);
12375 for (
unsigned I = 0; I != NumVars; ++I)
12376 Vars.push_back(Record.readSubExpr());
12377 C->setVarRefs(Vars);
12382 C->setPriority(Record.readSubExpr());
12383 C->setLParenLoc(Record.readSourceLocation());
12389 C->setGrainsize(Record.readSubExpr());
12390 C->setModifierLoc(Record.readSourceLocation());
12391 C->setLParenLoc(Record.readSourceLocation());
12397 C->setNumTasks(Record.readSubExpr());
12398 C->setModifierLoc(Record.readSourceLocation());
12399 C->setLParenLoc(Record.readSourceLocation());
12403 C->setHint(Record.readSubExpr());
12404 C->setLParenLoc(Record.readSourceLocation());
12409 C->setDistScheduleKind(
12411 C->setChunkSize(Record.readSubExpr());
12412 C->setLParenLoc(Record.readSourceLocation());
12413 C->setDistScheduleKindLoc(Record.readSourceLocation());
12414 C->setCommaLoc(Record.readSourceLocation());
12418 C->setDefaultmapKind(
12420 C->setDefaultmapModifier(
12422 C->setLParenLoc(Record.readSourceLocation());
12423 C->setDefaultmapModifierLoc(Record.readSourceLocation());
12424 C->setDefaultmapKindLoc(Record.readSourceLocation());
12427void OMPClauseReader::VisitOMPToClause(
OMPToClause *
C) {
12428 C->setLParenLoc(Record.readSourceLocation());
12430 C->setMotionModifier(
12432 C->setMotionModifierLoc(I, Record.readSourceLocation());
12433 if (
C->getMotionModifier(I) == OMPC_MOTION_MODIFIER_iterator)
12434 C->setIteratorModifier(Record.readExpr());
12436 C->setMapperQualifierLoc(Record.readNestedNameSpecifierLoc());
12437 C->setMapperIdInfo(Record.readDeclarationNameInfo());
12438 C->setColonLoc(Record.readSourceLocation());
12439 auto NumVars =
C->varlist_size();
12440 auto UniqueDecls =
C->getUniqueDeclarationsNum();
12441 auto TotalLists =
C->getTotalComponentListNum();
12442 auto TotalComponents =
C->getTotalComponentsNum();
12444 SmallVector<Expr *, 16> Vars;
12445 Vars.reserve(NumVars);
12446 for (
unsigned i = 0; i != NumVars; ++i)
12447 Vars.push_back(Record.readSubExpr());
12448 C->setVarRefs(Vars);
12450 SmallVector<Expr *, 16> UDMappers;
12451 UDMappers.reserve(NumVars);
12452 for (
unsigned I = 0; I < NumVars; ++I)
12453 UDMappers.push_back(Record.readSubExpr());
12454 C->setUDMapperRefs(UDMappers);
12456 SmallVector<ValueDecl *, 16> Decls;
12457 Decls.reserve(UniqueDecls);
12458 for (
unsigned i = 0; i < UniqueDecls; ++i)
12459 Decls.push_back(Record.readDeclAs<ValueDecl>());
12460 C->setUniqueDecls(Decls);
12462 SmallVector<unsigned, 16> ListsPerDecl;
12463 ListsPerDecl.reserve(UniqueDecls);
12464 for (
unsigned i = 0; i < UniqueDecls; ++i)
12465 ListsPerDecl.push_back(Record.readInt());
12466 C->setDeclNumLists(ListsPerDecl);
12468 SmallVector<unsigned, 32> ListSizes;
12469 ListSizes.reserve(TotalLists);
12470 for (
unsigned i = 0; i < TotalLists; ++i)
12471 ListSizes.push_back(Record.readInt());
12472 C->setComponentListSizes(ListSizes);
12474 SmallVector<OMPClauseMappableExprCommon::MappableComponent, 32> Components;
12475 Components.reserve(TotalComponents);
12476 for (
unsigned i = 0; i < TotalComponents; ++i) {
12477 Expr *AssociatedExprPr = Record.readSubExpr();
12478 bool IsNonContiguous = Record.readBool();
12479 auto *AssociatedDecl = Record.readDeclAs<ValueDecl>();
12480 Components.emplace_back(AssociatedExprPr, AssociatedDecl, IsNonContiguous);
12482 C->setComponents(Components, ListSizes);
12486 C->setLParenLoc(Record.readSourceLocation());
12488 C->setMotionModifier(
12490 C->setMotionModifierLoc(I, Record.readSourceLocation());
12491 if (
C->getMotionModifier(I) == OMPC_MOTION_MODIFIER_iterator)
12492 C->setIteratorModifier(Record.readExpr());
12494 C->setMapperQualifierLoc(Record.readNestedNameSpecifierLoc());
12495 C->setMapperIdInfo(Record.readDeclarationNameInfo());
12496 C->setColonLoc(Record.readSourceLocation());
12497 auto NumVars =
C->varlist_size();
12498 auto UniqueDecls =
C->getUniqueDeclarationsNum();
12499 auto TotalLists =
C->getTotalComponentListNum();
12500 auto TotalComponents =
C->getTotalComponentsNum();
12502 SmallVector<Expr *, 16> Vars;
12503 Vars.reserve(NumVars);
12504 for (
unsigned i = 0; i != NumVars; ++i)
12505 Vars.push_back(Record.readSubExpr());
12506 C->setVarRefs(Vars);
12508 SmallVector<Expr *, 16> UDMappers;
12509 UDMappers.reserve(NumVars);
12510 for (
unsigned I = 0; I < NumVars; ++I)
12511 UDMappers.push_back(Record.readSubExpr());
12512 C->setUDMapperRefs(UDMappers);
12514 SmallVector<ValueDecl *, 16> Decls;
12515 Decls.reserve(UniqueDecls);
12516 for (
unsigned i = 0; i < UniqueDecls; ++i)
12517 Decls.push_back(Record.readDeclAs<ValueDecl>());
12518 C->setUniqueDecls(Decls);
12520 SmallVector<unsigned, 16> ListsPerDecl;
12521 ListsPerDecl.reserve(UniqueDecls);
12522 for (
unsigned i = 0; i < UniqueDecls; ++i)
12523 ListsPerDecl.push_back(Record.readInt());
12524 C->setDeclNumLists(ListsPerDecl);
12526 SmallVector<unsigned, 32> ListSizes;
12527 ListSizes.reserve(TotalLists);
12528 for (
unsigned i = 0; i < TotalLists; ++i)
12529 ListSizes.push_back(Record.readInt());
12530 C->setComponentListSizes(ListSizes);
12532 SmallVector<OMPClauseMappableExprCommon::MappableComponent, 32> Components;
12533 Components.reserve(TotalComponents);
12534 for (
unsigned i = 0; i < TotalComponents; ++i) {
12535 Expr *AssociatedExprPr = Record.readSubExpr();
12536 bool IsNonContiguous = Record.readBool();
12537 auto *AssociatedDecl = Record.readDeclAs<ValueDecl>();
12538 Components.emplace_back(AssociatedExprPr, AssociatedDecl, IsNonContiguous);
12540 C->setComponents(Components, ListSizes);
12544 C->setLParenLoc(Record.readSourceLocation());
12545 auto NumVars =
C->varlist_size();
12546 auto UniqueDecls =
C->getUniqueDeclarationsNum();
12547 auto TotalLists =
C->getTotalComponentListNum();
12548 auto TotalComponents =
C->getTotalComponentsNum();
12550 SmallVector<Expr *, 16> Vars;
12551 Vars.reserve(NumVars);
12552 for (
unsigned i = 0; i != NumVars; ++i)
12553 Vars.push_back(Record.readSubExpr());
12554 C->setVarRefs(Vars);
12556 for (
unsigned i = 0; i != NumVars; ++i)
12557 Vars.push_back(Record.readSubExpr());
12558 C->setPrivateCopies(Vars);
12560 for (
unsigned i = 0; i != NumVars; ++i)
12561 Vars.push_back(Record.readSubExpr());
12564 SmallVector<ValueDecl *, 16> Decls;
12565 Decls.reserve(UniqueDecls);
12566 for (
unsigned i = 0; i < UniqueDecls; ++i)
12567 Decls.push_back(Record.readDeclAs<ValueDecl>());
12568 C->setUniqueDecls(Decls);
12570 SmallVector<unsigned, 16> ListsPerDecl;
12571 ListsPerDecl.reserve(UniqueDecls);
12572 for (
unsigned i = 0; i < UniqueDecls; ++i)
12573 ListsPerDecl.push_back(Record.readInt());
12574 C->setDeclNumLists(ListsPerDecl);
12576 SmallVector<unsigned, 32> ListSizes;
12577 ListSizes.reserve(TotalLists);
12578 for (
unsigned i = 0; i < TotalLists; ++i)
12579 ListSizes.push_back(Record.readInt());
12580 C->setComponentListSizes(ListSizes);
12582 SmallVector<OMPClauseMappableExprCommon::MappableComponent, 32> Components;
12583 Components.reserve(TotalComponents);
12584 for (
unsigned i = 0; i < TotalComponents; ++i) {
12585 auto *AssociatedExprPr = Record.readSubExpr();
12586 auto *AssociatedDecl = Record.readDeclAs<ValueDecl>();
12587 Components.emplace_back(AssociatedExprPr, AssociatedDecl,
12590 C->setComponents(Components, ListSizes);
12594 C->setLParenLoc(Record.readSourceLocation());
12595 auto NumVars =
C->varlist_size();
12596 auto UniqueDecls =
C->getUniqueDeclarationsNum();
12597 auto TotalLists =
C->getTotalComponentListNum();
12598 auto TotalComponents =
C->getTotalComponentsNum();
12600 SmallVector<Expr *, 16> Vars;
12601 Vars.reserve(NumVars);
12602 for (
unsigned i = 0; i != NumVars; ++i)
12603 Vars.push_back(Record.readSubExpr());
12604 C->setVarRefs(Vars);
12606 SmallVector<ValueDecl *, 16> Decls;
12607 Decls.reserve(UniqueDecls);
12608 for (
unsigned i = 0; i < UniqueDecls; ++i)
12609 Decls.push_back(Record.readDeclAs<ValueDecl>());
12610 C->setUniqueDecls(Decls);
12612 SmallVector<unsigned, 16> ListsPerDecl;
12613 ListsPerDecl.reserve(UniqueDecls);
12614 for (
unsigned i = 0; i < UniqueDecls; ++i)
12615 ListsPerDecl.push_back(Record.readInt());
12616 C->setDeclNumLists(ListsPerDecl);
12618 SmallVector<unsigned, 32> ListSizes;
12619 ListSizes.reserve(TotalLists);
12620 for (
unsigned i = 0; i < TotalLists; ++i)
12621 ListSizes.push_back(Record.readInt());
12622 C->setComponentListSizes(ListSizes);
12624 SmallVector<OMPClauseMappableExprCommon::MappableComponent, 32> Components;
12625 Components.reserve(TotalComponents);
12626 for (
unsigned i = 0; i < TotalComponents; ++i) {
12627 Expr *AssociatedExpr = Record.readSubExpr();
12628 auto *AssociatedDecl = Record.readDeclAs<ValueDecl>();
12629 Components.emplace_back(AssociatedExpr, AssociatedDecl,
12632 C->setComponents(Components, ListSizes);
12636 C->setLParenLoc(Record.readSourceLocation());
12637 auto NumVars =
C->varlist_size();
12638 auto UniqueDecls =
C->getUniqueDeclarationsNum();
12639 auto TotalLists =
C->getTotalComponentListNum();
12640 auto TotalComponents =
C->getTotalComponentsNum();
12642 SmallVector<Expr *, 16> Vars;
12643 Vars.reserve(NumVars);
12644 for (
unsigned i = 0; i != NumVars; ++i)
12645 Vars.push_back(Record.readSubExpr());
12646 C->setVarRefs(Vars);
12649 SmallVector<ValueDecl *, 16> Decls;
12650 Decls.reserve(UniqueDecls);
12651 for (
unsigned i = 0; i < UniqueDecls; ++i)
12652 Decls.push_back(Record.readDeclAs<ValueDecl>());
12653 C->setUniqueDecls(Decls);
12655 SmallVector<unsigned, 16> ListsPerDecl;
12656 ListsPerDecl.reserve(UniqueDecls);
12657 for (
unsigned i = 0; i < UniqueDecls; ++i)
12658 ListsPerDecl.push_back(Record.readInt());
12659 C->setDeclNumLists(ListsPerDecl);
12661 SmallVector<unsigned, 32> ListSizes;
12662 ListSizes.reserve(TotalLists);
12663 for (
unsigned i = 0; i < TotalLists; ++i)
12664 ListSizes.push_back(Record.readInt());
12665 C->setComponentListSizes(ListSizes);
12667 SmallVector<OMPClauseMappableExprCommon::MappableComponent, 32> Components;
12668 Components.reserve(TotalComponents);
12669 for (
unsigned i = 0; i < TotalComponents; ++i) {
12670 Expr *AssociatedExpr = Record.readSubExpr();
12671 auto *AssociatedDecl = Record.readDeclAs<ValueDecl>();
12672 Components.emplace_back(AssociatedExpr, AssociatedDecl,
12675 C->setComponents(Components, ListSizes);
12679 C->setLParenLoc(Record.readSourceLocation());
12680 auto NumVars =
C->varlist_size();
12681 auto UniqueDecls =
C->getUniqueDeclarationsNum();
12682 auto TotalLists =
C->getTotalComponentListNum();
12683 auto TotalComponents =
C->getTotalComponentsNum();
12685 SmallVector<Expr *, 16> Vars;
12686 Vars.reserve(NumVars);
12687 for (
unsigned I = 0; I != NumVars; ++I)
12688 Vars.push_back(Record.readSubExpr());
12689 C->setVarRefs(Vars);
12692 SmallVector<ValueDecl *, 16> Decls;
12693 Decls.reserve(UniqueDecls);
12694 for (
unsigned I = 0; I < UniqueDecls; ++I)
12695 Decls.push_back(Record.readDeclAs<ValueDecl>());
12696 C->setUniqueDecls(Decls);
12698 SmallVector<unsigned, 16> ListsPerDecl;
12699 ListsPerDecl.reserve(UniqueDecls);
12700 for (
unsigned I = 0; I < UniqueDecls; ++I)
12701 ListsPerDecl.push_back(Record.readInt());
12702 C->setDeclNumLists(ListsPerDecl);
12704 SmallVector<unsigned, 32> ListSizes;
12705 ListSizes.reserve(TotalLists);
12706 for (
unsigned i = 0; i < TotalLists; ++i)
12707 ListSizes.push_back(Record.readInt());
12708 C->setComponentListSizes(ListSizes);
12710 SmallVector<OMPClauseMappableExprCommon::MappableComponent, 32> Components;
12711 Components.reserve(TotalComponents);
12712 for (
unsigned I = 0; I < TotalComponents; ++I) {
12713 Expr *AssociatedExpr = Record.readSubExpr();
12714 auto *AssociatedDecl = Record.readDeclAs<ValueDecl>();
12715 Components.emplace_back(AssociatedExpr, AssociatedDecl,
12718 C->setComponents(Components, ListSizes);
12722 C->setLParenLoc(Record.readSourceLocation());
12723 unsigned NumVars =
C->varlist_size();
12724 SmallVector<Expr *, 16> Vars;
12725 Vars.reserve(NumVars);
12726 for (
unsigned i = 0; i != NumVars; ++i)
12727 Vars.push_back(Record.readSubExpr());
12728 C->setVarRefs(Vars);
12730 Vars.reserve(NumVars);
12731 for (
unsigned i = 0; i != NumVars; ++i)
12732 Vars.push_back(Record.readSubExpr());
12733 C->setPrivateRefs(Vars);
12737 C->setLParenLoc(Record.readSourceLocation());
12738 unsigned NumVars =
C->varlist_size();
12739 SmallVector<Expr *, 16> Vars;
12740 Vars.reserve(NumVars);
12741 for (
unsigned i = 0; i != NumVars; ++i)
12742 Vars.push_back(Record.readSubExpr());
12743 C->setVarRefs(Vars);
12747 C->setLParenLoc(Record.readSourceLocation());
12748 unsigned NumVars =
C->varlist_size();
12749 SmallVector<Expr *, 16> Vars;
12750 Vars.reserve(NumVars);
12751 for (
unsigned i = 0; i != NumVars; ++i)
12752 Vars.push_back(Record.readSubExpr());
12753 C->setVarRefs(Vars);
12757 C->setLParenLoc(Record.readSourceLocation());
12758 unsigned NumOfAllocators =
C->getNumberOfAllocators();
12759 SmallVector<OMPUsesAllocatorsClause::Data, 4>
Data;
12760 Data.reserve(NumOfAllocators);
12761 for (
unsigned I = 0; I != NumOfAllocators; ++I) {
12762 OMPUsesAllocatorsClause::Data &D =
Data.emplace_back();
12765 D.
LParenLoc = Record.readSourceLocation();
12766 D.
RParenLoc = Record.readSourceLocation();
12768 C->setAllocatorsData(
Data);
12772 C->setLParenLoc(Record.readSourceLocation());
12773 C->setModifier(Record.readSubExpr());
12774 C->setColonLoc(Record.readSourceLocation());
12775 unsigned NumOfLocators =
C->varlist_size();
12776 SmallVector<Expr *, 4> Locators;
12777 Locators.reserve(NumOfLocators);
12778 for (
unsigned I = 0; I != NumOfLocators; ++I)
12779 Locators.push_back(Record.readSubExpr());
12780 C->setVarRefs(Locators);
12786 C->setLParenLoc(Record.readSourceLocation());
12787 C->setKindKwLoc(Record.readSourceLocation());
12788 C->setModifierKwLoc(Record.readSourceLocation());
12793 C->setThreadID(Record.readSubExpr());
12794 C->setLParenLoc(Record.readSourceLocation());
12799 C->setLParenLoc(Record.readSourceLocation());
12800 C->setBindKindLoc(Record.readSourceLocation());
12804 C->setAlignment(Record.readExpr());
12805 C->setLParenLoc(Record.readSourceLocation());
12810 C->setSize(Record.readSubExpr());
12811 C->setLParenLoc(Record.readSourceLocation());
12814void OMPClauseReader::VisitOMPDynGroupprivateClause(
12817 C->setDynGroupprivateModifier(
12819 C->setDynGroupprivateFallbackModifier(
12821 C->setSize(Record.readSubExpr());
12822 C->setLParenLoc(Record.readSourceLocation());
12823 C->setDynGroupprivateModifierLoc(Record.readSourceLocation());
12824 C->setDynGroupprivateFallbackModifierLoc(Record.readSourceLocation());
12828 C->setLParenLoc(Record.readSourceLocation());
12829 C->setDependenceType(
12831 C->setDependenceLoc(Record.readSourceLocation());
12832 C->setColonLoc(Record.readSourceLocation());
12833 unsigned NumVars =
C->varlist_size();
12834 SmallVector<Expr *, 16> Vars;
12835 Vars.reserve(NumVars);
12836 for (
unsigned I = 0; I != NumVars; ++I)
12837 Vars.push_back(Record.readSubExpr());
12838 C->setVarRefs(Vars);
12839 for (
unsigned I = 0, E =
C->getNumLoops(); I < E; ++I)
12840 C->setLoopData(I, Record.readSubExpr());
12845 Record.readAttributes(Attrs);
12846 C->setAttrs(Attrs);
12847 C->setLocStart(Record.readSourceLocation());
12848 C->setLParenLoc(Record.readSourceLocation());
12849 C->setLocEnd(Record.readSourceLocation());
12862 Selector.ScoreOrCondition =
nullptr;
12864 Selector.ScoreOrCondition = readExprRef();
12876 if (Reader->ReadingKind == ASTReader::Read_Stmt) {
12881 for (
unsigned I = 0, E =
Data->getNumClauses(); I < E; ++I)
12883 Data->setClauses(Clauses);
12884 if (
Data->hasAssociatedStmt())
12886 for (
unsigned I = 0, E =
Data->getNumChildren(); I < E; ++I)
12891 unsigned NumVars =
readInt();
12893 for (
unsigned I = 0; I < NumVars; ++I)
12899 unsigned NumExprs =
readInt();
12901 for (
unsigned I = 0; I < NumExprs; ++I)
12911 switch (ClauseKind) {
12926 bool isConditionExprClause =
readBool();
12927 if (isConditionExprClause) {
12932 unsigned NumVars =
readInt();
12934 for (
unsigned I = 0; I < NumVars; ++I)
12941 unsigned NumClauses =
readInt();
12943 for (
unsigned I = 0; I < NumClauses; ++I)
12977 for (
unsigned I = 0; I < VarList.size(); ++I) {
12980 RecipeList.push_back({Alloca});
12984 VarList, RecipeList, EndLoc);
13002 for (
unsigned I = 0; I < VarList.size(); ++I) {
13006 RecipeList.push_back({Recipe, RecipeTemp});
13010 VarList, RecipeList, EndLoc);
13061 LParenLoc, ModList, VarList, EndLoc);
13070 LParenLoc, ModList, VarList, EndLoc);
13079 LParenLoc, ModList, VarList, EndLoc);
13088 LParenLoc, ModList, VarList, EndLoc);
13094 AsyncExpr, EndLoc);
13102 DevNumExpr, QueuesLoc, QueueIdExprs,
13109 unsigned NumArchs =
readInt();
13111 for (
unsigned I = 0; I < NumArchs; ++I) {
13114 Archs.emplace_back(Loc, Ident);
13118 LParenLoc, Archs, EndLoc);
13126 for (
unsigned I = 0; I < VarList.size(); ++I) {
13130 3 *
sizeof(
int *));
13133 unsigned NumCombiners =
readInt();
13134 for (
unsigned I = 0; I < NumCombiners; ++I) {
13139 Combiners.push_back({LHS, RHS, Op});
13142 RecipeList.push_back({Recipe, Combiners});
13146 VarList, RecipeList, EndLoc);
13165 HasForce, LoopCount, EndLoc);
13169 unsigned NumClauses =
readInt();
13171 for (
unsigned I = 0; I < NumClauses; ++I)
13174 SizeExprs, EndLoc);
13178 unsigned NumExprs =
readInt();
13181 for (
unsigned I = 0; I < NumExprs; ++I) {
13187 GangKinds, Exprs, EndLoc);
13193 WorkerExpr, EndLoc);
13199 VectorExpr, EndLoc);
13211 LParenLoc, VarList, EndLoc);
13225 llvm_unreachable(
"Clause serialization not yet implemented");
13227 llvm_unreachable(
"Invalid Clause Kind");
13232 for (
unsigned I = 0; I < Clauses.size(); ++I)
13237 unsigned NumVars =
readInt();
13238 A->Clauses.resize(NumVars);
13245 llvm::FoldingSetNodeID ID;
13246 ID.AddString(PrimaryModuleName);
13247 return ID.computeStableHash();
13252 return std::nullopt;
13255 return std::nullopt;
13258 return std::nullopt;
Defines the clang::ASTContext interface.
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 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 bool checkModuleCachePath(llvm::vfs::FileSystem &VFS, StringRef SpecificModuleCachePath, StringRef ExistingModuleCachePath, StringRef ASTFilename, DiagnosticsEngine *Diags, const LangOptions &LangOpts, const PreprocessorOptions &PPOpts, const HeaderSearchOptions &HSOpts, const HeaderSearchOptions &ASTFileHSOpts)
Check that the specified and the existing module cache paths are equivalent.
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.
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.
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::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.
#define IMPORT(DERIVED, BASE)
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 ...
OMPTraitInfo & getNewOMPTraitInfo()
Return a new OMPTraitInfo object owned by this context.
QualType getQualifiedType(SplitQualType split) const
Un-split a SplitQualType.
void adjustExceptionSpec(FunctionDecl *FD, const FunctionProtoType::ExceptionSpecInfo &ESI, bool AsWritten=false)
Change the exception specification on a function once it is delay-parsed, instantiated,...
void deduplicateMergedDefinitionsFor(NamedDecl *ND)
Clean up the merged definition list.
void adjustDeducedFunctionResultType(FunctionDecl *FD, QualType ResultType)
Change the result type of a function type once it is deduced.
void setPrimaryMergedDecl(Decl *D, Decl *Primary)
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 bool ReadLanguageOptions(const LangOptions &LangOpts, StringRef ModuleFilename, bool Complain, bool AllowCompatibleDifferences)
Receives the language options.
virtual void visitModuleFile(StringRef Filename, serialization::ModuleKind Kind)
This is called for each AST file loaded.
virtual void ReadModuleName(StringRef ModuleName)
virtual void ReadCounter(const serialization::ModuleFile &M, uint32_t Value)
Receives COUNTER value.
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.
SmallVectorImpl< uint64_t > RecordDataImpl
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.
T * ReadDeclAs(ModuleFile &F, const RecordDataImpl &R, unsigned &I)
Reads a declaration from the given position in a record in the given module.
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.
serialization::ModuleKind ModuleKind
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.
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.
unsigned getTotalNumSLocs() const
Returns the number of source locations found in the chain.
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.
serialization::MacroID ReadMacroID(ModuleFile &F, const RecordDataImpl &Record, unsigned &Idx)
Reads a macro ID from the given position in a record in the given module.
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.
friend class PCHValidator
friend class serialization::ReadMethodPoolVisitor
void CompleteRedeclChain(const Decl *D) override
If any redeclarations of D have been imported since it was last checked, this digs out those redeclar...
SourceLocation TranslateSourceLocation(ModuleFile &ModuleFile, SourceLocation Loc) const
Translate a source location from another module file's source location space into ours.
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)
std::pair< unsigned, unsigned > findPreprocessedEntitiesInRange(SourceRange Range) override
Returns a pair of [Begin, End) indices of preallocated preprocessed entities that Range encompasses.
IdentifierInfo * get(StringRef Name) override
Retrieve the IdentifierInfo for the named identifier.
IdentifierInfo * getLocalIdentifier(ModuleFile &M, uint64_t LocalID)
void visitInputFiles(serialization::ModuleFile &MF, bool IncludeSystem, bool Complain, llvm::function_ref< void(const serialization::InputFile &IF, bool isSystem)> Visitor)
Visit all the input files of the given module file.
Module * getModule(unsigned ID) override
Retrieve the module that corresponds to the given module ID.
llvm::iterator_range< ModuleDeclIterator > getModuleFileLevelDecls(ModuleFile &Mod)
Stmt * GetExternalDeclStmt(uint64_t Offset) override
Resolve the offset of a statement into a statement.
Selector GetExternalSelector(serialization::SelectorID ID) override
Resolve a selector ID into a selector.
unsigned getTotalNumSelectors() const
Returns the number of selectors found in the chain.
MacroInfo * getMacro(serialization::MacroID ID)
Retrieve the macro with the given ID.
void ReadUndefinedButUsed(llvm::MapVector< NamedDecl *, SourceLocation > &Undefined) override
Load the set of used but not defined functions or variables with internal linkage,...
void ReadDelegatingConstructors(SmallVectorImpl< CXXConstructorDecl * > &Decls) override
Read the set of delegating constructors known to the external Sema source.
QualType GetType(serialization::TypeID ID)
Resolve a type ID into a type, potentially building a new type.
void addPendingMacro(IdentifierInfo *II, ModuleFile *M, uint32_t MacroDirectivesOffset)
Add a macro to deserialize its macro directive history.
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.
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, const HeaderSearchOptions &HSOpts, StringRef ExistingModuleCachePath, bool RequireStrictOptionMatches=false)
Determine whether the given AST file is acceptable to load into a translation unit with the given lan...
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)
friend class serialization::reader::ASTIdentifierLookupTrait
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)
FileID TranslateFileID(ModuleFile &F, FileID FID) const
Translate a FileID from another module file's FileID space into ours.
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.
Decl * GetLocalDecl(ModuleFile &F, LocalDeclID LocalID)
Reads a declaration with the given local ID in the given module.
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)
friend class ASTRecordReader
SmallVector< uint64_t, 64 > RecordData
FileID ReadFileID(ModuleFile &F, const RecordDataImpl &Record, unsigned &Idx) const
Read a FileID.
void StartedDeserializing() override
Notify ASTReader that we started deserialization of a decl or type so until FinishedDeserializing is ...
serialization::MacroID getGlobalMacroID(ModuleFile &M, serialization::MacroID LocalID)
Retrieve the global macro ID corresponding to the given local ID within the given module file.
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.
void getMemoryBufferSizes(MemoryBufferSizes &sizes) const override
Return the amount of memory used by memory buffers, breaking down by heap-backed versus mmap'ed memor...
serialization::ModuleFile ModuleFile
bool hasGlobalIndex() const
Determine whether this AST reader has a global index.
serialization::PreprocessedEntityID getGlobalPreprocessedEntityID(ModuleFile &M, serialization::PreprocessedEntityID LocalID) const
Determine the global preprocessed entity ID that corresponds to the given local ID within the given m...
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.
QualType readType()
Read a type from the current position in the record.
T * readDeclAs()
Reads a declaration from the given position in the record, 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.
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 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.
void setAttr(const Attr *A)
void setConceptReference(ConceptReference *CR)
void setRParenLoc(SourceLocation Loc)
void setCaretLoc(SourceLocation Loc)
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)
void ReadCounter(const serialization::ModuleFile &M, uint32_t Value) override
Receives COUNTER value.
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 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
A map from continuous integer ranges to some value, with a very specialized interface.
void insertOrReplace(const value_type &Val)
typename Representation::iterator iterator
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.
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.
IdentifierInfo * getAsIdentifierInfo() const
Retrieve the IdentifierInfo * stored in this declaration name, or null if this declaration name isn't...
TemplateDecl * getCXXDeductionGuideTemplate() const
If this name is the name of a C++ deduction guide, return the template associated with that name.
const IdentifierInfo * getCXXLiteralIdentifier() const
If this name is the name of a literal operator, retrieve the identifier associated with it.
OverloadedOperatorKind getCXXOverloadedOperator() const
If this name is the name of an overloadable operator in C++ (e.g., operator+), retrieve the kind of o...
NameKind
The kind of the name stored in this DeclarationName.
@ CXXConversionFunctionName
Selector getObjCSelector() const
Get the Objective-C selector stored in this declaration name.
NameKind getNameKind() const
Determine what kind of name this is.
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 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)
This represents one expression.
RAII class for safely pairing a StartedDeserializing call with FinishedDeserializing.
static DeclContextLookupResult SetExternalVisibleDeclsForName(const DeclContext *DC, DeclarationName Name, ArrayRef< NamedDecl * > Decls)
uint32_t incrementGeneration(ASTContext &C)
Increment the current generation.
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.
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)
llvm::SmallPtrSet< ModuleFile *, 4 > HitSet
A set of module files in which we found a result.
static std::pair< GlobalModuleIndex *, llvm::Error > readIndex(llvm::StringRef Path)
Read a global index file for the given directory.
One of these records is kept for each identifier that is lexed.
unsigned getBuiltinID() const
Return a value indicating whether this is a builtin function.
bool isCPlusPlusOperatorKeyword() const
tok::TokenKind getTokenID() const
If this is a source-language token (e.g.
bool hadMacroDefinition() const
Returns true if this identifier was #defined to some value at any moment.
void setIsPoisoned(bool Value=true)
setIsPoisoned - Mark this identifier as poisoned.
bool isFromAST() const
Return true if the identifier in its current state was loaded from an AST file.
bool isPoisoned() const
Return true if this token has been poisoned.
bool hasRevertedTokenIDToIdentifier() const
True if revertTokenIDToIdentifier() was called.
tok::NotableIdentifierKind getNotableIdentifierID() const
void setOutOfDate(bool OOD)
Set whether the information for this identifier is out of date with respect to the external source.
tok::ObjCKeywordKind getObjCKeywordID() const
Return the Objective-C keyword ID for the this identifier.
void setObjCOrBuiltinID(unsigned ID)
void revertTokenIDToIdentifier()
Revert TokenID to tok::identifier; used for GNU libstdc++ 4.2 compatibility.
bool isOutOfDate() const
Determine whether the information for this identifier is out of date with respect to the external sou...
void setChangedSinceDeserialization()
Note that this identifier has changed since it was loaded from an AST file.
void * getFETokenInfo() const
Get and set FETokenInfo.
StringRef getName() const
Return the actual identifier string.
bool isExtensionToken() const
get/setExtension - Initialize information about whether or not this language token is an extension.
An iterator that walks over all of the known identifiers in the lookup table.
IdentifierIterator()=default
IdentifierResolver - Keeps track of shadowed decls on enclosing scopes.
void RemoveDecl(NamedDecl *D)
RemoveDecl - Unlink the decl from its shadowed decl chain.
Implements an efficient mapping from strings to IdentifierInfo nodes.
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.
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)
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 ...
NestedNameSpecifierLoc getWithLocInContext(ASTContext &Context) const
Retrieve a nested-name-specifier with location information, copied into the given AST context.
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)
void 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' dir...
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 'dyn_groupprivate' clause in 'pragma omp target ...' and 'pragma omp teams ....
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 class represents the 'looprange' clause in the 'pragma omp fuse' directive.
static OMPLoopRangeClause * CreateEmpty(const ASTContext &C)
Build an empty 'looprange' clause node.
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' directiv...
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' directi...
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 'threadset' clause in the 'pragma omp task ...' 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
void setNameLoc(SourceLocation Loc)
void setNameEndLoc(SourceLocation Loc)
ObjCMethodDecl - Represents an instance or class method declaration.
bool hasBody() const override
Determine whether this method has a body.
void setLazyBody(uint64_t Offset)
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)
Kind
The basic Objective-C runtimes that we know about.
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< OpenACCPrivateRecipe > InitRecipes, SourceLocation EndLoc)
static OpenACCReductionClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, OpenACCReductionOperator Operator, ArrayRef< Expr * > VarList, ArrayRef< OpenACCReductionRecipeWithStorage > 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...
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, uint32_t 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)
void setStarLoc(SourceLocation Loc)
Base class that describes a preprocessed entity, which may be a preprocessor directive or macro expan...
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 p...
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.
HeaderSearch & getHeaderSearchInfo() const
A (possibly-)qualified type.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
@ FastWidth
The width of the "fast" qualifier mask.
@ FastMask
The fast qualifier mask.
void setAmpAmpLoc(SourceLocation Loc)
Wrapper for source info for record types.
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 * getAsOpaquePtr() const
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.
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.
SourceLocation getFileLoc(SourceLocation Loc) const
Given Loc, if it is a macro location return the expansion location or the spelling location,...
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.
One instance of this struct is kept for every file loaded or used.
OptionalFileEntryRef ContentsEntry
References the file which the contents were actually loaded from.
std::optional< llvm::MemoryBufferRef > getBufferIfLoaded() const
Return the buffer, only if it has been loaded.
unsigned BufferOverridden
Indicates whether the buffer itself was provided to override the actual file contents.
OptionalFileEntryRef OrigEntry
Reference to the file entry representing this ContentCache.
Information about a FileID, basically just the logical file that it represents and include stack info...
void setHasLineDirectives()
Set the flag that indicates that this FileID has line table entries associated with it.
Stmt - This represents one statement.
void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
void setNameLoc(SourceLocation Loc)
void setElaboratedKeywordLoc(SourceLocation Loc)
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)
Token - This structure provides full information about a lexed token.
[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.
void setLParenLoc(SourceLocation Loc)
void setTypeofLoc(SourceLocation Loc)
void setRParenLoc(SourceLocation Loc)
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.
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.
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.
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.
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)
void ReadDataIntoImpl(const unsigned char *d, unsigned DataLen, data_type_builder &Val)
file_type ReadFileRef(const unsigned char *&d)
DeclarationNameKey ReadKeyBase(const unsigned char *&d)
internal_key_type ReadKey(const unsigned char *d, unsigned)
DeclarationNameKey internal_key_type
void ReadDataInto(internal_key_type, const unsigned char *d, unsigned DataLen, data_type_builder &Val)
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)
external_key_type internal_key_type
Class that performs lookup to specialized decls.
file_type ReadFileRef(const unsigned char *&d)
void ReadDataInto(internal_key_type, const unsigned char *d, unsigned DataLen, data_type_builder &Val)
unsigned internal_key_type
static std::pair< unsigned, unsigned > ReadKeyDataLength(const unsigned char *&d)
internal_key_type ReadKey(const unsigned char *d, unsigned)
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.
@ ModuleFile
The module file (.pcm). Required.
unsigned kind
All of the diagnostics that can be emitted by the frontend.
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...
std::variant< struct RequiresDecl, struct HeaderDecl, struct UmbrellaDirDecl, struct ModuleDecl, struct ExcludeDecl, struct ExportDecl, struct ExportAsDecl, struct ExternModuleDecl, struct UseDecl, struct LinkDecl, struct ConfigMacrosDecl, struct ConflictDecl > Decl
All declarations that can appear in a module declaration.
llvm::OnDiskChainedHashTable< ASTSelectorLookupTrait > ASTSelectorLookupTable
The on-disk hash table used for the global method pool.
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.
GlobalDeclID LazySpecializationInfo
@ EXTENSION_METADATA
Metadata describing this particular extension.
@ 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.
uint32_t SelectorID
An ID number that refers to an ObjC selector in an AST file.
const unsigned int NUM_PREDEF_IDENT_IDS
The number of predefined identifier IDs.
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.
const unsigned int NUM_PREDEF_PP_ENTITY_IDS
The number of predefined preprocessed entity IDs.
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.
DeclIDBase::DeclID DeclID
An ID number that refers to a declaration in an AST file.
@ 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.
uint64_t PreprocessedEntityID
An ID number that refers to an entity in the detailed preprocessing record.
llvm::support::detail::packed_endian_specific_integral< serialization::DeclID, llvm::endianness::native, llvm::support::unaligned > unaligned_decl_id_t
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.
uint64_t MacroID
An ID number that refers to a macro in an AST file.
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.
uint64_t TypeID
An ID number that refers to a type in an AST 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.
uint32_t SubmoduleID
An ID number that refers to a submodule in a module 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.
@ RISCV_VECTOR_INTRINSICS_PRAGMA
Record code for pragma clang riscv intrinsic vector.
@ 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.
unsigned ComputeHash(Selector Sel)
TypeID LocalTypeID
Same with TypeID except that the LocalTypeID is only meaningful with the corresponding ModuleFile.
uint64_t IdentifierID
An ID number that refers to an identifier in an AST file.
TokenKind
Provides a simple uniform namespace for tokens from all C languages.
The JSON file list parser is used to communicate input to InstallAPI.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
bool isa(CodeGen::Address addr)
CustomizableOptional< FileEntryRef > OptionalFileEntryRef
SanitizerMask getPPTransparentSanitizers()
Return the sanitizers which do not affect preprocessing.
OpenMPDefaultClauseVariableCategory
OpenMP variable-category for 'default' clause.
OpenMPDefaultmapClauseModifier
OpenMP modifiers for 'defaultmap' clause.
OpenMPOrderClauseModifier
OpenMP modifiers for 'order' clause.
std::vector< std::string > Macros
A list of macros of the form <definition>=<expansion> .
@ Success
Annotation was successful.
std::pair< FileID, unsigned > FileIDAndOffset
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...
SmallVector< Attr *, 4 > AttrVec
AttrVec - A vector of Attr, which is how they are stored on the AST.
nullptr
This class represents a compute construct, representing a 'Kind' of ‘parallel’, 'serial',...
OpenMPDistScheduleClauseKind
OpenMP attributes for 'dist_schedule' clause.
OpenMPDoacrossClauseModifier
OpenMP dependence types for 'doacross' clause.
static constexpr unsigned NumberOfOMPMapClauseModifiers
Number of allowed map-type-modifiers.
OpenMPDynGroupprivateClauseFallbackModifier
@ Module
Module linkage, which indicates that the entity can be referred to from other translation units withi...
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.
const FunctionProtoType * T
OpenMPLastprivateModifier
OpenMP 'lastprivate' clause modifier.
@ Template
We are parsing a template declaration.
OpenMPDependClauseKind
OpenMP attributes for 'depend' clause.
OpenMPGrainsizeClauseModifier
OpenMPNumTasksClauseModifier
@ Type
The name was classified as a type.
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.
llvm::omp::Directive OpenMPDirectiveKind
OpenMP directives.
TypeSpecifierSign
Specifies the signedness of a type, e.g., signed or unsigned.
OpenMPDynGroupprivateClauseModifier
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.
llvm::omp::Clause OpenMPClauseKind
OpenMP clauses.
OpenMPOrderClauseKind
OpenMP attributes for 'order' clause.
OpenMPScheduleClauseKind
OpenMP attributes for 'schedule' clause.
OpenMPThreadsetKind
OpenMP modifiers for 'threadset' 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.
__LIBC_ATTRS FILE * stderr
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.
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.
SourceLocation LParenLoc
Locations of '(' and ')' symbols.
Expr * AllocatorTraits
Allocator traits.
Expr * Allocator
Allocator.
a linked list of methods with the same selector name but different signatures.
ObjCMethodList * getNext() const
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)
MultiOnDiskHashTable< LazySpecializationInfoLookupTrait > Table
void insert(LazySpecializationInfo Info)