82#include "llvm/ADT/APFloat.h"
83#include "llvm/ADT/APInt.h"
84#include "llvm/ADT/ArrayRef.h"
85#include "llvm/ADT/DenseMap.h"
86#include "llvm/ADT/DenseSet.h"
87#include "llvm/ADT/PointerIntPair.h"
88#include "llvm/ADT/STLExtras.h"
89#include "llvm/ADT/ScopeExit.h"
90#include "llvm/ADT/SmallPtrSet.h"
91#include "llvm/ADT/SmallString.h"
92#include "llvm/ADT/SmallVector.h"
93#include "llvm/ADT/StringRef.h"
94#include "llvm/Bitstream/BitCodes.h"
95#include "llvm/Bitstream/BitstreamWriter.h"
96#include "llvm/Support/Compression.h"
97#include "llvm/Support/DJB.h"
98#include "llvm/Support/EndianStream.h"
99#include "llvm/Support/ErrorHandling.h"
100#include "llvm/Support/LEB128.h"
101#include "llvm/Support/MemoryBuffer.h"
102#include "llvm/Support/OnDiskHashTable.h"
103#include "llvm/Support/Path.h"
104#include "llvm/Support/SHA1.h"
105#include "llvm/Support/TimeProfiler.h"
106#include "llvm/Support/VersionTuple.h"
107#include "llvm/Support/raw_ostream.h"
122using namespace clang;
125template <
typename T,
typename Allocator>
126static StringRef
bytes(
const std::vector<T, Allocator> &v) {
127 if (v.empty())
return StringRef();
128 return StringRef(
reinterpret_cast<const char*
>(&v[0]),
129 sizeof(
T) * v.size());
134 return StringRef(
reinterpret_cast<const char*
>(v.data()),
135 sizeof(
T) * v.size());
138static std::string
bytes(
const std::vector<bool> &
V) {
140 Str.reserve(
V.size() / 8);
141 for (
unsigned I = 0,
E =
V.size(); I <
E;) {
143 for (
unsigned Bit = 0; Bit < 8 && I <
E; ++Bit, ++I)
156#define TYPE_BIT_CODE(CLASS_ID, CODE_ID, CODE_VALUE) \
157 case Type::CLASS_ID: return TYPE_##CODE_ID;
158#include "clang/Serialization/TypeBitCodes.def"
160 llvm_unreachable(
"shouldn't be serializing a builtin type this way");
162 llvm_unreachable(
"bad type kind");
167struct AffectingModuleMaps {
168 llvm::DenseSet<FileID> DefinitionFileIDs;
169 llvm::DenseSet<const FileEntry *> DefinitionFiles;
172std::optional<AffectingModuleMaps>
185 enum AffectedReason :
bool {
186 AR_TextualHeader = 0,
187 AR_ImportOrTextualHeader = 1,
189 auto AssignMostImportant = [](AffectedReason &LHS, AffectedReason RHS) {
190 LHS = std::max(LHS, RHS);
192 llvm::DenseMap<FileID, AffectedReason> ModuleMaps;
193 llvm::DenseMap<const Module *, AffectedReason> ProcessedModules;
194 auto CollectModuleMapsForHierarchy = [&](
const Module *M,
195 AffectedReason Reason) {
201 if (
auto [It, Inserted] = ProcessedModules.insert({M, Reason});
202 !Inserted && Reason <= It->second) {
208 std::queue<const Module *> Q;
211 const Module *Mod = Q.front();
217 AssignMostImportant(ModuleMaps[F], Reason);
222 AssignMostImportant(ModuleMaps[UniqF], Reason);
231 CollectModuleMapsForHierarchy(RootModule, AR_ImportOrTextualHeader);
233 std::queue<const Module *> Q;
236 const Module *CurrentModule = Q.front();
240 CollectModuleMapsForHierarchy(ImportedModule, AR_ImportOrTextualHeader);
242 CollectModuleMapsForHierarchy(UndeclaredModule, AR_ImportOrTextualHeader);
256 for (
unsigned UID = 0, LastUID = FilesByUID.size(); UID != LastUID; ++UID) {
270 if (
const Module *M = KH.getModule())
271 CollectModuleMapsForHierarchy(M, AR_TextualHeader);
292 llvm::DenseSet<const FileEntry *> ModuleFileEntries;
293 llvm::DenseSet<FileID> ModuleFileIDs;
294 for (
auto [FID, Reason] : ModuleMaps) {
295 if (Reason == AR_ImportOrTextualHeader)
296 ModuleFileIDs.insert(FID);
297 if (
auto *FE =
SM.getFileEntryForID(FID))
298 ModuleFileEntries.insert(FE);
301 AffectingModuleMaps R;
302 R.DefinitionFileIDs = std::move(ModuleFileIDs);
303 R.DefinitionFiles = std::move(ModuleFileEntries);
314 : Writer(Writer), BasicWriter(Context, Writer,
Record) {}
317 if (
T.hasLocalNonFastQualifiers()) {
324 const Type *typePtr =
T.getTypePtr();
341#define ABSTRACT_TYPELOC(CLASS, PARENT)
342#define TYPELOC(CLASS, PARENT) \
343 void Visit##CLASS##TypeLoc(CLASS##TypeLoc TyLoc);
344#include "clang/AST/TypeLocNodes.def"
413 VisitArrayTypeLoc(TL);
417 VisitArrayTypeLoc(TL);
421 VisitArrayTypeLoc(TL);
424void TypeLocWriter::VisitDependentSizedArrayTypeLoc(
426 VisitArrayTypeLoc(TL);
429void TypeLocWriter::VisitDependentAddressSpaceTypeLoc(
433 addSourceLocation(
range.getBegin());
434 addSourceLocation(
range.getEnd());
438void TypeLocWriter::VisitDependentSizedExtVectorTypeLoc(
447void TypeLocWriter::VisitDependentVectorTypeLoc(
459 addSourceLocation(
range.getBegin());
460 addSourceLocation(
range.getEnd());
465void TypeLocWriter::VisitDependentSizedMatrixTypeLoc(
469 addSourceLocation(
range.getBegin());
470 addSourceLocation(
range.getEnd());
481 for (
unsigned i = 0, e = TL.
getNumParams(); i != e; ++i)
486 VisitFunctionTypeLoc(TL);
490 VisitFunctionTypeLoc(TL);
561void TypeLocWriter::VisitAutoTypeLoc(
AutoTypeLoc TL) {
566 Record.AddConceptReference(CR);
572void TypeLocWriter::VisitDeducedTemplateSpecializationTypeLoc(
579void TypeLocWriter::VisitTagTypeLoc(
TagTypeLoc TL) {
593void TypeLocWriter::VisitEnumTypeLoc(
EnumTypeLoc TL) { VisitTagTypeLoc(TL); }
607void TypeLocWriter::VisitHLSLAttributedResourceTypeLoc(
620void TypeLocWriter::VisitSubstTemplateTypeParmTypeLoc(
625void TypeLocWriter::VisitSubstTemplateTypeParmPackTypeLoc(
630void TypeLocWriter::VisitSubstBuiltinTemplatePackTypeLoc(
635void TypeLocWriter::VisitTemplateSpecializationTypeLoc(
643 for (
unsigned i = 0, e = TL.
getNumArgs(); i != e; ++i)
662void TypeLocWriter::VisitDependentTemplateSpecializationTypeLoc(
705void TypeLocWriter::VisitPipeTypeLoc(
PipeTypeLoc TL) {
711void TypeLocWriter::VisitDependentBitIntTypeLoc(
716void TypeLocWriter::VisitPredefinedSugarTypeLoc(
721void ASTWriter::WriteTypeAbbrevs() {
722 using namespace llvm;
724 std::shared_ptr<BitCodeAbbrev> Abv;
727 Abv = std::make_shared<BitCodeAbbrev>();
729 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
730 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 3));
731 TypeExtQualAbbrev = Stream.EmitAbbrev(std::move(Abv));
739 llvm::BitstreamWriter &Stream,
743 Stream.EmitRecord(llvm::bitc::BLOCKINFO_CODE_SETBID,
Record);
746 if (!Name || Name[0] == 0)
750 Record.push_back(*Name++);
751 Stream.EmitRecord(llvm::bitc::BLOCKINFO_CODE_BLOCKNAME,
Record);
755 llvm::BitstreamWriter &Stream,
760 Record.push_back(*Name++);
761 Stream.EmitRecord(llvm::bitc::BLOCKINFO_CODE_SETRECORDNAME,
Record);
766#define RECORD(X) EmitRecordID(X, #X, Stream, Record)
898void ASTWriter::WriteBlockInfoBlock() {
900 Stream.EnterBlockInfoBlock();
902#define BLOCK(X) EmitBlockID(X ## _ID, #X, Stream, Record)
903#define RECORD(X) EmitRecordID(X, #X, Stream, Record)
906 BLOCK(CONTROL_BLOCK);
916 BLOCK(OPTIONS_BLOCK);
924 BLOCK(INPUT_FILES_BLOCK);
989 BLOCK(SOURCE_MANAGER_BLOCK);
997 BLOCK(PREPROCESSOR_BLOCK);
1005 BLOCK(SUBMODULE_BLOCK);
1027 BLOCK(COMMENTS_BLOCK);
1031 BLOCK(DECLTYPES_BLOCK);
1035 RECORD(TYPE_BLOCK_POINTER);
1036 RECORD(TYPE_LVALUE_REFERENCE);
1037 RECORD(TYPE_RVALUE_REFERENCE);
1038 RECORD(TYPE_MEMBER_POINTER);
1039 RECORD(TYPE_CONSTANT_ARRAY);
1040 RECORD(TYPE_INCOMPLETE_ARRAY);
1041 RECORD(TYPE_VARIABLE_ARRAY);
1044 RECORD(TYPE_FUNCTION_NO_PROTO);
1045 RECORD(TYPE_FUNCTION_PROTO);
1047 RECORD(TYPE_TYPEOF_EXPR);
1051 RECORD(TYPE_OBJC_INTERFACE);
1052 RECORD(TYPE_OBJC_OBJECT_POINTER);
1054 RECORD(TYPE_SUBST_TEMPLATE_TYPE_PARM);
1055 RECORD(TYPE_UNRESOLVED_USING);
1056 RECORD(TYPE_INJECTED_CLASS_NAME);
1057 RECORD(TYPE_OBJC_OBJECT);
1058 RECORD(TYPE_TEMPLATE_TYPE_PARM);
1059 RECORD(TYPE_TEMPLATE_SPECIALIZATION);
1060 RECORD(TYPE_DEPENDENT_NAME);
1061 RECORD(TYPE_DEPENDENT_TEMPLATE_SPECIALIZATION);
1062 RECORD(TYPE_DEPENDENT_SIZED_ARRAY);
1064 RECORD(TYPE_MACRO_QUALIFIED);
1065 RECORD(TYPE_PACK_EXPANSION);
1067 RECORD(TYPE_SUBST_TEMPLATE_TYPE_PARM_PACK);
1068 RECORD(TYPE_SUBST_BUILTIN_TEMPLATE_PACK);
1070 RECORD(TYPE_UNARY_TRANSFORM);
1074 RECORD(TYPE_OBJC_TYPE_PARAM);
1155 BLOCK(PREPROCESSOR_DETAIL_BLOCK);
1161 BLOCK(EXTENSION_BLOCK);
1164 BLOCK(UNHASHED_CONTROL_BLOCK);
1185 return Changed | llvm::sys::path::remove_dots(
Path);
1200 assert(
Filename &&
"No file name to adjust?");
1202 if (BaseDir.empty())
1207 for (;
Filename[Pos] && Pos < BaseDir.size(); ++Pos)
1217 if (!llvm::sys::path::is_separator(
Filename[Pos])) {
1218 if (!llvm::sys::path::is_separator(BaseDir.back()))
1235std::pair<ASTFileSignature, ASTFileSignature>
1236ASTWriter::createSignature()
const {
1237 StringRef AllBytes(Buffer.data(), Buffer.size());
1240 Hasher.update(AllBytes.slice(ASTBlockRange.first, ASTBlockRange.second));
1245 Hasher.update(AllBytes.slice(0, UnhashedControlBlockRange.first));
1248 AllBytes.slice(UnhashedControlBlockRange.second, ASTBlockRange.first));
1250 Hasher.update(AllBytes.substr(ASTBlockRange.second));
1253 return std::make_pair(ASTBlockHash, Signature);
1258 Hasher.update(StringRef(Buffer.data(), Buffer.size()));
1260 assert(WritingModule);
1265 for (
auto [ExportImported, _] : WritingModule->
Exports)
1266 Hasher.update(ExportImported->Signature);
1290 for (
Module *M : TouchedTopLevelModules)
1298 for (uint8_t Byte : S) {
1299 Stream.BackpatchByte(BitNo, Byte);
1311 if (!WritingModule ||
1318 std::tie(ASTBlockHash, Signature) = createSignature();
1326void ASTWriter::writeUnhashedControlBlock(
Preprocessor &PP) {
1327 using namespace llvm;
1330 Stream.FlushToWord();
1331 UnhashedControlBlockRange.first = Stream.GetCurrentBitNo() >> 3;
1354 auto Abbrev = std::make_shared<BitCodeAbbrev>();
1356 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
1357 unsigned ASTBlockHashAbbrev = Stream.EmitAbbrev(std::move(Abbrev));
1360 Stream.EmitRecordWithBlob(ASTBlockHashAbbrev,
Record, Blob);
1361 ASTBlockHashOffset = Stream.GetCurrentBitNo() - Blob.size() * 8;
1365 auto Abbrev = std::make_shared<BitCodeAbbrev>();
1366 Abbrev->Add(BitCodeAbbrevOp(
SIGNATURE));
1367 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
1368 unsigned SignatureAbbrev = Stream.EmitAbbrev(std::move(Abbrev));
1371 Stream.EmitRecordWithBlob(SignatureAbbrev,
Record, Blob);
1372 SignatureOffset = Stream.GetCurrentBitNo() - Blob.size() * 8;
1381 if (!HSOpts.ModulesSkipDiagnosticOptions) {
1382#define DIAGOPT(Name, Bits, Default) Record.push_back(DiagOpts.Name);
1383#define ENUM_DIAGOPT(Name, Type, Bits, Default) \
1384 Record.push_back(static_cast<unsigned>(DiagOpts.get##Name()));
1385#include "clang/Basic/DiagnosticOptions.def"
1387 for (
unsigned I = 0, N = DiagOpts.
Warnings.size(); I != N; ++I)
1390 for (
unsigned I = 0, N = DiagOpts.
Remarks.size(); I != N; ++I)
1399 if (!HSOpts.ModulesSkipHeaderSearchPaths) {
1401 Record.push_back(HSOpts.UserEntries.size());
1402 for (
unsigned I = 0, N = HSOpts.UserEntries.size(); I != N; ++I) {
1405 Record.push_back(
static_cast<unsigned>(Entry.
Group));
1411 Record.push_back(HSOpts.SystemHeaderPrefixes.size());
1412 for (
unsigned I = 0, N = HSOpts.SystemHeaderPrefixes.size(); I != N; ++I) {
1414 Record.push_back(HSOpts.SystemHeaderPrefixes[I].IsSystemHeader);
1418 Record.push_back(HSOpts.VFSOverlayFiles.size());
1419 for (StringRef VFSOverlayFile : HSOpts.VFSOverlayFiles)
1425 if (!HSOpts.ModulesSkipPragmaDiagnosticMappings)
1426 WritePragmaDiagnosticMappings(Diags, WritingModule);
1431 auto Abbrev = std::make_shared<BitCodeAbbrev>();
1433 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
1434 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
1435 unsigned HSUsageAbbrevCode = Stream.EmitAbbrev(std::move(Abbrev));
1437 HSEntryUsage.size()};
1438 Stream.EmitRecordWithBlob(HSUsageAbbrevCode,
Record,
bytes(HSEntryUsage));
1444 auto Abbrev = std::make_shared<BitCodeAbbrev>();
1445 Abbrev->Add(BitCodeAbbrevOp(
VFS_USAGE));
1446 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
1447 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
1448 unsigned VFSUsageAbbrevCode = Stream.EmitAbbrev(std::move(Abbrev));
1450 Stream.EmitRecordWithBlob(VFSUsageAbbrevCode,
Record,
bytes(VFSUsage));
1455 UnhashedControlBlockRange.second = Stream.GetCurrentBitNo() >> 3;
1459void ASTWriter::WriteControlBlock(
Preprocessor &PP, StringRef isysroot) {
1460 using namespace llvm;
1469 auto MetadataAbbrev = std::make_shared<BitCodeAbbrev>();
1470 MetadataAbbrev->Add(BitCodeAbbrevOp(
METADATA));
1471 MetadataAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 16));
1472 MetadataAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 16));
1473 MetadataAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 16));
1474 MetadataAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 16));
1475 MetadataAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
1477 MetadataAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
1478 MetadataAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
1479 MetadataAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
1480 MetadataAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
1481 unsigned MetadataAbbrevCode = Stream.EmitAbbrev(std::move(MetadataAbbrev));
1482 assert((!WritingModule || isysroot.empty()) &&
1483 "writing module as a relocatable PCH?");
1488 CLANG_VERSION_MAJOR,
1489 CLANG_VERSION_MINOR,
1493 ASTHasCompilerErrors};
1494 Stream.EmitRecordWithBlob(MetadataAbbrevCode,
Record,
1498 if (WritingModule) {
1500 auto Abbrev = std::make_shared<BitCodeAbbrev>();
1502 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
1503 unsigned AbbrevCode = Stream.EmitAbbrev(std::move(Abbrev));
1505 Stream.EmitRecordWithBlob(AbbrevCode,
Record, WritingModule->
Name);
1516 return std::nullopt;
1530 auto Abbrev = std::make_shared<BitCodeAbbrev>();
1532 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
1533 unsigned AbbrevCode = Stream.EmitAbbrev(std::move(Abbrev));
1536 Stream.EmitRecordWithBlob(AbbrevCode,
Record, *BaseDir);
1540 BaseDirectory.assign(BaseDir->begin(), BaseDir->end());
1541 }
else if (!isysroot.empty()) {
1543 BaseDirectory = std::string(isysroot);
1553 ? Map.getModuleMapFileForUniquing(WritingModule)
1554 ->getNameAsRequested()
1559 if (
auto *AdditionalModMaps =
1560 Map.getAdditionalModuleMapFiles(WritingModule)) {
1561 Record.push_back(AdditionalModMaps->size());
1563 AdditionalModMaps->end());
1578 auto Abbrev = std::make_shared<BitCodeAbbrev>();
1579 Abbrev->Add(BitCodeAbbrevOp(
IMPORT));
1580 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3));
1581 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
1582 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
1583 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
1584 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
1585 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
1586 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
1587 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
1588 unsigned AbbrevCode = Stream.EmitAbbrev(std::move(Abbrev));
1594 if (!M.isDirectlyImported())
1604 Record.push_back(M.StandardCXXModule);
1608 if (M.StandardCXXModule) {
1623 Stream.EmitRecordWithBlob(AbbrevCode,
Record, Blob);
1633#define LANGOPT(Name, Bits, Default, Compatibility, Description) \
1634 Record.push_back(LangOpts.Name);
1635#define ENUM_LANGOPT(Name, Type, Bits, Default, Compatibility, Description) \
1636 Record.push_back(static_cast<unsigned>(LangOpts.get##Name()));
1637#include "clang/Basic/LangOptions.def"
1638#define SANITIZER(NAME, ID) \
1639 Record.push_back(LangOpts.Sanitize.has(SanitizerKind::ID));
1640#include "clang/Basic/Sanitizers.def"
1672#define CODEGENOPT(Name, Bits, Default, Compatibility) \
1673 if constexpr (CK::Compatibility != CK::Benign) \
1674 Record.push_back(static_cast<unsigned>(CGOpts.Name));
1675#define ENUM_CODEGENOPT(Name, Type, Bits, Default, Compatibility) \
1676 if constexpr (CK::Compatibility != CK::Benign) \
1677 Record.push_back(static_cast<unsigned>(CGOpts.get##Name()));
1678#define DEBUGOPT(Name, Bits, Default, Compatibility)
1679#define VALUE_DEBUGOPT(Name, Bits, Default, Compatibility)
1680#define ENUM_DEBUGOPT(Name, Type, Bits, Default, Compatibility)
1681#include "clang/Basic/CodeGenOptions.def"
1697 for (
unsigned I = 0, N = TargetOpts.
Features.size(); I != N; ++I) {
1737 bool WriteMacros = !SkipMacros;
1738 Record.push_back(WriteMacros);
1742 for (
unsigned I = 0, N = PPOpts.
Macros.size(); I != N; ++I) {
1750 for (
unsigned I = 0, N = PPOpts.
Includes.size(); I != N; ++I)
1755 for (
unsigned I = 0, N = PPOpts.
MacroIncludes.size(); I != N; ++I)
1771 auto FileAbbrev = std::make_shared<BitCodeAbbrev>();
1773 FileAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
1774 FileAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
1775 unsigned FileAbbrevCode = Stream.EmitAbbrev(std::move(FileAbbrev));
1787 WriteInputFiles(SourceMgr);
1794struct InputFileEntry {
1798 bool BufferOverridden;
1805 void trySetContentHash(
1807 llvm::function_ref<std::optional<llvm::MemoryBufferRef>()> GetMemBuff) {
1816 auto MemBuff = GetMemBuff();
1823 uint64_t Hash = xxh3_64bits(MemBuff->getBuffer());
1825 ContentHash[1] =
uint32_t(Hash >> 32);
1836 assert(IncludeFID.
isValid() &&
"IncludeLoc in invalid file");
1837 if (!IsSLocAffecting[IncludeFID.ID])
1844 using namespace llvm;
1849 auto IFAbbrev = std::make_shared<BitCodeAbbrev>();
1851 IFAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
1852 IFAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 12));
1853 IFAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 32));
1854 IFAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
1855 IFAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
1856 IFAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
1857 IFAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
1858 IFAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 16));
1859 IFAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
1860 unsigned IFAbbrevCode = Stream.EmitAbbrev(std::move(IFAbbrev));
1863 auto IFHAbbrev = std::make_shared<BitCodeAbbrev>();
1865 IFHAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
1866 IFHAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
1867 unsigned IFHAbbrevCode = Stream.EmitAbbrev(std::move(IFHAbbrev));
1869 uint64_t InputFilesOffsetBase = Stream.GetCurrentBitNo();
1872 std::vector<InputFileEntry> UserFiles;
1873 std::vector<InputFileEntry> SystemFiles;
1877 assert(&SourceMgr.
getSLocEntry(FileID::get(I)) == SLoc);
1884 if (!
Cache->OrigEntry)
1888 if (!IsSLocFileEntryAffecting[I])
1891 InputFileEntry Entry(*
Cache->OrigEntry);
1892 Entry.IsSystemFile =
isSystem(
File.getFileCharacteristic());
1893 Entry.IsTransient =
Cache->IsTransient;
1894 Entry.BufferOverridden =
Cache->BufferOverridden;
1897 Entry.IsTopLevel = IncludeFileID.
isInvalid() || IncludeFileID.ID < 0 ||
1898 !IsSLocFileEntryAffecting[IncludeFileID.ID];
1901 Entry.trySetContentHash(*PP, [&] {
return Cache->getBufferIfLoaded(); });
1903 if (Entry.IsSystemFile)
1904 SystemFiles.push_back(Entry);
1906 UserFiles.push_back(Entry);
1913 if (!Sysroot.empty()) {
1915 llvm::sys::path::append(SDKSettingsJSON,
"SDKSettings.json");
1918 InputFileEntry Entry(*FE);
1919 Entry.IsSystemFile =
true;
1920 Entry.IsTransient =
false;
1921 Entry.BufferOverridden =
false;
1922 Entry.IsTopLevel =
true;
1923 Entry.IsModuleMap =
false;
1924 std::unique_ptr<MemoryBuffer> MB;
1925 Entry.trySetContentHash(*PP, [&]() -> std::optional<MemoryBufferRef> {
1927 MB = std::move(*MBOrErr);
1928 return MB->getMemBufferRef();
1930 return std::nullopt;
1932 SystemFiles.push_back(Entry);
1937 auto SortedFiles = llvm::concat<InputFileEntry>(std::move(UserFiles),
1938 std::move(SystemFiles));
1940 unsigned UserFilesNum = 0;
1942 std::vector<uint64_t> InputFileOffsets;
1943 for (
const auto &Entry : SortedFiles) {
1944 uint32_t &InputFileID = InputFileIDs[Entry.File];
1945 if (InputFileID != 0)
1949 InputFileOffsets.push_back(Stream.GetCurrentBitNo() - InputFilesOffsetBase);
1951 InputFileID = InputFileOffsets.size();
1953 if (!Entry.IsSystemFile)
1965 if (Name == NameAsRequested)
1968 RecordData::value_type
Record[] = {
1970 InputFileOffsets.size(),
1973 Entry.BufferOverridden,
1977 NameAsRequested.size()};
1979 Stream.EmitRecordWithBlob(IFAbbrevCode,
Record,
1980 (NameAsRequested + Name).str());
1986 Entry.ContentHash[1]};
1987 Stream.EmitRecordWithAbbrev(IFHAbbrevCode,
Record);
1994 auto OffsetsAbbrev = std::make_shared<BitCodeAbbrev>();
1996 OffsetsAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
1997 OffsetsAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
1999 OffsetsAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2000 unsigned OffsetsAbbrevCode = Stream.EmitAbbrev(std::move(OffsetsAbbrev));
2004 InputFileOffsets.size(), UserFilesNum};
2005 Stream.EmitRecordWithBlob(OffsetsAbbrevCode,
Record,
bytes(InputFileOffsets));
2015 using namespace llvm;
2017 auto Abbrev = std::make_shared<BitCodeAbbrev>();
2019 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));
2020 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));
2021 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3));
2022 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2024 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2025 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));
2026 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 24));
2027 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));
2028 return Stream.EmitAbbrev(std::move(Abbrev));
2034 using namespace llvm;
2036 auto Abbrev = std::make_shared<BitCodeAbbrev>();
2038 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));
2039 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));
2040 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3));
2041 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2042 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2043 return Stream.EmitAbbrev(std::move(Abbrev));
2050 using namespace llvm;
2052 auto Abbrev = std::make_shared<BitCodeAbbrev>();
2056 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));
2057 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2058 return Stream.EmitAbbrev(std::move(Abbrev));
2064 using namespace llvm;
2066 auto Abbrev = std::make_shared<BitCodeAbbrev>();
2068 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));
2069 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));
2070 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2071 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2072 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2073 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2074 return Stream.EmitAbbrev(std::move(Abbrev));
2079static std::pair<unsigned, unsigned>
2081 llvm::encodeULEB128(KeyLen, Out);
2082 llvm::encodeULEB128(DataLen, Out);
2083 return std::make_pair(KeyLen, DataLen);
2089 class HeaderFileInfoTrait {
2093 HeaderFileInfoTrait(
ASTWriter &Writer) : Writer(Writer) {}
2100 using key_type_ref =
const key_type &;
2102 using UnresolvedModule =
2103 llvm::PointerIntPair<Module *, 2, ModuleMap::ModuleHeaderRole>;
2109 : HFI(HFI), AlreadyIncluded(AlreadyIncluded),
2113 bool AlreadyIncluded;
2117 using data_type_ref =
const data_type &;
2126 uint8_t buf[
sizeof(key.Size) +
sizeof(key.ModTime)];
2127 memcpy(buf, &key.Size,
sizeof(key.Size));
2128 memcpy(buf +
sizeof(key.Size), &key.ModTime,
sizeof(key.ModTime));
2129 return llvm::xxh3_64bits(buf);
2132 std::pair<unsigned, unsigned>
2133 EmitKeyDataLength(raw_ostream& Out, key_type_ref key, data_type_ref
Data) {
2134 unsigned KeyLen = key.Filename.size() + 1 + 8 + 8;
2136 for (
auto ModInfo :
Data.KnownHeaders)
2139 if (
Data.Unresolved.getPointer())
2144 void EmitKey(raw_ostream& Out, key_type_ref key,
unsigned KeyLen) {
2145 using namespace llvm::support;
2147 endian::Writer
LE(Out, llvm::endianness::little);
2152 Out.write(key.Filename.data(), KeyLen);
2155 void EmitData(raw_ostream &Out, key_type_ref key,
2156 data_type_ref
Data,
unsigned DataLen) {
2157 using namespace llvm::support;
2159 endian::Writer
LE(Out, llvm::endianness::little);
2160 uint64_t Start = Out.tell(); (void)Start;
2162 unsigned char Flags = (
Data.AlreadyIncluded << 6)
2163 | (
Data.HFI.isImport << 5)
2165 Data.HFI.isPragmaOnce << 4)
2166 | (
Data.HFI.DirInfo << 1);
2167 LE.write<uint8_t>(Flags);
2169 if (
Data.HFI.LazyControllingMacro.isID())
2178 assert((
Value >> 3) == ModID &&
"overflow in header module info");
2183 for (
auto ModInfo :
Data.KnownHeaders)
2184 EmitModule(ModInfo.getModule(), ModInfo.getRole());
2185 if (
Data.Unresolved.getPointer())
2186 EmitModule(
Data.Unresolved.getPointer(),
Data.Unresolved.getInt());
2188 assert(Out.tell() - Start == DataLen &&
"Wrong data length");
2197void ASTWriter::WriteHeaderSearch(
const HeaderSearch &HS) {
2198 HeaderFileInfoTrait GeneratorTrait(*
this);
2199 llvm::OnDiskChainedHashTableGenerator<HeaderFileInfoTrait>
Generator;
2201 unsigned NumHeaderSearchEntries = 0;
2208 if (WritingModule) {
2210 while (!Worklist.empty()) {
2211 Module *M = Worklist.pop_back_val();
2228 if (!
U.Size || (!
U.ModTime && IncludeTimestamps)) {
2229 PP->
Diag(
U.FileNameLoc, diag::err_module_no_size_mtime_for_header)
2237 llvm::sys::path::append(
Filename,
U.FileName);
2240 StringRef FilenameDup = strdup(
Filename.c_str());
2241 SavedStrings.push_back(FilenameDup.data());
2243 HeaderFileInfoTrait::key_type Key = {
2244 FilenameDup, *
U.Size, IncludeTimestamps ? *
U.ModTime : 0};
2245 HeaderFileInfoTrait::data_type
Data = {
2250 ++NumHeaderSearchEntries;
2253 Worklist.append(SubmodulesRange.begin(), SubmodulesRange.end());
2263 for (
unsigned UID = 0, LastUID = FilesByUID.size(); UID != LastUID; ++UID) {
2282 Filename = StringRef(strdup(FilenameTmp.c_str()));
2283 SavedStrings.push_back(
Filename.data());
2288 HeaderFileInfoTrait::key_type Key = {
2291 HeaderFileInfoTrait::data_type
Data = {
2295 ++NumHeaderSearchEntries;
2302 using namespace llvm::support;
2304 llvm::raw_svector_ostream Out(TableData);
2306 endian::write<uint32_t>(Out, 0, llvm::endianness::little);
2307 BucketOffset =
Generator.Emit(Out, GeneratorTrait);
2311 using namespace llvm;
2313 auto Abbrev = std::make_shared<BitCodeAbbrev>();
2315 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
2316 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
2317 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
2318 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2319 unsigned TableAbbrev = Stream.EmitAbbrev(std::move(Abbrev));
2323 NumHeaderSearchEntries, TableData.size()};
2324 Stream.EmitRecordWithBlob(TableAbbrev,
Record, TableData);
2327 for (
unsigned I = 0, N = SavedStrings.size(); I != N; ++I)
2328 free(
const_cast<char *
>(SavedStrings[I]));
2331static void emitBlob(llvm::BitstreamWriter &Stream, StringRef Blob,
2332 unsigned SLocBufferBlobCompressedAbbrv,
2333 unsigned SLocBufferBlobAbbrv) {
2334 using RecordDataType = ASTWriter::RecordData::value_type;
2339 if (llvm::compression::zstd::isAvailable()) {
2340 llvm::compression::zstd::compress(
2341 llvm::arrayRefFromStringRef(Blob.drop_back(1)), CompressedBuffer, 9);
2343 Stream.EmitRecordWithBlob(SLocBufferBlobCompressedAbbrv,
Record,
2344 llvm::toStringRef(CompressedBuffer));
2347 if (llvm::compression::zlib::isAvailable()) {
2348 llvm::compression::zlib::compress(
2349 llvm::arrayRefFromStringRef(Blob.drop_back(1)), CompressedBuffer);
2351 Stream.EmitRecordWithBlob(SLocBufferBlobCompressedAbbrv,
Record,
2352 llvm::toStringRef(CompressedBuffer));
2357 Stream.EmitRecordWithBlob(SLocBufferBlobAbbrv,
Record, Blob);
2368void ASTWriter::WriteSourceManagerBlock(
SourceManager &SourceMgr) {
2373 const uint64_t SourceManagerBlockOffset = Stream.GetCurrentBitNo();
2379 unsigned SLocBufferBlobCompressedAbbrv =
2385 std::vector<uint32_t> SLocEntryOffsets;
2386 uint64_t SLocEntryOffsetsBase = Stream.GetCurrentBitNo();
2392 FileID FID = FileID::get(I);
2396 uint64_t Offset = Stream.GetCurrentBitNo() - SLocEntryOffsetsBase;
2397 assert((Offset >> 32) == 0 &&
"SLocEntry offset too large");
2403 if (
Cache->OrigEntry) {
2416 if (!IsSLocAffecting[I])
2418 SLocEntryOffsets.push_back(Offset);
2422 Record.push_back(
File.getFileCharacteristic());
2425 bool EmitBlob =
false;
2428 "Writing to AST an overridden file is not supported");
2431 assert(InputFileIDs[*Content->
OrigEntry] != 0 &&
"Missed file entry");
2434 Record.push_back(getAdjustedNumCreatedFIDs(FID));
2436 FileDeclIDsTy::iterator FDI = FileDeclIDs.find(FID);
2437 if (FDI != FileDeclIDs.end()) {
2438 Record.push_back(FDI->second->FirstDeclIndex);
2439 Record.push_back(FDI->second->DeclIDs.size());
2445 Stream.EmitRecordWithAbbrev(SLocFileAbbrv,
Record);
2456 std::optional<llvm::MemoryBufferRef> Buffer = Content->
getBufferOrNone(
2458 StringRef Name = Buffer ? Buffer->getBufferIdentifier() :
"";
2459 Stream.EmitRecordWithBlob(SLocBufferAbbrv,
Record,
2460 StringRef(Name.data(), Name.size() + 1));
2467 std::optional<llvm::MemoryBufferRef> Buffer = Content->
getBufferOrNone(
2470 Buffer = llvm::MemoryBufferRef(
"<<<INVALID BUFFER>>>",
"");
2471 StringRef Blob(Buffer->getBufferStart(), Buffer->getBufferSize() + 1);
2472 emitBlob(Stream, Blob, SLocBufferBlobCompressedAbbrv,
2473 SLocBufferBlobAbbrv);
2478 SLocEntryOffsets.push_back(Offset);
2493 Record.push_back(getAdjustedOffset(NextOffset - SLoc->
getOffset()) - 1);
2494 Stream.EmitRecordWithAbbrev(SLocExpansionAbbrv,
Record);
2500 if (SLocEntryOffsets.empty())
2505 using namespace llvm;
2507 auto Abbrev = std::make_shared<BitCodeAbbrev>();
2509 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 16));
2510 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 16));
2511 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 32));
2512 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2513 unsigned SLocOffsetsAbbrev = Stream.EmitAbbrev(std::move(Abbrev));
2515 RecordData::value_type
Record[] = {
2518 SLocEntryOffsetsBase - SourceManagerBlockOffset};
2519 Stream.EmitRecordWithBlob(SLocOffsetsAbbrev,
Record,
2520 bytes(SLocEntryOffsets));
2531 llvm::DenseMap<int, int> FilenameMap;
2532 FilenameMap[-1] = -1;
2533 for (
const auto &L : LineTable) {
2536 for (
auto &LE : L.second) {
2537 if (FilenameMap.insert(std::make_pair(
LE.FilenameID,
2538 FilenameMap.size() - 1)).second)
2545 for (
const auto &L : LineTable) {
2553 Record.push_back(L.second.size());
2554 for (
const auto &LE : L.second) {
2557 Record.push_back(FilenameMap[
LE.FilenameID]);
2558 Record.push_back((
unsigned)
LE.FileKind);
2559 Record.push_back(
LE.IncludeOffset);
2574 if (MI->isBuiltinMacro())
2590void ASTWriter::WritePreprocessor(
const Preprocessor &PP,
bool IsModule) {
2591 uint64_t MacroOffsetsBase = Stream.GetCurrentBitNo();
2595 WritePreprocessorDetail(*PPRec, MacroOffsetsBase);
2610 if (AssumeNonNullLoc.
isValid()) {
2624 Record.push_back(SkipInfo->FoundNonSkipPortion);
2625 Record.push_back(SkipInfo->FoundElse);
2632 Record.push_back(Cond.WasSkipping);
2633 Record.push_back(Cond.FoundNonSkip);
2634 Record.push_back(Cond.FoundElse);
2664 if (
Id.second->hadMacroDefinition() &&
2665 (!
Id.second->isFromAST() ||
2666 Id.second->hasChangedSinceDeserialization()))
2667 MacroIdentifiers.push_back(
Id.second);
2670 llvm::sort(MacroIdentifiers, llvm::deref<std::less<>>());
2676 uint64_t StartOffset = Stream.GetCurrentBitNo() - MacroOffsetsBase;
2677 assert((StartOffset >> 32) == 0 &&
"Macro identifiers offset too large");
2680 bool EmittedModuleMacros =
false;
2697 if (
auto *DefMD = dyn_cast<DefMacroDirective>(MD)) {
2699 }
else if (
auto *VisMD = dyn_cast<VisibilityMacroDirective>(MD)) {
2700 Record.push_back(VisMD->isPublic());
2702 ModuleMacroRecord.push_back(getSubmoduleID(WritingModule));
2705 ModuleMacroRecord.clear();
2706 EmittedModuleMacros =
true;
2716 if (
auto *DefMD = dyn_cast<DefMacroDirective>(MD)) {
2718 }
else if (
auto *VisMD = dyn_cast<VisibilityMacroDirective>(MD)) {
2719 Record.push_back(VisMD->isPublic());
2726 llvm::DenseMap<ModuleMacro *, unsigned> Visits;
2727 while (!Worklist.empty()) {
2728 auto *
Macro = Worklist.pop_back_val();
2731 ModuleMacroRecord.push_back(getSubmoduleID(
Macro->getOwningModule()));
2733 for (
auto *M :
Macro->overrides())
2734 ModuleMacroRecord.push_back(getSubmoduleID(M->getOwningModule()));
2737 ModuleMacroRecord.clear();
2740 for (
auto *M :
Macro->overrides())
2741 if (++Visits[M] == M->getNumOverridingMacros())
2742 Worklist.push_back(M);
2744 EmittedModuleMacros =
true;
2747 if (
Record.empty() && !EmittedModuleMacros)
2750 IdentMacroDirectivesOffsetMap[Name] = StartOffset;
2761 std::vector<uint32_t> MacroOffsets;
2763 for (
unsigned I = 0, N = MacroInfosToEmit.size(); I != N; ++I) {
2768 if (ID < FirstMacroID) {
2769 assert(0 &&
"Loaded MacroInfo entered MacroInfosToEmit ?");
2774 unsigned Index =
ID - FirstMacroID;
2775 if (Index >= MacroOffsets.size())
2776 MacroOffsets.resize(Index + 1);
2778 uint64_t Offset = Stream.GetCurrentBitNo() - MacroOffsetsBase;
2779 assert((Offset >> 32) == 0 &&
"Macro offset too large");
2780 MacroOffsets[Index] = Offset;
2807 Stream.EmitRecord(Code,
Record);
2811 for (
unsigned TokNo = 0, e = MI->
getNumTokens(); TokNo != e; ++TokNo) {
2826 using namespace llvm;
2828 auto Abbrev = std::make_shared<BitCodeAbbrev>();
2830 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
2831 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
2832 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 32));
2833 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2835 unsigned MacroOffsetAbbrev = Stream.EmitAbbrev(std::move(Abbrev));
2839 MacroOffsetsBase - ASTBlockStartOffset};
2840 Stream.EmitRecordWithBlob(MacroOffsetAbbrev,
Record,
bytes(MacroOffsets));
2845 uint64_t MacroOffsetsBase) {
2855 unsigned NumPreprocessingRecords = 0;
2856 using namespace llvm;
2859 unsigned InclusionAbbrev = 0;
2861 auto Abbrev = std::make_shared<BitCodeAbbrev>();
2863 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
2864 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2865 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2));
2866 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2867 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2868 InclusionAbbrev = Stream.EmitAbbrev(std::move(Abbrev));
2871 unsigned FirstPreprocessorEntityID
2872 = (Chain ? PPRec.getNumLoadedPreprocessedEntities() : 0)
2874 unsigned NextPreprocessorEntityID = FirstPreprocessorEntityID;
2879 (void)++
E, ++NumPreprocessingRecords, ++NextPreprocessorEntityID) {
2882 uint64_t Offset = Stream.GetCurrentBitNo() - MacroOffsetsBase;
2883 assert((Offset >> 32) == 0 &&
"Preprocessed entity offset too large");
2884 SourceRange R = getAdjustedRange((*E)->getSourceRange());
2885 PreprocessedEntityOffsets.emplace_back(
2889 if (
auto *MD = dyn_cast<MacroDefinitionRecord>(*
E)) {
2891 MacroDefinitions[MD] = NextPreprocessorEntityID;
2898 if (
auto *ME = dyn_cast<MacroExpansion>(*
E)) {
2899 Record.push_back(ME->isBuiltinMacro());
2900 if (ME->isBuiltinMacro())
2903 Record.push_back(MacroDefinitions[ME->getDefinition()]);
2908 if (
auto *ID = dyn_cast<InclusionDirective>(*
E)) {
2910 Record.push_back(
ID->getFileName().size());
2911 Record.push_back(
ID->wasInQuotes());
2912 Record.push_back(
static_cast<unsigned>(
ID->getKind()));
2913 Record.push_back(
ID->importedModule());
2915 Buffer +=
ID->getFileName();
2919 Buffer +=
ID->getFile()->getName();
2920 Stream.EmitRecordWithBlob(InclusionAbbrev,
Record, Buffer);
2924 llvm_unreachable(
"Unhandled PreprocessedEntity in ASTWriter");
2929 if (NumPreprocessingRecords > 0) {
2930 assert(PreprocessedEntityOffsets.size() == NumPreprocessingRecords);
2933 using namespace llvm;
2935 auto Abbrev = std::make_shared<BitCodeAbbrev>();
2937 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
2938 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2939 unsigned PPEOffsetAbbrev = Stream.EmitAbbrev(std::move(Abbrev));
2942 FirstPreprocessorEntityID -
2944 Stream.EmitRecordWithBlob(PPEOffsetAbbrev,
Record,
2945 bytes(PreprocessedEntityOffsets));
2950 if (SkippedRanges.size() > 0) {
2951 std::vector<PPSkippedRange> SerializedSkippedRanges;
2952 SerializedSkippedRanges.reserve(SkippedRanges.size());
2953 for (
auto const&
Range : SkippedRanges)
2954 SerializedSkippedRanges.emplace_back(
2958 using namespace llvm;
2959 auto Abbrev = std::make_shared<BitCodeAbbrev>();
2961 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2962 unsigned PPESkippedRangeAbbrev = Stream.EmitAbbrev(std::move(Abbrev));
2966 Stream.EmitRecordWithBlob(PPESkippedRangeAbbrev,
Record,
2967 bytes(SerializedSkippedRanges));
2975 auto Known = SubmoduleIDs.find(Mod);
2976 if (Known != SubmoduleIDs.end())
2977 return Known->second;
2980 if (Top != WritingModule &&
2982 !Top->fullModuleNameIs(StringRef(
getLangOpts().CurrentModule))))
2985 return SubmoduleIDs[Mod] = NextSubmoduleID++;
2988unsigned ASTWriter::getSubmoduleID(
Module *Mod) {
3001 unsigned ChildModules = 0;
3005 return ChildModules + 1;
3008void ASTWriter::WriteSubmodules(
Module *WritingModule,
ASTContext *Context) {
3013 using namespace llvm;
3015 auto Abbrev = std::make_shared<BitCodeAbbrev>();
3017 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
3018 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
3019 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 4));
3020 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));
3021 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 4));
3022 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
3023 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
3024 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
3025 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
3026 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
3027 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
3028 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
3029 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
3030 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
3031 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
3032 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
3033 unsigned DefinitionAbbrev = Stream.EmitAbbrev(std::move(Abbrev));
3035 Abbrev = std::make_shared<BitCodeAbbrev>();
3037 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
3038 unsigned UmbrellaAbbrev = Stream.EmitAbbrev(std::move(Abbrev));
3040 Abbrev = std::make_shared<BitCodeAbbrev>();
3042 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
3043 unsigned HeaderAbbrev = Stream.EmitAbbrev(std::move(Abbrev));
3045 Abbrev = std::make_shared<BitCodeAbbrev>();
3047 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
3048 unsigned TopHeaderAbbrev = Stream.EmitAbbrev(std::move(Abbrev));
3050 Abbrev = std::make_shared<BitCodeAbbrev>();
3052 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
3053 unsigned UmbrellaDirAbbrev = Stream.EmitAbbrev(std::move(Abbrev));
3055 Abbrev = std::make_shared<BitCodeAbbrev>();
3057 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
3058 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
3059 unsigned RequiresAbbrev = Stream.EmitAbbrev(std::move(Abbrev));
3061 Abbrev = std::make_shared<BitCodeAbbrev>();
3063 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
3064 unsigned ExcludedHeaderAbbrev = Stream.EmitAbbrev(std::move(Abbrev));
3066 Abbrev = std::make_shared<BitCodeAbbrev>();
3068 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
3069 unsigned TextualHeaderAbbrev = Stream.EmitAbbrev(std::move(Abbrev));
3071 Abbrev = std::make_shared<BitCodeAbbrev>();
3073 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
3074 unsigned PrivateHeaderAbbrev = Stream.EmitAbbrev(std::move(Abbrev));
3076 Abbrev = std::make_shared<BitCodeAbbrev>();
3078 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
3079 unsigned PrivateTextualHeaderAbbrev = Stream.EmitAbbrev(std::move(Abbrev));
3081 Abbrev = std::make_shared<BitCodeAbbrev>();
3083 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
3084 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
3085 unsigned LinkLibraryAbbrev = Stream.EmitAbbrev(std::move(Abbrev));
3087 Abbrev = std::make_shared<BitCodeAbbrev>();
3089 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
3090 unsigned ConfigMacroAbbrev = Stream.EmitAbbrev(std::move(Abbrev));
3092 Abbrev = std::make_shared<BitCodeAbbrev>();
3094 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
3095 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
3096 unsigned ConflictAbbrev = Stream.EmitAbbrev(std::move(Abbrev));
3098 Abbrev = std::make_shared<BitCodeAbbrev>();
3100 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
3101 unsigned ExportAsAbbrev = Stream.EmitAbbrev(std::move(Abbrev));
3104 RecordData::value_type
Record[] = {
3110 std::queue<Module *> Q;
3111 Q.push(WritingModule);
3112 while (!Q.empty()) {
3115 unsigned ID = getSubmoduleID(Mod);
3119 assert(SubmoduleIDs[Mod->
Parent] &&
"Submodule parent not written?");
3120 ParentID = SubmoduleIDs[Mod->
Parent];
3127 FileID UnadjustedInferredFID;
3130 int InferredFID = getAdjustedFileID(UnadjustedInferredFID).getOpaqueValue();
3137 (RecordData::value_type)Mod->
Kind,
3139 (RecordData::value_type)InferredFID,
3150 Stream.EmitRecordWithBlob(DefinitionAbbrev,
Record, Mod->
Name);
3156 Stream.EmitRecordWithBlob(RequiresAbbrev,
Record, R.FeatureName);
3160 if (std::optional<Module::Header> UmbrellaHeader =
3163 Stream.EmitRecordWithBlob(UmbrellaAbbrev,
Record,
3164 UmbrellaHeader->NameAsWritten);
3165 }
else if (std::optional<Module::DirectoryName> UmbrellaDir =
3168 Stream.EmitRecordWithBlob(UmbrellaDirAbbrev,
Record,
3169 UmbrellaDir->NameAsWritten);
3174 unsigned RecordKind;
3185 for (
const auto &HL : HeaderLists) {
3186 RecordData::value_type
Record[] = {HL.RecordKind};
3187 for (
const auto &H : Mod->
getHeaders(HL.HeaderKind))
3188 Stream.EmitRecordWithBlob(HL.Abbrev,
Record, H.NameAsWritten);
3197 Stream.EmitRecordWithBlob(TopHeaderAbbrev,
Record, HeaderName);
3205 Record.push_back(getSubmoduleID(I));
3213 Record.push_back(getSubmoduleID(I));
3220 for (
const auto &
E : Mod->
Exports) {
3223 Record.push_back(getSubmoduleID(
E.getPointer()));
3239 Stream.EmitRecordWithBlob(LinkLibraryAbbrev,
Record, LL.Library);
3247 getSubmoduleID(
C.Other)};
3248 Stream.EmitRecordWithBlob(ConflictAbbrev,
Record,
C.Message);
3254 Stream.EmitRecordWithBlob(ConfigMacroAbbrev,
Record, CM);
3281 assert((NextSubmoduleID - FirstSubmoduleID ==
3283 "Wrong # of submodules; found a reference to a non-local, "
3284 "non-imported submodule?");
3289 llvm::SmallDenseMap<const DiagnosticsEngine::DiagState *, unsigned, 64>
3291 unsigned CurrID = 0;
3294 auto EncodeDiagStateFlags =
3295 [](
const DiagnosticsEngine::DiagState *DS) ->
unsigned {
3298 {(
unsigned)DS->IgnoreAllWarnings, (
unsigned)DS->EnableAllWarnings,
3299 (
unsigned)DS->WarningsAsErrors, (
unsigned)DS->ErrorsAsFatal,
3300 (
unsigned)DS->SuppressSystemWarnings})
3305 unsigned Flags = EncodeDiagStateFlags(
Diag.DiagStatesByLoc.FirstDiagState);
3308 auto AddDiagState = [&](
const DiagnosticsEngine::DiagState *State,
3309 bool IncludeNonPragmaStates) {
3312 assert(Flags == EncodeDiagStateFlags(State) &&
3313 "diag state flags vary in single AST file");
3317 assert(!IncludeNonPragmaStates ||
3318 State ==
Diag.DiagStatesByLoc.FirstDiagState);
3320 unsigned &DiagStateID = DiagStateIDMap[State];
3321 Record.push_back(DiagStateID);
3323 if (DiagStateID == 0) {
3324 DiagStateID = ++CurrID;
3328 auto SizeIdx =
Record.size();
3330 for (
const auto &I : *State) {
3332 if (!I.second.isPragma() && !IncludeNonPragmaStates)
3336 if (!I.second.isPragma() &&
3337 I.second ==
Diag.getDiagnosticIDs()->getDefaultMapping(I.first))
3339 Mappings.push_back(I);
3343 llvm::sort(Mappings, llvm::less_first());
3345 for (
const auto &I : Mappings) {
3346 Record.push_back(I.first);
3347 Record.push_back(I.second.serialize());
3354 AddDiagState(
Diag.DiagStatesByLoc.FirstDiagState, isModule);
3357 auto NumLocationsIdx =
Record.size();
3361 unsigned NumLocations = 0;
3362 for (
auto &FileIDAndFile :
Diag.DiagStatesByLoc.Files) {
3363 if (!FileIDAndFile.first.isValid() ||
3364 !FileIDAndFile.second.HasLocalTransitions)
3370 Record.push_back(FileIDAndFile.second.StateTransitions.size());
3371 for (
auto &StatePoint : FileIDAndFile.second.StateTransitions) {
3372 Record.push_back(getAdjustedOffset(StatePoint.Offset));
3373 AddDiagState(StatePoint.State,
false);
3378 Record[NumLocationsIdx] = NumLocations;
3387 AddDiagState(
Diag.DiagStatesByLoc.CurDiagState,
false);
3400 IdxRef =
TypeIdx(0, NextTypeID++);
3404 assert(Idx.
getValue() >= FirstTypeID &&
"Writing predefined type");
3408 ASTTypeWriter(Context, *
this).write(
T) - DeclTypesBlockStartOffset;
3412 if (TypeOffsets.size() == Index)
3413 TypeOffsets.emplace_back(Offset);
3414 else if (TypeOffsets.size() < Index) {
3415 TypeOffsets.resize(Index + 1);
3416 TypeOffsets[Index].set(Offset);
3418 llvm_unreachable(
"Types emitted in wrong order");
3427 auto *ND = dyn_cast<NamedDecl>(
D);
3451 uint64_t Offset = Stream.GetCurrentBitNo();
3453 for (
const auto *
D : DC->
decls()) {
3466 KindDeclPairs.push_back(
D->
getKind());
3467 KindDeclPairs.push_back(
GetDeclRef(
D).getRawValue());
3470 ++NumLexicalDeclContexts;
3472 Stream.EmitRecordWithBlob(DeclContextLexicalAbbrev,
Record,
3473 bytes(KindDeclPairs));
3477void ASTWriter::WriteTypeDeclOffsets() {
3478 using namespace llvm;
3481 auto Abbrev = std::make_shared<BitCodeAbbrev>();
3483 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
3484 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
3485 unsigned TypeOffsetAbbrev = Stream.EmitAbbrev(std::move(Abbrev));
3488 Stream.EmitRecordWithBlob(TypeOffsetAbbrev,
Record,
bytes(TypeOffsets));
3492 Abbrev = std::make_shared<BitCodeAbbrev>();
3494 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
3495 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
3496 unsigned DeclOffsetAbbrev = Stream.EmitAbbrev(std::move(Abbrev));
3499 Stream.EmitRecordWithBlob(DeclOffsetAbbrev,
Record,
bytes(DeclOffsets));
3503void ASTWriter::WriteFileDeclIDsMap() {
3504 using namespace llvm;
3507 SortedFileDeclIDs.reserve(FileDeclIDs.size());
3508 for (
const auto &
P : FileDeclIDs)
3509 SortedFileDeclIDs.push_back(std::make_pair(
P.first,
P.second.get()));
3510 llvm::sort(SortedFileDeclIDs, llvm::less_first());
3514 for (
auto &FileDeclEntry : SortedFileDeclIDs) {
3515 DeclIDInFileInfo &Info = *FileDeclEntry.second;
3516 Info.FirstDeclIndex = FileGroupedDeclIDs.size();
3517 llvm::stable_sort(Info.DeclIDs);
3518 for (
auto &LocDeclEntry : Info.DeclIDs)
3519 FileGroupedDeclIDs.push_back(LocDeclEntry.second.getRawValue());
3522 auto Abbrev = std::make_shared<BitCodeAbbrev>();
3524 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
3525 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
3526 unsigned AbbrevCode = Stream.EmitAbbrev(std::move(Abbrev));
3528 FileGroupedDeclIDs.size()};
3529 Stream.EmitRecordWithBlob(AbbrevCode,
Record,
bytes(FileGroupedDeclIDs));
3532void ASTWriter::WriteComments(
ASTContext &Context) {
3534 auto _ = llvm::make_scope_exit([
this] { Stream.ExitBlock(); });
3545 for (
const auto &FO : Context.
Comments.OrderedComments) {
3546 for (
const auto &OC : FO.second) {
3565class ASTMethodPoolTrait {
3570 using key_type_ref = key_type;
3576 using data_type_ref =
const data_type &;
3581 explicit ASTMethodPoolTrait(
ASTWriter &Writer) : Writer(Writer) {}
3587 std::pair<unsigned, unsigned>
3588 EmitKeyDataLength(raw_ostream& Out,
Selector Sel,
3589 data_type_ref Methods) {
3593 unsigned DataLen = 4 + 2 + 2;
3595 Method =
Method->getNext())
3596 if (ShouldWriteMethodListNode(Method))
3597 DataLen +=
sizeof(
DeclID);
3599 Method =
Method->getNext())
3600 if (ShouldWriteMethodListNode(Method))
3601 DataLen +=
sizeof(
DeclID);
3605 void EmitKey(raw_ostream& Out,
Selector Sel,
unsigned) {
3606 using namespace llvm::support;
3608 endian::Writer
LE(Out, llvm::endianness::little);
3610 assert((Start >> 32) == 0 &&
"Selector key offset too large");
3613 LE.write<uint16_t>(N);
3616 for (
unsigned I = 0; I != N; ++I)
3621 void EmitData(raw_ostream& Out, key_type_ref,
3622 data_type_ref Methods,
unsigned DataLen) {
3623 using namespace llvm::support;
3625 endian::Writer
LE(Out, llvm::endianness::little);
3626 uint64_t Start = Out.tell(); (void)Start;
3628 unsigned NumInstanceMethods = 0;
3630 Method =
Method->getNext())
3631 if (ShouldWriteMethodListNode(Method))
3632 ++NumInstanceMethods;
3634 unsigned NumFactoryMethods = 0;
3636 Method =
Method->getNext())
3637 if (ShouldWriteMethodListNode(Method))
3638 ++NumFactoryMethods;
3640 unsigned InstanceBits = Methods.Instance.getBits();
3641 assert(InstanceBits < 4);
3642 unsigned InstanceHasMoreThanOneDeclBit =
3643 Methods.Instance.hasMoreThanOneDecl();
3644 unsigned FullInstanceBits = (NumInstanceMethods << 3) |
3645 (InstanceHasMoreThanOneDeclBit << 2) |
3647 unsigned FactoryBits = Methods.Factory.getBits();
3648 assert(FactoryBits < 4);
3649 unsigned FactoryHasMoreThanOneDeclBit =
3650 Methods.Factory.hasMoreThanOneDecl();
3651 unsigned FullFactoryBits = (NumFactoryMethods << 3) |
3652 (FactoryHasMoreThanOneDeclBit << 2) |
3654 LE.write<uint16_t>(FullInstanceBits);
3655 LE.write<uint16_t>(FullFactoryBits);
3657 Method =
Method->getNext())
3658 if (ShouldWriteMethodListNode(Method))
3661 Method =
Method->getNext())
3662 if (ShouldWriteMethodListNode(Method))
3665 assert(Out.tell() - Start == DataLen &&
"Data length is wrong");
3670 return (
Node->getMethod() && !
Node->getMethod()->isFromASTFile());
3681void ASTWriter::WriteSelectors(
Sema &SemaRef) {
3682 using namespace llvm;
3687 unsigned NumTableEntries = 0;
3690 llvm::OnDiskChainedHashTableGenerator<ASTMethodPoolTrait>
Generator;
3691 ASTMethodPoolTrait Trait(*
this);
3695 SelectorOffsets.resize(NextSelectorID - FirstSelectorID);
3696 for (
auto &SelectorAndID : SelectorIDs) {
3699 SemaObjC::GlobalMethodPool::iterator F =
3701 ASTMethodPoolTrait::data_type
Data = {
3707 Data.Instance = F->second.first;
3708 Data.Factory = F->second.second;
3712 if (Chain && ID < FirstSelectorID) {
3714 bool changed =
false;
3717 if (!M->getMethod()->isFromASTFile()) {
3725 if (!M->getMethod()->isFromASTFile()) {
3733 }
else if (
Data.Instance.getMethod() ||
Data.Factory.getMethod()) {
3744 using namespace llvm::support;
3746 ASTMethodPoolTrait Trait(*
this);
3747 llvm::raw_svector_ostream Out(MethodPool);
3749 endian::write<uint32_t>(Out, 0, llvm::endianness::little);
3750 BucketOffset =
Generator.Emit(Out, Trait);
3754 auto Abbrev = std::make_shared<BitCodeAbbrev>();
3756 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
3757 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
3758 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
3759 unsigned MethodPoolAbbrev = Stream.EmitAbbrev(std::move(Abbrev));
3765 Stream.EmitRecordWithBlob(MethodPoolAbbrev,
Record, MethodPool);
3769 Abbrev = std::make_shared<BitCodeAbbrev>();
3771 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
3772 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
3773 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
3774 unsigned SelectorOffsetAbbrev = Stream.EmitAbbrev(std::move(Abbrev));
3778 RecordData::value_type
Record[] = {
3781 Stream.EmitRecordWithBlob(SelectorOffsetAbbrev,
Record,
3782 bytes(SelectorOffsets));
3788void ASTWriter::WriteReferencedSelectorsPool(
Sema &SemaRef) {
3789 using namespace llvm;
3801 Selector Sel = SelectorAndLocation.first;
3803 Writer.AddSelectorRef(Sel);
3825 for (; Redecl; Redecl = Redecl->getPreviousDecl()) {
3827 if (!Redecl->isFromASTFile()) {
3831 if (!Redecl->getDeclContext()->getRedeclContext()->Equals(
3834 return cast<NamedDecl>(Redecl);
3839 if (Redecl->getOwningModuleID() == 0)
3844 if (!
First->isFromASTFile())
3845 return cast<NamedDecl>(
First);
3855bool IsInterestingIdentifier(
const IdentifierInfo *II, uint64_t MacroOffset,
3856 bool IsModule,
bool IsCPlusPlus) {
3857 bool NeedDecls = !IsModule || !IsCPlusPlus;
3859 bool IsInteresting =
3866 II->
isPoisoned() || (!IsModule && IsInteresting) ||
3877 bool IsCPlusPlus = Writer.
getLangOpts().CPlusPlus;
3878 return IsInterestingIdentifier(II, 0, IsModule, IsCPlusPlus);
3881class ASTIdentifierTableTrait {
3894 return IsInterestingIdentifier(II, MacroOffset, IsModule,
3900 using key_type_ref = key_type;
3903 using data_type_ref = data_type;
3911 : Writer(Writer), PP(PP), IdResolver(IdResolver), IsModule(IsModule),
3912 NeedDecls(!IsModule || !Writer.getLangOpts().
CPlusPlus),
3913 InterestingIdentifierOffsets(InterestingIdentifierOffsets) {}
3915 bool needDecls()
const {
return NeedDecls; }
3918 return llvm::djbHash(II->
getName());
3926 std::pair<unsigned, unsigned>
3936 if (InterestingIdentifierOffsets &&
3938 InterestingIdentifierOffsets->push_back(Out.tell());
3949 if (NeedDecls && IdResolver)
3950 DataLen += std::distance(IdResolver->
begin(II), IdResolver->
end()) *
3956 void EmitKey(raw_ostream &Out,
const IdentifierInfo *II,
unsigned KeyLen) {
3962 using namespace llvm::support;
3964 endian::Writer
LE(Out, llvm::endianness::little);
3974 assert((Bits & 0xffff) == Bits &&
"ObjCOrBuiltinID too big for ASTReader.");
3975 LE.write<uint16_t>(Bits);
3977 bool HasMacroDefinition =
3980 Bits = (Bits << 1) |
unsigned(HasMacroDefinition);
3982 Bits = (Bits << 1) |
unsigned(II->
isPoisoned());
3985 LE.write<uint16_t>(Bits);
3987 if (HasMacroDefinition)
3990 if (NeedDecls && IdResolver) {
4019 using namespace llvm;
4026 llvm::OnDiskChainedHashTableGenerator<ASTIdentifierTableTrait>
Generator;
4027 ASTIdentifierTableTrait Trait(*
this, PP, IdResolver, IsModule,
4028 IsModule ? &InterestingIdents :
nullptr);
4032 IdentifierOffsets.resize(NextIdentID - FirstIdentID);
4033 for (
auto IdentIDPair : IdentifierIDs) {
4036 assert(II &&
"NULL identifier in identifier table");
4041 (Trait.needDecls() &&
4050 using namespace llvm::support;
4054 endian::write<uint32_t>(Out, 0, llvm::endianness::little);
4055 BucketOffset =
Generator.Emit(Out, Trait);
4059 auto Abbrev = std::make_shared<BitCodeAbbrev>();
4061 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
4062 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
4063 unsigned IDTableAbbrev = Stream.EmitAbbrev(std::move(Abbrev));
4071 auto Abbrev = std::make_shared<BitCodeAbbrev>();
4073 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
4074 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
4075 unsigned IdentifierOffsetAbbrev = Stream.EmitAbbrev(std::move(Abbrev));
4078 for (
unsigned I = 0, N = IdentifierOffsets.size(); I != N; ++I)
4079 assert(IdentifierOffsets[I] &&
"Missing identifier offset?");
4083 IdentifierOffsets.size()};
4084 Stream.EmitRecordWithBlob(IdentifierOffsetAbbrev,
Record,
4085 bytes(IdentifierOffsets));
4089 if (!InterestingIdents.empty())
4097 PendingEmittingVTables.push_back(RD);
4101 TouchedModuleFiles.insert(MF);
4110class ASTDeclContextNameLookupTraitBase {
4118 using data_type = std::pair<unsigned, unsigned>;
4119 using data_type_ref =
const data_type &;
4124 explicit ASTDeclContextNameLookupTraitBase(
ASTWriter &Writer)
4127 data_type getData(
const DeclIDsTy &LocalIDs) {
4128 unsigned Start = DeclIDs.size();
4129 for (
auto ID : LocalIDs)
4130 DeclIDs.push_back(
ID);
4131 return std::make_pair(Start, DeclIDs.size());
4135 unsigned Start = DeclIDs.size();
4140 return std::make_pair(Start, DeclIDs.size());
4143 void EmitFileRef(raw_ostream &Out,
ModuleFile *F)
const {
4145 "have reference to loaded module file but no chain?");
4147 using namespace llvm::support;
4150 llvm::endianness::little);
4153 std::pair<unsigned, unsigned> EmitKeyDataLengthBase(raw_ostream &Out,
4155 data_type_ref Lookup) {
4156 unsigned KeyLen = 1;
4157 switch (Name.getKind()) {
4179 unsigned DataLen =
sizeof(
DeclID) * (Lookup.second - Lookup.first);
4181 return {KeyLen, DataLen};
4185 using namespace llvm::support;
4187 endian::Writer
LE(Out, llvm::endianness::little);
4188 LE.write<uint8_t>(Name.getKind());
4189 switch (Name.getKind()) {
4202 "Invalid operator?");
4203 LE.write<uint8_t>(Name.getOperatorKind());
4212 llvm_unreachable(
"Invalid name kind?");
4215 void EmitDataBase(raw_ostream &Out, data_type Lookup,
unsigned DataLen) {
4216 using namespace llvm::support;
4218 endian::Writer
LE(Out, llvm::endianness::little);
4219 uint64_t Start = Out.tell(); (void)Start;
4220 for (
unsigned I = Lookup.first, N = Lookup.second; I != N; ++I)
4222 assert(Out.tell() - Start == DataLen &&
"Data length is wrong");
4226class ModuleLevelNameLookupTrait :
public ASTDeclContextNameLookupTraitBase {
4228 using primary_module_hash_type =
unsigned;
4230 using key_type = std::pair<DeclarationNameKey, primary_module_hash_type>;
4231 using key_type_ref = key_type;
4233 explicit ModuleLevelNameLookupTrait(
ASTWriter &Writer)
4234 : ASTDeclContextNameLookupTraitBase(Writer) {}
4236 static bool EqualKey(key_type_ref a, key_type_ref
b) {
return a ==
b; }
4239 llvm::FoldingSetNodeID
ID;
4240 ID.AddInteger(Key.first.getHash());
4241 ID.AddInteger(Key.second);
4242 return ID.computeStableHash();
4245 std::pair<unsigned, unsigned>
4246 EmitKeyDataLength(raw_ostream &Out, key_type Key, data_type_ref Lookup) {
4247 auto [KeyLen, DataLen] = EmitKeyDataLengthBase(Out, Key.first, Lookup);
4248 KeyLen +=
sizeof(Key.second);
4252 void EmitKey(raw_ostream &Out, key_type Key,
unsigned) {
4253 EmitKeyBase(Out, Key.first);
4254 llvm::support::endian::Writer
LE(Out, llvm::endianness::little);
4255 LE.write<primary_module_hash_type>(Key.second);
4258 void EmitData(raw_ostream &Out, key_type_ref, data_type Lookup,
4260 EmitDataBase(Out, Lookup, DataLen);
4264class ASTDeclContextNameTrivialLookupTrait
4265 :
public ASTDeclContextNameLookupTraitBase {
4268 using key_type_ref = key_type;
4271 using ASTDeclContextNameLookupTraitBase::ASTDeclContextNameLookupTraitBase;
4273 using ASTDeclContextNameLookupTraitBase::getData;
4275 static bool EqualKey(key_type_ref a, key_type_ref
b) {
return a ==
b; }
4277 hash_value_type
ComputeHash(key_type Name) {
return Name.getHash(); }
4279 std::pair<unsigned, unsigned> EmitKeyDataLength(raw_ostream &Out,
4281 data_type_ref Lookup) {
4282 auto [KeyLen, DataLen] = EmitKeyDataLengthBase(Out, Name, Lookup);
4287 return EmitKeyBase(Out, Name);
4290 void EmitData(raw_ostream &Out, key_type_ref, data_type Lookup,
4292 EmitDataBase(Out, Lookup, DataLen);
4301 return isModuleLocalDecl(
Parent);
4305 if (
auto *FTD = dyn_cast<FunctionTemplateDecl>(
D))
4306 if (
auto *CDGD = dyn_cast<CXXDeductionGuideDecl>(FTD->getTemplatedDecl()))
4307 return isModuleLocalDecl(CDGD->getDeducedTemplate());
4315static bool isTULocalInNamedModules(
NamedDecl *
D) {
4338class ASTDeclContextNameLookupTrait
4339 :
public ASTDeclContextNameTrivialLookupTrait {
4341 using TULocalDeclsMapTy = llvm::DenseMap<key_type, DeclIDsTy>;
4343 using ModuleLevelDeclsMapTy =
4344 llvm::DenseMap<ModuleLevelNameLookupTrait::key_type, DeclIDsTy>;
4347 enum class LookupVisibility {
4357 LookupVisibility getLookupVisibility(
NamedDecl *
D)
const {
4360 return LookupVisibility::GenerallyVisibile;
4362 if (isModuleLocalDecl(
D))
4363 return LookupVisibility::ModuleLocalVisible;
4364 if (isTULocalInNamedModules(
D))
4365 return LookupVisibility::TULocal;
4377 if (
auto *ECD = dyn_cast<EnumConstantDecl>(
D);
4379 ECD->getTopLevelOwningNamedModule()->isNamedModule()) {
4382 cast<EnumDecl>(ECD->getDeclContext())->getDeclName()),
4384 return Found->isInvisibleOutsideTheOwningModule();
4386 return ECD->isFromExplicitGlobalModule() ||
4387 ECD->isInAnonymousNamespace()
4388 ? LookupVisibility::TULocal
4389 : LookupVisibility::ModuleLocalVisible;
4392 return LookupVisibility::GenerallyVisibile;
4396 ModuleLevelDeclsMapTy ModuleLocalDeclsMap;
4397 TULocalDeclsMapTy TULocalDeclsMap;
4400 using ASTDeclContextNameTrivialLookupTrait::
4401 ASTDeclContextNameTrivialLookupTrait;
4404 : ASTDeclContextNameTrivialLookupTrait(Writer), DC(DC) {}
4406 template <
typename Coll> data_type getData(
const Coll &Decls) {
4407 unsigned Start = DeclIDs.size();
4425 switch (getLookupVisibility(DeclForLocalLookup)) {
4426 case LookupVisibility::ModuleLocalVisible:
4429 auto Key = std::make_pair(
D->getDeclName(), *PrimaryModuleHash);
4430 auto Iter = ModuleLocalDeclsMap.find(Key);
4431 if (
Iter == ModuleLocalDeclsMap.end())
4432 ModuleLocalDeclsMap.insert({Key, DeclIDsTy{
ID}});
4434 Iter->second.push_back(
ID);
4438 case LookupVisibility::TULocal: {
4439 auto Iter = TULocalDeclsMap.find(
D->getDeclName());
4440 if (
Iter == TULocalDeclsMap.end())
4441 TULocalDeclsMap.insert({
D->getDeclName(), DeclIDsTy{
ID}});
4443 Iter->second.push_back(
ID);
4446 case LookupVisibility::GenerallyVisibile:
4451 DeclIDs.push_back(
ID);
4453 return std::make_pair(Start, DeclIDs.size());
4456 const ModuleLevelDeclsMapTy &getModuleLocalDecls() {
4457 return ModuleLocalDeclsMap;
4460 const TULocalDeclsMapTy &getTULocalDecls() {
return TULocalDeclsMap; }
4466class LazySpecializationInfoLookupTrait {
4472 using key_type_ref = key_type;
4475 using data_type = std::pair<unsigned, unsigned>;
4476 using data_type_ref =
const data_type &;
4481 explicit LazySpecializationInfoLookupTrait(
ASTWriter &Writer)
4484 template <
typename Col,
typename Col2>
4485 data_type getData(Col &&
C, Col2 &ExistingInfo) {
4486 unsigned Start = Specs.size();
4494 Specs.push_back(Info);
4495 return std::make_pair(Start, Specs.size());
4498 data_type ImportData(
4500 unsigned Start = Specs.size();
4501 for (
auto ID : FromReader)
4502 Specs.push_back(
ID);
4503 return std::make_pair(Start, Specs.size());
4506 static bool EqualKey(key_type_ref a, key_type_ref
b) {
return a ==
b; }
4508 hash_value_type
ComputeHash(key_type Name) {
return Name; }
4510 void EmitFileRef(raw_ostream &Out,
ModuleFile *F)
const {
4512 "have reference to loaded module file but no chain?");
4514 using namespace llvm::support;
4517 llvm::endianness::little);
4520 std::pair<unsigned, unsigned> EmitKeyDataLength(raw_ostream &Out,
4522 data_type_ref Lookup) {
4524 unsigned KeyLen = 4;
4526 (Lookup.second - Lookup.first);
4531 void EmitKey(raw_ostream &Out, key_type HashValue,
unsigned) {
4532 using namespace llvm::support;
4534 endian::Writer
LE(Out, llvm::endianness::little);
4538 void EmitData(raw_ostream &Out, key_type_ref, data_type Lookup,
4540 using namespace llvm::support;
4542 endian::Writer
LE(Out, llvm::endianness::little);
4545 for (
unsigned I = Lookup.first, N = Lookup.second; I != N; ++I) {
4546 LE.write<
DeclID>(Specs[I].getRawValue());
4548 assert(Out.tell() - Start == DataLen &&
"Data length is wrong");
4552unsigned CalculateODRHashForSpecs(
const Decl *Spec) {
4554 if (
auto *CTSD = dyn_cast<ClassTemplateSpecializationDecl>(Spec))
4555 Args = CTSD->getTemplateArgs().asArray();
4556 else if (
auto *VTSD = dyn_cast<VarTemplateSpecializationDecl>(Spec))
4557 Args = VTSD->getTemplateArgs().asArray();
4558 else if (
auto *FD = dyn_cast<FunctionDecl>(Spec))
4559 Args = FD->getTemplateSpecializationArgs()->asArray();
4561 llvm_unreachable(
"New Specialization Kind?");
4567void ASTWriter::GenerateSpecializationInfoLookupTable(
4574 LazySpecializationInfoLookupTrait>
4576 LazySpecializationInfoLookupTrait Trait(*
this);
4578 llvm::MapVector<unsigned, llvm::SmallVector<const NamedDecl *, 4>>
4584 auto Iter = SpecializationMaps.find(HashedValue);
4585 if (
Iter == SpecializationMaps.end())
4586 Iter = SpecializationMaps
4587 .try_emplace(HashedValue,
4598 for (
auto &[HashValue, Specs] : SpecializationMaps) {
4609 ExisitingSpecs = Lookups->Table.find(HashValue);
4611 Generator.insert(HashValue, Trait.getData(Specs, ExisitingSpecs), Trait);
4614 Generator.emit(LookupTable, Trait, Lookups ? &Lookups->Table :
nullptr);
4617uint64_t ASTWriter::WriteSpecializationInfoLookupTable(
4622 GenerateSpecializationInfoLookupTable(
D, Specializations, LookupTable,
4625 uint64_t Offset = Stream.GetCurrentBitNo();
4626 RecordData::value_type
Record[] = {
static_cast<RecordData::value_type
>(
4628 Stream.EmitRecordWithBlob(IsPartial ? DeclPartialSpecializationsAbbrev
4629 : DeclSpecializationsAbbrev,
4641 for (
auto *
D :
Result.getLookupResult()) {
4643 if (LocalD->isFromASTFile())
4661void ASTWriter::GenerateNameLookupTable(
4666 assert(!ConstDC->hasLazyLocalLexicalLookups() &&
4667 !ConstDC->hasLazyExternalLexicalLookups() &&
4668 "must call buildLookups first");
4676 ASTDeclContextNameLookupTrait>
4678 ASTDeclContextNameLookupTrait Trait(*
this, *DC);
4687 bool IncludeConstructorNames =
false;
4688 bool IncludeConversionNames =
false;
4715 if (
Result.getLookupResult().empty())
4718 switch (Name.getNameKind()) {
4720 Names.push_back(Name);
4724 IncludeConstructorNames =
true;
4728 IncludeConversionNames =
true;
4736 if (IncludeConstructorNames || IncludeConversionNames) {
4742 for (
Decl *ChildD : cast<CXXRecordDecl>(DC)->decls()) {
4743 if (
auto *ChildND = dyn_cast<NamedDecl>(ChildD)) {
4744 auto Name = ChildND->getDeclName();
4745 switch (Name.getNameKind()) {
4750 if (!IncludeConstructorNames)
4755 if (!IncludeConversionNames)
4759 if (AddedNames.insert(Name).second)
4760 Names.push_back(Name);
4768 for (
auto &Name : Names)
4780 for (
auto &Name : Names) {
4783 switch (Name.getNameKind()) {
4801 if (!ConstructorDecls.empty())
4802 Generator.insert(ConstructorDecls.front()->getDeclName(),
4803 Trait.getData(ConstructorDecls), Trait);
4804 if (!ConversionDecls.empty())
4805 Generator.insert(ConversionDecls.front()->getDeclName(),
4806 Trait.getData(ConversionDecls), Trait);
4811 Generator.emit(LookupTable, Trait, Lookups ? &Lookups->Table :
nullptr);
4813 const auto &ModuleLocalDecls = Trait.getModuleLocalDecls();
4814 if (!ModuleLocalDecls.empty()) {
4816 ModuleLevelNameLookupTrait>
4817 ModuleLocalLookupGenerator;
4818 ModuleLevelNameLookupTrait ModuleLocalTrait(*
this);
4820 for (
const auto &ModuleLocalIter : ModuleLocalDecls) {
4821 const auto &Key = ModuleLocalIter.first;
4822 const auto &IDs = ModuleLocalIter.second;
4823 ModuleLocalLookupGenerator.insert(Key, ModuleLocalTrait.getData(IDs),
4827 auto *ModuleLocalLookups =
4829 ModuleLocalLookupGenerator.emit(
4830 ModuleLocalLookupTable, ModuleLocalTrait,
4831 ModuleLocalLookups ? &ModuleLocalLookups->Table :
nullptr);
4834 const auto &TULocalDecls = Trait.getTULocalDecls();
4837 ASTDeclContextNameTrivialLookupTrait>
4839 ASTDeclContextNameTrivialLookupTrait TULocalTrait(*
this);
4841 for (
const auto &TULocalIter : TULocalDecls) {
4842 const auto &Key = TULocalIter.first;
4843 const auto &IDs = TULocalIter.second;
4844 TULookupGenerator.insert(Key, TULocalTrait.getData(IDs), TULocalTrait);
4848 TULookupGenerator.emit(TULookupTable, TULocalTrait,
4849 TULocalLookups ? &TULocalLookups->Table :
nullptr);
4858void ASTWriter::WriteDeclContextVisibleBlock(
4865 if (isa<NamespaceDecl>(DC) && Chain &&
4868 for (
auto *Prev = cast<NamespaceDecl>(DC)->getPreviousDecl(); Prev;
4869 Prev = Prev->getPreviousDecl())
4870 if (!Prev->isFromASTFile())
4883 LookupResults.reserve(Map->size());
4884 for (
auto &Entry : *Map)
4885 LookupResults.push_back(
4886 std::make_pair(Entry.first, Entry.second.getLookupResult()));
4889 llvm::sort(LookupResults, llvm::less_first());
4890 for (
auto &NameAndResult : LookupResults) {
4898 assert(
Result.empty() &&
"Cannot have a constructor or conversion "
4899 "function name in a namespace!");
4941 if (!Map || Map->empty())
4949 GenerateNameLookupTable(Context, DC, LookupTable, ModuleLocalLookupTable,
4954 Stream.EmitRecordWithBlob(DeclContextVisibleLookupAbbrev,
Record,
4956 ++NumVisibleDeclContexts;
4958 if (!ModuleLocalLookupTable.empty()) {
4962 RecordData::value_type ModuleLocalRecord[] = {
4964 Stream.EmitRecordWithBlob(DeclModuleLocalVisibleLookupAbbrev,
4965 ModuleLocalRecord, ModuleLocalLookupTable);
4966 ++NumModuleLocalDeclContexts;
4969 if (!TULookupTable.empty()) {
4972 RecordData::value_type TULocalDeclsRecord[] = {
4974 Stream.EmitRecordWithBlob(DeclTULocalLookupAbbrev, TULocalDeclsRecord,
4976 ++NumTULocalDeclContexts;
4986void ASTWriter::WriteDeclContextVisibleUpdate(
ASTContext &Context,
4989 if (!Map || Map->empty())
4996 GenerateNameLookupTable(Context, DC, LookupTable, ModuleLocalLookupTable,
5001 if (isa<NamespaceDecl>(DC))
5007 Stream.EmitRecordWithBlob(UpdateVisibleAbbrev,
Record, LookupTable);
5009 if (!ModuleLocalLookupTable.empty()) {
5011 RecordData::value_type ModuleLocalRecord[] = {
5013 Stream.EmitRecordWithBlob(ModuleLocalUpdateVisibleAbbrev, ModuleLocalRecord,
5014 ModuleLocalLookupTable);
5017 if (!TULookupTable.empty()) {
5018 RecordData::value_type GMFRecord[] = {
5020 Stream.EmitRecordWithBlob(TULocalUpdateVisibleAbbrev, GMFRecord,
5032void ASTWriter::WriteOpenCLExtensions(
Sema &SemaRef) {
5038 for (
const auto &I:Opts.OptMap) {
5040 auto V = I.getValue();
5041 Record.push_back(
V.Supported ? 1 : 0);
5042 Record.push_back(
V.Enabled ? 1 : 0);
5043 Record.push_back(
V.WithPragma ? 1 : 0);
5050void ASTWriter::WriteCUDAPragmas(
Sema &SemaRef) {
5051 if (SemaRef.
CUDA().ForceHostDeviceDepth > 0) {
5052 RecordData::value_type
Record[] = {SemaRef.
CUDA().ForceHostDeviceDepth};
5057void ASTWriter::WriteObjCCategories() {
5058 if (ObjCClassesWithCategories.empty())
5064 for (
unsigned I = 0, N = ObjCClassesWithCategories.size(); I != N; ++I) {
5066 unsigned StartIndex = Categories.size();
5071 Categories.push_back(0);
5075 Cat =
Class->known_categories_begin(),
5076 CatEnd =
Class->known_categories_end();
5077 Cat != CatEnd; ++Cat, ++Size) {
5083 Categories[StartIndex] =
Size;
5087 CategoriesMap.push_back(CatInfo);
5092 llvm::array_pod_sort(CategoriesMap.begin(), CategoriesMap.end());
5095 using namespace llvm;
5097 auto Abbrev = std::make_shared<BitCodeAbbrev>();
5099 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
5100 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
5101 unsigned AbbrevID = Stream.EmitAbbrev(std::move(Abbrev));
5104 Stream.EmitRecordWithBlob(AbbrevID,
Record,
5105 reinterpret_cast<char *
>(CategoriesMap.data()),
5112void ASTWriter::WriteLateParsedTemplates(
Sema &SemaRef) {
5119 for (
auto &LPTMapEntry : LPTMap) {
5127 for (
const auto &Tok : LPT.
Toks) {
5135void ASTWriter::WriteOptimizePragmaOptions(
Sema &SemaRef) {
5143void ASTWriter::WriteMSStructPragmaOptions(
Sema &SemaRef) {
5151void ASTWriter::WriteMSPointersToMembersPragmaOptions(
Sema &SemaRef) {
5159void ASTWriter::WritePackPragmaOptions(
Sema &SemaRef) {
5179void ASTWriter::WriteFloatControlPragmaOptions(
Sema &SemaRef) {
5189 for (
const auto &StackEntry : SemaRef.
FpPragmaStack.Stack) {
5190 Record.push_back(StackEntry.Value.getAsOpaqueInt());
5199void ASTWriter::WriteDeclsWithEffectsToVerify(
Sema &SemaRef) {
5209void ASTWriter::WriteModuleFileExtension(
Sema &SemaRef,
5215 auto Abv = std::make_shared<llvm::BitCodeAbbrev>();
5217 Abv->Add(llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::VBR, 6));
5218 Abv->Add(llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::VBR, 6));
5219 Abv->Add(llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::VBR, 6));
5220 Abv->Add(llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::VBR, 6));
5221 Abv->Add(llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::Blob));
5222 unsigned Abbrev = Stream.EmitAbbrev(std::move(Abv));
5228 Record.push_back(Metadata.MajorVersion);
5229 Record.push_back(Metadata.MinorVersion);
5230 Record.push_back(Metadata.BlockName.size());
5231 Record.push_back(Metadata.UserInfo.size());
5233 Buffer += Metadata.BlockName;
5234 Buffer += Metadata.UserInfo;
5235 Stream.EmitRecordWithBlob(Abbrev,
Record, Buffer);
5254 (isa<PreferredNameAttr>(A) && (Writer->isWritingStdCXXNamedModules() ||
5255 Writer->isWritingStdCXXHeaderUnit())))
5256 return Record.push_back(0);
5266 Record.push_back(A->getAttributeSpellingListIndexRaw());
5269#include "clang/Serialization/AttrPCHWrite.inc"
5275 for (
const auto *A : Attrs)
5289 case tok::annot_pragma_loop_hint: {
5293 Record.push_back(Info->Toks.size());
5294 for (
const auto &
T : Info->Toks)
5298 case tok::annot_pragma_pack: {
5301 Record.push_back(
static_cast<unsigned>(Info->Action));
5307 case tok::annot_pragma_openmp:
5308 case tok::annot_pragma_openmp_end:
5309 case tok::annot_pragma_unused:
5310 case tok::annot_pragma_openacc:
5311 case tok::annot_pragma_openacc_end:
5312 case tok::annot_repl_input_end:
5315 llvm_unreachable(
"missing serialization code for annotation token");
5326 Record.push_back(Str.size());
5327 llvm::append_range(
Record, Str);
5332 Record.push_back(Str.size());
5333 llvm::append_range(Blob, Str);
5337 assert(WritingAST &&
"can't prepare path for output when not writing AST");
5340 StringRef PathStr(
Path.data(),
Path.size());
5341 if (PathStr ==
"<built-in>" || PathStr ==
"<command line>")
5347 const char *PathBegin =
Path.data();
5348 const char *PathPtr =
5350 if (PathPtr != PathBegin) {
5351 Path.erase(
Path.begin(),
Path.begin() + (PathPtr - PathBegin));
5375 Stream.EmitRecordWithBlob(Abbrev,
Record, FilePath);
5380 Record.push_back(Version.getMajor());
5381 if (std::optional<unsigned> Minor = Version.getMinor())
5382 Record.push_back(*Minor + 1);
5385 if (std::optional<unsigned> Subminor = Version.getSubminor())
5386 Record.push_back(*Subminor + 1);
5404 assert(ID < IdentifierOffsets.size());
5405 IdentifierOffsets[ID] = Offset;
5411 unsigned ID = SelectorIDs[Sel];
5412 assert(ID &&
"Unknown selector");
5415 if (ID < FirstSelectorID)
5417 SelectorOffsets[ID - FirstSelectorID] = Offset;
5423 ArrayRef<std::shared_ptr<ModuleFileExtension>> Extensions,
5424 bool IncludeTimestamps,
bool BuildingImplicitModule,
5425 bool GeneratingReducedBMI)
5426 : Stream(Stream), Buffer(Buffer), ModCache(ModCache),
5427 CodeGenOpts(CodeGenOpts), IncludeTimestamps(IncludeTimestamps),
5428 BuildingImplicitModule(BuildingImplicitModule),
5429 GeneratingReducedBMI(GeneratingReducedBMI) {
5430 for (
const auto &Ext : Extensions) {
5431 if (
auto Writer = Ext->createExtensionWriter(*
this))
5432 ModuleFileExtensionWriters.push_back(std::move(Writer));
5439 assert(WritingAST &&
"can't determine lang opts when not writing AST");
5444 return IncludeTimestamps ?
E->getModificationTime() : 0;
5449 StringRef OutputFile,
Module *WritingModule,
5450 StringRef isysroot,
bool ShouldCacheASTInMemory) {
5451 llvm::TimeTraceScope scope(
"WriteAST", OutputFile);
5454 Sema *SemaPtr = dyn_cast<Sema *>(Subject);
5456 SemaPtr ? SemaPtr->
getPreprocessor() : *cast<Preprocessor *>(Subject);
5461 Stream.Emit((
unsigned)
'C', 8);
5462 Stream.Emit((
unsigned)
'P', 8);
5463 Stream.Emit((
unsigned)
'C', 8);
5464 Stream.Emit((
unsigned)
'H', 8);
5466 WriteBlockInfoBlock();
5469 this->WritingModule = WritingModule;
5470 ASTFileSignature Signature = WriteASTCore(SemaPtr, isysroot, WritingModule);
5472 this->WritingModule =
nullptr;
5473 this->BaseDirectory.clear();
5477 if (ShouldCacheASTInMemory) {
5480 OutputFile, llvm::MemoryBuffer::getMemBufferCopy(
5481 StringRef(Buffer.begin(), Buffer.size())));
5486template<
typename Vector>
5488 for (
typename Vector::iterator I = Vec.begin(
nullptr,
true),
E = Vec.end();
5494template <
typename Vector>
5497 for (
typename Vector::iterator I = Vec.begin(
nullptr,
true),
E = Vec.end();
5503void ASTWriter::computeNonAffectingInputFiles() {
5507 IsSLocAffecting.resize(N,
true);
5508 IsSLocFileEntryAffecting.resize(N,
true);
5513 auto AffectingModuleMaps = GetAffectingModuleMaps(*PP, WritingModule);
5515 unsigned FileIDAdjustment = 0;
5516 unsigned OffsetAdjustment = 0;
5518 NonAffectingFileIDAdjustments.reserve(N);
5519 NonAffectingOffsetAdjustments.reserve(N);
5521 NonAffectingFileIDAdjustments.push_back(FileIDAdjustment);
5522 NonAffectingOffsetAdjustments.push_back(OffsetAdjustment);
5524 for (
unsigned I = 1; I != N; ++I) {
5526 FileID FID = FileID::get(I);
5533 if (!
Cache->OrigEntry)
5541 if (!AffectingModuleMaps)
5545 if (AffectingModuleMaps->DefinitionFileIDs.contains(FID))
5548 IsSLocAffecting[I] =
false;
5549 IsSLocFileEntryAffecting[I] =
5550 AffectingModuleMaps->DefinitionFiles.contains(*
Cache->OrigEntry);
5552 FileIDAdjustment += 1;
5558 if (!NonAffectingFileIDs.empty() &&
5559 NonAffectingFileIDs.back().ID == FID.ID - 1) {
5560 NonAffectingFileIDs.back() = FID;
5562 NonAffectingFileIDAdjustments.back() = FileIDAdjustment;
5563 NonAffectingOffsetAdjustments.back() = OffsetAdjustment;
5567 NonAffectingFileIDs.push_back(FID);
5570 NonAffectingFileIDAdjustments.push_back(FileIDAdjustment);
5571 NonAffectingOffsetAdjustments.push_back(OffsetAdjustment);
5580 for (StringRef
Path :
5583 for (
unsigned I = 1; I != N; ++I) {
5584 if (IsSLocAffecting[I]) {
5590 if (!
Cache->OrigEntry)
5593 Cache->OrigEntry->getNameAsRequested());
5599void ASTWriter::PrepareWritingSpecialDecls(
Sema &SemaRef) {
5602 bool isModule = WritingModule !=
nullptr;
5609 PredefinedDecls.insert(
D);
5617 RegisterPredefDecl(Context.ObjCProtocolClassDecl,
5621 RegisterPredefDecl(Context.ObjCInstanceTypeDecl,
5625 RegisterPredefDecl(Context.BuiltinMSVaListDecl,
5632 RegisterPredefDecl(Context.CFConstantStringTypeDecl,
5634 RegisterPredefDecl(Context.CFConstantStringTagDecl,
5636#define BuiltinTemplate(BTName) \
5637 RegisterPredefDecl(Context.Decl##BTName, PREDEF_DECL##BTName##_ID);
5638#include "clang/Basic/BuiltinTemplates.inc"
5650 if (GeneratingReducedBMI) {
5676 if (GeneratingReducedBMI)
5698 for (
unsigned I = 0, N = SemaRef.
VTableUses.size(); I != N; ++I)
5709 "There are local ones at end of translation unit!");
5722 for (
const auto &I : SemaRef.KnownNamespaces)
5735 for (
const auto &DeleteExprsInfo :
5742 for (
const auto *I : DeclsToEmitEvenIfUnreferenced)
5744 DeclsToEmitEvenIfUnreferenced.clear();
5757 llvm::sort(IIs, llvm::deref<std::less<>>());
5773 PendingEmittingVTables.clear();
5776void ASTWriter::WriteSpecialDeclRecords(
Sema &SemaRef) {
5779 bool isModule = WritingModule !=
nullptr;
5782 if (!EagerlyDeserializedDecls.empty())
5785 if (!ModularCodegenDecls.empty())
5791 TentativeDefinitions);
5792 if (!TentativeDefinitions.empty())
5799 UnusedFileScopedDecls);
5800 if (!UnusedFileScopedDecls.empty())
5806 if (!ExtVectorDecls.empty())
5812 for (
unsigned I = 0, N = SemaRef.
VTableUses.size(); I != N; ++I) {
5828 if (!UnusedLocalTypedefNameCandidates.empty())
5830 UnusedLocalTypedefNameCandidates);
5841 if (!PendingInstantiations.empty())
5847 auto AddEmittedDeclRefOrZero = [
this, &SemaDeclRefs](
Decl *
D) {
5849 SemaDeclRefs.push_back(0);
5858 if (!SemaDeclRefs.empty())
5866 if (!DeclsToCheckForDeferredDiags.empty())
5868 DeclsToCheckForDeferredDiags);
5874 AddDeclRef(CudaCallDecl, CUDASpecialDeclRefs);
5882 DelegatingCtorDecls);
5883 if (!DelegatingCtorDecls.empty())
5888 for (
const auto &I : SemaRef.KnownNamespaces) {
5892 if (!KnownNamespaces.empty())
5906 if (!UndefinedButUsed.empty())
5913 for (
const auto &DeleteExprsInfo :
5918 AddDeclRef(DeleteExprsInfo.first, DeleteExprsToAnalyze);
5919 DeleteExprsToAnalyze.push_back(DeleteExprsInfo.second.size());
5920 for (
const auto &DeleteLoc : DeleteExprsInfo.second) {
5922 DeleteExprsToAnalyze.push_back(DeleteLoc.second);
5926 if (!DeleteExprsToAnalyze.empty())
5937 if (!VTablesToEmit.empty())
5943 using namespace llvm;
5945 bool isModule = WritingModule !=
nullptr;
5953 computeNonAffectingInputFiles();
5955 writeUnhashedControlBlock(*PP);
5968 IdentifierIDs.clear();
5981 if (IsInterestingNonMacroIdentifier(
ID.second, *
this))
5982 IIs.push_back(
ID.second);
5985 llvm::sort(IIs, llvm::deref<std::less<>>());
5994 for (
const auto &WeakUndeclaredIdentifierList :
5996 const IdentifierInfo *
const II = WeakUndeclaredIdentifierList.first;
5997 for (
const auto &WI : WeakUndeclaredIdentifierList.second) {
6013 AddTypeRef(Context, Context.ObjCIdRedefinitionType, SpecialTypes);
6014 AddTypeRef(Context, Context.ObjCClassRedefinitionType, SpecialTypes);
6015 AddTypeRef(Context, Context.ObjCSelRedefinitionType, SpecialTypes);
6020 PrepareWritingSpecialDecls(*SemaPtr);
6023 WriteControlBlock(*PP, isysroot);
6026 Stream.FlushToWord();
6027 ASTBlockRange.first = Stream.GetCurrentBitNo() >> 3;
6029 ASTBlockStartOffset = Stream.GetCurrentBitNo();
6047 for (
auto &SelectorAndID : SelectorIDs)
6048 AllSelectors.push_back(SelectorAndID.first);
6049 for (
auto &
Selector : AllSelectors)
6073 auto Abbrev = std::make_shared<BitCodeAbbrev>();
6075 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
6076 unsigned ModuleOffsetMapAbbrev = Stream.EmitAbbrev(std::move(Abbrev));
6079 llvm::raw_svector_ostream Out(Buffer);
6081 using namespace llvm::support;
6083 endian::Writer
LE(Out, llvm::endianness::little);
6084 LE.write<uint8_t>(
static_cast<uint8_t
>(M.
Kind));
6086 LE.write<uint16_t>(Name.size());
6087 Out.write(Name.data(), Name.size());
6093 auto writeBaseIDOrNone = [&](
auto BaseID,
bool ShouldWrite) {
6094 assert(BaseID < std::numeric_limits<uint32_t>::max() &&
"base id too high");
6111 Stream.EmitRecordWithBlob(ModuleOffsetMapAbbrev,
Record,
6112 Buffer.data(), Buffer.size());
6116 WriteDeclAndTypes(SemaPtr->
Context);
6118 WriteFileDeclIDsMap();
6121 WriteComments(SemaPtr->
Context);
6122 WritePreprocessor(*PP, isModule);
6125 WriteSelectors(*SemaPtr);
6126 WriteReferencedSelectorsPool(*SemaPtr);
6127 WriteLateParsedTemplates(*SemaPtr);
6129 WriteIdentifierTable(*PP, SemaPtr ? &SemaPtr->
IdResolver :
nullptr, isModule);
6132 WriteOpenCLExtensions(*SemaPtr);
6133 WriteCUDAPragmas(*SemaPtr);
6138 WriteSubmodules(WritingModule, SemaPtr ? &SemaPtr->
Context :
nullptr);
6143 WriteSpecialDeclRecords(*SemaPtr);
6146 if (!WeakUndeclaredIdentifiers.empty())
6148 WeakUndeclaredIdentifiers);
6150 if (!WritingModule) {
6160 assert(SubmoduleIDs.contains(I->getImportedModule()));
6161 Imports.push_back(ModuleInfo(SubmoduleIDs[I->getImportedModule()],
6162 I->getImportedModule()));
6166 if (!Imports.empty()) {
6167 auto Cmp = [](
const ModuleInfo &A,
const ModuleInfo &B) {
6170 auto Eq = [](
const ModuleInfo &A,
const ModuleInfo &B) {
6171 return A.ID == B.ID;
6175 llvm::sort(Imports, Cmp);
6176 Imports.erase(llvm::unique(Imports,
Eq), Imports.end());
6179 for (
const auto &Import : Imports) {
6180 ImportedModules.push_back(
Import.ID);
6191 WriteObjCCategories();
6193 if (!WritingModule) {
6194 WriteOptimizePragmaOptions(*SemaPtr);
6195 WriteMSStructPragmaOptions(*SemaPtr);
6196 WriteMSPointersToMembersPragmaOptions(*SemaPtr);
6198 WritePackPragmaOptions(*SemaPtr);
6199 WriteFloatControlPragmaOptions(*SemaPtr);
6200 WriteDeclsWithEffectsToVerify(*SemaPtr);
6204 RecordData::value_type
Record[] = {NumStatements,
6206 NumLexicalDeclContexts,
6207 NumVisibleDeclContexts,
6208 NumModuleLocalDeclContexts,
6209 NumTULocalDeclContexts};
6212 Stream.FlushToWord();
6213 ASTBlockRange.second = Stream.GetCurrentBitNo() >> 3;
6217 for (
const auto &ExtWriter : ModuleFileExtensionWriters)
6218 WriteModuleFileExtension(*SemaPtr, *ExtWriter);
6220 return backpatchSignature();
6223void ASTWriter::EnteringModulePurview() {
6226 if (GeneratingReducedBMI)
6227 DeclUpdatesFromGMF.swap(DeclUpdates);
6233void ASTWriter::AddedManglingNumber(
const Decl *
D,
unsigned Number) {
6237 DeclUpdates[
D].push_back(DeclUpdate(DeclUpdateKind::ManglingNumber, Number));
6239void ASTWriter::AddedStaticLocalNumbers(
const Decl *
D,
unsigned Number) {
6243 DeclUpdates[
D].push_back(
6244 DeclUpdate(DeclUpdateKind::StaticLocalNumber, Number));
6256 DeclUpdate(DeclUpdateKind::CXXAddedAnonymousNamespace, NS));
6260void ASTWriter::WriteDeclAndTypes(
ASTContext &Context) {
6265 DeclTypesBlockStartOffset = Stream.GetCurrentBitNo();
6269 WriteDeclUpdatesBlocks(Context, DeclUpdatesOffsetsRecord);
6270 while (!DeclTypesToEmit.empty()) {
6271 DeclOrType DOT = DeclTypesToEmit.front();
6272 DeclTypesToEmit.pop();
6274 WriteType(Context, DOT.getType());
6276 WriteDecl(Context, DOT.getDecl());
6278 }
while (!DeclUpdates.empty());
6280 DoneWritingDeclsAndTypes =
true;
6284 assert(DelayedNamespace.empty() || GeneratingReducedBMI);
6289 Offsets.
LexicalOffset = WriteDeclContextLexicalBlock(Context, NS);
6290 WriteDeclContextVisibleBlock(Context, NS, Offsets);
6311 assert(DeclTypesToEmit.empty());
6312 assert(DeclUpdates.empty());
6317 WriteTypeDeclOffsets();
6318 if (!DeclUpdatesOffsetsRecord.empty())
6321 if (!DelayedNamespaceRecord.empty())
6323 DelayedNamespaceRecord);
6325 if (!RelatedDeclsMap.empty()) {
6329 for (
const auto &Pair : RelatedDeclsMap) {
6330 RelatedDeclsMapRecord.push_back(Pair.first.getRawValue());
6331 RelatedDeclsMapRecord.push_back(Pair.second.size());
6332 for (
const auto &Lambda : Pair.second)
6333 RelatedDeclsMapRecord.push_back(Lambda.getRawValue());
6336 auto Abv = std::make_shared<llvm::BitCodeAbbrev>();
6338 Abv->Add(llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::Array));
6339 Abv->Add(llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::VBR, 6));
6340 unsigned FunctionToLambdaMapAbbrev = Stream.EmitAbbrev(std::move(Abv));
6342 FunctionToLambdaMapAbbrev);
6345 if (!SpecializationsUpdates.empty()) {
6346 WriteSpecializationsUpdates(
false);
6347 SpecializationsUpdates.clear();
6350 if (!PartialSpecializationsUpdates.empty()) {
6351 WriteSpecializationsUpdates(
true);
6352 PartialSpecializationsUpdates.clear();
6367 NewGlobalKindDeclPairs.push_back(
D->
getKind());
6368 NewGlobalKindDeclPairs.push_back(
GetDeclRef(
D).getRawValue());
6371 auto Abv = std::make_shared<llvm::BitCodeAbbrev>();
6373 Abv->Add(llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::Blob));
6374 unsigned TuUpdateLexicalAbbrev = Stream.EmitAbbrev(std::move(Abv));
6377 Stream.EmitRecordWithBlob(TuUpdateLexicalAbbrev,
Record,
6378 bytes(NewGlobalKindDeclPairs));
6380 Abv = std::make_shared<llvm::BitCodeAbbrev>();
6382 Abv->Add(llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::VBR, 6));
6383 Abv->Add(llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::Blob));
6384 UpdateVisibleAbbrev = Stream.EmitAbbrev(std::move(Abv));
6386 Abv = std::make_shared<llvm::BitCodeAbbrev>();
6388 Abv->Add(llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::VBR, 6));
6389 Abv->Add(llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::Blob));
6390 ModuleLocalUpdateVisibleAbbrev = Stream.EmitAbbrev(std::move(Abv));
6392 Abv = std::make_shared<llvm::BitCodeAbbrev>();
6394 Abv->Add(llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::VBR, 6));
6395 Abv->Add(llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::Blob));
6396 TULocalUpdateVisibleAbbrev = Stream.EmitAbbrev(std::move(Abv));
6399 WriteDeclContextVisibleUpdate(Context, TU);
6402 if (Context.ExternCContext)
6403 WriteDeclContextVisibleUpdate(Context, Context.ExternCContext);
6406 for (
auto *DC : UpdatedDeclContexts)
6407 WriteDeclContextVisibleUpdate(Context, DC);
6410void ASTWriter::WriteSpecializationsUpdates(
bool IsPartial) {
6414 auto Abv = std::make_shared<llvm::BitCodeAbbrev>();
6416 Abv->Add(llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::VBR, 6));
6417 Abv->Add(llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::Blob));
6418 auto UpdateSpecializationAbbrev = Stream.EmitAbbrev(std::move(Abv));
6421 IsPartial ? PartialSpecializationsUpdates : SpecializationsUpdates;
6422 for (
auto &SpecializationUpdate : SpecUpdates) {
6423 const NamedDecl *
D = SpecializationUpdate.first;
6426 GenerateSpecializationInfoLookupTable(
D, SpecializationUpdate.second,
6427 LookupTable, IsPartial);
6430 RecordData::value_type
Record[] = {
6431 static_cast<RecordData::value_type
>(
RecordType),
6433 Stream.EmitRecordWithBlob(UpdateSpecializationAbbrev,
Record, LookupTable);
6437void ASTWriter::WriteDeclUpdatesBlocks(
ASTContext &Context,
6438 RecordDataImpl &OffsetsRecord) {
6439 if (DeclUpdates.empty())
6442 DeclUpdateMap LocalUpdates;
6443 LocalUpdates.swap(DeclUpdates);
6445 for (
auto &DeclUpdate : LocalUpdates) {
6446 const Decl *
D = DeclUpdate.first;
6448 bool HasUpdatedBody =
false;
6449 bool HasAddedVarDefinition =
false;
6452 for (
auto &
Update : DeclUpdate.second) {
6457 if (Kind == DeclUpdateKind::CXXAddedFunctionDefinition)
6458 HasUpdatedBody =
true;
6459 else if (Kind == DeclUpdateKind::CXXAddedVarDefinition)
6460 HasAddedVarDefinition =
true;
6462 Record.push_back(llvm::to_underlying(Kind));
6465 case DeclUpdateKind::CXXAddedImplicitMember:
6466 case DeclUpdateKind::CXXAddedAnonymousNamespace:
6467 assert(
Update.getDecl() &&
"no decl to add?");
6470 case DeclUpdateKind::CXXAddedFunctionDefinition:
6471 case DeclUpdateKind::CXXAddedVarDefinition:
6474 case DeclUpdateKind::CXXPointOfInstantiation:
6479 case DeclUpdateKind::CXXInstantiatedDefaultArgument:
6481 cast<ParmVarDecl>(
Update.getDecl())->getDefaultArg());
6484 case DeclUpdateKind::CXXInstantiatedDefaultMemberInitializer:
6486 cast<FieldDecl>(
Update.getDecl())->getInClassInitializer());
6489 case DeclUpdateKind::CXXInstantiatedClassDefinition: {
6490 auto *RD = cast<CXXRecordDecl>(
D);
6491 UpdatedDeclContexts.insert(RD->getPrimaryContext());
6492 Record.push_back(RD->isParamDestroyedInCallee());
6493 Record.push_back(llvm::to_underlying(RD->getArgPassingRestrictions()));
6494 Record.AddCXXDefinitionData(RD);
6495 Record.AddOffset(WriteDeclContextLexicalBlock(Context, RD));
6500 if (
auto *MSInfo = RD->getMemberSpecializationInfo()) {
6501 Record.push_back(MSInfo->getTemplateSpecializationKind());
6502 Record.AddSourceLocation(MSInfo->getPointOfInstantiation());
6504 auto *Spec = cast<ClassTemplateSpecializationDecl>(RD);
6505 Record.push_back(Spec->getTemplateSpecializationKind());
6506 Record.AddSourceLocation(Spec->getPointOfInstantiation());
6510 auto From = Spec->getInstantiatedFrom();
6511 if (
auto PartialSpec =
6514 Record.AddDeclRef(PartialSpec);
6515 Record.AddTemplateArgumentList(
6516 &Spec->getTemplateInstantiationArgs());
6521 Record.push_back(llvm::to_underlying(RD->getTagKind()));
6522 Record.AddSourceLocation(RD->getLocation());
6523 Record.AddSourceLocation(RD->getBeginLoc());
6524 Record.AddSourceRange(RD->getBraceRange());
6535 case DeclUpdateKind::CXXResolvedDtorDelete:
6537 Record.AddStmt(cast<CXXDestructorDecl>(
D)->getOperatorDeleteThisArg());
6540 case DeclUpdateKind::CXXResolvedExceptionSpec: {
6543 Record.writeExceptionSpecInfo(prototype->getExceptionSpecInfo());
6547 case DeclUpdateKind::CXXDeducedReturnType:
6551 case DeclUpdateKind::DeclMarkedUsed:
6554 case DeclUpdateKind::ManglingNumber:
6555 case DeclUpdateKind::StaticLocalNumber:
6559 case DeclUpdateKind::DeclMarkedOpenMPThreadPrivate:
6561 D->
getAttr<OMPThreadPrivateDeclAttr>()->getRange());
6564 case DeclUpdateKind::DeclMarkedOpenMPAllocate: {
6565 auto *A =
D->
getAttr<OMPAllocateDeclAttr>();
6566 Record.push_back(A->getAllocatorType());
6567 Record.AddStmt(A->getAllocator());
6568 Record.AddStmt(A->getAlignment());
6569 Record.AddSourceRange(A->getRange());
6573 case DeclUpdateKind::DeclMarkedOpenMPDeclareTarget:
6574 Record.push_back(
D->
getAttr<OMPDeclareTargetDeclAttr>()->getMapType());
6576 D->
getAttr<OMPDeclareTargetDeclAttr>()->getRange());
6579 case DeclUpdateKind::DeclExported:
6583 case DeclUpdateKind::AddedAttrToRecord:
6592 if (HasUpdatedBody) {
6593 const auto *Def = cast<FunctionDecl>(
D);
6595 llvm::to_underlying(DeclUpdateKind::CXXAddedFunctionDefinition));
6596 Record.push_back(Def->isInlined());
6597 Record.AddSourceLocation(Def->getInnerLocStart());
6598 Record.AddFunctionDefinition(Def);
6599 }
else if (HasAddedVarDefinition) {
6600 const auto *VD = cast<VarDecl>(
D);
6602 llvm::to_underlying(DeclUpdateKind::CXXAddedVarDefinition));
6603 Record.push_back(VD->isInline());
6604 Record.push_back(VD->isInlineSpecified());
6605 Record.AddVarDeclInit(VD);
6622 NonAffectingFileIDs.empty())
6624 auto It = llvm::lower_bound(NonAffectingFileIDs, FID);
6625 unsigned Idx = std::distance(NonAffectingFileIDs.begin(), It);
6626 unsigned Offset = NonAffectingFileIDAdjustments[Idx];
6627 return FileID::get(FID.getOpaqueValue() - Offset);
6630unsigned ASTWriter::getAdjustedNumCreatedFIDs(
FileID FID)
const {
6636 unsigned AdjustedNumCreatedFIDs = 0;
6637 for (
unsigned I = FID.ID, N = I + NumCreatedFIDs; I != N; ++I)
6638 if (IsSLocAffecting[I])
6639 ++AdjustedNumCreatedFIDs;
6640 return AdjustedNumCreatedFIDs;
6656 return Offset - getAdjustment(Offset);
6661 if (NonAffectingRanges.empty())
6667 if (Offset > NonAffectingRanges.back().getEnd().getOffset())
6668 return NonAffectingOffsetAdjustments.back();
6670 if (Offset < NonAffectingRanges.front().getBegin().getOffset())
6677 auto It = llvm::lower_bound(NonAffectingRanges, Offset, Contains);
6678 unsigned Idx = std::distance(NonAffectingRanges.begin(), It);
6679 return NonAffectingOffsetAdjustments[Idx];
6683 Record.push_back(getAdjustedFileID(FID).getOpaqueValue());
6689 unsigned ModuleFileIndex = 0;
6695 SourceManager::MaxLoadedOffset -
Loc.getOffset() - 1);
6696 assert(SLocMapI !=
getChain()->GlobalSLocOffsetMap.end() &&
6697 "Corrupted global sloc offset map");
6702 ModuleFileIndex = F->
Index + 1;
6710 Loc = getAdjustedLocation(
Loc);
6747 MacroInfoToEmitData Info = { Name, MI, ID };
6748 MacroInfosToEmit.push_back(Info);
6754 return IdentMacroDirectivesOffsetMap.lookup(Name);
6758 Record->push_back(Writer->getSelectorRef(SelRef));
6767 if (SID == 0 && Chain) {
6771 SID = SelectorIDs[Sel];
6774 SID = NextSelectorID++;
6775 SelectorIDs[Sel] = SID;
6817 bool InfoHasSameExpr
6819 Record->push_back(InfoHasSameExpr);
6820 if (InfoHasSameExpr)
6837 TypeLocWriter TLW(*
this);
6847template <
typename IdxForTypeTy>
6849 IdxForTypeTy IdxForType) {
6853 unsigned FastQuals =
T.getLocalFastQualifiers();
6854 T.removeLocalFastQualifiers();
6856 if (
T.hasLocalNonFastQualifiers())
6857 return IdxForType(
T).asTypeID(FastQuals);
6859 assert(!
T.hasLocalQualifiers());
6861 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(
T.getTypePtr()))
6869 return IdxForType(
T).asTypeID(FastQuals);
6876 assert(!
T.getLocalFastQualifiers());
6880 if (DoneWritingDeclsAndTypes) {
6881 assert(0 &&
"New type seen after serializing all the types to emit!");
6887 Idx =
TypeIdx(0, NextTypeID++);
6888 DeclTypesToEmit.push(
T);
6914 assert(WritingAST &&
"Cannot request a declaration ID before AST writing");
6921 if (
auto *
Iter = DeclUpdatesFromGMF.find(
D);
6922 Iter != DeclUpdatesFromGMF.end()) {
6924 DeclUpdates[
D].push_back(
Update);
6925 DeclUpdatesFromGMF.erase(
Iter);
6937 assert(!(
reinterpret_cast<uintptr_t>(
D) & 0x01) &&
"Invalid decl pointer");
6939 if (ID.isInvalid()) {
6940 if (DoneWritingDeclsAndTypes) {
6941 assert(0 &&
"New decl seen after serializing all the decls to emit!");
6948 DeclTypesToEmit.push(
const_cast<Decl *
>(
D));
6963 assert(DeclIDs.contains(
D) &&
"Declaration not emitted!");
6970 assert(DoneWritingDeclsAndTypes &&
6971 "wasDeclEmitted should only be called after writing declarations");
6976 bool Emitted = DeclIDs.contains(
D);
6978 GeneratingReducedBMI) &&
6979 "The declaration within modules can only be omitted in reduced BMI.");
6984 assert(ID.isValid());
6998 if (isa<ParmVarDecl, TemplateTemplateParmDecl>(
D))
7003 assert(
SM.isLocalSourceLocation(FileLoc));
7004 auto [FID, Offset] =
SM.getDecomposedLoc(FileLoc);
7007 assert(
SM.getSLocEntry(FID).isFile());
7008 assert(IsSLocAffecting[FID.ID]);
7010 std::unique_ptr<DeclIDInFileInfo> &Info = FileDeclIDs[FID];
7012 Info = std::make_unique<DeclIDInFileInfo>();
7014 std::pair<unsigned, LocalDeclID> LocDecl(Offset, ID);
7015 LocDeclIDsTy &Decls = Info->DeclIDs;
7016 Decls.push_back(LocDecl);
7021 "expected an anonymous declaration");
7025 auto It = AnonymousDeclarationNumbers.find(
D);
7026 if (It == AnonymousDeclarationNumbers.end()) {
7029 AnonymousDeclarationNumbers[ND] = Number;
7032 It = AnonymousDeclarationNumbers.find(
D);
7033 assert(It != AnonymousDeclarationNumbers.end() &&
7034 "declaration not found within its lexical context");
7042 switch (Name.getNameKind()) {
7089 while (QualifierLoc) {
7090 NestedNames.push_back(QualifierLoc);
7094 Record->push_back(NestedNames.size());
7095 while(!NestedNames.empty()) {
7096 QualifierLoc = NestedNames.pop_back_val();
7099 Record->push_back(llvm::to_underlying(Kind));
7102 AddDeclRef(Qualifier.getAsNamespaceAndPrefix().Namespace);
7124 llvm_unreachable(
"unexpected null nested name specifier");
7131 assert(TemplateParams &&
"No TemplateParams!");
7137 for (
const auto &
P : *TemplateParams)
7143 Record->push_back(
false);
7150 assert(TemplateArgs &&
"No TemplateArgs!");
7152 for (
int i = 0, e = TemplateArgs->
size(); i != e; ++i)
7158 assert(ASTTemplArgList &&
"No ASTTemplArgList!");
7170 I =
Set.begin(),
E =
Set.end(); I !=
E; ++I) {
7172 Record->push_back(I.getAccess());
7180 Record->push_back(
Base.getAccessSpecifierAsWritten());
7181 Record->push_back(
Base.getInheritConstructors());
7194 for (
auto &
Base : Bases)
7212 for (
auto *
Init : CtorInits) {
7213 if (
Init->isBaseInitializer()) {
7217 }
else if (
Init->isDelegatingInitializer()) {
7220 }
else if (
Init->isMemberInitializer()){
7233 if (
Init->isWritten())
7247 auto &
Data =
D->data();
7253#define FIELD(Name, Width, Merge) \
7254 if (!DefinitionBits.canWriteNextNBits(Width)) { \
7255 Record->push_back(DefinitionBits); \
7256 DefinitionBits.reset(0); \
7258 DefinitionBits.addBits(Data.Name, Width);
7260#include "clang/AST/CXXRecordDeclDefinitionBits.def"
7263 Record->push_back(DefinitionBits);
7267 Record->push_back(
D->getODRHash());
7269 bool ModulesCodegen =
7270 !
D->isDependentType() &&
7271 D->getTemplateSpecializationKind() !=
7274 Record->push_back(ModulesCodegen);
7276 Writer->AddDeclRef(
D, Writer->ModularCodegenDecls);
7281 Record->push_back(
Data.ComputedVisibleConversions);
7282 if (
Data.ComputedVisibleConversions)
7286 if (!
Data.IsLambda) {
7288 if (
Data.NumBases > 0)
7293 if (
Data.NumVBases > 0)
7298 auto &Lambda =
D->getLambdaData();
7301 LambdaBits.
addBits(Lambda.DependencyKind, 2);
7302 LambdaBits.
addBit(Lambda.IsGenericLambda);
7303 LambdaBits.
addBits(Lambda.CaptureDefault, 2);
7304 LambdaBits.
addBits(Lambda.NumCaptures, 15);
7305 LambdaBits.
addBit(Lambda.HasKnownInternalLinkage);
7306 Record->push_back(LambdaBits);
7308 Record->push_back(Lambda.NumExplicitCaptures);
7309 Record->push_back(Lambda.ManglingNumber);
7310 Record->push_back(
D->getDeviceLambdaManglingNumber());
7314 for (
unsigned I = 0, N = Lambda.NumCaptures; I != N; ++I) {
7321 Record->push_back(CaptureBits);
7323 switch (
Capture.getCaptureKind()) {
7353 assert(ES->CheckedForSideEffects);
7354 Val |= (ES->HasConstantInitialization ? 2 : 0);
7355 Val |= (ES->HasConstantDestruction ? 4 : 0);
7369void ASTWriter::ReaderInitialized(
ASTReader *Reader) {
7370 assert(Reader &&
"Cannot remove chain");
7371 assert((!Chain || Chain == Reader) &&
"Cannot replace chain");
7372 assert(FirstDeclID == NextDeclID &&
7373 FirstTypeID == NextTypeID &&
7374 FirstIdentID == NextIdentID &&
7375 FirstMacroID == NextMacroID &&
7376 FirstSubmoduleID == NextSubmoduleID &&
7377 FirstSelectorID == NextSelectorID &&
7378 "Setting chain after writing has started.");
7387 NextMacroID = FirstMacroID;
7388 NextSelectorID = FirstSelectorID;
7389 NextSubmoduleID = FirstSubmoduleID;
7399 unsigned OriginalModuleFileIndex = StoredID >> 32;
7403 if (OriginalModuleFileIndex == 0 && StoredID)
7414 MacroID &StoredID = MacroIDs[MI];
7437 if (ModuleFileIndex == 0 && StoredIdx.
getValue())
7449 PredefinedDecls.insert(
D);
7461 assert(!MacroDefinitions.contains(MD));
7462 MacroDefinitions[MD] =
ID;
7466 assert(!SubmoduleIDs.contains(Mod));
7467 SubmoduleIDs[Mod] =
ID;
7470void ASTWriter::CompletedTagDefinition(
const TagDecl *
D) {
7472 assert(
D->isCompleteDefinition());
7473 assert(!WritingAST &&
"Already writing the AST!");
7474 if (
auto *RD = dyn_cast<CXXRecordDecl>(
D)) {
7476 if (RD->isFromASTFile()) {
7481 "completed a tag from another module but not by instantiation?");
7482 DeclUpdates[RD].push_back(
7483 DeclUpdate(DeclUpdateKind::CXXInstantiatedClassDefinition));
7500 "Should not add lookup results to non-lookup contexts!");
7503 if (isa<TranslationUnitDecl>(DC))
7511 !isa<FunctionTemplateDecl>(
D))
7521 assert(!WritingAST &&
"Already writing the AST!");
7522 if (UpdatedDeclContexts.insert(DC) && !cast<Decl>(DC)->isFromASTFile()) {
7526 llvm::append_range(DeclsToEmitEvenIfUnreferenced, DC->
decls());
7528 DeclsToEmitEvenIfUnreferenced.push_back(
D);
7540 if (!isa<CXXMethodDecl>(
D))
7545 assert(!WritingAST &&
"Already writing the AST!");
7546 DeclUpdates[RD].push_back(
7547 DeclUpdate(DeclUpdateKind::CXXAddedImplicitMember,
D));
7550void ASTWriter::ResolvedExceptionSpec(
const FunctionDecl *FD) {
7552 assert(!DoneWritingDeclsAndTypes &&
"Already done writing updates!");
7559 ->castAs<FunctionProtoType>()
7560 ->getExceptionSpecType()))
7561 DeclUpdates[
D].push_back(DeclUpdateKind::CXXResolvedExceptionSpec);
7567 assert(!WritingAST &&
"Already writing the AST!");
7570 DeclUpdates[
D].push_back(
7571 DeclUpdate(DeclUpdateKind::CXXDeducedReturnType, ReturnType));
7579 assert(!WritingAST &&
"Already writing the AST!");
7580 assert(
Delete &&
"Not given an operator delete");
7583 DeclUpdates[
D].push_back(
7584 DeclUpdate(DeclUpdateKind::CXXResolvedDtorDelete,
Delete));
7588void ASTWriter::CompletedImplicitDefinition(
const FunctionDecl *
D) {
7590 assert(!WritingAST &&
"Already writing the AST!");
7595 if (!
D->doesThisDeclarationHaveABody())
7599 DeclUpdates[
D].push_back(
7600 DeclUpdate(DeclUpdateKind::CXXAddedFunctionDefinition));
7603void ASTWriter::VariableDefinitionInstantiated(
const VarDecl *
D) {
7605 assert(!WritingAST &&
"Already writing the AST!");
7609 DeclUpdates[
D].push_back(DeclUpdate(DeclUpdateKind::CXXAddedVarDefinition));
7612void ASTWriter::FunctionDefinitionInstantiated(
const FunctionDecl *
D) {
7614 assert(!WritingAST &&
"Already writing the AST!");
7619 if (!
D->doesThisDeclarationHaveABody())
7622 DeclUpdates[
D].push_back(
7623 DeclUpdate(DeclUpdateKind::CXXAddedFunctionDefinition));
7626void ASTWriter::InstantiationRequested(
const ValueDecl *
D) {
7628 assert(!WritingAST &&
"Already writing the AST!");
7635 if (
auto *VD = dyn_cast<VarDecl>(
D))
7636 POI = VD->getPointOfInstantiation();
7638 POI = cast<FunctionDecl>(
D)->getPointOfInstantiation();
7639 DeclUpdates[
D].push_back(
7640 DeclUpdate(DeclUpdateKind::CXXPointOfInstantiation, POI));
7643void ASTWriter::DefaultArgumentInstantiated(
const ParmVarDecl *
D) {
7645 assert(!WritingAST &&
"Already writing the AST!");
7649 DeclUpdates[
D].push_back(
7650 DeclUpdate(DeclUpdateKind::CXXInstantiatedDefaultArgument,
D));
7653void ASTWriter::DefaultMemberInitializerInstantiated(
const FieldDecl *
D) {
7654 assert(!WritingAST &&
"Already writing the AST!");
7658 DeclUpdates[
D].push_back(
7659 DeclUpdate(DeclUpdateKind::CXXInstantiatedDefaultMemberInitializer,
D));
7665 assert(!WritingAST &&
"Already writing the AST!");
7669 assert(IFD->
getDefinition() &&
"Category on a class without a definition?");
7670 ObjCClassesWithCategories.insert(
7674void ASTWriter::DeclarationMarkedUsed(
const Decl *
D) {
7676 assert(!WritingAST &&
"Already writing the AST!");
7685 DeclUpdates[
D].push_back(DeclUpdate(DeclUpdateKind::DeclMarkedUsed));
7688void ASTWriter::DeclarationMarkedOpenMPThreadPrivate(
const Decl *
D) {
7690 assert(!WritingAST &&
"Already writing the AST!");
7694 DeclUpdates[
D].push_back(
7695 DeclUpdate(DeclUpdateKind::DeclMarkedOpenMPThreadPrivate));
7698void ASTWriter::DeclarationMarkedOpenMPAllocate(
const Decl *
D,
const Attr *A) {
7700 assert(!WritingAST &&
"Already writing the AST!");
7704 DeclUpdates[
D].push_back(
7705 DeclUpdate(DeclUpdateKind::DeclMarkedOpenMPAllocate, A));
7708void ASTWriter::DeclarationMarkedOpenMPDeclareTarget(
const Decl *
D,
7711 assert(!WritingAST &&
"Already writing the AST!");
7715 DeclUpdates[
D].push_back(
7716 DeclUpdate(DeclUpdateKind::DeclMarkedOpenMPDeclareTarget,
Attr));
7721 assert(!WritingAST &&
"Already writing the AST!");
7723 DeclUpdates[
D].push_back(DeclUpdate(DeclUpdateKind::DeclExported, M));
7726void ASTWriter::AddedAttributeToRecord(
const Attr *
Attr,
7729 assert(!WritingAST &&
"Already writing the AST!");
7730 if (!
Record->isFromASTFile())
7732 DeclUpdates[
Record].push_back(
7733 DeclUpdate(DeclUpdateKind::AddedAttrToRecord,
Attr));
7736void ASTWriter::AddedCXXTemplateSpecialization(
7738 assert(!WritingAST &&
"Already writing the AST!");
7745 DeclsToEmitEvenIfUnreferenced.push_back(
D);
7748void ASTWriter::AddedCXXTemplateSpecialization(
7750 assert(!WritingAST &&
"Already writing the AST!");
7757 DeclsToEmitEvenIfUnreferenced.push_back(
D);
7762 assert(!WritingAST &&
"Already writing the AST!");
7769 DeclsToEmitEvenIfUnreferenced.push_back(
D);
7783#define GEN_CLANG_CLAUSE_CLASS
7784#define CLAUSE_CLASS(Enum, Str, Class) void Visit##Class(Class *S);
7785#include "llvm/Frontend/OpenMP/OMP.inc"
7794 OMPClauseWriter(*this).writeClause(
C);
7797void OMPClauseWriter::writeClause(
OMPClause *
C) {
7798 Record.push_back(
unsigned(
C->getClauseKind()));
7800 Record.AddSourceLocation(
C->getBeginLoc());
7801 Record.AddSourceLocation(
C->getEndLoc());
7805 Record.push_back(uint64_t(
C->getCaptureRegion()));
7806 Record.AddStmt(
C->getPreInitStmt());
7810 VisitOMPClauseWithPreInit(
C);
7811 Record.AddStmt(
C->getPostUpdateExpr());
7814void OMPClauseWriter::VisitOMPIfClause(
OMPIfClause *
C) {
7815 VisitOMPClauseWithPreInit(
C);
7817 Record.AddSourceLocation(
C->getNameModifierLoc());
7818 Record.AddSourceLocation(
C->getColonLoc());
7819 Record.AddStmt(
C->getCondition());
7820 Record.AddSourceLocation(
C->getLParenLoc());
7824 VisitOMPClauseWithPreInit(
C);
7825 Record.AddStmt(
C->getCondition());
7826 Record.AddSourceLocation(
C->getLParenLoc());
7830 VisitOMPClauseWithPreInit(
C);
7831 Record.writeEnum(
C->getModifier());
7832 Record.AddStmt(
C->getNumThreads());
7833 Record.AddSourceLocation(
C->getModifierLoc());
7834 Record.AddSourceLocation(
C->getLParenLoc());
7838 Record.AddStmt(
C->getSafelen());
7839 Record.AddSourceLocation(
C->getLParenLoc());
7843 Record.AddStmt(
C->getSimdlen());
7844 Record.AddSourceLocation(
C->getLParenLoc());
7848 Record.push_back(
C->getNumSizes());
7849 for (
Expr *Size :
C->getSizesRefs())
7851 Record.AddSourceLocation(
C->getLParenLoc());
7855 Record.push_back(
C->getNumLoops());
7856 for (
Expr *Size :
C->getArgsRefs())
7858 Record.AddSourceLocation(
C->getLParenLoc());
7864 Record.AddStmt(
C->getFactor());
7865 Record.AddSourceLocation(
C->getLParenLoc());
7869 Record.AddStmt(
C->getAllocator());
7870 Record.AddSourceLocation(
C->getLParenLoc());
7874 Record.AddStmt(
C->getNumForLoops());
7875 Record.AddSourceLocation(
C->getLParenLoc());
7879 Record.AddStmt(
C->getEventHandler());
7880 Record.AddSourceLocation(
C->getLParenLoc());
7884 Record.push_back(
unsigned(
C->getDefaultKind()));
7885 Record.AddSourceLocation(
C->getLParenLoc());
7886 Record.AddSourceLocation(
C->getDefaultKindKwLoc());
7890 Record.push_back(
unsigned(
C->getProcBindKind()));
7891 Record.AddSourceLocation(
C->getLParenLoc());
7892 Record.AddSourceLocation(
C->getProcBindKindKwLoc());
7896 VisitOMPClauseWithPreInit(
C);
7897 Record.push_back(
C->getScheduleKind());
7898 Record.push_back(
C->getFirstScheduleModifier());
7899 Record.push_back(
C->getSecondScheduleModifier());
7900 Record.AddStmt(
C->getChunkSize());
7901 Record.AddSourceLocation(
C->getLParenLoc());
7902 Record.AddSourceLocation(
C->getFirstScheduleModifierLoc());
7903 Record.AddSourceLocation(
C->getSecondScheduleModifierLoc());
7904 Record.AddSourceLocation(
C->getScheduleKindLoc());
7905 Record.AddSourceLocation(
C->getCommaLoc());
7909 Record.push_back(
C->getLoopNumIterations().size());
7910 Record.AddStmt(
C->getNumForLoops());
7911 for (
Expr *NumIter :
C->getLoopNumIterations())
7913 for (
unsigned I = 0,
E =
C->getLoopNumIterations().size(); I <
E; ++I)
7914 Record.AddStmt(
C->getLoopCounter(I));
7915 Record.AddSourceLocation(
C->getLParenLoc());
7929 Record.push_back(
C->isExtended() ? 1 : 0);
7930 if (
C->isExtended()) {
7931 Record.AddSourceLocation(
C->getLParenLoc());
7932 Record.AddSourceLocation(
C->getArgumentLoc());
7933 Record.writeEnum(
C->getDependencyKind());
7943 Record.AddSourceLocation(
C->getLParenLoc());
7944 Record.AddSourceLocation(
C->getFailParameterLoc());
7945 Record.writeEnum(
C->getFailParameter());
7953 Record.push_back(
static_cast<uint64_t>(
C->getDirectiveKinds().size()));
7954 Record.AddSourceLocation(
C->getLParenLoc());
7955 for (
auto K :
C->getDirectiveKinds()) {
7962 Record.AddSourceLocation(
C->getLParenLoc());
7966 Record.push_back(
static_cast<uint64_t>(
C->getDirectiveKinds().size()));
7967 Record.AddSourceLocation(
C->getLParenLoc());
7968 for (
auto K :
C->getDirectiveKinds()) {
7975void OMPClauseWriter::VisitOMPNoOpenMPRoutinesClause(
7978void OMPClauseWriter::VisitOMPNoOpenMPConstructsClause(
7998 Record.push_back(
C->varlist_size());
7999 for (
Expr *VE :
C->varlist())
8001 Record.writeBool(
C->getIsTarget());
8002 Record.writeBool(
C->getIsTargetSync());
8003 Record.AddSourceLocation(
C->getLParenLoc());
8004 Record.AddSourceLocation(
C->getVarLoc());
8008 Record.AddStmt(
C->getInteropVar());
8009 Record.AddSourceLocation(
C->getLParenLoc());
8010 Record.AddSourceLocation(
C->getVarLoc());
8014 Record.AddStmt(
C->getInteropVar());
8015 Record.AddSourceLocation(
C->getLParenLoc());
8016 Record.AddSourceLocation(
C->getVarLoc());
8020 VisitOMPClauseWithPreInit(
C);
8021 Record.AddStmt(
C->getCondition());
8022 Record.AddSourceLocation(
C->getLParenLoc());
8026 VisitOMPClauseWithPreInit(
C);
8027 Record.AddStmt(
C->getCondition());
8028 Record.AddSourceLocation(
C->getLParenLoc());
8032 VisitOMPClauseWithPreInit(
C);
8033 Record.AddStmt(
C->getThreadID());
8034 Record.AddSourceLocation(
C->getLParenLoc());
8038 Record.AddStmt(
C->getAlignment());
8039 Record.AddSourceLocation(
C->getLParenLoc());
8043 Record.push_back(
C->varlist_size());
8044 Record.AddSourceLocation(
C->getLParenLoc());
8045 for (
auto *VE :
C->varlist()) {
8048 for (
auto *VE :
C->private_copies()) {
8054 Record.push_back(
C->varlist_size());
8055 VisitOMPClauseWithPreInit(
C);
8056 Record.AddSourceLocation(
C->getLParenLoc());
8057 for (
auto *VE :
C->varlist()) {
8060 for (
auto *VE :
C->private_copies()) {
8063 for (
auto *VE :
C->inits()) {
8069 Record.push_back(
C->varlist_size());
8070 VisitOMPClauseWithPostUpdate(
C);
8071 Record.AddSourceLocation(
C->getLParenLoc());
8072 Record.writeEnum(
C->getKind());
8073 Record.AddSourceLocation(
C->getKindLoc());
8074 Record.AddSourceLocation(
C->getColonLoc());
8075 for (
auto *VE :
C->varlist())
8077 for (
auto *
E :
C->private_copies())
8079 for (
auto *
E :
C->source_exprs())
8081 for (
auto *
E :
C->destination_exprs())
8083 for (
auto *
E :
C->assignment_ops())
8088 Record.push_back(
C->varlist_size());
8089 Record.AddSourceLocation(
C->getLParenLoc());
8090 for (
auto *VE :
C->varlist())
8095 Record.push_back(
C->varlist_size());
8096 Record.writeEnum(
C->getModifier());
8097 VisitOMPClauseWithPostUpdate(
C);
8098 Record.AddSourceLocation(
C->getLParenLoc());
8099 Record.AddSourceLocation(
C->getModifierLoc());
8100 Record.AddSourceLocation(
C->getColonLoc());
8101 Record.AddNestedNameSpecifierLoc(
C->getQualifierLoc());
8102 Record.AddDeclarationNameInfo(
C->getNameInfo());
8103 for (
auto *VE :
C->varlist())
8105 for (
auto *VE :
C->privates())
8107 for (
auto *
E :
C->lhs_exprs())
8109 for (
auto *
E :
C->rhs_exprs())
8111 for (
auto *
E :
C->reduction_ops())
8113 if (
C->getModifier() == clang::OMPC_REDUCTION_inscan) {
8114 for (
auto *
E :
C->copy_ops())
8116 for (
auto *
E :
C->copy_array_temps())
8118 for (
auto *
E :
C->copy_array_elems())
8121 auto PrivateFlags =
C->private_var_reduction_flags();
8122 Record.push_back(std::distance(PrivateFlags.begin(), PrivateFlags.end()));
8123 for (
bool Flag : PrivateFlags)
8128 Record.push_back(
C->varlist_size());
8129 VisitOMPClauseWithPostUpdate(
C);
8130 Record.AddSourceLocation(
C->getLParenLoc());
8131 Record.AddSourceLocation(
C->getColonLoc());
8132 Record.AddNestedNameSpecifierLoc(
C->getQualifierLoc());
8133 Record.AddDeclarationNameInfo(
C->getNameInfo());
8134 for (
auto *VE :
C->varlist())
8136 for (
auto *VE :
C->privates())
8138 for (
auto *
E :
C->lhs_exprs())
8140 for (
auto *
E :
C->rhs_exprs())
8142 for (
auto *
E :
C->reduction_ops())
8147 Record.push_back(
C->varlist_size());
8148 VisitOMPClauseWithPostUpdate(
C);
8149 Record.AddSourceLocation(
C->getLParenLoc());
8150 Record.AddSourceLocation(
C->getColonLoc());
8151 Record.AddNestedNameSpecifierLoc(
C->getQualifierLoc());
8152 Record.AddDeclarationNameInfo(
C->getNameInfo());
8153 for (
auto *VE :
C->varlist())
8155 for (
auto *VE :
C->privates())
8157 for (
auto *
E :
C->lhs_exprs())
8159 for (
auto *
E :
C->rhs_exprs())
8161 for (
auto *
E :
C->reduction_ops())
8163 for (
auto *
E :
C->taskgroup_descriptors())
8168 Record.push_back(
C->varlist_size());
8169 VisitOMPClauseWithPostUpdate(
C);
8170 Record.AddSourceLocation(
C->getLParenLoc());
8171 Record.AddSourceLocation(
C->getColonLoc());
8172 Record.push_back(
C->getModifier());
8173 Record.AddSourceLocation(
C->getModifierLoc());
8174 for (
auto *VE :
C->varlist()) {
8177 for (
auto *VE :
C->privates()) {
8180 for (
auto *VE :
C->inits()) {
8183 for (
auto *VE :
C->updates()) {
8186 for (
auto *VE :
C->finals()) {
8190 Record.AddStmt(
C->getCalcStep());
8191 for (
auto *VE :
C->used_expressions())
8196 Record.push_back(
C->varlist_size());
8197 Record.AddSourceLocation(
C->getLParenLoc());
8198 Record.AddSourceLocation(
C->getColonLoc());
8199 for (
auto *VE :
C->varlist())
8201 Record.AddStmt(
C->getAlignment());
8205 Record.push_back(
C->varlist_size());
8206 Record.AddSourceLocation(
C->getLParenLoc());
8207 for (
auto *VE :
C->varlist())
8209 for (
auto *
E :
C->source_exprs())
8211 for (
auto *
E :
C->destination_exprs())
8213 for (
auto *
E :
C->assignment_ops())
8218 Record.push_back(
C->varlist_size());
8219 Record.AddSourceLocation(
C->getLParenLoc());
8220 for (
auto *VE :
C->varlist())
8222 for (
auto *
E :
C->source_exprs())
8224 for (
auto *
E :
C->destination_exprs())
8226 for (
auto *
E :
C->assignment_ops())
8231 Record.push_back(
C->varlist_size());
8232 Record.AddSourceLocation(
C->getLParenLoc());
8233 for (
auto *VE :
C->varlist())
8238 Record.AddStmt(
C->getDepobj());
8239 Record.AddSourceLocation(
C->getLParenLoc());
8243 Record.push_back(
C->varlist_size());
8244 Record.push_back(
C->getNumLoops());
8245 Record.AddSourceLocation(
C->getLParenLoc());
8246 Record.AddStmt(
C->getModifier());
8247 Record.push_back(
C->getDependencyKind());
8248 Record.AddSourceLocation(
C->getDependencyLoc());
8249 Record.AddSourceLocation(
C->getColonLoc());
8250 Record.AddSourceLocation(
C->getOmpAllMemoryLoc());
8251 for (
auto *VE :
C->varlist())
8253 for (
unsigned I = 0,
E =
C->getNumLoops(); I <
E; ++I)
8254 Record.AddStmt(
C->getLoopData(I));
8258 VisitOMPClauseWithPreInit(
C);
8259 Record.writeEnum(
C->getModifier());
8260 Record.AddStmt(
C->getDevice());
8261 Record.AddSourceLocation(
C->getModifierLoc());
8262 Record.AddSourceLocation(
C->getLParenLoc());
8266 Record.push_back(
C->varlist_size());
8267 Record.push_back(
C->getUniqueDeclarationsNum());
8268 Record.push_back(
C->getTotalComponentListNum());
8269 Record.push_back(
C->getTotalComponentsNum());
8270 Record.AddSourceLocation(
C->getLParenLoc());
8271 bool HasIteratorModifier =
false;
8273 Record.push_back(
C->getMapTypeModifier(I));
8274 Record.AddSourceLocation(
C->getMapTypeModifierLoc(I));
8275 if (
C->getMapTypeModifier(I) == OMPC_MAP_MODIFIER_iterator)
8276 HasIteratorModifier =
true;
8278 Record.AddNestedNameSpecifierLoc(
C->getMapperQualifierLoc());
8279 Record.AddDeclarationNameInfo(
C->getMapperIdInfo());
8280 Record.push_back(
C->getMapType());
8281 Record.AddSourceLocation(
C->getMapLoc());
8282 Record.AddSourceLocation(
C->getColonLoc());
8283 for (
auto *
E :
C->varlist())
8285 for (
auto *
E :
C->mapperlists())
8287 if (HasIteratorModifier)
8288 Record.AddStmt(
C->getIteratorModifier());
8289 for (
auto *
D :
C->all_decls())
8291 for (
auto N :
C->all_num_lists())
8293 for (
auto N :
C->all_lists_sizes())
8295 for (
auto &M :
C->all_components()) {
8296 Record.AddStmt(M.getAssociatedExpression());
8297 Record.AddDeclRef(M.getAssociatedDeclaration());
8302 Record.push_back(
C->varlist_size());
8303 Record.writeEnum(
C->getFirstAllocateModifier());
8304 Record.writeEnum(
C->getSecondAllocateModifier());
8305 Record.AddSourceLocation(
C->getLParenLoc());
8306 Record.AddSourceLocation(
C->getColonLoc());
8307 Record.AddStmt(
C->getAllocator());
8308 Record.AddStmt(
C->getAlignment());
8309 for (
auto *VE :
C->varlist())
8314 Record.push_back(
C->varlist_size());
8315 VisitOMPClauseWithPreInit(
C);
8316 Record.AddSourceLocation(
C->getLParenLoc());
8317 for (
auto *VE :
C->varlist())
8322 Record.push_back(
C->varlist_size());
8323 VisitOMPClauseWithPreInit(
C);
8324 Record.AddSourceLocation(
C->getLParenLoc());
8325 for (
auto *VE :
C->varlist())
8330 VisitOMPClauseWithPreInit(
C);
8331 Record.AddStmt(
C->getPriority());
8332 Record.AddSourceLocation(
C->getLParenLoc());
8336 VisitOMPClauseWithPreInit(
C);
8337 Record.writeEnum(
C->getModifier());
8338 Record.AddStmt(
C->getGrainsize());
8339 Record.AddSourceLocation(
C->getModifierLoc());
8340 Record.AddSourceLocation(
C->getLParenLoc());
8344 VisitOMPClauseWithPreInit(
C);
8345 Record.writeEnum(
C->getModifier());
8346 Record.AddStmt(
C->getNumTasks());
8347 Record.AddSourceLocation(
C->getModifierLoc());
8348 Record.AddSourceLocation(
C->getLParenLoc());
8353 Record.AddSourceLocation(
C->getLParenLoc());
8357 VisitOMPClauseWithPreInit(
C);
8358 Record.push_back(
C->getDistScheduleKind());
8359 Record.AddStmt(
C->getChunkSize());
8360 Record.AddSourceLocation(
C->getLParenLoc());
8361 Record.AddSourceLocation(
C->getDistScheduleKindLoc());
8362 Record.AddSourceLocation(
C->getCommaLoc());
8366 Record.push_back(
C->getDefaultmapKind());
8367 Record.push_back(
C->getDefaultmapModifier());
8368 Record.AddSourceLocation(
C->getLParenLoc());
8369 Record.AddSourceLocation(
C->getDefaultmapModifierLoc());
8370 Record.AddSourceLocation(
C->getDefaultmapKindLoc());
8373void OMPClauseWriter::VisitOMPToClause(
OMPToClause *
C) {
8374 Record.push_back(
C->varlist_size());
8375 Record.push_back(
C->getUniqueDeclarationsNum());
8376 Record.push_back(
C->getTotalComponentListNum());
8377 Record.push_back(
C->getTotalComponentsNum());
8378 Record.AddSourceLocation(
C->getLParenLoc());
8380 Record.push_back(
C->getMotionModifier(I));
8381 Record.AddSourceLocation(
C->getMotionModifierLoc(I));
8383 Record.AddNestedNameSpecifierLoc(
C->getMapperQualifierLoc());
8384 Record.AddDeclarationNameInfo(
C->getMapperIdInfo());
8385 Record.AddSourceLocation(
C->getColonLoc());
8386 for (
auto *
E :
C->varlist())
8388 for (
auto *
E :
C->mapperlists())
8390 for (
auto *
D :
C->all_decls())
8392 for (
auto N :
C->all_num_lists())
8394 for (
auto N :
C->all_lists_sizes())
8396 for (
auto &M :
C->all_components()) {
8397 Record.AddStmt(M.getAssociatedExpression());
8398 Record.writeBool(M.isNonContiguous());
8399 Record.AddDeclRef(M.getAssociatedDeclaration());
8404 Record.push_back(
C->varlist_size());
8405 Record.push_back(
C->getUniqueDeclarationsNum());
8406 Record.push_back(
C->getTotalComponentListNum());
8407 Record.push_back(
C->getTotalComponentsNum());
8408 Record.AddSourceLocation(
C->getLParenLoc());
8410 Record.push_back(
C->getMotionModifier(I));
8411 Record.AddSourceLocation(
C->getMotionModifierLoc(I));
8413 Record.AddNestedNameSpecifierLoc(
C->getMapperQualifierLoc());
8414 Record.AddDeclarationNameInfo(
C->getMapperIdInfo());
8415 Record.AddSourceLocation(
C->getColonLoc());
8416 for (
auto *
E :
C->varlist())
8418 for (
auto *
E :
C->mapperlists())
8420 for (
auto *
D :
C->all_decls())
8422 for (
auto N :
C->all_num_lists())
8424 for (
auto N :
C->all_lists_sizes())
8426 for (
auto &M :
C->all_components()) {
8427 Record.AddStmt(M.getAssociatedExpression());
8428 Record.writeBool(M.isNonContiguous());
8429 Record.AddDeclRef(M.getAssociatedDeclaration());
8434 Record.push_back(
C->varlist_size());
8435 Record.push_back(
C->getUniqueDeclarationsNum());
8436 Record.push_back(
C->getTotalComponentListNum());
8437 Record.push_back(
C->getTotalComponentsNum());
8438 Record.AddSourceLocation(
C->getLParenLoc());
8439 for (
auto *
E :
C->varlist())
8441 for (
auto *VE :
C->private_copies())
8443 for (
auto *VE :
C->inits())
8445 for (
auto *
D :
C->all_decls())
8447 for (
auto N :
C->all_num_lists())
8449 for (
auto N :
C->all_lists_sizes())
8451 for (
auto &M :
C->all_components()) {
8452 Record.AddStmt(M.getAssociatedExpression());
8453 Record.AddDeclRef(M.getAssociatedDeclaration());
8458 Record.push_back(
C->varlist_size());
8459 Record.push_back(
C->getUniqueDeclarationsNum());
8460 Record.push_back(
C->getTotalComponentListNum());
8461 Record.push_back(
C->getTotalComponentsNum());
8462 Record.AddSourceLocation(
C->getLParenLoc());
8463 for (
auto *
E :
C->varlist())
8465 for (
auto *
D :
C->all_decls())
8467 for (
auto N :
C->all_num_lists())
8469 for (
auto N :
C->all_lists_sizes())
8471 for (
auto &M :
C->all_components()) {
8472 Record.AddStmt(M.getAssociatedExpression());
8473 Record.AddDeclRef(M.getAssociatedDeclaration());
8478 Record.push_back(
C->varlist_size());
8479 Record.push_back(
C->getUniqueDeclarationsNum());
8480 Record.push_back(
C->getTotalComponentListNum());
8481 Record.push_back(
C->getTotalComponentsNum());
8482 Record.AddSourceLocation(
C->getLParenLoc());
8483 for (
auto *
E :
C->varlist())
8485 for (
auto *
D :
C->all_decls())
8487 for (
auto N :
C->all_num_lists())
8489 for (
auto N :
C->all_lists_sizes())
8491 for (
auto &M :
C->all_components()) {
8492 Record.AddStmt(M.getAssociatedExpression());
8493 Record.AddDeclRef(M.getAssociatedDeclaration());
8498 Record.push_back(
C->varlist_size());
8499 Record.push_back(
C->getUniqueDeclarationsNum());
8500 Record.push_back(
C->getTotalComponentListNum());
8501 Record.push_back(
C->getTotalComponentsNum());
8502 Record.AddSourceLocation(
C->getLParenLoc());
8503 for (
auto *
E :
C->varlist())
8505 for (
auto *
D :
C->all_decls())
8507 for (
auto N :
C->all_num_lists())
8509 for (
auto N :
C->all_lists_sizes())
8511 for (
auto &M :
C->all_components()) {
8512 Record.AddStmt(M.getAssociatedExpression());
8513 Record.AddDeclRef(M.getAssociatedDeclaration());
8519void OMPClauseWriter::VisitOMPUnifiedSharedMemoryClause(
8528void OMPClauseWriter::VisitOMPAtomicDefaultMemOrderClause(
8530 Record.push_back(
C->getAtomicDefaultMemOrderKind());
8531 Record.AddSourceLocation(
C->getLParenLoc());
8532 Record.AddSourceLocation(
C->getAtomicDefaultMemOrderKindKwLoc());
8537void OMPClauseWriter::VisitOMPAtClause(
OMPAtClause *
C) {
8538 Record.push_back(
C->getAtKind());
8539 Record.AddSourceLocation(
C->getLParenLoc());
8540 Record.AddSourceLocation(
C->getAtKindKwLoc());
8544 Record.push_back(
C->getSeverityKind());
8545 Record.AddSourceLocation(
C->getLParenLoc());
8546 Record.AddSourceLocation(
C->getSeverityKindKwLoc());
8550 VisitOMPClauseWithPreInit(
C);
8551 Record.AddStmt(
C->getMessageString());
8552 Record.AddSourceLocation(
C->getLParenLoc());
8556 Record.push_back(
C->varlist_size());
8557 Record.AddSourceLocation(
C->getLParenLoc());
8558 for (
auto *VE :
C->varlist())
8560 for (
auto *
E :
C->private_refs())
8565 Record.push_back(
C->varlist_size());
8566 Record.AddSourceLocation(
C->getLParenLoc());
8567 for (
auto *VE :
C->varlist())
8572 Record.push_back(
C->varlist_size());
8573 Record.AddSourceLocation(
C->getLParenLoc());
8574 for (
auto *VE :
C->varlist())
8579 Record.writeEnum(
C->getKind());
8580 Record.writeEnum(
C->getModifier());
8581 Record.AddSourceLocation(
C->getLParenLoc());
8582 Record.AddSourceLocation(
C->getKindKwLoc());
8583 Record.AddSourceLocation(
C->getModifierKwLoc());
8587 Record.push_back(
C->getNumberOfAllocators());
8588 Record.AddSourceLocation(
C->getLParenLoc());
8589 for (
unsigned I = 0,
E =
C->getNumberOfAllocators(); I <
E; ++I) {
8599 Record.push_back(
C->varlist_size());
8600 Record.AddSourceLocation(
C->getLParenLoc());
8601 Record.AddStmt(
C->getModifier());
8602 Record.AddSourceLocation(
C->getColonLoc());
8603 for (
Expr *
E :
C->varlist())
8608 Record.writeEnum(
C->getBindKind());
8609 Record.AddSourceLocation(
C->getLParenLoc());
8610 Record.AddSourceLocation(
C->getBindKindLoc());
8614 VisitOMPClauseWithPreInit(
C);
8616 Record.AddSourceLocation(
C->getLParenLoc());
8620 Record.push_back(
C->varlist_size());
8621 Record.push_back(
C->getNumLoops());
8622 Record.AddSourceLocation(
C->getLParenLoc());
8623 Record.push_back(
C->getDependenceType());
8624 Record.AddSourceLocation(
C->getDependenceLoc());
8625 Record.AddSourceLocation(
C->getColonLoc());
8626 for (
auto *VE :
C->varlist())
8628 for (
unsigned I = 0,
E =
C->getNumLoops(); I <
E; ++I)
8629 Record.AddStmt(
C->getLoopData(I));
8633 Record.AddAttributes(
C->getAttrs());
8634 Record.AddSourceLocation(
C->getBeginLoc());
8635 Record.AddSourceLocation(
C->getLParenLoc());
8636 Record.AddSourceLocation(
C->getEndLoc());
8643 for (
const auto &
Set : TI->
Sets) {
8650 writeExprRef(
Selector.ScoreOrCondition);
8664 for (
unsigned I = 0,
E =
Data->getNumClauses(); I <
E; ++I)
8666 if (
Data->hasAssociatedStmt())
8668 for (
unsigned I = 0,
E =
Data->getNumChildren(); I <
E; ++I)
8674 for (
Expr *
E :
C->getVarList())
8680 for (
Expr *
E : Exprs)
8689 switch (
C->getClauseKind()) {
8691 const auto *DC = cast<OpenACCDefaultClause>(
C);
8697 const auto *IC = cast<OpenACCIfClause>(
C);
8699 AddStmt(
const_cast<Expr*
>(IC->getConditionExpr()));
8703 const auto *SC = cast<OpenACCSelfClause>(
C);
8706 if (SC->isConditionExprClause()) {
8708 if (SC->hasConditionExpr())
8709 AddStmt(
const_cast<Expr *
>(SC->getConditionExpr()));
8712 for (
Expr *
E : SC->getVarList())
8718 const auto *NGC = cast<OpenACCNumGangsClause>(
C);
8721 for (
Expr *
E : NGC->getIntExprs())
8726 const auto *DNC = cast<OpenACCDeviceNumClause>(
C);
8732 const auto *DAC = cast<OpenACCDefaultAsyncClause>(
C);
8738 const auto *NWC = cast<OpenACCNumWorkersClause>(
C);
8744 const auto *NWC = cast<OpenACCVectorLengthClause>(
C);
8750 const auto *PC = cast<OpenACCPrivateClause>(
C);
8754 for (
VarDecl *VD : PC->getInitRecipes())
8759 const auto *HC = cast<OpenACCHostClause>(
C);
8765 const auto *DC = cast<OpenACCDeviceClause>(
C);
8771 const auto *FPC = cast<OpenACCFirstPrivateClause>(
C);
8782 const auto *AC = cast<OpenACCAttachClause>(
C);
8788 const auto *DC = cast<OpenACCDetachClause>(
C);
8794 const auto *DC = cast<OpenACCDeleteClause>(
C);
8800 const auto *UDC = cast<OpenACCUseDeviceClause>(
C);
8806 const auto *DPC = cast<OpenACCDevicePtrClause>(
C);
8812 const auto *NCC = cast<OpenACCNoCreateClause>(
C);
8818 const auto *PC = cast<OpenACCPresentClause>(
C);
8826 const auto *CC = cast<OpenACCCopyClause>(
C);
8835 const auto *CIC = cast<OpenACCCopyInClause>(
C);
8844 const auto *COC = cast<OpenACCCopyOutClause>(
C);
8853 const auto *CC = cast<OpenACCCreateClause>(
C);
8860 const auto *AC = cast<OpenACCAsyncClause>(
C);
8863 if (AC->hasIntExpr())
8868 const auto *WC = cast<OpenACCWaitClause>(
C);
8871 if (
Expr *DNE = WC->getDevNumExpr())
8880 const auto *DTC = cast<OpenACCDeviceTypeClause>(
C);
8885 if (Arg.getIdentifierInfo())
8892 const auto *RC = cast<OpenACCReductionClause>(
C);
8913 const auto *CC = cast<OpenACCCollapseClause>(
C);
8920 const auto *TC = cast<OpenACCTileClause>(
C);
8923 for (
Expr *
E : TC->getSizeExprs())
8928 const auto *GC = cast<OpenACCGangClause>(
C);
8931 for (
unsigned I = 0; I < GC->getNumExprs(); ++I) {
8933 AddStmt(
const_cast<Expr *
>(GC->getExpr(I).second));
8938 const auto *WC = cast<OpenACCWorkerClause>(
C);
8941 if (WC->hasIntExpr())
8946 const auto *VC = cast<OpenACCVectorClause>(
C);
8949 if (VC->hasIntExpr())
8954 const auto *LC = cast<OpenACCLinkClause>(
C);
8960 const auto *DRC = cast<OpenACCDeviceResidentClause>(
C);
8967 const auto *BC = cast<OpenACCBindClause>(
C);
8970 if (BC->isStringArgument())
8979 llvm_unreachable(
"Clause serialization not yet implemented");
8981 llvm_unreachable(
"Invalid Clause Kind");
8990 const OpenACCRoutineDeclAttr *A) {
Defines the clang::ASTContext interface.
static bool isInterestingIdentifier(ASTReader &Reader, const IdentifierInfo &II, bool IsModule)
Whether the given identifier is "interesting".
static NamedDecl * getDeclForLocalLookup(const LangOptions &LangOpts, NamedDecl *D)
Determine the declaration that should be put into the name lookup table to represent the given declar...
static unsigned CreateSLocBufferAbbrev(llvm::BitstreamWriter &Stream)
Create an abbreviation for the SLocEntry that refers to a buffer.
static bool isLookupResultNotInteresting(ASTWriter &Writer, StoredDeclsList &Result)
Returns ture if all of the lookup result are either external, not emitted or predefined.
static void AddLazyVectorDecls(ASTWriter &Writer, Vector &Vec)
static bool IsInternalDeclFromFileContext(const Decl *D)
static TypeID MakeTypeID(ASTContext &Context, QualType T, IdxForTypeTy IdxForType)
static void AddLazyVectorEmiitedDecls(ASTWriter &Writer, Vector &Vec, ASTWriter::RecordData &Record)
static unsigned CreateSLocExpansionAbbrev(llvm::BitstreamWriter &Stream)
Create an abbreviation for the SLocEntry that refers to a macro expansion.
static StringRef bytes(const std::vector< T, Allocator > &v)
static unsigned CreateSLocBufferBlobAbbrev(llvm::BitstreamWriter &Stream, bool Compressed)
Create an abbreviation for the SLocEntry that refers to a buffer's blob.
static void BackpatchSignatureAt(llvm::BitstreamWriter &Stream, const ASTFileSignature &S, uint64_t BitNo)
static const char * adjustFilenameForRelocatableAST(const char *Filename, StringRef BaseDir)
Adjusts the given filename to only write out the portion of the filename that is not part of the syst...
static bool isLocalIdentifierID(IdentifierID ID)
If the.
static unsigned getNumberOfModules(Module *Mod)
Compute the number of modules within the given tree (including the given module).
static bool isImportedDeclContext(ASTReader *Chain, const Decl *D)
static TypeCode getTypeCodeForTypeClass(Type::TypeClass id)
static void AddStmtsExprs(llvm::BitstreamWriter &Stream, ASTWriter::RecordDataImpl &Record)
static void emitBlob(llvm::BitstreamWriter &Stream, StringRef Blob, unsigned SLocBufferBlobCompressedAbbrv, unsigned SLocBufferBlobAbbrv)
static uint64_t EmitCXXBaseSpecifiers(ASTContext &Context, ASTWriter &W, ArrayRef< CXXBaseSpecifier > Bases)
static std::pair< unsigned, unsigned > emitULEBKeyDataLength(unsigned KeyLen, unsigned DataLen, raw_ostream &Out)
Emit key length and data length as ULEB-encoded data, and return them as a pair.
static bool shouldIgnoreMacro(MacroDirective *MD, bool IsModule, const Preprocessor &PP)
static bool cleanPathForOutput(FileManager &FileMgr, SmallVectorImpl< char > &Path)
Prepares a path for being written to an AST file by converting it to an absolute path and removing ne...
static uint64_t EmitCXXCtorInitializers(ASTContext &Context, ASTWriter &W, ArrayRef< CXXCtorInitializer * > CtorInits)
static unsigned CreateSLocFileAbbrev(llvm::BitstreamWriter &Stream)
Create an abbreviation for the SLocEntry that refers to a file.
Defines the Diagnostic-related interfaces.
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Defines the C++ template declaration subclasses.
Defines the clang::Expr interface and subclasses for C++ expressions.
Defines interfaces for clang::FileEntry and clang::FileEntryRef.
Defines the clang::FileManager interface and associated types.
Defines the clang::FileSystemOptions interface.
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines the LambdaCapture class.
Defines several types used to describe C++ lambda expressions that are shared between the parser and ...
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::Target Target
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.
Defines the clang::OpenCLOptions class.
This file defines OpenMP AST classes for clauses.
Defines the clang::Preprocessor interface.
This file declares semantic analysis for CUDA constructs.
This file declares semantic analysis for Objective-C.
static void EmitBlockID(unsigned ID, const char *Name, llvm::BitstreamWriter &Stream, RecordDataImpl &Record)
Emits a block ID in the BLOCKINFO block.
static void EmitRecordID(unsigned ID, const char *Name, llvm::BitstreamWriter &Stream, RecordDataImpl &Record)
Emits a record ID in the BLOCKINFO block.
Defines the clang::SourceLocation class and associated facilities.
Defines implementation details of the clang::SourceManager class.
Defines the SourceManager interface.
Defines various enumerations that describe declaration and type specifiers.
Defines the clang::TargetOptions class.
#define IMPORT(DERIVED, BASE)
#define BLOCK(DERIVED, BASE)
Defines the clang::TypeLoc interface and its subclasses.
C Language Family Type Representation.
Defines version macros and version-related utility functions for Clang.
__DEVICE__ void * memcpy(void *__a, const void *__b, size_t __c)
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
TranslationUnitDecl * getTranslationUnitDecl() const
QualType getRawCFConstantStringType() const
Get the structure type used to representation CFStrings, or NULL if it hasn't yet been built.
QualType getucontext_tType() const
Retrieve the C ucontext_t type.
QualType getFILEType() const
Retrieve the C FILE type.
ArrayRef< Decl * > getModuleInitializers(Module *M)
Get the initializations to perform when importing a module, if any.
const LangOptions & getLangOpts() const
RawCommentList Comments
All comments in this translation unit.
TagDecl * MSTypeInfoTagDecl
QualType getjmp_bufType() const
Retrieve the C jmp_buf type.
QualType getsigjmp_bufType() const
Retrieve the C sigjmp_buf type.
QualType AutoRRefDeductTy
Decl * getVaListTagDecl() const
Retrieve the C type declaration corresponding to the predefined __va_list_tag type used to help defin...
FunctionDecl * getcudaConfigureCallDecl()
import_range local_imports() const
Reads an AST files chain containing the contents of a translation unit.
ModuleManager & getModuleManager()
Retrieve the module manager.
const serialization::reader::DeclContextLookupTable * getLoadedLookupTables(DeclContext *Primary) const
Get the loaded lookup tables for Primary, if any.
const serialization::reader::ModuleLocalLookupTable * getModuleLocalLookupTables(DeclContext *Primary) const
unsigned getTotalNumSubmodules() const
Returns the number of submodules known.
void finalizeForWriting()
Finalizes the AST reader's state before writing an AST file to disk.
void forEachImportedKeyDecl(const Decl *D, Fn Visit)
Run a callback on each imported key declaration of D.
unsigned getTotalNumSelectors() const
Returns the number of selectors found in the chain.
unsigned getModuleFileID(ModuleFile *M)
Get an ID for the given module file.
Decl * getKeyDeclaration(Decl *D)
Returns the first key declaration for the given declaration.
void LoadSelector(Selector Sel)
Load a selector from disk, registering its ID if it exists.
bool isProcessingUpdateRecords()
serialization::reader::LazySpecializationInfoLookupTable * getLoadedSpecializationsLookupTables(const Decl *D, bool IsPartial)
Get the loaded specializations lookup tables for D, if any.
unsigned getTotalNumMacros() const
Returns the number of macros found in the chain.
const serialization::reader::DeclContextLookupTable * getTULocalLookupTables(DeclContext *Primary) const
An object for streaming information to a record.
void AddDeclarationNameInfo(const DeclarationNameInfo &NameInfo)
void AddCXXBaseSpecifiers(ArrayRef< CXXBaseSpecifier > Bases)
Emit a set of C++ base specifiers.
void AddTemplateArgumentList(const TemplateArgumentList *TemplateArgs)
Emit a template argument list.
uint64_t Emit(unsigned Code, unsigned Abbrev=0)
Emit the record to the stream, followed by its substatements, and return its offset.
void AddCXXTemporary(const CXXTemporary *Temp)
Emit a CXXTemporary.
void writeOMPTraitInfo(const OMPTraitInfo *TI)
Write an OMPTraitInfo object.
void AddCXXBaseSpecifier(const CXXBaseSpecifier &Base)
Emit a C++ base specifier.
void writeOMPClause(OMPClause *C)
void writeBool(bool Value)
void AddAPValue(const APValue &Value)
Emit an APvalue.
void AddUnresolvedSet(const ASTUnresolvedSet &Set)
Emit a UnresolvedSet structure.
void AddIdentifierRef(const IdentifierInfo *II)
Emit a reference to an identifier.
void AddStmt(Stmt *S)
Add the given statement or expression to the queue of statements to emit.
void AddDeclarationName(DeclarationName Name)
Emit a declaration name.
void AddTemplateArgumentLocInfo(const TemplateArgumentLoc &Arg)
Emits a template argument location info.
void AddTypeLoc(TypeLoc TL)
Emits source location information for a type. Does not emit the type.
void AddSelectorRef(Selector S)
Emit a Selector (which is a smart pointer reference).
void writeSourceLocation(SourceLocation Loc)
void AddOffset(uint64_t BitOffset)
Add a bit offset into the record.
void AddTypeRef(QualType T)
Emit a reference to a type.
void writeQualType(QualType T)
void writeOpenACCClauseList(ArrayRef< const OpenACCClause * > Clauses)
Writes out a list of OpenACC clauses.
void push_back(uint64_t N)
Minimal vector-like interface.
void AddCXXCtorInitializers(ArrayRef< CXXCtorInitializer * > CtorInits)
Emit a CXXCtorInitializer array.
void AddTemplateParameterList(const TemplateParameterList *TemplateParams)
Emit a template parameter list.
void AddTemplateArgument(const TemplateArgument &Arg)
Emit a template argument.
void AddDeclarationNameLoc(const DeclarationNameLoc &DNLoc, DeclarationName Name)
void writeOpenACCIntExprList(ArrayRef< Expr * > Exprs)
void AddAPFloat(const llvm::APFloat &Value)
Emit a floating-point value.
void AddTypeSourceInfo(TypeSourceInfo *TInfo)
Emits a reference to a declarator info.
void AddQualifierInfo(const QualifierInfo &Info)
void writeUInt32(uint32_t Value)
void AddDeclRef(const Decl *D)
Emit a reference to a declaration.
void writeOMPChildren(OMPChildren *Data)
Writes data related to the OpenMP directives.
void AddConceptReference(const ConceptReference *CR)
void AddSourceRange(SourceRange Range)
Emit a source range.
void AddAPInt(const llvm::APInt &Value)
Emit an integral value.
void AddSourceLocation(SourceLocation Loc)
Emit a source location.
void writeOpenACCVarList(const OpenACCClauseWithVarList *C)
void AddAttributes(ArrayRef< const Attr * > Attrs)
Emit a list of attributes.
void AddASTTemplateArgumentListInfo(const ASTTemplateArgumentListInfo *ASTTemplArgList)
Emits an AST template argument list info.
void AddCXXDefinitionData(const CXXRecordDecl *D)
void AddVarDeclInit(const VarDecl *VD)
Emit information about the initializer of a VarDecl.
void writeStmtRef(const Stmt *S)
void AddTemplateArgumentLoc(const TemplateArgumentLoc &Arg)
Emits a template argument location.
void AddNestedNameSpecifierLoc(NestedNameSpecifierLoc NNS)
Emit a nested name specifier with source-location information.
void AddOpenACCRoutineDeclAttr(const OpenACCRoutineDeclAttr *A)
void writeOpenACCClause(const OpenACCClause *C)
Writes out a single OpenACC Clause.
void AddAttr(const Attr *A)
An UnresolvedSet-like class which uses the ASTContext's allocator.
Writes an AST file containing the contents of a translation unit.
void AddEmittedDeclRef(const Decl *D, RecordDataImpl &Record)
bool isWritingStdCXXNamedModules() const
void EmitRecordWithPath(unsigned Abbrev, RecordDataRef Record, StringRef Path)
Emit the current record with the given path as a blob.
void AddFileID(FileID FID, RecordDataImpl &Record)
Emit a FileID.
bool isDeclPredefined(const Decl *D) const
void AddPath(StringRef Path, RecordDataImpl &Record)
Add a path to the given record.
unsigned getTypeExtQualAbbrev() const
void AddVersionTuple(const VersionTuple &Version, RecordDataImpl &Record)
Add a version tuple to the given record.
bool isGeneratingReducedBMI() const
uint32_t getMacroDirectivesOffset(const IdentifierInfo *Name)
void AddAlignPackInfo(const Sema::AlignPackInfo &Info, RecordDataImpl &Record)
Emit a AlignPackInfo.
void AddPathBlob(StringRef Str, RecordDataImpl &Record, SmallVectorImpl< char > &Blob)
bool IsLocalDecl(const Decl *D)
Is this a local declaration (that is, one that will be written to our AST file)? This is the case for...
void AddTypeRef(ASTContext &Context, QualType T, RecordDataImpl &Record)
Emit a reference to a type.
bool wasDeclEmitted(const Decl *D) const
Whether or not the declaration got emitted.
void AddString(StringRef Str, RecordDataImpl &Record)
Add a string to the given record.
time_t getTimestampForOutput(const FileEntry *E) const
Get a timestamp for output into the AST file.
bool isWritingModule() const
LocalDeclID GetDeclRef(const Decl *D)
Force a declaration to be emitted and get its local ID to the module file been writing.
void AddSourceRange(SourceRange Range, RecordDataImpl &Record)
Emit a source range.
LocalDeclID getDeclID(const Decl *D)
Determine the local declaration ID of an already-emitted declaration.
void AddSourceLocation(SourceLocation Loc, RecordDataImpl &Record)
Emit a source location.
void addTouchedModuleFile(serialization::ModuleFile *)
void AddIdentifierRef(const IdentifierInfo *II, RecordDataImpl &Record)
Emit a reference to an identifier.
const CodeGenOptions & getCodeGenOpts() const
serialization::MacroID getMacroRef(MacroInfo *MI, const IdentifierInfo *Name)
Get the unique number used to refer to the given macro.
SourceLocationEncoding::RawLocEncoding getRawSourceLocationEncoding(SourceLocation Loc)
Return the raw encodings for source locations.
ASTFileSignature WriteAST(llvm::PointerUnion< Sema *, Preprocessor * > Subject, StringRef OutputFile, Module *WritingModule, StringRef isysroot, bool ShouldCacheASTInMemory=false)
Write a precompiled header or a module with the AST produced by the Sema object, or a dependency scan...
ASTReader * getChain() const
bool getDoneWritingDeclsAndTypes() const
serialization::IdentifierID getIdentifierRef(const IdentifierInfo *II)
Get the unique number used to refer to the given identifier.
ASTWriter(llvm::BitstreamWriter &Stream, SmallVectorImpl< char > &Buffer, ModuleCache &ModCache, const CodeGenOptions &CodeGenOpts, ArrayRef< std::shared_ptr< ModuleFileExtension > > Extensions, bool IncludeTimestamps=true, bool BuildingImplicitModule=false, bool GeneratingReducedBMI=false)
Create a new precompiled header writer that outputs to the given bitstream.
void handleVTable(CXXRecordDecl *RD)
unsigned getLocalOrImportedSubmoduleID(const Module *Mod)
Retrieve or create a submodule ID for this module, or return 0 if the submodule is neither local (a s...
void AddToken(const Token &Tok, RecordDataImpl &Record)
Emit a token.
void AddLookupOffsets(const LookupBlockOffsets &Offsets, RecordDataImpl &Record)
serialization::SelectorID getSelectorRef(Selector Sel)
Get the unique number used to refer to the given selector.
SmallVector< uint64_t, 64 > RecordData
serialization::TypeID GetOrCreateTypeID(ASTContext &Context, QualType T)
Force a type to be emitted and get its ID.
unsigned getAnonymousDeclarationNumber(const NamedDecl *D)
const LangOptions & getLangOpts() const
void SetSelectorOffset(Selector Sel, uint32_t Offset)
Note that the selector Sel occurs at the given offset within the method pool/selector table.
bool PreparePathForOutput(SmallVectorImpl< char > &Path)
Convert a path from this build process into one that is appropriate for emission in the module file.
void SetIdentifierOffset(const IdentifierInfo *II, uint32_t Offset)
Note that the identifier II occurs at the given offset within the identifier table.
void AddDeclRef(const Decl *D, RecordDataImpl &Record)
Emit a reference to a declaration.
void AddStringBlob(StringRef Str, RecordDataImpl &Record, SmallVectorImpl< char > &Blob)
Wrapper for source info for array parameter types.
Wrapper for source info for arrays.
SourceLocation getLBracketLoc() const
Expr * getSizeExpr() const
SourceLocation getRBracketLoc() const
SourceLocation getRParenLoc() const
SourceLocation getKWLoc() const
SourceLocation getLParenLoc() const
Attr - This represents one attribute.
attr::Kind getKind() const
SourceLocation getScopeLoc() const
SourceRange getRange() const
const IdentifierInfo * getScopeName() const
bool isRegularKeywordAttribute() const
const IdentifierInfo * getAttrName() const
Kind getParsedKind() const
Type source information for an attributed type.
const Attr * getAttr() const
The type attribute.
SourceLocation getRParenLoc() const
bool isDecltypeAuto() const
bool isConstrained() const
ConceptReference * getConceptReference() const
Type source information for an btf_tag attributed type.
A simple helper class to pack several bits in order into (a) 32 bit integer(s).
void addBits(uint32_t Value, uint32_t BitsWidth)
Wrapper for source info for block pointers.
SourceLocation getCaretLoc() const
Wrapper for source info for builtin types.
SourceLocation getBuiltinLoc() const
TypeSpecifierType getWrittenTypeSpec() const
TypeSpecifierWidth getWrittenWidthSpec() const
bool needsExtraLocalData() const
TypeSpecifierSign getWrittenSignSpec() const
This class is used for builtin types like 'int'.
Represents a base class of a C++ class.
Represents a C++ destructor within a class.
Represents a C++ struct/union/class.
Represents a C++ temporary.
const CXXDestructorDecl * getDestructor() const
Declaration of a class template.
Represents a class template specialization, which refers to a class template with a given set of temp...
CompatibilityKind
For ASTs produced with different option value, signifies their level of compatibility.
CodeGenOptions - Track various options which control how the code is optimized and passed to the back...
A reference to a concept and its template args, as it appears in the code.
const NestedNameSpecifierLoc & getNestedNameSpecifierLoc() const
NamedDecl * getFoundDecl() const
const DeclarationNameInfo & getConceptNameInfo() const
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
TemplateDecl * getNamedConcept() const
SourceLocation getTemplateKWLoc() const
Wrapper for source info for pointers decayed from arrays and functions.
The results of name lookup within a DeclContext.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
bool isFileContext() const
lookup_result lookup(DeclarationName Name) const
lookup - Find the declarations (if any) with the given Name in this context.
bool isLookupContext() const
Test whether the context supports looking up names.
bool isTranslationUnit() const
DeclContext * getRedeclContext()
getRedeclContext - Retrieve the context in which an entity conflicts with other entities of the same ...
StoredDeclsMap * buildLookup()
Ensure the lookup structure is fully-built and return it.
lookup_result noload_lookup(DeclarationName Name)
Find the declarations with the given name that are visible within this context; don't attempt to retr...
decl_range noload_decls() const
noload_decls_begin/end - Iterate over the declarations stored in this context that are currently load...
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.
bool isFunctionOrMethod() const
StoredDeclsMap * getLookupPtr() const
Retrieve the internal representation of the lookup structure.
DeclID getRawValue() const
A helper iterator adaptor to convert the iterators to SmallVector<SomeDeclID> to the iterators to Sma...
Decl - This represents one declaration (or definition), e.g.
Decl * getPreviousDecl()
Retrieve the previous declaration that declares the same entity as this declaration,...
Decl * getMostRecentDecl()
Retrieve the most recent declaration that declares the same entity as this declaration (which may be ...
Module * getTopLevelOwningNamedModule() const
Get the top level owning named module that owns this declaration if any.
FriendObjectKind getFriendObjectKind() const
Determines whether this declaration is the object of a friend declaration and, if so,...
ASTContext & getASTContext() const LLVM_READONLY
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
bool isInNamedModule() const
Whether this declaration comes from a named module.
bool isUnconditionallyVisible() const
Determine whether this declaration is definitely visible to name lookup, independent of whether the o...
@ FOK_None
Not a friend object.
bool isCanonicalDecl() const
Whether this particular Decl is a canonical one.
Module * getOwningModule() const
Get the module that owns this declaration (for visibility purposes).
bool isFirstDecl() const
True if this is the first declaration in its redeclaration chain.
bool isFromExplicitGlobalModule() const
Whether this declaration comes from explicit global module.
bool isFromASTFile() const
Determine whether this declaration came from an AST file (such as a precompiled header or module) rat...
DeclContext * getNonTransparentDeclContext()
Return the non transparent context.
SourceLocation getLocation() const
DeclContext * getDeclContext()
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC).
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
GlobalDeclID getGlobalID() const
Retrieve the global declaration ID associated with this declaration, which specifies where this Decl ...
DeclarationNameLoc - Additional source/type location info for a declaration name.
SourceLocation getCXXLiteralOperatorNameLoc() const
Return the location of the literal operator name (without the operator keyword).
TypeSourceInfo * getNamedTypeInfo() const
Returns the source type info.
SourceRange getCXXOperatorNameRange() const
Return the range of the operator name (without the operator keyword).
The name of a declaration.
@ CXXConversionFunctionName
SourceLocation getDecltypeLoc() const
SourceLocation getRParenLoc() const
SourceLocation getElaboratedKeywordLoc() const
SourceLocation getTemplateNameLoc() const
NestedNameSpecifierLoc getQualifierLoc() const
Expr * getAttrExprOperand() const
The attribute's expression operand, if it has one.
SourceRange getAttrOperandParensRange() const
The location of the parentheses around the operand, if there is an operand.
SourceLocation getAttrNameLoc() const
The location of the attribute name, i.e.
NestedNameSpecifierLoc getQualifierLoc() const
SourceLocation getNameLoc() const
SourceLocation getElaboratedKeywordLoc() const
SourceLocation getNameLoc() const
unsigned getNumArgs() const
SourceLocation getTemplateNameLoc() const
SourceLocation getLAngleLoc() const
SourceLocation getTemplateKeywordLoc() const
TemplateArgumentLoc getArgLoc(unsigned i) const
SourceLocation getRAngleLoc() const
SourceLocation getElaboratedKeywordLoc() const
NestedNameSpecifierLoc getQualifierLoc() const
SourceLocation getNameLoc() const
Options for controlling the compiler diagnostics engine.
std::vector< std::string > Remarks
The list of -R... options used to alter the diagnostic mappings, with the prefixes removed.
std::vector< std::string > Warnings
The list of -W... options used to alter the diagnostic mappings, with the prefixes removed.
Concrete class used by the front-end to report problems and issues.
bool hasUncompilableErrorOccurred() const
Errors that actually prevent compilation, not those that are upgraded from a warning by -Werror.
StringRef getName() const
SourceLocation getElaboratedKeywordLoc() const
SourceLocation getNameLoc() const
NestedNameSpecifierLoc getQualifierLoc() const
Wrapper for source info for enum types.
This represents one expression.
Represents difference between two FPOptions values.
storage_type getAsOpaqueInt() const
storage_type getAsOpaqueInt() const
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...
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.
void trackVFSUsage(bool Active)
Enable or disable tracking of VFS usage.
llvm::vfs::FileSystem & getVirtualFileSystem() const
llvm::ErrorOr< std::unique_ptr< llvm::MemoryBuffer > > getBufferForFile(FileEntryRef Entry, bool isVolatile=false, bool RequiresNullTerminator=true, std::optional< int64_t > MaybeLimit=std::nullopt, bool IsText=true)
Open the specified file as a MemoryBuffer, returning a new MemoryBuffer if successful,...
OptionalFileEntryRef getOptionalFileRef(StringRef Filename, bool OpenFile=false, bool CacheFailure=true)
Get a FileEntryRef if it exists, without doing anything on error.
void GetUniqueIDMapping(SmallVectorImpl< OptionalFileEntryRef > &UIDToFiles) const
Produce an array mapping from the unique IDs assigned to each file to the corresponding FileEntryRef.
bool makeAbsolutePath(SmallVectorImpl< char > &Path) const
Makes Path absolute taking into account FileSystemOptions and the working directory option.
FileSystemOptions & getFileSystemOpts()
Returns the current file system options.
OptionalDirectoryEntryRef getOptionalDirectoryRef(StringRef DirName, bool CacheFailure=true)
Get a DirectoryEntryRef if it exists, without doing anything on error.
Keeps track of options that affect how file operations are performed.
std::string WorkingDir
If set, paths are resolved as if the working directory was set to the value of WorkingDir.
Represents a function declaration or definition.
Represents a prototype with parameter type info, e.g.
Declaration of a template function.
Wrapper for source info for functions.
unsigned getNumParams() const
ParmVarDecl * getParam(unsigned i) const
SourceLocation getLocalRangeEnd() const
SourceRange getExceptionSpecRange() const
SourceLocation getLocalRangeBegin() const
SourceLocation getLParenLoc() const
SourceLocation getRParenLoc() const
Type source information for HLSL attributed resource type.
One of these records is kept for each identifier that is lexed.
unsigned getLength() const
Efficiently return the length of this identifier info.
unsigned getBuiltinID() const
Return a value indicating whether this is a builtin function.
bool hasChangedSinceDeserialization() const
Determine whether this identifier has changed since it was loaded from an AST file.
bool isCPlusPlusOperatorKeyword() const
bool hasFETokenInfoChangedSinceDeserialization() const
Determine whether the frontend token information for this identifier has changed since it was loaded ...
bool hasMacroDefinition() const
Return true if this identifier is #defined to some other value.
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.
const char * getNameStart() const
Return the beginning of the actual null-terminated string for this identifier.
tok::NotableIdentifierKind getNotableIdentifierID() const
unsigned getObjCOrBuiltinID() const
tok::ObjCKeywordKind getObjCKeywordID() const
Return the Objective-C keyword ID for the this identifier.
void * getFETokenInfo() const
Get and set FETokenInfo.
StringRef getName() const
Return the actual identifier string.
bool isExtensionToken() const
get/setExtension - Initialize information about whether or not this language token is an extension.
A simple pair of identifier info and location.
IdentifierResolver - Keeps track of shadowed decls on enclosing scopes.
iterator begin(DeclarationName Name)
Returns an iterator over decls with the name 'Name'.
iterator end()
Returns the end iterator.
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.
llvm::MemoryBuffer & addBuiltPCM(llvm::StringRef Filename, std::unique_ptr< llvm::MemoryBuffer > Buffer)
Store a just-built PCM under the Filename.
Wrapper for source info for injected class names of class templates.
SourceLocation getAmpLoc() const
Describes the capture of a variable or of this, or of a C++1y init-capture.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
clang::ObjCRuntime ObjCRuntime
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 ...
Used to hold and unique data used to represent #line information.
Record the location of a macro definition.
Encapsulates changes to the "macros namespace" (the location where the macro name became active,...
const MacroDirective * getPrevious() const
Get previous definition of the macro with the same name.
const MacroInfo * getMacroInfo() const
SourceLocation getLocation() const
Encapsulates the data about a macro definition (e.g.
bool isUsed() const
Return false if this macro is defined in the main file and has not yet been used.
bool isC99Varargs() const
SourceLocation getDefinitionEndLoc() const
Return the location of the last token in the macro.
ArrayRef< const IdentifierInfo * > params() const
unsigned getNumTokens() const
Return the number of tokens that this macro expands to.
unsigned getNumParams() const
const Token & getReplacementToken(unsigned Tok) const
bool isBuiltinMacro() const
Return true if this macro requires processing before expansion.
SourceLocation getDefinitionLoc() const
Return the location that the macro was defined at.
bool hasCommaPasting() const
bool isObjectLike() const
bool isUsedForHeaderGuard() const
Determine whether this macro was used for a header guard.
bool isGNUVarargs() const
SourceLocation getExpansionLoc() const
Expr * getAttrColumnOperand() const
The attribute's column operand, if it has one.
SourceRange getAttrOperandParensRange() const
The location of the parentheses around the operand, if there is an operand.
SourceLocation getAttrNameLoc() const
The location of the attribute name, i.e.
Expr * getAttrRowOperand() const
The attribute's row operand, if it has one.
Wrapper for source info for member pointers.
NestedNameSpecifierLoc getQualifierLoc() const
SourceLocation getStarLoc() const
The module cache used for compiling modules implicitly.
virtual InMemoryModuleCache & getInMemoryModuleCache()=0
Returns this process's view of the module cache.
Abstract base class that writes a module file extension block into a module file.
virtual void writeExtensionContents(Sema &SemaRef, llvm::BitstreamWriter &Stream)=0
Write the contents of the extension block into the given bitstream.
ModuleFileExtension * getExtension() const
Retrieve the module file extension with which this writer is associated.
virtual ModuleFileExtensionMetadata getExtensionMetadata() const =0
Retrieves the metadata for this module file extension.
void resolveHeaderDirectives(const FileEntry *File) const
Resolve all lazy header directives for the specified file.
ArrayRef< KnownHeader > findResolvedModulesForHeader(FileEntryRef File) const
Like findAllModulesForHeader, but do not attempt to infer module ownership from umbrella headers if w...
FileID getModuleMapFileIDForUniquing(const Module *M) const
Get the module map file that (along with the module name) uniquely identifies this module.
FileID getContainingModuleMapFileID(const Module *Module) const
Retrieve the module map file containing the definition of the given module.
ModuleHeaderRole
Flags describing the role of a module header.
static ModuleHeaderRole headerKindToRole(Module::HeaderKind Kind)
Convert a header kind to a role. Requires Kind to not be HK_Excluded.
Describes a module or submodule.
unsigned IsExplicit
Whether this is an explicit submodule.
SmallVector< ExportDecl, 2 > Exports
The set of export declarations.
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...
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.
Module * Parent
The parent of this module.
ModuleKind Kind
The kind of this module.
bool isUnimportable() const
Determine whether this module has been declared unimportable.
unsigned IsInferred
Whether this is an inferred submodule (module * { ... }).
llvm::SmallSetVector< Module *, 2 > Imports
The set of modules imported by this module, and on which this module depends.
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.
llvm::iterator_range< submodule_iterator > submodules()
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.
std::optional< Header > getUmbrellaHeaderAsWritten() const
Retrieve the umbrella header as written.
SmallVector< Requirement, 2 > Requirements
The set of language features required to use this module.
llvm::SmallSetVector< const Module *, 2 > UndeclaredUses
When NoUndeclaredIncludes is true, the set of modules this module tried to import but didn't because ...
OptionalDirectoryEntryRef Directory
The build directory of this module.
unsigned NamedModuleHasInit
Whether this C++20 named modules doesn't need an initializer.
llvm::SmallSetVector< Module *, 2 > AffectingClangModules
The set of top-level modules that affected the compilation of this module, but were not imported.
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.
ArrayRef< Header > getHeaders(HeaderKind HK) const
unsigned InferExportWildcard
Whether, when inferring submodules, the inferr submodules should export all modules they import (e....
ArrayRef< FileEntryRef > getTopHeaders(FileManager &FileMgr)
The top-level headers associated with this module.
std::optional< DirectoryName > getUmbrellaDirAsWritten() const
Retrieve the umbrella directory as written.
bool isHeaderUnit() const
Is this module a header unit.
@ ModuleMapModule
This is a module that was defined by a module map and built out of header files.
unsigned IsFramework
Whether this is a framework module.
std::string ExportAsModule
The module through which entities defined in this module will eventually be exposed,...
std::string getFullModuleName(bool AllowStringLiterals=false) const
Retrieve the full name of this module, including the path from its top-level module.
bool isNamedModule() const
Does this Module is a named module of a standard named module?
unsigned InferExplicitSubmodules
Whether, when inferring submodules, the inferred submodules should be explicit.
Module * getTopLevelModule()
Retrieve the top-level module for this (sub)module, which may be this module.
std::vector< Conflict > Conflicts
The list of conflicts.
This represents a decl that may have a name.
Represent a C++ namespace.
A C++ nested-name-specifier augmented with source location information.
NamespaceAndPrefixLoc getAsNamespaceAndPrefix() const
NestedNameSpecifier getNestedNameSpecifier() const
Retrieve the nested-name-specifier to which this instance refers.
TypeLoc castAsTypeLoc() const
For a nested-name-specifier that refers to a type, retrieve the type with source-location information...
SourceRange getLocalSourceRange() const
Retrieve the source range covering just the last part of this nested-name-specifier,...
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
Kind
The kind of specifier that completes this nested name specifier.
@ MicrosoftSuper
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in.
@ Global
The global specifier '::'. There is no stored value.
@ Type
A type, stored as a Type*.
@ Namespace
A namespace-like entity, stored as a NamespaceBaseDecl*.
This represents the 'absent' clause in the '#pragma omp assume' directive.
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.
This represents the 'align' clause in the '#pragma omp allocate' directive.
This represents clause 'aligned' in the '#pragma omp ...' directives.
This represents clause 'allocate' in the '#pragma omp ...' directives.
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.
This represents 'capture' clause in the '#pragma omp atomic' directive.
Contains data for OpenMP directives: clauses, children expressions/statements (helpers for codegen) a...
Class that handles post-update expression for some clauses, like 'lastprivate', 'reduction' etc.
Class that handles pre-initialization statement for some clauses, like 'schedule',...
This is a basic class for representing single OpenMP clause.
This represents 'collapse' clause in the '#pragma omp ...' directive.
This represents 'compare' clause in the '#pragma omp atomic' directive.
This represents the 'contains' clause in the '#pragma omp assume' directive.
This represents clause 'copyin' in the '#pragma omp ...' directives.
This represents clause 'copyprivate' in the '#pragma omp ...' directives.
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.
This represents implicit clause 'depobj' for the '#pragma omp depobj' directive.
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.
This represents 'dynamic_allocators' clause in the '#pragma omp requires' directive.
This represents clause 'exclusive' in the '#pragma omp scan' directive.
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.
This represents implicit clause 'flush' for the '#pragma omp flush' directive.
This represents clause 'from' in the '#pragma omp ...' directives.
Representation of the 'full' clause of the '#pragma omp unroll' directive.
This represents 'grainsize' clause in the '#pragma omp ...' directive.
This represents clause 'has_device_ptr' in the '#pragma omp ...' directives.
This represents 'hint' clause in the '#pragma omp ...' directive.
This represents the 'holds' clause in the '#pragma omp assume' directive.
This represents 'if' clause in the '#pragma omp ...' directive.
This represents clause 'in_reduction' in the '#pragma omp task' directives.
This represents clause 'inclusive' in the '#pragma omp scan' directive.
This represents the 'init' clause in '#pragma omp ...' directives.
This represents clause 'is_device_ptr' in the '#pragma omp ...' directives.
This represents clause 'lastprivate' in the '#pragma omp ...' directives.
This represents clause 'linear' in the '#pragma omp ...' directives.
This represents clause 'map' in the '#pragma omp ...' directives.
This represents 'mergeable' clause in the '#pragma omp ...' directive.
This represents the 'message' clause in the '#pragma omp error' and the '#pragma omp parallel' direct...
This represents the 'no_openmp' clause in the '#pragma omp assume' directive.
This represents the 'no_openmp_constructs' clause in the.
This represents the 'no_openmp_routines' clause in the '#pragma omp assume' directive.
This represents the 'no_parallelism' clause in the '#pragma omp assume' directive.
This represents 'nocontext' clause in the '#pragma omp ...' directive.
This represents 'nogroup' clause in the '#pragma omp ...' directive.
This represents clause 'nontemporal' in the '#pragma omp ...' directives.
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.
Representation of the 'partial' clause of the '#pragma omp unroll' directive.
This class represents the 'permutation' clause in the '#pragma omp interchange' directive.
This represents 'priority' clause in the '#pragma omp ...' directive.
This represents clause 'private' in the '#pragma omp ...' directives.
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.
This represents 'relaxed' clause in the '#pragma omp atomic' directives.
This represents 'release' clause in the '#pragma omp atomic|flush' directives.
This represents 'reverse_offload' clause in the '#pragma omp requires' directive.
This represents 'simd' clause in the '#pragma omp ...' directive.
This represents 'safelen' clause in the '#pragma omp ...' directive.
This represents 'schedule' clause in the '#pragma omp ...' directive.
This represents 'self_maps' clause in the '#pragma omp requires' directive.
This represents 'seq_cst' clause in the '#pragma omp atomic|flush' directives.
This represents the 'severity' clause in the '#pragma omp error' and the '#pragma omp parallel' direc...
This represents clause 'shared' in the '#pragma omp ...' directives.
This represents 'simdlen' clause in the '#pragma omp ...' directive.
This represents the 'sizes' clause in the '#pragma omp tile' directive.
This represents clause 'task_reduction' in the '#pragma omp taskgroup' directives.
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.
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.
This represents the 'use' clause in '#pragma omp ...' directives.
This represents clause 'use_device_addr' in the '#pragma omp ...' directives.
This represents clause 'use_device_ptr' in the '#pragma omp ...' directives.
This represents clause 'uses_allocators' in the '#pragma omp target'-based directives.
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.
ObjCCategoryDecl - Represents a category declaration.
Iterator that walks over the list of categories, filtering out those that do not meet specific criter...
Represents an ObjC class declaration.
ObjCInterfaceDecl * getDefinition()
Retrieve the definition of this class, or NULL if this class has been forward-declared (with @class) ...
Wrapper for source info for ObjC interfaces.
SourceLocation getNameEndLoc() const
SourceLocation getNameLoc() const
Wraps an ObjCPointerType with source location information.
SourceLocation getStarLoc() const
bool hasBaseTypeAsWritten() const
SourceLocation getTypeArgsLAngleLoc() const
unsigned getNumTypeArgs() const
unsigned getNumProtocols() const
TypeSourceInfo * getTypeArgTInfo(unsigned i) const
SourceLocation getProtocolRAngleLoc() const
SourceLocation getProtocolLoc(unsigned i) const
SourceLocation getProtocolLAngleLoc() const
SourceLocation getTypeArgsRAngleLoc() const
const VersionTuple & getVersion() const
ProtocolLAngleLoc, ProtocolRAngleLoc, and the source locations for protocol qualifiers are stored aft...
unsigned getNumProtocols() const
SourceLocation getProtocolLoc(unsigned i) const
SourceLocation getProtocolLAngleLoc() const
SourceLocation getProtocolRAngleLoc() const
Represents a clause with one or more 'var' objects, represented as an expr, as its arguments.
This is the base type for all OpenACC Clauses.
OpenCL supported extensions and optional core features.
SourceLocation getEllipsisLoc() const
SourceLocation getEllipsisLoc() const
SourceLocation getRParenLoc() const
SourceLocation getLParenLoc() const
Represents a parameter to a function.
SourceLocation getKWLoc() const
Wrapper for source info for pointers.
SourceLocation getStarLoc() const
Iteration over the preprocessed entities.
A record of the steps taken while preprocessing a source file, including the various preprocessing di...
MacroDefinitionRecord * findMacroDefinition(const MacroInfo *MI)
Retrieve the macro definition that corresponds to the given MacroInfo.
const std::vector< SourceRange > & getSkippedRanges()
Retrieve all ranges that got skipped while preprocessing.
iterator local_begin()
Begin iterator for local, non-loaded, preprocessed entities.
iterator local_end()
End iterator for local, non-loaded, preprocessed entities.
PreprocessorOptions - This class is used for passing the various options used in preprocessor initial...
std::vector< std::string > MacroIncludes
std::vector< std::string > Includes
bool WriteCommentListToPCH
Whether to write comment locations into the PCH when building it.
ObjCXXARCStandardLibraryKind ObjCXXARCStandardLibrary
The Objective-C++ ARC standard library that we should support, by providing appropriate definitions t...
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 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.
ArrayRef< ModuleMacro * > getLeafModuleMacros(const IdentifierInfo *II) const
Get the list of leaf (non-overridden) module macros for a name.
ArrayRef< PPConditionalInfo > getPreambleConditionalStack() const
SourceLocation getModuleImportLoc(Module *M) const
bool isRecordingPreamble() const
MacroDirective * getLocalMacroDirectiveHistory(const IdentifierInfo *II) const
Given an identifier, return the latest non-imported macro directive for that identifier.
bool SawDateOrTime() const
Returns true if the preprocessor has seen a use of DATE or TIME in the file so far.
unsigned getCounterValue() const
SourceManager & getSourceManager() const
std::optional< PreambleSkipInfo > getPreambleSkipInfo() const
bool hasRecordedPreamble() const
const TargetInfo & getTargetInfo() const
FileManager & getFileManager() const
bool alreadyIncluded(FileEntryRef File) const
Return true if this header has already been included.
FileID getPredefinesFileID() const
Returns the FileID for the preprocessor predefines.
HeaderSearch & getHeaderSearchInfo() const
SmallVector< SourceLocation, 64 > serializeSafeBufferOptOutMap() const
IdentifierTable & getIdentifierTable()
const PreprocessorOptions & getPreprocessorOpts() const
Retrieve the preprocessor options used to initialize this preprocessor.
const LangOptions & getLangOpts() const
PreprocessingRecord * getPreprocessingRecord() const
Retrieve the preprocessing record, or NULL if there is no preprocessing record.
DiagnosticsEngine & getDiagnostics() const
SourceLocation getPreambleRecordedPragmaAssumeNonNullLoc() const
Get the location of the recorded unterminated #pragma clang assume_nonnull begin in the preamble,...
DiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID) const
Forwarding function for diagnostics.
A (possibly-)qualified type.
Wrapper of type source information for a type with non-trivial direct qualifiers.
The collection of all-type qualifiers we support.
SourceLocation getAmpAmpLoc() const
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...
decl_type * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
Smart pointer class that efficiently represents Objective-C method names.
const IdentifierInfo * getIdentifierInfoForSlot(unsigned argIndex) const
Retrieve the identifier at a given position in the selector.
void * getAsOpaquePtr() const
unsigned getNumArgs() const
void updateOutOfDateSelector(Selector Sel)
llvm::MapVector< Selector, SourceLocation > ReferencedSelectors
Method selectors used in a @selector expression.
GlobalMethodPool MethodPool
Method Pool - allows efficient lookup when typechecking messages to "id".
static uint32_t getRawEncoding(const AlignPackInfo &Info)
Sema - This implements semantic analysis and AST building for C.
llvm::SmallSetVector< const TypedefNameDecl *, 4 > UnusedLocalTypedefNameCandidates
Set containing all typedefs that are likely unused.
DelegatingCtorDeclsType DelegatingCtorDecls
All the delegating constructors seen so far in the file, used for cycle detection at the end of the T...
Preprocessor & getPreprocessor() const
PragmaStack< FPOptionsOverride > FpPragmaStack
ExtVectorDeclsType ExtVectorDecls
ExtVectorDecls - This is a list all the extended vector types.
SourceLocation getOptimizeOffPragmaLocation() const
Get the location for the currently active "\#pragma clang optimize off". If this location is invalid,...
FPOptionsOverride CurFPFeatureOverrides()
LateParsedTemplateMapT LateParsedTemplateMap
UnusedFileScopedDeclsType UnusedFileScopedDecls
The set of file scoped decls seen so far that have not been used and must warn if not used.
SmallVector< const Decl * > DeclsWithEffectsToVerify
All functions/lambdas/blocks which have bodies and which have a non-empty FunctionEffectsRef to be ve...
EnumDecl * getStdAlignValT() const
LazyDeclPtr StdBadAlloc
The C++ "std::bad_alloc" class, which is defined by the C++ standard library.
SmallVector< VTableUse, 16 > VTableUses
The list of vtables that are required but have not yet been materialized.
llvm::MapVector< const FunctionDecl *, std::unique_ptr< LateParsedTemplate > > LateParsedTemplateMapT
CXXRecordDecl * getStdBadAlloc() const
SourceLocation ImplicitMSInheritanceAttrLoc
Source location for newly created implicit MSInheritanceAttrs.
llvm::DenseMap< CXXRecordDecl *, bool > VTablesUsed
The set of classes whose vtables have been used within this translation unit, and a bit that will be ...
PragmaStack< AlignPackInfo > AlignPackStack
llvm::SmallSetVector< Decl *, 4 > DeclsToCheckForDeferredDiags
Function or variable declarations to be checked for whether the deferred diagnostics should be emitte...
std::deque< PendingImplicitInstantiation > PendingLocalImplicitInstantiations
The queue of implicit template instantiations that are required and must be performed within the curr...
void getUndefinedButUsed(SmallVectorImpl< std::pair< NamedDecl *, SourceLocation > > &Undefined)
Obtain a sorted list of functions that are undefined but ODR-used.
LazyDeclPtr StdNamespace
The C++ "std" namespace, where the standard library resides.
std::deque< PendingImplicitInstantiation > PendingInstantiations
The queue of implicit template instantiations that are required but have not yet been performed.
TentativeDefinitionsType TentativeDefinitions
All the tentative definitions encountered in the TU.
const llvm::MapVector< FieldDecl *, DeleteLocs > & getMismatchingDeleteExpressions() const
Retrieves list of suspicious delete-expressions that will be checked at the end of translation unit.
OpenCLOptions & getOpenCLOptions()
NamespaceDecl * getStdNamespace() const
LangOptions::PragmaMSPointersToMembersKind MSPointerToMemberRepresentationMethod
Controls member pointer representation format under the MS ABI.
llvm::MapVector< IdentifierInfo *, llvm::SetVector< WeakInfo, llvm::SmallVector< WeakInfo, 1u >, llvm::SmallDenseSet< WeakInfo, 2u, WeakInfo::DenseMapInfoByAliasOnly > > > WeakUndeclaredIdentifiers
WeakUndeclaredIdentifiers - Identifiers contained in #pragma weak before declared.
LazyDeclPtr StdAlignValT
The C++ "std::align_val_t" enum class, which is defined by the C++ standard library.
IdentifierResolver IdResolver
static RawLocEncoding encode(SourceLocation Loc, UIntTy BaseOffset, unsigned BaseModuleFileIndex)
Encodes a location in the source.
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.
FileID getFileID(SourceLocation SpellingLoc) const
Return the FileID for a SourceLocation.
DiagnosticsEngine & getDiagnostics() const
SourceLocation::UIntTy getNextLocalOffset() const
OptionalFileEntryRef getFileEntryRefForID(FileID FID) const
Returns the FileEntryRef for the provided FileID.
const SrcMgr::SLocEntry & getLocalSLocEntry(unsigned Index) const
Get a local SLocEntry. This is exposed for indexing.
FileManager & getFileManager() const
unsigned local_sloc_entry_size() const
Get the number of local SLocEntries we have.
SourceLocation getLocForEndOfFile(FileID FID) const
Return the source location corresponding to the last byte of the specified file.
FileID getMainFileID() const
Returns the FileID of the main source file.
unsigned getFileIDSize(FileID FID) const
The size of the SLocEntry that FID represents.
bool hasLineTable() const
Determine if the source manager has a line table.
bool isLoadedSourceLocation(SourceLocation Loc) const
Returns true if Loc came from a PCH/Module.
bool isLoadedFileID(FileID FID) const
Returns true if FID came from a PCH/Module.
SourceLocation getLocForStartOfFile(FileID FID) const
Return the source location corresponding to the first byte of the specified file.
LineTableInfo & getLineTable()
Retrieve the stored line table.
const SrcMgr::SLocEntry & getSLocEntry(FileID FID, bool *Invalid=nullptr) const
A trivial tuple used to represent a source range.
SourceLocation getEnd() const
SourceLocation getBegin() const
One instance of this struct is kept for every file loaded or used.
OptionalFileEntryRef ContentsEntry
References the file which the contents were actually loaded from.
unsigned IsTransient
True if this file may be transient, that is, if it might not exist at some later point in time when t...
std::optional< llvm::MemoryBufferRef > getBufferOrNone(DiagnosticsEngine &Diag, FileManager &FM, SourceLocation Loc=SourceLocation()) const
Returns the memory buffer for the associated content.
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.
Each ExpansionInfo encodes the expansion location - where the token was ultimately expanded,...
SourceLocation getExpansionLocStart() const
bool isExpansionTokenRange() const
SourceLocation getSpellingLoc() const
bool isMacroArgExpansion() const
SourceLocation getExpansionLocEnd() const
Information about a FileID, basically just the logical file that it represents and include stack info...
const ContentCache & getContentCache() const
This is a discriminated union of FileInfo and ExpansionInfo.
SourceLocation::UIntTy getOffset() const
const FileInfo & getFile() const
const ExpansionInfo & getExpansion() const
An array of decls optimized for the common case of only containing one entry.
StringLiteral - This represents a string literal expression, e.g.
Wrapper for substituted template type parameters.
Wrapper for substituted template type parameters.
Wrapper for substituted template type parameters.
Represents the declaration of a struct/union/class/enum.
bool isCompleteDefinition() const
Return true if this decl has its body fully specified.
SourceLocation getNameLoc() const
SourceLocation getElaboratedKeywordLoc() const
NestedNameSpecifierLoc getQualifierLoc() const
Exposes information about the current target.
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 template argument list.
unsigned size() const
Retrieve the number of template arguments in this template argument list.
const TemplateArgument & get(unsigned Idx) const
Retrieve the template argument at a given index.
Location wrapper for a TemplateArgument.
SourceLocation getTemplateEllipsisLoc() const
TemplateArgumentLocInfo getLocInfo() const
const TemplateArgument & getArgument() const
SourceLocation getTemplateNameLoc() const
SourceLocation getTemplateKWLoc() const
NestedNameSpecifierLoc getTemplateQualifierLoc() const
Expr * getAsExpr() const
Retrieve the template argument as an expression.
@ Declaration
The template argument is a declaration that was provided for a pointer, reference,...
@ Template
The template argument is a template name that was provided for a template template parameter.
@ StructuralValue
The template argument is a non-type template argument that can't be represented by the special-case D...
@ Pack
The template argument is actually a parameter pack.
@ TemplateExpansion
The template argument is a pack expansion of a template name that was provided for a template templat...
@ NullPtr
The template argument is a null pointer or null pointer to member that was provided for a non-type te...
@ Type
The template argument is a type.
@ Null
Represents an empty template argument, e.g., one that has not been deduced.
@ Integral
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
@ Expression
The template argument is an expression, and we've not resolved it to one of the other forms yet,...
ArgKind getKind() const
Return the kind of stored template argument.
Stores a list of template parameters for a TemplateDecl and its derived classes.
Expr * getRequiresClause()
The constraint-expression of the associated requires-clause.
SourceLocation getRAngleLoc() const
SourceLocation getLAngleLoc() const
SourceLocation getTemplateLoc() const
unsigned getNumArgs() const
SourceLocation getLAngleLoc() const
TemplateArgumentLoc getArgLoc(unsigned i) const
SourceLocation getRAngleLoc() const
SourceLocation getTemplateNameLoc() const
SourceLocation getTemplateKeywordLoc() const
NestedNameSpecifierLoc getQualifierLoc() const
SourceLocation getElaboratedKeywordLoc() const
Wrapper for template type parameters.
Token - This structure provides full information about a lexed token.
IdentifierInfo * getIdentifierInfo() const
unsigned getFlags() const
Return the internal represtation of the flags.
SourceLocation getLocation() const
Return a source location identifier for the specified offset in the current file.
unsigned getLength() const
SourceLocation getAnnotationEndLoc() const
void * getAnnotationValue() const
tok::TokenKind getKind() const
bool isAnnotation() const
Return true if this is any of tok::annot_* kind tokens.
The top declaration context.
NamespaceDecl * getAnonymousNamespace() const
Base wrapper for a particular "section" of type source info.
QualType getType() const
Get the type for which this source info wrapper provides information.
TypeLoc getNextTypeLoc() const
Get the next TypeLoc pointed by this TypeLoc, e.g for "int*" the TypeLoc is a PointerLoc and next Typ...
TypeSourceInfo * getUnmodifiedTInfo() const
A container of type source information.
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
QualType getType() const
Return the type wrapped by this type source info.
SourceLocation getNameLoc() const
The base class of the type hierarchy.
TypeClass getTypeClass() const
Base class for declarations which introduce a typedef-name.
Wrapper for source info for typedefs.
SourceLocation getLParenLoc() const
SourceLocation getRParenLoc() const
SourceLocation getTypeofLoc() const
The iterator over UnresolvedSets.
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.
bool hasInitWithSideEffects() const
Checks whether this declaration has an initializer with side effects.
EvaluatedStmt * getEvaluatedStmt() const
const Expr * getInit() const
APValue * getEvaluatedValue() const
Return the already-evaluated value of this variable's initializer, or NULL if the value is not yet kn...
Declaration of a variable template.
Represents a variable template specialization, which refers to a variable template with a given set o...
SourceLocation getNameLoc() const
SourceLocation getLocation() const
Retrieve the location at which this variable was captured.
SourceLocation getEllipsisLoc() const
Retrieve the source location of the ellipsis, whose presence indicates that the capture is a pack exp...
void writeQualifiers(Qualifiers value)
A key used when looking up entities by DeclarationName.
Information about a module that has been loaded by the ASTReader.
serialization::PreprocessedEntityID BasePreprocessedEntityID
Base preprocessed entity ID for preprocessed entities local to this module.
serialization::SelectorID BaseSelectorID
Base selector ID for selectors local to this module.
unsigned LocalNumSubmodules
The number of submodules in this module.
bool isModule() const
Is this a module file for a module (rather than a PCH or similar).
unsigned NumPreprocessedEntities
unsigned Index
The index of this module in the list of modules.
serialization::SubmoduleID BaseSubmoduleID
Base submodule ID for submodules local to this module.
std::string FileName
The file name of the module file.
SourceLocation::UIntTy SLocEntryBaseOffset
The base offset in the source manager's view of this module.
unsigned LocalNumMacros
The number of macros in this AST file.
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.
Writer for the on-disk hash table.
A type index; the type ID with the qualifier bits removed.
uint32_t getModuleFileIndex() const
TypeID asTypeID(unsigned FastQuals) const
uint64_t getValue() const
Class that performs name lookup into a DeclContext stored in an AST file.
Class that performs lookup to specialized decls.
const unsigned int LOCAL_REDECLARATIONS
Record code for a list of local redeclarations of a declaration.
TypeCode
Record codes for each kind of type.
const unsigned int DECL_UPDATES
Record of updates for a declaration that was modified after being deserialized.
@ PREDEF_TYPE_AUTO_RREF_DEDUCT
The "auto &&" deduction type.
@ PREDEF_TYPE_NULL_ID
The NULL type.
@ PREDEF_TYPE_AUTO_DEDUCT
The "auto" deduction type.
@ CTOR_INITIALIZER_MEMBER
@ CTOR_INITIALIZER_DELEGATING
@ CTOR_INITIALIZER_INDIRECT_MEMBER
@ DECL_EMPTY
An EmptyDecl record.
@ DECL_CXX_BASE_SPECIFIERS
A record containing CXXBaseSpecifiers.
@ DECL_CXX_RECORD
A CXXRecordDecl record.
@ DECL_VAR_TEMPLATE_PARTIAL_SPECIALIZATION
A VarTemplatePartialSpecializationDecl record.
@ DECL_OMP_ALLOCATE
An OMPAllocateDcl record.
@ DECL_MS_PROPERTY
A MSPropertyDecl record.
@ DECL_REQUIRES_EXPR_BODY
A RequiresExprBodyDecl record.
@ DECL_STATIC_ASSERT
A StaticAssertDecl record.
@ DECL_INDIRECTFIELD
A IndirectFieldDecl record.
@ DECL_TEMPLATE_TEMPLATE_PARM
A TemplateTemplateParmDecl record.
@ DECL_IMPORT
An ImportDecl recording a module import.
@ DECL_ACCESS_SPEC
An AccessSpecDecl record.
@ DECL_OBJC_TYPE_PARAM
An ObjCTypeParamDecl record.
@ DECL_OBJC_CATEGORY_IMPL
A ObjCCategoryImplDecl record.
@ DECL_ENUM_CONSTANT
An EnumConstantDecl record.
@ DECL_PARM_VAR
A ParmVarDecl record.
@ DECL_TYPEDEF
A TypedefDecl record.
@ DECL_EXPANDED_TEMPLATE_TEMPLATE_PARM_PACK
A TemplateTemplateParmDecl record that stores an expanded template template parameter pack.
@ DECL_HLSL_BUFFER
A HLSLBufferDecl record.
@ DECL_NAMESPACE_ALIAS
A NamespaceAliasDecl record.
@ DECL_TYPEALIAS
A TypeAliasDecl record.
@ DECL_FUNCTION_TEMPLATE
A FunctionTemplateDecl record.
@ DECL_UNRESOLVED_USING_TYPENAME
An UnresolvedUsingTypenameDecl record.
@ DECL_CLASS_TEMPLATE_SPECIALIZATION
A ClassTemplateSpecializationDecl record.
@ DECL_FILE_SCOPE_ASM
A FileScopeAsmDecl record.
@ DECL_PARTIAL_SPECIALIZATIONS
@ DECL_CXX_CONSTRUCTOR
A CXXConstructorDecl record.
@ DECL_CXX_CONVERSION
A CXXConversionDecl record.
@ DECL_FIELD
A FieldDecl record.
@ DECL_LINKAGE_SPEC
A LinkageSpecDecl record.
@ DECL_CONTEXT_TU_LOCAL_VISIBLE
A record that stores the set of declarations that are only visible to the TU.
@ DECL_NAMESPACE
A NamespaceDecl record.
@ DECL_NON_TYPE_TEMPLATE_PARM
A NonTypeTemplateParmDecl record.
@ DECL_FUNCTION
A FunctionDecl record.
@ DECL_USING_DIRECTIVE
A UsingDirecitveDecl record.
@ DECL_RECORD
A RecordDecl record.
@ DECL_CONTEXT_LEXICAL
A record that stores the set of declarations that are lexically stored within a given DeclContext.
@ DECL_BLOCK
A BlockDecl record.
@ DECL_UNRESOLVED_USING_VALUE
An UnresolvedUsingValueDecl record.
@ DECL_TYPE_ALIAS_TEMPLATE
A TypeAliasTemplateDecl record.
@ DECL_CXX_CTOR_INITIALIZERS
A record containing CXXCtorInitializers.
@ DECL_OBJC_CATEGORY
A ObjCCategoryDecl record.
@ DECL_VAR
A VarDecl record.
@ DECL_USING
A UsingDecl record.
@ DECL_OBJC_PROTOCOL
A ObjCProtocolDecl record.
@ DECL_TEMPLATE_TYPE_PARM
A TemplateTypeParmDecl record.
@ DECL_VAR_TEMPLATE_SPECIALIZATION
A VarTemplateSpecializationDecl record.
@ DECL_OBJC_IMPLEMENTATION
A ObjCImplementationDecl record.
@ DECL_OBJC_COMPATIBLE_ALIAS
A ObjCCompatibleAliasDecl record.
@ DECL_FRIEND_TEMPLATE
A FriendTemplateDecl record.
@ DECL_PRAGMA_DETECT_MISMATCH
A PragmaDetectMismatchDecl record.
@ DECL_EXPANDED_NON_TYPE_TEMPLATE_PARM_PACK
A NonTypeTemplateParmDecl record that stores an expanded non-type template parameter pack.
@ DECL_OBJC_AT_DEFS_FIELD
A ObjCAtDefsFieldDecl record.
@ DECL_IMPLICIT_PARAM
An ImplicitParamDecl record.
@ DECL_FRIEND
A FriendDecl record.
@ DECL_CXX_METHOD
A CXXMethodDecl record.
@ DECL_EXPORT
An ExportDecl record.
@ DECL_PRAGMA_COMMENT
A PragmaCommentDecl record.
@ DECL_ENUM
An EnumDecl record.
@ DECL_CONTEXT_MODULE_LOCAL_VISIBLE
A record containing the set of declarations that are only visible from DeclContext in the same module...
@ DECL_OMP_DECLARE_REDUCTION
An OMPDeclareReductionDecl record.
@ DECL_OMP_THREADPRIVATE
An OMPThreadPrivateDecl record.
@ DECL_OBJC_METHOD
A ObjCMethodDecl record.
@ DECL_CXX_DESTRUCTOR
A CXXDestructorDecl record.
@ DECL_OMP_CAPTUREDEXPR
An OMPCapturedExprDecl record.
@ DECL_CLASS_TEMPLATE
A ClassTemplateDecl record.
@ DECL_USING_SHADOW
A UsingShadowDecl record.
@ DECL_CONCEPT
A ConceptDecl record.
@ DECL_OBJC_IVAR
A ObjCIvarDecl record.
@ DECL_OBJC_PROPERTY
A ObjCPropertyDecl record.
@ DECL_OBJC_INTERFACE
A ObjCInterfaceDecl record.
@ DECL_VAR_TEMPLATE
A VarTemplateDecl record.
@ DECL_CLASS_TEMPLATE_PARTIAL_SPECIALIZATION
A ClassTemplatePartialSpecializationDecl record.
@ DECL_CONTEXT_VISIBLE
A record that stores the set of declarations that are visible from a given DeclContext.
@ DECL_OBJC_PROPERTY_IMPL
A ObjCPropertyImplDecl record.
@ TYPE_EXT_QUAL
An ExtQualType record.
@ EXPR_DESIGNATED_INIT
A DesignatedInitExpr record.
@ EXPR_COMPOUND_LITERAL
A CompoundLiteralExpr record.
@ EXPR_OBJC_IVAR_REF_EXPR
An ObjCIvarRefExpr record.
@ EXPR_MEMBER
A MemberExpr record.
@ EXPR_CXX_TEMPORARY_OBJECT
A CXXTemporaryObjectExpr record.
@ EXPR_CXX_UNRESOLVED_LOOKUP
@ EXPR_COMPOUND_ASSIGN_OPERATOR
A CompoundAssignOperator record.
@ EXPR_EXPR_WITH_CLEANUPS
@ EXPR_CXX_STATIC_CAST
A CXXStaticCastExpr record.
@ EXPR_OBJC_STRING_LITERAL
An ObjCStringLiteral record.
@ EXPR_VA_ARG
A VAArgExpr record.
@ EXPR_CXX_OPERATOR_CALL
A CXXOperatorCallExpr record.
@ STMT_OBJC_AT_TRY
An ObjCAtTryStmt record.
@ EXPR_CXX_UNRESOLVED_CONSTRUCT
@ EXPR_FIXEDPOINT_LITERAL
@ STMT_DO
A DoStmt record.
@ STMT_OBJC_CATCH
An ObjCAtCatchStmt record.
@ STMT_IF
An IfStmt record.
@ EXPR_CXX_EXPRESSION_TRAIT
@ EXPR_STRING_LITERAL
A StringLiteral record.
@ EXPR_IMPLICIT_CAST
An ImplicitCastExpr record.
@ STMT_GCCASM
A GCC-style AsmStmt record.
@ EXPR_IMAGINARY_LITERAL
An ImaginaryLiteral record.
@ STMT_WHILE
A WhileStmt record.
@ EXPR_STMT
A StmtExpr record.
@ EXPR_CXX_REINTERPRET_CAST
A CXXReinterpretCastExpr record.
@ EXPR_DESIGNATED_INIT_UPDATE
A DesignatedInitUpdateExpr record.
@ STMT_OBJC_AT_SYNCHRONIZED
An ObjCAtSynchronizedStmt record.
@ EXPR_CXX_PSEUDO_DESTRUCTOR
@ EXPR_CHARACTER_LITERAL
A CharacterLiteral record.
@ EXPR_OBJC_ENCODE
An ObjCEncodeExpr record.
@ EXPR_CSTYLE_CAST
A CStyleCastExpr record.
@ EXPR_OBJC_BOXED_EXPRESSION
@ EXPR_OBJC_BOOL_LITERAL
An ObjCBoolLiteralExpr record.
@ EXPR_CXX_BIND_TEMPORARY
@ EXPR_EXT_VECTOR_ELEMENT
An ExtVectorElementExpr record.
@ STMT_RETURN
A ReturnStmt record.
@ STMT_OBJC_FOR_COLLECTION
An ObjCForCollectionStmt record.
@ STMT_CONTINUE
A ContinueStmt record.
@ EXPR_PREDEFINED
A PredefinedExpr record.
@ EXPR_CXX_BOOL_LITERAL
A CXXBoolLiteralExpr record.
@ EXPR_PAREN_LIST
A ParenListExpr record.
@ EXPR_CXX_PAREN_LIST_INIT
A CXXParenListInitExpr record.
@ STMT_COMPOUND
A CompoundStmt record.
@ STMT_FOR
A ForStmt record.
@ STMT_ATTRIBUTED
An AttributedStmt record.
@ EXPR_CXX_REWRITTEN_BINARY_OPERATOR
A CXXRewrittenBinaryOperator record.
@ STMT_GOTO
A GotoStmt record.
@ EXPR_NO_INIT
An NoInitExpr record.
@ EXPR_OBJC_ARRAY_LITERAL
@ EXPR_OBJC_PROTOCOL_EXPR
An ObjCProtocolExpr record.
@ EXPR_CXX_CONSTRUCT
A CXXConstructExpr record.
@ EXPR_OBJC_DICTIONARY_LITERAL
@ EXPR_CXX_DYNAMIC_CAST
A CXXDynamicCastExpr record.
@ STMT_CXX_TRY
A CXXTryStmt record.
@ EXPR_GENERIC_SELECTION
A GenericSelectionExpr record.
@ EXPR_CALL
A CallExpr record.
@ EXPR_GNU_NULL
A GNUNullExpr record.
@ EXPR_BINARY_CONDITIONAL_OPERATOR
@ EXPR_OBJC_PROPERTY_REF_EXPR
An ObjCPropertyRefExpr record.
@ EXPR_CXX_CONST_CAST
A CXXConstCastExpr record.
@ STMT_REF_PTR
A reference to a previously [de]serialized Stmt record.
@ EXPR_OBJC_MESSAGE_EXPR
An ObjCMessageExpr record.
@ EXPR_CXX_DEPENDENT_SCOPE_DECL_REF
@ STMT_CASE
A CaseStmt record.
@ EXPR_FUNCTION_PARM_PACK
@ STMT_STOP
A marker record that indicates that we are at the end of an expression.
@ EXPR_CXX_NULL_PTR_LITERAL
@ STMT_MSASM
A MS-style AsmStmt record.
@ EXPR_CONDITIONAL_OPERATOR
A ConditionOperator record.
@ EXPR_BINARY_OPERATOR
A BinaryOperator record.
@ EXPR_CXX_STD_INITIALIZER_LIST
A CXXStdInitializerListExpr record.
@ EXPR_SHUFFLE_VECTOR
A ShuffleVectorExpr record.
@ STMT_OBJC_FINALLY
An ObjCAtFinallyStmt record.
@ EXPR_OBJC_SELECTOR_EXPR
An ObjCSelectorExpr record.
@ EXPR_FLOATING_LITERAL
A FloatingLiteral record.
@ EXPR_CXX_DEPENDENT_SCOPE_MEMBER
@ STMT_NULL_PTR
A NULL expression.
@ STMT_DEFAULT
A DefaultStmt record.
@ EXPR_CHOOSE
A ChooseExpr record.
@ STMT_NULL
A NullStmt record.
@ EXPR_DECL_REF
A DeclRefExpr record.
@ EXPR_SUBST_NON_TYPE_TEMPLATE_PARM
@ EXPR_INIT_LIST
An InitListExpr record.
@ EXPR_IMPLICIT_VALUE_INIT
An ImplicitValueInitExpr record.
@ EXPR_PAREN
A ParenExpr record.
@ STMT_LABEL
A LabelStmt record.
@ EXPR_CXX_FUNCTIONAL_CAST
A CXXFunctionalCastExpr record.
@ EXPR_USER_DEFINED_LITERAL
A UserDefinedLiteral record.
@ EXPR_INTEGER_LITERAL
An IntegerLiteral record.
@ EXPR_MATERIALIZE_TEMPORARY
@ EXPR_CXX_MEMBER_CALL
A CXXMemberCallExpr record.
@ STMT_SWITCH
A SwitchStmt record.
@ STMT_DECL
A DeclStmt record.
@ EXPR_CXX_UNRESOLVED_MEMBER
@ EXPR_OBJC_KVC_REF_EXPR
UNUSED.
@ EXPR_SUBST_NON_TYPE_TEMPLATE_PARM_PACK
@ EXPR_CXX_SCALAR_VALUE_INIT
@ EXPR_SIZEOF_ALIGN_OF
A SizefAlignOfExpr record.
@ STMT_BREAK
A BreakStmt record.
@ STMT_OBJC_AT_THROW
An ObjCAtThrowStmt record.
@ EXPR_ADDR_LABEL
An AddrLabelExpr record.
@ STMT_CXX_FOR_RANGE
A CXXForRangeStmt record.
@ EXPR_CXX_ADDRSPACE_CAST
A CXXAddrspaceCastExpr record.
@ EXPR_ARRAY_SUBSCRIPT
An ArraySubscriptExpr record.
@ EXPR_UNARY_OPERATOR
A UnaryOperator record.
@ STMT_CXX_CATCH
A CXXCatchStmt record.
@ STMT_INDIRECT_GOTO
An IndirectGotoStmt record.
Defines the clang::TargetInfo interface.
bool isSystem(CharacteristicKind CK)
Determine whether a file / directory characteristic is for system code.
bool isModuleMap(CharacteristicKind CK)
Determine whether a file characteristic is for a module map.
bool LE(InterpState &S, CodePtr OpPC)
GlobalDeclID LazySpecializationInfo
uint64_t TypeID
An ID number that refers to a type in an AST file.
@ EXTENSION_METADATA
Metadata describing this particular extension.
@ SUBMODULE_EXCLUDED_HEADER
Specifies a header that has been explicitly excluded from this submodule.
@ SUBMODULE_TOPHEADER
Specifies a top-level header that falls into this (sub)module.
@ SUBMODULE_PRIVATE_TEXTUAL_HEADER
Specifies a header that is private to this submodule but must be textually included.
@ SUBMODULE_HEADER
Specifies a header that falls into this (sub)module.
@ SUBMODULE_EXPORT_AS
Specifies the name of the module that will eventually re-export the entities in this module.
@ SUBMODULE_UMBRELLA_DIR
Specifies an umbrella directory.
@ SUBMODULE_UMBRELLA_HEADER
Specifies the umbrella header used to create this module, if any.
@ SUBMODULE_METADATA
Metadata for submodules as a whole.
@ SUBMODULE_REQUIRES
Specifies a required feature.
@ SUBMODULE_PRIVATE_HEADER
Specifies a header that is private to this submodule.
@ SUBMODULE_IMPORTS
Specifies the submodules that are imported by this submodule.
@ SUBMODULE_CONFLICT
Specifies a conflict with another module.
@ SUBMODULE_INITIALIZERS
Specifies some declarations with initializers that must be emitted to initialize the module.
@ SUBMODULE_DEFINITION
Defines the major attributes of a submodule, including its name and parent.
@ SUBMODULE_LINK_LIBRARY
Specifies a library or framework to link against.
@ SUBMODULE_CONFIG_MACRO
Specifies a configuration macro for this module.
@ SUBMODULE_EXPORTS
Specifies the submodules that are re-exported from this submodule.
@ SUBMODULE_TEXTUAL_HEADER
Specifies a header that is part of the module but must be textually included.
@ SUBMODULE_AFFECTING_MODULES
Specifies affecting modules that were not imported.
TypeIdx TypeIdxFromBuiltin(const BuiltinType *BT)
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.
@ FILE_SYSTEM_OPTIONS
Record code for the filesystem options table.
@ TARGET_OPTIONS
Record code for the target options table.
@ PREPROCESSOR_OPTIONS
Record code for the preprocessor options table.
@ HEADER_SEARCH_OPTIONS
Record code for the headers search options table.
@ CODEGEN_OPTIONS
Record code for the codegen options table.
@ LANGUAGE_OPTIONS
Record code for the language options table.
uint32_t SelectorID
An ID number that refers to an ObjC selector in an AST file.
const unsigned int NUM_PREDEF_PP_ENTITY_IDS
The number of predefined preprocessed entity IDs.
uint32_t PreprocessedEntityID
An ID number that refers to an entity in the detailed preprocessing record.
const unsigned int NUM_PREDEF_SUBMODULE_IDS
The number of predefined submodule IDs.
@ SUBMODULE_BLOCK_ID
The block containing the submodule structure.
@ PREPROCESSOR_DETAIL_BLOCK_ID
The block containing the detailed preprocessing record.
@ AST_BLOCK_ID
The AST block, which acts as a container around the full AST block.
@ SOURCE_MANAGER_BLOCK_ID
The block containing information about the source manager.
@ CONTROL_BLOCK_ID
The control block, which contains all of the information that needs to be validated prior to committi...
@ DECLTYPES_BLOCK_ID
The block containing the definitions of all of the types and decls used within the AST file.
@ PREPROCESSOR_BLOCK_ID
The block containing information about the preprocessor.
@ COMMENTS_BLOCK_ID
The block containing comments.
@ UNHASHED_CONTROL_BLOCK_ID
A block with unhashed content.
@ EXTENSION_BLOCK_ID
A block containing a module file extension.
@ OPTIONS_BLOCK_ID
The block of configuration options, used to check that a module is being used in a configuration comp...
@ INPUT_FILES_BLOCK_ID
The block of input files, which were used as inputs to create this AST file.
unsigned StableHashForTemplateArguments(llvm::ArrayRef< TemplateArgument > Args)
Calculate a stable hash value for template arguments.
const unsigned VERSION_MINOR
AST file minor version number supported by this version of Clang.
@ 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.
@ 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.
void numberAnonymousDeclsWithin(const DeclContext *DC, Fn Visit)
Visit each declaration within DC that needs an anonymous declaration number and call Visit with the d...
@ MODULE_MAP_FILE
Record code for the module map file that was used to build this AST file.
@ MODULE_DIRECTORY
Record code for the module build directory.
@ ORIGINAL_FILE_ID
Record code for file ID of the file or buffer that was used to generate the AST file.
@ MODULE_NAME
Record code for the module name.
@ ORIGINAL_FILE
Record code for the original file that was used to generate the AST file, including both its file ID ...
@ 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...
@ 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.
@ INPUT_FILE_HASH
The input file content hash.
@ INPUT_FILE
An input file.
const DeclContext * getDefinitiveDeclContext(const DeclContext *DC)
Retrieve the "definitive" declaration that provides all of the visible entries for the given declarat...
@ 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.
uint64_t IdentifierID
An ID number that refers to an identifier in an AST file.
const unsigned int NUM_PREDEF_MACRO_IDS
The number of predefined macro IDs.
@ DECL_UPDATE_OFFSETS
Record for offsets of DECL_UPDATES records for declarations that were modified after being deserializ...
@ STATISTICS
Record code for the extra statistics we gather while generating an AST file.
@ FLOAT_CONTROL_PRAGMA_OPTIONS
Record code for #pragma float_control options.
@ KNOWN_NAMESPACES
Record code for the set of known namespaces, which are used for typo correction.
@ SPECIAL_TYPES
Record code for the set of non-builtin, special types.
@ PENDING_IMPLICIT_INSTANTIATIONS
Record code for pending implicit instantiations.
@ CXX_ADDED_TEMPLATE_SPECIALIZATION
@ TYPE_OFFSET
Record code for the offsets of each type.
@ DELEGATING_CTORS
The list of delegating constructor declarations.
@ PP_ASSUME_NONNULL_LOC
ID 66 used to be the list of included files.
@ EXT_VECTOR_DECLS
Record code for the set of ext_vector type names.
@ OPENCL_EXTENSIONS
Record code for enabled OpenCL extensions.
@ FP_PRAGMA_OPTIONS
Record code for floating point #pragma options.
@ PP_UNSAFE_BUFFER_USAGE
Record code for #pragma clang unsafe_buffer_usage begin/end.
@ CXX_ADDED_TEMPLATE_PARTIAL_SPECIALIZATION
@ DECLS_WITH_EFFECTS_TO_VERIFY
Record code for Sema's vector of functions/blocks with effects to be verified.
@ VTABLE_USES
Record code for the array of VTable uses.
@ LATE_PARSED_TEMPLATE
Record code for late parsed template functions.
@ DECLS_TO_CHECK_FOR_DEFERRED_DIAGS
Record code for the Decls to be checked for deferred diags.
@ DECL_OFFSET
Record code for the offsets of each decl.
@ SOURCE_MANAGER_LINE_TABLE
Record code for the source manager line table information, which stores information about #line direc...
@ PP_COUNTER_VALUE
The value of the next COUNTER to dispense.
@ DELETE_EXPRS_TO_ANALYZE
Delete expressions that will be analyzed later.
@ RELATED_DECLS_MAP
Record code for related declarations that have to be deserialized together from the same module.
@ UPDATE_VISIBLE
Record code for an update to a decl context's lookup table.
@ CUDA_PRAGMA_FORCE_HOST_DEVICE_DEPTH
Number of unmatched #pragma clang cuda_force_host_device begin directives we've seen.
@ MACRO_OFFSET
Record code for the table of offsets of each macro ID.
@ PPD_ENTITIES_OFFSETS
Record code for the table of offsets to entries in the preprocessing record.
@ OPENCL_EXTENSION_DECLS
Record code for declarations associated with OpenCL extensions.
@ VTABLES_TO_EMIT
Record code for vtables to emit.
@ UPDATE_MODULE_LOCAL_VISIBLE
@ IDENTIFIER_OFFSET
Record code for the table of offsets of each identifier ID.
@ OBJC_CATEGORIES
Record code for the array of Objective-C categories (including extensions).
@ METHOD_POOL
Record code for the Objective-C method pool,.
@ DELAYED_NAMESPACE_LEXICAL_VISIBLE_RECORD
Record code for lexical and visible block for delayed namespace in reduced BMI.
@ PP_CONDITIONAL_STACK
The stack of open #ifs/#ifdefs recorded in a preamble.
@ REFERENCED_SELECTOR_POOL
Record code for referenced selector pool.
@ SOURCE_LOCATION_OFFSETS
Record code for the table of offsets into the block of source-location information.
@ WEAK_UNDECLARED_IDENTIFIERS
Record code for weak undeclared identifiers.
@ UNDEFINED_BUT_USED
Record code for undefined but used functions and variables that need a definition in this TU.
@ FILE_SORTED_DECLS
Record code for a file sorted array of DeclIDs in a module.
@ MSSTRUCT_PRAGMA_OPTIONS
Record code for #pragma ms_struct options.
@ TENTATIVE_DEFINITIONS
Record code for the array of tentative definitions.
@ UPDATE_TU_LOCAL_VISIBLE
@ UNUSED_FILESCOPED_DECLS
Record code for the array of unused file scoped decls.
@ ALIGN_PACK_PRAGMA_OPTIONS
Record code for #pragma align/pack options.
@ IMPORTED_MODULES
Record code for an array of all of the (sub)modules that were imported by the AST file.
@ SELECTOR_OFFSETS
Record code for the table of offsets into the Objective-C method pool.
@ UNUSED_LOCAL_TYPEDEF_NAME_CANDIDATES
Record code for potentially unused local typedef names.
@ OPENCL_EXTENSION_TYPES
Record code for types associated with OpenCL extensions.
@ 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...
@ METADATA_OLD_FORMAT
This is so that older clang versions, before the introduction of the control block,...
@ CUDA_SPECIAL_DECL_REFS
Record code for special CUDA declarations.
@ TU_UPDATE_LEXICAL
Record code for an update to the TU's lexically contained declarations.
@ PPD_SKIPPED_RANGES
A table of skipped ranges within the preprocessing record.
@ IDENTIFIER_TABLE
Record code for the identifier table.
@ SEMA_DECL_REFS
Record code for declarations that Sema keeps references of.
@ OPTIMIZE_PRAGMA_OPTIONS
Record code for #pragma optimize options.
@ MODULE_OFFSET_MAP
Record code for the remapping information used to relate loaded modules to the various offsets and ID...
@ POINTERS_TO_MEMBERS_PRAGMA_OPTIONS
Record code for #pragma ms_struct options.
uint32_t MacroID
An ID number that refers to a macro in an AST file.
unsigned ComputeHash(Selector Sel)
The JSON file list parser is used to communicate input to InstallAPI.
@ NUM_OVERLOADED_OPERATORS
bool isTemplateInstantiation(TemplateSpecializationKind Kind)
Determine whether this template specialization kind refers to an instantiation of an entity (as oppos...
@ Specialization
We are substituting template parameters for template arguments in order to form a template specializa...
bool isUnresolvedExceptionSpec(ExceptionSpecificationType ESpecType)
@ LCK_ByCopy
Capturing by copy (a.k.a., by value)
@ LCK_ByRef
Capturing by reference.
@ LCK_VLAType
Capturing variable-length array type.
@ LCK_StarThis
Capturing the *this object by copy.
@ LCK_This
Capturing the *this object by reference.
@ Auto
'auto' clause, allowed on 'loop' directives.
@ Bind
'bind' clause, allowed on routine constructs.
@ Gang
'gang' clause, allowed on 'loop' and Combined constructs.
@ Wait
'wait' clause, allowed on Compute, Data, 'update', and Combined constructs.
@ DevicePtr
'deviceptr' clause, allowed on Compute and Combined Constructs, plus 'data' and 'declare'.
@ PCopyOut
'copyout' clause alias 'pcopyout'. Preserved for diagnostic purposes.
@ VectorLength
'vector_length' clause, allowed on 'parallel', 'kernels', 'parallel loop', and 'kernels loop' constru...
@ Async
'async' clause, allowed on Compute, Data, 'update', 'wait', and Combined constructs.
@ PresentOrCreate
'create' clause alias 'present_or_create'.
@ Collapse
'collapse' clause, allowed on 'loop' and Combined constructs.
@ NoHost
'nohost' clause, allowed on 'routine' directives.
@ PresentOrCopy
'copy' clause alias 'present_or_copy'. Preserved for diagnostic purposes.
@ DeviceNum
'device_num' clause, allowed on 'init', 'shutdown', and 'set' constructs.
@ Private
'private' clause, allowed on 'parallel', 'serial', 'loop', 'parallel loop', and 'serial loop' constru...
@ Invalid
Represents an invalid clause, for the purposes of parsing.
@ Vector
'vector' clause, allowed on 'loop', Combined, and 'routine' directives.
@ Copy
'copy' clause, allowed on Compute and Combined Constructs, plus 'data' and 'declare'.
@ Worker
'worker' clause, allowed on 'loop', Combined, and 'routine' directives.
@ Create
'create' clause, allowed on Compute and Combined constructs, plus 'data', 'enter data',...
@ DeviceType
'device_type' clause, allowed on Compute, 'data', 'init', 'shutdown', 'set', update',...
@ DefaultAsync
'default_async' clause, allowed on 'set' construct.
@ Attach
'attach' clause, allowed on Compute and Combined constructs, plus 'data' and 'enter data'.
@ Shortloop
'shortloop' is represented in the ACC.td file, but isn't present in the standard.
@ NumGangs
'num_gangs' clause, allowed on 'parallel', 'kernels', parallel loop', and 'kernels loop' constructs.
@ If
'if' clause, allowed on all the Compute Constructs, Data Constructs, Executable Constructs,...
@ Default
'default' clause, allowed on parallel, serial, kernel (and compound) constructs.
@ UseDevice
'use_device' clause, allowed on 'host_data' construct.
@ NoCreate
'no_create' clause, allowed on allowed on Compute and Combined constructs, plus 'data'.
@ PresentOrCopyOut
'copyout' clause alias 'present_or_copyout'.
@ Link
'link' clause, allowed on 'declare' construct.
@ Reduction
'reduction' clause, allowed on Parallel, Serial, Loop, and the combined constructs.
@ Self
'self' clause, allowed on Compute and Combined Constructs, plus 'update'.
@ CopyOut
'copyout' clause, allowed on Compute and Combined constructs, plus 'data', 'exit data',...
@ Seq
'seq' clause, allowed on 'loop' and 'routine' directives.
@ FirstPrivate
'firstprivate' clause, allowed on 'parallel', 'serial', 'parallel loop', and 'serial loop' constructs...
@ Host
'host' clause, allowed on 'update' construct.
@ PCopy
'copy' clause alias 'pcopy'. Preserved for diagnostic purposes.
@ Tile
'tile' clause, allowed on 'loop' and Combined constructs.
@ PCopyIn
'copyin' clause alias 'pcopyin'. Preserved for diagnostic purposes.
@ DeviceResident
'device_resident' clause, allowed on the 'declare' construct.
@ PCreate
'create' clause alias 'pcreate'. Preserved for diagnostic purposes.
@ Present
'present' clause, allowed on Compute and Combined constructs, plus 'data' and 'declare'.
@ DType
'dtype' clause, an alias for 'device_type', stored separately for diagnostic purposes.
@ CopyIn
'copyin' clause, allowed on Compute and Combined constructs, plus 'data', 'enter data',...
@ Device
'device' clause, allowed on the 'update' construct.
@ Independent
'independent' clause, allowed on 'loop' directives.
@ NumWorkers
'num_workers' clause, allowed on 'parallel', 'kernels', parallel loop', and 'kernels loop' constructs...
@ IfPresent
'if_present' clause, allowed on 'host_data' and 'update' directives.
@ Detach
'detach' clause, allowed on the 'exit data' construct.
@ Delete
'delete' clause, allowed on the 'exit data' construct.
@ PresentOrCopyIn
'copyin' clause alias 'present_or_copyin'.
@ Finalize
'finalize' clause, allowed on 'exit data' directive.
static constexpr unsigned NumberOfOMPMapClauseModifiers
Number of allowed map-type-modifiers.
@ Internal
Internal linkage, which indicates that the entity can be referred to from within the translation unit...
@ Module
Module linkage, which indicates that the entity can be referred to from other translation units withi...
PredefinedDeclIDs
Predefined declaration IDs.
@ PREDEF_DECL_CF_CONSTANT_STRING_TAG_ID
The internal '__NSConstantString' tag type.
@ PREDEF_DECL_TRANSLATION_UNIT_ID
The translation unit.
@ PREDEF_DECL_OBJC_CLASS_ID
The Objective-C 'Class' type.
@ PREDEF_DECL_BUILTIN_MS_GUID_ID
The predeclared '_GUID' struct.
@ PREDEF_DECL_BUILTIN_MS_TYPE_INFO_TAG_ID
The predeclared 'type_info' struct.
@ PREDEF_DECL_OBJC_INSTANCETYPE_ID
The internal 'instancetype' typedef.
@ PREDEF_DECL_OBJC_PROTOCOL_ID
The Objective-C 'Protocol' type.
@ PREDEF_DECL_UNSIGNED_INT_128_ID
The unsigned 128-bit integer type.
@ PREDEF_DECL_OBJC_SEL_ID
The Objective-C 'SEL' type.
@ 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_BUILTIN_VA_LIST_ID
The internal '__builtin_va_list' typedef.
@ PREDEF_DECL_EXTERN_C_CONTEXT_ID
The extern "C" context.
@ PREDEF_DECL_OBJC_ID_ID
The Objective-C 'id' type.
@ Property
The type of a property.
@ Result
The result type of a method or function.
bool CanElideDeclDef(const Decl *D)
If we can elide the definition of.
static constexpr unsigned NumberOfOMPMotionModifiers
Number of allowed motion-modifiers.
for(const auto &A :T->param_types())
const FunctionProtoType * T
std::string getClangFullRepositoryVersion()
Retrieves the full repository version that is an amalgamation of the information in getClangRepositor...
@ TSK_ExplicitInstantiationDeclaration
This template specialization was instantiated from a template due to an explicit instantiation declar...
@ None
The alignment was not explicit in code.
@ Class
The "class" keyword introduces the elaborated-type-specifier.
UnsignedOrNone getPrimaryModuleHash(const Module *M)
Calculate a hash value for the primary module name of the given module.
Diagnostic wrappers for TextAPI types for error reporting.
__UINTPTR_TYPE__ uintptr_t
An unsigned integer type with the property that any valid pointer to void can be converted to this ty...
The signature of a module, which is a hash of the AST content.
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>".
SourceLocation RAngleLoc
The source location of the right angle bracket ('>').
const TemplateArgumentLoc * getTemplateArgs() const
Retrieve the template arguments.
SourceLocation LAngleLoc
The source location of the left angle bracket ('<').
unsigned NumTemplateArgs
The number of template arguments in TemplateArgs.
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...
SourceLocation getLoc() const
getLoc - Returns the main location of the declaration name.
DeclarationName getName() const
getName - Returns the embedded declaration name.
const DeclarationNameLoc & getInfo() const
Structure used to store a statement, the constant value to which it was evaluated (if any),...
Contains a late templated function.
FPOptions FPO
Floating-point options in the point of definition.
Decl * D
The template function declaration to be late parsed.
NestedNameSpecifierLoc Prefix
Data for list of allocators.
a linked list of methods with the same selector name but different signatures.
A struct with extended info about a syntactic name qualifier, to be used for the case of out-of-line ...
TemplateParameterList ** TemplParamLists
A new-allocated array of size NumTemplParamLists, containing pointers to the "outer" template paramet...
NestedNameSpecifierLoc QualifierLoc
unsigned NumTemplParamLists
The number of "outer" template parameter lists.
Location information for a TemplateArgument.
TypeSourceInfo * getAsTypeSourceInfo() const
uint64_t ModuleLocalOffset
Describes the categories of an Objective-C class.