98#include "llvm/ADT/APFloat.h"
99#include "llvm/ADT/APInt.h"
100#include "llvm/ADT/APSInt.h"
101#include "llvm/ADT/ArrayRef.h"
102#include "llvm/ADT/DenseMap.h"
103#include "llvm/ADT/FloatingPointMode.h"
104#include "llvm/ADT/FoldingSet.h"
105#include "llvm/ADT/Hashing.h"
106#include "llvm/ADT/IntrusiveRefCntPtr.h"
107#include "llvm/ADT/STLExtras.h"
108#include "llvm/ADT/ScopeExit.h"
109#include "llvm/ADT/Sequence.h"
110#include "llvm/ADT/SmallPtrSet.h"
111#include "llvm/ADT/SmallString.h"
112#include "llvm/ADT/SmallVector.h"
113#include "llvm/ADT/StringExtras.h"
114#include "llvm/ADT/StringMap.h"
115#include "llvm/ADT/StringRef.h"
116#include "llvm/ADT/iterator_range.h"
117#include "llvm/Bitstream/BitstreamReader.h"
118#include "llvm/Support/Casting.h"
119#include "llvm/Support/Compiler.h"
120#include "llvm/Support/Compression.h"
121#include "llvm/Support/DJB.h"
122#include "llvm/Support/Endian.h"
123#include "llvm/Support/Error.h"
124#include "llvm/Support/ErrorHandling.h"
125#include "llvm/Support/FileSystem.h"
126#include "llvm/Support/LEB128.h"
127#include "llvm/Support/MemoryBuffer.h"
128#include "llvm/Support/Path.h"
129#include "llvm/Support/SaveAndRestore.h"
130#include "llvm/Support/TimeProfiler.h"
131#include "llvm/Support/Timer.h"
132#include "llvm/Support/VersionTuple.h"
133#include "llvm/Support/raw_ostream.h"
134#include "llvm/TargetParser/Triple.h"
147#include <system_error>
152using namespace clang;
155using llvm::BitstreamCursor;
163 return First->ReadFullVersionInformation(FullVersion) ||
164 Second->ReadFullVersionInformation(FullVersion);
168 First->ReadModuleName(ModuleName);
169 Second->ReadModuleName(ModuleName);
173 First->ReadModuleMapFile(ModuleMapPath);
174 Second->ReadModuleMapFile(ModuleMapPath);
178 const LangOptions &LangOpts, StringRef ModuleFilename,
bool Complain,
179 bool AllowCompatibleDifferences) {
180 return First->ReadLanguageOptions(LangOpts, ModuleFilename, Complain,
181 AllowCompatibleDifferences) ||
182 Second->ReadLanguageOptions(LangOpts, ModuleFilename, Complain,
183 AllowCompatibleDifferences);
187 const TargetOptions &TargetOpts, StringRef ModuleFilename,
bool Complain,
188 bool AllowCompatibleDifferences) {
189 return First->ReadTargetOptions(TargetOpts, ModuleFilename, Complain,
190 AllowCompatibleDifferences) ||
191 Second->ReadTargetOptions(TargetOpts, ModuleFilename, Complain,
192 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) {
290#define LANGOPT(Name, Bits, Default, Description) \
291 if (ExistingLangOpts.Name != LangOpts.Name) { \
294 Diags->Report(diag::err_ast_file_langopt_mismatch) \
295 << Description << LangOpts.Name << ExistingLangOpts.Name \
298 Diags->Report(diag::err_ast_file_langopt_value_mismatch) \
299 << Description << ModuleFilename; \
304#define VALUE_LANGOPT(Name, Bits, Default, Description) \
305 if (ExistingLangOpts.Name != LangOpts.Name) { \
307 Diags->Report(diag::err_ast_file_langopt_value_mismatch) \
308 << Description << ModuleFilename; \
312#define ENUM_LANGOPT(Name, Type, Bits, Default, Description) \
313 if (ExistingLangOpts.get##Name() != LangOpts.get##Name()) { \
315 Diags->Report(diag::err_ast_file_langopt_value_mismatch) \
316 << Description << ModuleFilename; \
320#define COMPATIBLE_LANGOPT(Name, Bits, Default, Description) \
321 if (!AllowCompatibleDifferences) \
322 LANGOPT(Name, Bits, Default, Description)
324#define COMPATIBLE_ENUM_LANGOPT(Name, Bits, Default, Description) \
325 if (!AllowCompatibleDifferences) \
326 ENUM_LANGOPT(Name, Bits, Default, Description)
328#define COMPATIBLE_VALUE_LANGOPT(Name, Bits, Default, Description) \
329 if (!AllowCompatibleDifferences) \
330 VALUE_LANGOPT(Name, Bits, Default, Description)
332#define BENIGN_LANGOPT(Name, Bits, Default, Description)
333#define BENIGN_ENUM_LANGOPT(Name, Type, Bits, Default, Description)
334#define BENIGN_VALUE_LANGOPT(Name, Bits, Default, Description)
335#include "clang/Basic/LangOptions.def"
339 Diags->
Report(diag::err_ast_file_langopt_value_mismatch)
340 <<
"module features" << ModuleFilename;
346 Diags->
Report(diag::err_ast_file_langopt_value_mismatch)
347 <<
"target Objective-C runtime" << ModuleFilename;
354 Diags->
Report(diag::err_ast_file_langopt_value_mismatch)
355 <<
"block command names" << ModuleFilename;
363 if (!AllowCompatibleDifferences) {
367 ExistingSanitizers.
clear(ModularSanitizers);
368 ImportedSanitizers.
clear(ModularSanitizers);
369 if (ExistingSanitizers.
Mask != ImportedSanitizers.
Mask) {
370 const std::string Flag =
"-fsanitize=";
372#define SANITIZER(NAME, ID) \
374 bool InExistingModule = ExistingSanitizers.has(SanitizerKind::ID); \
375 bool InImportedModule = ImportedSanitizers.has(SanitizerKind::ID); \
376 if (InExistingModule != InImportedModule) \
377 Diags->Report(diag::err_ast_file_targetopt_feature_mismatch) \
378 << InExistingModule << ModuleFilename << (Flag + NAME); \
380#include "clang/Basic/Sanitizers.def"
397 StringRef ModuleFilename,
399 bool AllowCompatibleDifferences =
true) {
400#define CHECK_TARGET_OPT(Field, Name) \
401 if (TargetOpts.Field != ExistingTargetOpts.Field) { \
403 Diags->Report(diag::err_ast_file_targetopt_mismatch) \
404 << ModuleFilename << Name << TargetOpts.Field \
405 << ExistingTargetOpts.Field; \
416 if (!AllowCompatibleDifferences) {
421#undef CHECK_TARGET_OPT
429 llvm::sort(ExistingFeatures);
430 llvm::sort(ReadFeatures);
436 ExistingFeatures.begin(), ExistingFeatures.end(), ReadFeatures.begin(),
437 ReadFeatures.end(), std::back_inserter(UnmatchedExistingFeatures));
438 std::set_difference(ReadFeatures.begin(), ReadFeatures.end(),
439 ExistingFeatures.begin(), ExistingFeatures.end(),
440 std::back_inserter(UnmatchedReadFeatures));
444 if (AllowCompatibleDifferences && UnmatchedReadFeatures.empty())
448 for (StringRef Feature : UnmatchedReadFeatures)
449 Diags->
Report(diag::err_ast_file_targetopt_feature_mismatch)
450 <<
false << ModuleFilename << Feature;
451 for (StringRef Feature : UnmatchedExistingFeatures)
452 Diags->
Report(diag::err_ast_file_targetopt_feature_mismatch)
453 <<
true << ModuleFilename << Feature;
456 return !UnmatchedReadFeatures.empty() || !UnmatchedExistingFeatures.empty();
460 StringRef ModuleFilename,
bool Complain,
461 bool AllowCompatibleDifferences) {
464 Complain ? &Reader.Diags :
nullptr,
465 AllowCompatibleDifferences);
469 StringRef ModuleFilename,
bool Complain,
470 bool AllowCompatibleDifferences) {
473 Complain ? &Reader.Diags :
nullptr,
474 AllowCompatibleDifferences);
479using MacroDefinitionsMap =
480 llvm::StringMap<std::pair<StringRef,
bool >>;
481using DeclsMap = llvm::DenseMap<DeclarationName, SmallVector<NamedDecl *, 8>>;
487 StringRef ModuleFilename,
497 for (
auto DiagIDMappingPair : MappingSource->getDiagnosticMappings()) {
506 Diags.
Report(diag::err_ast_file_diagopt_mismatch)
508 ->getWarningOptionForDiag(DiagID)
528 StringRef ModuleFilename,
bool IsSystem,
529 bool SystemHeaderWarningsInModule,
538 !SystemHeaderWarningsInModule) {
540 Diags.
Report(diag::err_ast_file_diagopt_mismatch)
541 <<
"-Wsystem-headers" << ModuleFilename;
548 Diags.
Report(diag::err_ast_file_diagopt_mismatch)
549 <<
"-Werror" << ModuleFilename;
556 Diags.
Report(diag::err_ast_file_diagopt_mismatch)
557 <<
"-Weverything -Werror" << ModuleFilename;
564 Diags.
Report(diag::err_ast_file_diagopt_mismatch)
565 <<
"-pedantic-errors" << ModuleFilename;
590 assert(!ModuleName.empty() &&
"diagnostic options read before module name");
594 assert(M &&
"missing module");
612 assert(ModuleMgr.
size() >= 1 &&
"what ASTFile is this then");
621 bool SystemHeaderWarningsInModule =
628 TopM->
IsSystem, SystemHeaderWarningsInModule,
636 MacroDefinitionsMap &Macros,
638 for (
unsigned I = 0, N = PPOpts.
Macros.size(); I != N; ++I) {
639 StringRef Macro = PPOpts.
Macros[I].first;
640 bool IsUndef = PPOpts.
Macros[I].second;
642 std::pair<StringRef, StringRef> MacroPair = Macro.split(
'=');
643 StringRef MacroName = MacroPair.first;
644 StringRef MacroBody = MacroPair.second;
648 if (MacroNames && !Macros.count(MacroName))
649 MacroNames->push_back(MacroName);
651 Macros[MacroName] = std::make_pair(
"",
true);
656 if (MacroName.size() == Macro.size())
660 StringRef::size_type End = MacroBody.find_first_of(
"\n\r");
661 MacroBody = MacroBody.substr(0, End);
664 if (MacroNames && !Macros.count(MacroName))
665 MacroNames->push_back(MacroName);
666 Macros[MacroName] = std::make_pair(MacroBody,
false);
690 std::string &SuggestedPredefines,
const LangOptions &LangOpts,
694 MacroDefinitionsMap ASTFileMacros;
696 MacroDefinitionsMap ExistingMacros;
699 &ExistingMacroNames);
703 SuggestedPredefines +=
"# 1 \"<command line>\" 1\n";
705 for (
unsigned I = 0, N = ExistingMacroNames.size(); I != N; ++I) {
707 StringRef MacroName = ExistingMacroNames[I];
708 std::pair<StringRef, bool> Existing = ExistingMacros[MacroName];
711 llvm::StringMap<std::pair<StringRef,
bool >>::iterator Known =
712 ASTFileMacros.find(MacroName);
718 Diags->
Report(diag::err_ast_file_macro_def_undef)
719 << MacroName <<
true << ModuleFilename;
727 if (Existing.second) {
728 SuggestedPredefines +=
"#undef ";
729 SuggestedPredefines += MacroName.str();
730 SuggestedPredefines +=
'\n';
732 SuggestedPredefines +=
"#define ";
733 SuggestedPredefines += MacroName.str();
734 SuggestedPredefines +=
' ';
735 SuggestedPredefines += Existing.first.str();
736 SuggestedPredefines +=
'\n';
743 if (Existing.second != Known->second.second) {
745 Diags->
Report(diag::err_ast_file_macro_def_undef)
746 << MacroName << Known->second.second << ModuleFilename;
753 if (Existing.second || Existing.first == Known->second.first) {
754 ASTFileMacros.erase(Known);
760 Diags->
Report(diag::err_ast_file_macro_def_conflict)
761 << MacroName << Known->second.first << Existing.first
768 SuggestedPredefines +=
"# 1 \"<built-in>\" 2\n";
773 for (
const auto &MacroName : ASTFileMacros.keys()) {
775 Diags->
Report(diag::err_ast_file_macro_def_undef)
776 << MacroName <<
false << ModuleFilename;
787 Diags->
Report(diag::err_ast_file_undef)
794 if (LangOpts.Modules &&
798 Diags->
Report(diag::err_ast_file_pp_detailed_record)
805 for (
unsigned I = 0, N = ExistingPPOpts.
Includes.size(); I != N; ++I) {
812 SuggestedPredefines +=
"#include \"";
813 SuggestedPredefines +=
File;
814 SuggestedPredefines +=
"\"\n";
824 SuggestedPredefines +=
"#include \"";
825 SuggestedPredefines +=
File;
826 SuggestedPredefines +=
"\"\n";
829 for (
unsigned I = 0, N = ExistingPPOpts.
MacroIncludes.size(); I != N; ++I) {
834 SuggestedPredefines +=
"#__include_macros \"";
835 SuggestedPredefines +=
File;
836 SuggestedPredefines +=
"\"\n##\n";
843 StringRef ModuleFilename,
844 bool ReadMacros,
bool Complain,
845 std::string &SuggestedPredefines) {
849 PPOpts, ExistingPPOpts, ModuleFilename, ReadMacros,
856 bool ReadMacros,
bool Complain, std::string &SuggestedPredefines) {
858 ModuleFilename, ReadMacros,
nullptr,
868 StringRef SpecificModuleCachePath,
869 StringRef ExistingModuleCachePath,
870 StringRef ModuleFilename,
875 SpecificModuleCachePath == ExistingModuleCachePath)
878 VFS.equivalent(SpecificModuleCachePath, ExistingModuleCachePath);
879 if (EqualOrErr && *EqualOrErr)
882 Diags->
Report(diag::err_ast_file_modulecache_mismatch)
883 << SpecificModuleCachePath << ExistingModuleCachePath << ModuleFilename;
888 StringRef ModuleFilename,
889 StringRef SpecificModuleCachePath,
894 Complain ? &Reader.Diags :
nullptr, PP.
getLangOpts(),
908 const char *Error =
nullptr;
910 uint64_t Val = llvm::decodeULEB128(
P, &Length,
nullptr, &Error);
912 llvm::report_fatal_error(Error);
918static std::pair<unsigned, unsigned>
921 if ((
unsigned)KeyLen != KeyLen)
922 llvm::report_fatal_error(
"key too large");
925 if ((
unsigned)DataLen != DataLen)
926 llvm::report_fatal_error(
"data too large");
928 return std::make_pair(KeyLen, DataLen);
932 bool TakeOwnership) {
933 DeserializationListener = Listener;
934 OwnsDeserializationListener = TakeOwnership;
945 Reader.ReadModuleOffsetMap(MF);
947 unsigned ModuleFileIndex =
ID.getModuleFileIndex();
954 assert(OwningModuleFile);
958 if (!ModuleFileIndex)
974std::pair<unsigned, unsigned>
981 using namespace llvm::support;
984 unsigned N = endian::readNext<uint16_t, llvm::endianness::little>(d);
986 F, endian::readNext<IdentifierID, llvm::endianness::little>(d));
993 Args.push_back(FirstII);
994 for (
unsigned I = 1; I != N; ++I)
995 Args.push_back(Reader.getLocalIdentifier(
996 F, endian::readNext<IdentifierID, llvm::endianness::little>(d)));
1004 using namespace llvm::support;
1008 Result.ID = Reader.getGlobalSelectorID(
1009 F, endian::readNext<uint32_t, llvm::endianness::little>(d));
1010 unsigned FullInstanceBits =
1011 endian::readNext<uint16_t, llvm::endianness::little>(d);
1012 unsigned FullFactoryBits =
1013 endian::readNext<uint16_t, llvm::endianness::little>(d);
1014 Result.InstanceBits = FullInstanceBits & 0x3;
1015 Result.InstanceHasMoreThanOneDecl = (FullInstanceBits >> 2) & 0x1;
1016 Result.FactoryBits = FullFactoryBits & 0x3;
1017 Result.FactoryHasMoreThanOneDecl = (FullFactoryBits >> 2) & 0x1;
1018 unsigned NumInstanceMethods = FullInstanceBits >> 3;
1019 unsigned NumFactoryMethods = FullFactoryBits >> 3;
1022 for (
unsigned I = 0; I != NumInstanceMethods; ++I) {
1026 endian::readNext<DeclID, llvm::endianness::little>(d))))
1027 Result.Instance.push_back(Method);
1031 for (
unsigned I = 0; I != NumFactoryMethods; ++I) {
1035 endian::readNext<DeclID, llvm::endianness::little>(d))))
1036 Result.Factory.push_back(Method);
1043 return llvm::djbHash(a);
1046std::pair<unsigned, unsigned>
1053 assert(n >= 2 && d[n-1] ==
'\0');
1054 return StringRef((
const char*) d, n-1);
1060 bool IsInteresting =
1071 bool Value = Bits & 0x1;
1077 using namespace llvm::support;
1080 endian::readNext<IdentifierID, llvm::endianness::little>(d);
1081 return Reader.getGlobalIdentifierID(F, RawID >> 1);
1094 const unsigned char* d,
1096 using namespace llvm::support;
1099 endian::readNext<IdentifierID, llvm::endianness::little>(d);
1100 bool IsInteresting = RawID & 0x01;
1110 II = &Reader.getIdentifierTable().getOwn(k);
1113 bool IsModule = Reader.getPreprocessor().getCurrentModule() !=
nullptr;
1115 Reader.markIdentifierUpToDate(II);
1117 IdentifierID ID = Reader.getGlobalIdentifierID(F, RawID);
1118 if (!IsInteresting) {
1121 Reader.SetIdentifierInfo(ID, II);
1125 unsigned ObjCOrBuiltinID =
1126 endian::readNext<uint16_t, llvm::endianness::little>(d);
1127 unsigned Bits = endian::readNext<uint16_t, llvm::endianness::little>(d);
1128 bool CPlusPlusOperatorKeyword =
readBit(Bits);
1129 bool HasRevertedTokenIDToIdentifier =
readBit(Bits);
1130 bool Poisoned =
readBit(Bits);
1131 bool ExtensionToken =
readBit(Bits);
1132 bool HadMacroDefinition =
readBit(Bits);
1134 assert(Bits == 0 &&
"Extra bits in the identifier?");
1135 DataLen -=
sizeof(uint16_t) * 2;
1139 if (HasRevertedTokenIDToIdentifier && II->
getTokenID() != tok::identifier)
1144 "Incorrect extension token flag");
1145 (void)ExtensionToken;
1149 "Incorrect C++ operator keyword flag");
1150 (void)CPlusPlusOperatorKeyword;
1154 if (HadMacroDefinition) {
1155 uint32_t MacroDirectivesOffset =
1156 endian::readNext<uint32_t, llvm::endianness::little>(d);
1159 Reader.addPendingMacro(II, &F, MacroDirectivesOffset);
1162 Reader.SetIdentifierInfo(ID, II);
1168 for (; DataLen > 0; DataLen -=
sizeof(
DeclID))
1169 DeclIDs.push_back(Reader.getGlobalDeclID(
1172 endian::readNext<DeclID, llvm::endianness::little>(d))));
1173 Reader.SetGloballyVisibleDecls(II, DeclIDs);
1180 : Kind(Name.getNameKind()) {
1183 Data = (uint64_t)Name.getAsIdentifierInfo();
1188 Data = (uint64_t)Name.getObjCSelector().getAsOpaquePtr();
1191 Data = Name.getCXXOverloadedOperator();
1194 Data = (uint64_t)Name.getCXXLiteralIdentifier();
1197 Data = (uint64_t)Name.getCXXDeductionGuideTemplate()
1198 ->getDeclName().getAsIdentifierInfo();
1210 llvm::FoldingSetNodeID ID;
1211 ID.AddInteger(Kind);
1234 return ID.computeStableHash();
1238ASTDeclContextNameLookupTrait::ReadFileRef(
const unsigned char *&d) {
1239 using namespace llvm::support;
1241 uint32_t ModuleFileID =
1242 endian::readNext<uint32_t, llvm::endianness::little>(d);
1243 return Reader.getLocalModuleFile(F, ModuleFileID);
1246std::pair<unsigned, unsigned>
1247ASTDeclContextNameLookupTrait::ReadKeyDataLength(
const unsigned char *&d) {
1252ASTDeclContextNameLookupTrait::ReadKey(
const unsigned char *d,
unsigned) {
1253 using namespace llvm::support;
1261 Data = (uint64_t)Reader.getLocalIdentifier(
1262 F, endian::readNext<IdentifierID, llvm::endianness::little>(d));
1267 Data = (uint64_t)Reader
1269 F, endian::readNext<uint32_t, llvm::endianness::little>(d))
1287 const unsigned char *d,
1290 using namespace llvm::support;
1292 for (
unsigned NumDecls = DataLen /
sizeof(
DeclID); NumDecls; --NumDecls) {
1294 Reader, F, endian::readNext<DeclID, llvm::endianness::little>(d));
1295 Val.
insert(Reader.getGlobalDeclID(F, ID));
1300LazySpecializationInfoLookupTrait::ReadFileRef(
const unsigned char *&d) {
1301 using namespace llvm::support;
1303 uint32_t ModuleFileID =
1304 endian::readNext<uint32_t, llvm::endianness::little, unaligned>(d);
1305 return Reader.getLocalModuleFile(F, ModuleFileID);
1309LazySpecializationInfoLookupTrait::ReadKey(
const unsigned char *d,
unsigned) {
1310 using namespace llvm::support;
1311 return endian::readNext<uint32_t, llvm::endianness::little, unaligned>(d);
1314std::pair<unsigned, unsigned>
1315LazySpecializationInfoLookupTrait::ReadKeyDataLength(
const unsigned char *&d) {
1320 const unsigned char *d,
1323 using namespace llvm::support;
1325 for (
unsigned NumDecls =
1327 NumDecls; --NumDecls) {
1330 endian::readNext<DeclID, llvm::endianness::little, unaligned>(d));
1331 Val.
insert(Reader.getGlobalDeclID(F, LocalID));
1335bool ASTReader::ReadLexicalDeclContextStorage(
ModuleFile &M,
1336 BitstreamCursor &Cursor,
1339 assert(Offset != 0);
1342 if (llvm::Error Err = Cursor.JumpToBit(Offset)) {
1343 Error(std::move(Err));
1351 Error(MaybeCode.takeError());
1354 unsigned Code = MaybeCode.get();
1357 if (!MaybeRecCode) {
1358 Error(MaybeRecCode.takeError());
1361 unsigned RecCode = MaybeRecCode.get();
1363 Error(
"Expected lexical block");
1367 assert(!isa<TranslationUnitDecl>(DC) &&
1368 "expected a TU_UPDATE_LEXICAL record for TU");
1373 auto &Lex = LexicalDecls[DC];
1375 Lex = std::make_pair(
1378 Blob.size() /
sizeof(
DeclID)));
1384bool ASTReader::ReadVisibleDeclContextStorage(
ModuleFile &M,
1385 BitstreamCursor &Cursor,
1388 assert(Offset != 0);
1391 if (llvm::Error Err =
Cursor.JumpToBit(Offset)) {
1392 Error(std::move(Err));
1400 Error(MaybeCode.takeError());
1403 unsigned Code = MaybeCode.get();
1406 if (!MaybeRecCode) {
1407 Error(MaybeRecCode.takeError());
1410 unsigned RecCode = MaybeRecCode.get();
1412 Error(
"Expected visible lookup table block");
1418 auto *
Data = (
const unsigned char*)Blob.data();
1419 PendingVisibleUpdates[
ID].push_back(UpdateData{&M,
Data});
1423void ASTReader::AddSpecializations(
const Decl *
D,
const unsigned char *
Data,
1427 IsPartial ? PartialSpecializationsLookups : SpecializationsLookups;
1432bool ASTReader::ReadSpecializations(
ModuleFile &M, BitstreamCursor &Cursor,
1433 uint64_t Offset,
Decl *
D,
bool IsPartial) {
1434 assert(Offset != 0);
1437 if (llvm::Error Err =
Cursor.JumpToBit(Offset)) {
1438 Error(std::move(Err));
1446 Error(MaybeCode.takeError());
1449 unsigned Code = MaybeCode.get();
1452 if (!MaybeRecCode) {
1453 Error(MaybeRecCode.takeError());
1456 unsigned RecCode = MaybeRecCode.get();
1459 Error(
"Expected decl specs block");
1463 auto *
Data = (
const unsigned char *)Blob.data();
1464 AddSpecializations(
D,
Data, M, IsPartial);
1468void ASTReader::Error(StringRef Msg)
const {
1469 Error(diag::err_fe_pch_malformed, Msg);
1470 if (PP.getLangOpts().Modules &&
1471 !PP.getHeaderSearchInfo().getModuleCachePath().empty()) {
1472 Diag(diag::note_module_cache_path)
1473 << PP.getHeaderSearchInfo().getModuleCachePath();
1477void ASTReader::Error(
unsigned DiagID, StringRef Arg1, StringRef Arg2,
1478 StringRef Arg3)
const {
1479 Diag(DiagID) << Arg1 << Arg2 << Arg3;
1482void ASTReader::Error(llvm::Error &&Err)
const {
1483 llvm::Error RemainingErr =
1485 auto Diag =
E.getDiagnostic().second;
1490 assert(NumArgs <= 3 &&
"Can only have up to 3 arguments");
1491 StringRef Arg1, Arg2, Arg3;
1494 Arg3 =
Diag.getStringArg(2);
1497 Arg2 =
Diag.getStringArg(1);
1500 Arg1 =
Diag.getStringArg(0);
1502 Error(
Diag.getDiagID(), Arg1, Arg2, Arg3);
1518 std::map<int, int> FileIDs;
1520 for (
unsigned I = 0;
Record[Idx]; ++I) {
1528 std::vector<LineEntry> Entries;
1529 while (Idx <
Record.size()) {
1533 unsigned NumEntries =
Record[Idx++];
1534 assert(NumEntries &&
"no line entries for file ID");
1536 Entries.reserve(NumEntries);
1537 for (
unsigned I = 0; I != NumEntries; ++I) {
1538 unsigned FileOffset =
Record[Idx++];
1539 unsigned LineNo =
Record[Idx++];
1540 int FilenameID = FileIDs[
Record[Idx++]];
1543 unsigned IncludeOffset =
Record[Idx++];
1545 FileKind, IncludeOffset));
1552llvm::Error ASTReader::ReadSourceManagerBlock(
ModuleFile &F) {
1553 using namespace SrcMgr;
1561 SLocEntryCursor = F.
Stream;
1564 if (llvm::Error Err = F.
Stream.SkipBlock())
1575 SLocEntryCursor.advanceSkippingSubblocks();
1577 return MaybeE.takeError();
1578 llvm::BitstreamEntry
E = MaybeE.get();
1581 case llvm::BitstreamEntry::SubBlock:
1582 case llvm::BitstreamEntry::Error:
1583 return llvm::createStringError(std::errc::illegal_byte_sequence,
1584 "malformed block record in AST file");
1585 case llvm::BitstreamEntry::EndBlock:
1586 return llvm::Error::success();
1587 case llvm::BitstreamEntry::Record:
1596 SLocEntryCursor.readRecord(
E.ID,
Record, &Blob);
1598 return MaybeRecord.takeError();
1599 switch (MaybeRecord.get()) {
1607 return llvm::Error::success();
1618 return std::move(Err);
1622 return MaybeEntry.takeError();
1624 llvm::BitstreamEntry Entry = MaybeEntry.get();
1625 if (Entry.Kind != llvm::BitstreamEntry::Record)
1626 return llvm::createStringError(
1627 std::errc::illegal_byte_sequence,
1628 "incorrectly-formatted source location entry in AST file");
1634 return MaybeSLOC.takeError();
1636 switch (MaybeSLOC.get()) {
1638 return llvm::createStringError(
1639 std::errc::illegal_byte_sequence,
1640 "incorrectly-formatted source location entry in AST file");
1650 GlobalSLocOffsetMap.find(SourceManager::MaxLoadedOffset - SLocOffset - 1);
1651 assert(SLocMapI != GlobalSLocOffsetMap.end() &&
1652 "Corrupted global sloc offset map");
1657 auto It = llvm::upper_bound(
1660 int ID = F->SLocEntryBaseID + LocalIndex;
1661 std::size_t Index = -ID - 2;
1662 if (!SourceMgr.SLocEntryOffsetLoaded[Index]) {
1663 assert(!SourceMgr.SLocEntryLoaded[Index]);
1664 auto MaybeEntryOffset = readSLocOffset(F, LocalIndex);
1665 if (!MaybeEntryOffset) {
1666 Error(MaybeEntryOffset.takeError());
1670 SourceMgr.LoadedSLocEntryTable[Index] =
1671 SrcMgr::SLocEntry::getOffsetOnly(*MaybeEntryOffset);
1672 SourceMgr.SLocEntryOffsetLoaded[Index] = true;
1674 return Offset < SourceMgr.LoadedSLocEntryTable[Index].getOffset();
1689 if (
unsigned(-ID) - 2 >= getTotalNumSLocs() || ID > 0) {
1690 Error(
"source location entry ID out-of-range for AST file");
1696 auto ReadBuffer = [
this](
1697 BitstreamCursor &SLocEntryCursor,
1698 StringRef Name) -> std::unique_ptr<llvm::MemoryBuffer> {
1703 Error(MaybeCode.takeError());
1706 unsigned Code = MaybeCode.get();
1709 SLocEntryCursor.readRecord(Code,
Record, &Blob);
1710 if (!MaybeRecCode) {
1711 Error(MaybeRecCode.takeError());
1714 unsigned RecCode = MaybeRecCode.get();
1719 const llvm::compression::Format F =
1720 Blob.size() > 0 && Blob.data()[0] == 0x78
1721 ? llvm::compression::Format::Zlib
1722 : llvm::compression::Format::Zstd;
1723 if (
const char *Reason = llvm::compression::getReasonIfUnsupported(F)) {
1728 if (llvm::Error
E = llvm::compression::decompress(
1729 F, llvm::arrayRefFromStringRef(Blob), Decompressed,
Record[0])) {
1730 Error(
"could not decompress embedded file contents: " +
1731 llvm::toString(std::move(
E)));
1734 return llvm::MemoryBuffer::getMemBufferCopy(
1735 llvm::toStringRef(Decompressed), Name);
1737 return llvm::MemoryBuffer::getMemBuffer(Blob.drop_back(1), Name,
true);
1739 Error(
"AST record has invalid code");
1744 ModuleFile *F = GlobalSLocEntryMap.find(-ID)->second;
1748 Error(std::move(Err));
1755 ++NumSLocEntriesRead;
1758 Error(MaybeEntry.takeError());
1761 llvm::BitstreamEntry Entry = MaybeEntry.get();
1763 if (Entry.Kind != llvm::BitstreamEntry::Record) {
1764 Error(
"incorrectly-formatted source location entry in AST file");
1771 SLocEntryCursor.readRecord(Entry.ID,
Record, &Blob);
1773 Error(MaybeSLOC.takeError());
1776 switch (MaybeSLOC.get()) {
1778 Error(
"incorrectly-formatted source location entry in AST file");
1784 unsigned InputID =
Record[4];
1785 InputFile IF = getInputFile(*F, InputID);
1798 IncludeLoc = getImportLocation(F);
1802 FileID FID = SourceMgr.createFileID(*
File, IncludeLoc, FileCharacter, ID,
1805 FileInfo.NumCreatedFIDs =
Record[5];
1809 unsigned NumFileDecls =
Record[7];
1810 if (NumFileDecls && ContextObj) {
1812 assert(F->
FileSortedDecls &&
"FILE_SORTED_DECLS not encountered yet ?");
1818 SourceMgr.getOrCreateContentCache(*
File, isSystem(FileCharacter));
1822 auto Buffer = ReadBuffer(SLocEntryCursor,
File->getName());
1825 SourceMgr.overrideFileContents(*
File, std::move(Buffer));
1832 const char *Name = Blob.data();
1833 unsigned Offset =
Record[0];
1838 IncludeLoc = getImportLocation(F);
1841 auto Buffer = ReadBuffer(SLocEntryCursor, Name);
1844 FileID FID = SourceMgr.createFileID(std::move(Buffer), FileCharacter, ID,
1845 BaseOffset + Offset, IncludeLoc);
1847 auto &FileInfo = SourceMgr.getSLocEntry(FID).getFile();
1848 FileInfo.setHasLineDirectives();
1858 SourceMgr.createExpansionLoc(SpellingLoc, ExpansionBegin, ExpansionEnd,
1872 if (
unsigned(-ID) - 2 >= getTotalNumSLocs() || ID > 0) {
1873 Error(
"source location entry ID out-of-range for AST file");
1878 ModuleFile *M = GlobalSLocEntryMap.find(-ID)->second;
1896 assert(SourceMgr.getMainFileID().isValid() &&
"missing main file");
1897 return SourceMgr.getLocForStartOfFile(SourceMgr.getMainFileID());
1907 uint64_t *StartOfBlockOffset) {
1908 if (llvm::Error Err = Cursor.EnterSubBlock(BlockID))
1911 if (StartOfBlockOffset)
1912 *StartOfBlockOffset = Cursor.GetCurrentBitNo();
1915 uint64_t Offset = Cursor.GetCurrentBitNo();
1918 return MaybeCode.takeError();
1919 unsigned Code = MaybeCode.get();
1922 if (Code != llvm::bitc::DEFINE_ABBREV) {
1923 if (llvm::Error Err = Cursor.JumpToBit(Offset))
1925 return llvm::Error::success();
1927 if (llvm::Error Err = Cursor.ReadAbbrevRecord())
1943 case tok::annot_pragma_loop_hint: {
1946 Info->Option = ReadToken(M,
Record, Idx);
1947 unsigned NumTokens =
Record[Idx++];
1949 Toks.reserve(NumTokens);
1950 for (
unsigned I = 0; I < NumTokens; ++I)
1951 Toks.push_back(ReadToken(M,
Record, Idx));
1952 Info->Toks =
llvm::ArrayRef(Toks).copy(PP.getPreprocessorAllocator());
1956 case tok::annot_pragma_pack: {
1959 auto SlotLabel = ReadString(
Record, Idx);
1961 llvm::StringRef(SlotLabel).copy(PP.getPreprocessorAllocator());
1962 Info->Alignment = ReadToken(M,
Record, Idx);
1967 case tok::annot_pragma_openmp:
1968 case tok::annot_pragma_openmp_end:
1969 case tok::annot_pragma_unused:
1970 case tok::annot_pragma_openacc:
1971 case tok::annot_pragma_openacc_end:
1972 case tok::annot_repl_input_end:
1975 llvm_unreachable(
"missing deserialization code for annotation token");
1992 if (llvm::Error Err = Stream.JumpToBit(Offset)) {
1994 consumeError(std::move(Err));
2006 unsigned Flags = BitstreamCursor::AF_DontPopBlockAtEnd;
2008 Stream.advanceSkippingSubblocks(Flags);
2010 Error(MaybeEntry.takeError());
2013 llvm::BitstreamEntry Entry = MaybeEntry.get();
2015 switch (Entry.Kind) {
2016 case llvm::BitstreamEntry::SubBlock:
2017 case llvm::BitstreamEntry::Error:
2018 Error(
"malformed block record in AST file");
2020 case llvm::BitstreamEntry::EndBlock:
2022 case llvm::BitstreamEntry::Record:
2033 Error(MaybeRecType.takeError());
2049 unsigned NextIndex = 1;
2056 PP.getPreprocessorAllocator());
2059 bool isC99VarArgs =
Record[NextIndex++];
2060 bool isGNUVarArgs =
Record[NextIndex++];
2061 bool hasCommaPasting =
Record[NextIndex++];
2062 MacroParams.clear();
2063 unsigned NumArgs =
Record[NextIndex++];
2064 for (
unsigned i = 0; i != NumArgs; ++i)
2065 MacroParams.push_back(getLocalIdentifier(F,
Record[NextIndex++]));
2079 if (NextIndex + 1 ==
Record.size() && PP.getPreprocessingRecord() &&
2083 GlobalID = getGlobalPreprocessedEntityID(F,
Record[NextIndex]);
2085 PreprocessingRecord::PPEntityID PPID =
2086 PPRec.getPPEntityID(GlobalID - 1,
true);
2088 PPRec.getPreprocessedEntity(PPID));
2090 PPRec.RegisterMacroDefinition(Macro, PPDef);
2101 if (MacroTokens.empty()) {
2102 Error(
"unexpected number of macro tokens for a macro in AST file");
2107 MacroTokens[0] = ReadToken(F,
Record, Idx);
2108 MacroTokens = MacroTokens.drop_front();
2117 unsigned LocalID)
const {
2119 ReadModuleOffsetMap(M);
2124 &&
"Invalid index into preprocessed entity index remap");
2126 return LocalID + I->second;
2130HeaderFileInfoTrait::getFile(
const internal_key_type &Key) {
2141 uint8_t buf[
sizeof(ikey.
Size) +
sizeof(ikey.
ModTime)];
2144 return llvm::xxh3_64bits(buf);
2165 return FEA && FEA == FEB;
2168std::pair<unsigned, unsigned>
2169HeaderFileInfoTrait::ReadKeyDataLength(
const unsigned char*& d) {
2174HeaderFileInfoTrait::ReadKey(
const unsigned char *d,
unsigned) {
2175 using namespace llvm::support;
2178 ikey.
Size = off_t(endian::readNext<uint64_t, llvm::endianness::little>(d));
2180 time_t(endian::readNext<uint64_t, llvm::endianness::little>(d));
2189 using namespace llvm::support;
2191 const unsigned char *End = d + DataLen;
2193 unsigned Flags = *d++;
2196 bool Included = (Flags >> 6) & 0x01;
2198 if ((FE = getFile(key)))
2201 Reader.getPreprocessor().getIncludedFiles().insert(*FE);
2204 HFI.
isImport |= (Flags >> 5) & 0x01;
2206 HFI.
DirInfo = (Flags >> 1) & 0x07;
2208 M, endian::readNext<IdentifierID, llvm::endianness::little>(d));
2210 assert((End - d) % 4 == 0 &&
2211 "Wrong data length in HeaderFileInfo deserialization");
2213 uint32_t LocalSMID =
2214 endian::readNext<uint32_t, llvm::endianness::little>(d);
2220 SubmoduleID GlobalSMID = Reader.getGlobalSubmoduleID(M, LocalSMID);
2221 Module *Mod = Reader.getSubmodule(GlobalSMID);
2223 Reader.getPreprocessor().getHeaderSearchInfo().getModuleMap();
2225 if (FE || (FE = getFile(key))) {
2228 ModMap.
addHeader(Mod, H, HeaderRole,
true);
2240 uint32_t MacroDirectivesOffset) {
2241 assert(NumCurrentElementsDeserializing > 0 &&
"Missing deserialization guard");
2242 PendingMacroIDs[II].push_back(PendingMacroInfo(M, MacroDirectivesOffset));
2249 for (
ModuleFile &I : llvm::reverse(ModuleMgr)) {
2250 BitstreamCursor &MacroCursor = I.MacroCursor;
2253 if (MacroCursor.getBitcodeBytes().empty())
2256 BitstreamCursor Cursor = MacroCursor;
2257 if (llvm::Error Err = Cursor.JumpToBit(I.MacroStartOffset)) {
2258 Error(std::move(Err));
2266 Error(MaybeE.takeError());
2269 llvm::BitstreamEntry
E = MaybeE.get();
2272 case llvm::BitstreamEntry::SubBlock:
2273 case llvm::BitstreamEntry::Error:
2274 Error(
"malformed block record in AST file");
2276 case llvm::BitstreamEntry::EndBlock:
2279 case llvm::BitstreamEntry::Record: {
2283 Error(MaybeRecord.takeError());
2286 switch (MaybeRecord.get()) {
2294 updateOutOfDateIdentifier(*II);
2313 class IdentifierLookupVisitor {
2316 unsigned PriorGeneration;
2317 unsigned &NumIdentifierLookups;
2318 unsigned &NumIdentifierLookupHits;
2322 IdentifierLookupVisitor(StringRef Name,
unsigned PriorGeneration,
2323 unsigned &NumIdentifierLookups,
2324 unsigned &NumIdentifierLookupHits)
2326 PriorGeneration(PriorGeneration),
2327 NumIdentifierLookups(NumIdentifierLookups),
2328 NumIdentifierLookupHits(NumIdentifierLookupHits) {}
2342 ++NumIdentifierLookups;
2343 ASTIdentifierLookupTable::iterator Pos =
2344 IdTable->find_hashed(Name, NameHash, &Trait);
2345 if (Pos == IdTable->end())
2351 ++NumIdentifierLookupHits;
2367 unsigned PriorGeneration = 0;
2368 if (getContext().getLangOpts().Modules)
2369 PriorGeneration = IdentifierGeneration[&II];
2375 if (!loadGlobalIndex()) {
2376 if (GlobalIndex->lookupIdentifier(II.
getName(), Hits)) {
2381 IdentifierLookupVisitor Visitor(II.
getName(), PriorGeneration,
2382 NumIdentifierLookups,
2383 NumIdentifierLookupHits);
2384 ModuleMgr.visit(Visitor, HitsPtr);
2385 markIdentifierUpToDate(&II);
2395 if (getContext().getLangOpts().Modules)
2396 IdentifierGeneration[II] = getGeneration();
2400 const PendingMacroInfo &PMInfo) {
2405 if (llvm::Error Err =
2407 Error(std::move(Err));
2411 struct ModuleMacroRecord {
2424 Cursor.advance(BitstreamCursor::AF_DontPopBlockAtEnd);
2426 Error(MaybeEntry.takeError());
2429 llvm::BitstreamEntry Entry = MaybeEntry.get();
2431 if (Entry.Kind != llvm::BitstreamEntry::Record) {
2432 Error(
"malformed block record in AST file");
2439 Error(MaybePP.takeError());
2447 ModuleMacros.push_back(ModuleMacroRecord());
2448 auto &Info = ModuleMacros.back();
2449 Info.SubModID = getGlobalSubmoduleID(M,
Record[0]);
2450 Info.MI = getMacro(getGlobalMacroID(M,
Record[1]));
2451 for (
int I = 2, N =
Record.size(); I != N; ++I)
2452 Info.Overrides.push_back(getGlobalSubmoduleID(M,
Record[I]));
2457 Error(
"malformed block record in AST file");
2468 std::reverse(ModuleMacros.begin(), ModuleMacros.end());
2470 for (
auto &MMR : ModuleMacros) {
2472 for (
unsigned ModID : MMR.Overrides) {
2473 Module *Mod = getSubmodule(ModID);
2474 auto *Macro = PP.getModuleMacro(Mod, II);
2475 assert(Macro &&
"missing definition for overridden macro");
2476 Overrides.push_back(Macro);
2479 bool Inserted =
false;
2480 Module *Owner = getSubmodule(MMR.SubModID);
2481 PP.addModuleMacro(Owner, II, MMR.MI, Overrides, Inserted);
2492 unsigned Idx = 0, N =
Record.size();
2500 MD = PP.AllocateDefMacroDirective(MI,
Loc);
2504 MD = PP.AllocateUndefMacroDirective(
Loc);
2507 bool isPublic =
Record[Idx++];
2508 MD = PP.AllocateVisibilityMacroDirective(
Loc, isPublic);
2520 PP.setLoadedMacroDirective(II, Earliest, Latest);
2523bool ASTReader::shouldDisableValidationForFile(
2561 consumeError(std::move(Err));
2567 consumeError(MaybeCode.takeError());
2569 unsigned Code = MaybeCode.get();
2575 "invalid record type for input file");
2578 consumeError(Maybe.takeError());
2581 assert(
Record[0] == ID &&
"Bogus stored ID or offset");
2589 uint16_t AsRequestedLength =
Record[7];
2597 consumeError(MaybeEntry.takeError());
2598 llvm::BitstreamEntry Entry = MaybeEntry.get();
2599 assert(Entry.Kind == llvm::BitstreamEntry::Record &&
2600 "expected record type for input file hash");
2605 "invalid record type for input file hash");
2608 consumeError(Maybe.takeError());
2637 consumeError(std::move(Err));
2653 PP.getHeaderSearchInfo().getHeaderSearchOpts();
2666 if ((Overridden || Transient || SkipChecks) && !
File)
2671 std::string ErrorStr =
"could not find file '";
2673 ErrorStr +=
"' referenced by AST file '";
2689 if ((!Overridden && !Transient) && !SkipChecks &&
2690 SM.isFileOverridden(*
File)) {
2704 enum ModificationKind {
2710 std::optional<int64_t> Old = std::nullopt;
2711 std::optional<int64_t> New = std::nullopt;
2713 auto HasInputContentChanged = [&](Change OriginalChange) {
2714 assert(ValidateASTInputFilesContent &&
2715 "We should only check the content of the inputs with "
2716 "ValidateASTInputFilesContent enabled.");
2718 if (StoredContentHash == 0)
2719 return OriginalChange;
2722 if (!MemBuffOrError) {
2724 return OriginalChange;
2725 std::string ErrorStr =
"could not get buffer for file '";
2726 ErrorStr +=
File->getName();
2729 return OriginalChange;
2732 auto ContentHash = xxh3_64bits(MemBuffOrError.get()->getBuffer());
2733 if (StoredContentHash ==
static_cast<uint64_t>(ContentHash))
2734 return Change{Change::None};
2736 return Change{Change::Content};
2738 auto HasInputFileChanged = [&]() {
2739 if (StoredSize !=
File->getSize())
2740 return Change{Change::Size, StoredSize,
File->getSize()};
2741 if (!shouldDisableValidationForFile(F) && StoredTime &&
2742 StoredTime !=
File->getModificationTime()) {
2743 Change MTimeChange = {Change::ModTime, StoredTime,
2744 File->getModificationTime()};
2748 if (ValidateASTInputFilesContent)
2749 return HasInputContentChanged(MTimeChange);
2753 return Change{Change::None};
2756 bool IsOutOfDate =
false;
2757 auto FileChange = SkipChecks ? Change{Change::None} : HasInputFileChanged();
2763 FileChange = HasInputContentChanged(FileChange);
2769 if (!StoredTime && ValidateASTInputFilesContent &&
2770 FileChange.Kind == Change::None)
2771 FileChange = HasInputContentChanged(FileChange);
2774 if (!Overridden && FileChange.Kind != Change::None) {
2778 while (!ImportStack.back()->ImportedBy.empty())
2779 ImportStack.push_back(ImportStack.back()->ImportedBy[0]);
2782 StringRef TopLevelPCHName(ImportStack.back()->FileName);
2783 Diag(diag::err_fe_ast_file_modified)
2785 << TopLevelPCHName << FileChange.Kind
2786 << (FileChange.Old && FileChange.New)
2787 << llvm::itostr(FileChange.Old.value_or(0))
2788 << llvm::itostr(FileChange.New.value_or(0));
2791 if (ImportStack.size() > 1) {
2792 Diag(diag::note_pch_required_by)
2793 << *
Filename << ImportStack[0]->FileName;
2794 for (
unsigned I = 1; I < ImportStack.size(); ++I)
2795 Diag(diag::note_pch_required_by)
2796 << ImportStack[I-1]->FileName << ImportStack[I]->FileName;
2799 Diag(diag::note_pch_rebuild_required) << TopLevelPCHName;
2814ASTReader::TemporarilyOwnedStringRef
2820ASTReader::TemporarilyOwnedStringRef
2823 assert(Buf.capacity() != 0 &&
"Overlapping ResolveImportedPath calls");
2825 if (Prefix.empty() ||
Path.empty() || llvm::sys::path::is_absolute(
Path) ||
2826 Path ==
"<built-in>" ||
Path ==
"<command line>")
2830 llvm::sys::path::append(Buf, Prefix,
Path);
2831 StringRef ResolvedPath{Buf.data(), Buf.size()};
2832 return {ResolvedPath, Buf};
2838 return ResolveImportedPathAndAllocate(Buf,
P, ModF.
BaseDirectory);
2844 auto ResolvedPath = ResolveImportedPath(Buf,
P, Prefix);
2845 return ResolvedPath->str();
2860 llvm_unreachable(
"unknown ASTReadResult");
2864 BitstreamCursor &Stream, StringRef
Filename,
2865 unsigned ClientLoadCapabilities,
bool AllowCompatibleConfigurationMismatch,
2869 consumeError(std::move(Err));
2880 consumeError(MaybeEntry.takeError());
2883 llvm::BitstreamEntry Entry = MaybeEntry.get();
2885 switch (Entry.Kind) {
2886 case llvm::BitstreamEntry::Error:
2887 case llvm::BitstreamEntry::SubBlock:
2890 case llvm::BitstreamEntry::EndBlock:
2893 case llvm::BitstreamEntry::Record:
2901 if (!MaybeRecordType) {
2903 consumeError(MaybeRecordType.takeError());
2908 bool Complain = (ClientLoadCapabilities & ARR_ConfigurationMismatch) == 0;
2910 AllowCompatibleConfigurationMismatch))
2911 Result = ConfigurationMismatch;
2916 bool Complain = (ClientLoadCapabilities & ARR_ConfigurationMismatch) == 0;
2918 AllowCompatibleConfigurationMismatch))
2919 Result = ConfigurationMismatch;
2924 bool Complain = (ClientLoadCapabilities & ARR_ConfigurationMismatch) == 0;
2925 if (!AllowCompatibleConfigurationMismatch &&
2926 ParseFileSystemOptions(
Record, Complain, Listener))
2927 Result = ConfigurationMismatch;
2932 bool Complain = (ClientLoadCapabilities & ARR_ConfigurationMismatch) == 0;
2933 if (!AllowCompatibleConfigurationMismatch &&
2935 Result = ConfigurationMismatch;
2940 bool Complain = (ClientLoadCapabilities & ARR_ConfigurationMismatch) == 0;
2941 if (!AllowCompatibleConfigurationMismatch &&
2943 SuggestedPredefines))
2944 Result = ConfigurationMismatch;
2954 unsigned ClientLoadCapabilities) {
2955 BitstreamCursor &Stream = F.
Stream;
2958 Error(std::move(Err));
2968 bool HasReadUnhashedControlBlock =
false;
2969 auto readUnhashedControlBlockOnce = [&]() {
2970 if (!HasReadUnhashedControlBlock) {
2971 HasReadUnhashedControlBlock =
true;
2972 if (ASTReadResult
Result =
2973 readUnhashedControlBlock(F, ImportedBy, ClientLoadCapabilities))
2979 bool DisableValidation = shouldDisableValidationForFile(F);
2983 unsigned NumInputs = 0;
2984 unsigned NumUserInputs = 0;
2985 StringRef BaseDirectoryAsWritten;
2989 Error(MaybeEntry.takeError());
2992 llvm::BitstreamEntry Entry = MaybeEntry.get();
2994 switch (Entry.Kind) {
2995 case llvm::BitstreamEntry::Error:
2996 Error(
"malformed block record in AST file");
2998 case llvm::BitstreamEntry::EndBlock: {
3001 if (ASTReadResult
Result = readUnhashedControlBlockOnce())
3006 PP.getHeaderSearchInfo().getHeaderSearchOpts();
3013 bool Complain = (ClientLoadCapabilities & ARR_OutOfDate) == 0;
3019 unsigned N = ValidateSystemInputs ? NumInputs : NumUserInputs;
3025 for (
unsigned I = 0; I < N; ++I) {
3026 InputFile IF = getInputFile(F, I+1, Complain);
3038 for (
unsigned I = 0; I < N; ++I) {
3039 bool IsSystem = I >= NumUserInputs;
3041 auto FilenameAsRequested = ResolveImportedPath(
3044 *FilenameAsRequested, IsSystem, FI.
Overridden,
3052 case llvm::BitstreamEntry::SubBlock:
3056 if (llvm::Error Err = Stream.SkipBlock()) {
3057 Error(std::move(Err));
3061 Error(
"malformed block record in AST file");
3071 if (Listener && !ImportedBy) {
3077 bool AllowCompatibleConfigurationMismatch =
3081 ReadOptionsBlock(Stream, F.
FileName, ClientLoadCapabilities,
3082 AllowCompatibleConfigurationMismatch, *Listener,
3083 SuggestedPredefines);
3085 Error(
"malformed block record in AST file");
3089 if (DisableValidation ||
3090 (AllowConfigurationMismatch &&
Result == ConfigurationMismatch))
3098 }
else if (llvm::Error Err = Stream.SkipBlock()) {
3099 Error(std::move(Err));
3105 if (llvm::Error Err = Stream.SkipBlock()) {
3106 Error(std::move(Err));
3112 case llvm::BitstreamEntry::Record:
3121 Stream.readRecord(Entry.ID,
Record, &Blob);
3122 if (!MaybeRecordType) {
3123 Error(MaybeRecordType.takeError());
3129 if ((ClientLoadCapabilities & ARR_VersionMismatch) == 0)
3131 : diag::err_ast_file_version_too_new)
3136 bool hasErrors =
Record[7];
3137 if (hasErrors && !DisableValidation) {
3140 if ((ClientLoadCapabilities & ARR_TreatModuleWithErrorsAsOutOfDate) &&
3141 canRecoverFromOutOfDate(F.
FileName, ClientLoadCapabilities))
3144 if (!AllowASTWithCompilerErrors) {
3145 Diag(diag::err_ast_file_with_compiler_errors)
3151 Diags.ErrorOccurred =
true;
3152 Diags.UncompilableErrorOccurred =
true;
3153 Diags.UnrecoverableErrorOccurred =
true;
3166 StringRef ASTBranch = Blob;
3167 if (StringRef(CurBranch) != ASTBranch && !DisableValidation) {
3168 if ((ClientLoadCapabilities & ARR_VersionMismatch) == 0)
3169 Diag(diag::err_ast_file_different_branch)
3181 if (ASTReadResult
Result = readUnhashedControlBlockOnce())
3191 auto [ImportLoc, ImportModuleFileIndex] =
3192 ReadUntranslatedSourceLocation(
Record[Idx++]);
3194 assert(ImportModuleFileIndex == 0);
3196 StringRef ImportedName = ReadStringBlob(
Record, Idx, Blob);
3198 bool IsImportingStdCXXModule =
Record[Idx++];
3200 off_t StoredSize = 0;
3201 time_t StoredModTime = 0;
3203 std::string ImportedFile;
3212 ImportedFile = PP.getHeaderSearchInfo().getPrebuiltModuleFileName(
3213 ImportedName, !IsImportingStdCXXModule);
3215 if (IsImportingStdCXXModule && ImportedFile.empty()) {
3216 Diag(diag::err_failed_to_find_module_file) << ImportedName;
3220 if (!IsImportingStdCXXModule) {
3221 StoredSize = (off_t)
Record[Idx++];
3222 StoredModTime = (time_t)
Record[Idx++];
3226 SignatureBytes.end());
3229 if (ImportedFile.empty()) {
3233 ReadPathBlob(BaseDirectoryAsWritten,
Record, Idx, Blob);
3239 unsigned Capabilities = ClientLoadCapabilities;
3240 if ((ClientLoadCapabilities & ARR_OutOfDate) == 0)
3241 Capabilities &= ~ARR_Missing;
3244 auto Result = ReadASTCore(ImportedFile, ImportedKind, ImportLoc, &F,
3245 Loaded, StoredSize, StoredModTime,
3246 StoredSignature, Capabilities);
3249 bool recompilingFinalized =
3250 Result == OutOfDate && (Capabilities & ARR_OutOfDate) &&
3251 getModuleManager().getModuleCache().isPCMFinal(F.
FileName);
3253 Diag(diag::note_module_file_imported_by)
3255 if (recompilingFinalized)
3256 Diag(diag::note_module_file_conflict);
3259 case Failure:
return Failure;
3262 case OutOfDate:
return OutOfDate;
3264 case ConfigurationMismatch:
return ConfigurationMismatch;
3265 case HadErrors:
return HadErrors;
3284 Diag(diag::remark_module_import)
3286 << (ImportedBy ? StringRef(ImportedBy->
ModuleName) : StringRef());
3292 if (ASTReadResult
Result = readUnhashedControlBlockOnce())
3300 BaseDirectoryAsWritten = Blob;
3302 "MODULE_DIRECTORY found before MODULE_NAME");
3304 if (!PP.getPreprocessorOpts().ModulesCheckRelocated)
3308 Module *M = PP.getHeaderSearchInfo().lookupModule(
3315 if (!
bool(PP.getPreprocessorOpts().DisablePCHOrModuleValidation &
3318 auto BuildDir = PP.getFileManager().getOptionalDirectoryRef(Blob);
3319 if (!BuildDir || *BuildDir != M->
Directory) {
3320 if (!canRecoverFromOutOfDate(F.
FileName, ClientLoadCapabilities))
3321 Diag(diag::err_imported_module_relocated)
3332 if (ASTReadResult
Result =
3333 ReadModuleMapFileBlock(
Record, F, ImportedBy, ClientLoadCapabilities))
3339 NumUserInputs =
Record[1];
3341 (
const llvm::support::unaligned_uint64_t *)Blob.data();
3350llvm::Error ASTReader::ReadASTBlock(
ModuleFile &F,
3351 unsigned ClientLoadCapabilities) {
3352 BitstreamCursor &Stream = F.
Stream;
3354 if (llvm::Error Err = Stream.EnterSubBlock(
AST_BLOCK_ID))
3363 return MaybeEntry.takeError();
3364 llvm::BitstreamEntry Entry = MaybeEntry.get();
3366 switch (Entry.Kind) {
3367 case llvm::BitstreamEntry::Error:
3368 return llvm::createStringError(
3369 std::errc::illegal_byte_sequence,
3370 "error at end of module block in AST file");
3371 case llvm::BitstreamEntry::EndBlock:
3383 return llvm::Error::success();
3384 case llvm::BitstreamEntry::SubBlock:
3392 if (llvm::Error Err = Stream.SkipBlock())
3394 if (llvm::Error Err = ReadBlockAbbrevs(
3401 if (!PP.getExternalSource())
3402 PP.setExternalSource(
this);
3404 if (llvm::Error Err = Stream.SkipBlock())
3406 if (llvm::Error Err =
3415 if (llvm::Error Err = Stream.SkipBlock()) {
3424 if (!PP.getPreprocessingRecord())
3425 PP.createPreprocessingRecord();
3426 if (!PP.getPreprocessingRecord()->getExternalSource())
3427 PP.getPreprocessingRecord()->SetExternalSource(*
this);
3431 if (llvm::Error Err = ReadSourceManagerBlock(F))
3436 if (llvm::Error Err = ReadSubmoduleBlock(F, ClientLoadCapabilities))
3441 BitstreamCursor
C = Stream;
3443 if (llvm::Error Err = Stream.SkipBlock())
3447 CommentsCursors.push_back(std::make_pair(
C, &F));
3452 if (llvm::Error Err = Stream.SkipBlock())
3458 case llvm::BitstreamEntry::Record:
3467 Stream.readRecord(Entry.ID,
Record, &Blob);
3468 if (!MaybeRecordType)
3469 return MaybeRecordType.takeError();
3501 return llvm::createStringError(
3502 std::errc::illegal_byte_sequence,
3503 "duplicate TYPE_OFFSET record in AST file");
3516 return llvm::createStringError(
3517 std::errc::illegal_byte_sequence,
3518 "duplicate DECL_OFFSET record in AST file");
3530 DeclContext *TU = ContextObj->getTranslationUnitDecl();
3531 LexicalContents Contents(
3533 static_cast<unsigned int>(Blob.size() /
sizeof(
DeclID)));
3534 TULexicalDecls.push_back(std::make_pair(&F, Contents));
3542 auto *
Data = (
const unsigned char*)Blob.data();
3543 PendingVisibleUpdates[
ID].push_back(UpdateData{&F,
Data});
3546 if (
Decl *
D = GetExistingDecl(ID))
3547 PendingUpdateRecords.push_back(
3548 PendingUpdateRecord(ID,
D,
false));
3555 auto *
Data = (
const unsigned char *)Blob.data();
3556 PendingSpecializationsUpdates[
ID].push_back(UpdateData{&F,
Data});
3559 if (
Decl *
D = GetExistingDecl(ID))
3560 PendingUpdateRecords.push_back(
3561 PendingUpdateRecord(ID,
D,
false));
3568 auto *
Data = (
const unsigned char *)Blob.data();
3569 PendingPartialSpecializationsUpdates[
ID].push_back(UpdateData{&F,
Data});
3572 if (
Decl *
D = GetExistingDecl(ID))
3573 PendingUpdateRecords.push_back(
3574 PendingUpdateRecord(ID,
D,
false));
3580 reinterpret_cast<const unsigned char *
>(Blob.data());
3588 PP.getIdentifierTable().setExternalIdentifierLookup(
this);
3594 return llvm::createStringError(
3595 std::errc::illegal_byte_sequence,
3596 "duplicate IDENTIFIER_OFFSET record in AST file");
3602 IdentifiersLoaded.resize(IdentifiersLoaded.size()
3614 for (
unsigned I = 0, N =
Record.size(); I != N; )
3615 EagerlyDeserializedDecls.push_back(ReadDeclID(F,
Record, I));
3622 getContext().getLangOpts().BuildingPCHWithObjectFile)
3623 for (
unsigned I = 0, N =
Record.size(); I != N; )
3624 EagerlyDeserializedDecls.push_back(ReadDeclID(F,
Record, I));
3628 if (SpecialTypes.empty()) {
3629 for (
unsigned I = 0, N =
Record.size(); I != N; ++I)
3630 SpecialTypes.push_back(getGlobalTypeID(F,
Record[I]));
3637 if (SpecialTypes.size() !=
Record.size())
3638 return llvm::createStringError(std::errc::illegal_byte_sequence,
3639 "invalid special-types record");
3641 for (
unsigned I = 0, N =
Record.size(); I != N; ++I) {
3643 if (!SpecialTypes[I])
3644 SpecialTypes[I] =
ID;
3651 TotalNumStatements +=
Record[0];
3652 TotalNumMacros +=
Record[1];
3653 TotalLexicalDeclContexts +=
Record[2];
3654 TotalVisibleDeclContexts +=
Record[3];
3658 for (
unsigned I = 0, N =
Record.size(); I != N; )
3659 UnusedFileScopedDecls.push_back(ReadDeclID(F,
Record, I));
3663 for (
unsigned I = 0, N =
Record.size(); I != N; )
3664 DelegatingCtorDecls.push_back(ReadDeclID(F,
Record, I));
3668 if (
Record.size() % 3 != 0)
3669 return llvm::createStringError(std::errc::illegal_byte_sequence,
3670 "invalid weak identifiers record");
3674 WeakUndeclaredIdentifiers.clear();
3677 for (
unsigned I = 0, N =
Record.size(); I < N; ) {
3678 WeakUndeclaredIdentifiers.push_back(
3679 getGlobalIdentifierID(F,
Record[I++]));
3680 WeakUndeclaredIdentifiers.push_back(
3681 getGlobalIdentifierID(F,
Record[I++]));
3682 WeakUndeclaredIdentifiers.push_back(
3683 ReadSourceLocation(F,
Record, I).getRawEncoding());
3690 unsigned LocalBaseSelectorID =
Record[1];
3696 GlobalSelectorMap.insert(std::make_pair(getTotalNumSelectors()+1, &F));
3701 std::make_pair(LocalBaseSelectorID,
3713 = ASTSelectorLookupTable::Create(
3717 TotalNumMethodPoolEntries +=
Record[1];
3722 for (
unsigned Idx = 0, N =
Record.size() - 1; Idx < N; ) {
3723 ReferencedSelectorsData.push_back(getGlobalSelectorID(F,
3725 ReferencedSelectorsData.push_back(ReadSourceLocation(F,
Record, Idx).
3734 PP.setPreambleRecordedPragmaAssumeNonNullLoc(
3735 ReadSourceLocation(F,
Record, Idx));
3743 while (Idx <
Record.size())
3744 SrcLocs.push_back(ReadSourceLocation(F,
Record, Idx));
3745 PP.setDeserializedSafeBufferOptOutMap(SrcLocs);
3752 unsigned Idx = 0, End =
Record.size() - 1;
3753 bool ReachedEOFWhileSkipping =
Record[Idx++];
3754 std::optional<Preprocessor::PreambleSkipInfo> SkipInfo;
3755 if (ReachedEOFWhileSkipping) {
3758 bool FoundNonSkipPortion =
Record[Idx++];
3759 bool FoundElse =
Record[Idx++];
3761 SkipInfo.emplace(HashToken, IfTokenLoc, FoundNonSkipPortion,
3762 FoundElse, ElseLoc);
3766 auto Loc = ReadSourceLocation(F,
Record, Idx);
3767 bool WasSkipping =
Record[Idx++];
3768 bool FoundNonSkip =
Record[Idx++];
3769 bool FoundElse =
Record[Idx++];
3770 ConditionalStack.push_back(
3771 {
Loc, WasSkipping, FoundNonSkip, FoundElse});
3773 PP.setReplayablePreambleConditionalStack(ConditionalStack, SkipInfo);
3778 if (!
Record.empty() && Listener)
3797 SourceMgr.noteSLocAddressSpaceUsage(Diags);
3798 return llvm::createStringError(std::errc::invalid_argument,
3799 "ran out of source locations");
3804 unsigned RangeStart =
3806 GlobalSLocEntryMap.insert(std::make_pair(RangeStart, &F));
3811 GlobalSLocOffsetMap.insert(
3813 - SLocSpaceSize,&F));
3824 ParseLineTable(F,
Record);
3828 for (
unsigned I = 0, N =
Record.size(); I != N; )
3829 ExtVectorDecls.push_back(ReadDeclID(F,
Record, I));
3833 if (
Record.size() % 3 != 0)
3834 return llvm::createStringError(std::errc::illegal_byte_sequence,
3835 "Invalid VTABLE_USES record");
3842 for (
unsigned Idx = 0, N =
Record.size(); Idx != N; ) {
3843 VTableUses.push_back(
3844 {ReadDeclID(F,
Record, Idx),
3845 ReadSourceLocation(F,
Record, Idx).getRawEncoding(),
3852 if (
Record.size() % 2 != 0)
3853 return llvm::createStringError(
3854 std::errc::illegal_byte_sequence,
3855 "Invalid PENDING_IMPLICIT_INSTANTIATIONS block");
3857 for (
unsigned I = 0, N =
Record.size(); I != N; ) {
3858 PendingInstantiations.push_back(
3859 {ReadDeclID(F,
Record, I),
3860 ReadSourceLocation(F,
Record, I).getRawEncoding()});
3866 return llvm::createStringError(std::errc::illegal_byte_sequence,
3867 "Invalid SEMA_DECL_REFS block");
3868 for (
unsigned I = 0, N =
Record.size(); I != N; )
3869 SemaDeclRefs.push_back(ReadDeclID(F,
Record, I));
3877 unsigned LocalBasePreprocessedEntityID =
Record[0];
3879 unsigned StartingID;
3880 if (!PP.getPreprocessingRecord())
3881 PP.createPreprocessingRecord();
3882 if (!PP.getPreprocessingRecord()->getExternalSource())
3883 PP.getPreprocessingRecord()->SetExternalSource(*
this);
3885 = PP.getPreprocessingRecord()
3892 GlobalPreprocessedEntityMap.insert(std::make_pair(StartingID, &F));
3897 std::make_pair(LocalBasePreprocessedEntityID,
3909 if (!PP.getPreprocessingRecord())
3910 PP.createPreprocessingRecord();
3911 if (!PP.getPreprocessingRecord()->getExternalSource())
3912 PP.getPreprocessingRecord()->SetExternalSource(*
this);
3917 GlobalSkippedRangeMap.insert(
3923 if (
Record.size() % 2 != 0)
3924 return llvm::createStringError(
3925 std::errc::illegal_byte_sequence,
3926 "invalid DECL_UPDATE_OFFSETS block in AST file");
3927 for (
unsigned I = 0, N =
Record.size(); I != N; ) {
3929 DeclUpdateOffsets[
ID].push_back(std::make_pair(&F,
Record[I++]));
3933 if (
Decl *
D = GetExistingDecl(ID))
3934 PendingUpdateRecords.push_back(
3935 PendingUpdateRecord(ID,
D,
false));
3940 if (
Record.size() % 3 != 0)
3941 return llvm::createStringError(
3942 std::errc::illegal_byte_sequence,
3943 "invalid DELAYED_NAMESPACE_LEXICAL_VISIBLE_RECORD block in AST "
3945 for (
unsigned I = 0, N =
Record.size(); I != N; ) {
3949 assert(BaseOffset &&
"Invalid DeclsBlockStartOffset for module file!");
3952 LocalLexicalOffset ? BaseOffset + LocalLexicalOffset : 0;
3955 LocalVisibleOffset ? BaseOffset + LocalVisibleOffset : 0;
3957 DelayedNamespaceOffsetMap[
ID] = {LexicalOffset, VisibleOffset};
3959 assert(!GetExistingDecl(ID) &&
3960 "We shouldn't load the namespace in the front of delayed "
3961 "namespace lexical and visible block");
3967 for (
unsigned I = 0, N =
Record.size(); I != N; ) {
3969 auto &RelatedDecls = RelatedDeclsMap[
ID];
3970 unsigned NN =
Record[I++];
3971 RelatedDecls.reserve(NN);
3972 for (
unsigned II = 0; II < NN; II++)
3973 RelatedDecls.push_back(ReadDeclID(F,
Record, I));
3979 return llvm::createStringError(
3980 std::errc::illegal_byte_sequence,
3981 "duplicate OBJC_CATEGORIES_MAP record in AST file");
3994 CUDASpecialDeclRefs.clear();
3995 for (
unsigned I = 0, N =
Record.size(); I != N; )
3996 CUDASpecialDeclRefs.push_back(ReadDeclID(F,
Record, I));
4008 PP.getHeaderSearchInfo().SetExternalSource(
this);
4009 if (!PP.getHeaderSearchInfo().getExternalLookup())
4010 PP.getHeaderSearchInfo().SetExternalLookup(
this);
4016 FPPragmaOptions.swap(
Record);
4020 for (
unsigned I = 0, N =
Record.size(); I != N; )
4021 DeclsWithEffectsToVerify.push_back(ReadDeclID(F,
Record, I));
4025 for (
unsigned I = 0,
E =
Record.size(); I !=
E; ) {
4026 auto Name = ReadString(
Record, I);
4027 auto &OptInfo = OpenCLExtensions.OptMap[Name];
4028 OptInfo.Supported =
Record[I++] != 0;
4029 OptInfo.Enabled =
Record[I++] != 0;
4030 OptInfo.WithPragma =
Record[I++] != 0;
4031 OptInfo.Avail =
Record[I++];
4032 OptInfo.Core =
Record[I++];
4033 OptInfo.Opt =
Record[I++];
4038 for (
unsigned I = 0, N =
Record.size(); I != N; )
4039 TentativeDefinitions.push_back(ReadDeclID(F,
Record, I));
4043 for (
unsigned I = 0, N =
Record.size(); I != N; )
4044 KnownNamespaces.push_back(ReadDeclID(F,
Record, I));
4048 if (
Record.size() % 2 != 0)
4049 return llvm::createStringError(std::errc::illegal_byte_sequence,
4050 "invalid undefined-but-used record");
4051 for (
unsigned I = 0, N =
Record.size(); I != N; ) {
4052 UndefinedButUsed.push_back(
4053 {ReadDeclID(F,
Record, I),
4054 ReadSourceLocation(F,
Record, I).getRawEncoding()});
4059 for (
unsigned I = 0, N =
Record.size(); I != N;) {
4060 DelayedDeleteExprs.push_back(ReadDeclID(F,
Record, I).getRawValue());
4062 DelayedDeleteExprs.push_back(Count);
4063 for (uint64_t
C = 0;
C < Count; ++
C) {
4064 DelayedDeleteExprs.push_back(ReadSourceLocation(F,
Record, I).getRawEncoding());
4065 bool IsArrayForm =
Record[I++] == 1;
4066 DelayedDeleteExprs.push_back(IsArrayForm);
4073 getContext().getLangOpts().BuildingPCHWithObjectFile)
4074 for (
unsigned I = 0, N =
Record.size(); I != N;)
4075 VTablesToEmit.push_back(ReadDeclID(F,
Record, I));
4083 for (
unsigned I = 0, N =
Record.size(); I != N; ) {
4084 unsigned GlobalID = getGlobalSubmoduleID(F,
Record[I++]);
4087 PendingImportedModules.push_back(ImportedSubmodule(GlobalID,
Loc));
4088 if (DeserializationListener)
4089 DeserializationListener->ModuleImportRead(GlobalID,
Loc);
4097 return llvm::createStringError(
4098 std::errc::illegal_byte_sequence,
4099 "duplicate MACRO_OFFSET record in AST file");
4102 unsigned LocalBaseMacroID =
Record[1];
4108 GlobalMacroMap.insert(std::make_pair(getTotalNumMacros() + 1, &F));
4112 std::make_pair(LocalBaseMacroID,
4121 LateParsedTemplates.emplace_back(
4122 std::piecewise_construct, std::forward_as_tuple(&F),
4128 return llvm::createStringError(std::errc::illegal_byte_sequence,
4129 "invalid pragma optimize record");
4130 OptimizeOffPragmaLocation = ReadSourceLocation(F,
Record[0]);
4135 return llvm::createStringError(std::errc::illegal_byte_sequence,
4136 "invalid pragma ms_struct record");
4137 PragmaMSStructState =
Record[0];
4142 return llvm::createStringError(
4143 std::errc::illegal_byte_sequence,
4144 "invalid pragma pointers to members record");
4145 PragmaMSPointersToMembersState =
Record[0];
4146 PointersToMembersPragmaLocation = ReadSourceLocation(F,
Record[1]);
4150 for (
unsigned I = 0, N =
Record.size(); I != N; )
4151 UnusedLocalTypedefNameCandidates.push_back(ReadDeclID(F,
Record, I));
4156 return llvm::createStringError(std::errc::illegal_byte_sequence,
4157 "invalid cuda pragma options record");
4158 ForceHostDeviceDepth =
Record[0];
4163 return llvm::createStringError(std::errc::illegal_byte_sequence,
4164 "invalid pragma pack record");
4165 PragmaAlignPackCurrentValue = ReadAlignPackInfo(
Record[0]);
4166 PragmaAlignPackCurrentLocation = ReadSourceLocation(F,
Record[1]);
4167 unsigned NumStackEntries =
Record[2];
4170 PragmaAlignPackStack.clear();
4171 for (
unsigned I = 0; I < NumStackEntries; ++I) {
4172 PragmaAlignPackStackEntry Entry;
4173 Entry.Value = ReadAlignPackInfo(
Record[Idx++]);
4174 Entry.Location = ReadSourceLocation(F,
Record[Idx++]);
4175 Entry.PushLocation = ReadSourceLocation(F,
Record[Idx++]);
4176 PragmaAlignPackStrings.push_back(ReadString(
Record, Idx));
4177 Entry.SlotLabel = PragmaAlignPackStrings.back();
4178 PragmaAlignPackStack.push_back(Entry);
4185 return llvm::createStringError(std::errc::illegal_byte_sequence,
4186 "invalid pragma float control record");
4188 FpPragmaCurrentLocation = ReadSourceLocation(F,
Record[1]);
4189 unsigned NumStackEntries =
Record[2];
4192 FpPragmaStack.clear();
4193 for (
unsigned I = 0; I < NumStackEntries; ++I) {
4194 FpPragmaStackEntry Entry;
4196 Entry.Location = ReadSourceLocation(F,
Record[Idx++]);
4197 Entry.PushLocation = ReadSourceLocation(F,
Record[Idx++]);
4198 FpPragmaStrings.push_back(ReadString(
Record, Idx));
4199 Entry.SlotLabel = FpPragmaStrings.back();
4200 FpPragmaStack.push_back(Entry);
4206 for (
unsigned I = 0, N =
Record.size(); I != N; )
4207 DeclsToCheckForDeferredDiags.insert(ReadDeclID(F,
Record, I));
4213void ASTReader::ReadModuleOffsetMap(
ModuleFile &F)
const {
4228 assert(ImportedModuleVector.empty());
4230 while (
Data < DataEnd) {
4234 using namespace llvm::support;
4236 endian::readNext<uint8_t, llvm::endianness::little>(
Data));
4237 uint16_t Len = endian::readNext<uint16_t, llvm::endianness::little>(
Data);
4238 StringRef Name = StringRef((
const char*)
Data, Len);
4242 ? ModuleMgr.lookupByModuleName(Name)
4243 : ModuleMgr.lookupByFileName(Name));
4245 std::string Msg =
"refers to unknown module, cannot find ";
4246 Msg.append(std::string(Name));
4251 ImportedModuleVector.push_back(OM);
4254 endian::readNext<uint32_t, llvm::endianness::little>(
Data);
4255 uint32_t PreprocessedEntityIDOffset =
4256 endian::readNext<uint32_t, llvm::endianness::little>(
Data);
4258 endian::readNext<uint32_t, llvm::endianness::little>(
Data);
4260 endian::readNext<uint32_t, llvm::endianness::little>(
Data);
4263 RemapBuilder &Remap) {
4264 constexpr uint32_t None = std::numeric_limits<uint32_t>::max();
4266 Remap.insert(std::make_pair(Offset,
4267 static_cast<int>(BaseOffset - Offset)));
4270 mapOffset(MacroIDOffset, OM->
BaseMacroID, MacroRemap);
4272 PreprocessedEntityRemap);
4281 unsigned ClientLoadCapabilities) {
4290 "MODULE_NAME should come before MODULE_MAP_FILE");
4291 if (PP.getPreprocessorOpts().ModulesCheckRelocated &&
4297 auto &Map = PP.getHeaderSearchInfo().getModuleMap();
4299 M ? Map.getModuleMapFileForUniquing(M) : std::nullopt;
4301 if (!
bool(PP.getPreprocessorOpts().DisablePCHOrModuleValidation &
4304 if (!canRecoverFromOutOfDate(F.
FileName, ClientLoadCapabilities)) {
4305 if (
auto ASTFE = M ? M->
getASTFile() : std::nullopt) {
4308 << ASTFE->getName();
4311 Diag(diag::err_imported_module_not_found)
4319 Diag(diag::note_imported_by_pch_module_not_found)
4326 assert(M && M->
Name == F.
ModuleName &&
"found module with different name");
4330 if (!StoredModMap || *StoredModMap != ModMap) {
4331 assert(ModMap &&
"found module is missing module map file");
4333 "top-level import should be verified");
4335 if (!canRecoverFromOutOfDate(F.
FileName, ClientLoadCapabilities))
4336 Diag(diag::err_imported_module_modmap_changed)
4343 for (
unsigned I = 0, N =
Record[Idx++]; I < N; ++I) {
4348 if (!canRecoverFromOutOfDate(F.
FileName, ClientLoadCapabilities))
4349 Error(
"could not find file '" +
Filename +
"' referenced by AST file");
4352 AdditionalStoredMaps.insert(*SF);
4357 if (
auto *AdditionalModuleMaps = Map.getAdditionalModuleMapFiles(M)) {
4361 if (!AdditionalStoredMaps.erase(ModMap)) {
4362 if (!canRecoverFromOutOfDate(F.
FileName, ClientLoadCapabilities))
4363 Diag(diag::err_module_different_modmap)
4373 if (!canRecoverFromOutOfDate(F.
FileName, ClientLoadCapabilities))
4374 Diag(diag::err_module_different_modmap)
4388 SemaObjC::GlobalMethodPool::iterator Known =
4395 : Known->second.second;
4397 for (
ObjCMethodList *List = &Start; List; List = List->getNext()) {
4399 if (List->getMethod() == Method) {
4407 if (List->getNext())
4408 List->setMethod(List->getNext()->getMethod());
4410 List->setMethod(Method);
4416 for (
Decl *
D : Names) {
4420 if (wasHidden && SemaObj) {
4433 Stack.push_back(Mod);
4434 while (!Stack.empty()) {
4435 Mod = Stack.pop_back_val();
4437 if (NameVisibility <= Mod->NameVisibility) {
4453 HiddenNamesMapType::iterator Hidden = HiddenNamesMap.find(Mod);
4454 if (Hidden != HiddenNamesMap.end()) {
4456 HiddenNamesMap.erase(Hidden);
4458 assert(!HiddenNamesMap.contains(Mod) &&
4459 "making names visible added hidden names");
4466 I = Exports.begin(),
E = Exports.end(); I !=
E; ++I) {
4468 if (
Visited.insert(Exported).second)
4469 Stack.push_back(Exported);
4484 getContext().mergeDefinitionIntoModule(
4487 PendingMergedDefinitionsToDeduplicate.insert(Def);
4496 if (TriedLoadingGlobalIndex || !UseGlobalIndex ||
4497 !PP.getLangOpts().Modules)
4501 TriedLoadingGlobalIndex =
true;
4502 StringRef ModuleCachePath
4503 = getPreprocessor().getHeaderSearchInfo().getModuleCachePath();
4504 std::pair<GlobalModuleIndex *, llvm::Error>
Result =
4506 if (llvm::Error Err = std::move(
Result.second)) {
4508 consumeError(std::move(Err));
4512 GlobalIndex.reset(
Result.first);
4513 ModuleMgr.setGlobalIndex(GlobalIndex.get());
4518 return PP.getLangOpts().Modules && UseGlobalIndex &&
4519 !hasGlobalIndex() && TriedLoadingGlobalIndex;
4530 consumeError(MaybeEntry.takeError());
4533 llvm::BitstreamEntry Entry = MaybeEntry.get();
4535 switch (Entry.Kind) {
4536 case llvm::BitstreamEntry::Error:
4537 case llvm::BitstreamEntry::EndBlock:
4540 case llvm::BitstreamEntry::Record:
4546 consumeError(Skipped.takeError());
4550 case llvm::BitstreamEntry::SubBlock:
4551 if (Entry.ID == BlockID) {
4552 if (llvm::Error Err = Cursor.EnterSubBlock(BlockID)) {
4554 consumeError(std::move(Err));
4561 if (llvm::Error Err = Cursor.SkipBlock()) {
4563 consumeError(std::move(Err));
4572 unsigned ClientLoadCapabilities,
4574 llvm::TimeTraceScope scope(
"ReadAST",
FileName);
4578 CurrentDeserializingModuleKind,
Type);
4584 unsigned PreviousGeneration = 0;
4586 PreviousGeneration = incrementGeneration(*ContextObj);
4588 unsigned NumModules = ModuleMgr.size();
4593 ClientLoadCapabilities)) {
4594 ModuleMgr.removeModules(ModuleMgr.begin() + NumModules);
4598 GlobalIndex.reset();
4599 ModuleMgr.setGlobalIndex(
nullptr);
4603 if (NewLoadedModuleFile && !Loaded.empty())
4604 *NewLoadedModuleFile = Loaded.back().Mod;
4615 for (ImportedModule &M : Loaded) {
4617 llvm::TimeTraceScope Scope2(
"Read Loaded AST", F.
ModuleName);
4620 if (llvm::Error Err = ReadASTBlock(F, ClientLoadCapabilities)) {
4621 Error(std::move(Err));
4627 Error(diag::err_module_file_missing_top_level_submodule, F.
FileName);
4633 if (llvm::Error Err = ReadExtensionBlock(F)) {
4634 Error(std::move(Err));
4647 for (ImportedModule &M : Loaded) {
4663 if (!PP.getLangOpts().CPlusPlus) {
4670 auto It = PP.getIdentifierTable().find(Key);
4671 if (It == PP.getIdentifierTable().end())
4680 II = &PP.getIdentifierTable().getOwn(Key);
4691 SetIdentifierInfo(ID, II);
4698 for (
auto &
Id : PP.getIdentifierTable())
4699 Id.second->setOutOfDate(
true);
4702 for (
const auto &Sel : SelectorGeneration)
4703 SelectorOutOfDate[Sel.first] =
true;
4707 for (ImportedModule &M : Loaded) {
4710 ModuleMgr.moduleFileAccepted(&F);
4719 F.
ImportLoc = TranslateSourceLocation(*M.ImportedBy, M.ImportLoc);
4723 for (
unsigned I = 0, N = UnresolvedModuleRefs.size(); I != N; ++I) {
4724 UnresolvedModuleRef &
Unresolved = UnresolvedModuleRefs[I];
4726 Module *ResolvedMod = getSubmodule(GlobalID);
4729 case UnresolvedModuleRef::Conflict:
4732 Conflict.
Other = ResolvedMod;
4734 Unresolved.Mod->Conflicts.push_back(Conflict);
4738 case UnresolvedModuleRef::Import:
4743 case UnresolvedModuleRef::Affecting:
4745 Unresolved.Mod->AffectingClangModules.insert(ResolvedMod);
4748 case UnresolvedModuleRef::Export:
4755 UnresolvedModuleRefs.clear();
4762 InitializeContext();
4767 if (DeserializationListener)
4768 DeserializationListener->ReaderInitialized(
this);
4770 ModuleFile &PrimaryModule = ModuleMgr.getPrimaryModule();
4785 for (
unsigned I = 0, N = ObjCClassesLoaded.size(); I != N; ++I) {
4786 loadObjCCategories(ObjCClassesLoaded[I]->getGlobalID(),
4787 ObjCClassesLoaded[I], PreviousGeneration);
4796 for (
unsigned I = 0, N = Loaded.size(); I != N; ++I) {
4797 ImportedModule &M = Loaded[I];
4814 if (!Stream.canSkipToPos(4))
4815 return llvm::createStringError(std::errc::illegal_byte_sequence,
4816 "file too small to contain AST file magic");
4817 for (
unsigned C : {
'C',
'P',
'C',
'H'})
4820 return llvm::createStringError(
4821 std::errc::illegal_byte_sequence,
4822 "file doesn't start with AST file magic");
4824 return Res.takeError();
4825 return llvm::Error::success();
4840 llvm_unreachable(
"unknown module kind");
4844ASTReader::ReadASTCore(StringRef
FileName,
4849 off_t ExpectedSize, time_t ExpectedModTime,
4851 unsigned ClientLoadCapabilities) {
4853 std::string ErrorStr;
4855 = ModuleMgr.addModule(
FileName,
Type, ImportLoc, ImportedBy,
4856 getGeneration(), ExpectedSize, ExpectedModTime,
4860 switch (AddResult) {
4862 Diag(diag::remark_module_import)
4864 << (ImportedBy ? StringRef(ImportedBy->
ModuleName) : StringRef());
4874 if (ClientLoadCapabilities & ARR_Missing)
4878 Diag(diag::err_ast_file_not_found)
4886 if (ClientLoadCapabilities & ARR_OutOfDate)
4890 Diag(diag::err_ast_file_out_of_date)
4896 assert(M &&
"Missing module file");
4898 bool ShouldFinalizePCM =
false;
4899 auto FinalizeOrDropPCM = llvm::make_scope_exit([&]() {
4900 auto &MC = getModuleManager().getModuleCache();
4901 if (ShouldFinalizePCM)
4907 BitstreamCursor &Stream = F.
Stream;
4908 Stream = BitstreamCursor(PCHContainerRdr.ExtractPCH(*F.Buffer));
4909 F.SizeInBits = F.Buffer->getBufferSize() * 8;
4913 Diag(diag::err_ast_file_invalid)
4919 bool HaveReadControlBlock =
false;
4923 Error(MaybeEntry.takeError());
4926 llvm::BitstreamEntry Entry = MaybeEntry.get();
4928 switch (Entry.Kind) {
4929 case llvm::BitstreamEntry::Error:
4930 case llvm::BitstreamEntry::Record:
4931 case llvm::BitstreamEntry::EndBlock:
4932 Error(
"invalid record at top-level of AST file");
4935 case llvm::BitstreamEntry::SubBlock:
4941 HaveReadControlBlock =
true;
4942 switch (ReadControlBlock(F, Loaded, ImportedBy, ClientLoadCapabilities)) {
4950 F.ModuleName.empty()) {
4952 if (
Result != OutOfDate ||
4953 (ClientLoadCapabilities & ARR_OutOfDate) == 0)
4959 case Failure:
return Failure;
4960 case Missing:
return Missing;
4961 case OutOfDate:
return OutOfDate;
4963 case ConfigurationMismatch:
return ConfigurationMismatch;
4964 case HadErrors:
return HadErrors;
4969 if (!HaveReadControlBlock) {
4970 if ((ClientLoadCapabilities & ARR_VersionMismatch) == 0)
4971 Diag(diag::err_ast_file_version_too_old)
4977 Loaded.push_back(ImportedModule(M, ImportedBy, ImportLoc));
4978 ShouldFinalizePCM =
true;
4982 if (llvm::Error Err = Stream.SkipBlock()) {
4983 Error(std::move(Err));
4990 llvm_unreachable(
"unexpected break; expected return");
4994ASTReader::readUnhashedControlBlock(
ModuleFile &F,
bool WasImportedBy,
4995 unsigned ClientLoadCapabilities) {
4997 PP.getHeaderSearchInfo().getHeaderSearchOpts();
4998 bool AllowCompatibleConfigurationMismatch =
5000 bool DisableValidation = shouldDisableValidationForFile(F);
5002 ASTReadResult
Result = readUnhashedControlBlockImpl(
5004 AllowCompatibleConfigurationMismatch, Listener.get(),
5009 if (DisableValidation || WasImportedBy ||
5010 (AllowConfigurationMismatch &&
Result == ConfigurationMismatch))
5014 Error(
"malformed block record in AST file");
5037 if (getModuleManager().getModuleCache().isPCMFinal(F.
FileName)) {
5038 Diag(diag::warn_module_system_bit_conflict) << F.
FileName;
5048 unsigned ClientLoadCapabilities,
bool AllowCompatibleConfigurationMismatch,
5051 BitstreamCursor Stream(StreamData);
5056 consumeError(std::move(Err));
5071 consumeError(MaybeEntry.takeError());
5074 llvm::BitstreamEntry Entry = MaybeEntry.get();
5076 switch (Entry.Kind) {
5077 case llvm::BitstreamEntry::Error:
5078 case llvm::BitstreamEntry::SubBlock:
5081 case llvm::BitstreamEntry::EndBlock:
5084 case llvm::BitstreamEntry::Record:
5093 Stream.readRecord(Entry.ID,
Record, &Blob);
5094 if (!MaybeRecordType) {
5103 "Dummy AST file signature not backpatched in ASTWriter.");
5110 "Dummy AST block hash not backpatched in ASTWriter.");
5114 bool Complain = (ClientLoadCapabilities & ARR_OutOfDate) == 0;
5115 if (Listener && ValidateDiagnosticOptions &&
5116 !AllowCompatibleConfigurationMismatch &&
5122 bool Complain = (ClientLoadCapabilities & ARR_ConfigurationMismatch) == 0;
5123 if (Listener && !AllowCompatibleConfigurationMismatch &&
5124 ParseHeaderSearchPaths(
Record, Complain, *Listener))
5125 Result = ConfigurationMismatch;
5154 if (
Record.size() < 4)
return true;
5159 unsigned BlockNameLen =
Record[2];
5160 unsigned UserInfoLen =
Record[3];
5162 if (BlockNameLen + UserInfoLen > Blob.size())
return true;
5164 Metadata.
BlockName = std::string(Blob.data(), Blob.data() + BlockNameLen);
5165 Metadata.
UserInfo = std::string(Blob.data() + BlockNameLen,
5166 Blob.data() + BlockNameLen + UserInfoLen);
5170llvm::Error ASTReader::ReadExtensionBlock(
ModuleFile &F) {
5171 BitstreamCursor &Stream = F.
Stream;
5177 return MaybeEntry.takeError();
5178 llvm::BitstreamEntry Entry = MaybeEntry.get();
5180 switch (Entry.Kind) {
5181 case llvm::BitstreamEntry::SubBlock:
5182 if (llvm::Error Err = Stream.SkipBlock())
5185 case llvm::BitstreamEntry::EndBlock:
5186 return llvm::Error::success();
5187 case llvm::BitstreamEntry::Error:
5188 return llvm::createStringError(std::errc::illegal_byte_sequence,
5189 "malformed block record in AST file");
5190 case llvm::BitstreamEntry::Record:
5197 Stream.readRecord(Entry.ID,
Record, &Blob);
5199 return MaybeRecCode.takeError();
5200 switch (MaybeRecCode.get()) {
5204 return llvm::createStringError(
5205 std::errc::illegal_byte_sequence,
5206 "malformed EXTENSION_METADATA in AST file");
5209 auto Known = ModuleFileExtensions.find(Metadata.
BlockName);
5210 if (Known == ModuleFileExtensions.end())
break;
5213 if (
auto Reader = Known->second->createExtensionReader(Metadata, *
this,
5223 return llvm::Error::success();
5227 assert(ContextObj &&
"no context to initialize");
5231 if (DeserializationListener)
5232 DeserializationListener->DeclRead(
5242 if (!Context.CFConstantStringTypeDecl)
5249 Error(
"FILE type is NULL");
5253 if (!Context.FILEDecl) {
5259 Error(
"Invalid FILE type in AST file");
5268 QualType Jmp_bufType = GetType(Jmp_buf);
5269 if (Jmp_bufType.
isNull()) {
5270 Error(
"jmp_buf type is NULL");
5274 if (!Context.jmp_bufDecl) {
5280 Error(
"Invalid jmp_buf type in AST file");
5289 QualType Sigjmp_bufType = GetType(Sigjmp_buf);
5290 if (Sigjmp_bufType.
isNull()) {
5291 Error(
"sigjmp_buf type is NULL");
5295 if (!Context.sigjmp_bufDecl) {
5300 assert(Tag &&
"Invalid sigjmp_buf type in AST file");
5307 if (Context.ObjCIdRedefinitionType.
isNull())
5308 Context.ObjCIdRedefinitionType = GetType(ObjCIdRedef);
5311 if (
TypeID ObjCClassRedef =
5313 if (Context.ObjCClassRedefinitionType.
isNull())
5314 Context.ObjCClassRedefinitionType = GetType(ObjCClassRedef);
5317 if (
TypeID ObjCSelRedef =
5319 if (Context.ObjCSelRedefinitionType.
isNull())
5320 Context.ObjCSelRedefinitionType = GetType(ObjCSelRedef);
5324 QualType Ucontext_tType = GetType(Ucontext_t);
5325 if (Ucontext_tType.
isNull()) {
5326 Error(
"ucontext_t type is NULL");
5330 if (!Context.ucontext_tDecl) {
5335 assert(Tag &&
"Invalid ucontext_t type in AST file");
5345 if (!CUDASpecialDeclRefs.empty()) {
5346 assert(CUDASpecialDeclRefs.size() == 1 &&
"More decl refs than expected!");
5348 cast<FunctionDecl>(GetDecl(CUDASpecialDeclRefs[0])));
5353 for (
auto &Import : PendingImportedModules) {
5354 if (
Module *Imported = getSubmodule(Import.ID)) {
5357 if (Import.ImportLoc.isValid())
5358 PP.makeModuleVisible(Imported, Import.ImportLoc);
5365 PendingImportedModulesSema.append(PendingImportedModules);
5366 PendingImportedModules.clear();
5376 BitstreamCursor Stream(
PCH);
5379 consumeError(std::move(Err));
5391 Stream.advanceSkippingSubblocks();
5394 consumeError(MaybeEntry.takeError());
5397 llvm::BitstreamEntry Entry = MaybeEntry.get();
5399 if (Entry.Kind != llvm::BitstreamEntry::Record)
5407 consumeError(MaybeRecord.takeError());
5413 "Dummy AST file signature not backpatched in ASTWriter.");
5423 const std::string &ASTFileName,
FileManager &FileMgr,
5431 Diags.
Report(diag::err_fe_unable_to_read_pch_file)
5432 << ASTFileName << Buffer.getError().message();
5433 return std::string();
5437 BitstreamCursor Stream(PCHContainerRdr.
ExtractPCH(**Buffer));
5441 Diags.
Report(diag::err_fe_not_a_pch_file) << ASTFileName << std::move(Err);
5442 return std::string();
5447 Diags.
Report(diag::err_fe_pch_malformed_block) << ASTFileName;
5448 return std::string();
5455 Stream.advanceSkippingSubblocks();
5458 consumeError(MaybeEntry.takeError());
5459 return std::string();
5461 llvm::BitstreamEntry Entry = MaybeEntry.get();
5463 if (Entry.Kind == llvm::BitstreamEntry::EndBlock)
5464 return std::string();
5466 if (Entry.Kind != llvm::BitstreamEntry::Record) {
5467 Diags.
Report(diag::err_fe_pch_malformed_block) << ASTFileName;
5468 return std::string();
5476 consumeError(MaybeRecord.takeError());
5477 return std::string();
5490 std::string ExistingModuleCachePath;
5492 bool StrictOptionMatches;
5495 SimplePCHValidator(
const LangOptions &ExistingLangOpts,
5498 StringRef ExistingModuleCachePath,
FileManager &FileMgr,
5499 bool StrictOptionMatches)
5500 : ExistingLangOpts(ExistingLangOpts),
5501 ExistingTargetOpts(ExistingTargetOpts),
5502 ExistingPPOpts(ExistingPPOpts),
5503 ExistingModuleCachePath(ExistingModuleCachePath), FileMgr(FileMgr),
5504 StrictOptionMatches(StrictOptionMatches) {}
5506 bool ReadLanguageOptions(
const LangOptions &LangOpts,
5507 StringRef ModuleFilename,
bool Complain,
5508 bool AllowCompatibleDifferences)
override {
5510 nullptr, AllowCompatibleDifferences);
5514 StringRef ModuleFilename,
bool Complain,
5515 bool AllowCompatibleDifferences)
override {
5517 nullptr, AllowCompatibleDifferences);
5521 StringRef ModuleFilename,
5522 StringRef SpecificModuleCachePath,
5523 bool Complain)
override {
5525 SpecificModuleCachePath,
5526 ExistingModuleCachePath, ModuleFilename,
5527 nullptr, ExistingLangOpts, ExistingPPOpts);
5531 StringRef ModuleFilename,
bool ReadMacros,
5533 std::string &SuggestedPredefines)
override {
5535 PPOpts, ExistingPPOpts, ModuleFilename, ReadMacros,
nullptr,
5536 FileMgr, SuggestedPredefines, ExistingLangOpts,
5549 unsigned ClientLoadCapabilities) {
5551 std::unique_ptr<llvm::MemoryBuffer> OwnedBuffer;
5563 OwnedBuffer = std::move(*BufferOrErr);
5564 Buffer = OwnedBuffer.get();
5568 StringRef Bytes = PCHContainerRdr.
ExtractPCH(*Buffer);
5569 BitstreamCursor Stream(Bytes);
5573 consumeError(std::move(Err));
5584 BitstreamCursor InputFilesCursor;
5585 uint64_t InputFilesOffsetBase = 0;
5588 std::string ModuleDir;
5589 bool DoneWithControlBlock =
false;
5591 PathBuf.reserve(256);
5592 while (!DoneWithControlBlock) {
5596 consumeError(MaybeEntry.takeError());
5599 llvm::BitstreamEntry Entry = MaybeEntry.get();
5601 switch (Entry.Kind) {
5602 case llvm::BitstreamEntry::SubBlock: {
5605 std::string IgnoredSuggestedPredefines;
5606 if (ReadOptionsBlock(Stream,
Filename, ClientLoadCapabilities,
5608 Listener, IgnoredSuggestedPredefines) !=
Success)
5614 InputFilesCursor = Stream;
5615 if (llvm::Error Err = Stream.SkipBlock()) {
5617 consumeError(std::move(Err));
5620 if (NeedsInputFiles &&
5623 InputFilesOffsetBase = InputFilesCursor.GetCurrentBitNo();
5627 if (llvm::Error Err = Stream.SkipBlock()) {
5629 consumeError(std::move(Err));
5638 case llvm::BitstreamEntry::EndBlock:
5639 DoneWithControlBlock =
true;
5642 case llvm::BitstreamEntry::Error:
5645 case llvm::BitstreamEntry::Record:
5649 if (DoneWithControlBlock)
break;
5654 Stream.readRecord(Entry.ID,
Record, &Blob);
5655 if (!MaybeRecCode) {
5670 ModuleDir = std::string(Blob);
5674 std::string PathStr = ReadString(
Record, Idx);
5675 auto Path = ResolveImportedPath(PathBuf, PathStr, ModuleDir);
5680 if (!NeedsInputFiles)
5683 unsigned NumInputFiles =
Record[0];
5684 unsigned NumUserFiles =
Record[1];
5685 const llvm::support::unaligned_uint64_t *InputFileOffs =
5686 (
const llvm::support::unaligned_uint64_t *)Blob.data();
5687 for (
unsigned I = 0; I != NumInputFiles; ++I) {
5689 bool isSystemFile = I >= NumUserFiles;
5691 if (isSystemFile && !NeedsSystemInputFiles)
5694 BitstreamCursor &Cursor = InputFilesCursor;
5696 if (llvm::Error Err =
5697 Cursor.JumpToBit(InputFilesOffsetBase + InputFileOffs[I])) {
5699 consumeError(std::move(Err));
5705 consumeError(MaybeCode.takeError());
5707 unsigned Code = MaybeCode.get();
5711 bool shouldContinue =
false;
5713 Cursor.readRecord(Code,
Record, &Blob);
5714 if (!MaybeRecordType) {
5716 consumeError(MaybeRecordType.takeError());
5722 bool Overridden =
static_cast<bool>(
Record[3]);
5723 auto Filename = ResolveImportedPath(PathBuf, Blob, ModuleDir);
5725 *
Filename, isSystemFile, Overridden,
false);
5728 if (!shouldContinue)
5747 StringRef ModuleName = ReadStringBlob(
Record, Idx, Blob);
5749 bool IsStandardCXXModule =
Record[Idx++];
5753 if (IsStandardCXXModule) {
5763 StringRef FilenameStr = ReadStringBlob(
Record, Idx, Blob);
5764 auto Filename = ResolveImportedPath(PathBuf, FilenameStr, ModuleDir);
5776 if (FindModuleFileExtensions) {
5777 BitstreamCursor SavedStream = Stream;
5779 bool DoneWithExtensionBlock =
false;
5780 while (!DoneWithExtensionBlock) {
5786 llvm::BitstreamEntry Entry = MaybeEntry.get();
5788 switch (Entry.Kind) {
5789 case llvm::BitstreamEntry::SubBlock:
5790 if (llvm::Error Err = Stream.SkipBlock()) {
5792 consumeError(std::move(Err));
5797 case llvm::BitstreamEntry::EndBlock:
5798 DoneWithExtensionBlock =
true;
5801 case llvm::BitstreamEntry::Error:
5804 case llvm::BitstreamEntry::Record:
5811 Stream.readRecord(Entry.ID,
Record, &Blob);
5812 if (!MaybeRecCode) {
5816 switch (MaybeRecCode.get()) {
5828 Stream = SavedStream;
5832 if (readUnhashedControlBlockImpl(
5833 nullptr, Bytes,
Filename, ClientLoadCapabilities,
5835 ValidateDiagnosticOptions) !=
Success)
5847 StringRef ExistingModuleCachePath,
5848 bool RequireStrictOptionMatches) {
5849 SimplePCHValidator validator(LangOpts, TargetOpts, PPOpts,
5850 ExistingModuleCachePath, FileMgr,
5851 RequireStrictOptionMatches);
5852 return !readASTFileControlBlock(
Filename, FileMgr, ModuleCache,
5858llvm::Error ASTReader::ReadSubmoduleBlock(
ModuleFile &F,
5859 unsigned ClientLoadCapabilities) {
5864 ModuleMap &ModMap = PP.getHeaderSearchInfo().getModuleMap();
5869 auto CreateModule = !KnowsTopLevelModule
5874 Module *CurrentModule =
nullptr;
5878 F.
Stream.advanceSkippingSubblocks();
5880 return MaybeEntry.takeError();
5881 llvm::BitstreamEntry Entry = MaybeEntry.get();
5883 switch (Entry.Kind) {
5884 case llvm::BitstreamEntry::SubBlock:
5885 case llvm::BitstreamEntry::Error:
5886 return llvm::createStringError(std::errc::illegal_byte_sequence,
5887 "malformed block record in AST file");
5888 case llvm::BitstreamEntry::EndBlock:
5889 return llvm::Error::success();
5890 case llvm::BitstreamEntry::Record:
5900 return MaybeKind.takeError();
5901 unsigned Kind = MaybeKind.get();
5904 return llvm::createStringError(
5905 std::errc::illegal_byte_sequence,
5906 "submodule metadata record should be at beginning of block");
5921 return llvm::createStringError(std::errc::illegal_byte_sequence,
5922 "malformed module definition");
5924 StringRef Name = Blob;
5931 bool IsFramework =
Record[Idx++];
5932 bool IsExplicit =
Record[Idx++];
5933 bool IsSystem =
Record[Idx++];
5934 bool IsExternC =
Record[Idx++];
5935 bool InferSubmodules =
Record[Idx++];
5936 bool InferExplicitSubmodules =
Record[Idx++];
5937 bool InferExportWildcard =
Record[Idx++];
5938 bool ConfigMacrosExhaustive =
Record[Idx++];
5939 bool ModuleMapIsPrivate =
Record[Idx++];
5940 bool NamedModuleHasInit =
Record[Idx++];
5942 Module *ParentModule =
nullptr;
5944 ParentModule = getSubmodule(
Parent);
5946 CurrentModule = std::invoke(CreateModule, &ModMap, Name, ParentModule,
5947 IsFramework, IsExplicit);
5950 if (GlobalIndex >= SubmodulesLoaded.size() ||
5951 SubmodulesLoaded[GlobalIndex])
5952 return llvm::createStringError(std::errc::invalid_argument,
5953 "too many submodules");
5955 if (!ParentModule) {
5958 if (!
bool(PP.getPreprocessorOpts().DisablePCHOrModuleValidation &
5960 CurFile != F.
File) {
5961 auto ConflictError =
5963 ContextObj->DiagAllocator)
5985 if (InferredAllowedBy.
isValid())
5995 if (DeserializationListener)
5996 DeserializationListener->ModuleRead(GlobalID, CurrentModule);
5998 SubmodulesLoaded[GlobalIndex] = CurrentModule;
6023 auto Filename = ResolveImportedPath(PathBuf, Blob, F);
6024 if (
auto Umbrella = PP.getFileManager().getOptionalFileRef(*
Filename)) {
6052 auto HeaderName = ResolveImportedPath(PathBuf, Blob, F);
6059 auto Dirname = ResolveImportedPath(PathBuf, Blob, F);
6061 PP.getFileManager().getOptionalDirectoryRef(*Dirname)) {
6073 unsigned LocalBaseSubmoduleID =
Record[1];
6077 GlobalSubmoduleMap.insert(std::make_pair(getTotalNumSubmodules()+1,&F));
6082 std::make_pair(LocalBaseSubmoduleID,
6091 for (
unsigned Idx = 0; Idx !=
Record.size(); ++Idx) {
6096 Unresolved.Kind = UnresolvedModuleRef::Import;
6103 for (
unsigned Idx = 0; Idx !=
Record.size(); ++Idx) {
6108 Unresolved.Kind = UnresolvedModuleRef::Affecting;
6115 for (
unsigned Idx = 0; Idx + 1 <
Record.size(); Idx += 2) {
6120 Unresolved.Kind = UnresolvedModuleRef::Export;
6132 PP.getTargetInfo());
6150 Unresolved.Kind = UnresolvedModuleRef::Conflict;
6161 for (
unsigned I = 0; I <
Record.size(); )
6162 Inits.push_back(ReadDeclID(F,
Record, I));
6163 ContextObj->addLazyModuleInitializers(CurrentModule, Inits);
6182bool ASTReader::ParseLanguageOptions(
const RecordData &
Record,
6183 StringRef ModuleFilename,
bool Complain,
6185 bool AllowCompatibleDifferences) {
6188#define LANGOPT(Name, Bits, Default, Description) \
6189 LangOpts.Name = Record[Idx++];
6190#define ENUM_LANGOPT(Name, Type, Bits, Default, Description) \
6191 LangOpts.set##Name(static_cast<LangOptions::Type>(Record[Idx++]));
6192#include "clang/Basic/LangOptions.def"
6193#define SANITIZER(NAME, ID) \
6194 LangOpts.Sanitize.set(SanitizerKind::ID, Record[Idx++]);
6195#include "clang/Basic/Sanitizers.def"
6197 for (
unsigned N =
Record[Idx++]; N; --N)
6201 VersionTuple runtimeVersion = ReadVersionTuple(
Record, Idx);
6207 for (
unsigned N =
Record[Idx++]; N; --N) {
6209 ReadString(
Record, Idx));
6214 for (
unsigned N =
Record[Idx++]; N; --N) {
6221 AllowCompatibleDifferences);
6224bool ASTReader::ParseTargetOptions(
const RecordData &
Record,
6225 StringRef ModuleFilename,
bool Complain,
6227 bool AllowCompatibleDifferences) {
6231 TargetOpts.
CPU = ReadString(
Record, Idx);
6233 TargetOpts.
ABI = ReadString(
Record, Idx);
6234 for (
unsigned N =
Record[Idx++]; N; --N) {
6237 for (
unsigned N =
Record[Idx++]; N; --N) {
6242 AllowCompatibleDifferences);
6245bool ASTReader::ParseDiagnosticOptions(
const RecordData &
Record,
6246 StringRef ModuleFilename,
bool Complain,
6250#define DIAGOPT(Name, Bits, Default) DiagOpts->Name = Record[Idx++];
6251#define ENUM_DIAGOPT(Name, Type, Bits, Default) \
6252 DiagOpts->set##Name(static_cast<Type>(Record[Idx++]));
6253#include "clang/Basic/DiagnosticOptions.def"
6255 for (
unsigned N =
Record[Idx++]; N; --N)
6256 DiagOpts->Warnings.push_back(ReadString(
Record, Idx));
6257 for (
unsigned N =
Record[Idx++]; N; --N)
6258 DiagOpts->Remarks.push_back(ReadString(
Record, Idx));
6263bool ASTReader::ParseFileSystemOptions(
const RecordData &
Record,
bool Complain,
6271bool ASTReader::ParseHeaderSearchOptions(
const RecordData &
Record,
6272 StringRef ModuleFilename,
6290 std::string SpecificModuleCachePath = ReadString(
Record, Idx);
6293 SpecificModuleCachePath, Complain);
6296bool ASTReader::ParseHeaderSearchPaths(
const RecordData &
Record,
bool Complain,
6302 for (
unsigned N =
Record[Idx++]; N; --N) {
6306 bool IsFramework =
Record[Idx++];
6307 bool IgnoreSysRoot =
Record[Idx++];
6313 for (
unsigned N =
Record[Idx++]; N; --N) {
6314 std::string Prefix = ReadString(
Record, Idx);
6315 bool IsSystemHeader =
Record[Idx++];
6320 for (
unsigned N =
Record[Idx++]; N; --N) {
6321 std::string VFSOverlayFile = ReadString(
Record, Idx);
6328bool ASTReader::ParsePreprocessorOptions(
const RecordData &
Record,
6329 StringRef ModuleFilename,
6332 std::string &SuggestedPredefines) {
6337 bool ReadMacros =
Record[Idx++];
6339 for (
unsigned N =
Record[Idx++]; N; --N) {
6341 bool IsUndef =
Record[Idx++];
6342 PPOpts.
Macros.push_back(std::make_pair(Macro, IsUndef));
6347 for (
unsigned N =
Record[Idx++]; N; --N) {
6352 for (
unsigned N =
Record[Idx++]; N; --N) {
6361 SuggestedPredefines.clear();
6363 Complain, SuggestedPredefines);
6366std::pair<ModuleFile *, unsigned>
6367ASTReader::getModulePreprocessedEntity(
unsigned GlobalIndex) {
6368 GlobalPreprocessedEntityMapType::iterator
6369 I = GlobalPreprocessedEntityMap.find(GlobalIndex);
6370 assert(I != GlobalPreprocessedEntityMap.end() &&
6371 "Corrupted global preprocessed entity map");
6374 return std::make_pair(M, LocalIndex);
6377llvm::iterator_range<PreprocessingRecord::iterator>
6378ASTReader::getModulePreprocessedEntities(
ModuleFile &Mod)
const {
6387bool ASTReader::canRecoverFromOutOfDate(StringRef ModuleFileName,
6388 unsigned int ClientLoadCapabilities) {
6389 return ClientLoadCapabilities & ARR_OutOfDate &&
6390 !getModuleManager().getModuleCache().isPCMFinal(ModuleFileName);
6393llvm::iterator_range<ASTReader::ModuleDeclIterator>
6395 return llvm::make_range(
6402 auto I = GlobalSkippedRangeMap.find(GlobalIndex);
6403 assert(I != GlobalSkippedRangeMap.end() &&
6404 "Corrupted global skipped range map");
6407 assert(LocalIndex < M->NumPreprocessedSkippedRanges);
6410 ReadSourceLocation(*M, RawRange.
getEnd()));
6417 std::pair<ModuleFile *, unsigned> PPInfo = getModulePreprocessedEntity(Index);
6419 unsigned LocalIndex = PPInfo.second;
6422 if (!PP.getPreprocessingRecord()) {
6423 Error(
"no preprocessing record");
6430 Error(std::move(Err));
6437 Error(MaybeEntry.takeError());
6440 llvm::BitstreamEntry Entry = MaybeEntry.get();
6442 if (Entry.Kind != llvm::BitstreamEntry::Record)
6447 ReadSourceLocation(M, PPOffs.
getEnd()));
6453 if (!MaybeRecType) {
6454 Error(MaybeRecType.takeError());
6459 bool isBuiltin =
Record[0];
6463 Name = getLocalIdentifier(M,
Record[1]);
6466 getGlobalPreprocessedEntityID(M,
Record[1]);
6467 Def = cast<MacroDefinitionRecord>(
6468 PPRec.getLoadedPreprocessedEntity(GlobalID - 1));
6486 if (DeserializationListener)
6487 DeserializationListener->MacroDefinitionRead(PPID, MD);
6493 const char *FullFileNameStart = Blob.data() +
Record[0];
6494 StringRef FullFileName(FullFileNameStart, Blob.size() -
Record[0]);
6496 if (!FullFileName.empty())
6497 File = PP.getFileManager().getOptionalFileRef(FullFileName);
6504 StringRef(Blob.data(),
Record[0]),
6512 llvm_unreachable(
"Invalid PreprocessorDetailRecordTypes");
6522 GlobalSLocOffsetMapType::const_iterator SLocMapI)
const {
6524 for (GlobalSLocOffsetMapType::const_iterator
6525 EndI = GlobalSLocOffsetMap.end(); SLocMapI != EndI; ++SLocMapI) {
6531 return getTotalNumPreprocessedEntities();
6536struct PPEntityComp {
6566 bool EndsAfter)
const {
6567 if (SourceMgr.isLocalSourceLocation(
Loc))
6568 return getTotalNumPreprocessedEntities();
6570 GlobalSLocOffsetMapType::const_iterator SLocMapI = GlobalSLocOffsetMap.find(
6571 SourceManager::MaxLoadedOffset -
Loc.getOffset() - 1);
6572 assert(SLocMapI != GlobalSLocOffsetMap.end() &&
6573 "Corrupted global sloc offset map");
6575 if (SLocMapI->second->NumPreprocessedEntities == 0)
6576 return findNextPreprocessedEntity(SLocMapI);
6587 pp_iterator
First = pp_begin;
6591 PPI = std::upper_bound(pp_begin, pp_end,
Loc,
6592 PPEntityComp(*
this, M));
6601 std::advance(PPI,
Half);
6602 if (SourceMgr.isBeforeInTranslationUnit(
6603 ReadSourceLocation(M, PPI->getEnd()),
Loc)) {
6606 Count = Count -
Half - 1;
6613 return findNextPreprocessedEntity(SLocMapI);
6620std::pair<unsigned, unsigned>
6623 return std::make_pair(0,0);
6629 return std::make_pair(BeginID, EndID);
6639 std::pair<ModuleFile *, unsigned> PPInfo = getModulePreprocessedEntity(Index);
6641 unsigned LocalIndex = PPInfo.second;
6648 if (SourceMgr.isInFileID(SourceMgr.getFileLoc(
Loc), FID))
6657 class HeaderFileInfoVisitor {
6659 std::optional<HeaderFileInfo> HFI;
6662 explicit HeaderFileInfoVisitor(
FileEntryRef FE) : FE(FE) {}
6671 HeaderFileInfoLookupTable::iterator Pos = Table->find(FE);
6672 if (Pos == Table->end())
6679 std::optional<HeaderFileInfo> getHeaderFileInfo()
const {
return HFI; }
6685 HeaderFileInfoVisitor Visitor(FE);
6686 ModuleMgr.visit(Visitor);
6687 if (std::optional<HeaderFileInfo> HFI = Visitor.getHeaderFileInfo())
6694 using DiagState = DiagnosticsEngine::DiagState;
6705 auto ReadDiagState = [&](
const DiagState &BasedOn,
6706 bool IncludeNonPragmaStates) {
6707 unsigned BackrefID =
Record[Idx++];
6709 return DiagStates[BackrefID - 1];
6712 Diag.DiagStates.push_back(BasedOn);
6713 DiagState *NewState = &
Diag.DiagStates.back();
6714 DiagStates.push_back(NewState);
6715 unsigned Size =
Record[Idx++];
6716 assert(Idx + Size * 2 <=
Record.size() &&
6717 "Invalid data, not enough diag/map pairs");
6719 unsigned DiagID =
Record[Idx++];
6722 if (!NewMapping.
isPragma() && !IncludeNonPragmaStates)
6735 Mapping = NewMapping;
6741 DiagState *FirstState;
6746 FirstState =
Diag.DiagStatesByLoc.FirstDiagState;
6747 DiagStates.push_back(FirstState);
6751 "Invalid data, unexpected backref in initial state");
6753 assert(Idx <
Record.size() &&
6754 "Invalid data, not enough state change pairs in initial state");
6759 unsigned Flags =
Record[Idx++];
6761 Initial.SuppressSystemWarnings = Flags & 1; Flags >>= 1;
6762 Initial.ErrorsAsFatal = Flags & 1; Flags >>= 1;
6763 Initial.WarningsAsErrors = Flags & 1; Flags >>= 1;
6764 Initial.EnableAllWarnings = Flags & 1; Flags >>= 1;
6765 Initial.IgnoreAllWarnings = Flags & 1; Flags >>= 1;
6767 FirstState = ReadDiagState(Initial,
true);
6775 .StateTransitions.push_back({FirstState, 0});
6780 FirstState = ReadDiagState(*
Diag.DiagStatesByLoc.CurDiagState,
false);
6784 unsigned NumLocations =
Record[Idx++];
6785 while (NumLocations--) {
6786 assert(Idx <
Record.size() &&
6787 "Invalid data, missing pragma diagnostic states");
6789 assert(FID.
isValid() &&
"invalid FileID for transition");
6790 unsigned Transitions =
Record[Idx++];
6796 auto &F =
Diag.DiagStatesByLoc.Files[FID];
6797 F.StateTransitions.reserve(F.StateTransitions.size() + Transitions);
6798 for (
unsigned I = 0; I != Transitions; ++I) {
6799 unsigned Offset =
Record[Idx++];
6800 auto *State = ReadDiagState(*FirstState,
false);
6801 F.StateTransitions.push_back({State, Offset});
6806 assert(Idx <
Record.size() &&
6807 "Invalid data, missing final pragma diagnostic state");
6809 auto *CurState = ReadDiagState(*FirstState,
false);
6812 Diag.DiagStatesByLoc.CurDiagState = CurState;
6813 Diag.DiagStatesByLoc.CurDiagStateLoc = CurStateLoc;
6818 auto &
T =
Diag.DiagStatesByLoc.Files[NullFile].StateTransitions;
6820 T.push_back({CurState, 0});
6822 T[0].State = CurState;
6831ASTReader::RecordLocation ASTReader::TypeCursorForIndex(
TypeID ID) {
6832 auto [M, Index] = translateTypeIDToIndex(ID);
6839#define TYPE_BIT_CODE(CLASS_ID, CODE_ID, CODE_VALUE) \
6840 case TYPE_##CODE_ID: return Type::CLASS_ID;
6841#include "clang/Serialization/TypeBitCodes.def"
6843 return std::nullopt;
6854 assert(ContextObj &&
"reading type with no AST context");
6856 RecordLocation
Loc = TypeCursorForIndex(ID);
6857 BitstreamCursor &DeclsCursor =
Loc.F->DeclsCursor;
6863 ReadingKindTracker ReadingKind(Read_Type, *
this);
6866 Deserializing AType(
this);
6868 if (llvm::Error Err = DeclsCursor.JumpToBit(
Loc.Offset)) {
6869 Error(std::move(Err));
6874 Error(RawCode.takeError());
6881 Error(Code.takeError());
6892 Error(
"Unexpected code for type");
6897 return TypeReader.read(*maybeClass);
6925 : Reader(Reader),
Seq(
Seq) {}
6930#define ABSTRACT_TYPELOC(CLASS, PARENT)
6931#define TYPELOC(CLASS, PARENT) \
6932 void Visit##CLASS##TypeLoc(CLASS##TypeLoc TyLoc);
6933#include "clang/AST/TypeLocNodes.def"
6999 if (Reader.readBool())
7006 VisitArrayTypeLoc(TL);
7010 VisitArrayTypeLoc(TL);
7014 VisitArrayTypeLoc(TL);
7017void TypeLocReader::VisitDependentSizedArrayTypeLoc(
7019 VisitArrayTypeLoc(TL);
7022void TypeLocReader::VisitDependentAddressSpaceTypeLoc(
7030void TypeLocReader::VisitDependentSizedExtVectorTypeLoc(
7039void TypeLocReader::VisitDependentVectorTypeLoc(
7055void TypeLocReader::VisitDependentSizedMatrixTypeLoc(
7069 for (
unsigned i = 0, e = TL.
getNumParams(); i != e; ++i) {
7075 VisitFunctionTypeLoc(TL);
7079 VisitFunctionTypeLoc(TL);
7086void TypeLocReader::VisitUsingTypeLoc(
UsingTypeLoc TL) {
7124 auto NNS = readNestedNameSpecifierLoc();
7125 auto TemplateKWLoc = readSourceLocation();
7126 auto ConceptNameLoc = readDeclarationNameInfo();
7127 auto FoundDecl = readDeclAs<NamedDecl>();
7128 auto NamedConcept = readDeclAs<ConceptDecl>();
7130 getContext(), NNS, TemplateKWLoc, ConceptNameLoc, FoundDecl, NamedConcept,
7131 (readBool() ? readASTTemplateArgumentListInfo() :
nullptr));
7135void TypeLocReader::VisitAutoTypeLoc(
AutoTypeLoc TL) {
7137 if (Reader.readBool())
7139 if (Reader.readBool())
7143void TypeLocReader::VisitDeducedTemplateSpecializationTypeLoc(
7152void TypeLocReader::VisitEnumTypeLoc(
EnumTypeLoc TL) {
7168void TypeLocReader::VisitHLSLAttributedResourceTypeLoc(
7177void TypeLocReader::VisitSubstTemplateTypeParmTypeLoc(
7182void TypeLocReader::VisitSubstTemplateTypeParmPackTypeLoc(
7187void TypeLocReader::VisitTemplateSpecializationTypeLoc(
7193 for (
unsigned i = 0, e = TL.
getNumArgs(); i != e; ++i)
7195 Reader.readTemplateArgumentLocInfo(
7199void TypeLocReader::VisitParenTypeLoc(
ParenTypeLoc TL) {
7219void TypeLocReader::VisitDependentTemplateSpecializationTypeLoc(
7229 Reader.readTemplateArgumentLocInfo(
7273void TypeLocReader::VisitPipeTypeLoc(
PipeTypeLoc TL) {
7280void TypeLocReader::VisitDependentBitIntTypeLoc(
7297 TypeSourceInfo *TInfo = getContext().CreateTypeSourceInfo(InfoTy);
7316std::pair<ModuleFile *, unsigned>
7319 "Predefined type shouldn't be in TypesLoaded");
7321 assert(ModuleFileIndex &&
"Untranslated Local Decl?");
7323 ModuleFile *OwningModuleFile = &getModuleManager()[ModuleFileIndex - 1];
7324 assert(OwningModuleFile &&
7325 "untranslated type ID or local type ID shouldn't be in TypesLoaded");
7327 return {OwningModuleFile,
7332 assert(ContextObj &&
"reading type with no AST context");
7343 llvm_unreachable(
"Invalid predefined type");
7532#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
7533 case PREDEF_TYPE_##Id##_ID: \
7534 T = Context.SingletonId; \
7536#include "clang/Basic/OpenCLImageTypes.def"
7537#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
7538 case PREDEF_TYPE_##Id##_ID: \
7539 T = Context.Id##Ty; \
7541#include "clang/Basic/OpenCLExtensionTypes.def"
7581#define SVE_TYPE(Name, Id, SingletonId) \
7582 case PREDEF_TYPE_##Id##_ID: \
7583 T = Context.SingletonId; \
7585#include "clang/Basic/AArch64SVEACLETypes.def"
7586#define PPC_VECTOR_TYPE(Name, Id, Size) \
7587 case PREDEF_TYPE_##Id##_ID: \
7588 T = Context.Id##Ty; \
7590#include "clang/Basic/PPCTypes.def"
7591#define RVV_TYPE(Name, Id, SingletonId) \
7592 case PREDEF_TYPE_##Id##_ID: \
7593 T = Context.SingletonId; \
7595#include "clang/Basic/RISCVVTypes.def"
7596#define WASM_TYPE(Name, Id, SingletonId) \
7597 case PREDEF_TYPE_##Id##_ID: \
7598 T = Context.SingletonId; \
7600#include "clang/Basic/WebAssemblyReferenceTypes.def"
7601#define AMDGPU_TYPE(Name, Id, SingletonId, Width, Align) \
7602 case PREDEF_TYPE_##Id##_ID: \
7603 T = Context.SingletonId; \
7605#include "clang/Basic/AMDGPUTypes.def"
7606#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) \
7607 case PREDEF_TYPE_##Id##_ID: \
7608 T = Context.SingletonId; \
7610#include "clang/Basic/HLSLIntangibleTypes.def"
7613 assert(!
T.isNull() &&
"Unknown predefined type");
7614 return T.withFastQualifiers(FastQuals);
7617 unsigned Index = translateTypeIDToIndex(ID).second;
7619 assert(Index < TypesLoaded.size() &&
"Type index out-of-range");
7620 if (TypesLoaded[Index].isNull()) {
7621 TypesLoaded[Index] = readTypeRecord(ID);
7622 if (TypesLoaded[Index].isNull())
7625 TypesLoaded[Index]->setFromAST();
7626 if (DeserializationListener)
7628 TypesLoaded[Index]);
7631 return TypesLoaded[Index].withFastQualifiers(FastQuals);
7635 return GetType(getGlobalTypeID(F, LocalID));
7644 ReadModuleOffsetMap(F);
7647 LocalID &= llvm::maskTrailingOnes<TypeID>(32);
7649 if (ModuleFileIndex == 0)
7654 ModuleFileIndex = MF.
Index + 1;
7655 return ((uint64_t)ModuleFileIndex << 32) | LocalID;
7664 return readTypeSourceInfo();
7667 readNestedNameSpecifierLoc();
7677 TemplateNameLoc, EllipsisLoc);
7688 llvm_unreachable(
"unexpected template argument loc");
7703 Result.setLAngleLoc(readSourceLocation());
7704 Result.setRAngleLoc(readSourceLocation());
7705 unsigned NumArgsAsWritten = readInt();
7706 for (
unsigned i = 0; i != NumArgsAsWritten; ++i)
7707 Result.addArgument(readTemplateArgumentLoc());
7713 readTemplateArgumentListInfo(
Result);
7720 if (NumCurrentElementsDeserializing) {
7725 PendingIncompleteDeclChains.push_back(
const_cast<Decl*
>(
D));
7730 assert(isa<TranslationUnitDecl>(
D) &&
"Not a TU?");
7741 if (isa<TranslationUnitDecl, NamespaceDecl, RecordDecl, EnumDecl>(DC)) {
7743 if (!getContext().getLangOpts().
CPlusPlus &&
7744 isa<TranslationUnitDecl>(DC)) {
7748 auto *II = Name.getAsIdentifierInfo();
7749 assert(II &&
"non-identifier name in C?");
7750 if (II->isOutOfDate())
7751 updateOutOfDateIdentifier(*II);
7757 auto *DC = cast<DeclContext>(DCDecl);
7759 FindExternalLexicalDecls(
7767 if (
auto *CTSD = dyn_cast<ClassTemplateSpecializationDecl>(
D)) {
7768 Template = CTSD->getSpecializedTemplate();
7769 Args = CTSD->getTemplateArgs().asArray();
7770 }
else if (
auto *VTSD = dyn_cast<VarTemplateSpecializationDecl>(
D)) {
7771 Template = VTSD->getSpecializedTemplate();
7772 Args = VTSD->getTemplateArgs().asArray();
7773 }
else if (
auto *FD = dyn_cast<FunctionDecl>(
D)) {
7774 if (
auto *Tmplt = FD->getPrimaryTemplate()) {
7776 Args = FD->getTemplateSpecializationArgs()->asArray();
7792 RecordLocation
Loc = getLocalBitOffset(Offset);
7793 BitstreamCursor &Cursor =
Loc.F->DeclsCursor;
7795 if (llvm::Error Err = Cursor.JumpToBit(
Loc.Offset)) {
7796 Error(std::move(Err));
7799 ReadingKindTracker ReadingKind(Read_Decl, *
this);
7804 Error(MaybeCode.takeError());
7807 unsigned Code = MaybeCode.get();
7811 if (!MaybeRecCode) {
7812 Error(MaybeRecCode.takeError());
7816 Error(
"malformed AST file: missing C++ ctor initializers");
7820 return Record.readCXXCtorInitializers();
7824 assert(ContextObj &&
"reading base specifiers with no AST context");
7827 RecordLocation
Loc = getLocalBitOffset(Offset);
7828 BitstreamCursor &Cursor =
Loc.F->DeclsCursor;
7830 if (llvm::Error Err = Cursor.JumpToBit(
Loc.Offset)) {
7831 Error(std::move(Err));
7834 ReadingKindTracker ReadingKind(Read_Decl, *
this);
7839 Error(MaybeCode.takeError());
7842 unsigned Code = MaybeCode.get();
7846 if (!MaybeRecCode) {
7847 Error(MaybeCode.takeError());
7850 unsigned RecCode = MaybeRecCode.get();
7853 Error(
"malformed AST file: missing C++ base specifiers");
7857 unsigned NumBases =
Record.readInt();
7860 for (
unsigned I = 0; I != NumBases; ++I)
7861 Bases[I] =
Record.readCXXBaseSpecifier();
7874 ReadModuleOffsetMap(F);
7877 OwningModuleFileIndex == 0
7881 if (OwningModuleFileIndex == 0)
7884 uint64_t NewModuleFileIndex = OwningModuleFile->
Index + 1;
7893 unsigned ModuleFileIndex = ID.getModuleFileIndex();
7894 return M.
Index == ModuleFileIndex - 1;
7902 uint64_t ModuleFileIndex = ID.getModuleFileIndex();
7903 assert(ModuleFileIndex &&
"Untranslated Local Decl?");
7905 return &getModuleManager()[ModuleFileIndex - 1];
7919 if (
Decl *
D = GetExistingDecl(ID))
7923 DeclCursorForID(ID,
Loc);
7928 assert(ContextObj &&
"reading predefined decl without AST context");
7930 Decl *NewLoaded =
nullptr;
7939 if (Context.ObjCIdDecl)
7940 return Context.ObjCIdDecl;
7945 if (Context.ObjCSelDecl)
7946 return Context.ObjCSelDecl;
7951 if (Context.ObjCClassDecl)
7952 return Context.ObjCClassDecl;
7957 if (Context.ObjCProtocolClassDecl)
7958 return Context.ObjCProtocolClassDecl;
7963 if (Context.Int128Decl)
7964 return Context.Int128Decl;
7969 if (Context.UInt128Decl)
7970 return Context.UInt128Decl;
7975 if (Context.ObjCInstanceTypeDecl)
7976 return Context.ObjCInstanceTypeDecl;
7981 if (Context.BuiltinVaListDecl)
7982 return Context.BuiltinVaListDecl;
7993 if (Context.BuiltinMSVaListDecl)
7994 return Context.BuiltinMSVaListDecl;
8003 if (Context.ExternCContext)
8004 return Context.ExternCContext;
8009 if (Context.MakeIntegerSeqDecl)
8010 return Context.MakeIntegerSeqDecl;
8015 if (Context.CFConstantStringTypeDecl)
8016 return Context.CFConstantStringTypeDecl;
8021 if (Context.CFConstantStringTagDecl)
8022 return Context.CFConstantStringTagDecl;
8027 if (Context.TypePackElementDecl)
8028 return Context.TypePackElementDecl;
8033 if (Context.BuiltinCommonTypeDecl)
8034 return Context.BuiltinCommonTypeDecl;
8039 llvm_unreachable(
"Invalid decl ID");
8043 assert(NewLoaded &&
"Failed to load predefined decl?");
8045 if (DeserializationListener)
8046 DeserializationListener->PredefinedDeclBuilt(ID, NewLoaded);
8051unsigned ASTReader::translateGlobalDeclIDToIndex(
GlobalDeclID GlobalID)
const {
8052 ModuleFile *OwningModuleFile = getOwningModuleFile(GlobalID);
8053 if (!OwningModuleFile) {
8062 assert(ContextObj &&
"reading decl with no AST context");
8071 Merged.push_back(ID);
8076 unsigned Index = translateGlobalDeclIDToIndex(ID);
8078 if (Index >= DeclsLoaded.size()) {
8079 assert(0 &&
"declaration ID out-of-range for AST file");
8080 Error(
"declaration ID out-of-range for AST file");
8084 return DeclsLoaded[Index];
8089 return GetExistingDecl(ID);
8091 unsigned Index = translateGlobalDeclIDToIndex(ID);
8093 if (Index >= DeclsLoaded.size()) {
8094 assert(0 &&
"declaration ID out-of-range for AST file");
8095 Error(
"declaration ID out-of-range for AST file");
8099 if (!DeclsLoaded[Index]) {
8101 if (DeserializationListener)
8102 DeserializationListener->DeclRead(ID, DeclsLoaded[Index]);
8105 return DeclsLoaded[Index];
8114 ReadModuleOffsetMap(M);
8116 ModuleFile *Owner = getOwningModuleFile(GlobalID);
8124 uint64_t OrignalModuleFileIndex = 0;
8127 OrignalModuleFileIndex = I + 1;
8131 if (!OrignalModuleFileIndex)
8139 if (Idx >=
Record.size()) {
8140 Error(
"Corrupted AST file");
8154 ClearSwitchCaseIDs();
8157 RecordLocation
Loc = getLocalBitOffset(Offset);
8158 if (llvm::Error Err =
Loc.F->DeclsCursor.JumpToBit(
Loc.Offset)) {
8159 Error(std::move(Err));
8162 assert(NumCurrentElementsDeserializing == 0 &&
8163 "should not be called while already deserializing");
8165 return ReadStmtFromStream(*
Loc.F);
8168bool ASTReader::LoadExternalSpecializationsImpl(SpecLookupTableTy &SpecLookups,
8172 auto It = SpecLookups.find(
D);
8173 if (It == SpecLookups.end())
8179 It->second.Table.findAll();
8183 SpecLookups.erase(It);
8185 bool NewSpecsFound =
false;
8186 Deserializing LookupResults(
this);
8187 for (
auto &Info : Infos) {
8188 if (GetExistingDecl(Info))
8190 NewSpecsFound =
true;
8194 return NewSpecsFound;
8200 bool NewSpecsFound =
8201 LoadExternalSpecializationsImpl(PartialSpecializationsLookups,
D);
8203 return NewSpecsFound;
8205 NewSpecsFound |= LoadExternalSpecializationsImpl(SpecializationsLookups,
D);
8206 return NewSpecsFound;
8209bool ASTReader::LoadExternalSpecializationsImpl(
8210 SpecLookupTableTy &SpecLookups,
const Decl *
D,
8214 auto It = SpecLookups.find(
D);
8215 if (It == SpecLookups.end())
8218 Deserializing LookupResults(
this);
8223 It->second.Table.find(HashValue);
8225 bool NewSpecsFound =
false;
8226 for (
auto &Info : Infos) {
8227 if (GetExistingDecl(Info))
8229 NewSpecsFound =
true;
8233 return NewSpecsFound;
8240 bool NewDeclsFound = LoadExternalSpecializationsImpl(
8241 PartialSpecializationsLookups,
D, TemplateArgs);
8243 LoadExternalSpecializationsImpl(SpecializationsLookups,
D, TemplateArgs);
8245 return NewDeclsFound;
8254 assert(LexicalDecls.size() % 2 == 0 &&
"expected an even number of entries");
8255 for (
int I = 0, N = LexicalDecls.size(); I != N; I += 2) {
8257 if (!IsKindWeWant(K))
8260 auto ID = (
DeclID) + LexicalDecls[I + 1];
8265 if (PredefsVisited[ID])
8268 PredefsVisited[ID] =
true;
8272 assert(
D->
getKind() == K &&
"wrong kind for lexical decl");
8279 if (isa<TranslationUnitDecl>(DC)) {
8280 for (
const auto &Lexical : TULexicalDecls)
8281 Visit(Lexical.first, Lexical.second);
8283 auto I = LexicalDecls.find(DC);
8284 if (I != LexicalDecls.end())
8285 Visit(I->second.first, I->second.second);
8288 ++NumLexicalDeclContextsRead;
8293class UnalignedDeclIDComp {
8299 : Reader(Reader), Mod(M) {}
8327 unsigned Offset,
unsigned Length,
8331 llvm::DenseMap<FileID, FileDeclsInfo>::iterator I = FileDeclIDs.find(
File);
8332 if (I == FileDeclIDs.end())
8335 FileDeclsInfo &DInfo = I->second;
8336 if (DInfo.Decls.empty())
8340 BeginLoc =
SM.getLocForStartOfFile(
File).getLocWithOffset(Offset);
8343 UnalignedDeclIDComp DIDComp(*
this, *DInfo.Mod);
8345 llvm::lower_bound(DInfo.Decls, BeginLoc, DIDComp);
8346 if (BeginIt != DInfo.Decls.begin())
8352 while (BeginIt != DInfo.Decls.begin() &&
8353 GetDecl(getGlobalDeclID(*DInfo.Mod,
8355 ->isTopLevelDeclInObjCContainer())
8359 llvm::upper_bound(DInfo.Decls, EndLoc, DIDComp);
8360 if (EndIt != DInfo.Decls.end())
8365 Decls.push_back(GetDecl(getGlobalDeclID(
8373 "DeclContext has no visible decls in storage");
8377 auto It = Lookups.find(DC);
8378 if (It == Lookups.end())
8388 NamedDecl *ND = cast<NamedDecl>(GetDecl(ID));
8390 Decls.push_back(ND);
8393 ++NumVisibleDeclContextsRead;
8394 SetExternalVisibleDeclsForName(DC, Name, Decls);
8395 return !Decls.empty();
8402 auto It = Lookups.find(DC);
8403 assert(It != Lookups.end() &&
8404 "have external visible storage but no lookup tables");
8409 NamedDecl *ND = cast<NamedDecl>(GetDecl(ID));
8413 ++NumVisibleDeclContextsRead;
8415 for (DeclsMap::iterator I = Decls.begin(),
E = Decls.end(); I !=
E; ++I) {
8416 SetExternalVisibleDeclsForName(DC, I->first, I->second);
8418 const_cast<DeclContext *
>(DC)->setHasExternalVisibleStorage(
false);
8423 auto I = Lookups.find(Primary);
8424 return I == Lookups.end() ? nullptr : &I->second;
8431 IsPartial ? PartialSpecializationsLookups : SpecializationsLookups;
8432 auto I = LookupTable.find(
D);
8433 return I == LookupTable.end() ? nullptr : &I->second;
8438 return (PartialSpecializationsLookups.find(
D) !=
8439 PartialSpecializationsLookups.end()) ||
8440 (SpecializationsLookups.find(
D) != SpecializationsLookups.end());
8449 assert(ImplD && Consumer);
8451 for (
auto *I : ImplD->
methods())
8457void ASTReader::PassInterestingDeclToConsumer(
Decl *
D) {
8465 Consumer->HandleVTable(RD);
8469 this->Consumer = Consumer;
8472 PassInterestingDeclsToConsumer();
8474 if (DeserializationListener)
8475 DeserializationListener->ReaderInitialized(
this);
8479 std::fprintf(stderr,
"*** AST File Statistics:\n");
8481 unsigned NumTypesLoaded =
8482 TypesLoaded.size() - llvm::count(TypesLoaded.materialized(),
QualType());
8483 unsigned NumDeclsLoaded =
8484 DeclsLoaded.size() -
8485 llvm::count(DeclsLoaded.materialized(), (
Decl *)
nullptr);
8486 unsigned NumIdentifiersLoaded =
8487 IdentifiersLoaded.size() -
8489 unsigned NumMacrosLoaded =
8490 MacrosLoaded.size() - llvm::count(MacrosLoaded, (
MacroInfo *)
nullptr);
8491 unsigned NumSelectorsLoaded =
8492 SelectorsLoaded.size() - llvm::count(SelectorsLoaded,
Selector());
8494 if (
unsigned TotalNumSLocEntries = getTotalNumSLocs())
8495 std::fprintf(stderr,
" %u/%u source location entries read (%f%%)\n",
8496 NumSLocEntriesRead, TotalNumSLocEntries,
8497 ((
float)NumSLocEntriesRead/TotalNumSLocEntries * 100));
8498 if (!TypesLoaded.empty())
8499 std::fprintf(stderr,
" %u/%u types read (%f%%)\n",
8500 NumTypesLoaded, (
unsigned)TypesLoaded.size(),
8501 ((
float)NumTypesLoaded/TypesLoaded.size() * 100));
8502 if (!DeclsLoaded.empty())
8503 std::fprintf(stderr,
" %u/%u declarations read (%f%%)\n",
8504 NumDeclsLoaded, (
unsigned)DeclsLoaded.size(),
8505 ((
float)NumDeclsLoaded/DeclsLoaded.size() * 100));
8506 if (!IdentifiersLoaded.empty())
8507 std::fprintf(stderr,
" %u/%u identifiers read (%f%%)\n",
8508 NumIdentifiersLoaded, (
unsigned)IdentifiersLoaded.size(),
8509 ((
float)NumIdentifiersLoaded/IdentifiersLoaded.size() * 100));
8510 if (!MacrosLoaded.empty())
8511 std::fprintf(stderr,
" %u/%u macros read (%f%%)\n",
8512 NumMacrosLoaded, (
unsigned)MacrosLoaded.size(),
8513 ((
float)NumMacrosLoaded/MacrosLoaded.size() * 100));
8514 if (!SelectorsLoaded.empty())
8515 std::fprintf(stderr,
" %u/%u selectors read (%f%%)\n",
8516 NumSelectorsLoaded, (
unsigned)SelectorsLoaded.size(),
8517 ((
float)NumSelectorsLoaded/SelectorsLoaded.size() * 100));
8518 if (TotalNumStatements)
8519 std::fprintf(stderr,
" %u/%u statements read (%f%%)\n",
8520 NumStatementsRead, TotalNumStatements,
8521 ((
float)NumStatementsRead/TotalNumStatements * 100));
8523 std::fprintf(stderr,
" %u/%u macros read (%f%%)\n",
8524 NumMacrosRead, TotalNumMacros,
8525 ((
float)NumMacrosRead/TotalNumMacros * 100));
8526 if (TotalLexicalDeclContexts)
8527 std::fprintf(stderr,
" %u/%u lexical declcontexts read (%f%%)\n",
8528 NumLexicalDeclContextsRead, TotalLexicalDeclContexts,
8529 ((
float)NumLexicalDeclContextsRead/TotalLexicalDeclContexts
8531 if (TotalVisibleDeclContexts)
8532 std::fprintf(stderr,
" %u/%u visible declcontexts read (%f%%)\n",
8533 NumVisibleDeclContextsRead, TotalVisibleDeclContexts,
8534 ((
float)NumVisibleDeclContextsRead/TotalVisibleDeclContexts
8536 if (TotalNumMethodPoolEntries)
8537 std::fprintf(stderr,
" %u/%u method pool entries read (%f%%)\n",
8538 NumMethodPoolEntriesRead, TotalNumMethodPoolEntries,
8539 ((
float)NumMethodPoolEntriesRead/TotalNumMethodPoolEntries
8541 if (NumMethodPoolLookups)
8542 std::fprintf(stderr,
" %u/%u method pool lookups succeeded (%f%%)\n",
8543 NumMethodPoolHits, NumMethodPoolLookups,
8544 ((
float)NumMethodPoolHits/NumMethodPoolLookups * 100.0));
8545 if (NumMethodPoolTableLookups)
8546 std::fprintf(stderr,
" %u/%u method pool table lookups succeeded (%f%%)\n",
8547 NumMethodPoolTableHits, NumMethodPoolTableLookups,
8548 ((
float)NumMethodPoolTableHits/NumMethodPoolTableLookups
8550 if (NumIdentifierLookupHits)
8551 std::fprintf(stderr,
8552 " %u / %u identifier table lookups succeeded (%f%%)\n",
8553 NumIdentifierLookupHits, NumIdentifierLookups,
8554 (
double)NumIdentifierLookupHits*100.0/NumIdentifierLookups);
8557 std::fprintf(stderr,
"\n");
8558 GlobalIndex->printStats();
8561 std::fprintf(stderr,
"\n");
8563 std::fprintf(stderr,
"\n");
8566template<
typename Key,
typename ModuleFile,
unsigned InitialCapacity>
8567LLVM_DUMP_METHOD
static void
8570 InitialCapacity> &Map) {
8571 if (Map.begin() == Map.end())
8576 llvm::errs() << Name <<
":\n";
8577 for (
typename MapType::const_iterator I = Map.begin(), IEnd = Map.end();
8579 llvm::errs() <<
" " << (
DeclID)I->first <<
" -> " << I->second->FileName
8584 llvm::errs() <<
"*** PCH/ModuleFile Remappings:\n";
8586 dumpModuleIDMap(
"Global source location entry map", GlobalSLocEntryMap);
8591 GlobalPreprocessedEntityMap);
8593 llvm::errs() <<
"\n*** PCH/Modules Loaded:";
8602 if (llvm::MemoryBuffer *buf = I.Buffer) {
8603 size_t bytes = buf->getBufferSize();
8604 switch (buf->getBufferKind()) {
8605 case llvm::MemoryBuffer::MemoryBuffer_Malloc:
8608 case llvm::MemoryBuffer::MemoryBuffer_MMap:
8624 pushExternalDeclIntoScope(
D,
D->getDeclName());
8626 PreloadedDeclIDs.clear();
8629 if (!FPPragmaOptions.empty()) {
8630 assert(FPPragmaOptions.size() == 1 &&
"Wrong number of FP_PRAGMA_OPTIONS");
8633 SemaObj->CurFPFeatures =
8638 Decl *
D = GetDecl(ID);
8639 if (
auto *FD = dyn_cast<FunctionDecl>(
D))
8640 SemaObj->addDeclWithEffects(FD, FD->getFunctionEffects());
8641 else if (
auto *BD = dyn_cast<BlockDecl>(
D))
8642 SemaObj->addDeclWithEffects(BD, BD->getFunctionEffects());
8644 llvm_unreachable(
"unexpected Decl type in DeclsWithEffectsToVerify");
8646 DeclsWithEffectsToVerify.clear();
8648 SemaObj->OpenCLFeatures = OpenCLExtensions;
8654 assert(SemaObj &&
"no Sema to update");
8658 if (!SemaDeclRefs.empty()) {
8659 assert(SemaDeclRefs.size() % 3 == 0);
8660 for (
unsigned I = 0; I != SemaDeclRefs.size(); I += 3) {
8661 if (!SemaObj->StdNamespace)
8662 SemaObj->StdNamespace = SemaDeclRefs[I].getRawValue();
8663 if (!SemaObj->StdBadAlloc)
8664 SemaObj->StdBadAlloc = SemaDeclRefs[I + 1].getRawValue();
8665 if (!SemaObj->StdAlignValT)
8666 SemaObj->StdAlignValT = SemaDeclRefs[I + 2].getRawValue();
8668 SemaDeclRefs.clear();
8673 if(OptimizeOffPragmaLocation.isValid())
8674 SemaObj->ActOnPragmaOptimize(
false, OptimizeOffPragmaLocation);
8675 if (PragmaMSStructState != -1)
8677 if (PointersToMembersPragmaLocation.isValid()) {
8678 SemaObj->ActOnPragmaMSPointersToMembers(
8680 PragmaMSPointersToMembersState,
8681 PointersToMembersPragmaLocation);
8683 SemaObj->CUDA().ForceHostDeviceDepth = ForceHostDeviceDepth;
8685 if (PragmaAlignPackCurrentValue) {
8689 bool DropFirst =
false;
8690 if (!PragmaAlignPackStack.empty() &&
8691 PragmaAlignPackStack.front().Location.isInvalid()) {
8692 assert(PragmaAlignPackStack.front().Value ==
8693 SemaObj->AlignPackStack.DefaultValue &&
8694 "Expected a default alignment value");
8695 SemaObj->AlignPackStack.Stack.emplace_back(
8696 PragmaAlignPackStack.front().SlotLabel,
8697 SemaObj->AlignPackStack.CurrentValue,
8698 SemaObj->AlignPackStack.CurrentPragmaLocation,
8699 PragmaAlignPackStack.front().PushLocation);
8702 for (
const auto &Entry :
8703 llvm::ArrayRef(PragmaAlignPackStack).drop_front(DropFirst ? 1 : 0)) {
8704 SemaObj->AlignPackStack.Stack.emplace_back(
8705 Entry.SlotLabel, Entry.Value, Entry.Location, Entry.PushLocation);
8707 if (PragmaAlignPackCurrentLocation.isInvalid()) {
8708 assert(*PragmaAlignPackCurrentValue ==
8709 SemaObj->AlignPackStack.DefaultValue &&
8710 "Expected a default align and pack value");
8713 SemaObj->AlignPackStack.CurrentValue = *PragmaAlignPackCurrentValue;
8714 SemaObj->AlignPackStack.CurrentPragmaLocation =
8715 PragmaAlignPackCurrentLocation;
8718 if (FpPragmaCurrentValue) {
8722 bool DropFirst =
false;
8723 if (!FpPragmaStack.empty() && FpPragmaStack.front().Location.isInvalid()) {
8724 assert(FpPragmaStack.front().Value ==
8725 SemaObj->FpPragmaStack.DefaultValue &&
8726 "Expected a default pragma float_control value");
8727 SemaObj->FpPragmaStack.Stack.emplace_back(
8728 FpPragmaStack.front().SlotLabel, SemaObj->FpPragmaStack.CurrentValue,
8729 SemaObj->FpPragmaStack.CurrentPragmaLocation,
8730 FpPragmaStack.front().PushLocation);
8733 for (
const auto &Entry :
8735 SemaObj->FpPragmaStack.Stack.emplace_back(
8736 Entry.SlotLabel, Entry.Value, Entry.Location, Entry.PushLocation);
8737 if (FpPragmaCurrentLocation.isInvalid()) {
8738 assert(*FpPragmaCurrentValue == SemaObj->FpPragmaStack.DefaultValue &&
8739 "Expected a default pragma float_control value");
8742 SemaObj->FpPragmaStack.CurrentValue = *FpPragmaCurrentValue;
8743 SemaObj->FpPragmaStack.CurrentPragmaLocation = FpPragmaCurrentLocation;
8748 for (
auto &Import : PendingImportedModulesSema) {
8749 if (Import.ImportLoc.isInvalid())
8751 if (
Module *Imported = getSubmodule(Import.ID)) {
8752 SemaObj->makeModuleVisible(Imported, Import.ImportLoc);
8755 PendingImportedModulesSema.clear();
8762 IdentifierLookupVisitor Visitor(Name, 0,
8763 NumIdentifierLookups,
8764 NumIdentifierLookupHits);
8770 if (PP.getLangOpts().CPlusPlus) {
8771 for (
auto *F : ModuleMgr.pch_modules())
8779 if (!loadGlobalIndex()) {
8780 if (GlobalIndex->lookupIdentifier(Name, Hits)) {
8785 ModuleMgr.visit(Visitor, HitsPtr);
8789 markIdentifierUpToDate(II);
8807 ASTIdentifierLookupTable::key_iterator Current;
8811 ASTIdentifierLookupTable::key_iterator End;
8818 bool SkipModules =
false);
8820 StringRef Next()
override;
8827 : Reader(Reader), Index(Reader.ModuleMgr.size()), SkipModules(SkipModules) {
8831 while (Current == End) {
8843 Current = IdTable->key_begin();
8844 End = IdTable->key_end();
8849 StringRef
Result = *Current;
8858 std::unique_ptr<IdentifierIterator> Current;
8859 std::unique_ptr<IdentifierIterator> Queued;
8862 ChainedIdentifierIterator(std::unique_ptr<IdentifierIterator>
First,
8863 std::unique_ptr<IdentifierIterator> Second)
8864 : Current(
std::move(
First)), Queued(
std::move(Second)) {}
8866 StringRef Next()
override {
8870 StringRef result = Current->Next();
8871 if (!result.empty())
8876 std::swap(Current, Queued);
8885 std::unique_ptr<IdentifierIterator> ReaderIter(
8887 std::unique_ptr<IdentifierIterator> ModulesIter(
8888 GlobalIndex->createIdentifierIterator());
8889 return new ChainedIdentifierIterator(std::move(ReaderIter),
8890 std::move(ModulesIter));
8897namespace serialization {
8902 unsigned PriorGeneration;
8903 unsigned InstanceBits = 0;
8904 unsigned FactoryBits = 0;
8905 bool InstanceHasMoreThanOneDecl =
false;
8906 bool FactoryHasMoreThanOneDecl =
false;
8912 unsigned PriorGeneration)
8913 : Reader(Reader), Sel(Sel), PriorGeneration(PriorGeneration) {}
8923 ++Reader.NumMethodPoolTableLookups;
8926 ASTSelectorLookupTable::iterator Pos = PoolTable->find(Sel);
8927 if (Pos == PoolTable->end())
8930 ++Reader.NumMethodPoolTableHits;
8931 ++Reader.NumSelectorsRead;
8935 ++Reader.NumMethodPoolEntriesRead;
8937 if (Reader.DeserializationListener)
8943 InstanceMethods.append(
Data.Instance.rbegin(),
Data.Instance.rend());
8944 FactoryMethods.append(
Data.Factory.rbegin(),
Data.Factory.rend());
8945 InstanceBits =
Data.InstanceBits;
8946 FactoryBits =
Data.FactoryBits;
8947 InstanceHasMoreThanOneDecl =
Data.InstanceHasMoreThanOneDecl;
8948 FactoryHasMoreThanOneDecl =
Data.FactoryHasMoreThanOneDecl;
8954 return InstanceMethods;
8959 return FactoryMethods;
8966 return InstanceHasMoreThanOneDecl;
8984 unsigned &Generation = SelectorGeneration[Sel];
8985 unsigned PriorGeneration = Generation;
8987 SelectorOutOfDate[Sel] =
false;
8990 ++NumMethodPoolLookups;
8992 ModuleMgr.
visit(Visitor);
8998 ++NumMethodPoolHits;
9019 if (SelectorOutOfDate[Sel])
9027 for (
unsigned I = 0, N = KnownNamespaces.size(); I != N; ++I) {
9029 = dyn_cast_or_null<NamespaceDecl>(
GetDecl(KnownNamespaces[I])))
9030 Namespaces.push_back(Namespace);
9035 llvm::MapVector<NamedDecl *, SourceLocation> &Undefined) {
9036 for (
unsigned Idx = 0, N = UndefinedButUsed.size(); Idx != N;) {
9037 UndefinedButUsedDecl &
U = UndefinedButUsed[Idx++];
9040 Undefined.insert(std::make_pair(
D,
Loc));
9042 UndefinedButUsed.clear();
9048 for (
unsigned Idx = 0, N = DelayedDeleteExprs.size(); Idx != N;) {
9051 uint64_t Count = DelayedDeleteExprs[Idx++];
9052 for (uint64_t
C = 0;
C < Count; ++
C) {
9055 const bool IsArrayForm = DelayedDeleteExprs[Idx++];
9056 Exprs[FD].push_back(std::make_pair(DeleteLoc, IsArrayForm));
9063 for (
unsigned I = 0, N = TentativeDefinitions.size(); I != N; ++I) {
9064 VarDecl *Var = dyn_cast_or_null<VarDecl>(
GetDecl(TentativeDefinitions[I]));
9066 TentativeDefs.push_back(Var);
9068 TentativeDefinitions.clear();
9073 for (
unsigned I = 0, N = UnusedFileScopedDecls.size(); I != N; ++I) {
9075 = dyn_cast_or_null<DeclaratorDecl>(
GetDecl(UnusedFileScopedDecls[I]));
9079 UnusedFileScopedDecls.clear();
9084 for (
unsigned I = 0, N = DelegatingCtorDecls.size(); I != N; ++I) {
9086 = dyn_cast_or_null<CXXConstructorDecl>(
GetDecl(DelegatingCtorDecls[I]));
9090 DelegatingCtorDecls.clear();
9094 for (
unsigned I = 0, N = ExtVectorDecls.size(); I != N; ++I) {
9096 = dyn_cast_or_null<TypedefNameDecl>(
GetDecl(ExtVectorDecls[I]));
9100 ExtVectorDecls.clear();
9105 for (
unsigned I = 0, N = UnusedLocalTypedefNameCandidates.size(); I != N;
9108 GetDecl(UnusedLocalTypedefNameCandidates[I]));
9112 UnusedLocalTypedefNameCandidates.clear();
9117 for (
auto I : DeclsToCheckForDeferredDiags) {
9118 auto *
D = dyn_cast_or_null<Decl>(
GetDecl(I));
9122 DeclsToCheckForDeferredDiags.clear();
9127 if (ReferencedSelectorsData.empty())
9132 unsigned int DataSize = ReferencedSelectorsData.size()-1;
9134 while (I < DataSize) {
9138 Sels.push_back(std::make_pair(Sel, SelLoc));
9140 ReferencedSelectorsData.clear();
9145 if (WeakUndeclaredIdentifiers.empty())
9148 for (
unsigned I = 0, N = WeakUndeclaredIdentifiers.size(); I < N; ) {
9156 WeakIDs.push_back(std::make_pair(WeakId, WI));
9158 WeakUndeclaredIdentifiers.clear();
9162 for (
unsigned Idx = 0, N = VTableUses.size(); Idx < N; ) {
9164 VTableUse &TableInfo = VTableUses[Idx++];
9165 VT.
Record = dyn_cast_or_null<CXXRecordDecl>(
GetDecl(TableInfo.ID));
9168 VTables.push_back(VT);
9176 for (
unsigned Idx = 0, N = PendingInstantiations.size(); Idx < N;) {
9177 PendingInstantiation &Inst = PendingInstantiations[Idx++];
9181 Pending.push_back(std::make_pair(
D,
Loc));
9183 PendingInstantiations.clear();
9187 llvm::MapVector<
const FunctionDecl *, std::unique_ptr<LateParsedTemplate>>
9189 for (
auto &LPT : LateParsedTemplates) {
9192 for (
unsigned Idx = 0, N = LateParsed.size(); Idx < N;
9194 FunctionDecl *FD = ReadDeclAs<FunctionDecl>(*FMod, LateParsed, Idx);
9196 auto LT = std::make_unique<LateParsedTemplate>();
9201 assert(F &&
"No module");
9203 unsigned TokN = LateParsed[Idx++];
9204 LT->Toks.reserve(TokN);
9205 for (
unsigned T = 0;
T < TokN; ++
T)
9206 LT->Toks.push_back(
ReadToken(*F, LateParsed, Idx));
9208 LPTMap.insert(std::make_pair(FD, std::move(
LT)));
9212 LateParsedTemplates.clear();
9224 if (
auto Iter = LambdaDeclarationsForMerging.find(LambdaInfo);
9225 Iter != LambdaDeclarationsForMerging.end() &&
9228 cast<CXXRecordDecl>(
Iter->second)->getMostRecentDecl();
9234 const_cast<QualType &
>(Lambda->TypeForDecl->CanonicalType) =
9235 Previous->TypeForDecl->CanonicalType;
9241 LambdaDeclarationsForMerging.insert(
9251 assert(ID &&
"Non-zero identifier ID required");
9252 unsigned Index = translateIdentifierIDToIndex(ID).second;
9253 assert(Index < IdentifiersLoaded.size() &&
"identifier ID out of range");
9254 IdentifiersLoaded[Index] = II;
9255 if (DeserializationListener)
9278 if (NumCurrentElementsDeserializing && !Decls) {
9279 PendingIdentifierInfos[II].append(DeclIDs.begin(), DeclIDs.end());
9283 for (
unsigned I = 0, N = DeclIDs.size(); I != N; ++I) {
9296 Decls->push_back(
D);
9303 pushExternalDeclIntoScope(
D, II);
9307std::pair<ModuleFile *, unsigned>
9308ASTReader::translateIdentifierIDToIndex(
IdentifierID ID)
const {
9310 return {
nullptr, 0};
9312 unsigned ModuleFileIndex = ID >> 32;
9313 unsigned LocalID = ID & llvm::maskTrailingOnes<IdentifierID>(32);
9315 assert(ModuleFileIndex &&
"not translating loaded IdentifierID?");
9327 if (IdentifiersLoaded.empty()) {
9328 Error(
"no identifier table in AST file");
9332 auto [M, Index] = translateIdentifierIDToIndex(ID);
9333 if (!IdentifiersLoaded[Index]) {
9334 assert(M !=
nullptr &&
"Untranslated Identifier ID?");
9337 const unsigned char *
Data =
9344 IdentifiersLoaded[Index] = &II;
9347 if (DeserializationListener)
9351 return IdentifiersLoaded[Index];
9363 ReadModuleOffsetMap(M);
9365 unsigned ModuleFileIndex = LocalID >> 32;
9366 LocalID &= llvm::maskTrailingOnes<IdentifierID>(32);
9369 assert(MF &&
"malformed identifier ID encoding?");
9371 if (!ModuleFileIndex)
9381 if (MacrosLoaded.empty()) {
9382 Error(
"no macro table in AST file");
9387 if (!MacrosLoaded[ID]) {
9390 assert(I != GlobalMacroMap.
end() &&
"Corrupted global macro map");
9396 if (DeserializationListener)
9401 return MacrosLoaded[ID];
9409 ReadModuleOffsetMap(M);
9413 assert(I != M.
MacroRemap.
end() &&
"Invalid index into macro index remap");
9415 return LocalID + I->second;
9424 ReadModuleOffsetMap(M);
9429 &&
"Invalid index into submodule index remap");
9431 return LocalID + I->second;
9436 assert(GlobalID == 0 &&
"Unhandled global submodule ID");
9440 if (GlobalID > SubmodulesLoaded.size()) {
9441 Error(
"submodule ID out of range in AST file");
9456 return I == GlobalSubmoduleMap.
end() ? nullptr : I->second;
9459 unsigned IndexFromEnd = ID >> 1;
9460 assert(IndexFromEnd &&
"got reference to unknown module file");
9477 auto I = llvm::find(PCHModules, M);
9478 assert(I != PCHModules.end() &&
"emitting reference to unknown file");
9479 return (I - PCHModules.end()) << 1;
9489 if (std::distance(std::begin(PCHChain), std::end(PCHChain))) {
9494 llvm::sys::path::parent_path(MF.
FileName),
9497 return std::nullopt;
9501 auto I = DefinitionSource.find(FD);
9502 if (I == DefinitionSource.end())
9515 if (ID > SelectorsLoaded.size()) {
9516 Error(
"selector ID out of range in AST file");
9520 if (SelectorsLoaded[ID - 1].getAsOpaquePtr() ==
nullptr) {
9523 assert(I != GlobalSelectorMap.
end() &&
"Corrupted global selector map");
9527 SelectorsLoaded[ID - 1] =
9529 if (DeserializationListener)
9530 DeserializationListener->
SelectorRead(ID, SelectorsLoaded[ID - 1]);
9533 return SelectorsLoaded[ID - 1];
9551 ReadModuleOffsetMap(M);
9556 &&
"Invalid index into selector index remap");
9558 return LocalID + I->second;
9563 switch (Name.getNameKind()) {
9589 NameInfo.
setName(readDeclarationName());
9601 unsigned NumTPLists =
readInt();
9606 for (
unsigned i = 0; i != NumTPLists; ++i)
9617 unsigned NumParams =
readInt();
9619 Params.reserve(NumParams);
9621 Params.push_back(readDeclAs<NamedDecl>());
9623 bool HasRequiresClause =
readBool();
9624 Expr *RequiresClause = HasRequiresClause ?
readExpr() :
nullptr;
9627 getContext(), TemplateLoc, LAngleLoc, Params, RAngleLoc, RequiresClause);
9628 return TemplateParams;
9633 bool Canonicalize) {
9634 unsigned NumTemplateArgs =
readInt();
9635 TemplArgs.reserve(NumTemplateArgs);
9636 while (NumTemplateArgs--)
9642 unsigned NumDecls =
readInt();
9644 while (NumDecls--) {
9656 bool inheritConstructors =
readBool();
9662 Result.setInheritConstructors(inheritConstructors);
9669 unsigned NumInitializers =
readInt();
9670 assert(NumInitializers &&
"wrote ctor initializers but have no inits");
9672 for (
unsigned i = 0; i != NumInitializers; ++i) {
9674 bool IsBaseVirtual =
false;
9690 Member = readDeclAs<FieldDecl>();
9694 IndirectMember = readDeclAs<IndirectFieldDecl>();
9705 BOMInit =
new (Context)
9707 RParenLoc, MemberOrEllipsisLoc);
9709 BOMInit =
new (Context)
9712 BOMInit =
new (Context)
9716 BOMInit =
new (Context)
9718 LParenLoc,
Init, RParenLoc);
9721 unsigned SourceOrder =
readInt();
9725 CtorInitializers[i] = BOMInit;
9728 return CtorInitializers;
9736 for (
unsigned I = 0; I != N; ++I) {
9737 auto Kind = readNestedNameSpecifierKind();
9769 Builder.Extend(Context,
9771 T->getTypeLoc(), ColonColonLoc);
9777 Builder.MakeGlobal(Context, ColonColonLoc);
9790 return Builder.getWithLocInContext(Context);
9801 const StringRef Blob) {
9802 unsigned Count =
Record[0];
9803 const char *Byte = Blob.data();
9804 llvm::BitVector Ret = llvm::BitVector(Count,
false);
9805 for (
unsigned I = 0; I < Count; ++Byte)
9806 for (
unsigned Bit = 0; Bit < 8 && I < Count; ++Bit, ++I)
9807 if (*Byte & (1 << Bit))
9819 unsigned Len =
Record[Idx++];
9827 unsigned Len =
Record[Idx++];
9828 StringRef
Result = Blob.substr(0, Len);
9829 Blob = Blob.substr(Len);
9853 unsigned Major =
Record[Idx++];
9854 unsigned Minor =
Record[Idx++];
9855 unsigned Subminor =
Record[Idx++];
9857 return VersionTuple(Major);
9859 return VersionTuple(Major, Minor - 1);
9860 return VersionTuple(Major, Minor - 1, Subminor - 1);
9871 return Diag(CurrentImportLoc, DiagID);
9879 llvm::function_ref<
void()> Fn) {
9898 assert((*CurrSwitchCaseStmts)[ID] ==
nullptr &&
9899 "Already have a SwitchCase with this ID");
9900 (*CurrSwitchCaseStmts)[ID] = SC;
9905 assert((*CurrSwitchCaseStmts)[ID] !=
nullptr &&
"No SwitchCase with this ID");
9906 return (*CurrSwitchCaseStmts)[ID];
9910 CurrSwitchCaseStmts->clear();
9915 std::vector<RawComment *> Comments;
9922 BitstreamCursor &Cursor = I->first;
9929 Cursor.advanceSkippingSubblocks(
9930 BitstreamCursor::AF_DontPopBlockAtEnd);
9932 Error(MaybeEntry.takeError());
9935 llvm::BitstreamEntry Entry = MaybeEntry.get();
9937 switch (Entry.Kind) {
9938 case llvm::BitstreamEntry::SubBlock:
9939 case llvm::BitstreamEntry::Error:
9940 Error(
"malformed block record in AST file");
9942 case llvm::BitstreamEntry::EndBlock:
9944 case llvm::BitstreamEntry::Record:
9952 if (!MaybeComment) {
9953 Error(MaybeComment.takeError());
9962 bool IsTrailingComment =
Record[Idx++];
9963 bool IsAlmostTrailingComment =
Record[Idx++];
9965 SR, Kind, IsTrailingComment, IsAlmostTrailingComment));
9971 llvm::DenseMap<FileID, std::map<unsigned, RawComment *>>
9972 FileToOffsetToComment;
9976 std::pair<FileID, unsigned>
Loc =
9992 assert(NumUserInputs <= NumInputs);
9993 unsigned N = IncludeSystem ? NumInputs : NumUserInputs;
9994 for (
unsigned I = 0; I < N; ++I) {
9995 bool IsSystem = I >= NumUserInputs;
9997 Visitor(IFI, IsSystem);
10002 bool IncludeSystem,
bool Complain,
10004 bool isSystem)> Visitor) {
10007 assert(NumUserInputs <= NumInputs);
10008 unsigned N = IncludeSystem ? NumInputs : NumUserInputs;
10009 for (
unsigned I = 0; I < N; ++I) {
10010 bool IsSystem = I >= NumUserInputs;
10011 InputFile IF = getInputFile(MF, I+1, Complain);
10012 Visitor(IF, IsSystem);
10020 for (
unsigned I = 0; I < NumInputs; ++I) {
10023 if (
auto FE = getInputFile(MF, I + 1).getFile())
10028void ASTReader::finishPendingActions() {
10030 !PendingIdentifierInfos.empty() || !PendingDeducedFunctionTypes.empty() ||
10031 !PendingDeducedVarTypes.empty() || !PendingIncompleteDeclChains.empty() ||
10032 !PendingDeclChains.empty() || !PendingMacroIDs.empty() ||
10033 !PendingDeclContextInfos.empty() || !PendingUpdateRecords.empty() ||
10034 !PendingObjCExtensionIvarRedeclarations.empty()) {
10037 using TopLevelDeclsMap =
10038 llvm::DenseMap<IdentifierInfo *, SmallVector<Decl *, 2>>;
10039 TopLevelDeclsMap TopLevelDecls;
10041 while (!PendingIdentifierInfos.empty()) {
10044 std::move(PendingIdentifierInfos.back().second);
10045 PendingIdentifierInfos.pop_back();
10052 for (
unsigned I = 0; I != PendingDeducedFunctionTypes.size(); ++I) {
10053 auto *FD = PendingDeducedFunctionTypes[I].first;
10054 FD->setType(
GetType(PendingDeducedFunctionTypes[I].second));
10056 if (
auto *DT = FD->getReturnType()->getContainedDeducedType()) {
10059 if (DT->isDeduced()) {
10060 PendingDeducedTypeUpdates.insert(
10061 {FD->getCanonicalDecl(), FD->getReturnType()});
10068 PendingUndeducedFunctionDecls.push_back(FD);
10072 PendingDeducedFunctionTypes.clear();
10076 for (
unsigned I = 0; I != PendingDeducedVarTypes.size(); ++I) {
10077 auto *VD = PendingDeducedVarTypes[I].first;
10078 VD->setType(
GetType(PendingDeducedVarTypes[I].second));
10080 PendingDeducedVarTypes.clear();
10084 for (
unsigned I = 0; I != PendingIncompleteDeclChains.size(); ++I) {
10085 markIncompleteDeclChain(PendingIncompleteDeclChains[I]);
10087 PendingIncompleteDeclChains.clear();
10090 for (
unsigned I = 0; I != PendingDeclChains.size(); ++I)
10091 loadPendingDeclChain(PendingDeclChains[I].first,
10092 PendingDeclChains[I].second);
10093 PendingDeclChains.clear();
10096 for (TopLevelDeclsMap::iterator TLD = TopLevelDecls.begin(),
10097 TLDEnd = TopLevelDecls.end(); TLD != TLDEnd; ++TLD) {
10099 for (
unsigned I = 0, N = TLD->second.size(); I != N; ++I) {
10100 pushExternalDeclIntoScope(cast<NamedDecl>(TLD->second[I]), II);
10105 for (
unsigned I = 0; I != PendingMacroIDs.size(); ++I) {
10108 GlobalIDs.swap(PendingMacroIDs.begin()[I].second);
10110 for (
unsigned IDIdx = 0, NumIDs = GlobalIDs.size(); IDIdx != NumIDs;
10112 const PendingMacroInfo &Info = GlobalIDs[IDIdx];
10113 if (!Info.M->isModule())
10117 for (
unsigned IDIdx = 0, NumIDs = GlobalIDs.size(); IDIdx != NumIDs;
10119 const PendingMacroInfo &Info = GlobalIDs[IDIdx];
10120 if (Info.M->isModule())
10124 PendingMacroIDs.clear();
10128 while (!PendingDeclContextInfos.empty()) {
10129 PendingDeclContextInfo Info = PendingDeclContextInfos.front();
10130 PendingDeclContextInfos.pop_front();
10133 Info.D->setDeclContextsImpl(SemaDC, LexicalDC,
getContext());
10137 while (!PendingUpdateRecords.empty()) {
10138 auto Update = PendingUpdateRecords.pop_back_val();
10139 ReadingKindTracker ReadingKind(Read_Decl, *
this);
10140 loadDeclUpdateRecords(
Update);
10143 while (!PendingObjCExtensionIvarRedeclarations.empty()) {
10144 auto ExtensionsPair = PendingObjCExtensionIvarRedeclarations.back().first;
10145 auto DuplicateIvars =
10146 PendingObjCExtensionIvarRedeclarations.back().second;
10149 ExtensionsPair.first->getASTContext(),
10150 ExtensionsPair.second->getASTContext(), NonEquivalentDecls,
10154 if (Ctx.IsEquivalent(ExtensionsPair.first, ExtensionsPair.second)) {
10156 for (
auto IvarPair : DuplicateIvars) {
10157 ObjCIvarDecl *Ivar = IvarPair.first, *PrevIvar = IvarPair.second;
10159 Ivar->setDeclContextsImpl(PrevIvar->getDeclContext(),
10165 ExtensionsPair.first->setInvalidDecl();
10166 ExtensionsPair.second->getClassInterface()
10168 ->setIvarList(
nullptr);
10170 for (
auto IvarPair : DuplicateIvars) {
10171 Diag(IvarPair.first->getLocation(),
10172 diag::err_duplicate_ivar_declaration)
10173 << IvarPair.first->getIdentifier();
10174 Diag(IvarPair.second->getLocation(), diag::note_previous_definition);
10177 PendingObjCExtensionIvarRedeclarations.pop_back();
10183 assert(PendingFakeDefinitionData.empty() &&
10184 "faked up a class definition but never saw the real one");
10190 for (
Decl *
D : PendingDefinitions) {
10191 if (
TagDecl *TD = dyn_cast<TagDecl>(
D)) {
10192 if (
const TagType *TagT = dyn_cast<TagType>(TD->getTypeForDecl())) {
10197 if (
auto RD = dyn_cast<CXXRecordDecl>(
D)) {
10198 for (
auto *R = getMostRecentExistingDecl(RD); R;
10201 cast<CXXRecordDecl>(R)->isThisDeclarationADefinition() &&
10202 "declaration thinks it's the definition but it isn't");
10203 cast<CXXRecordDecl>(R)->DefinitionData = RD->DefinitionData;
10210 if (
auto ID = dyn_cast<ObjCInterfaceDecl>(
D)) {
10215 for (
auto *R = getMostRecentExistingDecl(ID); R; R = R->
getPreviousDecl())
10216 cast<ObjCInterfaceDecl>(R)->Data =
ID->Data;
10221 if (
auto PD = dyn_cast<ObjCProtocolDecl>(
D)) {
10222 for (
auto *R = getMostRecentExistingDecl(PD); R; R = R->
getPreviousDecl())
10223 cast<ObjCProtocolDecl>(R)->Data = PD->Data;
10228 auto RTD = cast<RedeclarableTemplateDecl>(
D)->getCanonicalDecl();
10229 for (
auto *R = getMostRecentExistingDecl(RTD); R; R = R->
getPreviousDecl())
10230 cast<RedeclarableTemplateDecl>(R)->Common = RTD->Common;
10232 PendingDefinitions.clear();
10234 for (
auto [
D,
Previous] : PendingWarningForDuplicatedDefsInModuleUnits) {
10235 auto hasDefinitionImpl = [
this](
Decl *
D,
auto hasDefinitionImpl) {
10236 if (
auto *VD = dyn_cast<VarDecl>(
D))
10237 return VD->isThisDeclarationADefinition() ||
10238 VD->isThisDeclarationADemotedDefinition();
10240 if (
auto *TD = dyn_cast<TagDecl>(
D))
10241 return TD->isThisDeclarationADefinition() ||
10242 TD->isThisDeclarationADemotedDefinition();
10244 if (
auto *FD = dyn_cast<FunctionDecl>(
D))
10245 return FD->isThisDeclarationADefinition() || PendingBodies.count(FD);
10247 if (
auto *RTD = dyn_cast<RedeclarableTemplateDecl>(
D))
10248 return hasDefinitionImpl(RTD->getTemplatedDecl(), hasDefinitionImpl);
10255 return hasDefinitionImpl(
D, hasDefinitionImpl);
10271 PendingWarningForDuplicatedDefsInModuleUnits.clear();
10277 for (PendingBodiesMap::iterator PB = PendingBodies.begin(),
10278 PBEnd = PendingBodies.end();
10279 PB != PBEnd; ++PB) {
10280 if (
FunctionDecl *FD = dyn_cast<FunctionDecl>(PB->first)) {
10283 if (!
getContext().getLangOpts().Modules || !FD->hasBody(Defn)) {
10289 if (!FD->isLateTemplateParsed() &&
10290 !NonConstDefn->isLateTemplateParsed() &&
10295 FD->getODRHash() != NonConstDefn->getODRHash()) {
10296 if (!isa<CXXMethodDecl>(FD)) {
10297 PendingFunctionOdrMergeFailures[FD].push_back(NonConstDefn);
10298 }
else if (FD->getLexicalParent()->isFileContext() &&
10299 NonConstDefn->getLexicalParent()->isFileContext()) {
10303 PendingFunctionOdrMergeFailures[FD].push_back(NonConstDefn);
10314 PendingBodies.clear();
10317 for (
auto [RD, MD] : PendingAddedClassMembers) {
10318 RD->addedMember(MD);
10320 PendingAddedClassMembers.clear();
10323 for (
auto *ND : PendingMergedDefinitionsToDeduplicate)
10325 PendingMergedDefinitionsToDeduplicate.clear();
10328void ASTReader::diagnoseOdrViolations() {
10329 if (PendingOdrMergeFailures.empty() && PendingOdrMergeChecks.empty() &&
10330 PendingRecordOdrMergeFailures.empty() &&
10331 PendingFunctionOdrMergeFailures.empty() &&
10332 PendingEnumOdrMergeFailures.empty() &&
10333 PendingObjCInterfaceOdrMergeFailures.empty() &&
10334 PendingObjCProtocolOdrMergeFailures.empty())
10341 auto OdrMergeFailures = std::move(PendingOdrMergeFailures);
10342 PendingOdrMergeFailures.clear();
10343 for (
auto &Merge : OdrMergeFailures) {
10344 Merge.first->buildLookup();
10345 Merge.first->decls_begin();
10346 Merge.first->bases_begin();
10347 Merge.first->vbases_begin();
10348 for (
auto &RecordPair : Merge.second) {
10349 auto *RD = RecordPair.first;
10357 auto RecordOdrMergeFailures = std::move(PendingRecordOdrMergeFailures);
10358 PendingRecordOdrMergeFailures.clear();
10359 for (
auto &Merge : RecordOdrMergeFailures) {
10360 Merge.first->decls_begin();
10361 for (
auto &
D : Merge.second)
10366 auto ObjCInterfaceOdrMergeFailures =
10367 std::move(PendingObjCInterfaceOdrMergeFailures);
10368 PendingObjCInterfaceOdrMergeFailures.clear();
10369 for (
auto &Merge : ObjCInterfaceOdrMergeFailures) {
10370 Merge.first->decls_begin();
10371 for (
auto &InterfacePair : Merge.second)
10372 InterfacePair.first->decls_begin();
10376 auto FunctionOdrMergeFailures = std::move(PendingFunctionOdrMergeFailures);
10377 PendingFunctionOdrMergeFailures.clear();
10378 for (
auto &Merge : FunctionOdrMergeFailures) {
10379 Merge.first->buildLookup();
10380 Merge.first->decls_begin();
10381 Merge.first->getBody();
10382 for (
auto &FD : Merge.second) {
10390 auto EnumOdrMergeFailures = std::move(PendingEnumOdrMergeFailures);
10391 PendingEnumOdrMergeFailures.clear();
10392 for (
auto &Merge : EnumOdrMergeFailures) {
10393 Merge.first->decls_begin();
10394 for (
auto &
Enum : Merge.second) {
10395 Enum->decls_begin();
10400 auto ObjCProtocolOdrMergeFailures =
10401 std::move(PendingObjCProtocolOdrMergeFailures);
10402 PendingObjCProtocolOdrMergeFailures.clear();
10403 for (
auto &Merge : ObjCProtocolOdrMergeFailures) {
10404 Merge.first->decls_begin();
10405 for (
auto &ProtocolPair : Merge.second)
10406 ProtocolPair.first->decls_begin();
10415 while (!PendingOdrMergeChecks.empty()) {
10416 NamedDecl *
D = PendingOdrMergeChecks.pop_back_val();
10427 bool Found =
false;
10431 if (RI->getLexicalDeclContext() == CanonDef) {
10446 for (
auto *CanonMember : CanonDef->
decls()) {
10447 if (CanonMember->getCanonicalDecl() == DCanon) {
10456 if (
auto *ND = dyn_cast<NamedDecl>(CanonMember))
10457 if (ND->getDeclName() ==
D->getDeclName())
10458 Candidates.push_back(ND);
10464 if (!isa<TagDecl>(
D))
10469 Deserializing RecursionGuard(
this);
10471 std::string CanonDefModule =
10473 cast<Decl>(CanonDef));
10476 << CanonDef << CanonDefModule.empty() << CanonDefModule;
10478 if (Candidates.empty())
10479 Diag(cast<Decl>(CanonDef)->getLocation(),
10480 diag::note_module_odr_violation_no_possible_decls) <<
D;
10482 for (
unsigned I = 0, N = Candidates.size(); I != N; ++I)
10483 Diag(Candidates[I]->getLocation(),
10484 diag::note_module_odr_violation_possible_decl)
10488 DiagnosedOdrMergeFailures.insert(CanonDef);
10492 if (OdrMergeFailures.empty() && RecordOdrMergeFailures.empty() &&
10493 FunctionOdrMergeFailures.empty() && EnumOdrMergeFailures.empty() &&
10494 ObjCInterfaceOdrMergeFailures.empty() &&
10495 ObjCProtocolOdrMergeFailures.empty())
10502 for (
auto &Merge : OdrMergeFailures) {
10505 if (!DiagnosedOdrMergeFailures.insert(Merge.first).second)
10508 bool Diagnosed =
false;
10510 for (
auto &RecordPair : Merge.second) {
10511 if (DiagsEmitter.diagnoseMismatch(FirstRecord, RecordPair.first,
10512 RecordPair.second)) {
10525 Diag(Merge.first->getLocation(),
10526 diag::err_module_odr_violation_different_instantiations)
10533 for (
auto &Merge : RecordOdrMergeFailures) {
10536 if (!DiagnosedOdrMergeFailures.insert(Merge.first).second)
10540 bool Diagnosed =
false;
10541 for (
auto *SecondRecord : Merge.second) {
10542 if (DiagsEmitter.diagnoseMismatch(FirstRecord, SecondRecord)) {
10548 assert(Diagnosed &&
"Unable to emit ODR diagnostic.");
10552 for (
auto &Merge : FunctionOdrMergeFailures) {
10554 bool Diagnosed =
false;
10555 for (
auto &SecondFunction : Merge.second) {
10556 if (DiagsEmitter.diagnoseMismatch(FirstFunction, SecondFunction)) {
10562 assert(Diagnosed &&
"Unable to emit ODR diagnostic.");
10566 for (
auto &Merge : EnumOdrMergeFailures) {
10569 if (!DiagnosedOdrMergeFailures.insert(Merge.first).second)
10572 EnumDecl *FirstEnum = Merge.first;
10573 bool Diagnosed =
false;
10574 for (
auto &SecondEnum : Merge.second) {
10575 if (DiagsEmitter.diagnoseMismatch(FirstEnum, SecondEnum)) {
10581 assert(Diagnosed &&
"Unable to emit ODR diagnostic.");
10584 for (
auto &Merge : ObjCInterfaceOdrMergeFailures) {
10587 if (!DiagnosedOdrMergeFailures.insert(Merge.first).second)
10590 bool Diagnosed =
false;
10592 for (
auto &InterfacePair : Merge.second) {
10593 if (DiagsEmitter.diagnoseMismatch(FirstID, InterfacePair.first,
10594 InterfacePair.second)) {
10600 assert(Diagnosed &&
"Unable to emit ODR diagnostic.");
10603 for (
auto &Merge : ObjCProtocolOdrMergeFailures) {
10606 if (!DiagnosedOdrMergeFailures.insert(Merge.first).second)
10610 bool Diagnosed =
false;
10611 for (
auto &ProtocolPair : Merge.second) {
10612 if (DiagsEmitter.diagnoseMismatch(FirstProtocol, ProtocolPair.first,
10613 ProtocolPair.second)) {
10619 assert(Diagnosed &&
"Unable to emit ODR diagnostic.");
10624 if (++NumCurrentElementsDeserializing == 1 && ReadTimer.get())
10625 ReadTimer->startTimer();
10629 assert(NumCurrentElementsDeserializing &&
10630 "FinishedDeserializing not paired with StartedDeserializing");
10631 if (NumCurrentElementsDeserializing == 1) {
10634 finishPendingActions();
10636 --NumCurrentElementsDeserializing;
10638 if (NumCurrentElementsDeserializing == 0) {
10644 while (!PendingExceptionSpecUpdates.empty() ||
10645 !PendingDeducedTypeUpdates.empty() ||
10646 !PendingUndeducedFunctionDecls.empty()) {
10647 auto ESUpdates = std::move(PendingExceptionSpecUpdates);
10648 PendingExceptionSpecUpdates.clear();
10649 for (
auto Update : ESUpdates) {
10650 ProcessingUpdatesRAIIObj ProcessingUpdates(*
this);
10654 Listener->ResolvedExceptionSpec(cast<FunctionDecl>(
Update.second));
10655 for (
auto *Redecl :
Update.second->redecls())
10659 auto DTUpdates = std::move(PendingDeducedTypeUpdates);
10660 PendingDeducedTypeUpdates.clear();
10661 for (
auto Update : DTUpdates) {
10662 ProcessingUpdatesRAIIObj ProcessingUpdates(*
this);
10668 auto UDTUpdates = std::move(PendingUndeducedFunctionDecls);
10669 PendingUndeducedFunctionDecls.clear();
10673 (void)UndeducedFD->getMostRecentDecl();
10677 ReadTimer->stopTimer();
10679 diagnoseOdrViolations();
10684 PassInterestingDeclsToConsumer();
10691 auto It = PendingFakeLookupResults.find(II);
10692 if (It != PendingFakeLookupResults.end()) {
10693 for (
auto *ND : It->second)
10698 It->second.clear();
10704 }
else if (SemaObj->
TUScope) {
10716 ArrayRef<std::shared_ptr<ModuleFileExtension>> Extensions,
10717 StringRef isysroot,
10719 bool AllowASTWithCompilerErrors,
10720 bool AllowConfigurationMismatch,
bool ValidateSystemInputs,
10721 bool ValidateASTInputFilesContent,
bool UseGlobalIndex,
10722 std::unique_ptr<llvm::Timer> ReadTimer)
10726 SourceMgr(PP.getSourceManager()), FileMgr(PP.getFileManager()),
10727 PCHContainerRdr(PCHContainerRdr), Diags(PP.getDiagnostics()),
10728 StackHandler(Diags), PP(PP), ContextObj(Context),
10729 ModuleMgr(PP.getFileManager(), ModuleCache, PCHContainerRdr,
10730 PP.getHeaderSearchInfo()),
10731 DummyIdResolver(PP), ReadTimer(
std::move(ReadTimer)), isysroot(isysroot),
10732 DisableValidationKind(DisableValidationKind),
10733 AllowASTWithCompilerErrors(AllowASTWithCompilerErrors),
10734 AllowConfigurationMismatch(AllowConfigurationMismatch),
10735 ValidateSystemInputs(ValidateSystemInputs),
10736 ValidateASTInputFilesContent(ValidateASTInputFilesContent),
10737 UseGlobalIndex(UseGlobalIndex), CurrSwitchCaseStmts(&SwitchCaseStmts) {
10740 PathBuf.reserve(256);
10742 for (
const auto &Ext : Extensions) {
10743 auto BlockName = Ext->getExtensionMetadata().BlockName;
10744 auto Known = ModuleFileExtensions.find(BlockName);
10745 if (Known != ModuleFileExtensions.end()) {
10746 Diags.
Report(diag::warn_duplicate_module_file_extension)
10751 ModuleFileExtensions.insert({BlockName, Ext});
10756 if (OwnsDeserializationListener)
10757 delete DeserializationListener;
10761 return SemaObj ? SemaObj->
IdResolver : DummyIdResolver;
10765 unsigned AbbrevID) {
10768 return Cursor.readRecord(AbbrevID,
Record);
10785#define GEN_CLANG_CLAUSE_CLASS
10786#define CLAUSE_CLASS(Enum, Str, Class) void Visit##Class(Class *C);
10787#include "llvm/Frontend/OpenMP/OMP.inc"
10801 switch (llvm::omp::Clause(
Record.readInt())) {
10802 case llvm::omp::OMPC_if:
10805 case llvm::omp::OMPC_final:
10808 case llvm::omp::OMPC_num_threads:
10811 case llvm::omp::OMPC_safelen:
10814 case llvm::omp::OMPC_simdlen:
10817 case llvm::omp::OMPC_sizes: {
10818 unsigned NumSizes =
Record.readInt();
10822 case llvm::omp::OMPC_permutation: {
10823 unsigned NumLoops =
Record.readInt();
10827 case llvm::omp::OMPC_full:
10830 case llvm::omp::OMPC_partial:
10833 case llvm::omp::OMPC_allocator:
10836 case llvm::omp::OMPC_collapse:
10839 case llvm::omp::OMPC_default:
10842 case llvm::omp::OMPC_proc_bind:
10845 case llvm::omp::OMPC_schedule:
10848 case llvm::omp::OMPC_ordered:
10851 case llvm::omp::OMPC_nowait:
10854 case llvm::omp::OMPC_untied:
10857 case llvm::omp::OMPC_mergeable:
10860 case llvm::omp::OMPC_read:
10863 case llvm::omp::OMPC_write:
10866 case llvm::omp::OMPC_update:
10869 case llvm::omp::OMPC_capture:
10872 case llvm::omp::OMPC_compare:
10875 case llvm::omp::OMPC_fail:
10878 case llvm::omp::OMPC_seq_cst:
10881 case llvm::omp::OMPC_acq_rel:
10884 case llvm::omp::OMPC_absent: {
10885 unsigned NumKinds =
Record.readInt();
10889 case llvm::omp::OMPC_holds:
10892 case llvm::omp::OMPC_contains: {
10893 unsigned NumKinds =
Record.readInt();
10897 case llvm::omp::OMPC_no_openmp:
10900 case llvm::omp::OMPC_no_openmp_routines:
10903 case llvm::omp::OMPC_no_parallelism:
10906 case llvm::omp::OMPC_acquire:
10909 case llvm::omp::OMPC_release:
10912 case llvm::omp::OMPC_relaxed:
10915 case llvm::omp::OMPC_weak:
10918 case llvm::omp::OMPC_threads:
10921 case llvm::omp::OMPC_simd:
10924 case llvm::omp::OMPC_nogroup:
10927 case llvm::omp::OMPC_unified_address:
10930 case llvm::omp::OMPC_unified_shared_memory:
10933 case llvm::omp::OMPC_reverse_offload:
10936 case llvm::omp::OMPC_dynamic_allocators:
10939 case llvm::omp::OMPC_atomic_default_mem_order:
10942 case llvm::omp::OMPC_at:
10945 case llvm::omp::OMPC_severity:
10948 case llvm::omp::OMPC_message:
10951 case llvm::omp::OMPC_private:
10954 case llvm::omp::OMPC_firstprivate:
10957 case llvm::omp::OMPC_lastprivate:
10960 case llvm::omp::OMPC_shared:
10963 case llvm::omp::OMPC_reduction: {
10964 unsigned N =
Record.readInt();
10969 case llvm::omp::OMPC_task_reduction:
10972 case llvm::omp::OMPC_in_reduction:
10975 case llvm::omp::OMPC_linear:
10978 case llvm::omp::OMPC_aligned:
10981 case llvm::omp::OMPC_copyin:
10984 case llvm::omp::OMPC_copyprivate:
10987 case llvm::omp::OMPC_flush:
10990 case llvm::omp::OMPC_depobj:
10993 case llvm::omp::OMPC_depend: {
10994 unsigned NumVars =
Record.readInt();
10995 unsigned NumLoops =
Record.readInt();
10999 case llvm::omp::OMPC_device:
11002 case llvm::omp::OMPC_map: {
11011 case llvm::omp::OMPC_num_teams:
11014 case llvm::omp::OMPC_thread_limit:
11017 case llvm::omp::OMPC_priority:
11020 case llvm::omp::OMPC_grainsize:
11023 case llvm::omp::OMPC_num_tasks:
11026 case llvm::omp::OMPC_hint:
11029 case llvm::omp::OMPC_dist_schedule:
11032 case llvm::omp::OMPC_defaultmap:
11035 case llvm::omp::OMPC_to: {
11044 case llvm::omp::OMPC_from: {
11053 case llvm::omp::OMPC_use_device_ptr: {
11062 case llvm::omp::OMPC_use_device_addr: {
11071 case llvm::omp::OMPC_is_device_ptr: {
11080 case llvm::omp::OMPC_has_device_addr: {
11089 case llvm::omp::OMPC_allocate:
11092 case llvm::omp::OMPC_nontemporal:
11095 case llvm::omp::OMPC_inclusive:
11098 case llvm::omp::OMPC_exclusive:
11101 case llvm::omp::OMPC_order:
11104 case llvm::omp::OMPC_init:
11107 case llvm::omp::OMPC_use:
11110 case llvm::omp::OMPC_destroy:
11113 case llvm::omp::OMPC_novariants:
11116 case llvm::omp::OMPC_nocontext:
11119 case llvm::omp::OMPC_detach:
11122 case llvm::omp::OMPC_uses_allocators:
11125 case llvm::omp::OMPC_affinity:
11128 case llvm::omp::OMPC_filter:
11131 case llvm::omp::OMPC_bind:
11134 case llvm::omp::OMPC_align:
11137 case llvm::omp::OMPC_ompx_dyn_cgroup_mem:
11140 case llvm::omp::OMPC_doacross: {
11141 unsigned NumVars =
Record.readInt();
11142 unsigned NumLoops =
Record.readInt();
11146 case llvm::omp::OMPC_ompx_attribute:
11149 case llvm::omp::OMPC_ompx_bare:
11152#define OMP_CLAUSE_NO_CLASS(Enum, Str) \
11153 case llvm::omp::Enum: \
11155#include "llvm/Frontend/OpenMP/OMPKinds.def"
11159 assert(
C &&
"Unknown OMPClause type");
11162 C->setLocStart(
Record.readSourceLocation());
11163 C->setLocEnd(
Record.readSourceLocation());
11169 C->setPreInitStmt(
Record.readSubStmt(),
11175 C->setPostUpdateExpr(
Record.readSubExpr());
11178void OMPClauseReader::VisitOMPIfClause(
OMPIfClause *
C) {
11181 C->setNameModifierLoc(
Record.readSourceLocation());
11182 C->setColonLoc(
Record.readSourceLocation());
11183 C->setCondition(
Record.readSubExpr());
11184 C->setLParenLoc(
Record.readSourceLocation());
11189 C->setCondition(
Record.readSubExpr());
11190 C->setLParenLoc(
Record.readSourceLocation());
11195 C->setNumThreads(
Record.readSubExpr());
11196 C->setLParenLoc(
Record.readSourceLocation());
11200 C->setSafelen(
Record.readSubExpr());
11201 C->setLParenLoc(
Record.readSourceLocation());
11205 C->setSimdlen(
Record.readSubExpr());
11206 C->setLParenLoc(
Record.readSourceLocation());
11210 for (
Expr *&
E :
C->getSizesRefs())
11212 C->setLParenLoc(
Record.readSourceLocation());
11216 for (
Expr *&
E :
C->getArgsRefs())
11218 C->setLParenLoc(
Record.readSourceLocation());
11224 C->setFactor(
Record.readSubExpr());
11225 C->setLParenLoc(
Record.readSourceLocation());
11229 C->setAllocator(
Record.readExpr());
11230 C->setLParenLoc(
Record.readSourceLocation());
11234 C->setNumForLoops(
Record.readSubExpr());
11235 C->setLParenLoc(
Record.readSourceLocation());
11239 C->setDefaultKind(
static_cast<llvm::omp::DefaultKind
>(
Record.readInt()));
11240 C->setLParenLoc(
Record.readSourceLocation());
11241 C->setDefaultKindKwLoc(
Record.readSourceLocation());
11245 C->setProcBindKind(
static_cast<llvm::omp::ProcBindKind
>(
Record.readInt()));
11246 C->setLParenLoc(
Record.readSourceLocation());
11247 C->setProcBindKindKwLoc(
Record.readSourceLocation());
11252 C->setScheduleKind(
11254 C->setFirstScheduleModifier(
11256 C->setSecondScheduleModifier(
11258 C->setChunkSize(
Record.readSubExpr());
11259 C->setLParenLoc(
Record.readSourceLocation());
11260 C->setFirstScheduleModifierLoc(
Record.readSourceLocation());
11261 C->setSecondScheduleModifierLoc(
Record.readSourceLocation());
11262 C->setScheduleKindLoc(
Record.readSourceLocation());
11263 C->setCommaLoc(
Record.readSourceLocation());
11267 C->setNumForLoops(
Record.readSubExpr());
11268 for (
unsigned I = 0,
E =
C->NumberOfLoops; I <
E; ++I)
11269 C->setLoopNumIterations(I,
Record.readSubExpr());
11270 for (
unsigned I = 0,
E =
C->NumberOfLoops; I <
E; ++I)
11271 C->setLoopCounter(I,
Record.readSubExpr());
11272 C->setLParenLoc(
Record.readSourceLocation());
11276 C->setEventHandler(
Record.readSubExpr());
11277 C->setLParenLoc(
Record.readSourceLocation());
11286void OMPClauseReader::VisitOMPReadClause(
OMPReadClause *) {}
11291 if (
C->isExtended()) {
11292 C->setLParenLoc(
Record.readSourceLocation());
11293 C->setArgumentLoc(
Record.readSourceLocation());
11305 C->setLParenLoc(
Record.readSourceLocation());
11307 C->setFailParameterLoc(FailParameterLoc);
11309 C->setFailParameter(CKind);
11313 unsigned Count =
C->getDirectiveKinds().size();
11314 C->setLParenLoc(
Record.readSourceLocation());
11316 DKVec.reserve(Count);
11317 for (
unsigned I = 0; I < Count; I++) {
11320 C->setDirectiveKinds(DKVec);
11324 C->setExpr(
Record.readExpr());
11325 C->setLParenLoc(
Record.readSourceLocation());
11329 unsigned Count =
C->getDirectiveKinds().size();
11330 C->setLParenLoc(
Record.readSourceLocation());
11332 DKVec.reserve(Count);
11333 for (
unsigned I = 0; I < Count; I++) {
11336 C->setDirectiveKinds(DKVec);
11341void OMPClauseReader::VisitOMPNoOpenMPRoutinesClause(
11356void OMPClauseReader::VisitOMPWeakClause(
OMPWeakClause *) {}
11360void OMPClauseReader::VisitOMPSIMDClause(
OMPSIMDClause *) {}
11365 unsigned NumVars =
C->varlist_size();
11367 Vars.reserve(NumVars);
11368 for (
unsigned I = 0; I != NumVars; ++I)
11369 Vars.push_back(
Record.readSubExpr());
11370 C->setVarRefs(Vars);
11371 C->setIsTarget(
Record.readBool());
11372 C->setIsTargetSync(
Record.readBool());
11373 C->setLParenLoc(
Record.readSourceLocation());
11374 C->setVarLoc(
Record.readSourceLocation());
11378 C->setInteropVar(
Record.readSubExpr());
11379 C->setLParenLoc(
Record.readSourceLocation());
11380 C->setVarLoc(
Record.readSourceLocation());
11384 C->setInteropVar(
Record.readSubExpr());
11385 C->setLParenLoc(
Record.readSourceLocation());
11386 C->setVarLoc(
Record.readSourceLocation());
11391 C->setCondition(
Record.readSubExpr());
11392 C->setLParenLoc(
Record.readSourceLocation());
11397 C->setCondition(
Record.readSubExpr());
11398 C->setLParenLoc(
Record.readSourceLocation());
11403void OMPClauseReader::VisitOMPUnifiedSharedMemoryClause(
11412void OMPClauseReader::VisitOMPAtomicDefaultMemOrderClause(
11414 C->setAtomicDefaultMemOrderKind(
11416 C->setLParenLoc(
Record.readSourceLocation());
11417 C->setAtomicDefaultMemOrderKindKwLoc(
Record.readSourceLocation());
11420void OMPClauseReader::VisitOMPAtClause(
OMPAtClause *
C) {
11422 C->setLParenLoc(
Record.readSourceLocation());
11423 C->setAtKindKwLoc(
Record.readSourceLocation());
11428 C->setLParenLoc(
Record.readSourceLocation());
11429 C->setSeverityKindKwLoc(
Record.readSourceLocation());
11433 C->setMessageString(
Record.readSubExpr());
11434 C->setLParenLoc(
Record.readSourceLocation());
11438 C->setLParenLoc(
Record.readSourceLocation());
11439 unsigned NumVars =
C->varlist_size();
11441 Vars.reserve(NumVars);
11442 for (
unsigned i = 0; i != NumVars; ++i)
11443 Vars.push_back(
Record.readSubExpr());
11444 C->setVarRefs(Vars);
11446 for (
unsigned i = 0; i != NumVars; ++i)
11447 Vars.push_back(
Record.readSubExpr());
11448 C->setPrivateCopies(Vars);
11453 C->setLParenLoc(
Record.readSourceLocation());
11454 unsigned NumVars =
C->varlist_size();
11456 Vars.reserve(NumVars);
11457 for (
unsigned i = 0; i != NumVars; ++i)
11458 Vars.push_back(
Record.readSubExpr());
11459 C->setVarRefs(Vars);
11461 for (
unsigned i = 0; i != NumVars; ++i)
11462 Vars.push_back(
Record.readSubExpr());
11463 C->setPrivateCopies(Vars);
11465 for (
unsigned i = 0; i != NumVars; ++i)
11466 Vars.push_back(
Record.readSubExpr());
11472 C->setLParenLoc(
Record.readSourceLocation());
11474 C->setKindLoc(
Record.readSourceLocation());
11475 C->setColonLoc(
Record.readSourceLocation());
11476 unsigned NumVars =
C->varlist_size();
11478 Vars.reserve(NumVars);
11479 for (
unsigned i = 0; i != NumVars; ++i)
11480 Vars.push_back(
Record.readSubExpr());
11481 C->setVarRefs(Vars);
11483 for (
unsigned i = 0; i != NumVars; ++i)
11484 Vars.push_back(
Record.readSubExpr());
11485 C->setPrivateCopies(Vars);
11487 for (
unsigned i = 0; i != NumVars; ++i)
11488 Vars.push_back(
Record.readSubExpr());
11489 C->setSourceExprs(Vars);
11491 for (
unsigned i = 0; i != NumVars; ++i)
11492 Vars.push_back(
Record.readSubExpr());
11493 C->setDestinationExprs(Vars);
11495 for (
unsigned i = 0; i != NumVars; ++i)
11496 Vars.push_back(
Record.readSubExpr());
11497 C->setAssignmentOps(Vars);
11501 C->setLParenLoc(
Record.readSourceLocation());
11502 unsigned NumVars =
C->varlist_size();
11504 Vars.reserve(NumVars);
11505 for (
unsigned i = 0; i != NumVars; ++i)
11506 Vars.push_back(
Record.readSubExpr());
11507 C->setVarRefs(Vars);
11512 C->setLParenLoc(
Record.readSourceLocation());
11513 C->setModifierLoc(
Record.readSourceLocation());
11514 C->setColonLoc(
Record.readSourceLocation());
11517 C->setQualifierLoc(NNSL);
11518 C->setNameInfo(DNI);
11520 unsigned NumVars =
C->varlist_size();
11522 Vars.reserve(NumVars);
11523 for (
unsigned i = 0; i != NumVars; ++i)
11524 Vars.push_back(
Record.readSubExpr());
11525 C->setVarRefs(Vars);
11527 for (
unsigned i = 0; i != NumVars; ++i)
11528 Vars.push_back(
Record.readSubExpr());
11529 C->setPrivates(Vars);
11531 for (
unsigned i = 0; i != NumVars; ++i)
11532 Vars.push_back(
Record.readSubExpr());
11533 C->setLHSExprs(Vars);
11535 for (
unsigned i = 0; i != NumVars; ++i)
11536 Vars.push_back(
Record.readSubExpr());
11537 C->setRHSExprs(Vars);
11539 for (
unsigned i = 0; i != NumVars; ++i)
11540 Vars.push_back(
Record.readSubExpr());
11541 C->setReductionOps(Vars);
11542 if (
C->getModifier() == OMPC_REDUCTION_inscan) {
11544 for (
unsigned i = 0; i != NumVars; ++i)
11545 Vars.push_back(
Record.readSubExpr());
11546 C->setInscanCopyOps(Vars);
11548 for (
unsigned i = 0; i != NumVars; ++i)
11549 Vars.push_back(
Record.readSubExpr());
11550 C->setInscanCopyArrayTemps(Vars);
11552 for (
unsigned i = 0; i != NumVars; ++i)
11553 Vars.push_back(
Record.readSubExpr());
11554 C->setInscanCopyArrayElems(Vars);
11560 C->setLParenLoc(
Record.readSourceLocation());
11561 C->setColonLoc(
Record.readSourceLocation());
11564 C->setQualifierLoc(NNSL);
11565 C->setNameInfo(DNI);
11567 unsigned NumVars =
C->varlist_size();
11569 Vars.reserve(NumVars);
11570 for (
unsigned I = 0; I != NumVars; ++I)
11571 Vars.push_back(
Record.readSubExpr());
11572 C->setVarRefs(Vars);
11574 for (
unsigned I = 0; I != NumVars; ++I)
11575 Vars.push_back(
Record.readSubExpr());
11576 C->setPrivates(Vars);
11578 for (
unsigned I = 0; I != NumVars; ++I)
11579 Vars.push_back(
Record.readSubExpr());
11580 C->setLHSExprs(Vars);
11582 for (
unsigned I = 0; I != NumVars; ++I)
11583 Vars.push_back(
Record.readSubExpr());
11584 C->setRHSExprs(Vars);
11586 for (
unsigned I = 0; I != NumVars; ++I)
11587 Vars.push_back(
Record.readSubExpr());
11588 C->setReductionOps(Vars);
11593 C->setLParenLoc(
Record.readSourceLocation());
11594 C->setColonLoc(
Record.readSourceLocation());
11597 C->setQualifierLoc(NNSL);
11598 C->setNameInfo(DNI);
11600 unsigned NumVars =
C->varlist_size();
11602 Vars.reserve(NumVars);
11603 for (
unsigned I = 0; I != NumVars; ++I)
11604 Vars.push_back(
Record.readSubExpr());
11605 C->setVarRefs(Vars);
11607 for (
unsigned I = 0; I != NumVars; ++I)
11608 Vars.push_back(
Record.readSubExpr());
11609 C->setPrivates(Vars);
11611 for (
unsigned I = 0; I != NumVars; ++I)
11612 Vars.push_back(
Record.readSubExpr());
11613 C->setLHSExprs(Vars);
11615 for (
unsigned I = 0; I != NumVars; ++I)
11616 Vars.push_back(
Record.readSubExpr());
11617 C->setRHSExprs(Vars);
11619 for (
unsigned I = 0; I != NumVars; ++I)
11620 Vars.push_back(
Record.readSubExpr());
11621 C->setReductionOps(Vars);
11623 for (
unsigned I = 0; I != NumVars; ++I)
11624 Vars.push_back(
Record.readSubExpr());
11625 C->setTaskgroupDescriptors(Vars);
11630 C->setLParenLoc(
Record.readSourceLocation());
11631 C->setColonLoc(
Record.readSourceLocation());
11633 C->setModifierLoc(
Record.readSourceLocation());
11634 unsigned NumVars =
C->varlist_size();
11636 Vars.reserve(NumVars);
11637 for (
unsigned i = 0; i != NumVars; ++i)
11638 Vars.push_back(
Record.readSubExpr());
11639 C->setVarRefs(Vars);
11641 for (
unsigned i = 0; i != NumVars; ++i)
11642 Vars.push_back(
Record.readSubExpr());
11643 C->setPrivates(Vars);
11645 for (
unsigned i = 0; i != NumVars; ++i)
11646 Vars.push_back(
Record.readSubExpr());
11649 for (
unsigned i = 0; i != NumVars; ++i)
11650 Vars.push_back(
Record.readSubExpr());
11651 C->setUpdates(Vars);
11653 for (
unsigned i = 0; i != NumVars; ++i)
11654 Vars.push_back(
Record.readSubExpr());
11655 C->setFinals(Vars);
11656 C->setStep(
Record.readSubExpr());
11657 C->setCalcStep(
Record.readSubExpr());
11659 for (
unsigned I = 0; I != NumVars + 1; ++I)
11660 Vars.push_back(
Record.readSubExpr());
11661 C->setUsedExprs(Vars);
11665 C->setLParenLoc(
Record.readSourceLocation());
11666 C->setColonLoc(
Record.readSourceLocation());
11667 unsigned NumVars =
C->varlist_size();
11669 Vars.reserve(NumVars);
11670 for (
unsigned i = 0; i != NumVars; ++i)
11671 Vars.push_back(
Record.readSubExpr());
11672 C->setVarRefs(Vars);
11673 C->setAlignment(
Record.readSubExpr());
11677 C->setLParenLoc(
Record.readSourceLocation());
11678 unsigned NumVars =
C->varlist_size();
11680 Exprs.reserve(NumVars);
11681 for (
unsigned i = 0; i != NumVars; ++i)
11682 Exprs.push_back(
Record.readSubExpr());
11683 C->setVarRefs(Exprs);
11685 for (
unsigned i = 0; i != NumVars; ++i)
11686 Exprs.push_back(
Record.readSubExpr());
11687 C->setSourceExprs(Exprs);
11689 for (
unsigned i = 0; i != NumVars; ++i)
11690 Exprs.push_back(
Record.readSubExpr());
11691 C->setDestinationExprs(Exprs);
11693 for (
unsigned i = 0; i != NumVars; ++i)
11694 Exprs.push_back(
Record.readSubExpr());
11695 C->setAssignmentOps(Exprs);
11699 C->setLParenLoc(
Record.readSourceLocation());
11700 unsigned NumVars =
C->varlist_size();
11702 Exprs.reserve(NumVars);
11703 for (
unsigned i = 0; i != NumVars; ++i)
11704 Exprs.push_back(
Record.readSubExpr());
11705 C->setVarRefs(Exprs);
11707 for (
unsigned i = 0; i != NumVars; ++i)
11708 Exprs.push_back(
Record.readSubExpr());
11709 C->setSourceExprs(Exprs);
11711 for (
unsigned i = 0; i != NumVars; ++i)
11712 Exprs.push_back(
Record.readSubExpr());
11713 C->setDestinationExprs(Exprs);
11715 for (
unsigned i = 0; i != NumVars; ++i)
11716 Exprs.push_back(
Record.readSubExpr());
11717 C->setAssignmentOps(Exprs);
11721 C->setLParenLoc(
Record.readSourceLocation());
11722 unsigned NumVars =
C->varlist_size();
11724 Vars.reserve(NumVars);
11725 for (
unsigned i = 0; i != NumVars; ++i)
11726 Vars.push_back(
Record.readSubExpr());
11727 C->setVarRefs(Vars);
11731 C->setDepobj(
Record.readSubExpr());
11732 C->setLParenLoc(
Record.readSourceLocation());
11736 C->setLParenLoc(
Record.readSourceLocation());
11737 C->setModifier(
Record.readSubExpr());
11738 C->setDependencyKind(
11740 C->setDependencyLoc(
Record.readSourceLocation());
11741 C->setColonLoc(
Record.readSourceLocation());
11742 C->setOmpAllMemoryLoc(
Record.readSourceLocation());
11743 unsigned NumVars =
C->varlist_size();
11745 Vars.reserve(NumVars);
11746 for (
unsigned I = 0; I != NumVars; ++I)
11747 Vars.push_back(
Record.readSubExpr());
11748 C->setVarRefs(Vars);
11749 for (
unsigned I = 0,
E =
C->getNumLoops(); I <
E; ++I)
11750 C->setLoopData(I,
Record.readSubExpr());
11756 C->setDevice(
Record.readSubExpr());
11757 C->setModifierLoc(
Record.readSourceLocation());
11758 C->setLParenLoc(
Record.readSourceLocation());
11762 C->setLParenLoc(
Record.readSourceLocation());
11763 bool HasIteratorModifier =
false;
11765 C->setMapTypeModifier(
11767 C->setMapTypeModifierLoc(I,
Record.readSourceLocation());
11768 if (
C->getMapTypeModifier(I) == OMPC_MAP_MODIFIER_iterator)
11769 HasIteratorModifier =
true;
11771 C->setMapperQualifierLoc(
Record.readNestedNameSpecifierLoc());
11772 C->setMapperIdInfo(
Record.readDeclarationNameInfo());
11775 C->setMapLoc(
Record.readSourceLocation());
11776 C->setColonLoc(
Record.readSourceLocation());
11777 auto NumVars =
C->varlist_size();
11778 auto UniqueDecls =
C->getUniqueDeclarationsNum();
11779 auto TotalLists =
C->getTotalComponentListNum();
11780 auto TotalComponents =
C->getTotalComponentsNum();
11783 Vars.reserve(NumVars);
11784 for (
unsigned i = 0; i != NumVars; ++i)
11785 Vars.push_back(
Record.readExpr());
11786 C->setVarRefs(Vars);
11789 UDMappers.reserve(NumVars);
11790 for (
unsigned I = 0; I < NumVars; ++I)
11791 UDMappers.push_back(
Record.readExpr());
11792 C->setUDMapperRefs(UDMappers);
11794 if (HasIteratorModifier)
11795 C->setIteratorModifier(
Record.readExpr());
11798 Decls.reserve(UniqueDecls);
11799 for (
unsigned i = 0; i < UniqueDecls; ++i)
11801 C->setUniqueDecls(Decls);
11804 ListsPerDecl.reserve(UniqueDecls);
11805 for (
unsigned i = 0; i < UniqueDecls; ++i)
11806 ListsPerDecl.push_back(
Record.readInt());
11807 C->setDeclNumLists(ListsPerDecl);
11810 ListSizes.reserve(TotalLists);
11811 for (
unsigned i = 0; i < TotalLists; ++i)
11812 ListSizes.push_back(
Record.readInt());
11813 C->setComponentListSizes(ListSizes);
11816 Components.reserve(TotalComponents);
11817 for (
unsigned i = 0; i < TotalComponents; ++i) {
11820 Components.emplace_back(AssociatedExprPr, AssociatedDecl,
11823 C->setComponents(Components, ListSizes);
11828 C->setLParenLoc(
Record.readSourceLocation());
11829 C->setColonLoc(
Record.readSourceLocation());
11830 C->setAllocator(
Record.readSubExpr());
11831 unsigned NumVars =
C->varlist_size();
11833 Vars.reserve(NumVars);
11834 for (
unsigned i = 0; i != NumVars; ++i)
11835 Vars.push_back(
Record.readSubExpr());
11836 C->setVarRefs(Vars);
11841 C->setLParenLoc(
Record.readSourceLocation());
11842 unsigned NumVars =
C->varlist_size();
11844 Vars.reserve(NumVars);
11845 for (
unsigned I = 0; I != NumVars; ++I)
11846 Vars.push_back(
Record.readSubExpr());
11847 C->setVarRefs(Vars);
11852 C->setLParenLoc(
Record.readSourceLocation());
11853 unsigned NumVars =
C->varlist_size();
11855 Vars.reserve(NumVars);
11856 for (
unsigned I = 0; I != NumVars; ++I)
11857 Vars.push_back(
Record.readSubExpr());
11858 C->setVarRefs(Vars);
11863 C->setPriority(
Record.readSubExpr());
11864 C->setLParenLoc(
Record.readSourceLocation());
11870 C->setGrainsize(
Record.readSubExpr());
11871 C->setModifierLoc(
Record.readSourceLocation());
11872 C->setLParenLoc(
Record.readSourceLocation());
11878 C->setNumTasks(
Record.readSubExpr());
11879 C->setModifierLoc(
Record.readSourceLocation());
11880 C->setLParenLoc(
Record.readSourceLocation());
11884 C->setHint(
Record.readSubExpr());
11885 C->setLParenLoc(
Record.readSourceLocation());
11890 C->setDistScheduleKind(
11892 C->setChunkSize(
Record.readSubExpr());
11893 C->setLParenLoc(
Record.readSourceLocation());
11894 C->setDistScheduleKindLoc(
Record.readSourceLocation());
11895 C->setCommaLoc(
Record.readSourceLocation());
11899 C->setDefaultmapKind(
11901 C->setDefaultmapModifier(
11903 C->setLParenLoc(
Record.readSourceLocation());
11904 C->setDefaultmapModifierLoc(
Record.readSourceLocation());
11905 C->setDefaultmapKindLoc(
Record.readSourceLocation());
11908void OMPClauseReader::VisitOMPToClause(
OMPToClause *
C) {
11909 C->setLParenLoc(
Record.readSourceLocation());
11911 C->setMotionModifier(
11913 C->setMotionModifierLoc(I,
Record.readSourceLocation());
11915 C->setMapperQualifierLoc(
Record.readNestedNameSpecifierLoc());
11916 C->setMapperIdInfo(
Record.readDeclarationNameInfo());
11917 C->setColonLoc(
Record.readSourceLocation());
11918 auto NumVars =
C->varlist_size();
11919 auto UniqueDecls =
C->getUniqueDeclarationsNum();
11920 auto TotalLists =
C->getTotalComponentListNum();
11921 auto TotalComponents =
C->getTotalComponentsNum();
11924 Vars.reserve(NumVars);
11925 for (
unsigned i = 0; i != NumVars; ++i)
11926 Vars.push_back(
Record.readSubExpr());
11927 C->setVarRefs(Vars);
11930 UDMappers.reserve(NumVars);
11931 for (
unsigned I = 0; I < NumVars; ++I)
11932 UDMappers.push_back(
Record.readSubExpr());
11933 C->setUDMapperRefs(UDMappers);
11936 Decls.reserve(UniqueDecls);
11937 for (
unsigned i = 0; i < UniqueDecls; ++i)
11939 C->setUniqueDecls(Decls);
11942 ListsPerDecl.reserve(UniqueDecls);
11943 for (
unsigned i = 0; i < UniqueDecls; ++i)
11944 ListsPerDecl.push_back(
Record.readInt());
11945 C->setDeclNumLists(ListsPerDecl);
11948 ListSizes.reserve(TotalLists);
11949 for (
unsigned i = 0; i < TotalLists; ++i)
11950 ListSizes.push_back(
Record.readInt());
11951 C->setComponentListSizes(ListSizes);
11954 Components.reserve(TotalComponents);
11955 for (
unsigned i = 0; i < TotalComponents; ++i) {
11956 Expr *AssociatedExprPr =
Record.readSubExpr();
11957 bool IsNonContiguous =
Record.readBool();
11959 Components.emplace_back(AssociatedExprPr, AssociatedDecl, IsNonContiguous);
11961 C->setComponents(Components, ListSizes);
11965 C->setLParenLoc(
Record.readSourceLocation());
11967 C->setMotionModifier(
11969 C->setMotionModifierLoc(I,
Record.readSourceLocation());
11971 C->setMapperQualifierLoc(
Record.readNestedNameSpecifierLoc());
11972 C->setMapperIdInfo(
Record.readDeclarationNameInfo());
11973 C->setColonLoc(
Record.readSourceLocation());
11974 auto NumVars =
C->varlist_size();
11975 auto UniqueDecls =
C->getUniqueDeclarationsNum();
11976 auto TotalLists =
C->getTotalComponentListNum();
11977 auto TotalComponents =
C->getTotalComponentsNum();
11980 Vars.reserve(NumVars);
11981 for (
unsigned i = 0; i != NumVars; ++i)
11982 Vars.push_back(
Record.readSubExpr());
11983 C->setVarRefs(Vars);
11986 UDMappers.reserve(NumVars);
11987 for (
unsigned I = 0; I < NumVars; ++I)
11988 UDMappers.push_back(
Record.readSubExpr());
11989 C->setUDMapperRefs(UDMappers);
11992 Decls.reserve(UniqueDecls);
11993 for (
unsigned i = 0; i < UniqueDecls; ++i)
11995 C->setUniqueDecls(Decls);
11998 ListsPerDecl.reserve(UniqueDecls);
11999 for (
unsigned i = 0; i < UniqueDecls; ++i)
12000 ListsPerDecl.push_back(
Record.readInt());
12001 C->setDeclNumLists(ListsPerDecl);
12004 ListSizes.reserve(TotalLists);
12005 for (
unsigned i = 0; i < TotalLists; ++i)
12006 ListSizes.push_back(
Record.readInt());
12007 C->setComponentListSizes(ListSizes);
12010 Components.reserve(TotalComponents);
12011 for (
unsigned i = 0; i < TotalComponents; ++i) {
12012 Expr *AssociatedExprPr =
Record.readSubExpr();
12013 bool IsNonContiguous =
Record.readBool();
12015 Components.emplace_back(AssociatedExprPr, AssociatedDecl, IsNonContiguous);
12017 C->setComponents(Components, ListSizes);
12021 C->setLParenLoc(
Record.readSourceLocation());
12022 auto NumVars =
C->varlist_size();
12023 auto UniqueDecls =
C->getUniqueDeclarationsNum();
12024 auto TotalLists =
C->getTotalComponentListNum();
12025 auto TotalComponents =
C->getTotalComponentsNum();
12028 Vars.reserve(NumVars);
12029 for (
unsigned i = 0; i != NumVars; ++i)
12030 Vars.push_back(
Record.readSubExpr());
12031 C->setVarRefs(Vars);
12033 for (
unsigned i = 0; i != NumVars; ++i)
12034 Vars.push_back(
Record.readSubExpr());
12035 C->setPrivateCopies(Vars);
12037 for (
unsigned i = 0; i != NumVars; ++i)
12038 Vars.push_back(
Record.readSubExpr());
12042 Decls.reserve(UniqueDecls);
12043 for (
unsigned i = 0; i < UniqueDecls; ++i)
12045 C->setUniqueDecls(Decls);
12048 ListsPerDecl.reserve(UniqueDecls);
12049 for (
unsigned i = 0; i < UniqueDecls; ++i)
12050 ListsPerDecl.push_back(
Record.readInt());
12051 C->setDeclNumLists(ListsPerDecl);
12054 ListSizes.reserve(TotalLists);
12055 for (
unsigned i = 0; i < TotalLists; ++i)
12056 ListSizes.push_back(
Record.readInt());
12057 C->setComponentListSizes(ListSizes);
12060 Components.reserve(TotalComponents);
12061 for (
unsigned i = 0; i < TotalComponents; ++i) {
12062 auto *AssociatedExprPr =
Record.readSubExpr();
12064 Components.emplace_back(AssociatedExprPr, AssociatedDecl,
12067 C->setComponents(Components, ListSizes);
12071 C->setLParenLoc(
Record.readSourceLocation());
12072 auto NumVars =
C->varlist_size();
12073 auto UniqueDecls =
C->getUniqueDeclarationsNum();
12074 auto TotalLists =
C->getTotalComponentListNum();
12075 auto TotalComponents =
C->getTotalComponentsNum();
12078 Vars.reserve(NumVars);
12079 for (
unsigned i = 0; i != NumVars; ++i)
12080 Vars.push_back(
Record.readSubExpr());
12081 C->setVarRefs(Vars);
12084 Decls.reserve(UniqueDecls);
12085 for (
unsigned i = 0; i < UniqueDecls; ++i)
12087 C->setUniqueDecls(Decls);
12090 ListsPerDecl.reserve(UniqueDecls);
12091 for (
unsigned i = 0; i < UniqueDecls; ++i)
12092 ListsPerDecl.push_back(
Record.readInt());
12093 C->setDeclNumLists(ListsPerDecl);
12096 ListSizes.reserve(TotalLists);
12097 for (
unsigned i = 0; i < TotalLists; ++i)
12098 ListSizes.push_back(
Record.readInt());
12099 C->setComponentListSizes(ListSizes);
12102 Components.reserve(TotalComponents);
12103 for (
unsigned i = 0; i < TotalComponents; ++i) {
12104 Expr *AssociatedExpr =
Record.readSubExpr();
12106 Components.emplace_back(AssociatedExpr, AssociatedDecl,
12109 C->setComponents(Components, ListSizes);
12113 C->setLParenLoc(
Record.readSourceLocation());
12114 auto NumVars =
C->varlist_size();
12115 auto UniqueDecls =
C->getUniqueDeclarationsNum();
12116 auto TotalLists =
C->getTotalComponentListNum();
12117 auto TotalComponents =
C->getTotalComponentsNum();
12120 Vars.reserve(NumVars);
12121 for (
unsigned i = 0; i != NumVars; ++i)
12122 Vars.push_back(
Record.readSubExpr());
12123 C->setVarRefs(Vars);
12127 Decls.reserve(UniqueDecls);
12128 for (
unsigned i = 0; i < UniqueDecls; ++i)
12130 C->setUniqueDecls(Decls);
12133 ListsPerDecl.reserve(UniqueDecls);
12134 for (
unsigned i = 0; i < UniqueDecls; ++i)
12135 ListsPerDecl.push_back(
Record.readInt());
12136 C->setDeclNumLists(ListsPerDecl);
12139 ListSizes.reserve(TotalLists);
12140 for (
unsigned i = 0; i < TotalLists; ++i)
12141 ListSizes.push_back(
Record.readInt());
12142 C->setComponentListSizes(ListSizes);
12145 Components.reserve(TotalComponents);
12146 for (
unsigned i = 0; i < TotalComponents; ++i) {
12147 Expr *AssociatedExpr =
Record.readSubExpr();
12149 Components.emplace_back(AssociatedExpr, AssociatedDecl,
12152 C->setComponents(Components, ListSizes);
12156 C->setLParenLoc(
Record.readSourceLocation());
12157 auto NumVars =
C->varlist_size();
12158 auto UniqueDecls =
C->getUniqueDeclarationsNum();
12159 auto TotalLists =
C->getTotalComponentListNum();
12160 auto TotalComponents =
C->getTotalComponentsNum();
12163 Vars.reserve(NumVars);
12164 for (
unsigned I = 0; I != NumVars; ++I)
12165 Vars.push_back(
Record.readSubExpr());
12166 C->setVarRefs(Vars);
12170 Decls.reserve(UniqueDecls);
12171 for (
unsigned I = 0; I < UniqueDecls; ++I)
12173 C->setUniqueDecls(Decls);
12176 ListsPerDecl.reserve(UniqueDecls);
12177 for (
unsigned I = 0; I < UniqueDecls; ++I)
12178 ListsPerDecl.push_back(
Record.readInt());
12179 C->setDeclNumLists(ListsPerDecl);
12182 ListSizes.reserve(TotalLists);
12183 for (
unsigned i = 0; i < TotalLists; ++i)
12184 ListSizes.push_back(
Record.readInt());
12185 C->setComponentListSizes(ListSizes);
12188 Components.reserve(TotalComponents);
12189 for (
unsigned I = 0; I < TotalComponents; ++I) {
12190 Expr *AssociatedExpr =
Record.readSubExpr();
12192 Components.emplace_back(AssociatedExpr, AssociatedDecl,
12195 C->setComponents(Components, ListSizes);
12199 C->setLParenLoc(
Record.readSourceLocation());
12200 unsigned NumVars =
C->varlist_size();
12202 Vars.reserve(NumVars);
12203 for (
unsigned i = 0; i != NumVars; ++i)
12204 Vars.push_back(
Record.readSubExpr());
12205 C->setVarRefs(Vars);
12207 Vars.reserve(NumVars);
12208 for (
unsigned i = 0; i != NumVars; ++i)
12209 Vars.push_back(
Record.readSubExpr());
12210 C->setPrivateRefs(Vars);
12214 C->setLParenLoc(
Record.readSourceLocation());
12215 unsigned NumVars =
C->varlist_size();
12217 Vars.reserve(NumVars);
12218 for (
unsigned i = 0; i != NumVars; ++i)
12219 Vars.push_back(
Record.readSubExpr());
12220 C->setVarRefs(Vars);
12224 C->setLParenLoc(
Record.readSourceLocation());
12225 unsigned NumVars =
C->varlist_size();
12227 Vars.reserve(NumVars);
12228 for (
unsigned i = 0; i != NumVars; ++i)
12229 Vars.push_back(
Record.readSubExpr());
12230 C->setVarRefs(Vars);
12234 C->setLParenLoc(
Record.readSourceLocation());
12235 unsigned NumOfAllocators =
C->getNumberOfAllocators();
12237 Data.reserve(NumOfAllocators);
12238 for (
unsigned I = 0; I != NumOfAllocators; ++I) {
12240 D.Allocator =
Record.readSubExpr();
12241 D.AllocatorTraits =
Record.readSubExpr();
12242 D.LParenLoc =
Record.readSourceLocation();
12243 D.RParenLoc =
Record.readSourceLocation();
12245 C->setAllocatorsData(
Data);
12249 C->setLParenLoc(
Record.readSourceLocation());
12250 C->setModifier(
Record.readSubExpr());
12251 C->setColonLoc(
Record.readSourceLocation());
12252 unsigned NumOfLocators =
C->varlist_size();
12254 Locators.reserve(NumOfLocators);
12255 for (
unsigned I = 0; I != NumOfLocators; ++I)
12256 Locators.push_back(
Record.readSubExpr());
12257 C->setVarRefs(Locators);
12263 C->setLParenLoc(
Record.readSourceLocation());
12264 C->setKindKwLoc(
Record.readSourceLocation());
12265 C->setModifierKwLoc(
Record.readSourceLocation());
12270 C->setThreadID(
Record.readSubExpr());
12271 C->setLParenLoc(
Record.readSourceLocation());
12276 C->setLParenLoc(
Record.readSourceLocation());
12277 C->setBindKindLoc(
Record.readSourceLocation());
12281 C->setAlignment(
Record.readExpr());
12282 C->setLParenLoc(
Record.readSourceLocation());
12287 C->setSize(
Record.readSubExpr());
12288 C->setLParenLoc(
Record.readSourceLocation());
12292 C->setLParenLoc(
Record.readSourceLocation());
12293 C->setDependenceType(
12295 C->setDependenceLoc(
Record.readSourceLocation());
12296 C->setColonLoc(
Record.readSourceLocation());
12297 unsigned NumVars =
C->varlist_size();
12299 Vars.reserve(NumVars);
12300 for (
unsigned I = 0; I != NumVars; ++I)
12301 Vars.push_back(
Record.readSubExpr());
12302 C->setVarRefs(Vars);
12303 for (
unsigned I = 0,
E =
C->getNumLoops(); I <
E; ++I)
12304 C->setLoopData(I,
Record.readSubExpr());
12309 Record.readAttributes(Attrs);
12310 C->setAttrs(Attrs);
12311 C->setLocStart(
Record.readSourceLocation());
12312 C->setLParenLoc(
Record.readSourceLocation());
12313 C->setLocEnd(
Record.readSourceLocation());
12322 Set.Kind = readEnum<llvm::omp::TraitSet>();
12325 Selector.Kind = readEnum<llvm::omp::TraitSelector>();
12326 Selector.ScoreOrCondition =
nullptr;
12328 Selector.ScoreOrCondition = readExprRef();
12331 Property.Kind = readEnum<llvm::omp::TraitProperty>();
12340 if (Reader->ReadingKind == ASTReader::Read_Stmt) {
12345 for (
unsigned I = 0,
E =
Data->getNumClauses(); I <
E; ++I)
12347 Data->setClauses(Clauses);
12348 if (
Data->hasAssociatedStmt())
12350 for (
unsigned I = 0,
E =
Data->getNumChildren(); I <
E; ++I)
12355 unsigned NumVars =
readInt();
12357 for (
unsigned I = 0; I < NumVars; ++I)
12363 unsigned NumExprs =
readInt();
12365 for (
unsigned I = 0; I < NumExprs; ++I)
12375 switch (ClauseKind) {
12396 unsigned NumClauses =
readInt();
12398 for (
unsigned I = 0; I < NumClauses; ++I)
12481 LParenLoc, VarList, EndLoc);
12490 LParenLoc, IsReadOnly, VarList, EndLoc);
12499 LParenLoc, IsZero, VarList, EndLoc);
12508 LParenLoc, IsZero, VarList, EndLoc);
12514 AsyncExpr, EndLoc);
12522 DevNumExpr, QueuesLoc, QueueIdExprs,
12529 unsigned NumArchs =
readInt();
12531 for (
unsigned I = 0; I < NumArchs; ++I) {
12534 Archs.emplace_back(Ident,
Loc);
12538 LParenLoc, Archs, EndLoc);
12562 HasForce, LoopCount, EndLoc);
12566 unsigned NumClauses =
readInt();
12568 for (
unsigned I = 0; I < NumClauses; ++I)
12571 SizeExprs, EndLoc);
12575 unsigned NumExprs =
readInt();
12578 for (
unsigned I = 0; I < NumExprs; ++I) {
12579 GangKinds.push_back(readEnum<OpenACCGangKind>());
12583 GangKinds, Exprs, EndLoc);
12589 WorkerExpr, EndLoc);
12595 VectorExpr, EndLoc);
12606 llvm_unreachable(
"Clause serialization not yet implemented");
12608 llvm_unreachable(
"Invalid Clause Kind");
12613 for (
unsigned I = 0; I < Clauses.size(); ++I)
Defines the clang::ASTContext interface.
ASTImporterLookupTable & LT
static unsigned moduleKindForDiagnostic(ModuleKind Kind)
static void PassObjCImplDeclToConsumer(ObjCImplDecl *ImplD, ASTConsumer *Consumer)
Under non-PCH compilation the consumer receives the objc methods before receiving the implementation,...
static llvm::Error doesntStartWithASTFileMagic(BitstreamCursor &Stream)
Whether Stream doesn't start with the AST/PCH file magic number 'CPCH'.
static bool isExtHandlingFromDiagsError(DiagnosticsEngine &Diags)
static bool checkModuleCachePath(llvm::vfs::FileSystem &VFS, StringRef SpecificModuleCachePath, StringRef ExistingModuleCachePath, StringRef ModuleFilename, DiagnosticsEngine *Diags, const LangOptions &LangOpts, const PreprocessorOptions &PPOpts)
Check that the specified and the existing module cache paths are equivalent.
static unsigned getModuleFileIndexForTypeID(serialization::TypeID ID)
static void collectMacroDefinitions(const PreprocessorOptions &PPOpts, MacroDefinitionsMap &Macros, SmallVectorImpl< StringRef > *MacroNames=nullptr)
Collect the macro definitions provided by the given preprocessor options.
static void markIdentifierFromAST(ASTReader &Reader, IdentifierInfo &II, bool IsModule)
static void moveMethodToBackOfGlobalList(Sema &S, ObjCMethodDecl *Method)
Move the given method to the back of the global list of methods.
static bool isDiagnosedResult(ASTReader::ASTReadResult ARR, unsigned Caps)
static bool isInterestingIdentifier(ASTReader &Reader, const IdentifierInfo &II, bool IsModule)
Whether the given identifier is "interesting".
static bool parseModuleFileExtensionMetadata(const SmallVectorImpl< uint64_t > &Record, StringRef Blob, ModuleFileExtensionMetadata &Metadata)
Parse a record and blob containing module file extension metadata.
static Module * getTopImportImplicitModule(ModuleManager &ModuleMgr, Preprocessor &PP)
Return the top import module if it is implicit, nullptr otherwise.
static bool checkPreprocessorOptions(const PreprocessorOptions &PPOpts, const PreprocessorOptions &ExistingPPOpts, StringRef ModuleFilename, bool ReadMacros, DiagnosticsEngine *Diags, FileManager &FileMgr, std::string &SuggestedPredefines, const LangOptions &LangOpts, OptionValidation Validation=OptionValidateContradictions)
Check the preprocessor options deserialized from the control block against the preprocessor options i...
static void addMethodsToPool(Sema &S, ArrayRef< ObjCMethodDecl * > Methods, ObjCMethodList &List)
Add the given set of methods to the method list.
static bool checkDiagnosticMappings(DiagnosticsEngine &StoredDiags, DiagnosticsEngine &Diags, StringRef ModuleFilename, bool IsSystem, bool SystemHeaderWarningsInModule, bool Complain)
static bool isPredefinedType(serialization::TypeID ID)
static bool readBit(unsigned &Bits)
static bool checkDiagnosticGroupMappings(DiagnosticsEngine &StoredDiags, DiagnosticsEngine &Diags, StringRef ModuleFilename, bool Complain)
static std::optional< Type::TypeClass > getTypeClassForCode(TypeCode code)
static std::pair< unsigned, unsigned > readULEBKeyDataLength(const unsigned char *&P)
Read ULEB-encoded key length and data length.
static LLVM_DUMP_METHOD void dumpModuleIDMap(StringRef Name, const ContinuousRangeMap< Key, ModuleFile *, InitialCapacity > &Map)
@ OptionValidateStrictMatches
@ OptionValidateContradictions
static bool checkTargetOptions(const TargetOptions &TargetOpts, const TargetOptions &ExistingTargetOpts, StringRef ModuleFilename, DiagnosticsEngine *Diags, bool AllowCompatibleDifferences=true)
Compare the given set of target options against an existing set of target options.
static bool checkLanguageOptions(const LangOptions &LangOpts, const LangOptions &ExistingLangOpts, StringRef ModuleFilename, DiagnosticsEngine *Diags, bool AllowCompatibleDifferences=true)
Compare the given set of language options against an existing set of language options.
#define CHECK_TARGET_OPT(Field, Name)
static ASTFileSignature readASTFileSignature(StringRef PCH)
Reads and return the signature record from PCH's control block, or else returns 0.
static bool SkipCursorToBlock(BitstreamCursor &Cursor, unsigned BlockID)
Given a cursor at the start of an AST file, scan ahead and drop the cursor into the start of the give...
static unsigned getIndexForTypeID(serialization::TypeID ID)
static uint64_t readULEB(const unsigned char *&P)
Defines the clang::ASTSourceDescriptor class, which abstracts clang modules and precompiled header fi...
static StringRef bytes(const std::vector< T, Allocator > &v)
Defines the Diagnostic-related interfaces.
enum clang::sema::@1718::IndirectLocalPathEntry::EntryKind Kind
static void dump(llvm::raw_ostream &OS, StringRef FunctionName, ArrayRef< CounterExpression > Expressions, ArrayRef< CounterMappingRegion > Regions)
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Defines the C++ template declaration subclasses.
Defines the Diagnostic IDs-related interfaces.
static bool hasDefinition(const ObjCObjectPointerType *ObjPtr)
Defines the ExceptionSpecificationType enumeration and various utility functions.
Defines the clang::Expr interface and subclasses for C++ expressions.
Defines the clang::FileManager interface and associated types.
Defines the clang::FileSystemOptions interface.
llvm::DenseSet< const void * > Visited
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines the clang::LangOptions interface.
static DiagnosticBuilder Diag(DiagnosticsEngine *Diags, const LangOptions &Features, FullSourceLoc TokLoc, const char *TokBegin, const char *TokRangeBegin, const char *TokRangeEnd, unsigned DiagID)
Produce a diagnostic highlighting some portion of a literal.
llvm::MachO::FileType FileType
llvm::MachO::Record Record
Defines the clang::MacroInfo and clang::MacroDirective classes.
Defines the clang::Module class, which describes a module in the source code.
Defines types useful for describing an Objective-C runtime.
Defines some OpenACC-specific enums and functions.
This file defines OpenMP AST classes for clauses.
Defines some OpenMP-specific enums and functions.
Defines an enumeration for C++ overloaded operators.
Defines the clang::Preprocessor interface.
static std::string getName(const CallEvent &Call)
static std::string toString(const clang::SanitizerSet &Sanitizers)
Produce a string containing comma-separated names of sanitizers in Sanitizers set.
Defines the clang::SanitizerKind enum.
This file declares semantic analysis for CUDA constructs.
This file declares semantic analysis for Objective-C.
Defines the clang::SourceLocation class and associated facilities.
Defines implementation details of the clang::SourceManager class.
Defines the SourceManager interface.
Defines various enumerations that describe declaration and type specifiers.
Defines utilities for dealing with stack allocation and stack space.
Defines the clang::TargetOptions class.
Defines the clang::TokenKind enum and support functions.
Defines the clang::TypeLoc interface and its subclasses.
C Language Family Type Representation.
Defines version macros and version-related utility functions for Clang.
__DEVICE__ void * memcpy(void *__a, const void *__b, size_t __c)
ASTConsumer - This is an abstract interface that should be implemented by clients that read ASTs.
virtual void HandleInterestingDecl(DeclGroupRef D)
HandleInterestingDecl - Handle the specified interesting declaration.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
CanQualType ObjCBuiltinSelTy
TranslationUnitDecl * getTranslationUnitDecl() const
CanQualType ARCUnbridgedCastTy
BuiltinTemplateDecl * getBuiltinCommonTypeDecl() const
TypedefDecl * getObjCClassDecl() const
Retrieve the typedef declaration corresponding to the predefined Objective-C 'Class' type.
TypedefDecl * getCFConstantStringDecl() const
CanQualType SatUnsignedFractTy
BuiltinTemplateDecl * getMakeIntegerSeqDecl() const
ExternCContextDecl * getExternCContextDecl() const
TypedefDecl * getObjCSelDecl() const
Retrieve the typedef corresponding to the predefined 'SEL' type in Objective-C.
CanQualType UnsignedShortAccumTy
TypedefDecl * getObjCInstanceTypeDecl()
Retrieve the typedef declaration corresponding to the Objective-C "instancetype" type.
QualType getAutoRRefDeductType() const
C++11 deduction pattern for 'auto &&' type.
TypedefDecl * getBuiltinMSVaListDecl() const
Retrieve the C type declaration corresponding to the predefined __builtin_ms_va_list type.
TypedefDecl * getObjCIdDecl() const
Retrieve the typedef corresponding to the predefined id type in Objective-C.
ASTMutationListener * getASTMutationListener() const
Retrieve a pointer to the AST mutation listener associated with this AST context, if any.
CanQualType SatLongAccumTy
void setsigjmp_bufDecl(TypeDecl *sigjmp_bufDecl)
Set the type for the C sigjmp_buf type.
CanQualType OMPArrayShapingTy
void setFILEDecl(TypeDecl *FILEDecl)
Set the type for the C FILE type.
CanQualType UnsignedLongFractTy
CanQualType OMPIteratorTy
RawCommentList Comments
All comments in this translation unit.
CanQualType SatShortFractTy
CanQualType SatUnsignedAccumTy
CanQualType ArraySectionTy
CanQualType ObjCBuiltinIdTy
RecordDecl * getCFConstantStringTagDecl() const
CanQualType UnsignedFractTy
CanQualType ObjCBuiltinClassTy
CanQualType UnresolvedTemplateTy
void setucontext_tDecl(TypeDecl *ucontext_tDecl)
Set the type for the C ucontext_t type.
OMPTraitInfo & getNewOMPTraitInfo()
Return a new OMPTraitInfo object owned by this context.
CanQualType UnsignedLongTy
CanQualType UnsignedLongAccumTy
CanQualType BoundMemberTy
CanQualType SatUnsignedShortFractTy
TypedefDecl * getInt128Decl() const
Retrieve the declaration for the 128-bit signed integer type.
CanQualType PseudoObjectTy
QualType getQualifiedType(SplitQualType split) const
Un-split a SplitQualType.
CanQualType OCLClkEventTy
void adjustExceptionSpec(FunctionDecl *FD, const FunctionProtoType::ExceptionSpecInfo &ESI, bool AsWritten=false)
Change the exception specification on a function once it is delay-parsed, instantiated,...
TypedefDecl * getUInt128Decl() const
Retrieve the declaration for the 128-bit unsigned integer type.
CanQualType SatUnsignedShortAccumTy
Decl * getVaListTagDecl() const
Retrieve the C type declaration corresponding to the predefined __va_list_tag type used to help defin...
CanQualType UnsignedInt128Ty
ObjCInterfaceDecl * getObjCProtocolDecl() const
Retrieve the Objective-C class declaration corresponding to the predefined Protocol class.
TypedefDecl * getBuiltinVaListDecl() const
Retrieve the C type declaration corresponding to the predefined __builtin_va_list type.
CanQualType UnsignedCharTy
CanQualType UnsignedShortFractTy
void * Allocate(size_t Size, unsigned Align=8) const
CanQualType UnsignedIntTy
TagDecl * getMSGuidTagDecl() const
Retrieve the implicitly-predeclared 'struct _GUID' declaration.
CanQualType UnsignedLongLongTy
CanQualType OCLReserveIDTy
CanQualType UnsignedShortTy
CanQualType SatUnsignedLongFractTy
void setcudaConfigureCallDecl(FunctionDecl *FD)
DiagnosticsEngine & getDiagnostics() const
CanQualType SatLongFractTy
CanQualType SatShortAccumTy
QualType getAutoDeductType() const
C++11 deduction pattern for 'auto' type.
CanQualType IncompleteMatrixIdxTy
void setjmp_bufDecl(TypeDecl *jmp_bufDecl)
Set the type for the C jmp_buf type.
BuiltinTemplateDecl * getTypePackElementDecl() const
CanQualType SatUnsignedLongAccumTy
void deduplicateMergedDefinitonsFor(NamedDecl *ND)
Clean up the merged definition list.
void adjustDeducedFunctionResultType(FunctionDecl *FD, QualType ResultType)
Change the result type of a function type once it is deduced.
void setPrimaryMergedDecl(Decl *D, Decl *Primary)
CanQualType UnsignedAccumTy
void setCFConstantStringType(QualType T)
virtual void MacroRead(serialization::MacroID ID, MacroInfo *MI)
A macro was read from the AST file.
virtual void SelectorRead(serialization::SelectorID iD, Selector Sel)
A selector was read from the AST file.
virtual void IdentifierRead(serialization::IdentifierID ID, IdentifierInfo *II)
An identifier was deserialized from the AST file.
An identifier-lookup iterator that enumerates all of the identifiers stored within a set of AST files...
ASTIdentifierIterator(const ASTReader &Reader, bool SkipModules=false)
StringRef Next() override
Retrieve the next string in the identifier table and advances the iterator for the following string.
Abstract interface for callback invocations by the ASTReader.
virtual void ReadModuleMapFile(StringRef ModuleMapPath)
virtual bool needsInputFileVisitation()
Returns true if this ASTReaderListener wants to receive the input files of the AST file via visitInpu...
virtual bool ReadTargetOptions(const TargetOptions &TargetOpts, StringRef ModuleFilename, bool Complain, bool AllowCompatibleDifferences)
Receives the target options.
virtual bool visitInputFile(StringRef Filename, bool isSystem, bool isOverridden, bool isExplicitModule)
if needsInputFileVisitation returns true, this is called for each non-system input file of the AST Fi...
virtual bool ReadDiagnosticOptions(IntrusiveRefCntPtr< DiagnosticOptions > DiagOpts, StringRef ModuleFilename, bool Complain)
Receives the diagnostic options.
virtual bool ReadHeaderSearchPaths(const HeaderSearchOptions &HSOpts, bool Complain)
Receives the header search paths.
virtual bool ReadFileSystemOptions(const FileSystemOptions &FSOpts, bool Complain)
Receives the file system options.
virtual ~ASTReaderListener()
virtual bool ReadPreprocessorOptions(const PreprocessorOptions &PPOpts, StringRef ModuleFilename, bool ReadMacros, bool Complain, std::string &SuggestedPredefines)
Receives the preprocessor options.
virtual bool ReadHeaderSearchOptions(const HeaderSearchOptions &HSOpts, StringRef ModuleFilename, StringRef SpecificModuleCachePath, bool Complain)
Receives the header search options.
virtual void readModuleFileExtension(const ModuleFileExtensionMetadata &Metadata)
Indicates that a particular module file extension has been read.
virtual bool ReadLanguageOptions(const LangOptions &LangOpts, StringRef ModuleFilename, bool Complain, bool AllowCompatibleDifferences)
Receives the language options.
virtual void visitImport(StringRef ModuleName, StringRef Filename)
If needsImportVisitation returns true, this is called for each AST file imported by this AST file.
virtual void visitModuleFile(StringRef Filename, serialization::ModuleKind Kind)
This is called for each AST file loaded.
virtual bool needsImportVisitation() const
Returns true if this ASTReaderListener wants to receive the imports of the AST file via visitImport,...
virtual bool ReadFullVersionInformation(StringRef FullVersion)
Receives the full Clang version information.
virtual void ReadCounter(const serialization::ModuleFile &M, unsigned Value)
Receives COUNTER value.
virtual void ReadModuleName(StringRef ModuleName)
virtual bool needsSystemInputFileVisitation()
Returns true if this ASTReaderListener wants to receive the system input files of the AST file via vi...
Reads an AST files chain containing the contents of a translation unit.
std::optional< bool > isPreprocessedEntityInFileID(unsigned Index, FileID FID) override
Optionally returns true or false if the preallocated preprocessed entity with index Index came from f...
PreprocessedEntity * ReadPreprocessedEntity(unsigned Index) override
Read a preallocated preprocessed entity from the external source.
void markIdentifierUpToDate(const IdentifierInfo *II)
Note that this identifier is up-to-date.
void visitTopLevelModuleMaps(serialization::ModuleFile &MF, llvm::function_ref< void(FileEntryRef)> Visitor)
Visit all the top-level module maps loaded when building the given module file.
void setDeserializationListener(ASTDeserializationListener *Listener, bool TakeOwnership=false)
Set the AST deserialization listener.
serialization::SubmoduleID getGlobalSubmoduleID(ModuleFile &M, unsigned LocalID) const
Retrieve the global submodule ID given a module and its local ID number.
ExtKind hasExternalDefinitions(const Decl *D) override
IdentifierTable & getIdentifierTable()
Retrieve the identifier table associated with the preprocessor.
ModuleManager & getModuleManager()
Retrieve the module manager.
bool isDeclIDFromModule(GlobalDeclID ID, ModuleFile &M) const
Returns true if global DeclID ID originated from module M.
friend class ASTIdentifierIterator
bool ReadSLocEntry(int ID) override
Read the source location entry with index ID.
void RecordSwitchCaseID(SwitchCase *SC, unsigned ID)
Record that the given ID maps to the given switch-case statement.
DiagnosticBuilder Diag(unsigned DiagID) const
Report a diagnostic.
ASTContext & getContext()
Retrieve the AST context that this AST reader supplements.
Decl * ReadDecl(ModuleFile &F, const RecordDataImpl &R, unsigned &I)
Reads a declaration from the given position in a record in the given module.
static std::string ReadString(const RecordDataImpl &Record, unsigned &Idx)
void ReadDeclsToCheckForDeferredDiags(llvm::SmallSetVector< Decl *, 4 > &Decls) override
Read the set of decls to be checked for deferred diags.
void InitializeSema(Sema &S) override
Initialize the semantic source with the Sema instance being used to perform semantic analysis on the ...
@ ARR_Missing
The client can handle an AST file that cannot load because it is missing.
@ ARR_ConfigurationMismatch
The client can handle an AST file that cannot load because it's compiled configuration doesn't match ...
@ ARR_OutOfDate
The client can handle an AST file that cannot load because it is out-of-date relative to its input fi...
@ ARR_VersionMismatch
The client can handle an AST file that cannot load because it was built with a different version of C...
void ReadMismatchingDeleteExpressions(llvm::MapVector< FieldDecl *, llvm::SmallVector< std::pair< SourceLocation, bool >, 4 > > &Exprs) override
void FindFileRegionDecls(FileID File, unsigned Offset, unsigned Length, SmallVectorImpl< Decl * > &Decls) override
Get the decls that are contained in a file in the Offset/Length range.
std::string ReadPathBlob(StringRef BaseDirectory, const RecordData &Record, unsigned &Idx, StringRef &Blob)
SourceRange ReadSkippedRange(unsigned Index) override
Read a preallocated skipped range from the external source.
serialization::TypeID getGlobalTypeID(ModuleFile &F, serialization::LocalTypeID LocalID) const
Map a local type ID within a given AST file into a global type ID.
void dump()
Dump information about the AST reader to standard error.
MacroInfo * ReadMacroRecord(ModuleFile &F, uint64_t Offset)
Reads the macro record located at the given offset.
SmallVector< std::pair< llvm::BitstreamCursor, serialization::ModuleFile * >, 8 > CommentsCursors
Cursors for comments blocks.
Selector getLocalSelector(ModuleFile &M, unsigned LocalID)
Retrieve a selector from the given module with its local ID number.
void FindExternalLexicalDecls(const DeclContext *DC, llvm::function_ref< bool(Decl::Kind)> IsKindWeWant, SmallVectorImpl< Decl * > &Decls) override
Read all of the declarations lexically stored in a declaration context.
ModuleFile * getOwningModuleFile(const Decl *D) const
Retrieve the module file that owns the given declaration, or NULL if the declaration is not from a mo...
std::optional< ASTSourceDescriptor > getSourceDescriptor(unsigned ID) override
Return a descriptor for the corresponding module.
const serialization::reader::DeclContextLookupTable * getLoadedLookupTables(DeclContext *Primary) const
Get the loaded lookup tables for Primary, if any.
QualType getLocalType(ModuleFile &F, serialization::LocalTypeID LocalID)
Resolve a local type ID within a given AST file into a type.
void ClearSwitchCaseIDs()
SourceLocation ReadSourceLocation(ModuleFile &MF, RawLocEncoding Raw, LocSeq *Seq=nullptr) const
Read a source location from raw form.
void SetGloballyVisibleDecls(IdentifierInfo *II, const SmallVectorImpl< GlobalDeclID > &DeclIDs, SmallVectorImpl< Decl * > *Decls=nullptr)
Set the globally-visible declarations associated with the given identifier.
bool loadGlobalIndex()
Attempts to load the global index.
void ReadComments() override
Loads comments ranges.
SourceManager & getSourceManager() const
SourceLocation getSourceLocationForDeclID(GlobalDeclID ID)
Returns the source location for the decl ID.
void makeModuleVisible(Module *Mod, Module::NameVisibilityKind NameVisibility, SourceLocation ImportLoc)
Make the entities in the given module and any of its (non-explicit) submodules visible to name lookup...
bool LoadExternalSpecializations(const Decl *D, bool OnlyPartial) override
Load all the external specializations for the Decl.
void finalizeForWriting()
Finalizes the AST reader's state before writing an AST file to disk.
Sema * getSema()
Retrieve the semantic analysis object used to analyze the translation unit in which the precompiled h...
static std::string ResolveImportedPathAndAllocate(SmallString< 0 > &Buf, StringRef Path, ModuleFile &ModF)
Resolve Path in the context of module file M.
static StringRef ReadStringBlob(const RecordDataImpl &Record, unsigned &Idx, StringRef &Blob)
CXXCtorInitializer ** GetExternalCXXCtorInitializers(uint64_t Offset) override
Read the contents of a CXXCtorInitializer array.
void visitInputFileInfos(serialization::ModuleFile &MF, bool IncludeSystem, llvm::function_ref< void(const serialization::InputFileInfo &IFI, bool IsSystem)> Visitor)
Visit all the input file infos of the given module file.
void StartTranslationUnit(ASTConsumer *Consumer) override
Function that will be invoked when we begin parsing a new translation unit involving this external AS...
LocalDeclID mapGlobalIDToModuleFileGlobalID(ModuleFile &M, GlobalDeclID GlobalID)
Map a global declaration ID into the declaration ID used to refer to this declaration within the give...
void resolvePendingMacro(IdentifierInfo *II, const PendingMacroInfo &PMInfo)
bool FindExternalVisibleDeclsByName(const DeclContext *DC, DeclarationName Name) override
Finds all the visible declarations with a given name.
void ReadTentativeDefinitions(SmallVectorImpl< VarDecl * > &TentativeDefs) override
Read the set of tentative definitions known to the external Sema source.
Decl * GetExternalDecl(GlobalDeclID ID) override
Resolve a declaration ID into a declaration, potentially building a new declaration.
GlobalDeclID ReadDeclID(ModuleFile &F, const RecordDataImpl &Record, unsigned &Idx)
Reads a declaration ID from the given position in a record in the given module.
llvm::Expected< SourceLocation::UIntTy > readSLocOffset(ModuleFile *F, unsigned Index)
Try to read the offset of the SLocEntry at the given index in the given module file.
bool haveUnloadedSpecializations(const Decl *D) const
If we have any unloaded specialization for D.
void CompleteRedeclChain(const Decl *D) override
If any redeclarations of D have been imported since it was last checked, this digs out those redeclar...
static llvm::Error ReadBlockAbbrevs(llvm::BitstreamCursor &Cursor, unsigned BlockID, uint64_t *StartOfBlockOffset=nullptr)
ReadBlockAbbrevs - Enter a subblock of the specified BlockID with the specified cursor.
void SetIdentifierInfo(serialization::IdentifierID ID, IdentifierInfo *II)
serialization::PreprocessedEntityID getGlobalPreprocessedEntityID(ModuleFile &M, unsigned LocalID) const
Determine the global preprocessed entity ID that corresponds to the given local ID within the given m...
std::pair< unsigned, unsigned > findPreprocessedEntitiesInRange(SourceRange Range) override
Returns a pair of [Begin, End) indices of preallocated preprocessed entities that Range encompasses.
IdentifierInfo * get(StringRef Name) override
Retrieve the IdentifierInfo for the named identifier.
IdentifierInfo * getLocalIdentifier(ModuleFile &M, uint64_t LocalID)
void visitInputFiles(serialization::ModuleFile &MF, bool IncludeSystem, bool Complain, llvm::function_ref< void(const serialization::InputFile &IF, bool isSystem)> Visitor)
Visit all the input files of the given module file.
Module * getModule(unsigned ID) override
Retrieve the module that corresponds to the given module ID.
llvm::iterator_range< ModuleDeclIterator > getModuleFileLevelDecls(ModuleFile &Mod)
Stmt * GetExternalDeclStmt(uint64_t Offset) override
Resolve the offset of a statement into a statement.
Selector GetExternalSelector(serialization::SelectorID ID) override
Resolve a selector ID into a selector.
unsigned getTotalNumSelectors() const
Returns the number of selectors found in the chain.
MacroInfo * getMacro(serialization::MacroID ID)
Retrieve the macro with the given ID.
void ReadUndefinedButUsed(llvm::MapVector< NamedDecl *, SourceLocation > &Undefined) override
Load the set of used but not defined functions or variables with internal linkage,...
void ReadDelegatingConstructors(SmallVectorImpl< CXXConstructorDecl * > &Decls) override
Read the set of delegating constructors known to the external Sema source.
QualType GetType(serialization::TypeID ID)
Resolve a type ID into a type, potentially building a new type.
void addPendingMacro(IdentifierInfo *II, ModuleFile *M, uint32_t MacroDirectivesOffset)
Add a macro to deserialize its macro directive history.
SourceRange ReadSourceRange(ModuleFile &F, const RecordData &Record, unsigned &Idx, LocSeq *Seq=nullptr)
Read a source range.
GlobalDeclID getGlobalDeclID(ModuleFile &F, LocalDeclID LocalID) const
Map from a local declaration ID within a given module to a global declaration ID.
void ReadWeakUndeclaredIdentifiers(SmallVectorImpl< std::pair< IdentifierInfo *, WeakInfo > > &WeakIDs) override
Read the set of weak, undeclared identifiers known to the external Sema source.
void completeVisibleDeclsMap(const DeclContext *DC) override
Load all external visible decls in the given DeclContext.
void 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 InMemoryModuleCache &ModuleCache, const PCHContainerReader &PCHContainerRdr, bool FindModuleFileExtensions, ASTReaderListener &Listener, bool ValidateDiagnosticOptions, unsigned ClientLoadCapabilities=ARR_ConfigurationMismatch|ARR_OutOfDate)
Read the control block for the named AST file.
void ReadExtVectorDecls(SmallVectorImpl< TypedefNameDecl * > &Decls) override
Read the set of ext_vector type declarations known to the external Sema source.
SmallVector< GlobalDeclID, 16 > PreloadedDeclIDs
std::pair< SourceLocation, StringRef > getModuleImportLoc(int ID) override
Retrieve the module import location and module name for the given source manager entry ID.
void ReadUnusedFileScopedDecls(SmallVectorImpl< const DeclaratorDecl * > &Decls) override
Read the set of unused file-scope declarations known to the external Sema source.
void ReadReferencedSelectors(SmallVectorImpl< std::pair< Selector, SourceLocation > > &Sels) override
Read the set of referenced selectors known to the external Sema source.
Selector DecodeSelector(serialization::SelectorID Idx)
ASTReadResult ReadAST(StringRef FileName, ModuleKind Type, SourceLocation ImportLoc, unsigned ClientLoadCapabilities, ModuleFile **NewLoadedModuleFile=nullptr)
Load the AST file designated by the given file name.
StringRef getOriginalSourceFile()
Retrieve the name of the original source file name for the primary module file.
std::string ReadPath(ModuleFile &F, const RecordData &Record, unsigned &Idx)
unsigned getModuleFileID(ModuleFile *M)
Get an ID for the given module file.
IdentifierInfo * DecodeIdentifierInfo(serialization::IdentifierID ID)
ASTReadResult
The result of reading the control block of an AST file, which can fail for various reasons.
@ Success
The control block was read successfully.
@ ConfigurationMismatch
The AST file was written with a different language/target configuration.
@ OutOfDate
The AST file is out-of-date relative to its input files, and needs to be regenerated.
@ Failure
The AST file itself appears corrupted.
@ VersionMismatch
The AST file was written by a different version of Clang.
@ HadErrors
The AST file has errors.
@ Missing
The AST file was missing.
static VersionTuple ReadVersionTuple(const RecordData &Record, unsigned &Idx)
Read a version tuple.
Token ReadToken(ModuleFile &M, const RecordDataImpl &Record, unsigned &Idx)
Reads a token out of a record.
SwitchCase * getSwitchCaseWithID(unsigned ID)
Retrieve the switch-case statement with the given ID.
serialization::IdentifierID getGlobalIdentifierID(ModuleFile &M, uint64_t LocalID)
void ReadLateParsedTemplates(llvm::MapVector< const FunctionDecl *, std::unique_ptr< LateParsedTemplate > > &LPTMap) override
Read the set of late parsed template functions for this source.
IdentifierIterator * getIdentifiers() override
Retrieve an iterator into the set of all identifiers in all loaded AST files.
void ReadUsedVTables(SmallVectorImpl< ExternalVTableUse > &VTables) override
Read the set of used vtables known to the external Sema source.
bool isGlobalIndexUnavailable() const
Determine whether we tried to load the global index, but failed, e.g., because it is out-of-date or d...
uint32_t GetNumExternalSelectors() override
Returns the number of selectors known to the external AST source.
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.
void LoadSelector(Selector Sel)
Load a selector from disk, registering its ID if it exists.
void ReadPragmaDiagnosticMappings(DiagnosticsEngine &Diag)
void makeNamesVisible(const HiddenNames &Names, Module *Owner)
Make the names within this set of hidden names visible.
void UpdateSema()
Update the state of Sema after loading some additional modules.
Decl * GetDecl(GlobalDeclID ID)
Resolve a declaration ID into a declaration, potentially building a new declaration.
ASTReader(Preprocessor &PP, InMemoryModuleCache &ModuleCache, ASTContext *Context, const PCHContainerReader &PCHContainerRdr, ArrayRef< std::shared_ptr< ModuleFileExtension > > Extensions, StringRef isysroot="", DisableValidationForModuleKind DisableValidationKind=DisableValidationForModuleKind::None, bool AllowASTWithCompilerErrors=false, bool AllowConfigurationMismatch=false, bool ValidateSystemInputs=false, bool ValidateASTInputFilesContent=false, bool UseGlobalIndex=true, std::unique_ptr< llvm::Timer > ReadTimer={})
Load the AST file and validate its contents against the given Preprocessor.
int getSLocEntryID(SourceLocation::UIntTy SLocOffset) override
Get the index ID for the loaded SourceLocation offset.
void ReadPendingInstantiations(SmallVectorImpl< std::pair< ValueDecl *, SourceLocation > > &Pending) override
Read the set of pending instantiations known to the external Sema source.
Preprocessor & getPreprocessor() const
Retrieve the preprocessor.
serialization::reader::LazySpecializationInfoLookupTable * getLoadedSpecializationsLookupTables(const Decl *D, bool IsPartial)
Get the loaded specializations lookup tables for D, if any.
CXXTemporary * ReadCXXTemporary(ModuleFile &F, const RecordData &Record, unsigned &Idx)
void ReadKnownNamespaces(SmallVectorImpl< NamespaceDecl * > &Namespaces) override
Load the set of namespaces that are known to the external source, which will be used during typo corr...
Module * getSubmodule(serialization::SubmoduleID GlobalID)
Retrieve the submodule that corresponds to a global submodule ID.
void PrintStats() override
Print some statistics about AST usage.
void mergeDefinitionVisibility(NamedDecl *Def, NamedDecl *MergedDef)
Note that MergedDef is a redefinition of the canonical definition Def, so Def should be visible whene...
serialization::SelectorID getGlobalSelectorID(ModuleFile &M, unsigned LocalID) const
Retrieve the global selector ID that corresponds to this the local selector ID in a given module.
void runWithSufficientStackSpace(SourceLocation Loc, llvm::function_ref< void()> Fn)
void StartedDeserializing() override
Notify ASTReader that we started deserialization of a decl or type so until FinishedDeserializing is ...
void ReadMethodPool(Selector Sel) override
Load the contents of the global method pool for a given selector.
void InitializeContext()
Initializes the ASTContext.
CXXBaseSpecifier * GetExternalCXXBaseSpecifiers(uint64_t Offset) override
Resolve the offset of a set of C++ base specifiers in the decl stream into an array of specifiers.
FileManager & getFileManager() const
static bool isAcceptableASTFile(StringRef Filename, FileManager &FileMgr, const InMemoryModuleCache &ModuleCache, const PCHContainerReader &PCHContainerRdr, const LangOptions &LangOpts, const TargetOptions &TargetOpts, const PreprocessorOptions &PPOpts, StringRef ExistingModuleCachePath, bool RequireStrictOptionMatches=false)
Determine whether the given AST file is acceptable to load into a translation unit with the given lan...
void FinishedDeserializing() override
Notify ASTReader that we finished the deserialization of a decl or type.
void updateOutOfDateIdentifier(const IdentifierInfo &II) override
Update an out-of-date identifier.
void ReadDefinedMacros() override
Read the set of macros defined by this external macro source.
HeaderFileInfo GetHeaderFileInfo(FileEntryRef FE) override
Read the header file information for the given file entry.
serialization::MacroID getGlobalMacroID(ModuleFile &M, unsigned LocalID)
Retrieve the global macro ID corresponding to the given local ID within the given module file.
An object for streaming information from a record.
bool readBool()
Read a boolean value, advancing Idx.
uint32_t readUInt32()
Read a 32-bit unsigned value; required to satisfy BasicReader.
llvm::APFloat readAPFloat(const llvm::fltSemantics &Sem)
Read an arbitrary constant value, advancing Idx.
TemplateArgumentLoc readTemplateArgumentLoc()
Reads a TemplateArgumentLoc, advancing Idx.
void readTypeLoc(TypeLoc TL, LocSeq *Seq=nullptr)
Reads the location information for a type.
void readUnresolvedSet(LazyASTUnresolvedSet &Set)
Read a UnresolvedSet structure, advancing Idx.
void readTemplateArgumentList(SmallVectorImpl< TemplateArgument > &TemplArgs, bool Canonicalize=false)
Read a template argument array, advancing Idx.
void readQualifierInfo(QualifierInfo &Info)
DeclarationNameLoc readDeclarationNameLoc(DeclarationName Name)
Read a declaration name, advancing Idx.
CXXBaseSpecifier readCXXBaseSpecifier()
Read a C++ base specifier, advancing Idx.
Expected< unsigned > readRecord(llvm::BitstreamCursor &Cursor, unsigned AbbrevID)
Reads a record with id AbbrevID from Cursor, resetting the internal state.
DeclarationNameInfo readDeclarationNameInfo()
IdentifierInfo * readIdentifier()
TemplateArgumentLocInfo readTemplateArgumentLocInfo(TemplateArgument::ArgKind Kind)
Reads a TemplateArgumentLocInfo appropriate for the given TemplateArgument kind, advancing Idx.
TemplateArgument readTemplateArgument(bool Canonicalize)
ASTContext & getContext()
Retrieve the AST context that this AST reader supplements.
TypeSourceInfo * readTypeSourceInfo()
Reads a declarator info from the given record, advancing Idx.
void readTemplateArgumentListInfo(TemplateArgumentListInfo &Result)
TypeCoupledDeclRefInfo readTypeCoupledDeclRefInfo()
void skipInts(unsigned N)
Skips the specified number of values.
GlobalDeclID readDeclID()
Reads a declaration ID from the given position in this record.
SourceRange readSourceRange(LocSeq *Seq=nullptr)
Read a source range, advancing Idx.
NestedNameSpecifierLoc readNestedNameSpecifierLoc()
Return a nested name specifier, advancing Idx.
ConceptReference * readConceptReference()
void readOMPChildren(OMPChildren *Data)
Read an OpenMP children, advancing Idx.
OMPClause * readOMPClause()
Read an OpenMP clause, advancing Idx.
void readOpenACCClauseList(MutableArrayRef< const OpenACCClause * > Clauses)
Read a list of OpenACC clauses into the passed SmallVector.
OMPTraitInfo * readOMPTraitInfo()
Read an OMPTraitInfo object, advancing Idx.
TemplateParameterList * readTemplateParameterList()
Read a template parameter list, advancing Idx.
OpenACCClause * readOpenACCClause()
Read an OpenACC clause, advancing Idx.
llvm::SmallVector< Expr * > readOpenACCVarList()
Read a list of Exprs used for a var-list.
CXXCtorInitializer ** readCXXCtorInitializers()
Read a CXXCtorInitializer array, advancing Idx.
Stmt * readStmt()
Reads a statement.
const ASTTemplateArgumentListInfo * readASTTemplateArgumentListInfo()
uint64_t readInt()
Returns the current value in this record, and advances to the next value.
Attr * readAttr()
Reads one attribute from the current stream position, advancing Idx.
Expr * readExpr()
Reads an expression.
SourceLocation readSourceLocation(LocSeq *Seq=nullptr)
Read a source location, advancing Idx.
llvm::SmallVector< Expr * > readOpenACCIntExprList()
Read a list of Exprs used for a int-expr-list.
Expr * readSubExpr()
Reads a sub-expression operand during statement reading.
Abstracts clang modules and precompiled header files and holds everything needed to generate debug in...
Wrapper for source info for array parameter types.
Wrapper for source info for arrays.
void setLBracketLoc(SourceLocation Loc)
void setRBracketLoc(SourceLocation Loc)
void setSizeExpr(Expr *Size)
void setRParenLoc(SourceLocation Loc)
void setLParenLoc(SourceLocation Loc)
void setKWLoc(SourceLocation Loc)
Attr - This represents one attribute.
Type source information for an attributed type.
void setAttr(const Attr *A)
void setConceptReference(ConceptReference *CR)
void setRParenLoc(SourceLocation Loc)
Type source information for an btf_tag attributed type.
Wrapper for source info for block pointers.
void setCaretLoc(SourceLocation Loc)
Wrapper for source info for builtin types.
void setWrittenTypeSpec(TypeSpecifierType written)
bool needsExtraLocalData() const
void setModeAttr(bool written)
void setBuiltinLoc(SourceLocation Loc)
void setWrittenWidthSpec(TypeSpecifierWidth written)
void setWrittenSignSpec(TypeSpecifierSign written)
Represents a base class of a C++ class.
Represents a C++ constructor within a class.
Represents a C++ base or member initializer.
void setSourceOrder(int Pos)
Set the source order of this initializer.
Represents a C++ destructor within a class.
Represents a C++ struct/union/class.
Decl * getLambdaContextDecl() const
Retrieve the declaration that provides additional context for a lambda, when the normal declaration c...
unsigned getLambdaIndexInContext() const
Retrieve the index of this lambda within the context declaration returned by getLambdaContextDecl().
base_class_iterator bases_begin()
base_class_iterator vbases_begin()
Represents a C++ temporary.
static CXXTemporary * Create(const ASTContext &C, const CXXDestructorDecl *Destructor)
bool visitInputFile(StringRef Filename, bool isSystem, bool isOverridden, bool isExplicitModule) override
if needsInputFileVisitation returns true, this is called for each non-system input file of the AST Fi...
bool ReadFullVersionInformation(StringRef FullVersion) override
Receives the full Clang version information.
bool ReadHeaderSearchOptions(const HeaderSearchOptions &HSOpts, StringRef ModuleFilename, StringRef SpecificModuleCachePath, bool Complain) override
Receives the header search options.
bool ReadFileSystemOptions(const FileSystemOptions &FSOpts, bool Complain) override
Receives the file system options.
void ReadCounter(const serialization::ModuleFile &M, unsigned Value) override
Receives COUNTER value.
void ReadModuleMapFile(StringRef ModuleMapPath) override
bool ReadLanguageOptions(const LangOptions &LangOpts, StringRef ModuleFilename, bool Complain, bool AllowCompatibleDifferences) override
Receives the language options.
bool ReadTargetOptions(const TargetOptions &TargetOpts, StringRef ModuleFilename, bool Complain, bool AllowCompatibleDifferences) override
Receives the target options.
void ReadModuleName(StringRef ModuleName) override
bool needsInputFileVisitation() override
Returns true if this ASTReaderListener wants to receive the input files of the AST file via visitInpu...
bool ReadPreprocessorOptions(const PreprocessorOptions &PPOpts, StringRef ModuleFilename, bool ReadMacros, bool Complain, std::string &SuggestedPredefines) override
Receives the preprocessor options.
void readModuleFileExtension(const ModuleFileExtensionMetadata &Metadata) override
Indicates that a particular module file extension has been read.
void visitModuleFile(StringRef Filename, serialization::ModuleKind Kind) override
This is called for each AST file loaded.
bool ReadDiagnosticOptions(IntrusiveRefCntPtr< DiagnosticOptions > DiagOpts, StringRef ModuleFilename, bool Complain) override
Receives the diagnostic options.
bool needsSystemInputFileVisitation() override
Returns true if this ASTReaderListener wants to receive the system input files of the AST file via vi...
A reference to a concept and its template args, as it appears in the code.
static ConceptReference * Create(const ASTContext &C, NestedNameSpecifierLoc NNS, SourceLocation TemplateKWLoc, DeclarationNameInfo ConceptNameInfo, NamedDecl *FoundDecl, ConceptDecl *NamedConcept, const ASTTemplateArgumentListInfo *ArgsAsWritten)
const TypeClass * getTypePtr() const
An object that helps properly build a continuous range map from a set of values.
A map from continuous integer ranges to some value, with a very specialized interface.
void insertOrReplace(const value_type &Val)
typename Representation::const_iterator const_iterator
typename Representation::iterator iterator
Wrapper for source info for pointers decayed from arrays and functions.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
lookup_result lookup(DeclarationName Name) const
lookup - Find the declarations (if any) with the given Name in this context.
bool hasExternalVisibleStorage() const
Whether this DeclContext has external storage containing additional declarations that are visible in ...
DeclContext * getRedeclContext()
getRedeclContext - Retrieve the context in which an entity conflicts with other entities of the same ...
void setMustBuildLookupTable()
Mark that there are external lexical declarations that we need to include in our lookup table (and th...
bool hasExternalLexicalStorage() const
Whether this DeclContext has external storage containing additional declarations that are lexically i...
DeclContext * getPrimaryContext()
getPrimaryContext - There may be many different declarations of the same entity (including forward de...
decl_range decls() const
decls_begin/decls_end - Iterate over the declarations stored in this context.
void setHasExternalLexicalStorage(bool ES=true) const
State whether this DeclContext has external storage for declarations lexically in this context.
bool isDeclInLexicalTraversal(const Decl *D) const
Determine whether the given declaration is stored in the list of declarations lexically within this c...
decl_iterator decls_begin() const
unsigned getModuleFileIndex() const
DeclID getRawValue() const
unsigned getLocalDeclIndex() const
uint64_t DeclID
An ID number that refers to a declaration in an AST file.
Decl - This represents one declaration (or definition), e.g.
Decl * getPreviousDecl()
Retrieve the previous declaration that declares the same entity as this declaration,...
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
void setInvalidDecl(bool Invalid=true)
setInvalidDecl - Indicates the Decl had a semantic error.
bool isUnconditionallyVisible() const
Determine whether this declaration is definitely visible to name lookup, independent of whether the o...
Kind
Lists the kind of concrete classes of Decl.
bool isCanonicalDecl() const
Whether this particular Decl is a canonical one.
Module * getOwningModule() const
Get the module that owns this declaration (for visibility purposes).
Module * getImportedOwningModule() const
Get the imported owning module, if this decl is from an imported (non-local) module.
bool isFromASTFile() const
Determine whether this declaration came from an AST file (such as a precompiled header or module) rat...
SourceLocation getLocation() const
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl.
DeclContext * getDeclContext()
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC).
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
GlobalDeclID getGlobalID() const
Retrieve the global declaration ID associated with this declaration, which specifies where this Decl ...
void setVisibleDespiteOwningModule()
Set that this declaration is globally visible, even if it came from a module that is not visible.
DeclarationNameLoc - Additional source/type location info for a declaration name.
static DeclarationNameLoc makeNamedTypeLoc(TypeSourceInfo *TInfo)
Construct location information for a constructor, destructor or conversion operator.
static DeclarationNameLoc makeCXXLiteralOperatorNameLoc(SourceLocation Loc)
Construct location information for a literal C++ operator.
static DeclarationNameLoc makeCXXOperatorNameLoc(SourceLocation BeginLoc, SourceLocation EndLoc)
Construct location information for a non-literal C++ operator.
The name of a declaration.
NameKind
The kind of the name stored in this DeclarationName.
@ CXXConversionFunctionName
Represents a ValueDecl that came out of a declarator.
void setRParenLoc(SourceLocation Loc)
void setDecltypeLoc(SourceLocation Loc)
void setTemplateNameLoc(SourceLocation Loc)
void setAttrNameLoc(SourceLocation loc)
void setAttrOperandParensRange(SourceRange range)
void setAttrExprOperand(Expr *e)
void setNameLoc(SourceLocation Loc)
void setElaboratedKeywordLoc(SourceLocation Loc)
void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
void setNameLoc(SourceLocation Loc)
void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
unsigned getNumArgs() const
void setTemplateKeywordLoc(SourceLocation Loc)
void setElaboratedKeywordLoc(SourceLocation Loc)
void setRAngleLoc(SourceLocation Loc)
void setLAngleLoc(SourceLocation Loc)
void setArgLocInfo(unsigned i, TemplateArgumentLocInfo AI)
void setTemplateNameLoc(SourceLocation Loc)
ArrayRef< TemplateArgument > template_arguments() const
void setNameLoc(SourceLocation Loc)
A little helper class used to produce diagnostics.
Carries a Clang diagnostic in an llvm::Error.
static llvm::Error create(SourceLocation Loc, PartialDiagnostic Diag)
Creates a new DiagnosticError that contains the given diagnostic at the given location.
bool wasUpgradedFromWarning() const
Whether this mapping attempted to map the diagnostic to a warning, but was overruled because the diag...
bool isErrorOrFatal() const
void setSeverity(diag::Severity Value)
static DiagnosticMapping deserialize(unsigned Bits)
Deserialize a mapping.
void setUpgradedFromWarning(bool Value)
Options for controlling the compiler diagnostics engine.
std::vector< std::string > SystemHeaderWarningsModules
The list of -Wsystem-headers-in-module=... options used to override whether -Wsystem-headers is enabl...
Concrete class used by the front-end to report problems and issues.
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.
DiagnosticOptions & getDiagnosticOptions() const
Retrieve the diagnostic options.
bool getEnableAllWarnings() const
Level
The level of the diagnostic, after it has been through mapping.
Level getDiagnosticLevel(unsigned DiagID, SourceLocation Loc) const
Based on the way the client configured the DiagnosticsEngine object, classify the specified diagnosti...
bool getSuppressSystemWarnings() const
bool getWarningsAsErrors() const
diag::Severity getExtensionHandlingBehavior() const
const IntrusiveRefCntPtr< DiagnosticIDs > & getDiagnosticIDs() const
StringRef getName() const
void setElaboratedKeywordLoc(SourceLocation Loc)
void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
Wrapper for source info for enum types.
This represents one expression.
RAII class for safely pairing a StartedDeserializing call with FinishedDeserializing.
MemoryBufferSizes getMemoryBufferSizes() const
Return the amount of memory used by memory buffers, breaking down by heap-backed versus mmap'ed memor...
uint32_t getGeneration() const
Get the current generation of this AST source.
Represents difference between two FPOptions values.
static FPOptionsOverride getFromOpaqueInt(storage_type I)
FPOptions applyOverrides(FPOptions Base)
static FPOptions getFromOpaqueInt(storage_type Value)
Represents a member of a struct/union/class.
A reference to a FileEntry that includes the name of the file as it was accessed by the FileManager's...
time_t getModificationTime() const
StringRef getName() const
The name of this FileEntry.
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
Implements support for file system lookup, file system caching, and directory search management.
llvm::vfs::FileSystem & getVirtualFileSystem() const
llvm::ErrorOr< std::unique_ptr< llvm::MemoryBuffer > > getBufferForFile(FileEntryRef Entry, bool isVolatile=false, bool RequiresNullTerminator=true, std::optional< int64_t > MaybeLimit=std::nullopt, bool IsText=true)
Open the specified file as a MemoryBuffer, returning a new MemoryBuffer if successful,...
OptionalFileEntryRef getOptionalFileRef(StringRef Filename, bool OpenFile=false, bool CacheFailure=true)
Get a FileEntryRef if it exists, without doing anything on error.
FileEntryRef getVirtualFileRef(StringRef Filename, off_t Size, time_t ModificationTime)
Retrieve a file entry for a "virtual" file that acts as if there were a file with the given name on d...
Keeps track of options that affect how file operations are performed.
std::string WorkingDir
If set, paths are resolved as if the working directory was set to the value of WorkingDir.
Represents a function declaration or definition.
void setLazyBody(uint64_t Offset)
Represents a prototype with parameter type info, e.g.
ExtProtoInfo getExtProtoInfo() const
Wrapper for source info for functions.
unsigned getNumParams() const
void setLocalRangeBegin(SourceLocation L)
void setLParenLoc(SourceLocation Loc)
void setParam(unsigned i, ParmVarDecl *VD)
void setRParenLoc(SourceLocation Loc)
void setLocalRangeEnd(SourceLocation L)
void setExceptionSpecRange(SourceRange R)
static std::pair< GlobalModuleIndex *, llvm::Error > readIndex(llvm::StringRef Path)
Read a global index file for the given directory.
Type source information for HLSL attributed resource type.
One of these records is kept for each identifier that is lexed.
unsigned getBuiltinID() const
Return a value indicating whether this is a builtin function.
bool isCPlusPlusOperatorKeyword() const
tok::TokenKind getTokenID() const
If this is a source-language token (e.g.
bool hadMacroDefinition() const
Returns true if this identifier was #defined to some value at any moment.
void setIsPoisoned(bool Value=true)
setIsPoisoned - Mark this identifier as poisoned.
bool isFromAST() const
Return true if the identifier in its current state was loaded from an AST file.
bool isPoisoned() const
Return true if this token has been poisoned.
bool hasRevertedTokenIDToIdentifier() const
True if revertTokenIDToIdentifier() was called.
tok::NotableIdentifierKind getNotableIdentifierID() const
void setOutOfDate(bool OOD)
Set whether the information for this identifier is out of date with respect to the external source.
tok::ObjCKeywordKind getObjCKeywordID() const
Return the Objective-C keyword ID for the this identifier.
void setObjCOrBuiltinID(unsigned ID)
void revertTokenIDToIdentifier()
Revert TokenID to tok::identifier; used for GNU libstdc++ 4.2 compatibility.
bool isOutOfDate() const
Determine whether the information for this identifier is out of date with respect to the external sou...
void setChangedSinceDeserialization()
Note that this identifier has changed since it was loaded from an AST file.
void * getFETokenInfo() const
Get and set FETokenInfo.
StringRef getName() const
Return the actual identifier string.
bool isExtensionToken() const
get/setExtension - Initialize information about whether or not this language token is an extension.
An iterator that walks over all of the known identifiers in the lookup table.
IdentifierResolver - Keeps track of shadowed decls on enclosing scopes.
void RemoveDecl(NamedDecl *D)
RemoveDecl - Unlink the decl from its shadowed decl chain.
bool tryAddTopLevelDecl(NamedDecl *D, DeclarationName Name)
Try to add the given declaration to the top level scope, if it (or a redeclaration of it) hasn't alre...
llvm::iterator_range< iterator > decls(DeclarationName Name)
Returns a range of decls with the name 'Name'.
Implements an efficient mapping from strings to IdentifierInfo nodes.
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
In-memory cache for modules.
llvm::MemoryBuffer * lookupPCM(llvm::StringRef Filename) const
Get a pointer to the pCM if it exists; else nullptr.
Record the location of an inclusion directive, such as an #include or #import statement.
InclusionKind
The kind of inclusion directives known to the preprocessor.
Represents a field injected from an anonymous union/struct into the parent scope.
Wrapper for source info for injected class names of class templates.
void setAmpLoc(SourceLocation Loc)
PragmaMSPointersToMembersKind
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
clang::ObjCRuntime ObjCRuntime
SanitizerSet Sanitize
Set of enabled sanitizers.
CommentOptions CommentOpts
Options for parsing comments.
std::string OMPHostIRFile
Name of the IR file that contains the result of the OpenMP target host code generation.
std::vector< llvm::Triple > OMPTargetTriples
Triples of the OpenMP targets that the host code codegen should take into account in order to generat...
std::string CurrentModule
The name of the current module, of which the main source file is a part.
std::vector< std::string > ModuleFeatures
The names of any features to enable in module 'requires' decls in addition to the hard-coded list in ...
An UnresolvedSet-like class that might not have been loaded from the external AST source yet.
Used to hold and unique data used to represent #line information.
unsigned getLineTableFilenameID(StringRef Str)
void AddEntry(FileID FID, const std::vector< LineEntry > &Entries)
Add a new line entry that has already been encoded into the internal representation of the line table...
static LocalDeclID get(ASTReader &Reader, serialization::ModuleFile &MF, DeclID ID)
Record the location of a macro definition.
Encapsulates changes to the "macros namespace" (the location where the macro name became active,...
void setPrevious(MacroDirective *Prev)
Set previous definition of the macro with the same name.
Records the location of a macro expansion.
Encapsulates the data about a macro definition (e.g.
void setUsedForHeaderGuard(bool Val)
void setHasCommaPasting()
void setDefinitionEndLoc(SourceLocation EndLoc)
Set the location of the last token in the macro.
void setParameterList(ArrayRef< IdentifierInfo * > List, llvm::BumpPtrAllocator &PPAllocator)
Set the specified list of identifiers as the parameter list for this macro.
llvm::MutableArrayRef< Token > allocateTokens(unsigned NumTokens, llvm::BumpPtrAllocator &PPAllocator)
void setIsFunctionLike()
Function/Object-likeness.
void setIsC99Varargs()
Varargs querying methods. This can only be set for function-like macros.
void setIsUsed(bool Val)
Set the value of the IsUsed flag.
void setExpansionLoc(SourceLocation Loc)
void setAttrRowOperand(Expr *e)
void setAttrColumnOperand(Expr *e)
void setAttrOperandParensRange(SourceRange range)
void setAttrNameLoc(SourceLocation loc)
Wrapper for source info for member pointers.
void setStarLoc(SourceLocation Loc)
void setClassTInfo(TypeSourceInfo *TI)
void addLinkAsDependency(Module *Mod)
Make module to use export_as as the link dependency name if enough information is available or add it...
void setUmbrellaDirAsWritten(Module *Mod, DirectoryEntryRef UmbrellaDir, const Twine &NameAsWritten, const Twine &PathRelativeToRootModuleDirectory)
Sets the umbrella directory of the given module to the given directory.
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.
OptionalDirectoryEntryRef Directory
The build directory of this module.
unsigned NamedModuleHasInit
Whether this C++20 named modules doesn't need an initializer.
unsigned ConfigMacrosExhaustive
Whether the set of configuration macros is exhaustive.
std::string PresumedModuleMapFile
The presumed file name for the module map defining this module.
ASTFileSignature Signature
The module signature.
unsigned InferExportWildcard
Whether, when inferring submodules, the inferr submodules should export all modules they import (e....
void getExportedModules(SmallVectorImpl< Module * > &Exported) const
Appends this module's list of exported modules to Exported.
std::vector< UnresolvedConflict > UnresolvedConflicts
The list of conflicts for which the module-id has not yet been resolved.
unsigned IsFromModuleFile
Whether this module was loaded from a module file.
llvm::PointerIntPair< Module *, 1, bool > ExportDecl
Describes an exported module.
std::optional< DirectoryName > getUmbrellaDirAsWritten() const
Retrieve the umbrella directory as written.
std::string ExportAsModule
The module through which entities defined in this module will eventually be exposed,...
unsigned IsAvailable
Whether this module is available in the current translation unit.
unsigned InferExplicitSubmodules
Whether, when inferring submodules, the inferred submodules should be explicit.
OptionalFileEntryRef getASTFile() const
The serialized AST file for this module, if one was created.
std::vector< Conflict > Conflicts
The list of conflicts.
This represents a decl that may have a name.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
Represents a C++ namespace alias.
Represent a C++ namespace.
Class that aids in the construction of nested-name-specifiers along with source-location information ...
A C++ nested-name-specifier augmented with source location information.
@ NamespaceAlias
A namespace alias, stored as a NamespaceAliasDecl*.
@ TypeSpec
A type, stored as a Type*.
@ TypeSpecWithTemplate
A type that was preceded by the 'template' keyword, stored as a Type*.
@ Super
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in.
@ Identifier
An identifier, stored as an IdentifierInfo*.
@ Global
The global specifier '::'. There is no stored value.
@ Namespace
A namespace, stored as a NamespaceDecl*.
static std::string getOwningModuleNameForDiagnostic(const Decl *D)
Get the best name we know for the module that owns the given declaration, or an empty string if the d...
This represents the 'absent' clause in the '#pragma omp assume' directive.
static OMPAbsentClause * CreateEmpty(const ASTContext &C, unsigned NumKinds)
This represents 'acq_rel' clause in the '#pragma omp atomic|flush' directives.
This represents 'acquire' clause in the '#pragma omp atomic|flush' directives.
This represents clause 'affinity' in the '#pragma omp task'-based directives.
static OMPAffinityClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N locator items.
This represents the 'align' clause in the '#pragma omp allocate' directive.
This represents clause 'aligned' in the '#pragma omp ...' directives.
static OMPAlignedClause * CreateEmpty(const ASTContext &C, unsigned NumVars)
Creates an empty clause with the place for NumVars variables.
This represents clause 'allocate' in the '#pragma omp ...' directives.
static OMPAllocateClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N variables.
This represents 'allocator' clause in the '#pragma omp ...' directive.
This represents 'at' clause in the '#pragma omp error' directive.
This represents 'atomic_default_mem_order' clause in the '#pragma omp requires' directive.
This represents 'bind' clause in the '#pragma omp ...' directives.
static OMPBindClause * CreateEmpty(const ASTContext &C)
Build an empty 'bind' clause.
This represents 'capture' clause in the '#pragma omp atomic' directive.
Contains data for OpenMP directives: clauses, children expressions/statements (helpers for codegen) a...
void VisitOMPClauseWithPostUpdate(OMPClauseWithPostUpdate *C)
OMPClauseReader(ASTRecordReader &Record)
void VisitOMPClauseWithPreInit(OMPClauseWithPreInit *C)
RetTy Visit(PTR(OMPClause) S)
Class that handles post-update expression for some clauses, like 'lastprivate', 'reduction' etc.
Class that handles pre-initialization statement for some clauses, like 'schedule',...
This is a basic class for representing single OpenMP clause.
This represents 'collapse' clause in the '#pragma omp ...' directive.
This represents 'compare' clause in the '#pragma omp atomic' directive.
This represents the 'contains' clause in the '#pragma omp assume' directive.
static OMPContainsClause * CreateEmpty(const ASTContext &C, unsigned NumKinds)
This represents clause 'copyin' in the '#pragma omp ...' directives.
static OMPCopyinClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with N variables.
This represents clause 'copyprivate' in the '#pragma omp ...' directives.
static OMPCopyprivateClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with N variables.
This represents 'default' clause in the '#pragma omp ...' directive.
This represents 'defaultmap' clause in the '#pragma omp ...' directive.
This represents implicit clause 'depend' for the '#pragma omp task' directive.
static OMPDependClause * CreateEmpty(const ASTContext &C, unsigned N, unsigned NumLoops)
Creates an empty clause with N variables.
This represents implicit clause 'depobj' for the '#pragma omp depobj' directive.
static OMPDepobjClause * CreateEmpty(const ASTContext &C)
Creates an empty clause.
This represents 'destroy' clause in the '#pragma omp depobj' directive or the '#pragma omp interop' d...
This represents 'detach' clause in the '#pragma omp task' directive.
This represents 'device' clause in the '#pragma omp ...' directive.
This represents 'dist_schedule' clause in the '#pragma omp ...' directive.
This represents the 'doacross' clause for the '#pragma omp ordered' directive.
static OMPDoacrossClause * CreateEmpty(const ASTContext &C, unsigned N, unsigned NumLoops)
Creates an empty clause with N expressions.
This represents 'dynamic_allocators' clause in the '#pragma omp requires' directive.
This represents clause 'exclusive' in the '#pragma omp scan' directive.
static OMPExclusiveClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N variables.
This represents 'fail' clause in the '#pragma omp atomic' directive.
This represents 'filter' clause in the '#pragma omp ...' directive.
This represents 'final' clause in the '#pragma omp ...' directive.
This represents clause 'firstprivate' in the '#pragma omp ...' directives.
static OMPFirstprivateClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N variables.
This represents implicit clause 'flush' for the '#pragma omp flush' directive.
static OMPFlushClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with N variables.
This represents clause 'from' in the '#pragma omp ...' directives.
static OMPFromClause * CreateEmpty(const ASTContext &C, const OMPMappableExprListSizeTy &Sizes)
Creates an empty clause with the place for NumVars variables.
Representation of the 'full' clause of the '#pragma omp unroll' directive.
static OMPFullClause * CreateEmpty(const ASTContext &C)
Build an empty 'full' AST node for deserialization.
This represents 'grainsize' clause in the '#pragma omp ...' directive.
This represents clause 'has_device_ptr' in the '#pragma omp ...' directives.
static OMPHasDeviceAddrClause * CreateEmpty(const ASTContext &C, const OMPMappableExprListSizeTy &Sizes)
Creates an empty clause with the place for NumVars variables.
This represents 'hint' clause in the '#pragma omp ...' directive.
This represents the 'holds' clause in the '#pragma omp assume' directive.
This represents 'if' clause in the '#pragma omp ...' directive.
This represents clause 'in_reduction' in the '#pragma omp task' directives.
static OMPInReductionClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N variables.
This represents clause 'inclusive' in the '#pragma omp scan' directive.
static OMPInclusiveClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N variables.
This represents the 'init' clause in '#pragma omp ...' directives.
static OMPInitClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with N expressions.
This represents clause 'is_device_ptr' in the '#pragma omp ...' directives.
static OMPIsDevicePtrClause * CreateEmpty(const ASTContext &C, const OMPMappableExprListSizeTy &Sizes)
Creates an empty clause with the place for NumVars variables.
This represents clause 'lastprivate' in the '#pragma omp ...' directives.
static OMPLastprivateClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N variables.
This represents clause 'linear' in the '#pragma omp ...' directives.
static OMPLinearClause * CreateEmpty(const ASTContext &C, unsigned NumVars)
Creates an empty clause with the place for NumVars variables.
This represents clause 'map' in the '#pragma omp ...' directives.
static OMPMapClause * CreateEmpty(const ASTContext &C, const OMPMappableExprListSizeTy &Sizes)
Creates an empty clause with the place for NumVars original expressions, NumUniqueDeclarations declar...
This represents 'mergeable' clause in the '#pragma omp ...' directive.
This represents 'message' clause in the '#pragma omp error' directive.
This represents the 'no_openmp' clause in the '#pragma omp assume' directive.
This represents the 'no_openmp_routines' clause in the '#pragma omp assume' directive.
This represents the 'no_parallelism' clause in the '#pragma omp assume' directive.
This represents 'nocontext' clause in the '#pragma omp ...' directive.
This represents 'nogroup' clause in the '#pragma omp ...' directive.
This represents clause 'nontemporal' in the '#pragma omp ...' directives.
static OMPNontemporalClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N variables.
This represents 'novariants' clause in the '#pragma omp ...' directive.
This represents 'nowait' clause in the '#pragma omp ...' directive.
This represents 'num_tasks' clause in the '#pragma omp ...' directive.
This represents 'num_teams' clause in the '#pragma omp ...' directive.
static OMPNumTeamsClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with N variables.
This represents 'num_threads' clause in the '#pragma omp ...' directive.
This represents 'order' clause in the '#pragma omp ...' directive.
This represents 'ordered' clause in the '#pragma omp ...' directive.
static OMPOrderedClause * CreateEmpty(const ASTContext &C, unsigned NumLoops)
Build an empty clause.
Representation of the 'partial' clause of the '#pragma omp unroll' directive.
static OMPPartialClause * CreateEmpty(const ASTContext &C)
Build an empty 'partial' AST node for deserialization.
This 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 'seq_cst' clause in the '#pragma omp atomic|flush' directives.
This represents 'severity' clause in the '#pragma omp error' directive.
This represents clause 'shared' in the '#pragma omp ...' directives.
static OMPSharedClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with N variables.
This represents 'simdlen' clause in the '#pragma omp ...' directive.
This represents the 'sizes' clause in the '#pragma omp tile' directive.
static OMPSizesClause * CreateEmpty(const ASTContext &C, unsigned NumSizes)
Build an empty 'sizes' AST node for deserialization.
This represents clause 'task_reduction' in the '#pragma omp taskgroup' directives.
static OMPTaskReductionClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N variables.
This represents 'thread_limit' clause in the '#pragma omp ...' directive.
static OMPThreadLimitClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with N variables.
This represents 'threads' clause in the '#pragma omp ...' directive.
This represents clause 'to' in the '#pragma omp ...' directives.
static OMPToClause * CreateEmpty(const ASTContext &C, const OMPMappableExprListSizeTy &Sizes)
Creates an empty clause with the place for NumVars variables.
Helper data structure representing the traits in a match clause of an declare variant or metadirectiv...
llvm::SmallVector< OMPTraitSet, 2 > Sets
The outermost level of selector sets.
This represents 'unified_address' clause in the '#pragma omp requires' directive.
This represents 'unified_shared_memory' clause in the '#pragma omp requires' directive.
This represents 'untied' clause in the '#pragma omp ...' directive.
This represents 'update' clause in the '#pragma omp atomic' directive.
static OMPUpdateClause * CreateEmpty(const ASTContext &C, bool IsExtended)
Creates an empty clause with the place for N variables.
This represents the 'use' clause in '#pragma omp ...' directives.
This represents clause 'use_device_addr' in the '#pragma omp ...' directives.
static OMPUseDeviceAddrClause * CreateEmpty(const ASTContext &C, const OMPMappableExprListSizeTy &Sizes)
Creates an empty clause with the place for NumVars variables.
This represents clause 'use_device_ptr' in the '#pragma omp ...' directives.
static OMPUseDevicePtrClause * CreateEmpty(const ASTContext &C, const OMPMappableExprListSizeTy &Sizes)
Creates an empty clause with the place for NumVars variables.
This represents clause 'uses_allocators' in the '#pragma omp target'-based directives.
static OMPUsesAllocatorsClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N allocators.
This represents 'weak' clause in the '#pragma omp atomic' directives.
This represents 'write' clause in the '#pragma omp atomic' directive.
This represents 'ompx_attribute' clause in a directive that might generate an outlined function.
This represents 'ompx_bare' clause in the '#pragma omp target teams ...' directive.
This represents 'ompx_dyn_cgroup_mem' clause in the '#pragma omp target ...' directive.
method_range methods() const
Represents an ObjC class declaration.
Wrapper for source info for ObjC interfaces.
void setNameLoc(SourceLocation Loc)
void setNameEndLoc(SourceLocation Loc)
Interfaces are the core concept in Objective-C for object oriented design.
ObjCIvarDecl - Represents an ObjC instance variable.
ObjCMethodDecl - Represents an instance or class method declaration.
bool hasBody() const override
Determine whether this method has a body.
Selector getSelector() const
bool isInstanceMethod() const
void setLazyBody(uint64_t Offset)
Wraps an ObjCPointerType with source location information.
void setStarLoc(SourceLocation Loc)
void setTypeArgsRAngleLoc(SourceLocation Loc)
unsigned getNumTypeArgs() const
unsigned getNumProtocols() const
void setTypeArgsLAngleLoc(SourceLocation Loc)
void setTypeArgTInfo(unsigned i, TypeSourceInfo *TInfo)
void setProtocolLAngleLoc(SourceLocation Loc)
void setProtocolRAngleLoc(SourceLocation Loc)
void setHasBaseTypeAsWritten(bool HasBaseType)
void setProtocolLoc(unsigned i, SourceLocation Loc)
Represents an Objective-C protocol declaration.
The basic abstraction for the target Objective-C runtime.
Kind
The basic Objective-C runtimes that we know about.
ProtocolLAngleLoc, ProtocolRAngleLoc, and the source locations for protocol qualifiers are stored aft...
unsigned getNumProtocols() const
void setProtocolLoc(unsigned i, SourceLocation Loc)
void setProtocolLAngleLoc(SourceLocation Loc)
void setProtocolRAngleLoc(SourceLocation Loc)
static OpenACCAsyncClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCAttachClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCAutoClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
This is the base type for all OpenACC Clauses.
static 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, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCopyInClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, bool IsReadOnly, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCopyOutClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, bool IsZero, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCreateClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, bool IsZero, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDefaultClause * Create(const ASTContext &C, OpenACCDefaultClauseKind K, SourceLocation BeginLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
static 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 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 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, SourceLocation EndLoc)
static OpenACCGangClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< OpenACCGangKind > GangKinds, ArrayRef< Expr * > IntExprs, 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 OpenACCNoCreateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCNumGangsClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > IntExprs, SourceLocation EndLoc)
static OpenACCNumWorkersClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCPresentClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCPrivateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCReductionClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, OpenACCReductionOperator Operator, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCSelfClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *ConditionExpr, SourceLocation EndLoc)
static OpenACCSeqClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCTileClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > SizeExprs, SourceLocation EndLoc)
static OpenACCUseDeviceClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCVectorClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCVectorLengthClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCWaitClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *DevNumExpr, SourceLocation QueuesLoc, ArrayRef< Expr * > QueueIdExprs, SourceLocation EndLoc)
static OpenACCWorkerClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
This abstract interface provides operations for unwrapping containers for serialized ASTs (precompile...
virtual llvm::StringRef ExtractPCH(llvm::MemoryBufferRef Buffer) const =0
Returns the serialized AST inside the PCH container Buffer.
ASTReaderListener implementation to validate the information of the PCH file against an initialized P...
bool ReadLanguageOptions(const LangOptions &LangOpts, StringRef ModuleFilename, bool Complain, bool AllowCompatibleDifferences) override
Receives the language options.
bool ReadHeaderSearchOptions(const HeaderSearchOptions &HSOpts, StringRef ModuleFilename, StringRef SpecificModuleCachePath, bool Complain) override
Receives the header search options.
bool ReadDiagnosticOptions(IntrusiveRefCntPtr< DiagnosticOptions > DiagOpts, StringRef ModuleFilename, bool Complain) override
Receives the diagnostic options.
void ReadCounter(const serialization::ModuleFile &M, unsigned Value) override
Receives COUNTER value.
bool ReadPreprocessorOptions(const PreprocessorOptions &PPOpts, StringRef ModuleFilename, bool ReadMacros, bool Complain, std::string &SuggestedPredefines) override
Receives the preprocessor options.
bool ReadTargetOptions(const TargetOptions &TargetOpts, StringRef ModuleFilename, bool Complain, bool AllowCompatibleDifferences) override
Receives the target options.
void setEllipsisLoc(SourceLocation Loc)
void setEllipsisLoc(SourceLocation Loc)
void setRParenLoc(SourceLocation Loc)
void setLParenLoc(SourceLocation Loc)
Represents a parameter to a function.
void setKWLoc(SourceLocation Loc)
Wrapper for source info for pointers.
void setStarLoc(SourceLocation Loc)
Base class that describes a preprocessed entity, which may be a preprocessor directive or macro expan...
Iteration over the preprocessed entities.
A record of the steps taken while preprocessing a source file, including the various preprocessing di...
PreprocessorOptions - This class is used for passing the various options used in preprocessor initial...
std::vector< std::string > MacroIncludes
std::vector< std::string > Includes
ObjCXXARCStandardLibraryKind ObjCXXARCStandardLibrary
The Objective-C++ ARC standard library that we should support, by providing appropriate definitions t...
std::string PCHThroughHeader
If non-empty, the filename used in an #include directive in the primary source file (or command-line ...
bool DetailedRecord
Whether we should maintain a detailed record of all macro definitions and expansions.
std::string ImplicitPCHInclude
The implicit PCH included at the start of the translation unit, or empty.
bool AllowPCHWithDifferentModulesCachePath
When true, a PCH with modules cache path different to the current compilation will not be rejected.
bool UsePredefines
Initialize the preprocessor with the compiler and target specific predefines.
std::vector< std::pair< std::string, bool > > Macros
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
Module * getCurrentModule()
Retrieves the module that we're currently building, if any.
const TargetInfo & getTargetInfo() const
FileManager & getFileManager() const
PreprocessorOptions & getPreprocessorOpts() const
Retrieve the preprocessor options used to initialize this preprocessor.
HeaderSearch & getHeaderSearchInfo() const
IdentifierTable & getIdentifierTable()
const LangOptions & getLangOpts() const
void setCounterValue(unsigned V)
DiagnosticsEngine & getDiagnostics() const
A (possibly-)qualified type.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
Wrapper of type source information for a type with non-trivial direct qualifiers.
The collection of all-type qualifiers we support.
@ FastWidth
The width of the "fast" qualifier mask.
@ FastMask
The fast qualifier mask.
void setAmpAmpLoc(SourceLocation Loc)
Represents a struct/union/class.
Wrapper for source info for record types.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
Declaration of a redeclarable template.
void loadLazySpecializationsImpl(bool OnlyPartial=false) const
decl_type * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
void setPreviousDecl(decl_type *PrevDecl)
Set the previous declaration.
This table allows us to fully hide how we implement multi-keyword caching.
Selector getNullarySelector(const IdentifierInfo *ID)
Selector getSelector(unsigned NumArgs, const IdentifierInfo **IIV)
Can create any sort of selector.
Selector getUnarySelector(const IdentifierInfo *ID)
Smart pointer class that efficiently represents Objective-C method names.
void addMethodToGlobalList(ObjCMethodList *List, ObjCMethodDecl *Method)
Add the given method to the list of globally-known methods.
GlobalMethodPool MethodPool
Method Pool - allows efficient lookup when typechecking messages to "id".
Sema - This implements semantic analysis and AST building for C.
Scope * TUScope
Translation Unit Scope - useful to Objective-C actions that need to lookup file scope declarations in...
void runWithSufficientStackSpace(SourceLocation Loc, llvm::function_ref< void()> Fn)
Run some code with "sufficient" stack space.
void addExternalSource(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.
This object establishes a SourceLocationSequence.
Serialized encoding of a sequence of SourceLocations.
Encodes a location in the source.
static SourceLocation getFromRawEncoding(UIntTy Encoding)
Turn a raw encoding of a SourceLocation object into a real SourceLocation.
bool isValid() const
Return true if this is a valid SourceLocation object.
SourceLocation getLocWithOffset(IntTy Offset) const
Return a source location with the specified offset from this SourceLocation.
This class handles loading and caching of source files into memory.
SourceLocation getFileLoc(SourceLocation Loc) const
Given Loc, if it is a macro location return the expansion location or the spelling location,...
void setExternalSLocEntrySource(ExternalSLocEntrySource *Source)
std::pair< FileID, unsigned > getDecomposedLoc(SourceLocation Loc) const
Decompose the specified location into a raw FileID + Offset pair.
bool isBeforeInTranslationUnit(SourceLocation LHS, SourceLocation RHS) const
Determines the order of 2 source locations in the translation unit.
A trivial tuple used to represent a source range.
SourceLocation getEnd() const
SourceLocation getBegin() const
One instance of this struct is kept for every file loaded or used.
OptionalFileEntryRef ContentsEntry
References the file which the contents were actually loaded from.
std::optional< llvm::MemoryBufferRef > getBufferIfLoaded() const
Return the buffer, only if it has been loaded.
unsigned BufferOverridden
Indicates whether the buffer itself was provided to override the actual file contents.
OptionalFileEntryRef OrigEntry
Reference to the file entry representing this ContentCache.
Information about a FileID, basically just the logical file that it represents and include stack info...
void setHasLineDirectives()
Set the flag that indicates that this FileID has line table entries associated with it.
void runWithSufficientStackSpace(SourceLocation Loc, llvm::function_ref< void()> Fn)
Run some code with "sufficient" stack space.
Stmt - This represents one statement.
DiagnosticStorage * getStorage() const
Retrieve storage for this particular diagnostic.
Wrapper for substituted template type parameters.
Wrapper for substituted template type parameters.
Represents the declaration of a struct/union/class/enum.
TargetOptions & getTargetOpts() const
Retrieve the target options.
Options for controlling the target.
std::string Triple
The name of the target triple to compile for.
std::vector< std::string > Features
The list of target specific features to enable or disable – this should be a list of strings starting...
std::string ABI
If given, the name of the target ABI to use.
std::string TuneCPU
If given, the name of the target CPU to tune code for.
std::string CPU
If given, the name of the target CPU to generate code for.
std::vector< std::string > FeaturesAsWritten
The list of target specific features to enable or disable, as written on the command line.
A convenient class for passing around template argument information.
Location wrapper for a TemplateArgument.
Represents a template argument.
Expr * getAsExpr() const
Retrieve the template argument as an expression.
ArgKind
The kind of template argument we're storing.
@ Declaration
The template argument is a declaration that was provided for a pointer, reference,...
@ Template
The template argument is a template name that was provided for a template template parameter.
@ StructuralValue
The template argument is a non-type template argument that can't be represented by the special-case D...
@ Pack
The template argument is actually a parameter pack.
@ TemplateExpansion
The template argument is a pack expansion of a template name that was provided for a template templat...
@ NullPtr
The template argument is a null pointer or null pointer to member that was provided for a non-type te...
@ Type
The template argument is a type.
@ Null
Represents an empty template argument, e.g., one that has not been deduced.
@ Integral
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
@ Expression
The template argument is an expression, and we've not resolved it to one of the other forms yet,...
ArgKind getKind() const
Return the kind of stored template argument.
Stores a list of template parameters for a TemplateDecl and its derived classes.
static TemplateParameterList * Create(const ASTContext &C, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ArrayRef< NamedDecl * > Params, SourceLocation RAngleLoc, Expr *RequiresClause)
unsigned getNumArgs() const
void setArgLocInfo(unsigned i, TemplateArgumentLocInfo AI)
void setTemplateKeywordLoc(SourceLocation Loc)
void setTemplateNameLoc(SourceLocation Loc)
void setLAngleLoc(SourceLocation Loc)
void setRAngleLoc(SourceLocation Loc)
ArrayRef< TemplateArgument > template_arguments() const
Wrapper for template type parameters.
Token - This structure provides full information about a lexed token.
void setAnnotationEndLoc(SourceLocation L)
void setLength(unsigned Len)
void setKind(tok::TokenKind K)
tok::TokenKind getKind() const
void setLocation(SourceLocation L)
bool isAnnotation() const
Return true if this is any of tok::annot_* kind tokens.
void setAnnotationValue(void *val)
void startToken()
Reset all flags to cleared.
void setIdentifierInfo(IdentifierInfo *II)
void setFlag(TokenFlags Flag)
Set the specified flag.
[BoundsSafety] Represents information of declarations referenced by the arguments of the counted_by a...
void VisitArrayTypeLoc(ArrayTypeLoc)
void VisitFunctionTypeLoc(FunctionTypeLoc)
TypeLocReader(ASTRecordReader &Reader, LocSeq *Seq)
RetTy Visit(TypeLoc TyLoc)
Base wrapper for a particular "section" of type source info.
TypeLoc getNextTypeLoc() const
Get the next TypeLoc pointed by this TypeLoc, e.g for "int*" the TypeLoc is a PointerLoc and next Typ...
void setUnmodifiedTInfo(TypeSourceInfo *TI) const
A container of type source information.
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
void setNameLoc(SourceLocation Loc)
The base class of the type hierarchy.
const T * getAs() const
Member-template getAs<specific type>'.
Base class for declarations which introduce a typedef-name.
Wrapper for source info for typedefs.
void setLParenLoc(SourceLocation Loc)
void setTypeofLoc(SourceLocation Loc)
void setRParenLoc(SourceLocation Loc)
Wrapper for source info for unresolved typename using decls.
Wrapper for source info for types used via transparent aliases.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Represents a variable declaration or definition.
void setNameLoc(SourceLocation Loc)
Captures information about a #pragma weak directive.
Source location and bit offset of a declaration.
A key used when looking up entities by DeclarationName.
unsigned getHash() const
Compute a fingerprint of this key for use in on-disk hash table.
DeclarationNameKey()=default
Information about a module that has been loaded by the ASTReader.
const PPEntityOffset * PreprocessedEntityOffsets
void * IdentifierLookupTable
A pointer to an on-disk hash table of opaque type IdentifierHashTable.
void * SelectorLookupTable
A pointer to an on-disk hash table of opaque type ASTSelectorLookupTable.
std::vector< std::unique_ptr< ModuleFileExtensionReader > > ExtensionReaders
The list of extension readers that are attached to this module file.
SourceLocation DirectImportLoc
The source location where the module was explicitly or implicitly imported in the local translation u...
StringRef Data
The serialized bitstream data for this file.
const serialization::ObjCCategoriesInfo * ObjCCategoriesMap
Array of category list location information within this module file, sorted by the definition ID.
ContinuousRangeMap< uint32_t, int, 2 > PreprocessedEntityRemap
Remapping table for preprocessed entity IDs in this module.
int SLocEntryBaseID
The base ID in the source manager's view of this module.
serialization::IdentifierID BaseIdentifierID
Base identifier ID for identifiers local to this module.
serialization::PreprocessedEntityID BasePreprocessedEntityID
Base preprocessed entity ID for preprocessed entities local to this module.
serialization::TypeID BaseTypeIndex
Base type ID for types local to this module as represented in the global type ID space.
unsigned LocalNumObjCCategoriesInMap
The number of redeclaration info entries in ObjCCategoriesMap.
uint64_t MacroOffsetsBase
Base file offset for the offsets in MacroOffsets.
const llvm::support::unaligned_uint64_t * InputFileOffsets
Relative offsets for all of the input file entries in the AST file.
std::vector< unsigned > PreloadIdentifierOffsets
Offsets of identifiers that we're going to preload within IdentifierTableData.
unsigned LocalNumIdentifiers
The number of identifiers in this AST file.
llvm::BitstreamCursor DeclsCursor
DeclsCursor - This is a cursor to the start of the DECLTYPES_BLOCK block.
const unsigned char * IdentifierTableData
Actual data for the on-disk hash table of identifiers.
uint64_t SLocEntryOffsetsBase
Base file offset for the offsets in SLocEntryOffsets.
llvm::BitstreamCursor InputFilesCursor
The cursor to the start of the input-files block.
std::vector< InputFile > InputFilesLoaded
The input files that have been loaded from this AST file.
serialization::SelectorID BaseSelectorID
Base selector ID for selectors local to this module.
llvm::SetVector< ModuleFile * > ImportedBy
List of modules which depend on this module.
const char * HeaderFileInfoTableData
Actual data for the on-disk hash table of header file information.
SourceLocation ImportLoc
The source location where this module was first imported.
const serialization::unaligned_decl_id_t * FileSortedDecls
Array of file-level DeclIDs sorted by file.
const uint32_t * SLocEntryOffsets
Offsets for all of the source location entries in the AST file.
llvm::BitstreamCursor MacroCursor
The cursor to the start of the preprocessor block, which stores all of the macro definitions.
FileID OriginalSourceFileID
The file ID for the original source file that was used to build this AST file.
FileEntryRef File
The file entry for the module file.
std::string ActualOriginalSourceFileName
The actual original source file name that was used to build this AST file.
uint64_t PreprocessorDetailStartOffset
The offset of the start of the preprocessor detail cursor.
std::vector< InputFileInfo > InputFileInfosLoaded
The input file infos that have been loaded from this AST file.
unsigned LocalNumSubmodules
The number of submodules in this module.
SourceLocation FirstLoc
The first source location in this module.
ASTFileSignature ASTBlockHash
The signature of the AST block of the module file, this can be used to unique module files based on A...
uint64_t SourceManagerBlockStartOffset
The bit offset to the start of the SOURCE_MANAGER_BLOCK.
bool DidReadTopLevelSubmodule
Whether the top-level module has been read from the AST file.
std::string OriginalSourceFileName
The original source file name that was used to build the primary AST file, which may have been modifi...
bool isModule() const
Is this a module file for a module (rather than a PCH or similar).
bool HasTimestamps
Whether timestamps are included in this module file.
uint64_t InputFilesOffsetBase
Absolute offset of the start of the input-files block.
llvm::BitstreamCursor SLocEntryCursor
Cursor used to read source location entries.
unsigned NumPreprocessedEntities
bool RelocatablePCH
Whether this precompiled header is a relocatable PCH file.
const uint32_t * SelectorOffsets
Offsets into the selector lookup table's data array where each selector resides.
unsigned BaseDeclIndex
Base declaration index in ASTReader for declarations local to this module.
unsigned NumFileSortedDecls
unsigned LocalNumSLocEntries
The number of source location entries in this AST file.
void * HeaderFileInfoTable
The on-disk hash table that contains information about each of the header files.
unsigned Index
The index of this module in the list of modules.
unsigned NumUserInputFiles
llvm::BitstreamCursor Stream
The main bitstream cursor for the main block.
serialization::SubmoduleID BaseSubmoduleID
Base submodule ID for submodules local to this module.
uint64_t SizeInBits
The size of this file, in bits.
const UnalignedUInt64 * TypeOffsets
Offset of each type within the bitstream, indexed by the type ID, or the representation of a Type*.
uint64_t GlobalBitOffset
The global bit offset (or base) of this module.
bool StandardCXXModule
Whether this module file is a standard C++ module.
unsigned LocalNumTypes
The number of types in this AST file.
StringRef ModuleOffsetMap
The module offset map data for this file.
const PPSkippedRange * PreprocessedSkippedRangeOffsets
std::string FileName
The file name of the module file.
uint64_t InputFilesValidationTimestamp
If non-zero, specifies the time when we last validated input files.
llvm::BitstreamCursor PreprocessorDetailCursor
The cursor to the start of the (optional) detailed preprocessing record block.
SourceLocation::UIntTy SLocEntryBaseOffset
The base offset in the source manager's view of this module.
std::string ModuleMapPath
const DeclOffset * DeclOffsets
Offset of each declaration within the bitstream, indexed by the declaration ID (-1).
uint64_t MacroStartOffset
The offset of the start of the set of defined macros.
ASTFileSignature Signature
The signature of the module file, which may be used instead of the size and modification time to iden...
unsigned LocalNumMacros
The number of macros in this AST file.
unsigned NumPreprocessedSkippedRanges
const unsigned char * SelectorLookupTableData
A pointer to the character data that comprises the selector table.
void dump()
Dump debugging output for this module.
unsigned LocalNumDecls
The number of declarations in this AST file.
unsigned LocalNumHeaderFileInfos
The number of local HeaderFileInfo structures.
llvm::BitVector SearchPathUsage
The bit vector denoting usage of each header search entry (true = used).
unsigned Generation
The generation of which this module file is a part.
const uint32_t * IdentifierOffsets
Offsets into the identifier table data.
ContinuousRangeMap< uint32_t, int, 2 > SelectorRemap
Remapping table for selector IDs in this module.
ContinuousRangeMap< uint32_t, int, 2 > MacroRemap
Remapping table for macro IDs in this module.
const uint32_t * MacroOffsets
Offsets of macros in the preprocessor block.
uint64_t ASTBlockStartOffset
The bit offset of the AST block of this module.
ContinuousRangeMap< uint32_t, int, 2 > SubmoduleRemap
Remapping table for submodule IDs in this module.
llvm::BitVector VFSUsage
The bit vector denoting usage of each VFS entry (true = used).
uint64_t DeclsBlockStartOffset
The offset to the start of the DECLTYPES_BLOCK block.
SmallVector< uint64_t, 8 > PragmaDiagMappings
Diagnostic IDs and their mappings that the user changed.
unsigned BasePreprocessedSkippedRangeID
Base ID for preprocessed skipped ranges local to this module.
unsigned LocalNumSelectors
The number of selectors new to this file.
ModuleKind Kind
The type of this module.
std::string ModuleName
The name of the module.
serialization::MacroID BaseMacroID
Base macro ID for macros local to this module.
SmallVector< uint64_t, 1 > ObjCCategories
The Objective-C category lists for categories known to this module.
std::string BaseDirectory
The base directory of the module.
llvm::SmallVector< ModuleFile *, 16 > TransitiveImports
List of modules which this modules dependent on.
Manages the set of modules loaded by an AST reader.
ModuleFile & getPrimaryModule()
Returns the primary module associated with the manager, that is, the first module loaded.
AddModuleResult
The result of attempting to add a new module.
@ Missing
The module file is missing.
@ OutOfDate
The module file is out-of-date.
@ NewlyLoaded
The module file was just loaded in response to this call.
@ AlreadyLoaded
The module file had already been loaded.
llvm::iterator_range< SmallVectorImpl< ModuleFile * >::const_iterator > pch_modules() const
A range covering the PCH and preamble module files loaded.
ModuleReverseIterator rbegin()
Reverse iterator to traverse all loaded modules.
void visit(llvm::function_ref< bool(ModuleFile &M)> Visitor, llvm::SmallPtrSetImpl< ModuleFile * > *ModuleFilesHit=nullptr)
Visit each of the modules.
unsigned size() const
Number of modules loaded.
Source range/offset of a preprocessed entity.
uint32_t getOffset() const
RawLocEncoding getBegin() const
RawLocEncoding getEnd() const
Source range of a skipped preprocessor region.
RawLocEncoding getBegin() const
RawLocEncoding getEnd() const
unsigned getFactoryBits() const
ReadMethodPoolVisitor(ASTReader &Reader, Selector Sel, unsigned PriorGeneration)
ArrayRef< ObjCMethodDecl * > getInstanceMethods() const
Retrieve the instance methods found by this visitor.
ArrayRef< ObjCMethodDecl * > getFactoryMethods() const
Retrieve the instance methods found by this visitor.
bool instanceHasMoreThanOneDecl() const
bool operator()(ModuleFile &M)
bool factoryHasMoreThanOneDecl() const
unsigned getInstanceBits() const
static TypeIdx fromTypeID(TypeID ID)
32 aligned uint64_t in the AST file.
static std::pair< unsigned, unsigned > ReadKeyDataLength(const unsigned char *&d)
static hash_value_type ComputeHash(const internal_key_type &a)
StringRef internal_key_type
static internal_key_type ReadKey(const unsigned char *d, unsigned n)
Class that performs lookup for an identifier stored in an AST file.
IdentifierID ReadIdentifierID(const unsigned char *d)
data_type ReadData(const internal_key_type &k, const unsigned char *d, unsigned DataLen)
Class that performs lookup for a selector's entries in the global method pool stored in an AST file.
internal_key_type ReadKey(const unsigned char *d, unsigned)
data_type ReadData(Selector, const unsigned char *d, unsigned DataLen)
static std::pair< unsigned, unsigned > ReadKeyDataLength(const unsigned char *&d)
static hash_value_type ComputeHash(Selector Sel)
Class that performs lookup to specialized decls.
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_LEXICAL
A record that stores the set of declarations that are lexically stored within a given DeclContext.
@ DECL_CXX_CTOR_INITIALIZERS
A record containing CXXCtorInitializers.
@ DECL_CONTEXT_VISIBLE
A record that stores the set of declarations that are visible from a given DeclContext.
@ TYPE_EXT_QUAL
An ExtQualType record.
@ SPECIAL_TYPE_OBJC_SEL_REDEFINITION
Objective-C "SEL" redefinition type.
@ SPECIAL_TYPE_UCONTEXT_T
C ucontext_t typedef type.
@ SPECIAL_TYPE_JMP_BUF
C jmp_buf typedef type.
@ SPECIAL_TYPE_FILE
C FILE typedef type.
@ SPECIAL_TYPE_SIGJMP_BUF
C sigjmp_buf typedef type.
@ SPECIAL_TYPE_OBJC_CLASS_REDEFINITION
Objective-C "Class" redefinition type.
@ SPECIAL_TYPE_CF_CONSTANT_STRING
CFConstantString type.
@ SPECIAL_TYPE_OBJC_ID_REDEFINITION
Objective-C "id" redefinition type.
Defines the clang::TargetInfo interface.
CharacteristicKind
Indicates whether a file or directory holds normal user code, system code, or system code which is im...
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
Severity
Enum values that allow the client to map NOTEs, WARNINGs, and EXTENSIONs to either Ignore (nothing),...
@ Warning
Present this diagnostic as a warning.
@ Error
Present this diagnostic as an error.
IncludeDirGroup
IncludeDirGroup - Identifies the group an include Entry belongs to, representing its relative positiv...
llvm::OnDiskChainedHashTable< HeaderFileInfoTrait > HeaderFileInfoLookupTable
The on-disk hash table used for known header files.
llvm::OnDiskIterableChainedHashTable< ASTIdentifierLookupTrait > ASTIdentifierLookupTable
The on-disk hash table used to contain information about all of the identifiers in the program.
llvm::OnDiskChainedHashTable< ASTSelectorLookupTrait > ASTSelectorLookupTable
The on-disk hash table used for the global method pool.
uint64_t TypeID
An ID number that refers to a type in an AST file.
@ EXTENSION_METADATA
Metadata describing this particular extension.
llvm::support::detail::packed_endian_specific_integral< serialization::DeclID, llvm::endianness::native, llvm::support::unaligned > unaligned_decl_id_t
@ SUBMODULE_EXCLUDED_HEADER
Specifies a header that has been explicitly excluded from this submodule.
@ SUBMODULE_TOPHEADER
Specifies a top-level header that falls into this (sub)module.
@ SUBMODULE_PRIVATE_TEXTUAL_HEADER
Specifies a header that is private to this submodule but must be textually included.
@ SUBMODULE_HEADER
Specifies a header that falls into this (sub)module.
@ SUBMODULE_EXPORT_AS
Specifies the name of the module that will eventually re-export the entities in this module.
@ SUBMODULE_UMBRELLA_DIR
Specifies an umbrella directory.
@ SUBMODULE_UMBRELLA_HEADER
Specifies the umbrella header used to create this module, if any.
@ SUBMODULE_METADATA
Metadata for submodules as a whole.
@ SUBMODULE_REQUIRES
Specifies a required feature.
@ SUBMODULE_PRIVATE_HEADER
Specifies a header that is private to this submodule.
@ SUBMODULE_IMPORTS
Specifies the submodules that are imported by this submodule.
@ SUBMODULE_CONFLICT
Specifies a conflict with another module.
@ SUBMODULE_INITIALIZERS
Specifies some declarations with initializers that must be emitted to initialize the module.
@ SUBMODULE_DEFINITION
Defines the major attributes of a submodule, including its name and parent.
@ SUBMODULE_LINK_LIBRARY
Specifies a library or framework to link against.
@ SUBMODULE_CONFIG_MACRO
Specifies a configuration macro for this module.
@ SUBMODULE_EXPORTS
Specifies the submodules that are re-exported from this submodule.
@ SUBMODULE_TEXTUAL_HEADER
Specifies a header that is part of the module but must be textually included.
@ SUBMODULE_AFFECTING_MODULES
Specifies affecting modules that were not imported.
TypeID LocalTypeID
Same with TypeID except that the LocalTypeID is only meaningful with the corresponding ModuleFile.
const unsigned int NUM_PREDEF_IDENT_IDS
The number of predefined identifier IDs.
uint32_t SubmoduleID
An ID number that refers to a submodule in a module file.
OptionsRecordTypes
Record types that occur within the options block inside the control block.
@ FILE_SYSTEM_OPTIONS
Record code for the filesystem options table.
@ TARGET_OPTIONS
Record code for the target options table.
@ PREPROCESSOR_OPTIONS
Record code for the preprocessor options table.
@ HEADER_SEARCH_OPTIONS
Record code for the headers search options table.
@ LANGUAGE_OPTIONS
Record code for the language options table.
uint32_t SelectorID
An ID number that refers to an ObjC selector in an AST file.
const unsigned int NUM_PREDEF_PP_ENTITY_IDS
The number of predefined preprocessed entity IDs.
uint32_t PreprocessedEntityID
An ID number that refers to an entity in the detailed preprocessing record.
const unsigned int NUM_PREDEF_SUBMODULE_IDS
The number of predefined submodule IDs.
@ SUBMODULE_BLOCK_ID
The block containing the submodule structure.
@ PREPROCESSOR_DETAIL_BLOCK_ID
The block containing the detailed preprocessing record.
@ AST_BLOCK_ID
The AST block, which acts as a container around the full AST block.
@ SOURCE_MANAGER_BLOCK_ID
The block containing information about the source manager.
@ CONTROL_BLOCK_ID
The control block, which contains all of the information that needs to be validated prior to committi...
@ DECLTYPES_BLOCK_ID
The block containing the definitions of all of the types and decls used within the AST file.
@ PREPROCESSOR_BLOCK_ID
The block containing information about the preprocessor.
@ COMMENTS_BLOCK_ID
The block containing comments.
@ UNHASHED_CONTROL_BLOCK_ID
A block with unhashed content.
@ EXTENSION_BLOCK_ID
A block containing a module file extension.
@ OPTIONS_BLOCK_ID
The block of configuration options, used to check that a module is being used in a configuration comp...
@ INPUT_FILES_BLOCK_ID
The block of input files, which were used as inputs to create this AST file.
unsigned StableHashForTemplateArguments(llvm::ArrayRef< TemplateArgument > Args)
Calculate a stable hash value for template arguments.
CommentRecordTypes
Record types used within a comments block.
@ SM_SLOC_FILE_ENTRY
Describes a source location entry (SLocEntry) for a file.
@ SM_SLOC_BUFFER_BLOB_COMPRESSED
Describes a zlib-compressed blob that contains the data for a buffer entry.
@ SM_SLOC_BUFFER_ENTRY
Describes a source location entry (SLocEntry) for a buffer.
@ SM_SLOC_BUFFER_BLOB
Describes a blob that contains the data for a buffer entry.
@ SM_SLOC_EXPANSION_ENTRY
Describes a source location entry (SLocEntry) for a macro expansion.
const unsigned int NUM_PREDEF_SELECTOR_IDS
The number of predefined selector IDs.
bool needsAnonymousDeclarationNumber(const NamedDecl *D)
Determine whether the given declaration needs an anonymous declaration number.
const unsigned VERSION_MAJOR
AST file major version number supported by this version of Clang.
DeclIDBase::DeclID DeclID
An ID number that refers to a declaration in an AST file.
PreprocessorRecordTypes
Record types used within a preprocessor block.
@ PP_TOKEN
Describes one token.
@ PP_MACRO_FUNCTION_LIKE
A function-like macro definition.
@ PP_MACRO_OBJECT_LIKE
An object-like macro definition.
@ PP_MACRO_DIRECTIVE_HISTORY
The macro directives history for a particular identifier.
@ PP_MODULE_MACRO
A macro directive exported by a module.
ControlRecordTypes
Record types that occur within the control block.
@ MODULE_MAP_FILE
Record code for the module map file that was used to build this AST file.
@ MODULE_DIRECTORY
Record code for the module build directory.
@ ORIGINAL_FILE_ID
Record code for file ID of the file or buffer that was used to generate the AST file.
@ MODULE_NAME
Record code for the module name.
@ ORIGINAL_FILE
Record code for the original file that was used to generate the AST file, including both its file ID ...
@ IMPORT
Record code for another AST file imported by this AST file.
@ INPUT_FILE_OFFSETS
Offsets into the input-files block where input files reside.
@ METADATA
AST file metadata, including the AST file version number and information about the compiler used to b...
UnhashedControlBlockRecordTypes
Record codes for the unhashed control block.
@ DIAGNOSTIC_OPTIONS
Record code for the diagnostic options table.
@ HEADER_SEARCH_ENTRY_USAGE
Record code for the indices of used header search entries.
@ AST_BLOCK_HASH
Record code for the content hash of the AST block.
@ DIAG_PRAGMA_MAPPINGS
Record code for #pragma diagnostic mappings.
@ SIGNATURE
Record code for the signature that identifiers this AST file.
@ HEADER_SEARCH_PATHS
Record code for the headers search paths.
@ VFS_USAGE
Record code for the indices of used VFSs.
InputFileRecordTypes
Record types that occur within the input-files block inside the control block.
@ INPUT_FILE_HASH
The input file content hash.
@ INPUT_FILE
An input file.
void updateModuleTimestamp(StringRef ModuleFilename)
PreprocessorDetailRecordTypes
Record types used within a preprocessor detail block.
@ PPD_INCLUSION_DIRECTIVE
Describes an inclusion directive within the preprocessing record.
@ PPD_MACRO_EXPANSION
Describes a macro expansion within the preprocessing record.
@ PPD_MACRO_DEFINITION
Describes a macro definition within the preprocessing record.
ModuleKind
Specifies the kind of module that has been loaded.
@ MK_PCH
File is a PCH file treated as such.
@ MK_Preamble
File is a PCH file treated as the preamble.
@ MK_MainFile
File is a PCH file treated as the actual main file.
@ MK_ExplicitModule
File is an explicitly-loaded module.
@ MK_ImplicitModule
File is an implicitly-loaded module.
@ MK_PrebuiltModule
File is from a prebuilt module path.
uint64_t IdentifierID
An ID number that refers to an identifier in an AST file.
const unsigned int NUM_PREDEF_MACRO_IDS
The number of predefined macro IDs.
ASTRecordTypes
Record types that occur within the AST block itself.
@ DECL_UPDATE_OFFSETS
Record for offsets of DECL_UPDATES records for declarations that were modified after being deserializ...
@ STATISTICS
Record code for the extra statistics we gather while generating an AST file.
@ FLOAT_CONTROL_PRAGMA_OPTIONS
Record code for #pragma float_control options.
@ KNOWN_NAMESPACES
Record code for the set of known namespaces, which are used for typo correction.
@ SPECIAL_TYPES
Record code for the set of non-builtin, special types.
@ PENDING_IMPLICIT_INSTANTIATIONS
Record code for pending implicit instantiations.
@ CXX_ADDED_TEMPLATE_SPECIALIZATION
@ TYPE_OFFSET
Record code for the offsets of each type.
@ DELEGATING_CTORS
The list of delegating constructor declarations.
@ PP_ASSUME_NONNULL_LOC
ID 66 used to be the list of included files.
@ EXT_VECTOR_DECLS
Record code for the set of ext_vector type names.
@ OPENCL_EXTENSIONS
Record code for enabled OpenCL extensions.
@ FP_PRAGMA_OPTIONS
Record code for floating point #pragma options.
@ PP_UNSAFE_BUFFER_USAGE
Record code for #pragma clang unsafe_buffer_usage begin/end.
@ CXX_ADDED_TEMPLATE_PARTIAL_SPECIALIZATION
@ DECLS_WITH_EFFECTS_TO_VERIFY
Record code for Sema's vector of functions/blocks with effects to be verified.
@ VTABLE_USES
Record code for the array of VTable uses.
@ LATE_PARSED_TEMPLATE
Record code for late parsed template functions.
@ DECLS_TO_CHECK_FOR_DEFERRED_DIAGS
Record code for the Decls to be checked for deferred diags.
@ DECL_OFFSET
Record code for the offsets of each decl.
@ SOURCE_MANAGER_LINE_TABLE
Record code for the source manager line table information, which stores information about #line direc...
@ PP_COUNTER_VALUE
The value of the next COUNTER to dispense.
@ DELETE_EXPRS_TO_ANALYZE
Delete expressions that will be analyzed later.
@ RELATED_DECLS_MAP
Record code for related declarations that have to be deserialized together from the same module.
@ UPDATE_VISIBLE
Record code for an update to a decl context's lookup table.
@ CUDA_PRAGMA_FORCE_HOST_DEVICE_DEPTH
Number of unmatched #pragma clang cuda_force_host_device begin directives we've seen.
@ MACRO_OFFSET
Record code for the table of offsets of each macro ID.
@ PPD_ENTITIES_OFFSETS
Record code for the table of offsets to entries in the preprocessing record.
@ VTABLES_TO_EMIT
Record code for vtables to emit.
@ IDENTIFIER_OFFSET
Record code for the table of offsets of each identifier ID.
@ OBJC_CATEGORIES
Record code for the array of Objective-C categories (including extensions).
@ METHOD_POOL
Record code for the Objective-C method pool,.
@ DELAYED_NAMESPACE_LEXICAL_VISIBLE_RECORD
Record code for lexical and visible block for delayed namespace in reduced BMI.
@ PP_CONDITIONAL_STACK
The stack of open #ifs/#ifdefs recorded in a preamble.
@ REFERENCED_SELECTOR_POOL
Record code for referenced selector pool.
@ SOURCE_LOCATION_OFFSETS
Record code for the table of offsets into the block of source-location information.
@ WEAK_UNDECLARED_IDENTIFIERS
Record code for weak undeclared identifiers.
@ UNDEFINED_BUT_USED
Record code for undefined but used functions and variables that need a definition in this TU.
@ FILE_SORTED_DECLS
Record code for a file sorted array of DeclIDs in a module.
@ MSSTRUCT_PRAGMA_OPTIONS
Record code for #pragma ms_struct options.
@ TENTATIVE_DEFINITIONS
Record code for the array of tentative definitions.
@ UNUSED_FILESCOPED_DECLS
Record code for the array of unused file scoped decls.
@ ALIGN_PACK_PRAGMA_OPTIONS
Record code for #pragma align/pack options.
@ IMPORTED_MODULES
Record code for an array of all of the (sub)modules that were imported by the AST file.
@ SELECTOR_OFFSETS
Record code for the table of offsets into the Objective-C method pool.
@ UNUSED_LOCAL_TYPEDEF_NAME_CANDIDATES
Record code for potentially unused local typedef names.
@ EAGERLY_DESERIALIZED_DECLS
Record code for the array of eagerly deserialized decls.
@ INTERESTING_IDENTIFIERS
A list of "interesting" identifiers.
@ HEADER_SEARCH_TABLE
Record code for header search information.
@ OBJC_CATEGORIES_MAP
Record code for map of Objective-C class definition IDs to the ObjC categories in a module that are a...
@ CUDA_SPECIAL_DECL_REFS
Record code for special CUDA declarations.
@ TU_UPDATE_LEXICAL
Record code for an update to the TU's lexically contained declarations.
@ PPD_SKIPPED_RANGES
A table of skipped ranges within the preprocessing record.
@ IDENTIFIER_TABLE
Record code for the identifier table.
@ SEMA_DECL_REFS
Record code for declarations that Sema keeps references of.
@ OPTIMIZE_PRAGMA_OPTIONS
Record code for #pragma optimize options.
@ MODULE_OFFSET_MAP
Record code for the remapping information used to relate loaded modules to the various offsets and ID...
@ POINTERS_TO_MEMBERS_PRAGMA_OPTIONS
Record code for #pragma ms_struct options.
uint32_t MacroID
An ID number that refers to a macro in an AST file.
unsigned ComputeHash(Selector Sel)
TokenKind
Provides a simple uniform namespace for tokens from all C languages.
The JSON file list parser is used to communicate input to InstallAPI.
TypeSpecifierType
Specifies the kind of type.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
bool isa(CodeGen::Address addr)
SanitizerMask getPPTransparentSanitizers()
Return the sanitizers which do not affect preprocessing.
if(T->getSizeExpr()) TRY_TO(TraverseStmt(const_cast< Expr * >(T -> getSizeExpr())))
llvm::omp::Directive OpenMPDirectiveKind
OpenMP directives.
OpenMPDefaultmapClauseModifier
OpenMP modifiers for 'defaultmap' clause.
OpenMPOrderClauseModifier
OpenMP modifiers for 'order' clause.
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'.
@ 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.
llvm::omp::Clause OpenMPClauseKind
OpenMP clauses.
OpenMPDistScheduleClauseKind
OpenMP attributes for 'dist_schedule' clause.
OpenMPDoacrossClauseModifier
OpenMP dependence types for 'doacross' clause.
static constexpr unsigned NumberOfOMPMapClauseModifiers
Number of allowed map-type-modifiers.
ObjCXXARCStandardLibraryKind
Enumerate the kinds of standard library that.
PredefinedDeclIDs
Predefined declaration IDs.
@ PREDEF_DECL_CF_CONSTANT_STRING_TAG_ID
The internal '__NSConstantString' tag type.
@ PREDEF_DECL_COMMON_TYPE_ID
The internal '__builtin_common_type' template.
@ PREDEF_DECL_TRANSLATION_UNIT_ID
The translation unit.
@ PREDEF_DECL_TYPE_PACK_ELEMENT_ID
The internal '__type_pack_element' template.
@ PREDEF_DECL_OBJC_CLASS_ID
The Objective-C 'Class' type.
@ PREDEF_DECL_BUILTIN_MS_GUID_ID
The predeclared '_GUID' struct.
@ PREDEF_DECL_OBJC_INSTANCETYPE_ID
The internal 'instancetype' typedef.
@ PREDEF_DECL_OBJC_PROTOCOL_ID
The Objective-C 'Protocol' type.
@ PREDEF_DECL_UNSIGNED_INT_128_ID
The unsigned 128-bit integer type.
@ PREDEF_DECL_OBJC_SEL_ID
The Objective-C 'SEL' type.
@ 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.
@ PREDEF_DECL_MAKE_INTEGER_SEQ_ID
The internal '__make_integer_seq' template.
@ Property
The type of a property.
@ Result
The result type of a method or function.
OpenMPBindClauseKind
OpenMP bindings for the 'bind' clause.
OpenMPLastprivateModifier
OpenMP 'lastprivate' clause modifier.
OpenMPDependClauseKind
OpenMP attributes for 'depend' clause.
OpenMPGrainsizeClauseModifier
OpenMPNumTasksClauseModifier
OpenMPSeverityClauseKind
OpenMP attributes for 'severity' clause.
void ProcessWarningOptions(DiagnosticsEngine &Diags, const DiagnosticOptions &Opts, llvm::vfs::FileSystem &VFS, bool ReportDiags=true)
ProcessWarningOptions - Initialize the diagnostic client and process the warning options specified on...
static constexpr unsigned NumberOfOMPMotionModifiers
Number of allowed motion-modifiers.
TypeSpecifierWidth
Specifies the width of a type, e.g., short, long, or long long.
OpenMPMotionModifierKind
OpenMP modifier kind for 'to' or 'from' clause.
OpenMPDefaultmapClauseKind
OpenMP attributes for 'defaultmap' clause.
OpenMPAllocateClauseModifier
OpenMP modifiers for 'allocate' clause.
OpenMPLinearClauseKind
OpenMP attributes for 'linear' clause.
TypeSpecifierSign
Specifies the signedness of a type, e.g., signed or unsigned.
const FunctionProtoType * T
DisableValidationForModuleKind
Whether to disable the normal validation performed on precompiled headers and module files when they ...
@ None
Perform validation, don't disable it.
@ PCH
Disable validation for a precompiled header and the modules it depends on.
@ Module
Disable validation for module files.
bool shouldSkipCheckingODR(const Decl *D)
std::string getClangFullRepositoryVersion()
Retrieves the full repository version that is an amalgamation of the information in getClangRepositor...
OpenMPAtomicDefaultMemOrderClauseKind
OpenMP attributes for 'atomic_default_mem_order' clause.
@ Success
Template argument deduction was successful.
U cast(CodeGen::Address addr)
@ None
The alignment was not explicit in code.
OpenMPDeviceClauseModifier
OpenMP modifiers for 'device' clause.
OpenMPMapModifierKind
OpenMP modifier kind for 'map' clause.
@ Enum
The "enum" keyword introduces the elaborated-type-specifier.
OpenMPOrderClauseKind
OpenMP attributes for 'order' clause.
OpenMPScheduleClauseKind
OpenMP attributes for 'schedule' clause.
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
OpenMPMapClauseKind
OpenMP mapping kind for 'map' clause.
The signature of a module, which is a hash of the AST content.
static constexpr size_t size
static ASTFileSignature create(std::array< uint8_t, 20 > Bytes)
static ASTFileSignature createDummy()
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>".
static const ASTTemplateArgumentListInfo * Create(const ASTContext &C, const TemplateArgumentListInfo &List)
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...
DeclarationName getName() const
getName - Returns the embedded declaration name.
void setLoc(SourceLocation L)
setLoc - Sets the main location of the declaration name.
void setInfo(const DeclarationNameLoc &Info)
void setName(DeclarationName N)
setName - Sets the embedded declaration name.
A simple structure that captures a vtable use for the purposes of the ExternalSemaSource.
ExceptionSpecInfo ExceptionSpec
static LineEntry get(unsigned Offs, unsigned Line, int Filename, SrcMgr::CharacteristicKind FileKind, unsigned IncludeOffset)
A conflict between two modules.
Module * Other
The module that this module conflicts with.
std::string Message
The message provided to the user when there is a conflict.
A library or framework to link against when an entity from this module is used.
This structure contains all sizes needed for by an OMPMappableExprListClause.
unsigned NumComponentLists
Number of component lists.
unsigned NumVars
Number of expressions listed.
unsigned NumUniqueDeclarations
Number of unique base declarations.
unsigned NumComponents
Total number of expression components.
Data for list of allocators.
a linked list of methods with the same selector name but different signatures.
A struct with extended info about a syntactic name qualifier, to be used for the case of out-of-line ...
TemplateParameterList ** TemplParamLists
A new-allocated array of size NumTemplParamLists, containing pointers to the "outer" template paramet...
NestedNameSpecifierLoc QualifierLoc
unsigned NumTemplParamLists
The number of "outer" template parameter lists.
void clear(SanitizerMask K=SanitizerKind::All)
Disable the sanitizers specified in K.
SanitizerMask Mask
Bitmask of enabled sanitizers.
Helper class that saves the current stream position and then restores it when destroyed.
PragmaMsStackAction Action
llvm::DenseSet< std::tuple< Decl *, Decl *, int > > NonEquivalentDeclSet
Store declaration pairs already found to be non-equivalent.
Location information for a TemplateArgument.
Describes the categories of an Objective-C class.
void insert(GlobalDeclID ID)
void insert(LazySpecializationInfo Info)