94 #include "llvm/ADT/APFloat.h"
95 #include "llvm/ADT/APInt.h"
96 #include "llvm/ADT/APSInt.h"
97 #include "llvm/ADT/ArrayRef.h"
98 #include "llvm/ADT/DenseMap.h"
99 #include "llvm/ADT/FloatingPointMode.h"
100 #include "llvm/ADT/FoldingSet.h"
101 #include "llvm/ADT/Hashing.h"
102 #include "llvm/ADT/IntrusiveRefCntPtr.h"
103 #include "llvm/ADT/STLExtras.h"
104 #include "llvm/ADT/ScopeExit.h"
105 #include "llvm/ADT/SmallPtrSet.h"
106 #include "llvm/ADT/SmallString.h"
107 #include "llvm/ADT/SmallVector.h"
108 #include "llvm/ADT/StringExtras.h"
109 #include "llvm/ADT/StringMap.h"
110 #include "llvm/ADT/StringRef.h"
111 #include "llvm/ADT/iterator_range.h"
112 #include "llvm/Bitstream/BitstreamReader.h"
113 #include "llvm/Support/Casting.h"
114 #include "llvm/Support/Compiler.h"
115 #include "llvm/Support/Compression.h"
116 #include "llvm/Support/DJB.h"
117 #include "llvm/Support/Endian.h"
118 #include "llvm/Support/Error.h"
119 #include "llvm/Support/ErrorHandling.h"
120 #include "llvm/Support/FileSystem.h"
121 #include "llvm/Support/LEB128.h"
122 #include "llvm/Support/MemoryBuffer.h"
123 #include "llvm/Support/Path.h"
124 #include "llvm/Support/SaveAndRestore.h"
125 #include "llvm/Support/TimeProfiler.h"
126 #include "llvm/Support/Timer.h"
127 #include "llvm/Support/VersionTuple.h"
128 #include "llvm/Support/raw_ostream.h"
129 #include "llvm/TargetParser/Triple.h"
142 #include <system_error>
147 using namespace clang;
150 using llvm::BitstreamCursor;
158 return First->ReadFullVersionInformation(FullVersion) ||
159 Second->ReadFullVersionInformation(FullVersion);
163 First->ReadModuleName(ModuleName);
164 Second->ReadModuleName(ModuleName);
168 First->ReadModuleMapFile(ModuleMapPath);
169 Second->ReadModuleMapFile(ModuleMapPath);
175 bool AllowCompatibleDifferences) {
176 return First->ReadLanguageOptions(LangOpts, Complain,
177 AllowCompatibleDifferences) ||
178 Second->ReadLanguageOptions(LangOpts, Complain,
179 AllowCompatibleDifferences);
184 bool AllowCompatibleDifferences) {
185 return First->ReadTargetOptions(TargetOpts, Complain,
186 AllowCompatibleDifferences) ||
187 Second->ReadTargetOptions(TargetOpts, Complain,
188 AllowCompatibleDifferences);
193 return First->ReadDiagnosticOptions(DiagOpts, Complain) ||
194 Second->ReadDiagnosticOptions(DiagOpts, Complain);
200 return First->ReadFileSystemOptions(FSOpts, Complain) ||
201 Second->ReadFileSystemOptions(FSOpts, Complain);
207 return First->ReadHeaderSearchOptions(HSOpts, SpecificModuleCachePath,
209 Second->ReadHeaderSearchOptions(HSOpts, SpecificModuleCachePath,
215 std::string &SuggestedPredefines) {
216 return First->ReadPreprocessorOptions(PPOpts, ReadMacros, Complain,
217 SuggestedPredefines) ||
218 Second->ReadPreprocessorOptions(PPOpts, ReadMacros, Complain,
219 SuggestedPredefines);
225 Second->ReadCounter(M,
Value);
229 return First->needsInputFileVisitation() ||
230 Second->needsInputFileVisitation();
234 return First->needsSystemInputFileVisitation() ||
235 Second->needsSystemInputFileVisitation();
247 bool isExplicitModule) {
248 bool Continue =
false;
249 if (
First->needsInputFileVisitation() &&
253 if (Second->needsInputFileVisitation() &&
254 (!
isSystem || Second->needsSystemInputFileVisitation()))
262 First->readModuleFileExtension(Metadata);
263 Second->readModuleFileExtension(Metadata);
283 bool AllowCompatibleDifferences =
true) {
284 #define LANGOPT(Name, Bits, Default, Description) \
285 if (ExistingLangOpts.Name != LangOpts.Name) { \
288 Diags->Report(diag::err_pch_langopt_mismatch) \
289 << Description << LangOpts.Name << ExistingLangOpts.Name; \
291 Diags->Report(diag::err_pch_langopt_value_mismatch) \
297 #define VALUE_LANGOPT(Name, Bits, Default, Description) \
298 if (ExistingLangOpts.Name != LangOpts.Name) { \
300 Diags->Report(diag::err_pch_langopt_value_mismatch) \
305 #define ENUM_LANGOPT(Name, Type, Bits, Default, Description) \
306 if (ExistingLangOpts.get##Name() != LangOpts.get##Name()) { \
308 Diags->Report(diag::err_pch_langopt_value_mismatch) \
313 #define COMPATIBLE_LANGOPT(Name, Bits, Default, Description) \
314 if (!AllowCompatibleDifferences) \
315 LANGOPT(Name, Bits, Default, Description)
317 #define COMPATIBLE_ENUM_LANGOPT(Name, Bits, Default, Description) \
318 if (!AllowCompatibleDifferences) \
319 ENUM_LANGOPT(Name, Bits, Default, Description)
321 #define COMPATIBLE_VALUE_LANGOPT(Name, Bits, Default, Description) \
322 if (!AllowCompatibleDifferences) \
323 VALUE_LANGOPT(Name, Bits, Default, Description)
325 #define BENIGN_LANGOPT(Name, Bits, Default, Description)
326 #define BENIGN_ENUM_LANGOPT(Name, Type, Bits, Default, Description)
327 #define BENIGN_VALUE_LANGOPT(Name, Bits, Default, Description)
328 #include "clang/Basic/LangOptions.def"
332 Diags->
Report(diag::err_pch_langopt_value_mismatch) <<
"module features";
338 Diags->
Report(diag::err_pch_langopt_value_mismatch)
339 <<
"target Objective-C runtime";
346 Diags->
Report(diag::err_pch_langopt_value_mismatch)
347 <<
"block command names";
355 if (!AllowCompatibleDifferences) {
359 ExistingSanitizers.
clear(ModularSanitizers);
360 ImportedSanitizers.
clear(ModularSanitizers);
361 if (ExistingSanitizers.
Mask != ImportedSanitizers.
Mask) {
362 const std::string Flag =
"-fsanitize=";
364 #define SANITIZER(NAME, ID) \
366 bool InExistingModule = ExistingSanitizers.has(SanitizerKind::ID); \
367 bool InImportedModule = ImportedSanitizers.has(SanitizerKind::ID); \
368 if (InExistingModule != InImportedModule) \
369 Diags->Report(diag::err_pch_targetopt_feature_mismatch) \
370 << InExistingModule << (Flag + NAME); \
372 #include "clang/Basic/Sanitizers.def"
390 bool AllowCompatibleDifferences =
true) {
391 #define CHECK_TARGET_OPT(Field, Name) \
392 if (TargetOpts.Field != ExistingTargetOpts.Field) { \
394 Diags->Report(diag::err_pch_targetopt_mismatch) \
395 << Name << TargetOpts.Field << ExistingTargetOpts.Field; \
406 if (!AllowCompatibleDifferences) {
411 #undef CHECK_TARGET_OPT
419 llvm::sort(ExistingFeatures);
420 llvm::sort(ReadFeatures);
426 ExistingFeatures.begin(), ExistingFeatures.end(), ReadFeatures.begin(),
427 ReadFeatures.end(), std::back_inserter(UnmatchedExistingFeatures));
428 std::set_difference(ReadFeatures.begin(), ReadFeatures.end(),
429 ExistingFeatures.begin(), ExistingFeatures.end(),
430 std::back_inserter(UnmatchedReadFeatures));
434 if (AllowCompatibleDifferences && UnmatchedReadFeatures.empty())
438 for (StringRef Feature : UnmatchedReadFeatures)
439 Diags->
Report(diag::err_pch_targetopt_feature_mismatch)
441 for (StringRef Feature : UnmatchedExistingFeatures)
442 Diags->
Report(diag::err_pch_targetopt_feature_mismatch)
446 return !UnmatchedReadFeatures.empty() || !UnmatchedExistingFeatures.empty();
452 bool AllowCompatibleDifferences) {
453 const LangOptions &ExistingLangOpts = PP.getLangOpts();
455 Complain ? &Reader.Diags :
nullptr,
456 AllowCompatibleDifferences);
461 bool AllowCompatibleDifferences) {
462 const TargetOptions &ExistingTargetOpts = PP.getTargetInfo().getTargetOpts();
464 Complain ? &Reader.Diags :
nullptr,
465 AllowCompatibleDifferences);
470 using MacroDefinitionsMap =
471 llvm::StringMap<std::pair<StringRef,
bool >>;
472 using DeclsMap = llvm::DenseMap<DeclarationName, SmallVector<NamedDecl *, 8>>;
487 for (
auto DiagIDMappingPair : MappingSource->getDiagnosticMappings()) {
496 Diags.
Report(diag::err_pch_diagopt_mismatch) <<
"-Werror=" +
515 bool SystemHeaderWarningsInModule,
524 !SystemHeaderWarningsInModule) {
526 Diags.
Report(diag::err_pch_diagopt_mismatch) <<
"-Wsystem-headers";
533 Diags.
Report(diag::err_pch_diagopt_mismatch) <<
"-Werror";
540 Diags.
Report(diag::err_pch_diagopt_mismatch) <<
"-Weverything -Werror";
547 Diags.
Report(diag::err_pch_diagopt_mismatch) <<
"-pedantic-errors";
571 assert(!ModuleName.empty() &&
"diagnostic options read before module name");
575 assert(M &&
"missing module");
590 assert(ModuleMgr.
size() >= 1 &&
"what ASTFile is this then");
596 Module *Importer = PP.getCurrentModule();
599 bool SystemHeaderWarningsInModule =
606 SystemHeaderWarningsInModule, Complain);
613 MacroDefinitionsMap &Macros,
615 for (
unsigned I = 0, N = PPOpts.
Macros.size(); I != N; ++I) {
616 StringRef Macro = PPOpts.
Macros[I].first;
617 bool IsUndef = PPOpts.
Macros[I].second;
619 std::pair<StringRef, StringRef> MacroPair = Macro.split(
'=');
620 StringRef MacroName = MacroPair.first;
621 StringRef MacroBody = MacroPair.second;
625 if (MacroNames && !Macros.count(MacroName))
626 MacroNames->push_back(MacroName);
628 Macros[MacroName] = std::make_pair(
"",
true);
633 if (MacroName.size() == Macro.size())
637 StringRef::size_type
End = MacroBody.find_first_of(
"\n\r");
638 MacroBody = MacroBody.substr(0,
End);
641 if (MacroNames && !Macros.count(MacroName))
642 MacroNames->push_back(MacroName);
643 Macros[MacroName] = std::make_pair(MacroBody,
false);
667 std::string &SuggestedPredefines,
const LangOptions &LangOpts,
671 MacroDefinitionsMap ASTFileMacros;
673 MacroDefinitionsMap ExistingMacros;
676 &ExistingMacroNames);
680 SuggestedPredefines +=
"# 1 \"<command line>\" 1\n";
682 for (
unsigned I = 0, N = ExistingMacroNames.size(); I != N; ++I) {
684 StringRef MacroName = ExistingMacroNames[I];
685 std::pair<StringRef, bool> Existing = ExistingMacros[MacroName];
688 llvm::StringMap<std::pair<StringRef,
bool >>::iterator Known =
689 ASTFileMacros.find(MacroName);
695 Diags->
Report(diag::err_pch_macro_def_undef) << MacroName <<
true;
703 if (Existing.second) {
704 SuggestedPredefines +=
"#undef ";
705 SuggestedPredefines += MacroName.str();
706 SuggestedPredefines +=
'\n';
708 SuggestedPredefines +=
"#define ";
709 SuggestedPredefines += MacroName.str();
710 SuggestedPredefines +=
' ';
711 SuggestedPredefines += Existing.first.str();
712 SuggestedPredefines +=
'\n';
719 if (Existing.second != Known->second.second) {
721 Diags->
Report(diag::err_pch_macro_def_undef)
722 << MacroName << Known->second.second;
729 if (Existing.second || Existing.first == Known->second.first) {
730 ASTFileMacros.erase(Known);
736 Diags->
Report(diag::err_pch_macro_def_conflict)
737 << MacroName << Known->second.first << Existing.first;
743 SuggestedPredefines +=
"# 1 \"<built-in>\" 2\n";
748 for (
const auto &MacroName : ASTFileMacros.keys()) {
750 Diags->
Report(diag::err_pch_macro_def_undef) << MacroName <<
false;
767 if (LangOpts.Modules &&
777 for (
unsigned I = 0, N = ExistingPPOpts.
Includes.size(); I != N; ++I) {
784 SuggestedPredefines +=
"#include \"";
785 SuggestedPredefines +=
File;
786 SuggestedPredefines +=
"\"\n";
796 SuggestedPredefines +=
"#include \"";
797 SuggestedPredefines +=
File;
798 SuggestedPredefines +=
"\"\n";
801 for (
unsigned I = 0, N = ExistingPPOpts.
MacroIncludes.size(); I != N; ++I) {
806 SuggestedPredefines +=
"#__include_macros \"";
807 SuggestedPredefines +=
File;
808 SuggestedPredefines +=
"\"\n##\n";
815 bool ReadMacros,
bool Complain,
816 std::string &SuggestedPredefines) {
820 PPOpts, ExistingPPOpts, ReadMacros, Complain ? &Reader.Diags :
nullptr,
821 PP.getFileManager(), SuggestedPredefines, PP.getLangOpts());
826 std::string &SuggestedPredefines) {
828 nullptr, PP.getFileManager(),
829 SuggestedPredefines, PP.getLangOpts(),
838 StringRef SpecificModuleCachePath,
839 StringRef ExistingModuleCachePath,
844 SpecificModuleCachePath == ExistingModuleCachePath)
847 VFS.equivalent(SpecificModuleCachePath, ExistingModuleCachePath);
848 if (EqualOrErr && *EqualOrErr)
851 Diags->
Report(diag::err_pch_modulecache_mismatch)
852 << SpecificModuleCachePath << ExistingModuleCachePath;
857 StringRef SpecificModuleCachePath,
860 SpecificModuleCachePath,
861 PP.getHeaderSearchInfo().getModuleCachePath(),
862 Complain ? &Reader.Diags :
nullptr,
863 PP.getLangOpts(), PP.getPreprocessorOpts());
867 PP.setCounterValue(
Value);
876 const char *Error =
nullptr;
878 uint64_t Val = llvm::decodeULEB128(
P, &Length,
nullptr, &Error);
880 llvm::report_fatal_error(Error);
886 static std::pair<unsigned, unsigned>
889 if ((
unsigned)KeyLen != KeyLen)
890 llvm::report_fatal_error(
"key too large");
893 if ((
unsigned)DataLen != DataLen)
894 llvm::report_fatal_error(
"data too large");
896 return std::make_pair(KeyLen, DataLen);
900 bool TakeOwnership) {
901 DeserializationListener = Listener;
902 OwnsDeserializationListener = TakeOwnership;
909 std::pair<unsigned, unsigned>
916 using namespace llvm::support;
919 unsigned N = endian::readNext<uint16_t, llvm::endianness::little>(d);
921 F, endian::readNext<uint32_t, llvm::endianness::little>(d));
928 Args.push_back(FirstII);
929 for (
unsigned I = 1; I != N; ++I)
930 Args.push_back(Reader.getLocalIdentifier(
931 F, endian::readNext<uint32_t, llvm::endianness::little>(d)));
939 using namespace llvm::support;
943 Result.ID = Reader.getGlobalSelectorID(
944 F, endian::readNext<uint32_t, llvm::endianness::little>(d));
945 unsigned FullInstanceBits =
946 endian::readNext<uint16_t, llvm::endianness::little>(d);
947 unsigned FullFactoryBits =
948 endian::readNext<uint16_t, llvm::endianness::little>(d);
949 Result.InstanceBits = FullInstanceBits & 0x3;
950 Result.InstanceHasMoreThanOneDecl = (FullInstanceBits >> 2) & 0x1;
951 Result.FactoryBits = FullFactoryBits & 0x3;
952 Result.FactoryHasMoreThanOneDecl = (FullFactoryBits >> 2) & 0x1;
953 unsigned NumInstanceMethods = FullInstanceBits >> 3;
954 unsigned NumFactoryMethods = FullFactoryBits >> 3;
957 for (
unsigned I = 0; I != NumInstanceMethods; ++I) {
960 LocalDeclID(endian::readNext<DeclID, llvm::endianness::little>(d))))
961 Result.Instance.push_back(Method);
965 for (
unsigned I = 0; I != NumFactoryMethods; ++I) {
968 LocalDeclID(endian::readNext<DeclID, llvm::endianness::little>(d))))
969 Result.Factory.push_back(Method);
976 return llvm::djbHash(a);
979 std::pair<unsigned, unsigned>
986 assert(n >= 2 && d[n-1] ==
'\0');
987 return StringRef((
const char*) d, n-1);
1004 bool Value = Bits & 0x1;
1010 using namespace llvm::support;
1012 unsigned RawID = endian::readNext<uint32_t, llvm::endianness::little>(d);
1013 return Reader.getGlobalIdentifierID(F, RawID >> 1);
1026 const unsigned char* d,
1028 using namespace llvm::support;
1030 unsigned RawID = endian::readNext<uint32_t, llvm::endianness::little>(d);
1031 bool IsInteresting = RawID & 0x01;
1039 II = &Reader.getIdentifierTable().getOwn(k);
1043 Reader.markIdentifierUpToDate(II);
1046 if (!IsInteresting) {
1049 Reader.SetIdentifierInfo(
ID, II);
1053 unsigned ObjCOrBuiltinID =
1054 endian::readNext<uint16_t, llvm::endianness::little>(d);
1055 unsigned Bits = endian::readNext<uint16_t, llvm::endianness::little>(d);
1056 bool CPlusPlusOperatorKeyword =
readBit(Bits);
1057 bool HasRevertedTokenIDToIdentifier =
readBit(Bits);
1058 bool Poisoned =
readBit(Bits);
1059 bool ExtensionToken =
readBit(Bits);
1060 bool HadMacroDefinition =
readBit(Bits);
1062 assert(Bits == 0 &&
"Extra bits in the identifier?");
1067 if (HasRevertedTokenIDToIdentifier && II->
getTokenID() != tok::identifier)
1072 "Incorrect extension token flag");
1073 (void)ExtensionToken;
1077 "Incorrect C++ operator keyword flag");
1078 (void)CPlusPlusOperatorKeyword;
1082 if (HadMacroDefinition) {
1083 uint32_t MacroDirectivesOffset =
1084 endian::readNext<uint32_t, llvm::endianness::little>(d);
1087 Reader.addPendingMacro(II, &F, MacroDirectivesOffset);
1090 Reader.SetIdentifierInfo(
ID, II);
1096 for (; DataLen > 0; DataLen -=
sizeof(
DeclID))
1097 DeclIDs.push_back(Reader.getGlobalDeclID(
1099 LocalDeclID(endian::readNext<DeclID, llvm::endianness::little>(d))));
1100 Reader.SetGloballyVisibleDecls(II, DeclIDs);
1107 :
Kind(Name.getNameKind()) {
1110 Data = (
uint64_t)Name.getAsIdentifierInfo();
1115 Data = (
uint64_t)Name.getObjCSelector().getAsOpaquePtr();
1118 Data = Name.getCXXOverloadedOperator();
1121 Data = (
uint64_t)Name.getCXXLiteralIdentifier();
1124 Data = (
uint64_t)Name.getCXXDeductionGuideTemplate()
1125 ->getDeclName().getAsIdentifierInfo();
1137 llvm::FoldingSetNodeID
ID;
1138 ID.AddInteger(Kind);
1161 return ID.ComputeHash();
1165 ASTDeclContextNameLookupTrait::ReadFileRef(
const unsigned char *&d) {
1166 using namespace llvm::support;
1168 uint32_t ModuleFileID =
1169 endian::readNext<uint32_t, llvm::endianness::little>(d);
1170 return Reader.getLocalModuleFile(F, ModuleFileID);
1173 std::pair<unsigned, unsigned>
1174 ASTDeclContextNameLookupTrait::ReadKeyDataLength(
const unsigned char *&d) {
1179 ASTDeclContextNameLookupTrait::ReadKey(
const unsigned char *d,
unsigned) {
1180 using namespace llvm::support;
1189 F, endian::readNext<uint32_t, llvm::endianness::little>(d));
1196 F, endian::readNext<uint32_t, llvm::endianness::little>(d))
1214 const unsigned char *d,
1217 using namespace llvm::support;
1219 for (
unsigned NumDecls = DataLen /
sizeof(
DeclID); NumDecls; --NumDecls) {
1220 LocalDeclID LocalID(endian::readNext<DeclID, llvm::endianness::little>(d));
1221 Val.
insert(Reader.getGlobalDeclID(F, LocalID));
1225 bool ASTReader::ReadLexicalDeclContextStorage(
ModuleFile &M,
1233 Error(std::move(Err));
1241 Error(MaybeCode.takeError());
1244 unsigned Code = MaybeCode.get();
1247 if (!MaybeRecCode) {
1248 Error(MaybeRecCode.takeError());
1251 unsigned RecCode = MaybeRecCode.get();
1253 Error(
"Expected lexical block");
1257 assert(!isa<TranslationUnitDecl>(DC) &&
1258 "expected a TU_UPDATE_LEXICAL record for TU");
1263 auto &Lex = LexicalDecls[DC];
1265 Lex = std::make_pair(
1267 reinterpret_cast<const unaligned_decl_id_t *
>(Blob.data()),
1268 Blob.size() /
sizeof(
DeclID)));
1274 bool ASTReader::ReadVisibleDeclContextStorage(
ModuleFile &M,
1282 Error(std::move(Err));
1290 Error(MaybeCode.takeError());
1293 unsigned Code = MaybeCode.get();
1296 if (!MaybeRecCode) {
1297 Error(MaybeRecCode.takeError());
1300 unsigned RecCode = MaybeRecCode.get();
1302 Error(
"Expected visible lookup table block");
1308 auto *
Data = (
const unsigned char*)Blob.data();
1309 PendingVisibleUpdates[
ID].push_back(PendingVisibleUpdate{&M,
Data});
1313 void ASTReader::Error(StringRef Msg)
const {
1314 Error(diag::err_fe_pch_malformed, Msg);
1315 if (PP.getLangOpts().Modules && !Diags.isDiagnosticInFlight() &&
1316 !PP.getHeaderSearchInfo().getModuleCachePath().empty()) {
1317 Diag(diag::note_module_cache_path)
1318 << PP.getHeaderSearchInfo().getModuleCachePath();
1322 void ASTReader::Error(
unsigned DiagID, StringRef Arg1, StringRef Arg2,
1323 StringRef Arg3)
const {
1324 if (Diags.isDiagnosticInFlight())
1325 Diags.SetDelayedDiagnostic(DiagID, Arg1, Arg2, Arg3);
1327 Diag(DiagID) << Arg1 << Arg2 << Arg3;
1330 void ASTReader::Error(llvm::Error &&Err)
const {
1331 llvm::Error RemainingErr =
1338 assert(NumArgs <= 3 &&
"Can only have up to 3 arguments");
1339 StringRef Arg1, Arg2, Arg3;
1342 Arg3 =
Diag.getStringArg(2);
1345 Arg2 =
Diag.getStringArg(1);
1348 Arg1 =
Diag.getStringArg(0);
1350 Error(
Diag.getDiagID(), Arg1, Arg2, Arg3);
1366 std::map<int, int> FileIDs;
1368 for (
unsigned I = 0;
Record[Idx]; ++I) {
1376 std::vector<LineEntry> Entries;
1377 while (Idx <
Record.size()) {
1381 unsigned NumEntries =
Record[Idx++];
1382 assert(NumEntries &&
"no line entries for file ID");
1384 Entries.reserve(NumEntries);
1385 for (
unsigned I = 0; I != NumEntries; ++I) {
1386 unsigned FileOffset =
Record[Idx++];
1387 unsigned LineNo =
Record[Idx++];
1388 int FilenameID = FileIDs[
Record[Idx++]];
1391 unsigned IncludeOffset =
Record[Idx++];
1393 FileKind, IncludeOffset));
1400 llvm::Error ASTReader::ReadSourceManagerBlock(
ModuleFile &F) {
1401 using namespace SrcMgr;
1409 SLocEntryCursor = F.
Stream;
1412 if (llvm::Error Err = F.
Stream.SkipBlock())
1423 SLocEntryCursor.advanceSkippingSubblocks();
1425 return MaybeE.takeError();
1426 llvm::BitstreamEntry E = MaybeE.get();
1429 case llvm::BitstreamEntry::SubBlock:
1431 return llvm::createStringError(std::errc::illegal_byte_sequence,
1432 "malformed block record in AST file");
1433 case llvm::BitstreamEntry::EndBlock:
1434 return llvm::Error::success();
1444 SLocEntryCursor.readRecord(E.ID,
Record, &Blob);
1446 return MaybeRecord.takeError();
1447 switch (MaybeRecord.get()) {
1455 return llvm::Error::success();
1466 return std::move(Err);
1470 return MaybeEntry.takeError();
1472 llvm::BitstreamEntry Entry = MaybeEntry.get();
1474 return llvm::createStringError(
1475 std::errc::illegal_byte_sequence,
1476 "incorrectly-formatted source location entry in AST file");
1482 return MaybeSLOC.takeError();
1484 switch (MaybeSLOC.get()) {
1486 return llvm::createStringError(
1487 std::errc::illegal_byte_sequence,
1488 "incorrectly-formatted source location entry in AST file");
1498 GlobalSLocOffsetMap.find(SourceManager::MaxLoadedOffset - SLocOffset - 1);
1499 assert(SLocMapI != GlobalSLocOffsetMap.end() &&
1500 "Corrupted global sloc offset map");
1503 bool Invalid =
false;
1505 auto It = llvm::upper_bound(
1508 int ID = F->SLocEntryBaseID + LocalIndex;
1509 std::size_t Index = -ID - 2;
1510 if (!SourceMgr.SLocEntryOffsetLoaded[Index]) {
1511 assert(!SourceMgr.SLocEntryLoaded[Index]);
1512 auto MaybeEntryOffset = readSLocOffset(F, LocalIndex);
1513 if (!MaybeEntryOffset) {
1514 Error(MaybeEntryOffset.takeError());
1518 SourceMgr.LoadedSLocEntryTable[Index] =
1519 SrcMgr::SLocEntry::getOffsetOnly(*MaybeEntryOffset);
1520 SourceMgr.SLocEntryOffsetLoaded[Index] = true;
1522 return Offset < SourceMgr.LoadedSLocEntryTable[Index].getOffset();
1537 if (
unsigned(-
ID) - 2 >= getTotalNumSLocs() ||
ID > 0) {
1538 Error(
"source location entry ID out-of-range for AST file");
1544 auto ReadBuffer = [
this](
1545 BitstreamCursor &SLocEntryCursor,
1546 StringRef Name) -> std::unique_ptr<llvm::MemoryBuffer> {
1551 Error(MaybeCode.takeError());
1554 unsigned Code = MaybeCode.get();
1557 SLocEntryCursor.readRecord(Code,
Record, &Blob);
1558 if (!MaybeRecCode) {
1559 Error(MaybeRecCode.takeError());
1562 unsigned RecCode = MaybeRecCode.get();
1567 const llvm::compression::Format F =
1568 Blob.size() > 0 && Blob.data()[0] == 0x78
1569 ? llvm::compression::Format::Zlib
1570 : llvm::compression::Format::Zstd;
1571 if (
const char *Reason = llvm::compression::getReasonIfUnsupported(F)) {
1576 if (llvm::Error E = llvm::compression::decompress(
1577 F, llvm::arrayRefFromStringRef(Blob), Decompressed,
Record[0])) {
1578 Error(
"could not decompress embedded file contents: " +
1582 return llvm::MemoryBuffer::getMemBufferCopy(
1583 llvm::toStringRef(Decompressed), Name);
1585 return llvm::MemoryBuffer::getMemBuffer(Blob.drop_back(1), Name,
true);
1587 Error(
"AST record has invalid code");
1596 Error(std::move(Err));
1603 ++NumSLocEntriesRead;
1606 Error(MaybeEntry.takeError());
1609 llvm::BitstreamEntry Entry = MaybeEntry.get();
1612 Error(
"incorrectly-formatted source location entry in AST file");
1619 SLocEntryCursor.readRecord(Entry.ID,
Record, &Blob);
1621 Error(MaybeSLOC.takeError());
1624 switch (MaybeSLOC.get()) {
1626 Error(
"incorrectly-formatted source location entry in AST file");
1632 unsigned InputID =
Record[4];
1633 InputFile IF = getInputFile(*F, InputID);
1646 IncludeLoc = getImportLocation(F);
1650 FileID FID = SourceMgr.createFileID(*
File, IncludeLoc, FileCharacter,
ID,
1653 FileInfo.NumCreatedFIDs =
Record[5];
1657 unsigned NumFileDecls =
Record[7];
1658 if (NumFileDecls && ContextObj) {
1660 assert(F->
FileSortedDecls &&
"FILE_SORTED_DECLS not encountered yet ?");
1666 SourceMgr.getOrCreateContentCache(*
File,
isSystem(FileCharacter));
1670 auto Buffer = ReadBuffer(SLocEntryCursor,
File->getName());
1673 SourceMgr.overrideFileContents(*
File, std::move(Buffer));
1680 const char *Name = Blob.data();
1686 IncludeLoc = getImportLocation(F);
1689 auto Buffer = ReadBuffer(SLocEntryCursor, Name);
1692 FileID FID = SourceMgr.createFileID(std::move(Buffer), FileCharacter,
ID,
1693 BaseOffset +
Offset, IncludeLoc);
1695 auto &FileInfo = SourceMgr.getSLocEntry(FID).getFile();
1696 FileInfo.setHasLineDirectives();
1706 SourceMgr.createExpansionLoc(SpellingLoc, ExpansionBegin, ExpansionEnd,
1720 if (
unsigned(-
ID) - 2 >= getTotalNumSLocs() ||
ID > 0) {
1721 Error(
"source location entry ID out-of-range for AST file");
1744 assert(SourceMgr.getMainFileID().isValid() &&
"missing main file");
1745 return SourceMgr.getLocForStartOfFile(SourceMgr.getMainFileID());
1759 if (StartOfBlockOffset)
1760 *StartOfBlockOffset =
Cursor.GetCurrentBitNo();
1766 return MaybeCode.takeError();
1767 unsigned Code = MaybeCode.get();
1770 if (Code != llvm::bitc::DEFINE_ABBREV) {
1773 return llvm::Error::success();
1775 if (llvm::Error Err =
Cursor.ReadAbbrevRecord())
1791 case tok::annot_pragma_loop_hint: {
1794 Info->Option = ReadToken(M,
Record, Idx);
1795 unsigned NumTokens =
Record[Idx++];
1797 Toks.reserve(NumTokens);
1798 for (
unsigned I = 0; I < NumTokens; ++I)
1799 Toks.push_back(ReadToken(M,
Record, Idx));
1800 Info->Toks =
llvm::ArrayRef(Toks).copy(PP.getPreprocessorAllocator());
1804 case tok::annot_pragma_pack: {
1807 auto SlotLabel = ReadString(
Record, Idx);
1809 llvm::StringRef(SlotLabel).copy(PP.getPreprocessorAllocator());
1810 Info->Alignment = ReadToken(M,
Record, Idx);
1815 case tok::annot_pragma_openmp:
1816 case tok::annot_pragma_openmp_end:
1817 case tok::annot_pragma_unused:
1818 case tok::annot_pragma_openacc:
1819 case tok::annot_pragma_openacc_end:
1822 llvm_unreachable(
"missing deserialization code for annotation token");
1839 if (llvm::Error Err = Stream.JumpToBit(
Offset)) {
1841 consumeError(std::move(Err));
1853 unsigned Flags = BitstreamCursor::AF_DontPopBlockAtEnd;
1855 Stream.advanceSkippingSubblocks(Flags);
1857 Error(MaybeEntry.takeError());
1860 llvm::BitstreamEntry Entry = MaybeEntry.get();
1862 switch (Entry.Kind) {
1863 case llvm::BitstreamEntry::SubBlock:
1865 Error(
"malformed block record in AST file");
1867 case llvm::BitstreamEntry::EndBlock:
1880 Error(MaybeRecType.takeError());
1896 unsigned NextIndex = 1;
1903 PP.getPreprocessorAllocator());
1906 bool isC99VarArgs =
Record[NextIndex++];
1907 bool isGNUVarArgs =
Record[NextIndex++];
1908 bool hasCommaPasting =
Record[NextIndex++];
1909 MacroParams.clear();
1910 unsigned NumArgs =
Record[NextIndex++];
1911 for (
unsigned i = 0; i != NumArgs; ++i)
1912 MacroParams.push_back(getLocalIdentifier(F,
Record[NextIndex++]));
1926 if (NextIndex + 1 ==
Record.size() && PP.getPreprocessingRecord() &&
1930 GlobalID = getGlobalPreprocessedEntityID(F,
Record[NextIndex]);
1932 PreprocessingRecord::PPEntityID PPID =
1933 PPRec.getPPEntityID(GlobalID - 1,
true);
1935 PPRec.getPreprocessedEntity(PPID));
1937 PPRec.RegisterMacroDefinition(Macro, PPDef);
1948 if (MacroTokens.empty()) {
1949 Error(
"unexpected number of macro tokens for a macro in AST file");
1954 MacroTokens[0] = ReadToken(F,
Record, Idx);
1955 MacroTokens = MacroTokens.drop_front();
1964 unsigned LocalID)
const {
1966 ReadModuleOffsetMap(M);
1971 &&
"Invalid index into preprocessed entity index remap");
1973 return LocalID + I->second;
1976 const FileEntry *HeaderFileInfoTrait::getFile(
const internal_key_type &Key) {
1978 if (!Key.Imported) {
1979 if (
auto File = FileMgr.
getFile(Key.Filename))
1984 std::string Resolved = std::string(Key.Filename);
1985 Reader.ResolveImportedPath(M, Resolved);
1986 if (
auto File = FileMgr.
getFile(Resolved))
2013 return FEA && FEA == FEB;
2016 std::pair<unsigned, unsigned>
2017 HeaderFileInfoTrait::ReadKeyDataLength(
const unsigned char*& d) {
2022 HeaderFileInfoTrait::ReadKey(
const unsigned char *d,
unsigned) {
2023 using namespace llvm::support;
2026 ikey.
Size = off_t(endian::readNext<uint64_t, llvm::endianness::little>(d));
2028 time_t(endian::readNext<uint64_t, llvm::endianness::little>(d));
2037 using namespace llvm::support;
2039 const unsigned char *
End = d + DataLen;
2041 unsigned Flags = *d++;
2043 bool Included = (Flags >> 6) & 0x01;
2048 Reader.getPreprocessor().getIncludedFiles().insert(FE);
2051 HFI.
isImport |= (Flags >> 5) & 0x01;
2053 HFI.
DirInfo = (Flags >> 1) & 0x07;
2056 M, endian::readNext<uint32_t, llvm::endianness::little>(d));
2057 if (
unsigned FrameworkOffset =
2058 endian::readNext<uint32_t, llvm::endianness::little>(d)) {
2061 StringRef FrameworkName(FrameworkStrings + FrameworkOffset - 1);
2062 HFI.
Framework = HS->getUniqueFrameworkName(FrameworkName);
2065 assert((
End - d) % 4 == 0 &&
2066 "Wrong data length in HeaderFileInfo deserialization");
2068 uint32_t LocalSMID =
2069 endian::readNext<uint32_t, llvm::endianness::little>(d);
2075 SubmoduleID GlobalSMID = Reader.getGlobalSubmoduleID(M, LocalSMID);
2076 Module *Mod = Reader.getSubmodule(GlobalSMID);
2079 Reader.getPreprocessor().getHeaderSearchInfo().getModuleMap();
2083 Reader.ResolveImportedPath(M,
Filename);
2087 ModMap.
addHeader(Mod, H, HeaderRole,
true);
2099 uint32_t MacroDirectivesOffset) {
2100 assert(NumCurrentElementsDeserializing > 0 &&
"Missing deserialization guard");
2101 PendingMacroIDs[II].push_back(PendingMacroInfo(M, MacroDirectivesOffset));
2108 for (
ModuleFile &I : llvm::reverse(ModuleMgr)) {
2109 BitstreamCursor &MacroCursor = I.MacroCursor;
2112 if (MacroCursor.getBitcodeBytes().empty())
2115 BitstreamCursor
Cursor = MacroCursor;
2116 if (llvm::Error Err =
Cursor.JumpToBit(I.MacroStartOffset)) {
2117 Error(std::move(Err));
2125 Error(MaybeE.takeError());
2128 llvm::BitstreamEntry E = MaybeE.get();
2131 case llvm::BitstreamEntry::SubBlock:
2133 Error(
"malformed block record in AST file");
2135 case llvm::BitstreamEntry::EndBlock:
2142 Error(MaybeRecord.takeError());
2145 switch (MaybeRecord.get()) {
2153 updateOutOfDateIdentifier(*II);
2172 class IdentifierLookupVisitor {
2175 unsigned PriorGeneration;
2176 unsigned &NumIdentifierLookups;
2177 unsigned &NumIdentifierLookupHits;
2181 IdentifierLookupVisitor(StringRef Name,
unsigned PriorGeneration,
2182 unsigned &NumIdentifierLookups,
2183 unsigned &NumIdentifierLookupHits)
2185 PriorGeneration(PriorGeneration),
2186 NumIdentifierLookups(NumIdentifierLookups),
2187 NumIdentifierLookupHits(NumIdentifierLookupHits) {}
2201 ++NumIdentifierLookups;
2202 ASTIdentifierLookupTable::iterator Pos =
2203 IdTable->find_hashed(Name, NameHash, &Trait);
2204 if (Pos == IdTable->end())
2210 ++NumIdentifierLookupHits;
2226 unsigned PriorGeneration = 0;
2227 if (getContext().getLangOpts().Modules)
2228 PriorGeneration = IdentifierGeneration[&II];
2234 if (!loadGlobalIndex()) {
2235 if (GlobalIndex->lookupIdentifier(II.
getName(), Hits)) {
2240 IdentifierLookupVisitor Visitor(II.
getName(), PriorGeneration,
2241 NumIdentifierLookups,
2242 NumIdentifierLookupHits);
2243 ModuleMgr.visit(Visitor, HitsPtr);
2244 markIdentifierUpToDate(&II);
2254 if (getContext().getLangOpts().Modules)
2255 IdentifierGeneration[II] = getGeneration();
2259 const PendingMacroInfo &PMInfo) {
2264 if (llvm::Error Err =
2266 Error(std::move(Err));
2270 struct ModuleMacroRecord {
2283 Cursor.advance(BitstreamCursor::AF_DontPopBlockAtEnd);
2285 Error(MaybeEntry.takeError());
2288 llvm::BitstreamEntry Entry = MaybeEntry.get();
2291 Error(
"malformed block record in AST file");
2298 Error(MaybePP.takeError());
2306 ModuleMacros.push_back(ModuleMacroRecord());
2307 auto &Info = ModuleMacros.back();
2308 Info.SubModID = getGlobalSubmoduleID(M,
Record[0]);
2309 Info.MI = getMacro(getGlobalMacroID(M,
Record[1]));
2310 for (
int I = 2, N =
Record.size(); I != N; ++I)
2311 Info.Overrides.push_back(getGlobalSubmoduleID(M,
Record[I]));
2316 Error(
"malformed block record in AST file");
2327 std::reverse(ModuleMacros.begin(), ModuleMacros.end());
2329 for (
auto &MMR : ModuleMacros) {
2331 for (
unsigned ModID : MMR.Overrides) {
2332 Module *Mod = getSubmodule(ModID);
2333 auto *Macro = PP.getModuleMacro(Mod, II);
2334 assert(Macro &&
"missing definition for overridden macro");
2335 Overrides.push_back(Macro);
2338 bool Inserted =
false;
2339 Module *Owner = getSubmodule(MMR.SubModID);
2340 PP.addModuleMacro(Owner, II, MMR.MI, Overrides, Inserted);
2351 unsigned Idx = 0, N =
Record.size();
2359 MD = PP.AllocateDefMacroDirective(MI,
Loc);
2363 MD = PP.AllocateUndefMacroDirective(
Loc);
2366 bool isPublic =
Record[Idx++];
2367 MD = PP.AllocateVisibilityMacroDirective(
Loc, isPublic);
2379 PP.setLoadedMacroDirective(II, Earliest, Latest);
2382 bool ASTReader::shouldDisableValidationForFile(
2420 consumeError(std::move(Err));
2426 consumeError(MaybeCode.takeError());
2428 unsigned Code = MaybeCode.get();
2434 "invalid record type for input file");
2437 consumeError(Maybe.takeError());
2440 assert(
Record[0] ==
ID &&
"Bogus stored ID or offset");
2449 uint16_t AsRequestedLength =
Record[7];
2451 std::string NameAsRequested = Blob.substr(0, AsRequestedLength).str();
2452 std::string Name = Blob.substr(AsRequestedLength).str();
2454 ResolveImportedPath(F, NameAsRequested);
2455 ResolveImportedPath(F, Name);
2458 Name = NameAsRequested;
2460 return std::make_pair(std::move(NameAsRequested), std::move(Name));
2465 consumeError(MaybeEntry.takeError());
2466 llvm::BitstreamEntry Entry = MaybeEntry.get();
2468 "expected record type for input file hash");
2473 "invalid record type for input file hash");
2476 consumeError(Maybe.takeError());
2505 consumeError(std::move(Err));
2520 PP.getHeaderSearchInfo().getHeaderSearchOpts();
2533 if ((Overridden || Transient || SkipChecks) && !File)
2538 std::string ErrorStr =
"could not find file '";
2540 ErrorStr +=
"' referenced by AST file '";
2556 if ((!Overridden && !Transient) && !SkipChecks &&
2557 SM.isFileOverridden(*File)) {
2563 File =
SM.bypassFileContentsOverride(*File);
2571 enum ModificationKind {
2577 std::optional<int64_t> Old = std::nullopt;
2578 std::optional<int64_t> New = std::nullopt;
2580 auto HasInputContentChanged = [&](Change OriginalChange) {
2581 assert(ValidateASTInputFilesContent &&
2582 "We should only check the content of the inputs with "
2583 "ValidateASTInputFilesContent enabled.");
2585 if (StoredContentHash ==
static_cast<uint64_t>(llvm::hash_code(-1)))
2586 return OriginalChange;
2589 if (!MemBuffOrError) {
2591 return OriginalChange;
2592 std::string ErrorStr =
"could not get buffer for file '";
2593 ErrorStr +=
File->getName();
2596 return OriginalChange;
2600 auto ContentHash =
hash_value(MemBuffOrError.get()->getBuffer());
2601 if (StoredContentHash ==
static_cast<uint64_t>(ContentHash))
2604 return Change{Change::Content};
2606 auto HasInputFileChanged = [&]() {
2607 if (StoredSize !=
File->getSize())
2608 return Change{Change::Size, StoredSize,
File->getSize()};
2609 if (!shouldDisableValidationForFile(F) && StoredTime &&
2610 StoredTime !=
File->getModificationTime()) {
2611 Change MTimeChange = {Change::ModTime, StoredTime,
2612 File->getModificationTime()};
2616 if (ValidateASTInputFilesContent)
2617 return HasInputContentChanged(MTimeChange);
2624 bool IsOutOfDate =
false;
2625 auto FileChange = SkipChecks ? Change{
Change::None} : HasInputFileChanged();
2631 FileChange = HasInputContentChanged(FileChange);
2637 if (!StoredTime && ValidateASTInputFilesContent &&
2639 FileChange = HasInputContentChanged(FileChange);
2643 if (Complain && !Diags.isDiagnosticInFlight()) {
2646 while (!ImportStack.back()->ImportedBy.empty())
2647 ImportStack.push_back(ImportStack.back()->ImportedBy[0]);
2650 StringRef TopLevelPCHName(ImportStack.back()->FileName);
2651 Diag(diag::err_fe_ast_file_modified)
2653 << TopLevelPCHName << FileChange.Kind
2654 << (FileChange.Old && FileChange.New)
2655 << llvm::itostr(FileChange.Old.value_or(0))
2656 << llvm::itostr(FileChange.New.value_or(0));
2659 if (ImportStack.size() > 1) {
2660 Diag(diag::note_pch_required_by)
2661 <<
Filename << ImportStack[0]->FileName;
2662 for (
unsigned I = 1; I < ImportStack.size(); ++I)
2663 Diag(diag::note_pch_required_by)
2664 << ImportStack[I-1]->FileName << ImportStack[I]->FileName;
2667 Diag(diag::note_pch_rebuild_required) << TopLevelPCHName;
2697 llvm::sys::path::append(Buffer, Prefix,
Filename);
2698 Filename.assign(Buffer.begin(), Buffer.end());
2713 llvm_unreachable(
"unknown ASTReadResult");
2717 BitstreamCursor &Stream,
unsigned ClientLoadCapabilities,
2719 std::string &SuggestedPredefines) {
2722 consumeError(std::move(Err));
2728 ASTReadResult Result =
Success;
2733 consumeError(MaybeEntry.takeError());
2736 llvm::BitstreamEntry Entry = MaybeEntry.get();
2738 switch (Entry.Kind) {
2740 case llvm::BitstreamEntry::SubBlock:
2743 case llvm::BitstreamEntry::EndBlock:
2754 if (!MaybeRecordType) {
2756 consumeError(MaybeRecordType.takeError());
2761 bool Complain = (ClientLoadCapabilities & ARR_ConfigurationMismatch) == 0;
2762 if (ParseLanguageOptions(
Record, Complain, Listener,
2763 AllowCompatibleConfigurationMismatch))
2764 Result = ConfigurationMismatch;
2769 bool Complain = (ClientLoadCapabilities & ARR_ConfigurationMismatch) == 0;
2770 if (ParseTargetOptions(
Record, Complain, Listener,
2771 AllowCompatibleConfigurationMismatch))
2772 Result = ConfigurationMismatch;
2777 bool Complain = (ClientLoadCapabilities & ARR_ConfigurationMismatch) == 0;
2778 if (!AllowCompatibleConfigurationMismatch &&
2779 ParseFileSystemOptions(
Record, Complain, Listener))
2780 Result = ConfigurationMismatch;
2785 bool Complain = (ClientLoadCapabilities & ARR_ConfigurationMismatch) == 0;
2786 if (!AllowCompatibleConfigurationMismatch &&
2787 ParseHeaderSearchOptions(
Record, Complain, Listener))
2788 Result = ConfigurationMismatch;
2793 bool Complain = (ClientLoadCapabilities & ARR_ConfigurationMismatch) == 0;
2794 if (!AllowCompatibleConfigurationMismatch &&
2795 ParsePreprocessorOptions(
Record, Complain, Listener,
2796 SuggestedPredefines))
2797 Result = ConfigurationMismatch;
2807 unsigned ClientLoadCapabilities) {
2808 BitstreamCursor &Stream = F.
Stream;
2811 Error(std::move(Err));
2821 bool HasReadUnhashedControlBlock =
false;
2822 auto readUnhashedControlBlockOnce = [&]() {
2823 if (!HasReadUnhashedControlBlock) {
2824 HasReadUnhashedControlBlock =
true;
2825 if (ASTReadResult Result =
2826 readUnhashedControlBlock(F, ImportedBy, ClientLoadCapabilities))
2832 bool DisableValidation = shouldDisableValidationForFile(F);
2836 unsigned NumInputs = 0;
2837 unsigned NumUserInputs = 0;
2838 StringRef BaseDirectoryAsWritten;
2842 Error(MaybeEntry.takeError());
2845 llvm::BitstreamEntry Entry = MaybeEntry.get();
2847 switch (Entry.Kind) {
2849 Error(
"malformed block record in AST file");
2851 case llvm::BitstreamEntry::EndBlock: {
2854 if (ASTReadResult Result = readUnhashedControlBlockOnce())
2859 PP.getHeaderSearchInfo().getHeaderSearchOpts();
2866 bool Complain = (ClientLoadCapabilities & ARR_OutOfDate) == 0;
2872 unsigned N = ValidateSystemInputs ? NumInputs : NumUserInputs;
2878 for (
unsigned I = 0; I < N; ++I) {
2879 InputFile IF = getInputFile(F, I+1, Complain);
2891 for (
unsigned I = 0; I < N; ++I) {
2892 bool IsSystem = I >= NumUserInputs;
2903 case llvm::BitstreamEntry::SubBlock:
2907 if (llvm::Error Err = Stream.SkipBlock()) {
2908 Error(std::move(Err));
2912 Error(
"malformed block record in AST file");
2922 if (Listener && !ImportedBy) {
2928 bool AllowCompatibleConfigurationMismatch =
2931 ASTReadResult Result =
2932 ReadOptionsBlock(Stream, ClientLoadCapabilities,
2933 AllowCompatibleConfigurationMismatch, *Listener,
2934 SuggestedPredefines);
2935 if (Result == Failure) {
2936 Error(
"malformed block record in AST file");
2940 if (DisableValidation ||
2941 (AllowConfigurationMismatch && Result == ConfigurationMismatch))
2947 if (Result != Success)
2949 }
else if (llvm::Error Err = Stream.SkipBlock()) {
2950 Error(std::move(Err));
2956 if (llvm::Error Err = Stream.SkipBlock()) {
2957 Error(std::move(Err));
2972 Stream.readRecord(Entry.ID,
Record, &Blob);
2973 if (!MaybeRecordType) {
2974 Error(MaybeRecordType.takeError());
2980 if ((ClientLoadCapabilities & ARR_VersionMismatch) == 0)
2982 : diag::err_pch_version_too_new);
2986 bool hasErrors =
Record[7];
2987 if (hasErrors && !DisableValidation) {
2990 if ((ClientLoadCapabilities & ARR_TreatModuleWithErrorsAsOutOfDate) &&
2991 canRecoverFromOutOfDate(F.
FileName, ClientLoadCapabilities))
2994 if (!AllowASTWithCompilerErrors) {
2995 Diag(diag::err_pch_with_compiler_errors);
3000 Diags.ErrorOccurred =
true;
3001 Diags.UncompilableErrorOccurred =
true;
3002 Diags.UnrecoverableErrorOccurred =
true;
3015 StringRef ASTBranch = Blob;
3016 if (StringRef(CurBranch) != ASTBranch && !DisableValidation) {
3017 if ((ClientLoadCapabilities & ARR_VersionMismatch) == 0)
3018 Diag(diag::err_pch_different_branch) << ASTBranch << CurBranch;
3028 if (ASTReadResult Result = readUnhashedControlBlockOnce())
3032 unsigned Idx = 0, N =
Record.size();
3037 bool IsImportingStdCXXModule =
Record[Idx++];
3041 auto [ImportLoc, ImportModuleFileIndex] =
3042 ReadUntranslatedSourceLocation(
Record[Idx++]);
3044 assert(ImportModuleFileIndex == 0);
3045 off_t StoredSize = !IsImportingStdCXXModule ? (off_t)
Record[Idx++] : 0;
3046 time_t StoredModTime =
3047 !IsImportingStdCXXModule ? (time_t)
Record[Idx++] : 0;
3050 if (!IsImportingStdCXXModule) {
3051 auto FirstSignatureByte =
Record.begin() + Idx;
3057 std::string ImportedName = ReadString(
Record, Idx);
3058 std::string ImportedFile;
3067 ImportedFile = PP.getHeaderSearchInfo().getPrebuiltModuleFileName(
3068 ImportedName, !IsImportingStdCXXModule);
3072 if (!IsImportingStdCXXModule) {
3073 if (ImportedFile.empty()) {
3076 ImportedFile = ReadPath(BaseDirectoryAsWritten,
Record, Idx);
3079 }
else if (ImportedFile.empty()) {
3080 Diag(clang::diag::err_failed_to_find_module_file) << ImportedName;
3086 unsigned Capabilities = ClientLoadCapabilities;
3087 if ((ClientLoadCapabilities & ARR_OutOfDate) == 0)
3088 Capabilities &= ~ARR_Missing;
3091 auto Result = ReadASTCore(ImportedFile, ImportedKind, ImportLoc, &F,
3092 Loaded, StoredSize, StoredModTime,
3093 StoredSignature, Capabilities);
3096 bool recompilingFinalized =
3097 Result == OutOfDate && (Capabilities & ARR_OutOfDate) &&
3098 getModuleManager().getModuleCache().isPCMFinal(F.
FileName);
3100 Diag(diag::note_module_file_imported_by)
3102 if (recompilingFinalized)
3103 Diag(diag::note_module_file_conflict);
3106 case Failure:
return Failure;
3109 case OutOfDate:
return OutOfDate;
3111 case ConfigurationMismatch:
return ConfigurationMismatch;
3112 case HadErrors:
return HadErrors;
3132 Diag(diag::remark_module_import)
3134 << (ImportedBy ? StringRef(ImportedBy->
ModuleName) : StringRef());
3140 if (ASTReadResult Result = readUnhashedControlBlockOnce())
3148 BaseDirectoryAsWritten = Blob;
3150 "MODULE_DIRECTORY found before MODULE_NAME");
3152 if (!PP.getPreprocessorOpts().ModulesCheckRelocated)
3156 Module *M = PP.getHeaderSearchInfo().lookupModule(
3163 if (!
bool(PP.getPreprocessorOpts().DisablePCHOrModuleValidation &
3166 auto BuildDir = PP.getFileManager().getOptionalDirectoryRef(Blob);
3167 if (!BuildDir || *BuildDir != M->
Directory) {
3168 if (!canRecoverFromOutOfDate(F.
FileName, ClientLoadCapabilities))
3169 Diag(diag::err_imported_module_relocated)
3180 if (ASTReadResult Result =
3181 ReadModuleMapFileBlock(
Record, F, ImportedBy, ClientLoadCapabilities))
3187 NumUserInputs =
Record[1];
3189 (
const llvm::support::unaligned_uint64_t *)Blob.data();
3198 llvm::Error ASTReader::ReadASTBlock(
ModuleFile &F,
3199 unsigned ClientLoadCapabilities) {
3200 BitstreamCursor &Stream = F.
Stream;
3202 if (llvm::Error Err = Stream.EnterSubBlock(
AST_BLOCK_ID))
3211 return MaybeEntry.takeError();
3212 llvm::BitstreamEntry Entry = MaybeEntry.get();
3214 switch (Entry.Kind) {
3216 return llvm::createStringError(
3217 std::errc::illegal_byte_sequence,
3218 "error at end of module block in AST file");
3219 case llvm::BitstreamEntry::EndBlock:
3231 return llvm::Error::success();
3232 case llvm::BitstreamEntry::SubBlock:
3240 if (llvm::Error Err = Stream.SkipBlock())
3242 if (llvm::Error Err = ReadBlockAbbrevs(
3249 if (!PP.getExternalSource())
3250 PP.setExternalSource(
this);
3252 if (llvm::Error Err = Stream.SkipBlock())
3254 if (llvm::Error Err =
3263 if (llvm::Error Err = Stream.SkipBlock()) {
3272 if (!PP.getPreprocessingRecord())
3273 PP.createPreprocessingRecord();
3274 if (!PP.getPreprocessingRecord()->getExternalSource())
3275 PP.getPreprocessingRecord()->SetExternalSource(*
this);
3279 if (llvm::Error Err = ReadSourceManagerBlock(F))
3284 if (llvm::Error Err = ReadSubmoduleBlock(F, ClientLoadCapabilities))
3289 BitstreamCursor
C = Stream;
3291 if (llvm::Error Err = Stream.SkipBlock())
3295 CommentsCursors.push_back(std::make_pair(C, &F));
3300 if (llvm::Error Err = Stream.SkipBlock())
3315 Stream.readRecord(Entry.ID,
Record, &Blob);
3316 if (!MaybeRecordType)
3317 return MaybeRecordType.takeError();
3349 return llvm::createStringError(
3350 std::errc::illegal_byte_sequence,
3351 "duplicate TYPE_OFFSET record in AST file");
3354 unsigned LocalBaseTypeIndex =
Record[1];
3359 GlobalTypeMap.insert(std::make_pair(getTotalNumTypes(), &F));
3363 std::make_pair(LocalBaseTypeIndex,
3373 return llvm::createStringError(
3374 std::errc::illegal_byte_sequence,
3375 "duplicate DECL_OFFSET record in AST file");
3378 unsigned LocalBaseDeclID =
Record[1];
3384 GlobalDeclMap.insert(std::make_pair(
3390 std::make_pair(LocalBaseDeclID, F.
BaseDeclID - LocalBaseDeclID));
3402 DeclContext *TU = ContextObj->getTranslationUnitDecl();
3403 LexicalContents Contents(
3404 reinterpret_cast<const unaligned_decl_id_t *
>(Blob.data()),
3405 static_cast<unsigned int>(Blob.size() /
sizeof(
DeclID)));
3406 TULexicalDecls.push_back(std::make_pair(&F, Contents));
3414 auto *
Data = (
const unsigned char*)Blob.data();
3415 PendingVisibleUpdates[
ID].push_back(PendingVisibleUpdate{&F,
Data});
3418 if (
Decl *D = GetExistingDecl(
ID))
3419 PendingUpdateRecords.push_back(
3420 PendingUpdateRecord(
ID, D,
false));
3426 reinterpret_cast<const unsigned char *
>(Blob.data());
3434 PP.getIdentifierTable().setExternalIdentifierLookup(
this);
3440 return llvm::createStringError(
3441 std::errc::illegal_byte_sequence,
3442 "duplicate IDENTIFIER_OFFSET record in AST file");
3445 unsigned LocalBaseIdentifierID =
Record[1];
3451 GlobalIdentifierMap.insert(std::make_pair(getTotalNumIdentifiers() + 1,
3457 std::make_pair(LocalBaseIdentifierID,
3460 IdentifiersLoaded.resize(IdentifiersLoaded.size()
3473 for (
unsigned I = 0, N =
Record.size(); I != N; ++I)
3474 EagerlyDeserializedDecls.push_back(
3482 getContext().getLangOpts().BuildingPCHWithObjectFile)
3483 for (
unsigned I = 0, N =
Record.size(); I != N; ++I)
3484 EagerlyDeserializedDecls.push_back(
3489 if (SpecialTypes.empty()) {
3490 for (
unsigned I = 0, N =
Record.size(); I != N; ++I)
3491 SpecialTypes.push_back(getGlobalTypeID(F,
Record[I]));
3495 if (SpecialTypes.size() !=
Record.size())
3496 return llvm::createStringError(std::errc::illegal_byte_sequence,
3497 "invalid special-types record");
3499 for (
unsigned I = 0, N =
Record.size(); I != N; ++I) {
3501 if (!SpecialTypes[I])
3502 SpecialTypes[I] =
ID;
3509 TotalNumStatements +=
Record[0];
3510 TotalNumMacros +=
Record[1];
3511 TotalLexicalDeclContexts +=
Record[2];
3512 TotalVisibleDeclContexts +=
Record[3];
3516 for (
unsigned I = 0, N =
Record.size(); I != N; ++I)
3517 UnusedFileScopedDecls.push_back(
3522 for (
unsigned I = 0, N =
Record.size(); I != N; ++I)
3523 DelegatingCtorDecls.push_back(
3528 if (
Record.size() % 3 != 0)
3529 return llvm::createStringError(std::errc::illegal_byte_sequence,
3530 "invalid weak identifiers record");
3534 WeakUndeclaredIdentifiers.clear();
3537 for (
unsigned I = 0, N =
Record.size(); I < N; ) {
3538 WeakUndeclaredIdentifiers.push_back(
3539 getGlobalIdentifierID(F,
Record[I++]));
3540 WeakUndeclaredIdentifiers.push_back(
3541 getGlobalIdentifierID(F,
Record[I++]));
3542 WeakUndeclaredIdentifiers.push_back(
3543 ReadSourceLocation(F,
Record, I).getRawEncoding());
3550 unsigned LocalBaseSelectorID =
Record[1];
3556 GlobalSelectorMap.insert(std::make_pair(getTotalNumSelectors()+1, &F));
3561 std::make_pair(LocalBaseSelectorID,
3573 = ASTSelectorLookupTable::Create(
3577 TotalNumMethodPoolEntries +=
Record[1];
3582 for (
unsigned Idx = 0, N =
Record.size() - 1; Idx < N; ) {
3583 ReferencedSelectorsData.push_back(getGlobalSelectorID(F,
3585 ReferencedSelectorsData.push_back(ReadSourceLocation(F,
Record, Idx).
3594 PP.setPreambleRecordedPragmaAssumeNonNullLoc(
3595 ReadSourceLocation(F,
Record, Idx));
3601 unsigned Idx = 0,
End =
Record.size() - 1;
3602 bool ReachedEOFWhileSkipping =
Record[Idx++];
3603 std::optional<Preprocessor::PreambleSkipInfo> SkipInfo;
3604 if (ReachedEOFWhileSkipping) {
3607 bool FoundNonSkipPortion =
Record[Idx++];
3608 bool FoundElse =
Record[Idx++];
3610 SkipInfo.emplace(HashToken, IfTokenLoc, FoundNonSkipPortion,
3611 FoundElse, ElseLoc);
3615 auto Loc = ReadSourceLocation(F,
Record, Idx);
3616 bool WasSkipping =
Record[Idx++];
3617 bool FoundNonSkip =
Record[Idx++];
3618 bool FoundElse =
Record[Idx++];
3619 ConditionalStack.push_back(
3620 {
Loc, WasSkipping, FoundNonSkip, FoundElse});
3622 PP.setReplayablePreambleConditionalStack(ConditionalStack, SkipInfo);
3627 if (!
Record.empty() && Listener)
3645 if (!Diags.isDiagnosticInFlight()) {
3647 SourceMgr.noteSLocAddressSpaceUsage(Diags);
3649 return llvm::createStringError(std::errc::invalid_argument,
3650 "ran out of source locations");
3655 unsigned RangeStart =
3657 GlobalSLocEntryMap.insert(std::make_pair(RangeStart, &F));
3662 GlobalSLocOffsetMap.insert(
3664 - SLocSpaceSize,&F));
3675 ParseLineTable(F,
Record);
3679 for (
unsigned I = 0, N =
Record.size(); I != N; ++I)
3684 if (
Record.size() % 3 != 0)
3685 return llvm::createStringError(std::errc::illegal_byte_sequence,
3686 "Invalid VTABLE_USES record");
3693 for (
unsigned Idx = 0, N =
Record.size(); Idx != N; ) {
3694 VTableUses.push_back(
3696 ReadSourceLocation(F,
Record, Idx).getRawEncoding(),
3703 if (
Record.size() % 2 != 0)
3704 return llvm::createStringError(
3705 std::errc::illegal_byte_sequence,
3706 "Invalid PENDING_IMPLICIT_INSTANTIATIONS block");
3708 for (
unsigned I = 0, N =
Record.size(); I != N; ) {
3709 PendingInstantiations.push_back(
3711 ReadSourceLocation(F,
Record, I).getRawEncoding()});
3717 return llvm::createStringError(std::errc::illegal_byte_sequence,
3718 "Invalid SEMA_DECL_REFS block");
3719 for (
unsigned I = 0, N =
Record.size(); I != N; ++I)
3728 unsigned LocalBasePreprocessedEntityID =
Record[0];
3730 unsigned StartingID;
3731 if (!PP.getPreprocessingRecord())
3732 PP.createPreprocessingRecord();
3733 if (!PP.getPreprocessingRecord()->getExternalSource())
3734 PP.getPreprocessingRecord()->SetExternalSource(*
this);
3736 = PP.getPreprocessingRecord()
3743 GlobalPreprocessedEntityMap.insert(std::make_pair(StartingID, &F));
3748 std::make_pair(LocalBasePreprocessedEntityID,
3760 if (!PP.getPreprocessingRecord())
3761 PP.createPreprocessingRecord();
3762 if (!PP.getPreprocessingRecord()->getExternalSource())
3763 PP.getPreprocessingRecord()->SetExternalSource(*
this);
3768 GlobalSkippedRangeMap.insert(
3774 if (
Record.size() % 2 != 0)
3775 return llvm::createStringError(
3776 std::errc::illegal_byte_sequence,
3777 "invalid DECL_UPDATE_OFFSETS block in AST file");
3778 for (
unsigned I = 0, N =
Record.size(); I != N; I += 2) {
3780 DeclUpdateOffsets[
ID].push_back(std::make_pair(&F,
Record[I + 1]));
3784 if (
Decl *D = GetExistingDecl(
ID))
3785 PendingUpdateRecords.push_back(
3786 PendingUpdateRecord(
ID, D,
false));
3791 if (
Record.size() % 3 != 0)
3792 return llvm::createStringError(
3793 std::errc::illegal_byte_sequence,
3794 "invalid DELAYED_NAMESPACE_LEXICAL_VISIBLE_RECORD block in AST "
3796 for (
unsigned I = 0, N =
Record.size(); I != N; I += 3) {
3800 assert(BaseOffset &&
"Invalid DeclsBlockStartOffset for module file!");
3804 DelayedNamespaceOffsetMap[
ID] = {LexicalOffset, VisibleOffset};
3806 assert(!GetExistingDecl(
ID) &&
3807 "We shouldn't load the namespace in the front of delayed "
3808 "namespace lexical and visible block");
3815 return llvm::createStringError(
3816 std::errc::illegal_byte_sequence,
3817 "duplicate OBJC_CATEGORIES_MAP record in AST file");
3830 CUDASpecialDeclRefs.clear();
3831 for (
unsigned I = 0, N =
Record.size(); I != N; ++I)
3832 CUDASpecialDeclRefs.push_back(
3841 = HeaderFileInfoLookupTable::Create(
3845 &PP.getHeaderSearchInfo(),
3846 Blob.data() +
Record[2]));
3848 PP.getHeaderSearchInfo().SetExternalSource(
this);
3849 if (!PP.getHeaderSearchInfo().getExternalLookup())
3850 PP.getHeaderSearchInfo().SetExternalLookup(
this);
3856 FPPragmaOptions.swap(
Record);
3860 for (
unsigned I = 0, E =
Record.size(); I != E; ) {
3861 auto Name = ReadString(
Record, I);
3862 auto &OptInfo = OpenCLExtensions.OptMap[Name];
3863 OptInfo.Supported =
Record[I++] != 0;
3864 OptInfo.Enabled =
Record[I++] != 0;
3865 OptInfo.WithPragma =
Record[I++] != 0;
3866 OptInfo.Avail =
Record[I++];
3867 OptInfo.Core =
Record[I++];
3868 OptInfo.Opt =
Record[I++];
3873 for (
unsigned I = 0, N =
Record.size(); I != N; ++I)
3874 TentativeDefinitions.push_back(
3879 for (
unsigned I = 0, N =
Record.size(); I != N; ++I)
3884 if (
Record.size() % 2 != 0)
3885 return llvm::createStringError(std::errc::illegal_byte_sequence,
3886 "invalid undefined-but-used record");
3887 for (
unsigned I = 0, N =
Record.size(); I != N; ) {
3888 UndefinedButUsed.push_back(
3890 ReadSourceLocation(F,
Record, I).getRawEncoding()});
3895 for (
unsigned I = 0, N =
Record.size(); I != N;) {
3896 DelayedDeleteExprs.push_back(
3899 DelayedDeleteExprs.push_back(Count);
3901 DelayedDeleteExprs.push_back(ReadSourceLocation(F,
Record, I).getRawEncoding());
3902 bool IsArrayForm =
Record[I++] == 1;
3903 DelayedDeleteExprs.push_back(IsArrayForm);
3913 for (
unsigned I = 0, N =
Record.size(); I != N; ) {
3914 unsigned GlobalID = getGlobalSubmoduleID(F,
Record[I++]);
3917 PendingImportedModules.push_back(ImportedSubmodule(GlobalID,
Loc));
3918 if (DeserializationListener)
3919 DeserializationListener->ModuleImportRead(GlobalID,
Loc);
3927 return llvm::createStringError(
3928 std::errc::illegal_byte_sequence,
3929 "duplicate MACRO_OFFSET record in AST file");
3932 unsigned LocalBaseMacroID =
Record[1];
3938 GlobalMacroMap.insert(std::make_pair(getTotalNumMacros() + 1, &F));
3942 std::make_pair(LocalBaseMacroID,
3951 LateParsedTemplates.emplace_back(
3952 std::piecewise_construct, std::forward_as_tuple(&F),
3958 return llvm::createStringError(std::errc::illegal_byte_sequence,
3959 "invalid pragma optimize record");
3960 OptimizeOffPragmaLocation = ReadSourceLocation(F,
Record[0]);
3965 return llvm::createStringError(std::errc::illegal_byte_sequence,
3966 "invalid pragma ms_struct record");
3967 PragmaMSStructState =
Record[0];
3972 return llvm::createStringError(
3973 std::errc::illegal_byte_sequence,
3974 "invalid pragma pointers to members record");
3975 PragmaMSPointersToMembersState =
Record[0];
3976 PointersToMembersPragmaLocation = ReadSourceLocation(F,
Record[1]);
3980 for (
unsigned I = 0, N =
Record.size(); I != N; ++I)
3981 UnusedLocalTypedefNameCandidates.push_back(
3987 return llvm::createStringError(std::errc::illegal_byte_sequence,
3988 "invalid cuda pragma options record");
3989 ForceHostDeviceDepth =
Record[0];
3994 return llvm::createStringError(std::errc::illegal_byte_sequence,
3995 "invalid pragma pack record");
3996 PragmaAlignPackCurrentValue = ReadAlignPackInfo(
Record[0]);
3997 PragmaAlignPackCurrentLocation = ReadSourceLocation(F,
Record[1]);
3998 unsigned NumStackEntries =
Record[2];
4001 PragmaAlignPackStack.clear();
4002 for (
unsigned I = 0; I < NumStackEntries; ++I) {
4003 PragmaAlignPackStackEntry Entry;
4004 Entry.Value = ReadAlignPackInfo(
Record[Idx++]);
4005 Entry.Location = ReadSourceLocation(F,
Record[Idx++]);
4006 Entry.PushLocation = ReadSourceLocation(F,
Record[Idx++]);
4007 PragmaAlignPackStrings.push_back(ReadString(
Record, Idx));
4008 Entry.SlotLabel = PragmaAlignPackStrings.back();
4009 PragmaAlignPackStack.push_back(Entry);
4016 return llvm::createStringError(std::errc::illegal_byte_sequence,
4017 "invalid pragma float control record");
4019 FpPragmaCurrentLocation = ReadSourceLocation(F,
Record[1]);
4020 unsigned NumStackEntries =
Record[2];
4023 FpPragmaStack.clear();
4024 for (
unsigned I = 0; I < NumStackEntries; ++I) {
4025 FpPragmaStackEntry Entry;
4027 Entry.Location = ReadSourceLocation(F,
Record[Idx++]);
4028 Entry.PushLocation = ReadSourceLocation(F,
Record[Idx++]);
4029 FpPragmaStrings.push_back(ReadString(
Record, Idx));
4030 Entry.SlotLabel = FpPragmaStrings.back();
4031 FpPragmaStack.push_back(Entry);
4037 for (
unsigned I = 0, N =
Record.size(); I != N; ++I)
4038 DeclsToCheckForDeferredDiags.insert(
4045 void ASTReader::ReadModuleOffsetMap(
ModuleFile &F)
const {
4063 assert(ImportedModuleVector.empty());
4065 while (Data < DataEnd) {
4069 using namespace llvm::support;
4071 endian::readNext<uint8_t, llvm::endianness::little>(Data));
4072 uint16_t Len = endian::readNext<uint16_t, llvm::endianness::little>(Data);
4073 StringRef Name = StringRef((
const char*)Data, Len);
4077 ? ModuleMgr.lookupByModuleName(Name)
4078 : ModuleMgr.lookupByFileName(Name));
4080 std::string Msg =
"refers to unknown module, cannot find ";
4081 Msg.append(std::string(Name));
4086 ImportedModuleVector.push_back(OM);
4088 uint32_t IdentifierIDOffset =
4089 endian::readNext<uint32_t, llvm::endianness::little>(Data);
4090 uint32_t MacroIDOffset =
4091 endian::readNext<uint32_t, llvm::endianness::little>(Data);
4092 uint32_t PreprocessedEntityIDOffset =
4093 endian::readNext<uint32_t, llvm::endianness::little>(Data);
4094 uint32_t SubmoduleIDOffset =
4095 endian::readNext<uint32_t, llvm::endianness::little>(Data);
4096 uint32_t SelectorIDOffset =
4097 endian::readNext<uint32_t, llvm::endianness::little>(Data);
4098 uint32_t DeclIDOffset =
4099 endian::readNext<uint32_t, llvm::endianness::little>(Data);
4100 uint32_t TypeIndexOffset =
4101 endian::readNext<uint32_t, llvm::endianness::little>(Data);
4103 auto mapOffset = [&](uint32_t
Offset, uint32_t BaseOffset,
4104 RemapBuilder &Remap) {
4107 Remap.insert(std::make_pair(
Offset,
4108 static_cast<int>(BaseOffset -
Offset)));
4112 mapOffset(MacroIDOffset, OM->
BaseMacroID, MacroRemap);
4114 PreprocessedEntityRemap);
4117 mapOffset(DeclIDOffset, OM->
BaseDeclID, DeclRemap);
4128 unsigned ClientLoadCapabilities) {
4137 "MODULE_NAME should come before MODULE_MAP_FILE");
4138 if (PP.getPreprocessorOpts().ModulesCheckRelocated &&
4144 auto &Map = PP.getHeaderSearchInfo().getModuleMap();
4146 M ? Map.getModuleMapFileForUniquing(M) : std::nullopt;
4148 if (!
bool(PP.getPreprocessorOpts().DisablePCHOrModuleValidation &
4151 if (!canRecoverFromOutOfDate(F.
FileName, ClientLoadCapabilities)) {
4152 if (
auto ASTFE = M ? M->
getASTFile() : std::nullopt) {
4155 << ASTFE->getName();
4158 Diag(diag::err_imported_module_not_found)
4166 Diag(diag::note_imported_by_pch_module_not_found)
4173 assert(M && M->
Name == F.
ModuleName &&
"found module with different name");
4177 if (!StoredModMap || *StoredModMap != ModMap) {
4178 assert(ModMap &&
"found module is missing module map file");
4180 "top-level import should be verified");
4182 if (!canRecoverFromOutOfDate(F.
FileName, ClientLoadCapabilities))
4183 Diag(diag::err_imported_module_modmap_changed)
4190 for (
unsigned I = 0, N =
Record[Idx++]; I < N; ++I) {
4195 if (!canRecoverFromOutOfDate(F.
FileName, ClientLoadCapabilities))
4196 Error(
"could not find file '" +
Filename +
"' referenced by AST file");
4199 AdditionalStoredMaps.insert(*SF);
4204 if (
auto *AdditionalModuleMaps = Map.getAdditionalModuleMapFiles(M)) {
4208 if (!AdditionalStoredMaps.erase(ModMap)) {
4209 if (!canRecoverFromOutOfDate(F.
FileName, ClientLoadCapabilities))
4210 Diag(diag::err_module_different_modmap)
4220 if (!canRecoverFromOutOfDate(F.
FileName, ClientLoadCapabilities))
4221 Diag(diag::err_module_different_modmap)
4242 : Known->second.second;
4244 for (
ObjCMethodList *List = &Start; List; List = List->getNext()) {
4246 if (List->getMethod() == Method) {
4254 if (List->getNext())
4255 List->setMethod(List->getNext()->getMethod());
4257 List->setMethod(Method);
4263 for (
Decl *D : Names) {
4264 bool wasHidden = !D->isUnconditionallyVisible();
4265 D->setVisibleDespiteOwningModule();
4267 if (wasHidden && SemaObj) {
4280 Stack.push_back(Mod);
4281 while (!Stack.empty()) {
4282 Mod = Stack.pop_back_val();
4284 if (NameVisibility <= Mod->NameVisibility) {
4300 HiddenNamesMapType::iterator Hidden = HiddenNamesMap.find(Mod);
4301 if (Hidden != HiddenNamesMap.end()) {
4303 HiddenNamesMap.erase(Hidden);
4305 assert(!HiddenNamesMap.contains(Mod) &&
4306 "making names visible added hidden names");
4313 I = Exports.begin(), E = Exports.end(); I != E; ++I) {
4315 if (
Visited.insert(Exported).second)
4316 Stack.push_back(Exported);
4331 getContext().mergeDefinitionIntoModule(
4334 PendingMergedDefinitionsToDeduplicate.insert(Def);
4343 if (TriedLoadingGlobalIndex || !UseGlobalIndex ||
4344 !PP.getLangOpts().Modules)
4348 TriedLoadingGlobalIndex =
true;
4349 StringRef ModuleCachePath
4350 = getPreprocessor().getHeaderSearchInfo().getModuleCachePath();
4351 std::pair<GlobalModuleIndex *, llvm::Error> Result =
4353 if (llvm::Error Err = std::move(Result.second)) {
4354 assert(!Result.first);
4355 consumeError(std::move(Err));
4359 GlobalIndex.reset(Result.first);
4360 ModuleMgr.setGlobalIndex(GlobalIndex.get());
4365 return PP.getLangOpts().Modules && UseGlobalIndex &&
4366 !hasGlobalIndex() && TriedLoadingGlobalIndex;
4373 llvm::raw_fd_ostream OS(TimestampFilename, EC,
4374 llvm::sys::fs::OF_TextWithCRLF);
4377 OS <<
"Timestamp file\n";
4390 consumeError(MaybeEntry.takeError());
4393 llvm::BitstreamEntry Entry = MaybeEntry.get();
4395 switch (Entry.Kind) {
4397 case llvm::BitstreamEntry::EndBlock:
4406 consumeError(Skipped.takeError());
4410 case llvm::BitstreamEntry::SubBlock:
4414 consumeError(std::move(Err));
4421 if (llvm::Error Err =
Cursor.SkipBlock()) {
4423 consumeError(std::move(Err));
4432 unsigned ClientLoadCapabilities,
4434 llvm::TimeTraceScope scope(
"ReadAST",
FileName);
4438 CurrentDeserializingModuleKind,
Type);
4444 unsigned PreviousGeneration = 0;
4446 PreviousGeneration = incrementGeneration(*ContextObj);
4448 unsigned NumModules = ModuleMgr.size();
4453 ClientLoadCapabilities)) {
4454 ModuleMgr.removeModules(ModuleMgr.begin() + NumModules);
4458 GlobalIndex.reset();
4459 ModuleMgr.setGlobalIndex(
nullptr);
4463 if (NewLoadedModuleFile && !Loaded.empty())
4464 *NewLoadedModuleFile = Loaded.back().Mod;
4475 for (ImportedModule &M : Loaded) {
4477 llvm::TimeTraceScope Scope2(
"Read Loaded AST", F.
ModuleName);
4480 if (llvm::Error Err = ReadASTBlock(F, ClientLoadCapabilities)) {
4481 Error(std::move(Err));
4487 Error(diag::err_module_file_missing_top_level_submodule, F.
FileName);
4493 if (llvm::Error Err = ReadExtensionBlock(F)) {
4494 Error(std::move(Err));
4507 for (ImportedModule &M : Loaded) {
4523 if (!PP.getLangOpts().CPlusPlus) {
4530 auto It = PP.getIdentifierTable().find(Key);
4531 if (It == PP.getIdentifierTable().end())
4540 II = &PP.getIdentifierTable().getOwn(Key);
4551 SetIdentifierInfo(
ID, II);
4558 for (
auto &
Id : PP.getIdentifierTable())
4559 Id.second->setOutOfDate(
true);
4562 for (
const auto &Sel : SelectorGeneration)
4563 SelectorOutOfDate[Sel.first] =
true;
4567 for (ImportedModule &M : Loaded) {
4570 ModuleMgr.moduleFileAccepted(&F);
4579 F.
ImportLoc = TranslateSourceLocation(*M.ImportedBy, M.ImportLoc);
4583 for (
unsigned I = 0, N = UnresolvedModuleRefs.size(); I != N; ++I) {
4584 UnresolvedModuleRef &
Unresolved = UnresolvedModuleRefs[I];
4586 Module *ResolvedMod = getSubmodule(GlobalID);
4589 case UnresolvedModuleRef::Conflict:
4592 Conflict.
Other = ResolvedMod;
4594 Unresolved.Mod->Conflicts.push_back(Conflict);
4598 case UnresolvedModuleRef::Import:
4603 case UnresolvedModuleRef::Affecting:
4605 Unresolved.Mod->AffectingClangModules.insert(ResolvedMod);
4608 case UnresolvedModuleRef::Export:
4615 UnresolvedModuleRefs.clear();
4622 InitializeContext();
4627 if (DeserializationListener)
4628 DeserializationListener->ReaderInitialized(
this);
4630 ModuleFile &PrimaryModule = ModuleMgr.getPrimaryModule();
4645 for (
unsigned I = 0, N = ObjCClassesLoaded.size(); I != N; ++I) {
4646 loadObjCCategories(
GlobalDeclID(ObjCClassesLoaded[I]->getGlobalID()),
4647 ObjCClassesLoaded[I], PreviousGeneration);
4656 for (
unsigned I = 0, N = Loaded.size(); I != N; ++I) {
4657 ImportedModule &M = Loaded[I];
4674 if (!Stream.canSkipToPos(4))
4675 return llvm::createStringError(std::errc::illegal_byte_sequence,
4676 "file too small to contain AST file magic");
4677 for (
unsigned C : {
'C',
'P',
'C',
'H'})
4680 return llvm::createStringError(
4681 std::errc::illegal_byte_sequence,
4682 "file doesn't start with AST file magic");
4684 return Res.takeError();
4685 return llvm::Error::success();
4700 llvm_unreachable(
"unknown module kind");
4704 ASTReader::ReadASTCore(StringRef FileName,
4709 off_t ExpectedSize, time_t ExpectedModTime,
4711 unsigned ClientLoadCapabilities) {
4713 std::string ErrorStr;
4715 = ModuleMgr.addModule(FileName,
Type, ImportLoc, ImportedBy,
4716 getGeneration(), ExpectedSize, ExpectedModTime,
4720 switch (AddResult) {
4722 Diag(diag::remark_module_import)
4724 << (ImportedBy ? StringRef(ImportedBy->
ModuleName) : StringRef());
4734 if (ClientLoadCapabilities & ARR_Missing)
4738 Diag(diag::err_ast_file_not_found)
4746 if (ClientLoadCapabilities & ARR_OutOfDate)
4750 Diag(diag::err_ast_file_out_of_date)
4756 assert(M &&
"Missing module file");
4758 bool ShouldFinalizePCM =
false;
4759 auto FinalizeOrDropPCM = llvm::make_scope_exit([&]() {
4760 auto &MC = getModuleManager().getModuleCache();
4761 if (ShouldFinalizePCM)
4762 MC.finalizePCM(FileName);
4764 MC.tryToDropPCM(FileName);
4767 BitstreamCursor &Stream = F.
Stream;
4768 Stream = BitstreamCursor(PCHContainerRdr.ExtractPCH(*F.Buffer));
4769 F.SizeInBits = F.Buffer->getBufferSize() * 8;
4773 Diag(diag::err_ast_file_invalid)
4779 bool HaveReadControlBlock =
false;
4783 Error(MaybeEntry.takeError());
4786 llvm::BitstreamEntry Entry = MaybeEntry.get();
4788 switch (Entry.Kind) {
4791 case llvm::BitstreamEntry::EndBlock:
4792 Error(
"invalid record at top-level of AST file");
4795 case llvm::BitstreamEntry::SubBlock:
4801 HaveReadControlBlock =
true;
4802 switch (ReadControlBlock(F, Loaded, ImportedBy, ClientLoadCapabilities)) {
4810 F.ModuleName.empty()) {
4812 if (Result != OutOfDate ||
4813 (ClientLoadCapabilities & ARR_OutOfDate) == 0)
4819 case Failure:
return Failure;
4820 case Missing:
return Missing;
4821 case OutOfDate:
return OutOfDate;
4823 case ConfigurationMismatch:
return ConfigurationMismatch;
4824 case HadErrors:
return HadErrors;
4829 if (!HaveReadControlBlock) {
4830 if ((ClientLoadCapabilities & ARR_VersionMismatch) == 0)
4831 Diag(diag::err_pch_version_too_old);
4836 Loaded.push_back(ImportedModule(M, ImportedBy, ImportLoc));
4837 ShouldFinalizePCM =
true;
4841 if (llvm::Error Err = Stream.SkipBlock()) {
4842 Error(std::move(Err));
4849 llvm_unreachable(
"unexpected break; expected return");
4853 ASTReader::readUnhashedControlBlock(
ModuleFile &F,
bool WasImportedBy,
4854 unsigned ClientLoadCapabilities) {
4856 PP.getHeaderSearchInfo().getHeaderSearchOpts();
4857 bool AllowCompatibleConfigurationMismatch =
4859 bool DisableValidation = shouldDisableValidationForFile(F);
4861 ASTReadResult Result = readUnhashedControlBlockImpl(
4862 &F, F.
Data, ClientLoadCapabilities, AllowCompatibleConfigurationMismatch,
4868 if (DisableValidation || WasImportedBy ||
4869 (AllowConfigurationMismatch && Result == ConfigurationMismatch))
4872 if (Result == Failure) {
4873 Error(
"malformed block record in AST file");
4896 if (getModuleManager().getModuleCache().isPCMFinal(F.
FileName)) {
4897 Diag(diag::warn_module_system_bit_conflict) << F.
FileName;
4906 ModuleFile *F, llvm::StringRef StreamData,
unsigned ClientLoadCapabilities,
4908 bool ValidateDiagnosticOptions) {
4910 BitstreamCursor Stream(StreamData);
4915 consumeError(std::move(Err));
4925 ASTReadResult Result =
Success;
4930 consumeError(MaybeEntry.takeError());
4933 llvm::BitstreamEntry Entry = MaybeEntry.get();
4935 switch (Entry.Kind) {
4937 case llvm::BitstreamEntry::SubBlock:
4940 case llvm::BitstreamEntry::EndBlock:
4952 Stream.readRecord(Entry.ID,
Record, &Blob);
4953 if (!MaybeRecordType) {
4962 "Dummy AST file signature not backpatched in ASTWriter.");
4969 "Dummy AST block hash not backpatched in ASTWriter.");
4973 bool Complain = (ClientLoadCapabilities & ARR_OutOfDate) == 0;
4974 if (Listener && ValidateDiagnosticOptions &&
4975 !AllowCompatibleConfigurationMismatch &&
4976 ParseDiagnosticOptions(
Record, Complain, *Listener))
4981 bool Complain = (ClientLoadCapabilities & ARR_ConfigurationMismatch) == 0;
4982 if (Listener && !AllowCompatibleConfigurationMismatch &&
4983 ParseHeaderSearchPaths(
Record, Complain, *Listener))
4984 Result = ConfigurationMismatch;
5013 if (
Record.size() < 4)
return true;
5018 unsigned BlockNameLen =
Record[2];
5019 unsigned UserInfoLen =
Record[3];
5021 if (BlockNameLen + UserInfoLen > Blob.size())
return true;
5023 Metadata.
BlockName = std::string(Blob.data(), Blob.data() + BlockNameLen);
5024 Metadata.
UserInfo = std::string(Blob.data() + BlockNameLen,
5025 Blob.data() + BlockNameLen + UserInfoLen);
5029 llvm::Error ASTReader::ReadExtensionBlock(
ModuleFile &F) {
5030 BitstreamCursor &Stream = F.
Stream;
5036 return MaybeEntry.takeError();
5037 llvm::BitstreamEntry Entry = MaybeEntry.get();
5039 switch (Entry.Kind) {
5040 case llvm::BitstreamEntry::SubBlock:
5041 if (llvm::Error Err = Stream.SkipBlock())
5044 case llvm::BitstreamEntry::EndBlock:
5045 return llvm::Error::success();
5047 return llvm::createStringError(std::errc::illegal_byte_sequence,
5048 "malformed block record in AST file");
5056 Stream.readRecord(Entry.ID,
Record, &Blob);
5058 return MaybeRecCode.takeError();
5059 switch (MaybeRecCode.get()) {
5063 return llvm::createStringError(
5064 std::errc::illegal_byte_sequence,
5065 "malformed EXTENSION_METADATA in AST file");
5068 auto Known = ModuleFileExtensions.find(Metadata.
BlockName);
5069 if (Known == ModuleFileExtensions.end())
break;
5072 if (
auto Reader = Known->second->createExtensionReader(Metadata, *
this,
5082 return llvm::Error::success();
5086 assert(ContextObj &&
"no context to initialize");
5090 if (DeserializationListener)
5091 DeserializationListener->DeclRead(
5101 if (!Context.CFConstantStringTypeDecl)
5108 Error(
"FILE type is NULL");
5112 if (!Context.FILEDecl) {
5118 Error(
"Invalid FILE type in AST file");
5127 QualType Jmp_bufType = GetType(Jmp_buf);
5128 if (Jmp_bufType.
isNull()) {
5129 Error(
"jmp_buf type is NULL");
5133 if (!Context.jmp_bufDecl) {
5139 Error(
"Invalid jmp_buf type in AST file");
5148 QualType Sigjmp_bufType = GetType(Sigjmp_buf);
5149 if (Sigjmp_bufType.
isNull()) {
5150 Error(
"sigjmp_buf type is NULL");
5154 if (!Context.sigjmp_bufDecl) {
5159 assert(Tag &&
"Invalid sigjmp_buf type in AST file");
5165 if (
unsigned ObjCIdRedef
5167 if (Context.ObjCIdRedefinitionType.
isNull())
5168 Context.ObjCIdRedefinitionType = GetType(ObjCIdRedef);
5171 if (
unsigned ObjCClassRedef
5173 if (Context.ObjCClassRedefinitionType.
isNull())
5174 Context.ObjCClassRedefinitionType = GetType(ObjCClassRedef);
5177 if (
unsigned ObjCSelRedef
5179 if (Context.ObjCSelRedefinitionType.
isNull())
5180 Context.ObjCSelRedefinitionType = GetType(ObjCSelRedef);
5184 QualType Ucontext_tType = GetType(Ucontext_t);
5185 if (Ucontext_tType.
isNull()) {
5186 Error(
"ucontext_t type is NULL");
5190 if (!Context.ucontext_tDecl) {
5195 assert(Tag &&
"Invalid ucontext_t type in AST file");
5205 if (!CUDASpecialDeclRefs.empty()) {
5206 assert(CUDASpecialDeclRefs.size() == 1 &&
"More decl refs than expected!");
5208 cast<FunctionDecl>(GetDecl(CUDASpecialDeclRefs[0])));
5213 for (
auto &Import : PendingImportedModules) {
5214 if (
Module *Imported = getSubmodule(Import.ID)) {
5217 if (Import.ImportLoc.isValid())
5218 PP.makeModuleVisible(Imported, Import.ImportLoc);
5225 PendingImportedModulesSema.append(PendingImportedModules);
5226 PendingImportedModules.clear();
5236 BitstreamCursor Stream(
PCH);
5239 consumeError(std::move(Err));
5251 Stream.advanceSkippingSubblocks();
5254 consumeError(MaybeEntry.takeError());
5257 llvm::BitstreamEntry Entry = MaybeEntry.get();
5267 consumeError(MaybeRecord.takeError());
5273 "Dummy AST file signature not backpatched in ASTWriter.");
5283 const std::string &ASTFileName,
FileManager &FileMgr,
5289 Diags.
Report(diag::err_fe_unable_to_read_pch_file)
5290 << ASTFileName << Buffer.getError().message();
5291 return std::string();
5295 BitstreamCursor Stream(PCHContainerRdr.
ExtractPCH(**Buffer));
5299 Diags.
Report(diag::err_fe_not_a_pch_file) << ASTFileName << std::move(Err);
5300 return std::string();
5305 Diags.
Report(diag::err_fe_pch_malformed_block) << ASTFileName;
5306 return std::string();
5313 Stream.advanceSkippingSubblocks();
5316 consumeError(MaybeEntry.takeError());
5317 return std::string();
5319 llvm::BitstreamEntry Entry = MaybeEntry.get();
5321 if (Entry.Kind == llvm::BitstreamEntry::EndBlock)
5322 return std::string();
5325 Diags.
Report(diag::err_fe_pch_malformed_block) << ASTFileName;
5326 return std::string();
5334 consumeError(MaybeRecord.takeError());
5335 return std::string();
5348 std::string ExistingModuleCachePath;
5350 bool StrictOptionMatches;
5353 SimplePCHValidator(
const LangOptions &ExistingLangOpts,
5356 StringRef ExistingModuleCachePath,
FileManager &FileMgr,
5357 bool StrictOptionMatches)
5358 : ExistingLangOpts(ExistingLangOpts),
5359 ExistingTargetOpts(ExistingTargetOpts),
5360 ExistingPPOpts(ExistingPPOpts),
5361 ExistingModuleCachePath(ExistingModuleCachePath), FileMgr(FileMgr),
5362 StrictOptionMatches(StrictOptionMatches) {}
5364 bool ReadLanguageOptions(
const LangOptions &LangOpts,
bool Complain,
5365 bool AllowCompatibleDifferences)
override {
5367 AllowCompatibleDifferences);
5370 bool ReadTargetOptions(
const TargetOptions &TargetOpts,
bool Complain,
5371 bool AllowCompatibleDifferences)
override {
5373 AllowCompatibleDifferences);
5377 StringRef SpecificModuleCachePath,
5378 bool Complain)
override {
5381 ExistingModuleCachePath,
nullptr, ExistingLangOpts, ExistingPPOpts);
5385 bool ReadMacros,
bool Complain,
5386 std::string &SuggestedPredefines)
override {
5388 PPOpts, ExistingPPOpts, ReadMacros,
nullptr, FileMgr,
5389 SuggestedPredefines, ExistingLangOpts,
5402 unsigned ClientLoadCapabilities) {
5404 std::unique_ptr<llvm::MemoryBuffer> OwnedBuffer;
5416 OwnedBuffer = std::move(*BufferOrErr);
5417 Buffer = OwnedBuffer.get();
5421 StringRef Bytes = PCHContainerRdr.
ExtractPCH(*Buffer);
5422 BitstreamCursor Stream(Bytes);
5426 consumeError(std::move(Err));
5437 BitstreamCursor InputFilesCursor;
5441 std::string ModuleDir;
5442 bool DoneWithControlBlock =
false;
5443 while (!DoneWithControlBlock) {
5447 consumeError(MaybeEntry.takeError());
5450 llvm::BitstreamEntry Entry = MaybeEntry.get();
5452 switch (Entry.Kind) {
5453 case llvm::BitstreamEntry::SubBlock: {
5456 std::string IgnoredSuggestedPredefines;
5457 if (ReadOptionsBlock(Stream, ClientLoadCapabilities,
5459 Listener, IgnoredSuggestedPredefines) != Success)
5465 InputFilesCursor = Stream;
5466 if (llvm::Error Err = Stream.SkipBlock()) {
5468 consumeError(std::move(Err));
5471 if (NeedsInputFiles &&
5474 InputFilesOffsetBase = InputFilesCursor.GetCurrentBitNo();
5478 if (llvm::Error Err = Stream.SkipBlock()) {
5480 consumeError(std::move(Err));
5489 case llvm::BitstreamEntry::EndBlock:
5490 DoneWithControlBlock =
true;
5500 if (DoneWithControlBlock)
break;
5505 Stream.readRecord(Entry.ID,
Record, &Blob);
5506 if (!MaybeRecCode) {
5521 ModuleDir = std::string(Blob);
5525 auto Path = ReadString(
Record, Idx);
5526 ResolveImportedPath(Path, ModuleDir);
5531 if (!NeedsInputFiles)
5534 unsigned NumInputFiles =
Record[0];
5535 unsigned NumUserFiles =
Record[1];
5536 const llvm::support::unaligned_uint64_t *InputFileOffs =
5537 (
const llvm::support::unaligned_uint64_t *)Blob.data();
5538 for (
unsigned I = 0; I != NumInputFiles; ++I) {
5540 bool isSystemFile = I >= NumUserFiles;
5542 if (isSystemFile && !NeedsSystemInputFiles)
5545 BitstreamCursor &
Cursor = InputFilesCursor;
5547 if (llvm::Error Err =
5548 Cursor.JumpToBit(InputFilesOffsetBase + InputFileOffs[I])) {
5550 consumeError(std::move(Err));
5556 consumeError(MaybeCode.takeError());
5558 unsigned Code = MaybeCode.get();
5562 bool shouldContinue =
false;
5565 if (!MaybeRecordType) {
5567 consumeError(MaybeRecordType.takeError());
5573 bool Overridden =
static_cast<bool>(
Record[3]);
5574 std::string
Filename = std::string(Blob);
5575 ResolveImportedPath(
Filename, ModuleDir);
5577 Filename, isSystemFile, Overridden,
false);
5580 if (!shouldContinue)
5590 unsigned Idx = 0, N =
Record.size();
5596 bool IsStandardCXXModule =
Record[Idx++];
5603 if (IsStandardCXXModule) {
5604 std::string ModuleName = ReadString(
Record, Idx);
5611 std::string ModuleName = ReadString(
Record, Idx);
5613 ResolveImportedPath(
Filename, ModuleDir);
5626 if (FindModuleFileExtensions) {
5627 BitstreamCursor SavedStream = Stream;
5629 bool DoneWithExtensionBlock =
false;
5630 while (!DoneWithExtensionBlock) {
5636 llvm::BitstreamEntry Entry = MaybeEntry.get();
5638 switch (Entry.Kind) {
5639 case llvm::BitstreamEntry::SubBlock:
5640 if (llvm::Error Err = Stream.SkipBlock()) {
5642 consumeError(std::move(Err));
5647 case llvm::BitstreamEntry::EndBlock:
5648 DoneWithExtensionBlock =
true;
5661 Stream.readRecord(Entry.ID,
Record, &Blob);
5662 if (!MaybeRecCode) {
5666 switch (MaybeRecCode.get()) {
5678 Stream = SavedStream;
5682 if (readUnhashedControlBlockImpl(
5683 nullptr, Bytes, ClientLoadCapabilities,
5685 ValidateDiagnosticOptions) != Success)
5697 StringRef ExistingModuleCachePath,
5698 bool RequireStrictOptionMatches) {
5699 SimplePCHValidator validator(LangOpts, TargetOpts, PPOpts,
5700 ExistingModuleCachePath, FileMgr,
5701 RequireStrictOptionMatches);
5702 return !readASTFileControlBlock(
Filename, FileMgr, ModuleCache,
5708 llvm::Error ASTReader::ReadSubmoduleBlock(
ModuleFile &F,
5709 unsigned ClientLoadCapabilities) {
5714 ModuleMap &ModMap = PP.getHeaderSearchInfo().getModuleMap();
5716 Module *CurrentModule =
nullptr;
5720 F.
Stream.advanceSkippingSubblocks();
5722 return MaybeEntry.takeError();
5723 llvm::BitstreamEntry Entry = MaybeEntry.get();
5725 switch (Entry.Kind) {
5726 case llvm::BitstreamEntry::SubBlock:
5728 return llvm::createStringError(std::errc::illegal_byte_sequence,
5729 "malformed block record in AST file");
5730 case llvm::BitstreamEntry::EndBlock:
5731 return llvm::Error::success();
5742 return MaybeKind.takeError();
5743 unsigned Kind = MaybeKind.get();
5746 return llvm::createStringError(
5747 std::errc::illegal_byte_sequence,
5748 "submodule metadata record should be at beginning of block");
5763 return llvm::createStringError(std::errc::illegal_byte_sequence,
5764 "malformed module definition");
5766 StringRef Name = Blob;
5772 bool IsFramework =
Record[Idx++];
5773 bool IsExplicit =
Record[Idx++];
5774 bool IsSystem =
Record[Idx++];
5775 bool IsExternC =
Record[Idx++];
5776 bool InferSubmodules =
Record[Idx++];
5777 bool InferExplicitSubmodules =
Record[Idx++];
5778 bool InferExportWildcard =
Record[Idx++];
5779 bool ConfigMacrosExhaustive =
Record[Idx++];
5780 bool ModuleMapIsPrivate =
Record[Idx++];
5781 bool NamedModuleHasInit =
Record[Idx++];
5783 Module *ParentModule =
nullptr;
5785 ParentModule = getSubmodule(
Parent);
5796 if (GlobalIndex >= SubmodulesLoaded.size() ||
5797 SubmodulesLoaded[GlobalIndex])
5798 return llvm::createStringError(std::errc::invalid_argument,
5799 "too many submodules");
5801 if (!ParentModule) {
5804 if (!
bool(PP.getPreprocessorOpts().DisablePCHOrModuleValidation &
5806 CurFile != F.
File) {
5807 auto ConflictError =
5809 ContextObj->DiagAllocator)
5833 if (DeserializationListener)
5834 DeserializationListener->ModuleRead(GlobalID, CurrentModule);
5836 SubmodulesLoaded[GlobalIndex] = CurrentModule;
5861 std::string
Filename = std::string(Blob);
5863 if (
auto Umbrella = PP.getFileManager().getOptionalFileRef(
Filename)) {
5891 std::string HeaderName(Blob);
5892 ResolveImportedPath(F, HeaderName);
5899 std::string Dirname = std::string(Blob);
5900 ResolveImportedPath(F, Dirname);
5902 PP.getFileManager().getOptionalDirectoryRef(Dirname)) {
5914 unsigned LocalBaseSubmoduleID =
Record[1];
5918 GlobalSubmoduleMap.insert(std::make_pair(getTotalNumSubmodules()+1,&F));
5923 std::make_pair(LocalBaseSubmoduleID,
5932 for (
unsigned Idx = 0; Idx !=
Record.size(); ++Idx) {
5937 Unresolved.Kind = UnresolvedModuleRef::Import;
5939 UnresolvedModuleRefs.push_back(Unresolved);
5944 for (
unsigned Idx = 0; Idx !=
Record.size(); ++Idx) {
5949 Unresolved.Kind = UnresolvedModuleRef::Affecting;
5951 UnresolvedModuleRefs.push_back(Unresolved);
5956 for (
unsigned Idx = 0; Idx + 1 <
Record.size(); Idx += 2) {
5961 Unresolved.Kind = UnresolvedModuleRef::Export;
5963 UnresolvedModuleRefs.push_back(Unresolved);
5973 PP.getTargetInfo());
5979 Module::LinkLibrary(std::string(Blob),
Record[0]));
5991 Unresolved.Kind = UnresolvedModuleRef::Conflict;
5994 UnresolvedModuleRefs.push_back(Unresolved);
6004 ContextObj->addLazyModuleInitializers(CurrentModule, Inits);
6023 bool ASTReader::ParseLanguageOptions(
const RecordData &
Record,
6026 bool AllowCompatibleDifferences) {
6029 #define LANGOPT(Name, Bits, Default, Description) \
6030 LangOpts.Name = Record[Idx++];
6031 #define ENUM_LANGOPT(Name, Type, Bits, Default, Description) \
6032 LangOpts.set##Name(static_cast<LangOptions::Type>(Record[Idx++]));
6033 #include "clang/Basic/LangOptions.def"
6034 #define SANITIZER(NAME, ID) \
6035 LangOpts.Sanitize.set(SanitizerKind::ID, Record[Idx++]);
6036 #include "clang/Basic/Sanitizers.def"
6038 for (
unsigned N =
Record[Idx++]; N; --N)
6042 VersionTuple runtimeVersion = ReadVersionTuple(
Record, Idx);
6048 for (
unsigned N =
Record[Idx++]; N; --N) {
6050 ReadString(
Record, Idx));
6055 for (
unsigned N =
Record[Idx++]; N; --N) {
6062 AllowCompatibleDifferences);
6065 bool ASTReader::ParseTargetOptions(
const RecordData &
Record,
bool Complain,
6067 bool AllowCompatibleDifferences) {
6071 TargetOpts.
CPU = ReadString(
Record, Idx);
6073 TargetOpts.
ABI = ReadString(
Record, Idx);
6074 for (
unsigned N =
Record[Idx++]; N; --N) {
6077 for (
unsigned N =
Record[Idx++]; N; --N) {
6082 AllowCompatibleDifferences);
6085 bool ASTReader::ParseDiagnosticOptions(
const RecordData &
Record,
bool Complain,
6089 #define DIAGOPT(Name, Bits, Default) DiagOpts->Name = Record[Idx++];
6090 #define ENUM_DIAGOPT(Name, Type, Bits, Default) \
6091 DiagOpts->set##Name(static_cast<Type>(Record[Idx++]));
6092 #include "clang/Basic/DiagnosticOptions.def"
6094 for (
unsigned N =
Record[Idx++]; N; --N)
6095 DiagOpts->Warnings.push_back(ReadString(
Record, Idx));
6096 for (
unsigned N =
Record[Idx++]; N; --N)
6097 DiagOpts->Remarks.push_back(ReadString(
Record, Idx));
6102 bool ASTReader::ParseFileSystemOptions(
const RecordData &
Record,
bool Complain,
6110 bool ASTReader::ParseHeaderSearchOptions(
const RecordData &
Record,
6128 std::string SpecificModuleCachePath = ReadString(
Record, Idx);
6134 bool ASTReader::ParseHeaderSearchPaths(
const RecordData &
Record,
bool Complain,
6140 for (
unsigned N =
Record[Idx++]; N; --N) {
6141 std::string Path = ReadString(
Record, Idx);
6144 bool IsFramework =
Record[Idx++];
6145 bool IgnoreSysRoot =
Record[Idx++];
6151 for (
unsigned N =
Record[Idx++]; N; --N) {
6152 std::string Prefix = ReadString(
Record, Idx);
6153 bool IsSystemHeader =
Record[Idx++];
6158 for (
unsigned N =
Record[Idx++]; N; --N) {
6159 std::string VFSOverlayFile = ReadString(
Record, Idx);
6166 bool ASTReader::ParsePreprocessorOptions(
const RecordData &
Record,
6169 std::string &SuggestedPredefines) {
6174 bool ReadMacros =
Record[Idx++];
6176 for (
unsigned N =
Record[Idx++]; N; --N) {
6178 bool IsUndef =
Record[Idx++];
6179 PPOpts.
Macros.push_back(std::make_pair(Macro, IsUndef));
6184 for (
unsigned N =
Record[Idx++]; N; --N) {
6189 for (
unsigned N =
Record[Idx++]; N; --N) {
6198 SuggestedPredefines.clear();
6200 SuggestedPredefines);
6203 std::pair<ModuleFile *, unsigned>
6204 ASTReader::getModulePreprocessedEntity(
unsigned GlobalIndex) {
6205 GlobalPreprocessedEntityMapType::iterator
6206 I = GlobalPreprocessedEntityMap.find(GlobalIndex);
6207 assert(I != GlobalPreprocessedEntityMap.end() &&
6208 "Corrupted global preprocessed entity map");
6211 return std::make_pair(M, LocalIndex);
6214 llvm::iterator_range<PreprocessingRecord::iterator>
6215 ASTReader::getModulePreprocessedEntities(
ModuleFile &Mod)
const {
6224 bool ASTReader::canRecoverFromOutOfDate(StringRef ModuleFileName,
6225 unsigned int ClientLoadCapabilities) {
6226 return ClientLoadCapabilities & ARR_OutOfDate &&
6227 !getModuleManager().getModuleCache().isPCMFinal(ModuleFileName);
6230 llvm::iterator_range<ASTReader::ModuleDeclIterator>
6232 return llvm::make_range(
6239 auto I = GlobalSkippedRangeMap.find(GlobalIndex);
6240 assert(I != GlobalSkippedRangeMap.end() &&
6241 "Corrupted global skipped range map");
6244 assert(LocalIndex < M->NumPreprocessedSkippedRanges);
6247 ReadSourceLocation(*M, RawRange.
getEnd()));
6254 std::pair<ModuleFile *, unsigned> PPInfo = getModulePreprocessedEntity(Index);
6256 unsigned LocalIndex = PPInfo.second;
6259 if (!PP.getPreprocessingRecord()) {
6260 Error(
"no preprocessing record");
6267 Error(std::move(Err));
6274 Error(MaybeEntry.takeError());
6277 llvm::BitstreamEntry Entry = MaybeEntry.get();
6284 ReadSourceLocation(M, PPOffs.
getEnd()));
6290 if (!MaybeRecType) {
6291 Error(MaybeRecType.takeError());
6296 bool isBuiltin =
Record[0];
6300 Name = getLocalIdentifier(M,
Record[1]);
6303 getGlobalPreprocessedEntityID(M,
Record[1]);
6304 Def = cast<MacroDefinitionRecord>(
6305 PPRec.getLoadedPreprocessedEntity(GlobalID - 1));
6323 if (DeserializationListener)
6324 DeserializationListener->MacroDefinitionRead(PPID, MD);
6330 const char *FullFileNameStart = Blob.data() +
Record[0];
6331 StringRef FullFileName(FullFileNameStart, Blob.size() -
Record[0]);
6333 if (!FullFileName.empty())
6334 File = PP.getFileManager().getOptionalFileRef(FullFileName);
6341 StringRef(Blob.data(),
Record[0]),
6349 llvm_unreachable(
"Invalid PreprocessorDetailRecordTypes");
6359 GlobalSLocOffsetMapType::const_iterator SLocMapI)
const {
6361 for (GlobalSLocOffsetMapType::const_iterator
6362 EndI = GlobalSLocOffsetMap.end(); SLocMapI != EndI; ++SLocMapI) {
6368 return getTotalNumPreprocessedEntities();
6373 struct PPEntityComp {
6403 bool EndsAfter)
const {
6404 if (SourceMgr.isLocalSourceLocation(
Loc))
6405 return getTotalNumPreprocessedEntities();
6407 GlobalSLocOffsetMapType::const_iterator SLocMapI = GlobalSLocOffsetMap.find(
6408 SourceManager::MaxLoadedOffset -
Loc.getOffset() - 1);
6409 assert(SLocMapI != GlobalSLocOffsetMap.end() &&
6410 "Corrupted global sloc offset map");
6412 if (SLocMapI->second->NumPreprocessedEntities == 0)
6413 return findNextPreprocessedEntity(SLocMapI);
6424 pp_iterator
First = pp_begin;
6428 PPI = std::upper_bound(pp_begin, pp_end,
Loc,
6429 PPEntityComp(*
this, M));
6439 if (SourceMgr.isBeforeInTranslationUnit(
6440 ReadSourceLocation(M, PPI->getEnd()),
Loc)) {
6443 Count = Count -
Half - 1;
6450 return findNextPreprocessedEntity(SLocMapI);
6457 std::pair<unsigned, unsigned>
6460 return std::make_pair(0,0);
6466 return std::make_pair(BeginID, EndID);
6476 std::pair<ModuleFile *, unsigned> PPInfo = getModulePreprocessedEntity(Index);
6478 unsigned LocalIndex = PPInfo.second;
6485 if (SourceMgr.isInFileID(SourceMgr.getFileLoc(
Loc), FID))
6494 class HeaderFileInfoVisitor {
6496 std::optional<HeaderFileInfo> HFI;
6499 explicit HeaderFileInfoVisitor(
FileEntryRef FE) : FE(FE) {}
6508 HeaderFileInfoLookupTable::iterator Pos = Table->find(FE);
6509 if (Pos == Table->end())
6516 std::optional<HeaderFileInfo> getHeaderFileInfo()
const {
return HFI; }
6522 HeaderFileInfoVisitor Visitor(FE);
6523 ModuleMgr.visit(Visitor);
6524 if (std::optional<HeaderFileInfo> HFI = Visitor.getHeaderFileInfo())
6531 using DiagState = DiagnosticsEngine::DiagState;
6542 auto ReadDiagState = [&](
const DiagState &BasedOn,
6543 bool IncludeNonPragmaStates) {
6544 unsigned BackrefID =
Record[Idx++];
6546 return DiagStates[BackrefID - 1];
6549 Diag.DiagStates.push_back(BasedOn);
6550 DiagState *NewState = &
Diag.DiagStates.back();
6551 DiagStates.push_back(NewState);
6552 unsigned Size =
Record[Idx++];
6553 assert(Idx + Size * 2 <=
Record.size() &&
6554 "Invalid data, not enough diag/map pairs");
6556 unsigned DiagID =
Record[Idx++];
6559 if (!NewMapping.
isPragma() && !IncludeNonPragmaStates)
6572 Mapping = NewMapping;
6578 DiagState *FirstState;
6583 FirstState =
Diag.DiagStatesByLoc.FirstDiagState;
6584 DiagStates.push_back(FirstState);
6588 "Invalid data, unexpected backref in initial state");
6590 assert(Idx <
Record.size() &&
6591 "Invalid data, not enough state change pairs in initial state");
6596 unsigned Flags =
Record[Idx++];
6598 Initial.SuppressSystemWarnings = Flags & 1; Flags >>= 1;
6599 Initial.ErrorsAsFatal = Flags & 1; Flags >>= 1;
6600 Initial.WarningsAsErrors = Flags & 1; Flags >>= 1;
6601 Initial.EnableAllWarnings = Flags & 1; Flags >>= 1;
6602 Initial.IgnoreAllWarnings = Flags & 1; Flags >>= 1;
6604 FirstState = ReadDiagState(Initial,
true);
6612 .StateTransitions.push_back({FirstState, 0});
6617 FirstState = ReadDiagState(*
Diag.DiagStatesByLoc.CurDiagState,
false);
6621 unsigned NumLocations =
Record[Idx++];
6622 while (NumLocations--) {
6623 assert(Idx <
Record.size() &&
6624 "Invalid data, missing pragma diagnostic states");
6626 assert(FID.
isValid() &&
"invalid FileID for transition");
6627 unsigned Transitions =
Record[Idx++];
6633 auto &F =
Diag.DiagStatesByLoc.Files[FID];
6634 F.StateTransitions.reserve(F.StateTransitions.size() + Transitions);
6635 for (
unsigned I = 0; I != Transitions; ++I) {
6637 auto *
State = ReadDiagState(*FirstState,
false);
6643 assert(Idx <
Record.size() &&
6644 "Invalid data, missing final pragma diagnostic state");
6646 auto *CurState = ReadDiagState(*FirstState,
false);
6649 Diag.DiagStatesByLoc.CurDiagState = CurState;
6650 Diag.DiagStatesByLoc.CurDiagStateLoc = CurStateLoc;
6655 auto &
T =
Diag.DiagStatesByLoc.Files[NullFile].StateTransitions;
6657 T.push_back({CurState, 0});
6659 T[0].State = CurState;
6668 ASTReader::RecordLocation ASTReader::TypeCursorForIndex(
unsigned Index) {
6669 GlobalTypeMapType::iterator I = GlobalTypeMap.find(Index);
6670 assert(I != GlobalTypeMap.end() &&
"Corrupted global type map");
6678 #define TYPE_BIT_CODE(CLASS_ID, CODE_ID, CODE_VALUE) \
6679 case TYPE_##CODE_ID: return Type::CLASS_ID;
6680 #include "clang/Serialization/TypeBitCodes.def"
6682 return std::nullopt;
6692 QualType ASTReader::readTypeRecord(
unsigned Index) {
6693 assert(ContextObj &&
"reading type with no AST context");
6695 RecordLocation
Loc = TypeCursorForIndex(Index);
6696 BitstreamCursor &DeclsCursor =
Loc.F->DeclsCursor;
6702 ReadingKindTracker ReadingKind(Read_Type, *
this);
6705 Deserializing AType(
this);
6707 if (llvm::Error Err = DeclsCursor.JumpToBit(
Loc.Offset)) {
6708 Error(std::move(Err));
6713 Error(RawCode.takeError());
6720 Error(Code.takeError());
6731 Error(
"Unexpected code for type");
6736 return TypeReader.read(*maybeClass);
6764 : Reader(Reader),
Seq(
Seq) {}
6769 #define ABSTRACT_TYPELOC(CLASS, PARENT)
6770 #define TYPELOC(CLASS, PARENT) \
6771 void Visit##CLASS##TypeLoc(CLASS##TypeLoc TyLoc);
6772 #include "clang/AST/TypeLocNodes.def"
6838 if (Reader.readBool())
6845 VisitArrayTypeLoc(TL);
6849 VisitArrayTypeLoc(TL);
6853 VisitArrayTypeLoc(TL);
6856 void TypeLocReader::VisitDependentSizedArrayTypeLoc(
6858 VisitArrayTypeLoc(TL);
6861 void TypeLocReader::VisitDependentAddressSpaceTypeLoc(
6869 void TypeLocReader::VisitDependentSizedExtVectorTypeLoc(
6878 void TypeLocReader::VisitDependentVectorTypeLoc(
6894 void TypeLocReader::VisitDependentSizedMatrixTypeLoc(
6908 for (
unsigned i = 0, e = TL.
getNumParams(); i != e; ++i) {
6914 VisitFunctionTypeLoc(TL);
6918 VisitFunctionTypeLoc(TL);
6925 void TypeLocReader::VisitUsingTypeLoc(
UsingTypeLoc TL) {
6963 auto NNS = readNestedNameSpecifierLoc();
6964 auto TemplateKWLoc = readSourceLocation();
6965 auto ConceptNameLoc = readDeclarationNameInfo();
6966 auto FoundDecl = readDeclAs<NamedDecl>();
6967 auto NamedConcept = readDeclAs<ConceptDecl>();
6969 getContext(), NNS, TemplateKWLoc, ConceptNameLoc, FoundDecl, NamedConcept,
6970 (readBool() ? readASTTemplateArgumentListInfo() :
nullptr));
6974 void TypeLocReader::VisitAutoTypeLoc(
AutoTypeLoc TL) {
6976 if (Reader.readBool())
6978 if (Reader.readBool())
6982 void TypeLocReader::VisitDeducedTemplateSpecializationTypeLoc(
6991 void TypeLocReader::VisitEnumTypeLoc(
EnumTypeLoc TL) {
7011 void TypeLocReader::VisitSubstTemplateTypeParmTypeLoc(
7016 void TypeLocReader::VisitSubstTemplateTypeParmPackTypeLoc(
7021 void TypeLocReader::VisitTemplateSpecializationTypeLoc(
7027 for (
unsigned i = 0, e = TL.
getNumArgs(); i != e; ++i)
7029 Reader.readTemplateArgumentLocInfo(
7033 void TypeLocReader::VisitParenTypeLoc(
ParenTypeLoc TL) {
7053 void TypeLocReader::VisitDependentTemplateSpecializationTypeLoc(
7061 for (
unsigned I = 0, E = TL.
getNumArgs(); I != E; ++I)
7063 Reader.readTemplateArgumentLocInfo(
7107 void TypeLocReader::VisitPipeTypeLoc(
PipeTypeLoc TL) {
7114 void TypeLocReader::VisitDependentBitIntTypeLoc(
7131 TypeSourceInfo *TInfo = getContext().CreateTypeSourceInfo(InfoTy);
7137 assert(ContextObj &&
"reading type with no AST context");
7148 llvm_unreachable(
"Invalid predefined type");
7337 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
7338 case PREDEF_TYPE_##Id##_ID: \
7339 T = Context.SingletonId; \
7341 #include "clang/Basic/OpenCLImageTypes.def"
7342 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
7343 case PREDEF_TYPE_SAMPLED_##Id##_ID: \
7344 T = Context.Sampled##SingletonId; \
7346 #define IMAGE_WRITE_TYPE(Type, Id, Ext)
7347 #define IMAGE_READ_WRITE_TYPE(Type, Id, Ext)
7348 #include "clang/Basic/OpenCLImageTypes.def"
7349 #define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
7350 case PREDEF_TYPE_##Id##_ID: \
7351 T = Context.Id##Ty; \
7353 #include "clang/Basic/OpenCLExtensionTypes.def"
7393 #define SVE_TYPE(Name, Id, SingletonId) \
7394 case PREDEF_TYPE_##Id##_ID: \
7395 T = Context.SingletonId; \
7397 #include "clang/Basic/AArch64SVEACLETypes.def"
7398 #define PPC_VECTOR_TYPE(Name, Id, Size) \
7399 case PREDEF_TYPE_##Id##_ID: \
7400 T = Context.Id##Ty; \
7402 #include "clang/Basic/PPCTypes.def"
7403 #define RVV_TYPE(Name, Id, SingletonId) \
7404 case PREDEF_TYPE_##Id##_ID: \
7405 T = Context.SingletonId; \
7407 #include "clang/Basic/RISCVVTypes.def"
7408 #define WASM_TYPE(Name, Id, SingletonId) \
7409 case PREDEF_TYPE_##Id##_ID: \
7410 T = Context.SingletonId; \
7412 #include "clang/Basic/WebAssemblyReferenceTypes.def"
7415 assert(!
T.isNull() &&
"Unknown predefined type");
7416 return T.withFastQualifiers(FastQuals);
7420 assert(Index < TypesLoaded.size() &&
"Type index out-of-range");
7421 if (TypesLoaded[Index].isNull()) {
7422 TypesLoaded[Index] = readTypeRecord(Index);
7423 if (TypesLoaded[Index].isNull())
7426 TypesLoaded[Index]->setFromAST();
7427 if (DeserializationListener)
7429 TypesLoaded[Index]);
7432 return TypesLoaded[Index].withFastQualifiers(FastQuals);
7436 return GetType(getGlobalTypeID(F, LocalID));
7448 ReadModuleOffsetMap(F);
7452 assert(I != F.
TypeRemap.
end() &&
"Invalid index into type index remap");
7454 unsigned GlobalIndex = LocalIndex + I->second;
7464 return readTypeSourceInfo();
7467 readNestedNameSpecifierLoc();
7477 TemplateNameLoc, EllipsisLoc);
7488 llvm_unreachable(
"unexpected template argument loc");
7503 Result.setLAngleLoc(readSourceLocation());
7504 Result.setRAngleLoc(readSourceLocation());
7505 unsigned NumArgsAsWritten = readInt();
7506 for (
unsigned i = 0; i != NumArgsAsWritten; ++i)
7507 Result.addArgument(readTemplateArgumentLoc());
7513 readTemplateArgumentListInfo(Result);
7520 if (NumCurrentElementsDeserializing) {
7525 PendingIncompleteDeclChains.push_back(
const_cast<Decl*
>(D));
7530 assert(isa<TranslationUnitDecl>(D) &&
"Not a TU?");
7541 if (isa<TranslationUnitDecl, NamespaceDecl, RecordDecl, EnumDecl>(DC)) {
7543 if (!getContext().getLangOpts().
CPlusPlus &&
7544 isa<TranslationUnitDecl>(DC)) {
7548 auto *II = Name.getAsIdentifierInfo();
7549 assert(II &&
"non-identifier name in C?");
7550 if (II->isOutOfDate())
7551 updateOutOfDateIdentifier(*II);
7557 auto *DC = cast<DeclContext>(DCDecl);
7559 FindExternalLexicalDecls(
7565 if (
auto *CTSD = dyn_cast<ClassTemplateSpecializationDecl>(D))
7566 CTSD->getSpecializedTemplate()->LoadLazySpecializations();
7567 if (
auto *VTSD = dyn_cast<VarTemplateSpecializationDecl>(D))
7568 VTSD->getSpecializedTemplate()->LoadLazySpecializations();
7569 if (
auto *FD = dyn_cast<FunctionDecl>(D)) {
7570 if (
auto *Template = FD->getPrimaryTemplate())
7571 Template->LoadLazySpecializations();
7577 RecordLocation
Loc = getLocalBitOffset(
Offset);
7578 BitstreamCursor &
Cursor =
Loc.F->DeclsCursor;
7580 if (llvm::Error Err =
Cursor.JumpToBit(
Loc.Offset)) {
7581 Error(std::move(Err));
7584 ReadingKindTracker ReadingKind(Read_Decl, *
this);
7589 Error(MaybeCode.takeError());
7592 unsigned Code = MaybeCode.get();
7596 if (!MaybeRecCode) {
7597 Error(MaybeRecCode.takeError());
7601 Error(
"malformed AST file: missing C++ ctor initializers");
7605 return Record.readCXXCtorInitializers();
7609 assert(ContextObj &&
"reading base specifiers with no AST context");
7612 RecordLocation
Loc = getLocalBitOffset(
Offset);
7613 BitstreamCursor &
Cursor =
Loc.F->DeclsCursor;
7615 if (llvm::Error Err =
Cursor.JumpToBit(
Loc.Offset)) {
7616 Error(std::move(Err));
7619 ReadingKindTracker ReadingKind(Read_Decl, *
this);
7624 Error(MaybeCode.takeError());
7627 unsigned Code = MaybeCode.get();
7631 if (!MaybeRecCode) {
7632 Error(MaybeCode.takeError());
7635 unsigned RecCode = MaybeRecCode.get();
7638 Error(
"malformed AST file: missing C++ base specifiers");
7642 unsigned NumBases =
Record.readInt();
7645 for (
unsigned I = 0; I != NumBases; ++I)
7646 Bases[I] =
Record.readCXXBaseSpecifier();
7657 ReadModuleOffsetMap(F);
7661 assert(I != F.
DeclRemap.
end() &&
"Invalid index into decl index remap");
7680 assert(I != GlobalDeclMap.end() &&
"Corrupted global declaration map");
7690 if (Index > DeclsLoaded.size()) {
7691 Error(
"declaration ID out-of-range for AST file");
7695 if (
Decl *D = DeclsLoaded[Index])
7696 return D->getLocation();
7699 DeclCursorForID(
ID,
Loc);
7759 llvm_unreachable(
"PredefinedDeclIDs unknown enum value");
7763 assert(ContextObj &&
"reading decl with no AST context");
7771 Merged.push_back(
ID);
7778 if (Index >= DeclsLoaded.size()) {
7779 assert(0 &&
"declaration ID out-of-range for AST file");
7780 Error(
"declaration ID out-of-range for AST file");
7784 return DeclsLoaded[Index];
7789 return GetExistingDecl(
ID);
7793 if (Index >= DeclsLoaded.size()) {
7794 assert(0 &&
"declaration ID out-of-range for AST file");
7795 Error(
"declaration ID out-of-range for AST file");
7799 if (!DeclsLoaded[Index]) {
7801 if (DeserializationListener)
7802 DeserializationListener->DeclRead(
ID, DeclsLoaded[Index]);
7805 return DeclsLoaded[Index];
7815 assert(I != GlobalDeclMap.end() &&
"Corrupted global declaration map");
7818 llvm::DenseMap<ModuleFile *, DeclID>::iterator Pos =
7828 if (Idx >=
Record.size()) {
7829 Error(
"Corrupted AST file");
7843 ClearSwitchCaseIDs();
7846 RecordLocation
Loc = getLocalBitOffset(
Offset);
7847 if (llvm::Error Err =
Loc.F->DeclsCursor.JumpToBit(
Loc.Offset)) {
7848 Error(std::move(Err));
7851 assert(NumCurrentElementsDeserializing == 0 &&
7852 "should not be called while already deserializing");
7854 return ReadStmtFromStream(*
Loc.F);
7863 assert(LexicalDecls.size() % 2 == 0 &&
"expected an even number of entries");
7864 for (
int I = 0, N = LexicalDecls.size(); I != N; I += 2) {
7866 if (!IsKindWeWant(K))
7869 auto ID = (
DeclID) + LexicalDecls[I + 1];
7874 if (PredefsVisited[
ID])
7877 PredefsVisited[
ID] =
true;
7881 assert(D->getKind() == K &&
"wrong kind for lexical decl");
7888 if (isa<TranslationUnitDecl>(DC)) {
7889 for (
const auto &Lexical : TULexicalDecls)
7890 Visit(Lexical.first, Lexical.second);
7892 auto I = LexicalDecls.find(DC);
7893 if (I != LexicalDecls.end())
7894 Visit(I->second.first, I->second.second);
7897 ++NumLexicalDeclContextsRead;
7934 unsigned Offset,
unsigned Length,
7938 llvm::DenseMap<FileID, FileDeclsInfo>::iterator I = FileDeclIDs.find(
File);
7939 if (I == FileDeclIDs.end())
7942 FileDeclsInfo &DInfo = I->second;
7943 if (DInfo.Decls.empty())
7947 BeginLoc =
SM.getLocForStartOfFile(
File).getLocWithOffset(
Offset);
7950 DeclIDComp DIDComp(*
this, *DInfo.Mod);
7952 llvm::lower_bound(DInfo.Decls, BeginLoc, DIDComp);
7953 if (BeginIt != DInfo.Decls.begin())
7959 while (BeginIt != DInfo.Decls.begin() &&
7960 GetDecl(getGlobalDeclID(*DInfo.Mod, *BeginIt))
7961 ->isTopLevelDeclInObjCContainer())
7965 llvm::upper_bound(DInfo.Decls, EndLoc, DIDComp);
7966 if (EndIt != DInfo.Decls.end())
7970 Decls.push_back(GetDecl(getGlobalDeclID(*DInfo.Mod, *DIt)));
7977 "DeclContext has no visible decls in storage");
7981 auto It = Lookups.find(DC);
7982 if (It == Lookups.end())
7993 if (ND->
getDeclName() == Name && Found.insert(ND).second)
7994 Decls.push_back(ND);
7997 ++NumVisibleDeclContextsRead;
7998 SetExternalVisibleDeclsForName(DC, Name, Decls);
7999 return !Decls.empty();
8006 auto It = Lookups.find(DC);
8007 assert(It != Lookups.end() &&
8008 "have external visible storage but no lookup tables");
8017 ++NumVisibleDeclContextsRead;
8019 for (DeclsMap::iterator I = Decls.begin(), E = Decls.end(); I != E; ++I) {
8020 SetExternalVisibleDeclsForName(DC, I->first, I->second);
8022 const_cast<DeclContext *
>(DC)->setHasExternalVisibleStorage(
false);
8027 auto I = Lookups.find(Primary);
8028 return I == Lookups.end() ? nullptr : &I->second;
8037 assert(ImplD && Consumer);
8039 for (
auto *I : ImplD->
methods())
8045 void ASTReader::PassInterestingDeclToConsumer(
Decl *D) {
8053 this->Consumer = Consumer;
8056 PassInterestingDeclsToConsumer();
8058 if (DeserializationListener)
8059 DeserializationListener->ReaderInitialized(
this);
8063 std::fprintf(stderr,
"*** AST File Statistics:\n");
8065 unsigned NumTypesLoaded =
8066 TypesLoaded.size() - llvm::count(TypesLoaded.materialized(),
QualType());
8067 unsigned NumDeclsLoaded =
8068 DeclsLoaded.size() -
8069 llvm::count(DeclsLoaded.materialized(), (
Decl *)
nullptr);
8070 unsigned NumIdentifiersLoaded =
8071 IdentifiersLoaded.size() -
8073 unsigned NumMacrosLoaded =
8074 MacrosLoaded.size() - llvm::count(MacrosLoaded, (
MacroInfo *)
nullptr);
8075 unsigned NumSelectorsLoaded =
8076 SelectorsLoaded.size() - llvm::count(SelectorsLoaded,
Selector());
8078 if (
unsigned TotalNumSLocEntries = getTotalNumSLocs())
8079 std::fprintf(stderr,
" %u/%u source location entries read (%f%%)\n",
8080 NumSLocEntriesRead, TotalNumSLocEntries,
8081 ((
float)NumSLocEntriesRead/TotalNumSLocEntries * 100));
8082 if (!TypesLoaded.empty())
8083 std::fprintf(stderr,
" %u/%u types read (%f%%)\n",
8084 NumTypesLoaded, (
unsigned)TypesLoaded.size(),
8085 ((
float)NumTypesLoaded/TypesLoaded.size() * 100));
8086 if (!DeclsLoaded.empty())
8087 std::fprintf(stderr,
" %u/%u declarations read (%f%%)\n",
8088 NumDeclsLoaded, (
unsigned)DeclsLoaded.size(),
8089 ((
float)NumDeclsLoaded/DeclsLoaded.size() * 100));
8090 if (!IdentifiersLoaded.empty())
8091 std::fprintf(stderr,
" %u/%u identifiers read (%f%%)\n",
8092 NumIdentifiersLoaded, (
unsigned)IdentifiersLoaded.size(),
8093 ((
float)NumIdentifiersLoaded/IdentifiersLoaded.size() * 100));
8094 if (!MacrosLoaded.empty())
8095 std::fprintf(stderr,
" %u/%u macros read (%f%%)\n",
8096 NumMacrosLoaded, (
unsigned)MacrosLoaded.size(),
8097 ((
float)NumMacrosLoaded/MacrosLoaded.size() * 100));
8098 if (!SelectorsLoaded.empty())
8099 std::fprintf(stderr,
" %u/%u selectors read (%f%%)\n",
8100 NumSelectorsLoaded, (
unsigned)SelectorsLoaded.size(),
8101 ((
float)NumSelectorsLoaded/SelectorsLoaded.size() * 100));
8102 if (TotalNumStatements)
8103 std::fprintf(stderr,
" %u/%u statements read (%f%%)\n",
8104 NumStatementsRead, TotalNumStatements,
8105 ((
float)NumStatementsRead/TotalNumStatements * 100));
8107 std::fprintf(stderr,
" %u/%u macros read (%f%%)\n",
8108 NumMacrosRead, TotalNumMacros,
8109 ((
float)NumMacrosRead/TotalNumMacros * 100));
8110 if (TotalLexicalDeclContexts)
8111 std::fprintf(stderr,
" %u/%u lexical declcontexts read (%f%%)\n",
8112 NumLexicalDeclContextsRead, TotalLexicalDeclContexts,
8113 ((
float)NumLexicalDeclContextsRead/TotalLexicalDeclContexts
8115 if (TotalVisibleDeclContexts)
8116 std::fprintf(stderr,
" %u/%u visible declcontexts read (%f%%)\n",
8117 NumVisibleDeclContextsRead, TotalVisibleDeclContexts,
8118 ((
float)NumVisibleDeclContextsRead/TotalVisibleDeclContexts
8120 if (TotalNumMethodPoolEntries)
8121 std::fprintf(stderr,
" %u/%u method pool entries read (%f%%)\n",
8122 NumMethodPoolEntriesRead, TotalNumMethodPoolEntries,
8123 ((
float)NumMethodPoolEntriesRead/TotalNumMethodPoolEntries
8125 if (NumMethodPoolLookups)
8126 std::fprintf(stderr,
" %u/%u method pool lookups succeeded (%f%%)\n",
8127 NumMethodPoolHits, NumMethodPoolLookups,
8128 ((
float)NumMethodPoolHits/NumMethodPoolLookups * 100.0));
8129 if (NumMethodPoolTableLookups)
8130 std::fprintf(stderr,
" %u/%u method pool table lookups succeeded (%f%%)\n",
8131 NumMethodPoolTableHits, NumMethodPoolTableLookups,
8132 ((
float)NumMethodPoolTableHits/NumMethodPoolTableLookups
8134 if (NumIdentifierLookupHits)
8135 std::fprintf(stderr,
8136 " %u / %u identifier table lookups succeeded (%f%%)\n",
8137 NumIdentifierLookupHits, NumIdentifierLookups,
8138 (
double)NumIdentifierLookupHits*100.0/NumIdentifierLookups);
8141 std::fprintf(stderr,
"\n");
8142 GlobalIndex->printStats();
8145 std::fprintf(stderr,
"\n");
8147 std::fprintf(stderr,
"\n");
8150 template<
typename Key,
typename ModuleFile,
unsigned InitialCapacity>
8151 LLVM_DUMP_METHOD
static void
8154 InitialCapacity> &Map) {
8155 if (Map.begin() == Map.end())
8160 llvm::errs() << Name <<
":\n";
8161 for (
typename MapType::const_iterator I = Map.begin(), IEnd = Map.end();
8164 if constexpr (std::is_integral_v<Key>)
8167 ID = I->first.get();
8168 llvm::errs() <<
" " <<
ID <<
" -> " << I->second->FileName <<
"\n";
8173 llvm::errs() <<
"*** PCH/ModuleFile Remappings:\n";
8175 dumpModuleIDMap(
"Global source location entry map", GlobalSLocEntryMap);
8183 GlobalPreprocessedEntityMap);
8185 llvm::errs() <<
"\n*** PCH/Modules Loaded:";
8194 if (llvm::MemoryBuffer *buf = I.Buffer) {
8195 size_t bytes = buf->getBufferSize();
8196 switch (buf->getBufferKind()) {
8197 case llvm::MemoryBuffer::MemoryBuffer_Malloc:
8200 case llvm::MemoryBuffer::MemoryBuffer_MMap:
8218 PreloadedDeclIDs.clear();
8221 if (!FPPragmaOptions.empty()) {
8222 assert(FPPragmaOptions.size() == 1 &&
"Wrong number of FP_PRAGMA_OPTIONS");
8225 SemaObj->CurFPFeatures =
8229 SemaObj->OpenCLFeatures = OpenCLExtensions;
8235 assert(SemaObj &&
"no Sema to update");
8239 if (!SemaDeclRefs.empty()) {
8240 assert(SemaDeclRefs.size() % 3 == 0);
8241 for (
unsigned I = 0; I != SemaDeclRefs.size(); I += 3) {
8242 if (!SemaObj->StdNamespace)
8243 SemaObj->StdNamespace = SemaDeclRefs[I].get();
8244 if (!SemaObj->StdBadAlloc)
8245 SemaObj->StdBadAlloc = SemaDeclRefs[I + 1].get();
8246 if (!SemaObj->StdAlignValT)
8247 SemaObj->StdAlignValT = SemaDeclRefs[I + 2].get();
8249 SemaDeclRefs.clear();
8254 if(OptimizeOffPragmaLocation.isValid())
8255 SemaObj->ActOnPragmaOptimize(
false, OptimizeOffPragmaLocation);
8256 if (PragmaMSStructState != -1)
8258 if (PointersToMembersPragmaLocation.isValid()) {
8259 SemaObj->ActOnPragmaMSPointersToMembers(
8261 PragmaMSPointersToMembersState,
8262 PointersToMembersPragmaLocation);
8264 SemaObj->CUDA().ForceHostDeviceDepth = ForceHostDeviceDepth;
8266 if (PragmaAlignPackCurrentValue) {
8270 bool DropFirst =
false;
8271 if (!PragmaAlignPackStack.empty() &&
8272 PragmaAlignPackStack.front().Location.isInvalid()) {
8273 assert(PragmaAlignPackStack.front().Value ==
8274 SemaObj->AlignPackStack.DefaultValue &&
8275 "Expected a default alignment value");
8276 SemaObj->AlignPackStack.Stack.emplace_back(
8277 PragmaAlignPackStack.front().SlotLabel,
8278 SemaObj->AlignPackStack.CurrentValue,
8279 SemaObj->AlignPackStack.CurrentPragmaLocation,
8280 PragmaAlignPackStack.front().PushLocation);
8283 for (
const auto &Entry :
8284 llvm::ArrayRef(PragmaAlignPackStack).drop_front(DropFirst ? 1 : 0)) {
8285 SemaObj->AlignPackStack.Stack.emplace_back(
8286 Entry.SlotLabel, Entry.Value, Entry.Location, Entry.PushLocation);
8288 if (PragmaAlignPackCurrentLocation.isInvalid()) {
8289 assert(*PragmaAlignPackCurrentValue ==
8290 SemaObj->AlignPackStack.DefaultValue &&
8291 "Expected a default align and pack value");
8294 SemaObj->AlignPackStack.CurrentValue = *PragmaAlignPackCurrentValue;
8295 SemaObj->AlignPackStack.CurrentPragmaLocation =
8296 PragmaAlignPackCurrentLocation;
8299 if (FpPragmaCurrentValue) {
8303 bool DropFirst =
false;
8304 if (!FpPragmaStack.empty() && FpPragmaStack.front().Location.isInvalid()) {
8305 assert(FpPragmaStack.front().Value ==
8306 SemaObj->FpPragmaStack.DefaultValue &&
8307 "Expected a default pragma float_control value");
8308 SemaObj->FpPragmaStack.Stack.emplace_back(
8309 FpPragmaStack.front().SlotLabel, SemaObj->FpPragmaStack.CurrentValue,
8310 SemaObj->FpPragmaStack.CurrentPragmaLocation,
8311 FpPragmaStack.front().PushLocation);
8314 for (
const auto &Entry :
8316 SemaObj->FpPragmaStack.Stack.emplace_back(
8317 Entry.SlotLabel, Entry.Value, Entry.Location, Entry.PushLocation);
8318 if (FpPragmaCurrentLocation.isInvalid()) {
8319 assert(*FpPragmaCurrentValue == SemaObj->FpPragmaStack.DefaultValue &&
8320 "Expected a default pragma float_control value");
8323 SemaObj->FpPragmaStack.CurrentValue = *FpPragmaCurrentValue;
8324 SemaObj->FpPragmaStack.CurrentPragmaLocation = FpPragmaCurrentLocation;
8329 for (
auto &Import : PendingImportedModulesSema) {
8330 if (Import.ImportLoc.isInvalid())
8332 if (
Module *Imported = getSubmodule(Import.ID)) {
8333 SemaObj->makeModuleVisible(Imported, Import.ImportLoc);
8336 PendingImportedModulesSema.clear();
8343 IdentifierLookupVisitor Visitor(Name, 0,
8344 NumIdentifierLookups,
8345 NumIdentifierLookupHits);
8351 if (PP.getLangOpts().CPlusPlus) {
8352 for (
auto *F : ModuleMgr.pch_modules())
8360 if (!loadGlobalIndex()) {
8361 if (GlobalIndex->lookupIdentifier(Name, Hits)) {
8366 ModuleMgr.visit(Visitor, HitsPtr);
8370 markIdentifierUpToDate(II);
8388 ASTIdentifierLookupTable::key_iterator Current;
8392 ASTIdentifierLookupTable::key_iterator
End;
8399 bool SkipModules =
false);
8401 StringRef Next()
override;
8408 : Reader(Reader), Index(Reader.ModuleMgr.size()), SkipModules(SkipModules) {
8412 while (Current == End) {
8424 Current = IdTable->key_begin();
8425 End = IdTable->key_end();
8430 StringRef Result = *Current;
8439 std::unique_ptr<IdentifierIterator> Current;
8440 std::unique_ptr<IdentifierIterator> Queued;
8443 ChainedIdentifierIterator(std::unique_ptr<IdentifierIterator> First,
8444 std::unique_ptr<IdentifierIterator> Second)
8445 : Current(
std::move(
First)), Queued(
std::move(Second)) {}
8447 StringRef Next()
override {
8451 StringRef result = Current->Next();
8452 if (!result.empty())
8457 std::swap(Current, Queued);
8466 std::unique_ptr<IdentifierIterator> ReaderIter(
8468 std::unique_ptr<IdentifierIterator> ModulesIter(
8469 GlobalIndex->createIdentifierIterator());
8470 return new ChainedIdentifierIterator(std::move(ReaderIter),
8471 std::move(ModulesIter));
8478 namespace serialization {
8483 unsigned PriorGeneration;
8484 unsigned InstanceBits = 0;
8485 unsigned FactoryBits = 0;
8486 bool InstanceHasMoreThanOneDecl =
false;
8487 bool FactoryHasMoreThanOneDecl =
false;
8493 unsigned PriorGeneration)
8494 : Reader(Reader), Sel(Sel), PriorGeneration(PriorGeneration) {}
8504 ++Reader.NumMethodPoolTableLookups;
8507 ASTSelectorLookupTable::iterator Pos = PoolTable->find(Sel);
8508 if (Pos == PoolTable->end())
8511 ++Reader.NumMethodPoolTableHits;
8512 ++Reader.NumSelectorsRead;
8516 ++Reader.NumMethodPoolEntriesRead;
8518 if (Reader.DeserializationListener)
8524 InstanceMethods.append(
Data.Instance.rbegin(),
Data.Instance.rend());
8525 FactoryMethods.append(
Data.Factory.rbegin(),
Data.Factory.rend());
8526 InstanceBits =
Data.InstanceBits;
8527 FactoryBits =
Data.FactoryBits;
8528 InstanceHasMoreThanOneDecl =
Data.InstanceHasMoreThanOneDecl;
8529 FactoryHasMoreThanOneDecl =
Data.FactoryHasMoreThanOneDecl;
8535 return InstanceMethods;
8540 return FactoryMethods;
8547 return InstanceHasMoreThanOneDecl;
8565 unsigned &Generation = SelectorGeneration[Sel];
8566 unsigned PriorGeneration = Generation;
8568 SelectorOutOfDate[Sel] =
false;
8571 ++NumMethodPoolLookups;
8573 ModuleMgr.
visit(Visitor);
8579 ++NumMethodPoolHits;
8604 if (SelectorOutOfDate[Sel])
8612 for (
unsigned I = 0, N = KnownNamespaces.size(); I != N; ++I) {
8614 = dyn_cast_or_null<NamespaceDecl>(
GetDecl(KnownNamespaces[I])))
8615 Namespaces.push_back(Namespace);
8620 llvm::MapVector<NamedDecl *, SourceLocation> &
Undefined) {
8621 for (
unsigned Idx = 0, N = UndefinedButUsed.size(); Idx != N;) {
8622 UndefinedButUsedDecl &
U = UndefinedButUsed[Idx++];
8627 UndefinedButUsed.clear();
8633 for (
unsigned Idx = 0, N = DelayedDeleteExprs.size(); Idx != N;) {
8636 uint64_t Count = DelayedDeleteExprs[Idx++];
8637 for (
uint64_t C = 0; C < Count; ++C) {
8640 const bool IsArrayForm = DelayedDeleteExprs[Idx++];
8641 Exprs[FD].push_back(std::make_pair(DeleteLoc, IsArrayForm));
8648 for (
unsigned I = 0, N = TentativeDefinitions.size(); I != N; ++I) {
8649 VarDecl *Var = dyn_cast_or_null<VarDecl>(
GetDecl(TentativeDefinitions[I]));
8651 TentativeDefs.push_back(Var);
8653 TentativeDefinitions.clear();
8658 for (
unsigned I = 0, N = UnusedFileScopedDecls.size(); I != N; ++I) {
8660 = dyn_cast_or_null<DeclaratorDecl>(
GetDecl(UnusedFileScopedDecls[I]));
8664 UnusedFileScopedDecls.clear();
8669 for (
unsigned I = 0, N = DelegatingCtorDecls.size(); I != N; ++I) {
8671 = dyn_cast_or_null<CXXConstructorDecl>(
GetDecl(DelegatingCtorDecls[I]));
8675 DelegatingCtorDecls.clear();
8679 for (
unsigned I = 0, N = ExtVectorDecls.size(); I != N; ++I) {
8681 = dyn_cast_or_null<TypedefNameDecl>(
GetDecl(ExtVectorDecls[I]));
8685 ExtVectorDecls.clear();
8690 for (
unsigned I = 0, N = UnusedLocalTypedefNameCandidates.size(); I != N;
8693 GetDecl(UnusedLocalTypedefNameCandidates[I]));
8697 UnusedLocalTypedefNameCandidates.clear();
8702 for (
auto I : DeclsToCheckForDeferredDiags) {
8703 auto *D = dyn_cast_or_null<Decl>(
GetDecl(I));
8707 DeclsToCheckForDeferredDiags.clear();
8712 if (ReferencedSelectorsData.empty())
8717 unsigned int DataSize = ReferencedSelectorsData.size()-1;
8719 while (I < DataSize) {
8723 Sels.push_back(std::make_pair(Sel, SelLoc));
8725 ReferencedSelectorsData.clear();
8730 if (WeakUndeclaredIdentifiers.empty())
8733 for (
unsigned I = 0, N = WeakUndeclaredIdentifiers.size(); I < N; ) {
8741 WeakIDs.push_back(std::make_pair(WeakId, WI));
8743 WeakUndeclaredIdentifiers.clear();
8747 for (
unsigned Idx = 0, N = VTableUses.size(); Idx < N; ) {
8749 VTableUse &TableInfo = VTableUses[Idx++];
8750 VT.
Record = dyn_cast_or_null<CXXRecordDecl>(
GetDecl(TableInfo.ID));
8753 VTables.push_back(VT);
8761 for (
unsigned Idx = 0, N = PendingInstantiations.size(); Idx < N;) {
8762 PendingInstantiation &Inst = PendingInstantiations[Idx++];
8766 Pending.push_back(std::make_pair(D,
Loc));
8768 PendingInstantiations.clear();
8772 llvm::MapVector<
const FunctionDecl *, std::unique_ptr<LateParsedTemplate>>
8774 for (
auto &LPT : LateParsedTemplates) {
8777 for (
unsigned Idx = 0, N = LateParsed.size(); Idx < N;
8782 auto LT = std::make_unique<LateParsedTemplate>();
8787 assert(F &&
"No module");
8789 unsigned TokN = LateParsed[Idx++];
8790 LT->Toks.reserve(TokN);
8791 for (
unsigned T = 0;
T < TokN; ++
T)
8792 LT->Toks.push_back(
ReadToken(*F, LateParsed, Idx));
8794 LPTMap.insert(std::make_pair(FD, std::move(
LT)));
8798 LateParsedTemplates.clear();
8805 LambdaDeclarationsForMerging.insert(
8818 assert(ID &&
"Non-zero identifier ID required");
8819 assert(ID <= IdentifiersLoaded.size() &&
"identifier ID out of range");
8820 IdentifiersLoaded[ID - 1] = II;
8821 if (DeserializationListener)
8844 if (NumCurrentElementsDeserializing && !Decls) {
8845 PendingIdentifierInfos[II].append(DeclIDs.begin(), DeclIDs.end());
8849 for (
unsigned I = 0, N = DeclIDs.size(); I != N; ++I) {
8862 Decls->push_back(D);
8869 pushExternalDeclIntoScope(D, II);
8877 if (IdentifiersLoaded.empty()) {
8878 Error(
"no identifier table in AST file");
8883 if (!IdentifiersLoaded[ID]) {
8885 assert(I != GlobalIdentifierMap.
end() &&
"Corrupted global identifier map");
8888 const unsigned char *
Data =
8895 IdentifiersLoaded[ID] = &II;
8897 if (DeserializationListener)
8901 return IdentifiersLoaded[ID];
8913 ReadModuleOffsetMap(M);
8918 &&
"Invalid index into identifier index remap");
8920 return LocalID + I->second;
8927 if (MacrosLoaded.empty()) {
8928 Error(
"no macro table in AST file");
8933 if (!MacrosLoaded[ID]) {
8936 assert(I != GlobalMacroMap.
end() &&
"Corrupted global macro map");
8942 if (DeserializationListener)
8947 return MacrosLoaded[ID];
8955 ReadModuleOffsetMap(M);
8959 assert(I != M.
MacroRemap.
end() &&
"Invalid index into macro index remap");
8961 return LocalID + I->second;
8970 ReadModuleOffsetMap(M);
8975 &&
"Invalid index into submodule index remap");
8977 return LocalID + I->second;
8982 assert(GlobalID == 0 &&
"Unhandled global submodule ID");
8986 if (GlobalID > SubmodulesLoaded.size()) {
8987 Error(
"submodule ID out of range in AST file");
9002 return I == GlobalSubmoduleMap.
end() ? nullptr : I->second;
9005 unsigned IndexFromEnd = ID >> 1;
9006 assert(IndexFromEnd &&
"got reference to unknown module file");
9023 auto I = llvm::find(PCHModules, M);
9024 assert(I != PCHModules.end() &&
"emitting reference to unknown file");
9025 return (I - PCHModules.end()) << 1;
9035 if (
std::distance(std::begin(PCHChain), std::end(PCHChain))) {
9040 llvm::sys::path::parent_path(MF.
FileName),
9043 return std::nullopt;
9047 auto I = DefinitionSource.find(FD);
9048 if (I == DefinitionSource.end())
9061 if (ID > SelectorsLoaded.size()) {
9062 Error(
"selector ID out of range in AST file");
9066 if (SelectorsLoaded[ID - 1].getAsOpaquePtr() ==
nullptr) {
9069 assert(I != GlobalSelectorMap.
end() &&
"Corrupted global selector map");
9073 SelectorsLoaded[ID - 1] =
9075 if (DeserializationListener)
9076 DeserializationListener->
SelectorRead(ID, SelectorsLoaded[ID - 1]);
9079 return SelectorsLoaded[ID - 1];
9097 ReadModuleOffsetMap(M);
9102 &&
"Invalid index into selector index remap");
9104 return LocalID + I->second;
9109 switch (Name.getNameKind()) {
9135 NameInfo.
setName(readDeclarationName());
9147 unsigned NumTPLists =
readInt();
9152 for (
unsigned i = 0; i != NumTPLists; ++i)
9163 unsigned NumParams =
readInt();
9165 Params.reserve(NumParams);
9167 Params.push_back(readDeclAs<NamedDecl>());
9169 bool HasRequiresClause =
readBool();
9170 Expr *RequiresClause = HasRequiresClause ?
readExpr() :
nullptr;
9173 getContext(), TemplateLoc, LAngleLoc, Params, RAngleLoc, RequiresClause);
9174 return TemplateParams;
9179 bool Canonicalize) {
9180 unsigned NumTemplateArgs =
readInt();
9181 TemplArgs.reserve(NumTemplateArgs);
9182 while (NumTemplateArgs--)
9188 unsigned NumDecls =
readInt();
9190 while (NumDecls--) {
9202 bool inheritConstructors =
readBool();
9208 Result.setInheritConstructors(inheritConstructors);
9215 unsigned NumInitializers =
readInt();
9216 assert(NumInitializers &&
"wrote ctor initializers but have no inits");
9218 for (
unsigned i = 0; i != NumInitializers; ++i) {
9220 bool IsBaseVirtual =
false;
9236 Member = readDeclAs<FieldDecl>();
9240 IndirectMember = readDeclAs<IndirectFieldDecl>();
9251 BOMInit =
new (Context)
9253 RParenLoc, MemberOrEllipsisLoc);
9255 BOMInit =
new (Context)
9258 BOMInit =
new (Context)
9262 BOMInit =
new (Context)
9264 LParenLoc, Init, RParenLoc);
9267 unsigned SourceOrder =
readInt();
9271 CtorInitializers[i] = BOMInit;
9274 return CtorInitializers;
9282 for (
unsigned I = 0; I != N; ++I) {
9283 auto Kind = readNestedNameSpecifierKind();
9315 Builder.Extend(Context,
9317 T->getTypeLoc(), ColonColonLoc);
9323 Builder.MakeGlobal(Context, ColonColonLoc);
9336 return Builder.getWithLocInContext(Context);
9340 unsigned &Idx,
LocSeq *Seq) {
9347 const StringRef Blob) {
9348 unsigned Count =
Record[0];
9349 const char *Byte = Blob.data();
9350 llvm::BitVector
Ret = llvm::BitVector(Count,
false);
9351 for (
unsigned I = 0; I < Count; ++Byte)
9352 for (
unsigned Bit = 0; Bit < 8 && I < Count; ++Bit, ++I)
9353 if (*Byte & (1 << Bit))
9365 unsigned Len =
Record[Idx++];
9366 std::string Result(
Record.data() + Idx,
Record.data() + Idx + Len);
9381 if (!BaseDirectory.empty())
9388 unsigned Major =
Record[Idx++];
9389 unsigned Minor =
Record[Idx++];
9390 unsigned Subminor =
Record[Idx++];
9392 return VersionTuple(Major);
9394 return VersionTuple(Major, Minor - 1);
9395 return VersionTuple(Major, Minor - 1, Subminor - 1);
9406 return Diag(CurrentImportLoc, DiagID);
9422 assert((*CurrSwitchCaseStmts)[ID] ==
nullptr &&
9423 "Already have a SwitchCase with this ID");
9424 (*CurrSwitchCaseStmts)[ID] = SC;
9429 assert((*CurrSwitchCaseStmts)[ID] !=
nullptr &&
"No SwitchCase with this ID");
9430 return (*CurrSwitchCaseStmts)[ID];
9434 CurrSwitchCaseStmts->clear();
9439 std::vector<RawComment *> Comments;
9446 BitstreamCursor &
Cursor = I->first;
9453 Cursor.advanceSkippingSubblocks(
9454 BitstreamCursor::AF_DontPopBlockAtEnd);
9456 Error(MaybeEntry.takeError());
9459 llvm::BitstreamEntry Entry = MaybeEntry.get();
9461 switch (Entry.Kind) {
9462 case llvm::BitstreamEntry::SubBlock:
9464 Error(
"malformed block record in AST file");
9466 case llvm::BitstreamEntry::EndBlock:
9476 if (!MaybeComment) {
9477 Error(MaybeComment.takeError());
9486 bool IsTrailingComment =
Record[Idx++];
9487 bool IsAlmostTrailingComment =
Record[Idx++];
9489 SR,
Kind, IsTrailingComment, IsAlmostTrailingComment));
9495 llvm::DenseMap<FileID, std::map<unsigned, RawComment *>>
9496 FileToOffsetToComment;
9500 std::pair<FileID, unsigned>
Loc =
9503 Context.
Comments.OrderedComments[
Loc.first].emplace(
Loc.second, C);
9516 assert(NumUserInputs <= NumInputs);
9517 unsigned N = IncludeSystem ? NumInputs : NumUserInputs;
9518 for (
unsigned I = 0; I < N; ++I) {
9519 bool IsSystem = I >= NumUserInputs;
9521 Visitor(IFI, IsSystem);
9526 bool IncludeSystem,
bool Complain,
9531 assert(NumUserInputs <= NumInputs);
9532 unsigned N = IncludeSystem ? NumInputs : NumUserInputs;
9533 for (
unsigned I = 0; I < N; ++I) {
9534 bool IsSystem = I >= NumUserInputs;
9535 InputFile IF = getInputFile(MF, I+1, Complain);
9536 Visitor(IF, IsSystem);
9544 for (
unsigned I = 0; I < NumInputs; ++I) {
9547 if (
auto FE = getInputFile(MF, I + 1).getFile())
9552 void ASTReader::finishPendingActions() {
9554 !PendingIdentifierInfos.empty() || !PendingDeducedFunctionTypes.empty() ||
9555 !PendingDeducedVarTypes.empty() || !PendingIncompleteDeclChains.empty() ||
9556 !PendingDeclChains.empty() || !PendingMacroIDs.empty() ||
9557 !PendingDeclContextInfos.empty() || !PendingUpdateRecords.empty() ||
9558 !PendingObjCExtensionIvarRedeclarations.empty()) {
9561 using TopLevelDeclsMap =
9562 llvm::DenseMap<IdentifierInfo *, SmallVector<Decl *, 2>>;
9563 TopLevelDeclsMap TopLevelDecls;
9565 while (!PendingIdentifierInfos.empty()) {
9568 std::move(PendingIdentifierInfos.back().second);
9569 PendingIdentifierInfos.pop_back();
9576 for (
unsigned I = 0; I != PendingDeducedFunctionTypes.size(); ++I) {
9577 auto *FD = PendingDeducedFunctionTypes[I].first;
9578 FD->setType(
GetType(PendingDeducedFunctionTypes[I].second));
9580 if (
auto *DT = FD->getReturnType()->getContainedDeducedType()) {
9583 if (DT->isDeduced()) {
9584 PendingDeducedTypeUpdates.insert(
9585 {FD->getCanonicalDecl(), FD->getReturnType()});
9592 PendingUndeducedFunctionDecls.push_back(FD);
9596 PendingDeducedFunctionTypes.clear();
9600 for (
unsigned I = 0; I != PendingDeducedVarTypes.size(); ++I) {
9601 auto *VD = PendingDeducedVarTypes[I].first;
9602 VD->setType(
GetType(PendingDeducedVarTypes[I].second));
9604 PendingDeducedVarTypes.clear();
9608 for (
unsigned I = 0; I != PendingIncompleteDeclChains.size(); ++I) {
9609 markIncompleteDeclChain(PendingIncompleteDeclChains[I]);
9611 PendingIncompleteDeclChains.clear();
9614 for (
unsigned I = 0; I != PendingDeclChains.size(); ++I)
9615 loadPendingDeclChain(PendingDeclChains[I].first,
9616 PendingDeclChains[I].second);
9617 PendingDeclChains.clear();
9620 for (TopLevelDeclsMap::iterator TLD = TopLevelDecls.begin(),
9621 TLDEnd = TopLevelDecls.end(); TLD != TLDEnd; ++TLD) {
9623 for (
unsigned I = 0, N = TLD->second.size(); I != N; ++I) {
9624 pushExternalDeclIntoScope(cast<NamedDecl>(TLD->second[I]), II);
9629 for (
unsigned I = 0; I != PendingMacroIDs.size(); ++I) {
9632 GlobalIDs.swap(PendingMacroIDs.begin()[I].second);
9634 for (
unsigned IDIdx = 0, NumIDs = GlobalIDs.size(); IDIdx != NumIDs;
9636 const PendingMacroInfo &Info = GlobalIDs[IDIdx];
9637 if (!Info.M->isModule())
9641 for (
unsigned IDIdx = 0, NumIDs = GlobalIDs.size(); IDIdx != NumIDs;
9643 const PendingMacroInfo &Info = GlobalIDs[IDIdx];
9644 if (Info.M->isModule())
9648 PendingMacroIDs.clear();
9652 while (!PendingDeclContextInfos.empty()) {
9653 PendingDeclContextInfo Info = PendingDeclContextInfos.front();
9654 PendingDeclContextInfos.pop_front();
9657 Info.D->setDeclContextsImpl(SemaDC, LexicalDC,
getContext());
9661 while (!PendingUpdateRecords.empty()) {
9662 auto Update = PendingUpdateRecords.pop_back_val();
9663 ReadingKindTracker ReadingKind(Read_Decl, *
this);
9664 loadDeclUpdateRecords(Update);
9667 while (!PendingObjCExtensionIvarRedeclarations.empty()) {
9668 auto ExtensionsPair = PendingObjCExtensionIvarRedeclarations.back().first;
9669 auto DuplicateIvars =
9670 PendingObjCExtensionIvarRedeclarations.back().second;
9673 ExtensionsPair.first->getASTContext(),
9674 ExtensionsPair.second->getASTContext(), NonEquivalentDecls,
9678 if (Ctx.IsEquivalent(ExtensionsPair.first, ExtensionsPair.second)) {
9680 for (
auto IvarPair : DuplicateIvars) {
9681 ObjCIvarDecl *Ivar = IvarPair.first, *PrevIvar = IvarPair.second;
9683 Ivar->setDeclContextsImpl(PrevIvar->getDeclContext(),
9689 ExtensionsPair.first->setInvalidDecl();
9690 ExtensionsPair.second->getClassInterface()
9692 ->setIvarList(
nullptr);
9694 for (
auto IvarPair : DuplicateIvars) {
9695 Diag(IvarPair.first->getLocation(),
9696 diag::err_duplicate_ivar_declaration)
9697 << IvarPair.first->getIdentifier();
9698 Diag(IvarPair.second->getLocation(), diag::note_previous_definition);
9701 PendingObjCExtensionIvarRedeclarations.pop_back();
9707 assert(PendingFakeDefinitionData.empty() &&
9708 "faked up a class definition but never saw the real one");
9714 for (
Decl *D : PendingDefinitions) {
9715 if (
TagDecl *TD = dyn_cast<TagDecl>(D)) {
9716 if (
const TagType *TagT = dyn_cast<TagType>(TD->getTypeForDecl())) {
9721 if (
auto RD = dyn_cast<CXXRecordDecl>(D)) {
9722 for (
auto *R = getMostRecentExistingDecl(RD); R;
9723 R = R->getPreviousDecl()) {
9725 cast<CXXRecordDecl>(R)->isThisDeclarationADefinition() &&
9726 "declaration thinks it's the definition but it isn't");
9727 cast<CXXRecordDecl>(R)->DefinitionData = RD->DefinitionData;
9734 if (
auto ID = dyn_cast<ObjCInterfaceDecl>(D)) {
9739 for (
auto *R = getMostRecentExistingDecl(ID); R; R = R->getPreviousDecl())
9740 cast<ObjCInterfaceDecl>(R)->Data =
ID->Data;
9745 if (
auto PD = dyn_cast<ObjCProtocolDecl>(D)) {
9746 for (
auto *R = getMostRecentExistingDecl(PD); R; R = R->getPreviousDecl())
9747 cast<ObjCProtocolDecl>(R)->Data = PD->Data;
9752 auto RTD = cast<RedeclarableTemplateDecl>(D)->getCanonicalDecl();
9753 for (
auto *R = getMostRecentExistingDecl(RTD); R; R = R->getPreviousDecl())
9754 cast<RedeclarableTemplateDecl>(R)->Common = RTD->Common;
9756 PendingDefinitions.clear();
9762 for (PendingBodiesMap::iterator PB = PendingBodies.begin(),
9763 PBEnd = PendingBodies.end();
9764 PB != PBEnd; ++PB) {
9765 if (
FunctionDecl *FD = dyn_cast<FunctionDecl>(PB->first)) {
9775 if (
auto *RD = dyn_cast<CXXRecordDecl>(FD->getLexicalParent()))
9776 if (RD->isDependentContext() && !RD->isThisDeclarationADefinition())
9781 if (!
getContext().getLangOpts().Modules || !FD->hasBody(Defn)) {
9787 if (!FD->isLateTemplateParsed() &&
9788 !NonConstDefn->isLateTemplateParsed() &&
9792 FD->getODRHash() != NonConstDefn->getODRHash()) {
9793 if (!isa<CXXMethodDecl>(FD)) {
9794 PendingFunctionOdrMergeFailures[FD].push_back(NonConstDefn);
9795 }
else if (FD->getLexicalParent()->isFileContext() &&
9796 NonConstDefn->getLexicalParent()->isFileContext()) {
9800 PendingFunctionOdrMergeFailures[FD].push_back(NonConstDefn);
9811 PendingBodies.clear();
9814 for (
auto [RD, MD] : PendingAddedClassMembers) {
9815 RD->addedMember(MD);
9817 PendingAddedClassMembers.clear();
9820 for (
auto *ND : PendingMergedDefinitionsToDeduplicate)
9822 PendingMergedDefinitionsToDeduplicate.clear();
9825 void ASTReader::diagnoseOdrViolations() {
9826 if (PendingOdrMergeFailures.empty() && PendingOdrMergeChecks.empty() &&
9827 PendingRecordOdrMergeFailures.empty() &&
9828 PendingFunctionOdrMergeFailures.empty() &&
9829 PendingEnumOdrMergeFailures.empty() &&
9830 PendingObjCInterfaceOdrMergeFailures.empty() &&
9831 PendingObjCProtocolOdrMergeFailures.empty())
9838 auto OdrMergeFailures = std::move(PendingOdrMergeFailures);
9839 PendingOdrMergeFailures.clear();
9840 for (
auto &Merge : OdrMergeFailures) {
9841 Merge.first->buildLookup();
9842 Merge.first->decls_begin();
9843 Merge.first->bases_begin();
9844 Merge.first->vbases_begin();
9845 for (
auto &RecordPair : Merge.second) {
9846 auto *RD = RecordPair.first;
9854 auto RecordOdrMergeFailures = std::move(PendingRecordOdrMergeFailures);
9855 PendingRecordOdrMergeFailures.clear();
9856 for (
auto &Merge : RecordOdrMergeFailures) {
9857 Merge.first->decls_begin();
9858 for (
auto &D : Merge.second)
9863 auto ObjCInterfaceOdrMergeFailures =
9864 std::move(PendingObjCInterfaceOdrMergeFailures);
9865 PendingObjCInterfaceOdrMergeFailures.clear();
9866 for (
auto &Merge : ObjCInterfaceOdrMergeFailures) {
9867 Merge.first->decls_begin();
9868 for (
auto &InterfacePair : Merge.second)
9869 InterfacePair.first->decls_begin();
9873 auto FunctionOdrMergeFailures = std::move(PendingFunctionOdrMergeFailures);
9874 PendingFunctionOdrMergeFailures.clear();
9875 for (
auto &Merge : FunctionOdrMergeFailures) {
9876 Merge.first->buildLookup();
9877 Merge.first->decls_begin();
9878 Merge.first->getBody();
9879 for (
auto &FD : Merge.second) {
9887 auto EnumOdrMergeFailures = std::move(PendingEnumOdrMergeFailures);
9888 PendingEnumOdrMergeFailures.clear();
9889 for (
auto &Merge : EnumOdrMergeFailures) {
9890 Merge.first->decls_begin();
9891 for (
auto &Enum : Merge.second) {
9892 Enum->decls_begin();
9897 auto ObjCProtocolOdrMergeFailures =
9898 std::move(PendingObjCProtocolOdrMergeFailures);
9899 PendingObjCProtocolOdrMergeFailures.clear();
9900 for (
auto &Merge : ObjCProtocolOdrMergeFailures) {
9901 Merge.first->decls_begin();
9902 for (
auto &ProtocolPair : Merge.second)
9903 ProtocolPair.first->decls_begin();
9912 while (!PendingOdrMergeChecks.empty()) {
9913 NamedDecl *D = PendingOdrMergeChecks.pop_back_val();
9927 for (
auto *RI : D->
redecls()) {
9928 if (RI->getLexicalDeclContext() == CanonDef) {
9943 for (
auto *CanonMember : CanonDef->
decls()) {
9944 if (CanonMember->getCanonicalDecl() == DCanon) {
9953 if (
auto *ND = dyn_cast<NamedDecl>(CanonMember))
9955 Candidates.push_back(ND);
9961 if (!isa<TagDecl>(D))
9966 Deserializing RecursionGuard(
this);
9968 std::string CanonDefModule =
9970 cast<Decl>(CanonDef));
9973 << CanonDef << CanonDefModule.empty() << CanonDefModule;
9975 if (Candidates.empty())
9976 Diag(cast<Decl>(CanonDef)->getLocation(),
9977 diag::note_module_odr_violation_no_possible_decls) << D;
9979 for (
unsigned I = 0, N = Candidates.size(); I != N; ++I)
9980 Diag(Candidates[I]->getLocation(),
9981 diag::note_module_odr_violation_possible_decl)
9985 DiagnosedOdrMergeFailures.insert(CanonDef);
9989 if (OdrMergeFailures.empty() && RecordOdrMergeFailures.empty() &&
9990 FunctionOdrMergeFailures.empty() && EnumOdrMergeFailures.empty() &&
9991 ObjCInterfaceOdrMergeFailures.empty() &&
9992 ObjCProtocolOdrMergeFailures.empty())
9999 for (
auto &Merge : OdrMergeFailures) {
10002 if (!DiagnosedOdrMergeFailures.insert(Merge.first).second)
10005 bool Diagnosed =
false;
10007 for (
auto &RecordPair : Merge.second) {
10008 if (DiagsEmitter.diagnoseMismatch(FirstRecord, RecordPair.first,
10009 RecordPair.second)) {
10022 Diag(Merge.first->getLocation(),
10023 diag::err_module_odr_violation_different_instantiations)
10030 for (
auto &Merge : RecordOdrMergeFailures) {
10033 if (!DiagnosedOdrMergeFailures.insert(Merge.first).second)
10037 bool Diagnosed =
false;
10038 for (
auto *SecondRecord : Merge.second) {
10039 if (DiagsEmitter.diagnoseMismatch(FirstRecord, SecondRecord)) {
10045 assert(Diagnosed &&
"Unable to emit ODR diagnostic.");
10049 for (
auto &Merge : FunctionOdrMergeFailures) {
10051 bool Diagnosed =
false;
10052 for (
auto &SecondFunction : Merge.second) {
10053 if (DiagsEmitter.diagnoseMismatch(FirstFunction, SecondFunction)) {
10059 assert(Diagnosed &&
"Unable to emit ODR diagnostic.");
10063 for (
auto &Merge : EnumOdrMergeFailures) {
10066 if (!DiagnosedOdrMergeFailures.insert(Merge.first).second)
10069 EnumDecl *FirstEnum = Merge.first;
10070 bool Diagnosed =
false;
10071 for (
auto &SecondEnum : Merge.second) {
10072 if (DiagsEmitter.diagnoseMismatch(FirstEnum, SecondEnum)) {
10078 assert(Diagnosed &&
"Unable to emit ODR diagnostic.");
10081 for (
auto &Merge : ObjCInterfaceOdrMergeFailures) {
10084 if (!DiagnosedOdrMergeFailures.insert(Merge.first).second)
10087 bool Diagnosed =
false;
10089 for (
auto &InterfacePair : Merge.second) {
10090 if (DiagsEmitter.diagnoseMismatch(FirstID, InterfacePair.first,
10091 InterfacePair.second)) {
10097 assert(Diagnosed &&
"Unable to emit ODR diagnostic.");
10100 for (
auto &Merge : ObjCProtocolOdrMergeFailures) {
10103 if (!DiagnosedOdrMergeFailures.insert(Merge.first).second)
10107 bool Diagnosed =
false;
10108 for (
auto &ProtocolPair : Merge.second) {
10109 if (DiagsEmitter.diagnoseMismatch(FirstProtocol, ProtocolPair.first,
10110 ProtocolPair.second)) {
10116 assert(Diagnosed &&
"Unable to emit ODR diagnostic.");
10121 if (++NumCurrentElementsDeserializing == 1 && ReadTimer.get())
10122 ReadTimer->startTimer();
10126 assert(NumCurrentElementsDeserializing &&
10127 "FinishedDeserializing not paired with StartedDeserializing");
10128 if (NumCurrentElementsDeserializing == 1) {
10131 finishPendingActions();
10133 --NumCurrentElementsDeserializing;
10135 if (NumCurrentElementsDeserializing == 0) {
10141 while (!PendingExceptionSpecUpdates.empty() ||
10142 !PendingDeducedTypeUpdates.empty()) {
10143 auto ESUpdates = std::move(PendingExceptionSpecUpdates);
10144 PendingExceptionSpecUpdates.clear();
10145 for (
auto Update : ESUpdates) {
10146 ProcessingUpdatesRAIIObj ProcessingUpdates(*
this);
10150 Listener->ResolvedExceptionSpec(cast<FunctionDecl>(Update.second));
10151 for (
auto *Redecl : Update.second->redecls())
10155 auto DTUpdates = std::move(PendingDeducedTypeUpdates);
10156 PendingDeducedTypeUpdates.clear();
10157 for (
auto Update : DTUpdates) {
10158 ProcessingUpdatesRAIIObj ProcessingUpdates(*
this);
10164 auto UDTUpdates = std::move(PendingUndeducedFunctionDecls);
10165 PendingUndeducedFunctionDecls.clear();
10169 (void)UndeducedFD->getMostRecentDecl();
10173 ReadTimer->stopTimer();
10175 diagnoseOdrViolations();
10180 PassInterestingDeclsToConsumer();
10187 auto It = PendingFakeLookupResults.find(II);
10188 if (It != PendingFakeLookupResults.end()) {
10189 for (
auto *ND : It->second)
10194 It->second.clear();
10200 }
else if (SemaObj->
TUScope) {
10212 ArrayRef<std::shared_ptr<ModuleFileExtension>> Extensions,
10213 StringRef isysroot,
10215 bool AllowASTWithCompilerErrors,
10216 bool AllowConfigurationMismatch,
bool ValidateSystemInputs,
10217 bool ValidateASTInputFilesContent,
bool UseGlobalIndex,
10218 std::unique_ptr<llvm::Timer> ReadTimer)
10222 SourceMgr(PP.getSourceManager()), FileMgr(PP.getFileManager()),
10223 PCHContainerRdr(PCHContainerRdr), Diags(PP.getDiagnostics()), PP(PP),
10224 ContextObj(Context), ModuleMgr(PP.getFileManager(), ModuleCache,
10225 PCHContainerRdr, PP.getHeaderSearchInfo()),
10226 DummyIdResolver(PP), ReadTimer(
std::move(ReadTimer)), isysroot(isysroot),
10227 DisableValidationKind(DisableValidationKind),
10228 AllowASTWithCompilerErrors(AllowASTWithCompilerErrors),
10229 AllowConfigurationMismatch(AllowConfigurationMismatch),
10230 ValidateSystemInputs(ValidateSystemInputs),
10231 ValidateASTInputFilesContent(ValidateASTInputFilesContent),
10232 UseGlobalIndex(UseGlobalIndex), CurrSwitchCaseStmts(&SwitchCaseStmts) {
10235 for (
const auto &Ext : Extensions) {
10236 auto BlockName = Ext->getExtensionMetadata().BlockName;
10237 auto Known = ModuleFileExtensions.find(BlockName);
10238 if (Known != ModuleFileExtensions.end()) {
10239 Diags.
Report(diag::warn_duplicate_module_file_extension)
10244 ModuleFileExtensions.insert({BlockName, Ext});
10249 if (OwnsDeserializationListener)
10250 delete DeserializationListener;
10254 return SemaObj ? SemaObj->
IdResolver : DummyIdResolver;
10258 unsigned AbbrevID) {
10278 #define GEN_CLANG_CLAUSE_CLASS
10279 #define CLAUSE_CLASS(Enum, Str, Class) void Visit##Class(Class *C);
10280 #include "llvm/Frontend/OpenMP/OMP.inc"
10294 switch (llvm::omp::Clause(
Record.readInt())) {
10295 case llvm::omp::OMPC_if:
10298 case llvm::omp::OMPC_final:
10301 case llvm::omp::OMPC_num_threads:
10304 case llvm::omp::OMPC_safelen:
10307 case llvm::omp::OMPC_simdlen:
10310 case llvm::omp::OMPC_sizes: {
10311 unsigned NumSizes =
Record.readInt();
10315 case llvm::omp::OMPC_full:
10318 case llvm::omp::OMPC_partial:
10321 case llvm::omp::OMPC_allocator:
10324 case llvm::omp::OMPC_collapse:
10327 case llvm::omp::OMPC_default:
10330 case llvm::omp::OMPC_proc_bind:
10333 case llvm::omp::OMPC_schedule:
10336 case llvm::omp::OMPC_ordered:
10339 case llvm::omp::OMPC_nowait:
10342 case llvm::omp::OMPC_untied:
10345 case llvm::omp::OMPC_mergeable:
10348 case llvm::omp::OMPC_read:
10351 case llvm::omp::OMPC_write:
10354 case llvm::omp::OMPC_update:
10357 case llvm::omp::OMPC_capture:
10360 case llvm::omp::OMPC_compare:
10363 case llvm::omp::OMPC_fail:
10366 case llvm::omp::OMPC_seq_cst:
10369 case llvm::omp::OMPC_acq_rel:
10372 case llvm::omp::OMPC_acquire:
10375 case llvm::omp::OMPC_release:
10378 case llvm::omp::OMPC_relaxed:
10381 case llvm::omp::OMPC_weak:
10384 case llvm::omp::OMPC_threads:
10387 case llvm::omp::OMPC_simd:
10390 case llvm::omp::OMPC_nogroup:
10393 case llvm::omp::OMPC_unified_address:
10396 case llvm::omp::OMPC_unified_shared_memory:
10399 case llvm::omp::OMPC_reverse_offload:
10402 case llvm::omp::OMPC_dynamic_allocators:
10405 case llvm::omp::OMPC_atomic_default_mem_order:
10408 case llvm::omp::OMPC_at:
10411 case llvm::omp::OMPC_severity:
10414 case llvm::omp::OMPC_message:
10417 case llvm::omp::OMPC_private:
10420 case llvm::omp::OMPC_firstprivate:
10423 case llvm::omp::OMPC_lastprivate:
10426 case llvm::omp::OMPC_shared:
10429 case llvm::omp::OMPC_reduction: {
10430 unsigned N =
Record.readInt();
10435 case llvm::omp::OMPC_task_reduction:
10438 case llvm::omp::OMPC_in_reduction:
10441 case llvm::omp::OMPC_linear:
10444 case llvm::omp::OMPC_aligned:
10447 case llvm::omp::OMPC_copyin:
10450 case llvm::omp::OMPC_copyprivate:
10453 case llvm::omp::OMPC_flush:
10456 case llvm::omp::OMPC_depobj:
10459 case llvm::omp::OMPC_depend: {
10460 unsigned NumVars =
Record.readInt();
10461 unsigned NumLoops =
Record.readInt();
10465 case llvm::omp::OMPC_device:
10468 case llvm::omp::OMPC_map: {
10477 case llvm::omp::OMPC_num_teams:
10480 case llvm::omp::OMPC_thread_limit:
10483 case llvm::omp::OMPC_priority:
10486 case llvm::omp::OMPC_grainsize:
10489 case llvm::omp::OMPC_num_tasks:
10492 case llvm::omp::OMPC_hint:
10495 case llvm::omp::OMPC_dist_schedule:
10498 case llvm::omp::OMPC_defaultmap:
10501 case llvm::omp::OMPC_to: {
10510 case llvm::omp::OMPC_from: {
10519 case llvm::omp::OMPC_use_device_ptr: {
10528 case llvm::omp::OMPC_use_device_addr: {
10537 case llvm::omp::OMPC_is_device_ptr: {
10546 case llvm::omp::OMPC_has_device_addr: {
10555 case llvm::omp::OMPC_allocate:
10558 case llvm::omp::OMPC_nontemporal:
10561 case llvm::omp::OMPC_inclusive:
10564 case llvm::omp::OMPC_exclusive:
10567 case llvm::omp::OMPC_order:
10570 case llvm::omp::OMPC_init:
10573 case llvm::omp::OMPC_use:
10576 case llvm::omp::OMPC_destroy:
10579 case llvm::omp::OMPC_novariants:
10582 case llvm::omp::OMPC_nocontext:
10585 case llvm::omp::OMPC_detach:
10588 case llvm::omp::OMPC_uses_allocators:
10591 case llvm::omp::OMPC_affinity:
10594 case llvm::omp::OMPC_filter:
10597 case llvm::omp::OMPC_bind:
10600 case llvm::omp::OMPC_align:
10603 case llvm::omp::OMPC_ompx_dyn_cgroup_mem:
10606 case llvm::omp::OMPC_doacross: {
10607 unsigned NumVars =
Record.readInt();
10608 unsigned NumLoops =
Record.readInt();
10612 case llvm::omp::OMPC_ompx_attribute:
10615 case llvm::omp::OMPC_ompx_bare:
10618 #define OMP_CLAUSE_NO_CLASS(Enum, Str) \
10619 case llvm::omp::Enum: \
10621 #include "llvm/Frontend/OpenMP/OMPKinds.def"
10625 assert(C &&
"Unknown OMPClause type");
10628 C->setLocStart(
Record.readSourceLocation());
10629 C->setLocEnd(
Record.readSourceLocation());
10635 C->setPreInitStmt(
Record.readSubStmt(),
10641 C->setPostUpdateExpr(
Record.readSubExpr());
10644 void OMPClauseReader::VisitOMPIfClause(
OMPIfClause *C) {
10647 C->setNameModifierLoc(
Record.readSourceLocation());
10648 C->setColonLoc(
Record.readSourceLocation());
10649 C->setCondition(
Record.readSubExpr());
10650 C->setLParenLoc(
Record.readSourceLocation());
10655 C->setCondition(
Record.readSubExpr());
10656 C->setLParenLoc(
Record.readSourceLocation());
10661 C->setNumThreads(
Record.readSubExpr());
10662 C->setLParenLoc(
Record.readSourceLocation());
10666 C->setSafelen(
Record.readSubExpr());
10667 C->setLParenLoc(
Record.readSourceLocation());
10671 C->setSimdlen(
Record.readSubExpr());
10672 C->setLParenLoc(
Record.readSourceLocation());
10676 for (
Expr *&E :
C->getSizesRefs())
10677 E =
Record.readSubExpr();
10678 C->setLParenLoc(
Record.readSourceLocation());
10681 void OMPClauseReader::VisitOMPFullClause(
OMPFullClause *C) {}
10684 C->setFactor(
Record.readSubExpr());
10685 C->setLParenLoc(
Record.readSourceLocation());
10689 C->setAllocator(
Record.readExpr());
10690 C->setLParenLoc(
Record.readSourceLocation());
10694 C->setNumForLoops(
Record.readSubExpr());
10695 C->setLParenLoc(
Record.readSourceLocation());
10699 C->setDefaultKind(
static_cast<llvm::omp::DefaultKind
>(
Record.readInt()));
10700 C->setLParenLoc(
Record.readSourceLocation());
10701 C->setDefaultKindKwLoc(
Record.readSourceLocation());
10705 C->setProcBindKind(
static_cast<llvm::omp::ProcBindKind
>(
Record.readInt()));
10706 C->setLParenLoc(
Record.readSourceLocation());
10707 C->setProcBindKindKwLoc(
Record.readSourceLocation());
10712 C->setScheduleKind(
10714 C->setFirstScheduleModifier(
10716 C->setSecondScheduleModifier(
10718 C->setChunkSize(
Record.readSubExpr());
10719 C->setLParenLoc(
Record.readSourceLocation());
10720 C->setFirstScheduleModifierLoc(
Record.readSourceLocation());
10721 C->setSecondScheduleModifierLoc(
Record.readSourceLocation());
10722 C->setScheduleKindLoc(
Record.readSourceLocation());
10723 C->setCommaLoc(
Record.readSourceLocation());
10727 C->setNumForLoops(
Record.readSubExpr());
10728 for (
unsigned I = 0, E =
C->NumberOfLoops; I < E; ++I)
10729 C->setLoopNumIterations(I,
Record.readSubExpr());
10730 for (
unsigned I = 0, E =
C->NumberOfLoops; I < E; ++I)
10731 C->setLoopCounter(I,
Record.readSubExpr());
10732 C->setLParenLoc(
Record.readSourceLocation());
10736 C->setEventHandler(
Record.readSubExpr());
10737 C->setLParenLoc(
Record.readSourceLocation());
10746 void OMPClauseReader::VisitOMPReadClause(
OMPReadClause *) {}
10751 if (
C->isExtended()) {
10752 C->setLParenLoc(
Record.readSourceLocation());
10753 C->setArgumentLoc(
Record.readSourceLocation());
10764 void OMPClauseReader::VisitOMPFailClause(
OMPFailClause *C) {
10765 C->setLParenLoc(
Record.readSourceLocation());
10767 C->setFailParameterLoc(FailParameterLoc);
10769 C->setFailParameter(CKind);
10782 void OMPClauseReader::VisitOMPWeakClause(
OMPWeakClause *) {}
10786 void OMPClauseReader::VisitOMPSIMDClause(
OMPSIMDClause *) {}
10790 void OMPClauseReader::VisitOMPInitClause(
OMPInitClause *C) {
10791 unsigned NumVars =
C->varlist_size();
10793 Vars.reserve(NumVars);
10794 for (
unsigned I = 0; I != NumVars; ++I)
10795 Vars.push_back(
Record.readSubExpr());
10796 C->setVarRefs(Vars);
10797 C->setIsTarget(
Record.readBool());
10798 C->setIsTargetSync(
Record.readBool());
10799 C->setLParenLoc(
Record.readSourceLocation());
10800 C->setVarLoc(
Record.readSourceLocation());
10803 void OMPClauseReader::VisitOMPUseClause(
OMPUseClause *C) {
10804 C->setInteropVar(
Record.readSubExpr());
10805 C->setLParenLoc(
Record.readSourceLocation());
10806 C->setVarLoc(
Record.readSourceLocation());
10810 C->setInteropVar(
Record.readSubExpr());
10811 C->setLParenLoc(
Record.readSourceLocation());
10812 C->setVarLoc(
Record.readSourceLocation());
10817 C->setCondition(
Record.readSubExpr());
10818 C->setLParenLoc(
Record.readSourceLocation());
10823 C->setCondition(
Record.readSubExpr());
10824 C->setLParenLoc(
Record.readSourceLocation());
10829 void OMPClauseReader::VisitOMPUnifiedSharedMemoryClause(
10838 void OMPClauseReader::VisitOMPAtomicDefaultMemOrderClause(
10840 C->setAtomicDefaultMemOrderKind(
10842 C->setLParenLoc(
Record.readSourceLocation());
10843 C->setAtomicDefaultMemOrderKindKwLoc(
Record.readSourceLocation());
10846 void OMPClauseReader::VisitOMPAtClause(
OMPAtClause *C) {
10848 C->setLParenLoc(
Record.readSourceLocation());
10849 C->setAtKindKwLoc(
Record.readSourceLocation());
10854 C->setLParenLoc(
Record.readSourceLocation());
10855 C->setSeverityKindKwLoc(
Record.readSourceLocation());
10859 C->setMessageString(
Record.readSubExpr());
10860 C->setLParenLoc(
Record.readSourceLocation());
10864 C->setLParenLoc(
Record.readSourceLocation());
10865 unsigned NumVars =
C->varlist_size();
10867 Vars.reserve(NumVars);
10868 for (
unsigned i = 0; i != NumVars; ++i)
10869 Vars.push_back(
Record.readSubExpr());
10870 C->setVarRefs(Vars);
10872 for (
unsigned i = 0; i != NumVars; ++i)
10873 Vars.push_back(
Record.readSubExpr());
10874 C->setPrivateCopies(Vars);
10879 C->setLParenLoc(
Record.readSourceLocation());
10880 unsigned NumVars =
C->varlist_size();
10882 Vars.reserve(NumVars);
10883 for (
unsigned i = 0; i != NumVars; ++i)
10884 Vars.push_back(
Record.readSubExpr());
10885 C->setVarRefs(Vars);
10887 for (
unsigned i = 0; i != NumVars; ++i)
10888 Vars.push_back(
Record.readSubExpr());
10889 C->setPrivateCopies(Vars);
10891 for (
unsigned i = 0; i != NumVars; ++i)
10892 Vars.push_back(
Record.readSubExpr());
10898 C->setLParenLoc(
Record.readSourceLocation());
10900 C->setKindLoc(
Record.readSourceLocation());
10901 C->setColonLoc(
Record.readSourceLocation());
10902 unsigned NumVars =
C->varlist_size();
10904 Vars.reserve(NumVars);
10905 for (
unsigned i = 0; i != NumVars; ++i)
10906 Vars.push_back(
Record.readSubExpr());
10907 C->setVarRefs(Vars);
10909 for (
unsigned i = 0; i != NumVars; ++i)
10910 Vars.push_back(
Record.readSubExpr());
10911 C->setPrivateCopies(Vars);
10913 for (
unsigned i = 0; i != NumVars; ++i)
10914 Vars.push_back(
Record.readSubExpr());
10915 C->setSourceExprs(Vars);
10917 for (
unsigned i = 0; i != NumVars; ++i)
10918 Vars.push_back(
Record.readSubExpr());
10919 C->setDestinationExprs(Vars);
10921 for (
unsigned i = 0; i != NumVars; ++i)
10922 Vars.push_back(
Record.readSubExpr());
10923 C->setAssignmentOps(Vars);
10927 C->setLParenLoc(
Record.readSourceLocation());
10928 unsigned NumVars =
C->varlist_size();
10930 Vars.reserve(NumVars);
10931 for (
unsigned i = 0; i != NumVars; ++i)
10932 Vars.push_back(
Record.readSubExpr());
10933 C->setVarRefs(Vars);
10938 C->setLParenLoc(
Record.readSourceLocation());
10939 C->setModifierLoc(
Record.readSourceLocation());
10940 C->setColonLoc(
Record.readSourceLocation());
10943 C->setQualifierLoc(NNSL);
10944 C->setNameInfo(DNI);
10946 unsigned NumVars =
C->varlist_size();
10948 Vars.reserve(NumVars);
10949 for (
unsigned i = 0; i != NumVars; ++i)
10950 Vars.push_back(
Record.readSubExpr());
10951 C->setVarRefs(Vars);
10953 for (
unsigned i = 0; i != NumVars; ++i)
10954 Vars.push_back(
Record.readSubExpr());
10955 C->setPrivates(Vars);
10957 for (
unsigned i = 0; i != NumVars; ++i)
10958 Vars.push_back(
Record.readSubExpr());
10959 C->setLHSExprs(Vars);
10961 for (
unsigned i = 0; i != NumVars; ++i)
10962 Vars.push_back(
Record.readSubExpr());
10963 C->setRHSExprs(Vars);
10965 for (
unsigned i = 0; i != NumVars; ++i)
10966 Vars.push_back(
Record.readSubExpr());
10967 C->setReductionOps(Vars);
10968 if (
C->getModifier() == OMPC_REDUCTION_inscan) {
10970 for (
unsigned i = 0; i != NumVars; ++i)
10971 Vars.push_back(
Record.readSubExpr());
10972 C->setInscanCopyOps(Vars);
10974 for (
unsigned i = 0; i != NumVars; ++i)
10975 Vars.push_back(
Record.readSubExpr());
10976 C->setInscanCopyArrayTemps(Vars);
10978 for (
unsigned i = 0; i != NumVars; ++i)
10979 Vars.push_back(
Record.readSubExpr());
10980 C->setInscanCopyArrayElems(Vars);
10986 C->setLParenLoc(
Record.readSourceLocation());
10987 C->setColonLoc(
Record.readSourceLocation());
10990 C->setQualifierLoc(NNSL);
10991 C->setNameInfo(DNI);
10993 unsigned NumVars =
C->varlist_size();
10995 Vars.reserve(NumVars);
10996 for (
unsigned I = 0; I != NumVars; ++I)
10997 Vars.push_back(
Record.readSubExpr());
10998 C->setVarRefs(Vars);
11000 for (
unsigned I = 0; I != NumVars; ++I)
11001 Vars.push_back(
Record.readSubExpr());
11002 C->setPrivates(Vars);
11004 for (
unsigned I = 0; I != NumVars; ++I)
11005 Vars.push_back(
Record.readSubExpr());
11006 C->setLHSExprs(Vars);
11008 for (
unsigned I = 0; I != NumVars; ++I)
11009 Vars.push_back(
Record.readSubExpr());
11010 C->setRHSExprs(Vars);
11012 for (
unsigned I = 0; I != NumVars; ++I)
11013 Vars.push_back(
Record.readSubExpr());
11014 C->setReductionOps(Vars);
11019 C->setLParenLoc(
Record.readSourceLocation());
11020 C->setColonLoc(
Record.readSourceLocation());
11023 C->setQualifierLoc(NNSL);
11024 C->setNameInfo(DNI);
11026 unsigned NumVars =
C->varlist_size();
11028 Vars.reserve(NumVars);
11029 for (
unsigned I = 0; I != NumVars; ++I)
11030 Vars.push_back(
Record.readSubExpr());
11031 C->setVarRefs(Vars);
11033 for (
unsigned I = 0; I != NumVars; ++I)
11034 Vars.push_back(
Record.readSubExpr());
11035 C->setPrivates(Vars);
11037 for (
unsigned I = 0; I != NumVars; ++I)
11038 Vars.push_back(
Record.readSubExpr());
11039 C->setLHSExprs(Vars);
11041 for (
unsigned I = 0; I != NumVars; ++I)
11042 Vars.push_back(
Record.readSubExpr());
11043 C->setRHSExprs(Vars);
11045 for (
unsigned I = 0; I != NumVars; ++I)
11046 Vars.push_back(
Record.readSubExpr());
11047 C->setReductionOps(Vars);
11049 for (
unsigned I = 0; I != NumVars; ++I)
11050 Vars.push_back(
Record.readSubExpr());
11051 C->setTaskgroupDescriptors(Vars);
11056 C->setLParenLoc(
Record.readSourceLocation());
11057 C->setColonLoc(
Record.readSourceLocation());
11059 C->setModifierLoc(
Record.readSourceLocation());
11060 unsigned NumVars =
C->varlist_size();
11062 Vars.reserve(NumVars);
11063 for (
unsigned i = 0; i != NumVars; ++i)
11064 Vars.push_back(
Record.readSubExpr());
11065 C->setVarRefs(Vars);
11067 for (
unsigned i = 0; i != NumVars; ++i)
11068 Vars.push_back(
Record.readSubExpr());
11069 C->setPrivates(Vars);
11071 for (
unsigned i = 0; i != NumVars; ++i)
11072 Vars.push_back(
Record.readSubExpr());
11075 for (
unsigned i = 0; i != NumVars; ++i)
11076 Vars.push_back(
Record.readSubExpr());
11077 C->setUpdates(Vars);
11079 for (
unsigned i = 0; i != NumVars; ++i)
11080 Vars.push_back(
Record.readSubExpr());
11081 C->setFinals(Vars);
11082 C->setStep(
Record.readSubExpr());
11083 C->setCalcStep(
Record.readSubExpr());
11085 for (
unsigned I = 0; I != NumVars + 1; ++I)
11086 Vars.push_back(
Record.readSubExpr());
11087 C->setUsedExprs(Vars);
11091 C->setLParenLoc(
Record.readSourceLocation());
11092 C->setColonLoc(
Record.readSourceLocation());
11093 unsigned NumVars =
C->varlist_size();
11095 Vars.reserve(NumVars);
11096 for (
unsigned i = 0; i != NumVars; ++i)
11097 Vars.push_back(
Record.readSubExpr());
11098 C->setVarRefs(Vars);
11099 C->setAlignment(
Record.readSubExpr());
11103 C->setLParenLoc(
Record.readSourceLocation());
11104 unsigned NumVars =
C->varlist_size();
11106 Exprs.reserve(NumVars);
11107 for (
unsigned i = 0; i != NumVars; ++i)
11108 Exprs.push_back(
Record.readSubExpr());
11109 C->setVarRefs(Exprs);
11111 for (
unsigned i = 0; i != NumVars; ++i)
11112 Exprs.push_back(
Record.readSubExpr());
11113 C->setSourceExprs(Exprs);
11115 for (
unsigned i = 0; i != NumVars; ++i)
11116 Exprs.push_back(
Record.readSubExpr());
11117 C->setDestinationExprs(Exprs);
11119 for (
unsigned i = 0; i != NumVars; ++i)
11120 Exprs.push_back(
Record.readSubExpr());
11121 C->setAssignmentOps(Exprs);
11125 C->setLParenLoc(
Record.readSourceLocation());
11126 unsigned NumVars =
C->varlist_size();
11128 Exprs.reserve(NumVars);
11129 for (
unsigned i = 0; i != NumVars; ++i)
11130 Exprs.push_back(
Record.readSubExpr());
11131 C->setVarRefs(Exprs);
11133 for (
unsigned i = 0; i != NumVars; ++i)
11134 Exprs.push_back(
Record.readSubExpr());
11135 C->setSourceExprs(Exprs);
11137 for (
unsigned i = 0; i != NumVars; ++i)
11138 Exprs.push_back(
Record.readSubExpr());
11139 C->setDestinationExprs(Exprs);
11141 for (
unsigned i = 0; i != NumVars; ++i)
11142 Exprs.push_back(
Record.readSubExpr());
11143 C->setAssignmentOps(Exprs);
11147 C->setLParenLoc(
Record.readSourceLocation());
11148 unsigned NumVars =
C->varlist_size();
11150 Vars.reserve(NumVars);
11151 for (
unsigned i = 0; i != NumVars; ++i)
11152 Vars.push_back(
Record.readSubExpr());
11153 C->setVarRefs(Vars);
11157 C->setDepobj(
Record.readSubExpr());
11158 C->setLParenLoc(
Record.readSourceLocation());
11162 C->setLParenLoc(
Record.readSourceLocation());
11163 C->setModifier(
Record.readSubExpr());
11164 C->setDependencyKind(
11166 C->setDependencyLoc(
Record.readSourceLocation());
11167 C->setColonLoc(
Record.readSourceLocation());
11168 C->setOmpAllMemoryLoc(
Record.readSourceLocation());
11169 unsigned NumVars =
C->varlist_size();
11171 Vars.reserve(NumVars);
11172 for (
unsigned I = 0; I != NumVars; ++I)
11173 Vars.push_back(
Record.readSubExpr());
11174 C->setVarRefs(Vars);
11175 for (
unsigned I = 0, E =
C->getNumLoops(); I < E; ++I)
11176 C->setLoopData(I,
Record.readSubExpr());
11182 C->setDevice(
Record.readSubExpr());
11183 C->setModifierLoc(
Record.readSourceLocation());
11184 C->setLParenLoc(
Record.readSourceLocation());
11187 void OMPClauseReader::VisitOMPMapClause(
OMPMapClause *C) {
11188 C->setLParenLoc(
Record.readSourceLocation());
11189 bool HasIteratorModifier =
false;
11191 C->setMapTypeModifier(
11193 C->setMapTypeModifierLoc(I,
Record.readSourceLocation());
11194 if (
C->getMapTypeModifier(I) == OMPC_MAP_MODIFIER_iterator)
11195 HasIteratorModifier =
true;
11197 C->setMapperQualifierLoc(
Record.readNestedNameSpecifierLoc());
11198 C->setMapperIdInfo(
Record.readDeclarationNameInfo());
11201 C->setMapLoc(
Record.readSourceLocation());
11202 C->setColonLoc(
Record.readSourceLocation());
11203 auto NumVars =
C->varlist_size();
11204 auto UniqueDecls =
C->getUniqueDeclarationsNum();
11205 auto TotalLists =
C->getTotalComponentListNum();
11206 auto TotalComponents =
C->getTotalComponentsNum();
11209 Vars.reserve(NumVars);
11210 for (
unsigned i = 0; i != NumVars; ++i)
11211 Vars.push_back(
Record.readExpr());
11212 C->setVarRefs(Vars);
11215 UDMappers.reserve(NumVars);
11216 for (
unsigned I = 0; I < NumVars; ++I)
11217 UDMappers.push_back(
Record.readExpr());
11218 C->setUDMapperRefs(UDMappers);
11220 if (HasIteratorModifier)
11221 C->setIteratorModifier(
Record.readExpr());
11224 Decls.reserve(UniqueDecls);
11225 for (
unsigned i = 0; i < UniqueDecls; ++i)
11227 C->setUniqueDecls(Decls);
11230 ListsPerDecl.reserve(UniqueDecls);
11231 for (
unsigned i = 0; i < UniqueDecls; ++i)
11232 ListsPerDecl.push_back(
Record.readInt());
11233 C->setDeclNumLists(ListsPerDecl);
11236 ListSizes.reserve(TotalLists);
11237 for (
unsigned i = 0; i < TotalLists; ++i)
11238 ListSizes.push_back(
Record.readInt());
11239 C->setComponentListSizes(ListSizes);
11242 Components.reserve(TotalComponents);
11243 for (
unsigned i = 0; i < TotalComponents; ++i) {
11246 Components.emplace_back(AssociatedExprPr, AssociatedDecl,
11249 C->setComponents(Components, ListSizes);
11253 C->setLParenLoc(
Record.readSourceLocation());
11254 C->setColonLoc(
Record.readSourceLocation());
11255 C->setAllocator(
Record.readSubExpr());
11256 unsigned NumVars =
C->varlist_size();
11258 Vars.reserve(NumVars);
11259 for (
unsigned i = 0; i != NumVars; ++i)
11260 Vars.push_back(
Record.readSubExpr());
11261 C->setVarRefs(Vars);
11266 C->setNumTeams(
Record.readSubExpr());
11267 C->setLParenLoc(
Record.readSourceLocation());
11272 C->setThreadLimit(
Record.readSubExpr());
11273 C->setLParenLoc(
Record.readSourceLocation());
11278 C->setPriority(
Record.readSubExpr());
11279 C->setLParenLoc(
Record.readSourceLocation());
11285 C->setGrainsize(
Record.readSubExpr());
11286 C->setModifierLoc(
Record.readSourceLocation());
11287 C->setLParenLoc(
Record.readSourceLocation());
11293 C->setNumTasks(
Record.readSubExpr());
11294 C->setModifierLoc(
Record.readSourceLocation());
11295 C->setLParenLoc(
Record.readSourceLocation());
11298 void OMPClauseReader::VisitOMPHintClause(
OMPHintClause *C) {
11299 C->setHint(
Record.readSubExpr());
11300 C->setLParenLoc(
Record.readSourceLocation());
11305 C->setDistScheduleKind(
11307 C->setChunkSize(
Record.readSubExpr());
11308 C->setLParenLoc(
Record.readSourceLocation());
11309 C->setDistScheduleKindLoc(
Record.readSourceLocation());
11310 C->setCommaLoc(
Record.readSourceLocation());
11314 C->setDefaultmapKind(
11316 C->setDefaultmapModifier(
11318 C->setLParenLoc(
Record.readSourceLocation());
11319 C->setDefaultmapModifierLoc(
Record.readSourceLocation());
11320 C->setDefaultmapKindLoc(
Record.readSourceLocation());
11323 void OMPClauseReader::VisitOMPToClause(
OMPToClause *C) {
11324 C->setLParenLoc(
Record.readSourceLocation());
11326 C->setMotionModifier(
11328 C->setMotionModifierLoc(I,
Record.readSourceLocation());
11330 C->setMapperQualifierLoc(
Record.readNestedNameSpecifierLoc());
11331 C->setMapperIdInfo(
Record.readDeclarationNameInfo());
11332 C->setColonLoc(
Record.readSourceLocation());
11333 auto NumVars =
C->varlist_size();
11334 auto UniqueDecls =
C->getUniqueDeclarationsNum();
11335 auto TotalLists =
C->getTotalComponentListNum();
11336 auto TotalComponents =
C->getTotalComponentsNum();
11339 Vars.reserve(NumVars);
11340 for (
unsigned i = 0; i != NumVars; ++i)
11341 Vars.push_back(
Record.readSubExpr());
11342 C->setVarRefs(Vars);
11345 UDMappers.reserve(NumVars);
11346 for (
unsigned I = 0; I < NumVars; ++I)
11347 UDMappers.push_back(
Record.readSubExpr());
11348 C->setUDMapperRefs(UDMappers);
11351 Decls.reserve(UniqueDecls);
11352 for (
unsigned i = 0; i < UniqueDecls; ++i)
11354 C->setUniqueDecls(Decls);
11357 ListsPerDecl.reserve(UniqueDecls);
11358 for (
unsigned i = 0; i < UniqueDecls; ++i)
11359 ListsPerDecl.push_back(
Record.readInt());
11360 C->setDeclNumLists(ListsPerDecl);
11363 ListSizes.reserve(TotalLists);
11364 for (
unsigned i = 0; i < TotalLists; ++i)
11365 ListSizes.push_back(
Record.readInt());
11366 C->setComponentListSizes(ListSizes);
11369 Components.reserve(TotalComponents);
11370 for (
unsigned i = 0; i < TotalComponents; ++i) {
11371 Expr *AssociatedExprPr =
Record.readSubExpr();
11372 bool IsNonContiguous =
Record.readBool();
11374 Components.emplace_back(AssociatedExprPr, AssociatedDecl, IsNonContiguous);
11376 C->setComponents(Components, ListSizes);
11379 void OMPClauseReader::VisitOMPFromClause(
OMPFromClause *C) {
11380 C->setLParenLoc(
Record.readSourceLocation());
11382 C->setMotionModifier(
11384 C->setMotionModifierLoc(I,
Record.readSourceLocation());
11386 C->setMapperQualifierLoc(
Record.readNestedNameSpecifierLoc());
11387 C->setMapperIdInfo(
Record.readDeclarationNameInfo());
11388 C->setColonLoc(
Record.readSourceLocation());
11389 auto NumVars =
C->varlist_size();
11390 auto UniqueDecls =
C->getUniqueDeclarationsNum();
11391 auto TotalLists =
C->getTotalComponentListNum();
11392 auto TotalComponents =
C->getTotalComponentsNum();
11395 Vars.reserve(NumVars);
11396 for (
unsigned i = 0; i != NumVars; ++i)
11397 Vars.push_back(
Record.readSubExpr());
11398 C->setVarRefs(Vars);
11401 UDMappers.reserve(NumVars);
11402 for (
unsigned I = 0; I < NumVars; ++I)
11403 UDMappers.push_back(
Record.readSubExpr());
11404 C->setUDMapperRefs(UDMappers);
11407 Decls.reserve(UniqueDecls);
11408 for (
unsigned i = 0; i < UniqueDecls; ++i)
11410 C->setUniqueDecls(Decls);
11413 ListsPerDecl.reserve(UniqueDecls);
11414 for (
unsigned i = 0; i < UniqueDecls; ++i)
11415 ListsPerDecl.push_back(
Record.readInt());
11416 C->setDeclNumLists(ListsPerDecl);
11419 ListSizes.reserve(TotalLists);
11420 for (
unsigned i = 0; i < TotalLists; ++i)
11421 ListSizes.push_back(
Record.readInt());
11422 C->setComponentListSizes(ListSizes);
11425 Components.reserve(TotalComponents);
11426 for (
unsigned i = 0; i < TotalComponents; ++i) {
11427 Expr *AssociatedExprPr =
Record.readSubExpr();
11428 bool IsNonContiguous =
Record.readBool();
11430 Components.emplace_back(AssociatedExprPr, AssociatedDecl, IsNonContiguous);
11432 C->setComponents(Components, ListSizes);
11436 C->setLParenLoc(
Record.readSourceLocation());
11437 auto NumVars =
C->varlist_size();
11438 auto UniqueDecls =
C->getUniqueDeclarationsNum();
11439 auto TotalLists =
C->getTotalComponentListNum();
11440 auto TotalComponents =
C->getTotalComponentsNum();
11443 Vars.reserve(NumVars);
11444 for (
unsigned i = 0; i != NumVars; ++i)
11445 Vars.push_back(
Record.readSubExpr());
11446 C->setVarRefs(Vars);
11448 for (
unsigned i = 0; i != NumVars; ++i)
11449 Vars.push_back(
Record.readSubExpr());
11450 C->setPrivateCopies(Vars);
11452 for (
unsigned i = 0; i != NumVars; ++i)
11453 Vars.push_back(
Record.readSubExpr());
11457 Decls.reserve(UniqueDecls);
11458 for (
unsigned i = 0; i < UniqueDecls; ++i)
11460 C->setUniqueDecls(Decls);
11463 ListsPerDecl.reserve(UniqueDecls);
11464 for (
unsigned i = 0; i < UniqueDecls; ++i)
11465 ListsPerDecl.push_back(
Record.readInt());
11466 C->setDeclNumLists(ListsPerDecl);
11469 ListSizes.reserve(TotalLists);
11470 for (
unsigned i = 0; i < TotalLists; ++i)
11471 ListSizes.push_back(
Record.readInt());
11472 C->setComponentListSizes(ListSizes);
11475 Components.reserve(TotalComponents);
11476 for (
unsigned i = 0; i < TotalComponents; ++i) {
11477 auto *AssociatedExprPr =
Record.readSubExpr();
11479 Components.emplace_back(AssociatedExprPr, AssociatedDecl,
11482 C->setComponents(Components, ListSizes);
11486 C->setLParenLoc(
Record.readSourceLocation());
11487 auto NumVars =
C->varlist_size();
11488 auto UniqueDecls =
C->getUniqueDeclarationsNum();
11489 auto TotalLists =
C->getTotalComponentListNum();
11490 auto TotalComponents =
C->getTotalComponentsNum();
11493 Vars.reserve(NumVars);
11494 for (
unsigned i = 0; i != NumVars; ++i)
11495 Vars.push_back(
Record.readSubExpr());
11496 C->setVarRefs(Vars);
11499 Decls.reserve(UniqueDecls);
11500 for (
unsigned i = 0; i < UniqueDecls; ++i)
11502 C->setUniqueDecls(Decls);
11505 ListsPerDecl.reserve(UniqueDecls);
11506 for (
unsigned i = 0; i < UniqueDecls; ++i)
11507 ListsPerDecl.push_back(
Record.readInt());
11508 C->setDeclNumLists(ListsPerDecl);
11511 ListSizes.reserve(TotalLists);
11512 for (
unsigned i = 0; i < TotalLists; ++i)
11513 ListSizes.push_back(
Record.readInt());
11514 C->setComponentListSizes(ListSizes);
11517 Components.reserve(TotalComponents);
11518 for (
unsigned i = 0; i < TotalComponents; ++i) {
11519 Expr *AssociatedExpr =
Record.readSubExpr();
11521 Components.emplace_back(AssociatedExpr, AssociatedDecl,
11524 C->setComponents(Components, ListSizes);
11528 C->setLParenLoc(
Record.readSourceLocation());
11529 auto NumVars =
C->varlist_size();
11530 auto UniqueDecls =
C->getUniqueDeclarationsNum();
11531 auto TotalLists =
C->getTotalComponentListNum();
11532 auto TotalComponents =
C->getTotalComponentsNum();
11535 Vars.reserve(NumVars);
11536 for (
unsigned i = 0; i != NumVars; ++i)
11537 Vars.push_back(
Record.readSubExpr());
11538 C->setVarRefs(Vars);
11542 Decls.reserve(UniqueDecls);
11543 for (
unsigned i = 0; i < UniqueDecls; ++i)
11545 C->setUniqueDecls(Decls);
11548 ListsPerDecl.reserve(UniqueDecls);
11549 for (
unsigned i = 0; i < UniqueDecls; ++i)
11550 ListsPerDecl.push_back(
Record.readInt());
11551 C->setDeclNumLists(ListsPerDecl);
11554 ListSizes.reserve(TotalLists);
11555 for (
unsigned i = 0; i < TotalLists; ++i)
11556 ListSizes.push_back(
Record.readInt());
11557 C->setComponentListSizes(ListSizes);
11560 Components.reserve(TotalComponents);
11561 for (
unsigned i = 0; i < TotalComponents; ++i) {
11562 Expr *AssociatedExpr =
Record.readSubExpr();
11564 Components.emplace_back(AssociatedExpr, AssociatedDecl,
11567 C->setComponents(Components, ListSizes);
11571 C->setLParenLoc(
Record.readSourceLocation());
11572 auto NumVars =
C->varlist_size();
11573 auto UniqueDecls =
C->getUniqueDeclarationsNum();
11574 auto TotalLists =
C->getTotalComponentListNum();
11575 auto TotalComponents =
C->getTotalComponentsNum();
11578 Vars.reserve(NumVars);
11579 for (
unsigned I = 0; I != NumVars; ++I)
11580 Vars.push_back(
Record.readSubExpr());
11581 C->setVarRefs(Vars);
11585 Decls.reserve(UniqueDecls);
11586 for (
unsigned I = 0; I < UniqueDecls; ++I)
11588 C->setUniqueDecls(Decls);
11591 ListsPerDecl.reserve(UniqueDecls);
11592 for (
unsigned I = 0; I < UniqueDecls; ++I)
11593 ListsPerDecl.push_back(
Record.readInt());
11594 C->setDeclNumLists(ListsPerDecl);
11597 ListSizes.reserve(TotalLists);
11598 for (
unsigned i = 0; i < TotalLists; ++i)
11599 ListSizes.push_back(
Record.readInt());
11600 C->setComponentListSizes(ListSizes);
11603 Components.reserve(TotalComponents);
11604 for (
unsigned I = 0; I < TotalComponents; ++I) {
11605 Expr *AssociatedExpr =
Record.readSubExpr();
11607 Components.emplace_back(AssociatedExpr, AssociatedDecl,
11610 C->setComponents(Components, ListSizes);
11614 C->setLParenLoc(
Record.readSourceLocation());
11615 unsigned NumVars =
C->varlist_size();
11617 Vars.reserve(NumVars);
11618 for (
unsigned i = 0; i != NumVars; ++i)
11619 Vars.push_back(
Record.readSubExpr());
11620 C->setVarRefs(Vars);
11622 Vars.reserve(NumVars);
11623 for (
unsigned i = 0; i != NumVars; ++i)
11624 Vars.push_back(
Record.readSubExpr());
11625 C->setPrivateRefs(Vars);
11629 C->setLParenLoc(
Record.readSourceLocation());
11630 unsigned NumVars =
C->varlist_size();
11632 Vars.reserve(NumVars);
11633 for (
unsigned i = 0; i != NumVars; ++i)
11634 Vars.push_back(
Record.readSubExpr());
11635 C->setVarRefs(Vars);
11639 C->setLParenLoc(
Record.readSourceLocation());
11640 unsigned NumVars =
C->varlist_size();
11642 Vars.reserve(NumVars);
11643 for (
unsigned i = 0; i != NumVars; ++i)
11644 Vars.push_back(
Record.readSubExpr());
11645 C->setVarRefs(Vars);
11649 C->setLParenLoc(
Record.readSourceLocation());
11650 unsigned NumOfAllocators =
C->getNumberOfAllocators();
11652 Data.reserve(NumOfAllocators);
11653 for (
unsigned I = 0; I != NumOfAllocators; ++I) {
11660 C->setAllocatorsData(Data);
11664 C->setLParenLoc(
Record.readSourceLocation());
11665 C->setModifier(
Record.readSubExpr());
11666 C->setColonLoc(
Record.readSourceLocation());
11667 unsigned NumOfLocators =
C->varlist_size();
11669 Locators.reserve(NumOfLocators);
11670 for (
unsigned I = 0; I != NumOfLocators; ++I)
11671 Locators.push_back(
Record.readSubExpr());
11672 C->setVarRefs(Locators);
11678 C->setLParenLoc(
Record.readSourceLocation());
11679 C->setKindKwLoc(
Record.readSourceLocation());
11680 C->setModifierKwLoc(
Record.readSourceLocation());
11685 C->setThreadID(
Record.readSubExpr());
11686 C->setLParenLoc(
Record.readSourceLocation());
11689 void OMPClauseReader::VisitOMPBindClause(
OMPBindClause *C) {
11691 C->setLParenLoc(
Record.readSourceLocation());
11692 C->setBindKindLoc(
Record.readSourceLocation());
11696 C->setAlignment(
Record.readExpr());
11697 C->setLParenLoc(
Record.readSourceLocation());
11702 C->setSize(
Record.readSubExpr());
11703 C->setLParenLoc(
Record.readSourceLocation());
11707 C->setLParenLoc(
Record.readSourceLocation());
11708 C->setDependenceType(
11710 C->setDependenceLoc(
Record.readSourceLocation());
11711 C->setColonLoc(
Record.readSourceLocation());
11712 unsigned NumVars =
C->varlist_size();
11714 Vars.reserve(NumVars);
11715 for (
unsigned I = 0; I != NumVars; ++I)
11716 Vars.push_back(
Record.readSubExpr());
11717 C->setVarRefs(Vars);
11718 for (
unsigned I = 0, E =
C->getNumLoops(); I < E; ++I)
11719 C->setLoopData(I,
Record.readSubExpr());
11724 Record.readAttributes(Attrs);
11725 C->setAttrs(Attrs);
11726 C->setLocStart(
Record.readSourceLocation());
11727 C->setLParenLoc(
Record.readSourceLocation());
11728 C->setLocEnd(
Record.readSourceLocation());
11737 Set.Kind = readEnum<llvm::omp::TraitSet>();
11740 Selector.Kind = readEnum<llvm::omp::TraitSelector>();
11741 Selector.ScoreOrCondition =
nullptr;
11743 Selector.ScoreOrCondition = readExprRef();
11746 Property.Kind = readEnum<llvm::omp::TraitProperty>();
11755 if (Reader->ReadingKind == ASTReader::Read_Stmt) {
11760 for (
unsigned I = 0, E =
Data->getNumClauses(); I < E; ++I)
11762 Data->setClauses(Clauses);
11763 if (
Data->hasAssociatedStmt())
11765 for (
unsigned I = 0, E =
Data->getNumChildren(); I < E; ++I)
11770 unsigned NumVars =
readInt();
11772 for (
unsigned I = 0; I < NumVars; ++I)
11778 unsigned NumExprs =
readInt();
11780 for (
unsigned I = 0; I < NumExprs; ++I)
11790 switch (ClauseKind) {
11811 unsigned NumClauses =
readInt();
11813 for (
unsigned I = 0; I < NumClauses; ++I)
11872 LParenLoc, VarList, EndLoc);
11881 LParenLoc, IsReadOnly, VarList, EndLoc);
11890 LParenLoc, IsZero, VarList, EndLoc);
11899 LParenLoc, IsZero, VarList, EndLoc);
11905 AsyncExpr, EndLoc);
11913 DevNumExpr, QueuesLoc, QueueIdExprs,
11920 unsigned NumArchs =
readInt();
11922 for (
unsigned I = 0; I < NumArchs; ++I) {
11925 Archs.emplace_back(Ident,
Loc);
11929 LParenLoc, Archs, EndLoc);
11961 llvm_unreachable(
"Clause serialization not yet implemented");
11963 llvm_unreachable(
"Invalid Clause Kind");
11968 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 bool checkModuleCachePath(llvm::vfs::FileSystem &VFS, StringRef SpecificModuleCachePath, StringRef ExistingModuleCachePath, DiagnosticsEngine *Diags, const LangOptions &LangOpts, const PreprocessorOptions &PPOpts)
Check that the specified and the existing module cache paths are equivalent.
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 checkDiagnosticMappings(DiagnosticsEngine &StoredDiags, DiagnosticsEngine &Diags, bool IsSystem, bool SystemHeaderWarningsInModule, bool Complain)
static void updateModuleTimestamp(ModuleFile &MF)
static void collectMacroDefinitions(const PreprocessorOptions &PPOpts, MacroDefinitionsMap &Macros, SmallVectorImpl< StringRef > *MacroNames=nullptr)
Collect the macro definitions provided by the given preprocessor options.
static bool checkPreprocessorOptions(const PreprocessorOptions &PPOpts, const PreprocessorOptions &ExistingPPOpts, 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 std::pair< unsigned, unsigned > readULEBKeyDataLength(const unsigned char *&P)
Read ULEB-encoded key length and data length.
static bool checkDiagnosticGroupMappings(DiagnosticsEngine &StoredDiags, DiagnosticsEngine &Diags, bool Complain)
static Module * getTopImportImplicitModule(ModuleManager &ModuleMgr, Preprocessor &PP)
Return the top import module if it is implicit, nullptr otherwise.
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 Decl * getPredefinedDecl(ASTContext &Context, PredefinedDeclIDs ID)
static void markIdentifierFromAST(ASTReader &Reader, IdentifierInfo &II)
static void addMethodsToPool(Sema &S, ArrayRef< ObjCMethodDecl * > Methods, ObjCMethodList &List)
Add the given set of methods to the method list.
static bool readBit(unsigned &Bits)
static std::optional< Type::TypeClass > getTypeClassForCode(TypeCode code)
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, DiagnosticsEngine *Diags, bool AllowCompatibleDifferences=true)
Compare the given set of target options against an existing set of target options.
#define CHECK_TARGET_OPT(Field, Name)
static bool checkLanguageOptions(const LangOptions &LangOpts, const LangOptions &ExistingLangOpts, DiagnosticsEngine *Diags, bool AllowCompatibleDifferences=true)
Compare the given set of language options against an existing set of language options.
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 uint64_t readULEB(const unsigned char *&P)
static StringRef bytes(const std::vector< T, Allocator > &v)
Defines the Diagnostic-related interfaces.
static void dump(llvm::raw_ostream &OS, StringRef FunctionName, ArrayRef< CounterExpression > Expressions, ArrayRef< CounterMappingRegion > Regions)
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Defines the C++ template declaration subclasses.
Defines the ExceptionSpecificationType enumeration and various utility functions.
Defines the clang::Expr interface and subclasses for C++ expressions.
Defines the clang::FileManager interface and associated types.
Defines the clang::FileSystemOptions interface.
llvm::DenseSet< const void * > Visited
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
static const Decl * getCanonicalDecl(const Decl *D)
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines the clang::LangOptions interface.
static DiagnosticBuilder Diag(DiagnosticsEngine *Diags, const LangOptions &Features, FullSourceLoc TokLoc, const char *TokBegin, const char *TokRangeBegin, const char *TokRangeEnd, unsigned DiagID)
Produce a diagnostic highlighting some portion of a literal.
llvm::MachO::FileType FileType
llvm::MachO::Record Record
Defines the clang::MacroInfo and clang::MacroDirective classes.
Defines the clang::Module class, which describes a module in the source code.
Defines types useful for describing an Objective-C runtime.
Defines some OpenACC-specific enums and functions.
This file defines OpenMP AST classes for clauses.
Defines some OpenMP-specific enums and functions.
Defines an enumeration for C++ overloaded operators.
static ParseState advance(ParseState S, size_t N)
Defines the clang::Preprocessor interface.
static std::string getName(const CallEvent &Call)
Defines the clang::SanitizerKind enum.
This file declares semantic analysis for CUDA constructs.
This file declares semantic analysis for Objective-C.
Defines the clang::SourceLocation class and associated facilities.
Defines implementation details of the clang::SourceManager class.
Defines the SourceManager interface.
Defines various enumerations that describe declaration and type specifiers.
Defines the clang::TargetOptions class.
Defines the clang::TokenKind enum and support functions.
Defines the clang::TypeLoc interface and its subclasses.
C Language Family Type Representation.
Defines version macros and version-related utility functions for Clang.
__DEVICE__ int max(int __a, int __b)
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
CanQualType ARCUnbridgedCastTy
TypedefDecl * getObjCClassDecl() const
Retrieve the typedef declaration corresponding to the predefined Objective-C 'Class' type.
TypedefDecl * getCFConstantStringDecl() const
CanQualType SatUnsignedFractTy
BuiltinTemplateDecl * getMakeIntegerSeqDecl() const
ExternCContextDecl * getExternCContextDecl() const
TypedefDecl * getObjCSelDecl() const
Retrieve the typedef corresponding to the predefined 'SEL' type in Objective-C.
CanQualType UnsignedShortAccumTy
TypedefDecl * getObjCInstanceTypeDecl()
Retrieve the typedef declaration corresponding to the Objective-C "instancetype" type.
QualType getAutoRRefDeductType() const
C++11 deduction pattern for 'auto &&' type.
TypedefDecl * getBuiltinMSVaListDecl() const
Retrieve the C type declaration corresponding to the predefined __builtin_ms_va_list type.
TypedefDecl * getObjCIdDecl() const
Retrieve the typedef corresponding to the predefined id type in Objective-C.
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.
void * Allocate(size_t Size, unsigned Align=8) const
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.
TagDecl * getMSGuidTagDecl() const
Retrieve the implicitly-predeclared 'struct _GUID' declaration.
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
CanQualType UnsignedIntTy
CanQualType UnsignedLongLongTy
CanQualType OCLReserveIDTy
CanQualType UnsignedShortTy
CanQualType SatUnsignedLongFractTy
void setcudaConfigureCallDecl(FunctionDecl *FD)
ASTMutationListener * getASTMutationListener() const
Retrieve a pointer to the AST mutation listener associated with this AST context, if any.
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)
TranslationUnitDecl * getTranslationUnitDecl() const
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 bool ReadHeaderSearchOptions(const HeaderSearchOptions &HSOpts, StringRef SpecificModuleCachePath, bool Complain)
Receives the header search options.
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, bool Complain, bool AllowCompatibleDifferences)
Receives the target options.
virtual bool visitInputFile(StringRef Filename, bool isSystem, bool isOverridden, bool isExplicitModule)
if needsInputFileVisitation returns true, this is called for each non-system input file of the AST Fi...
virtual bool ReadHeaderSearchPaths(const HeaderSearchOptions &HSOpts, bool Complain)
Receives the header search paths.
virtual bool ReadFileSystemOptions(const FileSystemOptions &FSOpts, bool Complain)
Receives the file system options.
virtual ~ASTReaderListener()
virtual bool ReadDiagnosticOptions(IntrusiveRefCntPtr< DiagnosticOptions > DiagOpts, bool Complain)
Receives the diagnostic options.
virtual void readModuleFileExtension(const ModuleFileExtensionMetadata &Metadata)
Indicates that a particular module file extension has been read.
virtual bool ReadLanguageOptions(const LangOptions &LangOpts, bool Complain, bool AllowCompatibleDifferences)
Receives the language options.
virtual void visitImport(StringRef ModuleName, StringRef Filename)
If needsImportVisitation returns true, this is called for each AST file imported by this AST file.
virtual void visitModuleFile(StringRef Filename, serialization::ModuleKind Kind)
This is called for each AST file loaded.
virtual bool needsImportVisitation() const
Returns true if this ASTReaderListener wants to receive the imports of the AST file via visitImport,...
virtual bool ReadFullVersionInformation(StringRef FullVersion)
Receives the full Clang version information.
virtual void ReadCounter(const serialization::ModuleFile &M, unsigned Value)
Receives COUNTER value.
virtual void ReadModuleName(StringRef ModuleName)
virtual bool needsSystemInputFileVisitation()
Returns true if this ASTReaderListener wants to receive the system input files of the AST file via vi...
virtual bool ReadPreprocessorOptions(const PreprocessorOptions &PPOpts, bool ReadMacros, bool Complain, std::string &SuggestedPredefines)
Receives the preprocessor options.
Reads an AST files chain containing the contents of a translation unit.
std::optional< bool > isPreprocessedEntityInFileID(unsigned Index, FileID FID) override
Optionally returns true or false if the preallocated preprocessed entity with index Index came from f...
SourceManager & getSourceManager() const
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.
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.
void ReadMismatchingDeleteExpressions(llvm::MapVector< FieldDecl *, llvm::SmallVector< std::pair< SourceLocation, bool >, 4 >> &Exprs) override
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 FindFileRegionDecls(FileID File, unsigned Offset, unsigned Length, SmallVectorImpl< Decl * > &Decls) override
Get the decls that are contained in a file in the Offset/Length range.
SourceRange ReadSkippedRange(unsigned Index) override
Read a preallocated skipped range from the external source.
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.
void dump()
Dump information about the AST reader to standard error.
serialization::IdentifierID getGlobalIdentifierID(ModuleFile &M, unsigned LocalID)
void AssignedLambdaNumbering(const CXXRecordDecl *Lambda) override
Notify the external source that a lambda was assigned a mangling number.
MacroInfo * ReadMacroRecord(ModuleFile &F, uint64_t Offset)
Reads the macro record located at the given offset.
SmallVector< std::pair< llvm::BitstreamCursor, serialization::ModuleFile * >, 8 > CommentsCursors
Cursors for comments blocks.
Selector getLocalSelector(ModuleFile &M, unsigned LocalID)
Retrieve a selector from the given module with its local ID number.
void FindExternalLexicalDecls(const DeclContext *DC, llvm::function_ref< bool(Decl::Kind)> IsKindWeWant, SmallVectorImpl< Decl * > &Decls) override
Read all of the declarations lexically stored in a declaration context.
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.
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.
void SetIdentifierInfo(unsigned ID, IdentifierInfo *II)
bool loadGlobalIndex()
Attempts to load the global index.
void ReadComments() override
Loads comments ranges.
SourceLocation getSourceLocationForDeclID(GlobalDeclID ID)
Returns the source location for the decl ID.
void makeModuleVisible(Module *Mod, Module::NameVisibilityKind NameVisibility, SourceLocation ImportLoc)
Make the entities in the given module and any of its (non-explicit) submodules visible to name lookup...
void finalizeForWriting()
Finalizes the AST reader's state before writing an AST file to disk.
void ReadPendingInstantiations(SmallVectorImpl< std::pair< ValueDecl *, SourceLocation >> &Pending) override
Decl * GetLocalDecl(ModuleFile &F, LocalDeclID LocalID)
Reads a declaration with the given local ID in the given module.
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.
llvm::Expected< SourceLocation::UIntTy > readSLocOffset(ModuleFile *F, unsigned Index)
Try to read the offset of the SLocEntry at the given index in the given module file.
void CompleteRedeclChain(const Decl *D) override
If any redeclarations of D have been imported since it was last checked, this digs out those redeclar...
void ReadLateParsedTemplates(llvm::MapVector< const FunctionDecl *, std::unique_ptr< LateParsedTemplate >> &LPTMap) override
Read the set of late parsed template functions for this source.
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.
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.
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)
GlobalDeclID ReadDeclID(ModuleFile &F, const RecordData &Record, unsigned &Idx)
Reads a declaration ID from the given position in a record in the given module.
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 completeVisibleDeclsMap(const DeclContext *DC) override
Load all external visible decls in the given DeclContext.
void ReadUnusedLocalTypedefNameCandidates(llvm::SmallSetVector< const TypedefNameDecl *, 4 > &Decls) override
Read the set of potentially unused typedefs known to the source.
IdentifierResolver & getIdResolver()
Get the identifier resolver used for name lookup / updates in the translation unit scope.
static bool readASTFileControlBlock(StringRef Filename, FileManager &FileMgr, const InMemoryModuleCache &ModuleCache, const PCHContainerReader &PCHContainerRdr, bool FindModuleFileExtensions, ASTReaderListener &Listener, bool ValidateDiagnosticOptions, unsigned ClientLoadCapabilities=ARR_ConfigurationMismatch|ARR_OutOfDate)
Read the control block for the named AST file.
void ReadExtVectorDecls(SmallVectorImpl< TypedefNameDecl * > &Decls) override
Read the set of ext_vector type declarations known to the external Sema source.
void ResolveImportedPath(ModuleFile &M, std::string &Filename)
If we are loading a relocatable PCH or module file, and the filename is not an absolute path,...
Preprocessor & getPreprocessor() const
Retrieve the preprocessor.
ModuleFile * getOwningModuleFile(const Decl *D)
Retrieve the module file that owns the given declaration, or NULL if the declaration is not from a mo...
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.
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.
IdentifierIterator * getIdentifiers() override
Retrieve an iterator into the set of all identifiers in all loaded AST files.
void ReadUsedVTables(SmallVectorImpl< ExternalVTableUse > &VTables) override
Read the set of used vtables known to the external Sema source.
bool isGlobalIndexUnavailable() const
Determine whether we tried to load the global index, but failed, e.g., because it is out-of-date or d...
uint32_t GetNumExternalSelectors() override
Returns the number of selectors known to the external AST source.
void updateOutOfDateSelector(Selector Sel) override
Load the contents of the global method pool for a given selector if necessary.
void ReadWeakUndeclaredIdentifiers(SmallVectorImpl< std::pair< IdentifierInfo *, WeakInfo >> &WeakIDs) override
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 ReadReferencedSelectors(SmallVectorImpl< std::pair< Selector, SourceLocation >> &Sels) override
IdentifierInfo * getLocalIdentifier(ModuleFile &M, unsigned LocalID)
void ReadPragmaDiagnosticMappings(DiagnosticsEngine &Diag)
Sema * getSema()
Retrieve the semantic analysis object used to analyze the translation unit in which the precompiled h...
void makeNamesVisible(const HiddenNames &Names, Module *Owner)
Make the names within this set of hidden names visible.
void UpdateSema()
Update the state of Sema after loading some additional modules.
Decl * GetDecl(GlobalDeclID ID)
Resolve a declaration ID into a declaration, potentially building a new declaration.
int getSLocEntryID(SourceLocation::UIntTy SLocOffset) override
Get the index ID for the loaded SourceLocation offset.
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...
ModuleManager & getModuleManager()
Retrieve the module manager.
QualType getLocalType(ModuleFile &F, unsigned LocalID)
Resolve a local type ID within a given AST file into a type.
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.
ASTContext & getContext()
Retrieve the AST context that this AST reader supplements.
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.
serialization::TypeID getGlobalTypeID(ModuleFile &F, unsigned LocalID) const
Map a local type ID within a given AST file into a global type ID.
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.
Expr * readExpr()
Reads an expression.
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.
ASTContext & getContext()
Retrieve the AST context that this AST reader supplements.
Expr * readSubExpr()
Reads a sub-expression operand during statement reading.
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)
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.
const ASTTemplateArgumentListInfo * readASTTemplateArgumentListInfo()
Stmt * readStmt()
Reads a statement.
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.
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.
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().
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 ReadFileSystemOptions(const FileSystemOptions &FSOpts, bool Complain) override
Receives the file system options.
bool ReadPreprocessorOptions(const PreprocessorOptions &PPOpts, bool ReadMacros, bool Complain, std::string &SuggestedPredefines) override
Receives the preprocessor options.
void ReadCounter(const serialization::ModuleFile &M, unsigned Value) override
Receives COUNTER value.
void ReadModuleMapFile(StringRef ModuleMapPath) override
bool ReadHeaderSearchOptions(const HeaderSearchOptions &HSOpts, StringRef SpecificModuleCachePath, bool Complain) override
Receives the header search options.
bool ReadTargetOptions(const TargetOptions &TargetOpts, 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 ReadLanguageOptions(const LangOptions &LangOpts, bool Complain, bool AllowCompatibleDifferences) override
Receives the language options.
void readModuleFileExtension(const ModuleFileExtensionMetadata &Metadata) override
Indicates that a particular module file extension has been read.
bool ReadDiagnosticOptions(IntrusiveRefCntPtr< DiagnosticOptions > DiagOpts, bool Complain) override
Receives the diagnostic options.
void visitModuleFile(StringRef Filename, serialization::ModuleKind Kind) override
This is called for each AST file loaded.
bool needsSystemInputFileVisitation() override
Returns true if this ASTReaderListener wants to receive the system input files of the AST file via vi...
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
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 - This represents one declaration (or definition), e.g.
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
void setInvalidDecl(bool Invalid=true)
setInvalidDecl - Indicates the Decl had a semantic error.
bool isUnconditionallyVisible() const
Determine whether this declaration is definitely visible to name lookup, independent of whether the o...
Kind
Lists the kind of concrete classes of Decl.
GlobalDeclID getGlobalID() const
Retrieve the global declaration ID associated with this declaration, which specifies where this Decl ...
bool isFromASTFile() const
Determine whether this declaration came from an AST file (such as a precompiled header or module) rat...
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
SourceLocation getLocation() const
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC).
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl.
Module * getImportedOwningModule() const
Get the imported owning module, if this decl is from an imported (non-local) module.
DeclContext * getDeclContext()
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.
PartialDiagnosticAt & getDiagnostic()
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-header-in-module=...
Concrete class used by the front-end to report problems and issues.
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.
const IntrusiveRefCntPtr< DiagnosticIDs > & getDiagnosticIDs() const
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
StringRef getName() const
void setElaboratedKeywordLoc(SourceLocation Loc)
void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
Wrapper for source info for enum types.
This represents one expression.
RAII class for safely pairing a StartedDeserializing call with FinishedDeserializing.
MemoryBufferSizes getMemoryBufferSizes() const
Return the amount of memory used by memory buffers, breaking down by heap-backed versus mmap'ed memor...
uint32_t getGeneration() const
Get the current generation of this AST source.
Represents difference between two FPOptions values.
static FPOptionsOverride getFromOpaqueInt(storage_type I)
FPOptions applyOverrides(FPOptions Base)
static FPOptions getFromOpaqueInt(storage_type Value)
Represents a member of a struct/union/class.
A reference to a FileEntry that includes the name of the file as it was accessed by the FileManager's...
time_t getModificationTime() const
StringRef getName() const
The name of this FileEntry.
Cached information about one file (either on disk or in the virtual file system).
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
Implements support for file system lookup, file system caching, and directory search management.
OptionalFileEntryRef getOptionalFileRef(StringRef Filename, bool OpenFile=false, bool CacheFailure=true)
Get a FileEntryRef if it exists, without doing anything on error.
llvm::ErrorOr< std::unique_ptr< llvm::MemoryBuffer > > getBufferForFile(FileEntryRef Entry, bool isVolatile=false, bool RequiresNullTerminator=true)
Open the specified file as a MemoryBuffer, returning a new MemoryBuffer if successful,...
llvm::vfs::FileSystem & getVirtualFileSystem() const
FileEntryRef getVirtualFileRef(StringRef Filename, off_t Size, time_t ModificationTime)
Retrieve a file entry for a "virtual" file that acts as if there were a file with the given name on d...
llvm::ErrorOr< const FileEntry * > getFile(StringRef Filename, bool OpenFile=false, bool CacheFailure=true)
Lookup, cache, and verify the specified file (real or virtual).
Keeps track of options that affect how file operations are performed.
std::string WorkingDir
If set, paths are resolved as if the working directory was set to the value of WorkingDir.
Represents a function declaration or definition.
void setLazyBody(uint64_t Offset)
Represents a prototype with parameter type info, e.g.
ExtProtoInfo getExtProtoInfo() const
Wrapper for source info for functions.
unsigned getNumParams() const
void setLocalRangeBegin(SourceLocation L)
void setLParenLoc(SourceLocation Loc)
void setParam(unsigned i, ParmVarDecl *VD)
void setRParenLoc(SourceLocation Loc)
void setLocalRangeEnd(SourceLocation L)
void setExceptionSpecRange(SourceRange R)
static std::pair< GlobalModuleIndex *, llvm::Error > readIndex(llvm::StringRef Path)
Read a global index file for the given directory.
One of these records is kept for each identifier that is lexed.
unsigned getBuiltinID() const
Return a value indicating whether this is a builtin function.
bool isCPlusPlusOperatorKeyword() const
tok::TokenKind getTokenID() const
If this is a source-language token (e.g.
bool hadMacroDefinition() const
Returns true if this identifier was #defined to some value at any moment.
void setIsPoisoned(bool Value=true)
setIsPoisoned - Mark this identifier as poisoned.
bool isFromAST() const
Return true if the identifier in its current state was loaded from an AST file.
bool isPoisoned() const
Return true if this token has been poisoned.
bool hasRevertedTokenIDToIdentifier() const
True if revertTokenIDToIdentifier() was called.
tok::NotableIdentifierKind getNotableIdentifierID() const
void setOutOfDate(bool OOD)
Set whether the information for this identifier is out of date with respect to the external source.
tok::ObjCKeywordKind getObjCKeywordID() const
Return the Objective-C keyword ID for the this identifier.
void setObjCOrBuiltinID(unsigned ID)
void revertTokenIDToIdentifier()
Revert TokenID to tok::identifier; used for GNU libstdc++ 4.2 compatibility.
bool isOutOfDate() const
Determine whether the information for this identifier is out of date with respect to the external sou...
void setChangedSinceDeserialization()
Note that this identifier has changed since it was loaded from an AST file.
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.
void * getFETokenInfo() const
Get and set FETokenInfo.
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...
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.
void setIsFunctionLike()
Function/Object-likeness.
llvm::MutableArrayRef< Token > allocateTokens(unsigned NumTokens, llvm::BumpPtrAllocator &PPAllocator)
void setIsC99Varargs()
Varargs querying methods. This can only be set for function-like macros.
void setIsUsed(bool Val)
Set the value of the IsUsed flag.
void setExpansionLoc(SourceLocation Loc)
void setAttrRowOperand(Expr *e)
void setAttrColumnOperand(Expr *e)
void setAttrOperandParensRange(SourceRange range)
void setAttrNameLoc(SourceLocation loc)
Wrapper for source info for member pointers.
void setStarLoc(SourceLocation Loc)
void setClassTInfo(TypeSourceInfo *TI)
void addLinkAsDependency(Module *Mod)
Make module to use export_as as the link dependency name if enough information is available or add it...
std::pair< Module *, bool > findOrCreateModule(StringRef Name, Module *Parent, bool IsFramework, bool IsExplicit)
Find a new module or submodule, or create it if it does not already exist.
void setUmbrellaDirAsWritten(Module *Mod, DirectoryEntryRef UmbrellaDir, const Twine &NameAsWritten, const Twine &PathRelativeToRootModuleDirectory)
Sets the umbrella directory of the given module to the given directory.
void setUmbrellaHeaderAsWritten(Module *Mod, FileEntryRef UmbrellaHeader, const Twine &NameAsWritten, const Twine &PathRelativeToRootModuleDirectory)
Sets the umbrella header of the given module to the given header.
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.
SmallVector< Requirement, 2 > Requirements
The set of language features required to use this module.
OptionalDirectoryEntryRef Directory
The build directory of this module.
std::optional< DirectoryName > getUmbrellaDirAsWritten() const
Retrieve the umbrella directory as written.
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< Header > getUmbrellaHeaderAsWritten() const
Retrieve the umbrella header 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 '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 'shedule', 'firstprivate' etc.
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 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 '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 '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.
This represents 'num_threads' clause in the '#pragma omp ...' directive.
This represents 'order' clause in the '#pragma omp ...' directive.
This represents 'ordered' clause in the '#pragma omp ...' directive.
static OMPOrderedClause * CreateEmpty(const ASTContext &C, unsigned NumLoops)
Build an empty clause.
Representation of the 'partial' clause of the '#pragma omp unroll' directive.
static OMPPartialClause * CreateEmpty(const ASTContext &C)
Build an empty 'partial' AST node for deserialization.
This represents 'priority' clause in the '#pragma omp ...' directive.
This represents clause 'private' in the '#pragma omp ...' directives.
static OMPPrivateClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N variables.
This represents 'proc_bind' clause in the '#pragma omp ...' directive.
This represents 'read' clause in the '#pragma omp atomic' directive.
This represents clause 'reduction' in the '#pragma omp ...' directives.
static OMPReductionClause * CreateEmpty(const ASTContext &C, unsigned N, OpenMPReductionClauseModifier Modifier)
Creates an empty clause with the place for N variables.
This represents 'relaxed' clause in the '#pragma omp atomic' directives.
This represents 'release' clause in the '#pragma omp atomic|flush' directives.
This represents 'reverse_offload' clause in the '#pragma omp requires' directive.
This represents 'simd' clause in the '#pragma omp ...' directive.
This represents 'safelen' clause in the '#pragma omp ...' directive.
This represents 'schedule' clause in the '#pragma omp ...' directive.
This represents 'seq_cst' clause in the '#pragma omp atomic' directive.
This represents 'severity' clause in the '#pragma omp error' directive.
This represents clause 'shared' in the '#pragma omp ...' directives.
static OMPSharedClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with N variables.
This represents 'simdlen' clause in the '#pragma omp ...' directive.
This represents the 'sizes' clause in the '#pragma omp tile' directive.
static OMPSizesClause * CreateEmpty(const ASTContext &C, unsigned NumSizes)
Build an empty 'sizes' AST node for deserialization.
This represents clause 'task_reduction' in the '#pragma omp taskgroup' directives.
static OMPTaskReductionClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N variables.
This represents 'thread_limit' clause in the '#pragma omp ...' directive.
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)
This is the base type for all OpenACC Clauses.
static OpenACCCopyClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCopyInClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, bool IsReadOnly, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCopyOutClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, bool IsZero, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCreateClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, bool IsZero, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDefaultClause * Create(const ASTContext &C, OpenACCDefaultClauseKind K, SourceLocation BeginLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
static OpenACCDevicePtrClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDeviceTypeClause * Create(const ASTContext &C, OpenACCClauseKind K, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< DeviceTypeArgument > Archs, SourceLocation EndLoc)
static OpenACCFirstPrivateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCIfClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *ConditionExpr, SourceLocation EndLoc)
static 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 OpenACCVectorLengthClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCWaitClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *DevNumExpr, SourceLocation QueuesLoc, ArrayRef< Expr * > QueueIdExprs, SourceLocation EndLoc)
This abstract interface provides operations for unwrapping containers for serialized ASTs (precompile...
virtual llvm::StringRef ExtractPCH(llvm::MemoryBufferRef Buffer) const =0
Returns the serialized AST inside the PCH container Buffer.
ASTReaderListener implementation to validate the information of the PCH file against an initialized P...
bool ReadTargetOptions(const TargetOptions &TargetOpts, bool Complain, bool AllowCompatibleDifferences) override
Receives the target options.
void ReadCounter(const serialization::ModuleFile &M, unsigned Value) override
Receives COUNTER value.
bool ReadPreprocessorOptions(const PreprocessorOptions &PPOpts, bool ReadMacros, bool Complain, std::string &SuggestedPredefines) override
Receives the preprocessor options.
bool ReadHeaderSearchOptions(const HeaderSearchOptions &HSOpts, StringRef SpecificModuleCachePath, bool Complain) override
Receives the header search options.
bool ReadLanguageOptions(const LangOptions &LangOpts, bool Complain, bool AllowCompatibleDifferences) override
Receives the language options.
bool ReadDiagnosticOptions(IntrusiveRefCntPtr< DiagnosticOptions > DiagOpts, bool Complain) override
Receives the diagnostic 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.
HeaderSearch & getHeaderSearchInfo() const
IdentifierTable & getIdentifierTable()
Module * getCurrentModule()
Retrieves the module that we're currently building, if any.
const LangOptions & getLangOpts() const
A (possibly-)qualified type.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
Wrapper of type source information for a type with non-trivial direct qualifiers.
The collection of all-type qualifiers we support.
@ FastWidth
The width of the "fast" qualifier mask.
@ FastMask
The fast qualifier mask.
void setAmpAmpLoc(SourceLocation Loc)
Represents a struct/union/class.
Wrapper for source info for record types.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
This table allows us to fully hide how we implement multi-keyword caching.
Selector getNullarySelector(const IdentifierInfo *ID)
Selector getSelector(unsigned NumArgs, const IdentifierInfo **IIV)
Can create any sort of selector.
Selector getUnarySelector(const IdentifierInfo *ID)
Smart pointer class that efficiently represents Objective-C method names.
iterator find(Selector Sel)
llvm::DenseMap< Selector, Lists >::iterator iterator
std::pair< ObjCMethodList, ObjCMethodList > Lists
std::pair< iterator, bool > insert(std::pair< Selector, Lists > &&Val)
void addMethodToGlobalList(ObjCMethodList *List, ObjCMethodDecl *Method)
Add the given method to the list of globally-known methods.
GlobalMethodPool MethodPool
Method Pool - allows efficient lookup when typechecking messages to "id".
Sema - This implements semantic analysis and AST building for C.
Scope * TUScope
Translation Unit Scope - useful to Objective-C actions that need to lookup file scope declarations in...
void addExternalSource(ExternalSemaSource *E)
Registers an external source.
IdentifierResolver IdResolver
ASTReaderListenter implementation to set SuggestedPredefines of ASTReader which is required to use a ...
bool ReadPreprocessorOptions(const PreprocessorOptions &PPOpts, 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)
bool isBeforeInTranslationUnit(SourceLocation LHS, SourceLocation RHS) const
Determines the order of 2 source locations in the translation unit.
std::pair< FileID, unsigned > getDecomposedLoc(SourceLocation Loc) const
Decompose the specified location into a raw FileID + Offset pair.
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.
std::optional< llvm::MemoryBufferRef > getBufferIfLoaded() const
Return the buffer, only if it has been loaded.
OptionalFileEntryRef ContentsEntry
References the file which the contents were actually loaded from.
unsigned BufferOverridden
Indicates whether the buffer itself was provided to override the actual file contents.
OptionalFileEntryRef OrigEntry
Reference to the file entry representing this ContentCache.
Information about a FileID, basically just the logical file that it represents and include stack info...
void setHasLineDirectives()
Set the flag that indicates that this FileID has line table entries associated with it.
Stmt - This represents one statement.
DiagnosticStorage * getStorage() const
Retrieve storage for this particular diagnostic.
Wrapper for substituted template type parameters.
Wrapper for substituted template type parameters.
Represents the declaration of a struct/union/class/enum.
TagDecl * getDecl() const
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.
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.
Expr * getAsExpr() const
Retrieve the template argument as an expression.
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.
serialization::DeclID BaseDeclID
Base declaration ID for declarations local to this module.
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.
ContinuousRangeMap< uint32_t, int, 2 > TypeRemap
Remapping table for type IDs in this module.
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.
ContinuousRangeMap< uint32_t, int, 2 > IdentifierRemap
Remapping table for identifier IDs in this module.
const LocalDeclID * FileSortedDecls
Array of file-level DeclIDs sorted by 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 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 NumUserInputFiles
llvm::BitstreamCursor Stream
The main bitstream cursor for the main block.
serialization::SubmoduleID BaseSubmoduleID
Base submodule ID for submodules local to this module.
uint64_t SizeInBits
The size of this file, in bits.
const UnalignedUInt64 * TypeOffsets
Offset of each type within the bitstream, indexed by the type ID, or the representation of a Type*.
uint64_t GlobalBitOffset
The global bit offset (or base) of this module.
bool StandardCXXModule
Whether this module file is a standard C++ module.
unsigned LocalNumTypes
The number of types in this AST file.
StringRef ModuleOffsetMap
The module offset map data for this file.
const PPSkippedRange * PreprocessedSkippedRangeOffsets
std::string FileName
The file name of the module file.
uint64_t InputFilesValidationTimestamp
If non-zero, specifies the time when we last validated input files.
llvm::BitstreamCursor PreprocessorDetailCursor
The cursor to the start of the (optional) detailed preprocessing record block.
SourceLocation::UIntTy SLocEntryBaseOffset
The base offset in the source manager's view of this module.
std::string ModuleMapPath
const DeclOffset * DeclOffsets
Offset of each declaration within the bitstream, indexed by the declaration ID (-1).
std::string getTimestampFilename() const
uint64_t MacroStartOffset
The offset of the start of the set of defined macros.
ASTFileSignature Signature
The signature of the module file, which may be used instead of the size and modification time to iden...
unsigned LocalNumMacros
The number of macros in this AST file.
ContinuousRangeMap< serialization::DeclID, int, 2 > DeclRemap
Remapping table for declaration IDs in this module.
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.
llvm::DenseMap< ModuleFile *, serialization::DeclID > GlobalToLocalDeclIDs
Mapping from the module files that this module file depends on to the base declaration ID for that mo...
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.
ModuleReverseIterator rbegin()
Reverse iterator to traverse all loaded modules.
llvm::iterator_range< SmallVectorImpl< ModuleFile * >::const_iterator > pch_modules() const
A range covering the PCH and preamble module files loaded.
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 * > getFactoryMethods() const
Retrieve the instance methods found by this visitor.
bool instanceHasMoreThanOneDecl() const
bool operator()(ModuleFile &M)
ArrayRef< ObjCMethodDecl * > getInstanceMethods() const
Retrieve the instance methods found by this visitor.
bool factoryHasMoreThanOneDecl() const
unsigned getInstanceBits() const
static TypeIdx fromTypeID(TypeID ID)
32 aligned uint64_t in the AST file.
static std::pair< unsigned, unsigned > ReadKeyDataLength(const unsigned char *&d)
static hash_value_type ComputeHash(const internal_key_type &a)
StringRef internal_key_type
static internal_key_type ReadKey(const unsigned char *d, unsigned n)
Class that performs lookup for an identifier stored in an AST file.
IdentifierID ReadIdentifierID(const unsigned char *d)
data_type ReadData(const internal_key_type &k, const unsigned char *d, unsigned DataLen)
Class that performs lookup for a selector's entries in the global method pool stored in an AST file.
internal_key_type ReadKey(const unsigned char *d, unsigned)
data_type ReadData(Selector, const unsigned char *d, unsigned DataLen)
static std::pair< unsigned, unsigned > ReadKeyDataLength(const unsigned char *&d)
static hash_value_type ComputeHash(Selector Sel)
PredefinedTypeIDs
Predefined type IDs.
CtorInitializerType
The different kinds of data that can occur in a CtorInitializer.
const unsigned NUM_PREDEF_TYPE_IDS
The number of predefined type IDs that are reserved for the PREDEF_TYPE_* constants.
const unsigned NumSpecialTypeIDs
The number of special type IDs.
TypeCode
Record codes for each kind of type.
@ PREDEF_TYPE_LONG_ACCUM_ID
The 'long _Accum' type.
@ PREDEF_TYPE_SAMPLER_ID
OpenCL sampler type.
@ PREDEF_TYPE_INT128_ID
The '__int128_t' type.
@ PREDEF_TYPE_CHAR32_ID
The C++ 'char32_t' type.
@ PREDEF_TYPE_SAT_SHORT_ACCUM_ID
The '_Sat short _Accum' type.
@ PREDEF_TYPE_IBM128_ID
The '__ibm128' type.
@ PREDEF_TYPE_SHORT_FRACT_ID
The 'short _Fract' type.
@ PREDEF_TYPE_AUTO_RREF_DEDUCT
The "auto &&" deduction type.
@ PREDEF_TYPE_BOUND_MEMBER
The placeholder type for bound member functions.
@ PREDEF_TYPE_LONGLONG_ID
The (signed) 'long long' type.
@ PREDEF_TYPE_FRACT_ID
The '_Fract' type.
@ PREDEF_TYPE_ARC_UNBRIDGED_CAST
ARC's unbridged-cast placeholder type.
@ PREDEF_TYPE_USHORT_FRACT_ID
The 'unsigned short _Fract' type.
@ PREDEF_TYPE_SAT_ULONG_FRACT_ID
The '_Sat unsigned long _Fract' type.
@ PREDEF_TYPE_BOOL_ID
The 'bool' or '_Bool' type.
@ PREDEF_TYPE_SAT_LONG_ACCUM_ID
The '_Sat long _Accum' type.
@ PREDEF_TYPE_SAT_LONG_FRACT_ID
The '_Sat long _Fract' type.
@ PREDEF_TYPE_SAT_SHORT_FRACT_ID
The '_Sat short _Fract' type.
@ PREDEF_TYPE_CHAR_U_ID
The 'char' type, when it is unsigned.
@ PREDEF_TYPE_RESERVE_ID_ID
OpenCL reserve_id type.
@ PREDEF_TYPE_SAT_ACCUM_ID
The '_Sat _Accum' type.
@ PREDEF_TYPE_BUILTIN_FN
The placeholder type for builtin functions.
@ PREDEF_TYPE_SHORT_ACCUM_ID
The 'short _Accum' type.
@ PREDEF_TYPE_FLOAT_ID
The 'float' type.
@ PREDEF_TYPE_QUEUE_ID
OpenCL queue type.
@ PREDEF_TYPE_INT_ID
The (signed) 'int' type.
@ PREDEF_TYPE_OBJC_SEL
The ObjC 'SEL' type.
@ PREDEF_TYPE_BFLOAT16_ID
The '__bf16' type.
@ PREDEF_TYPE_WCHAR_ID
The C++ 'wchar_t' type.
@ PREDEF_TYPE_UCHAR_ID
The 'unsigned char' type.
@ PREDEF_TYPE_UACCUM_ID
The 'unsigned _Accum' type.
@ PREDEF_TYPE_SCHAR_ID
The 'signed char' type.
@ PREDEF_TYPE_CHAR_S_ID
The 'char' type, when it is signed.
@ PREDEF_TYPE_NULLPTR_ID
The type of 'nullptr'.
@ PREDEF_TYPE_ULONG_FRACT_ID
The 'unsigned long _Fract' type.
@ PREDEF_TYPE_FLOAT16_ID
The '_Float16' type.
@ PREDEF_TYPE_UINT_ID
The 'unsigned int' type.
@ PREDEF_TYPE_FLOAT128_ID
The '__float128' type.
@ PREDEF_TYPE_OBJC_ID
The ObjC 'id' type.
@ PREDEF_TYPE_CHAR16_ID
The C++ 'char16_t' type.
@ PREDEF_TYPE_ARRAY_SECTION
The placeholder type for an array section.
@ PREDEF_TYPE_ULONGLONG_ID
The 'unsigned long long' type.
@ PREDEF_TYPE_SAT_UFRACT_ID
The '_Sat unsigned _Fract' type.
@ PREDEF_TYPE_USHORT_ID
The 'unsigned short' type.
@ PREDEF_TYPE_SHORT_ID
The (signed) 'short' type.
@ PREDEF_TYPE_OMP_ARRAY_SHAPING
The placeholder type for OpenMP array shaping operation.
@ PREDEF_TYPE_DEPENDENT_ID
The placeholder type for dependent types.
@ PREDEF_TYPE_LONGDOUBLE_ID
The 'long double' type.
@ PREDEF_TYPE_DOUBLE_ID
The 'double' type.
@ PREDEF_TYPE_UINT128_ID
The '__uint128_t' type.
@ PREDEF_TYPE_HALF_ID
The OpenCL 'half' / ARM NEON __fp16 type.
@ PREDEF_TYPE_VOID_ID
The void type.
@ PREDEF_TYPE_SAT_USHORT_FRACT_ID
The '_Sat unsigned short _Fract' type.
@ PREDEF_TYPE_ACCUM_ID
The '_Accum' type.
@ PREDEF_TYPE_SAT_FRACT_ID
The '_Sat _Fract' type.
@ PREDEF_TYPE_NULL_ID
The NULL type.
@ PREDEF_TYPE_USHORT_ACCUM_ID
The 'unsigned short _Accum' type.
@ PREDEF_TYPE_CHAR8_ID
The C++ 'char8_t' type.
@ PREDEF_TYPE_UFRACT_ID
The 'unsigned _Fract' type.
@ PREDEF_TYPE_OVERLOAD_ID
The placeholder type for overloaded function sets.
@ PREDEF_TYPE_INCOMPLETE_MATRIX_IDX
A placeholder type for incomplete matrix index operations.
@ PREDEF_TYPE_UNRESOLVED_TEMPLATE
The placeholder type for unresolved templates.
@ PREDEF_TYPE_SAT_USHORT_ACCUM_ID
The '_Sat unsigned short _Accum' type.
@ PREDEF_TYPE_LONG_ID
The (signed) 'long' type.
@ PREDEF_TYPE_SAT_ULONG_ACCUM_ID
The '_Sat unsigned long _Accum' type.
@ PREDEF_TYPE_LONG_FRACT_ID
The 'long _Fract' type.
@ PREDEF_TYPE_UNKNOWN_ANY
The 'unknown any' placeholder type.
@ PREDEF_TYPE_OMP_ITERATOR
The placeholder type for OpenMP iterator expression.
@ PREDEF_TYPE_PSEUDO_OBJECT
The pseudo-object placeholder type.
@ PREDEF_TYPE_OBJC_CLASS
The ObjC 'Class' type.
@ PREDEF_TYPE_ULONG_ID
The 'unsigned long' type.
@ PREDEF_TYPE_SAT_UACCUM_ID
The '_Sat unsigned _Accum' type.
@ PREDEF_TYPE_CLK_EVENT_ID
OpenCL clk event type.
@ PREDEF_TYPE_EVENT_ID
OpenCL event type.
@ PREDEF_TYPE_ULONG_ACCUM_ID
The 'unsigned long _Accum' type.
@ PREDEF_TYPE_AUTO_DEDUCT
The "auto" deduction type.
@ CTOR_INITIALIZER_MEMBER
@ CTOR_INITIALIZER_DELEGATING
@ CTOR_INITIALIZER_INDIRECT_MEMBER
@ DECL_CXX_BASE_SPECIFIERS
A record containing CXXBaseSpecifiers.
@ DECL_CONTEXT_LEXICAL
A record that stores the set of declarations that are lexically stored within a given DeclContext.
@ DECL_CXX_CTOR_INITIALIZERS
A record containing CXXCtorInitializers.
@ DECL_CONTEXT_VISIBLE
A record that stores the set of declarations that are visible from a given DeclContext.
@ TYPE_EXT_QUAL
An ExtQualType record.
@ SPECIAL_TYPE_OBJC_SEL_REDEFINITION
Objective-C "SEL" redefinition type.
@ SPECIAL_TYPE_UCONTEXT_T
C ucontext_t typedef type.
@ SPECIAL_TYPE_JMP_BUF
C jmp_buf typedef type.
@ SPECIAL_TYPE_FILE
C FILE typedef type.
@ SPECIAL_TYPE_SIGJMP_BUF
C sigjmp_buf typedef type.
@ SPECIAL_TYPE_OBJC_CLASS_REDEFINITION
Objective-C "Class" redefinition type.
@ SPECIAL_TYPE_CF_CONSTANT_STRING
CFConstantString type.
@ SPECIAL_TYPE_OBJC_ID_REDEFINITION
Objective-C "id" redefinition type.
Defines the clang::TargetInfo interface.
CharacteristicKind
Indicates whether a file or directory holds normal user code, system code, or system code which is im...
bool isSystem(CharacteristicKind CK)
Determine whether a file / directory characteristic is for system code.
constexpr XRayInstrMask None
BlockID
The various types of blocks that can occur within a API notes file.
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...
bool Ret(InterpState &S, CodePtr &PC, APValue &Result)
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.
@ EXTENSION_METADATA
Metadata describing this particular extension.
uint32_t TypeID
An ID number that refers to a type in an AST file.
@ 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.
const unsigned int NUM_PREDEF_IDENT_IDS
The number of predefined identifier IDs.
uint32_t SubmoduleID
An ID number that refers to a submodule in a module file.
OptionsRecordTypes
Record types that occur within the options block inside the control block.
@ FILE_SYSTEM_OPTIONS
Record code for the filesystem options table.
@ TARGET_OPTIONS
Record code for the target options table.
@ PREPROCESSOR_OPTIONS
Record code for the preprocessor options table.
@ HEADER_SEARCH_OPTIONS
Record code for the headers search options table.
@ LANGUAGE_OPTIONS
Record code for the language options table.
uint32_t SelectorID
An ID number that refers to an ObjC selector in an AST file.
const unsigned int NUM_PREDEF_PP_ENTITY_IDS
The number of predefined preprocessed entity IDs.
uint32_t PreprocessedEntityID
An ID number that refers to an entity in the detailed preprocessing record.
const unsigned int NUM_PREDEF_SUBMODULE_IDS
The number of predefined submodule IDs.
@ SUBMODULE_BLOCK_ID
The block containing the submodule structure.
@ PREPROCESSOR_DETAIL_BLOCK_ID
The block containing the detailed preprocessing record.
@ AST_BLOCK_ID
The AST block, which acts as a container around the full AST block.
@ SOURCE_MANAGER_BLOCK_ID
The block containing information about the source manager.
@ CONTROL_BLOCK_ID
The control block, which contains all of the information that needs to be validated prior to committi...
@ DECLTYPES_BLOCK_ID
The block containing the definitions of all of the types and decls used within the AST file.
@ PREPROCESSOR_BLOCK_ID
The block containing information about the preprocessor.
@ COMMENTS_BLOCK_ID
The block containing comments.
@ UNHASHED_CONTROL_BLOCK_ID
A block with unhashed content.
@ EXTENSION_BLOCK_ID
A block containing a module file extension.
@ OPTIONS_BLOCK_ID
The block of configuration options, used to check that a module is being used in a configuration comp...
@ INPUT_FILES_BLOCK_ID
The block of input files, which were used as inputs to create this AST file.
CommentRecordTypes
Record types used within a comments block.
@ SM_SLOC_FILE_ENTRY
Describes a source location entry (SLocEntry) for a file.
@ SM_SLOC_BUFFER_BLOB_COMPRESSED
Describes a zlib-compressed blob that contains the data for a buffer entry.
@ SM_SLOC_BUFFER_ENTRY
Describes a source location entry (SLocEntry) for a buffer.
@ SM_SLOC_BUFFER_BLOB
Describes a blob that contains the data for a buffer entry.
@ SM_SLOC_EXPANSION_ENTRY
Describes a source location entry (SLocEntry) for a macro expansion.
const unsigned int NUM_PREDEF_SELECTOR_IDS
The number of predefined selector IDs.
bool needsAnonymousDeclarationNumber(const NamedDecl *D)
Determine whether the given declaration needs an anonymous declaration number.
const unsigned VERSION_MAJOR
AST file major version number supported by this version of Clang.
DeclIDBase::DeclID DeclID
An ID number that refers to a declaration in an AST file.
PreprocessorRecordTypes
Record types used within a preprocessor block.
@ PP_TOKEN
Describes one token.
@ PP_MACRO_FUNCTION_LIKE
A function-like macro definition.
@ PP_MACRO_OBJECT_LIKE
An object-like macro definition.
@ PP_MACRO_DIRECTIVE_HISTORY
The macro directives history for a particular identifier.
@ PP_MODULE_MACRO
A macro directive exported by a module.
ControlRecordTypes
Record types that occur within the control block.
@ MODULE_MAP_FILE
Record code for the module map file that was used to build this AST file.
@ MODULE_DIRECTORY
Record code for the module build directory.
@ IMPORTS
Record code for the list of other AST files imported by this AST file.
@ ORIGINAL_FILE_ID
Record code for file ID of the file or buffer that was used to generate the AST file.
@ MODULE_NAME
Record code for the module name.
@ ORIGINAL_FILE
Record code for the original file that was used to generate the AST file, including both its file ID ...
@ INPUT_FILE_OFFSETS
Offsets into the input-files block where input files reside.
@ METADATA
AST file metadata, including the AST file version number and information about the compiler used to b...
UnhashedControlBlockRecordTypes
Record codes for the unhashed control block.
@ DIAGNOSTIC_OPTIONS
Record code for the diagnostic options table.
@ HEADER_SEARCH_ENTRY_USAGE
Record code for the indices of used header search entries.
@ AST_BLOCK_HASH
Record code for the content hash of the AST block.
@ DIAG_PRAGMA_MAPPINGS
Record code for #pragma diagnostic mappings.
@ SIGNATURE
Record code for the signature that identifiers this AST file.
@ HEADER_SEARCH_PATHS
Record code for the headers search paths.
@ VFS_USAGE
Record code for the indices of used VFSs.
InputFileRecordTypes
Record types that occur within the input-files block inside the control block.
@ INPUT_FILE_HASH
The input file content hash.
@ INPUT_FILE
An input file.
PreprocessorDetailRecordTypes
Record types used within a preprocessor detail block.
@ PPD_INCLUSION_DIRECTIVE
Describes an inclusion directive within the preprocessing record.
@ PPD_MACRO_EXPANSION
Describes a macro expansion within the preprocessing record.
@ PPD_MACRO_DEFINITION
Describes a macro definition within the preprocessing record.
ModuleKind
Specifies the kind of module that has been loaded.
@ MK_PCH
File is a PCH file treated as such.
@ MK_Preamble
File is a PCH file treated as the preamble.
@ MK_MainFile
File is a PCH file treated as the actual main file.
@ MK_ExplicitModule
File is an explicitly-loaded module.
@ MK_ImplicitModule
File is an implicitly-loaded module.
@ MK_PrebuiltModule
File is from a prebuilt module path.
const unsigned int NUM_PREDEF_MACRO_IDS
The number of predefined macro IDs.
ASTRecordTypes
Record types that occur within the AST block itself.
@ DECL_UPDATE_OFFSETS
Record for offsets of DECL_UPDATES records for declarations that were modified after being deserializ...
@ STATISTICS
Record code for the extra statistics we gather while generating an AST file.
@ FLOAT_CONTROL_PRAGMA_OPTIONS
Record code for #pragma float_control options.
@ KNOWN_NAMESPACES
Record code for the set of known namespaces, which are used for typo correction.
@ SPECIAL_TYPES
Record code for the set of non-builtin, special types.
@ PENDING_IMPLICIT_INSTANTIATIONS
Record code for pending implicit instantiations.
@ TYPE_OFFSET
Record code for the offsets of each type.
@ DELEGATING_CTORS
The list of delegating constructor declarations.
@ PP_ASSUME_NONNULL_LOC
ID 66 used to be the list of included files.
@ EXT_VECTOR_DECLS
Record code for the set of ext_vector type names.
@ OPENCL_EXTENSIONS
Record code for enabled OpenCL extensions.
@ FP_PRAGMA_OPTIONS
Record code for floating point #pragma options.
@ VTABLE_USES
Record code for the array of VTable uses.
@ LATE_PARSED_TEMPLATE
Record code for late parsed template functions.
@ DECLS_TO_CHECK_FOR_DEFERRED_DIAGS
Record code for the Decls to be checked for deferred diags.
@ DECL_OFFSET
Record code for the offsets of each decl.
@ SOURCE_MANAGER_LINE_TABLE
Record code for the source manager line table information, which stores information about #line direc...
@ PP_COUNTER_VALUE
The value of the next COUNTER to dispense.
@ DELETE_EXPRS_TO_ANALYZE
Delete expressions that will be analyzed later.
@ UPDATE_VISIBLE
Record code for an update to a decl context's lookup table.
@ CUDA_PRAGMA_FORCE_HOST_DEVICE_DEPTH
Number of unmatched #pragma clang cuda_force_host_device begin directives we've seen.
@ MACRO_OFFSET
Record code for the table of offsets of each macro ID.
@ PPD_ENTITIES_OFFSETS
Record code for the table of offsets to entries in the preprocessing record.
@ 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.
uint32_t IdentifierID
An ID number that refers to an identifier in an AST file.
unsigned ComputeHash(Selector Sel)
std::string toString(const til::SExpr *E)
TokenKind
Provides a simple uniform namespace for tokens from all C languages.
The JSON file list parser is used to communicate input to InstallAPI.
OpenACCClauseKind
Represents the kind of an OpenACC clause.
@ Auto
'auto' clause, allowed on 'loop' directives.
@ Bind
'bind' clause, allowed on routine constructs.
@ Gang
'gang' clause, allowed on 'loop' and Combined constructs.
@ Wait
'wait' clause, allowed on Compute, Data, 'update', and Combined constructs.
@ DevicePtr
'deviceptr' clause, allowed on Compute and Combined Constructs, plus 'data' and 'declare'.
@ PCopyOut
'copyout' clause alias 'pcopyout'. Preserved for diagnostic purposes.
@ VectorLength
'vector_length' clause, allowed on 'parallel', 'kernels', 'parallel loop', and 'kernels loop' constru...
@ Async
'async' clause, allowed on Compute, Data, 'update', 'wait', and Combined constructs.
@ PresentOrCreate
'create' clause alias 'present_or_create'.
@ Collapse
'collapse' clause, allowed on 'loop' and Combined constructs.
@ NoHost
'nohost' clause, allowed on 'routine' directives.
@ PresentOrCopy
'copy' clause alias 'present_or_copy'. Preserved for diagnostic purposes.
@ DeviceNum
'device_num' clause, allowed on 'init', 'shutdown', and 'set' constructs.
@ Private
'private' clause, allowed on 'parallel', 'serial', 'loop', 'parallel loop', and 'serial loop' constru...
@ Invalid
Represents an invalid clause, for the purposes of parsing.
@ Vector
'vector' clause, allowed on 'loop', Combined, and 'routine' directives.
@ Copy
'copy' clause, allowed on Compute and Combined Constructs, plus 'data' and 'declare'.
@ Worker
'worker' clause, allowed on 'loop', Combined, and 'routine' directives.
@ Create
'create' clause, allowed on Compute and Combined constructs, plus 'data', 'enter data',...
@ DeviceType
'device_type' clause, allowed on Compute, 'data', 'init', 'shutdown', 'set', update',...
@ DefaultAsync
'default_async' clause, allowed on 'set' construct.
@ Attach
'attach' clause, allowed on Compute and Combined constructs, plus 'data' and 'enter data'.
@ NumGangs
'num_gangs' clause, allowed on 'parallel', 'kernels', parallel loop', and 'kernels loop' constructs.
@ If
'if' clause, allowed on all the Compute Constructs, Data Constructs, Executable Constructs,...
@ Default
'default' clause, allowed on parallel, serial, kernel (and compound) constructs.
@ UseDevice
'use_device' clause, allowed on 'host_data' construct.
@ NoCreate
'no_create' clause, allowed on allowed on Compute and Combined constructs, plus 'data'.
@ PresentOrCopyOut
'copyout' clause alias 'present_or_copyout'.
@ Link
'link' clause, allowed on 'declare' construct.
@ Reduction
'reduction' clause, allowed on Parallel, Serial, Loop, and the combined constructs.
@ Self
'self' clause, allowed on Compute and Combined Constructs, plus 'update'.
@ CopyOut
'copyout' clause, allowed on Compute and Combined constructs, plus 'data', 'exit data',...
@ Seq
'seq' clause, allowed on 'loop' and 'routine' directives.
@ FirstPrivate
'firstprivate' clause, allowed on 'parallel', 'serial', 'parallel loop', and 'serial loop' constructs...
@ Host
'host' clause, allowed on 'update' construct.
@ PCopy
'copy' clause alias 'pcopy'. Preserved for diagnostic purposes.
@ Tile
'tile' clause, allowed on 'loop' and Combined constructs.
@ PCopyIn
'copyin' clause alias 'pcopyin'. Preserved for diagnostic purposes.
@ DeviceResident
'device_resident' clause, allowed on the 'declare' construct.
@ PCreate
'create' clause alias 'pcreate'. Preserved for diagnostic purposes.
@ Present
'present' clause, allowed on Compute and Combined constructs, plus 'data' and 'declare'.
@ DType
'dtype' clause, an alias for 'device_type', stored separately for diagnostic purposes.
@ CopyIn
'copyin' clause, allowed on Compute and Combined constructs, plus 'data', 'enter data',...
@ Device
'device' clause, allowed on the 'update' construct.
@ Independent
'independent' clause, allowed on 'loop' directives.
@ NumWorkers
'num_workers' clause, allowed on 'parallel', 'kernels', parallel loop', and 'kernels loop' constructs...
@ IfPresent
'if_present' clause, allowed on 'host_data' and 'update' directives.
@ Detach
'detach' clause, allowed on the 'exit data' construct.
@ Delete
'delete' clause, allowed on the 'exit data' construct.
@ PresentOrCopyIn
'copyin' clause alias 'present_or_copyin'.
@ Finalize
'finalize' clause, allowed on 'exit data' directive.
TypeSpecifierType
Specifies the kind of type.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
SanitizerMask getPPTransparentSanitizers()
Return the sanitizers which do not affect preprocessing.
if(T->getSizeExpr()) TRY_TO(TraverseStmt(const_cast< Expr * >(T -> getSizeExpr())))
llvm::omp::Directive OpenMPDirectiveKind
OpenMP directives.
OpenMPDefaultmapClauseModifier
OpenMP modifiers for 'defaultmap' clause.
OpenMPOrderClauseModifier
OpenMP modifiers for 'order' clause.
void ProcessWarningOptions(DiagnosticsEngine &Diags, const DiagnosticOptions &Opts, bool ReportDiags=true)
ProcessWarningOptions - Initialize the diagnostic client and process the warning options specified on...
OpenMPAtClauseKind
OpenMP attributes for 'at' clause.
OpenMPReductionClauseModifier
OpenMP modifiers for 'reduction' clause.
OpenMPScheduleClauseModifier
OpenMP modifiers for 'schedule' clause.
llvm::omp::Clause OpenMPClauseKind
OpenMP clauses.
OpenMPDistScheduleClauseKind
OpenMP attributes for 'dist_schedule' clause.
OpenMPDoacrossClauseModifier
OpenMP dependence types for 'doacross' clause.
static constexpr unsigned NumberOfOMPMapClauseModifiers
Number of allowed map-type-modifiers.
const unsigned int NUM_PREDEF_DECL_IDS
The number of declaration IDs that are predefined.
ObjCXXARCStandardLibraryKind
Enumerate the kinds of standard library that.
PredefinedDeclIDs
Predefined declaration IDs.
@ PREDEF_DECL_CF_CONSTANT_STRING_TAG_ID
The internal '__NSConstantString' tag type.
@ PREDEF_DECL_TRANSLATION_UNIT_ID
The translation unit.
@ PREDEF_DECL_TYPE_PACK_ELEMENT_ID
The internal '__type_pack_element' template.
@ PREDEF_DECL_OBJC_CLASS_ID
The Objective-C 'Class' type.
@ PREDEF_DECL_BUILTIN_MS_GUID_ID
The predeclared '_GUID' struct.
@ PREDEF_DECL_OBJC_INSTANCETYPE_ID
The internal 'instancetype' typedef.
@ PREDEF_DECL_OBJC_PROTOCOL_ID
The Objective-C 'Protocol' type.
@ PREDEF_DECL_UNSIGNED_INT_128_ID
The unsigned 128-bit integer type.
@ PREDEF_DECL_OBJC_SEL_ID
The Objective-C 'SEL' type.
@ PREDEF_DECL_INT_128_ID
The signed 128-bit integer type.
@ PREDEF_DECL_VA_LIST_TAG
The internal '__va_list_tag' struct, if any.
@ PREDEF_DECL_BUILTIN_MS_VA_LIST_ID
The internal '__builtin_ms_va_list' typedef.
@ PREDEF_DECL_CF_CONSTANT_STRING_ID
The internal '__NSConstantString' typedef.
@ PREDEF_DECL_NULL_ID
The NULL declaration.
@ PREDEF_DECL_BUILTIN_VA_LIST_ID
The internal '__builtin_va_list' typedef.
@ PREDEF_DECL_EXTERN_C_CONTEXT_ID
The extern "C" context.
@ PREDEF_DECL_OBJC_ID_ID
The Objective-C 'id' type.
@ PREDEF_DECL_MAKE_INTEGER_SEQ_ID
The internal '__make_integer_seq' template.
@ Property
The type of a property.
OpenMPBindClauseKind
OpenMP bindings for the 'bind' clause.
OpenMPLastprivateModifier
OpenMP 'lastprivate' clause modifier.
OpenMPDependClauseKind
OpenMP attributes for 'depend' clause.
OpenMPGrainsizeClauseModifier
OpenMPNumTasksClauseModifier
OpenMPSeverityClauseKind
OpenMP attributes for 'severity' clause.
static constexpr unsigned NumberOfOMPMotionModifiers
Number of allowed motion-modifiers.
TypeSpecifierWidth
Specifies the width of a type, e.g., short, long, or long long.
OpenMPMotionModifierKind
OpenMP modifier kind for 'to' or 'from' clause.
OpenMPDefaultmapClauseKind
OpenMP attributes for 'defaultmap' clause.
OpenMPLinearClauseKind
OpenMP attributes for 'linear' clause.
TypeSpecifierSign
Specifies the signedness of a type, e.g., signed or unsigned.
llvm::hash_code hash_value(const CustomizableOptional< T > &O)
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.
U cast(CodeGen::Address addr)
OpenMPDeviceClauseModifier
OpenMP modifiers for 'device' clause.
OpenMPMapModifierKind
OpenMP modifier kind for 'map' clause.
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.
float __ovld __cnfn distance(float, float)
Returns the distance between p0 and p1.
The signature of a module, which is a hash of the AST content.
static constexpr size_t size
static ASTFileSignature create(std::array< uint8_t, 20 > Bytes)
static ASTFileSignature createDummy()
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>".
static const ASTTemplateArgumentListInfo * Create(const ASTContext &C, const TemplateArgumentListInfo &List)
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...
DeclarationName getName() const
getName - Returns the embedded declaration name.
void setLoc(SourceLocation L)
setLoc - Sets the main location of the declaration name.
void setInfo(const DeclarationNameLoc &Info)
void setName(DeclarationName N)
setName - Sets the embedded declaration name.
A simple structure that captures a vtable use for the purposes of the ExternalSemaSource.
ExceptionSpecInfo ExceptionSpec
static LineEntry get(unsigned Offs, unsigned Line, int Filename, SrcMgr::CharacteristicKind FileKind, unsigned IncludeOffset)
A conflict between two modules.
Module * Other
The module that this module conflicts with.
std::string Message
The message provided to the user when there is a conflict.
This structure contains all sizes needed for by an OMPMappableExprListClause.
unsigned NumComponentLists
Number of component lists.
unsigned NumVars
Number of expressions listed.
unsigned NumUniqueDeclarations
Number of unique base declarations.
unsigned NumComponents
Total number of expression components.
Data for list of allocators.
SourceLocation LParenLoc
Locations of '(' and ')' symbols.
Expr * AllocatorTraits
Allocator traits.
Expr * Allocator
Allocator.
a linked list of methods with the same selector name but different signatures.
A struct with extended info about a syntactic name qualifier, to be used for the case of out-of-line ...
TemplateParameterList ** TemplParamLists
A new-allocated array of size NumTemplParamLists, containing pointers to the "outer" template paramet...
NestedNameSpecifierLoc QualifierLoc
unsigned NumTemplParamLists
The number of "outer" template parameter lists.
void clear(SanitizerMask K=SanitizerKind::All)
Disable the sanitizers specified in K.
SanitizerMask Mask
Bitmask of enabled sanitizers.
Helper class that saves the current stream position and then restores it when destroyed.
PragmaMsStackAction Action
Location information for a TemplateArgument.
Describes the categories of an Objective-C class.
void insert(GlobalDeclID ID)