72 #include "llvm/ADT/APFloat.h" 73 #include "llvm/ADT/APInt.h" 74 #include "llvm/ADT/APSInt.h" 75 #include "llvm/ADT/ArrayRef.h" 76 #include "llvm/ADT/DenseMap.h" 77 #include "llvm/ADT/Hashing.h" 78 #include "llvm/ADT/Optional.h" 79 #include "llvm/ADT/PointerIntPair.h" 80 #include "llvm/ADT/STLExtras.h" 81 #include "llvm/ADT/ScopeExit.h" 82 #include "llvm/ADT/SmallSet.h" 83 #include "llvm/ADT/SmallString.h" 84 #include "llvm/ADT/SmallVector.h" 85 #include "llvm/ADT/StringMap.h" 86 #include "llvm/ADT/StringRef.h" 87 #include "llvm/Bitcode/BitCodes.h" 88 #include "llvm/Bitcode/BitstreamWriter.h" 89 #include "llvm/Support/Casting.h" 90 #include "llvm/Support/Compression.h" 91 #include "llvm/Support/DJB.h" 92 #include "llvm/Support/Endian.h" 93 #include "llvm/Support/EndianStream.h" 94 #include "llvm/Support/Error.h" 95 #include "llvm/Support/ErrorHandling.h" 96 #include "llvm/Support/MemoryBuffer.h" 97 #include "llvm/Support/OnDiskHashTable.h" 98 #include "llvm/Support/Path.h" 99 #include "llvm/Support/SHA1.h" 100 #include "llvm/Support/VersionTuple.h" 101 #include "llvm/Support/raw_ostream.h" 116 using namespace clang;
119 template <
typename T,
typename Allocator>
120 static StringRef
bytes(
const std::vector<T, Allocator> &
v) {
121 if (v.empty())
return StringRef();
122 return StringRef(reinterpret_cast<const char*>(&v[0]),
123 sizeof(T) * v.size());
126 template <
typename T>
128 return StringRef(reinterpret_cast<const char*>(v.data()),
129 sizeof(T) * v.size());
146 unsigned AbbrevToUse = 0;
150 : Writer(Writer), Record(Writer, Record) {}
153 return Record.
Emit(Code, AbbrevToUse);
162 AbbrevToUse = Writer.TypeExtQualAbbrev;
167 #define TYPE(Class, Base) \ 168 case Type::Class: Visit##Class##Type(cast<Class##Type>(T)); break; 169 #define ABSTRACT_TYPE(Class, Base) 170 #include "clang/AST/TypeNodes.def" 177 void VisitTagType(
const TagType *T);
179 #define TYPE(Class, Base) void Visit##Class##Type(const Class##Type *T); 180 #define ABSTRACT_TYPE(Class, Base) 181 #include "clang/AST/TypeNodes.def" 186 void ASTTypeWriter::VisitBuiltinType(
const BuiltinType *T) {
187 llvm_unreachable(
"Built-in types are never serialized");
190 void ASTTypeWriter::VisitComplexType(
const ComplexType *T) {
195 void ASTTypeWriter::VisitPointerType(
const PointerType *T) {
200 void ASTTypeWriter::VisitDecayedType(
const DecayedType *T) {
205 void ASTTypeWriter::VisitAdjustedType(
const AdjustedType *T) {
258 void ASTTypeWriter::VisitVectorType(
const VectorType *T) {
265 void ASTTypeWriter::VisitExtVectorType(
const ExtVectorType *T) {
277 Record.push_back(C.
getCC());
287 VisitFunctionType(T);
309 VisitFunctionType(T);
318 for (
unsigned I = 0, N = T->
getNumParams(); I != N; ++I)
322 for (
unsigned I = 0, N = T->
getNumParams(); I != N; ++I)
335 Record.AddDeclRef(T->
getDecl());
339 void ASTTypeWriter::VisitTypedefType(
const TypedefType *T) {
340 Record.AddDeclRef(T->
getDecl());
346 void ASTTypeWriter::VisitTypeOfExprType(
const TypeOfExprType *T) {
351 void ASTTypeWriter::VisitTypeOfType(
const TypeOfType *T) {
356 void ASTTypeWriter::VisitDecltypeType(
const DecltypeType *T) {
369 void ASTTypeWriter::VisitAutoType(
const AutoType *T) {
377 void ASTTypeWriter::VisitDeducedTemplateSpecializationType(
390 "Cannot serialize in the middle of a type definition");
393 void ASTTypeWriter::VisitRecordType(
const RecordType *T) {
398 void ASTTypeWriter::VisitEnumType(
const EnumType *T) {
403 void ASTTypeWriter::VisitAttributedType(
const AttributedType *T) {
411 ASTTypeWriter::VisitSubstTemplateTypeParmType(
419 ASTTypeWriter::VisitSubstTemplateTypeParmPackType(
427 ASTTypeWriter::VisitTemplateSpecializationType(
432 for (
const auto &ArgI : *T)
433 Record.AddTemplateArgument(ArgI);
434 Record.AddTypeRef(T->isTypeAlias() ? T->getAliasedType()
435 : T->isCanonicalUnqualified()
437 : T->getCanonicalTypeInternal());
450 ASTTypeWriter::VisitDependentSizedExtVectorType(
460 Record.AddStmt(const_cast<Expr*>(T->
getSizeExpr()));
467 ASTTypeWriter::VisitDependentAddressSpaceType(
480 Record.AddDeclRef(T->
getDecl());
495 ASTTypeWriter::VisitDependentTemplateSpecializationType(
501 for (
const auto &I : *T)
502 Record.AddTemplateArgument(I);
509 Record.push_back(*NumExpansions + 1);
515 void ASTTypeWriter::VisitParenType(
const ParenType *T) {
520 void ASTTypeWriter::VisitElaboratedType(
const ElaboratedType *T) {
540 Record.AddDeclRef(T->
getDecl());
542 for (
const auto *I : T->
quals())
543 Record.AddDeclRef(I);
547 void ASTTypeWriter::VisitObjCObjectType(
const ObjCObjectType *T) {
551 Record.AddTypeRef(TypeArg);
553 for (
const auto *I : T->
quals())
554 Record.AddDeclRef(I);
566 ASTTypeWriter::VisitAtomicType(
const AtomicType *T) {
572 ASTTypeWriter::VisitPipeType(
const PipeType *T) {
586 #define ABSTRACT_TYPELOC(CLASS, PARENT) 587 #define TYPELOC(CLASS, PARENT) \ 588 void Visit##CLASS##TypeLoc(CLASS##TypeLoc TyLoc); 589 #include "clang/AST/TypeLocNodes.def" 632 Record.AddSourceLocation(TL.
getAmpLoc());
644 void TypeLocWriter::VisitArrayTypeLoc(
ArrayTypeLoc TL) {
653 VisitArrayTypeLoc(TL);
657 VisitArrayTypeLoc(TL);
661 VisitArrayTypeLoc(TL);
664 void TypeLocWriter::VisitDependentSizedArrayTypeLoc(
666 VisitArrayTypeLoc(TL);
669 void TypeLocWriter::VisitDependentAddressSpaceTypeLoc(
673 Record.AddSourceLocation(range.
getBegin());
674 Record.AddSourceLocation(range.
getEnd());
678 void TypeLocWriter::VisitDependentSizedExtVectorTypeLoc(
687 void TypeLocWriter::VisitDependentVectorTypeLoc(
702 for (
unsigned i = 0, e = TL.
getNumParams(); i != e; ++i)
707 VisitFunctionTypeLoc(TL);
711 VisitFunctionTypeLoc(TL);
749 Record.AddSourceLocation(TL.
getKWLoc());
755 void TypeLocWriter::VisitAutoTypeLoc(
AutoTypeLoc TL) {
759 void TypeLocWriter::VisitDeducedTemplateSpecializationTypeLoc(
768 void TypeLocWriter::VisitEnumTypeLoc(
EnumTypeLoc TL) {
780 void TypeLocWriter::VisitSubstTemplateTypeParmTypeLoc(
785 void TypeLocWriter::VisitSubstTemplateTypeParmPackTypeLoc(
790 void TypeLocWriter::VisitTemplateSpecializationTypeLoc(
796 for (
unsigned i = 0, e = TL.
getNumArgs(); i != e; ++i)
801 void TypeLocWriter::VisitParenTypeLoc(
ParenTypeLoc TL) {
821 void TypeLocWriter::VisitDependentTemplateSpecializationTypeLoc(
829 for (
unsigned I = 0, E = TL.
getNumArgs(); I != E; ++I)
859 Record.AddSourceLocation(TL.
getKWLoc());
864 void TypeLocWriter::VisitPipeTypeLoc(
PipeTypeLoc TL) {
865 Record.AddSourceLocation(TL.
getKWLoc());
868 void ASTWriter::WriteTypeAbbrevs() {
869 using namespace llvm;
871 std::shared_ptr<BitCodeAbbrev> Abv;
874 Abv = std::make_shared<BitCodeAbbrev>();
876 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
877 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 3));
878 TypeExtQualAbbrev = Stream.EmitAbbrev(std::move(Abv));
881 Abv = std::make_shared<BitCodeAbbrev>();
884 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
885 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
886 Abv->Add(BitCodeAbbrevOp(0));
887 Abv->Add(BitCodeAbbrevOp(0));
888 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 4));
889 Abv->Add(BitCodeAbbrevOp(0));
890 Abv->Add(BitCodeAbbrevOp(0));
891 Abv->Add(BitCodeAbbrevOp(0));
893 Abv->Add(BitCodeAbbrevOp(0));
894 Abv->Add(BitCodeAbbrevOp(0));
895 Abv->Add(BitCodeAbbrevOp(0));
896 Abv->Add(BitCodeAbbrevOp(0));
897 Abv->Add(BitCodeAbbrevOp(
EST_None));
898 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
899 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
900 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
901 TypeFunctionProtoAbbrev = Stream.EmitAbbrev(std::move(Abv));
909 llvm::BitstreamWriter &Stream,
912 Record.push_back(ID);
913 Stream.EmitRecord(llvm::bitc::BLOCKINFO_CODE_SETBID, Record);
916 if (!Name || Name[0] == 0)
920 Record.push_back(*Name++);
921 Stream.EmitRecord(llvm::bitc::BLOCKINFO_CODE_BLOCKNAME, Record);
925 llvm::BitstreamWriter &Stream,
928 Record.push_back(ID);
930 Record.push_back(*Name++);
931 Stream.EmitRecord(llvm::bitc::BLOCKINFO_CODE_SETRECORDNAME, Record);
936 #define RECORD(X) EmitRecordID(X, #X, Stream, Record) 1063 void ASTWriter::WriteBlockInfoBlock() {
1065 Stream.EnterBlockInfoBlock();
1067 #define BLOCK(X) EmitBlockID(X ## _ID, #X, Stream, Record) 1068 #define RECORD(X) EmitRecordID(X, #X, Stream, Record) 1071 BLOCK(CONTROL_BLOCK);
1082 BLOCK(OPTIONS_BLOCK);
1089 BLOCK(INPUT_FILES_BLOCK);
1148 BLOCK(SOURCE_MANAGER_BLOCK);
1156 BLOCK(PREPROCESSOR_BLOCK);
1164 BLOCK(SUBMODULE_BLOCK);
1185 BLOCK(COMMENTS_BLOCK);
1189 BLOCK(DECLTYPES_BLOCK);
1306 BLOCK(PREPROCESSOR_DETAIL_BLOCK);
1312 BLOCK(EXTENSION_BLOCK);
1315 BLOCK(UNHASHED_CONTROL_BLOCK);
1332 return Changed | llvm::sys::path::remove_dots(Path);
1347 assert(Filename &&
"No file name to adjust?");
1349 if (BaseDir.empty())
1354 for (; Filename[Pos] && Pos < BaseDir.size(); ++Pos)
1355 if (Filename[Pos] != BaseDir[Pos])
1364 if (!llvm::sys::path::is_separator(Filename[Pos])) {
1365 if (!llvm::sys::path::is_separator(BaseDir.back()))
1379 return Filename + Pos;
1386 auto Hash = Hasher.result();
1390 auto LShift = [&](
unsigned char Val,
unsigned Shift) {
1391 return (uint32_t)Val <<
Shift;
1393 for (
int I = 0; I != 5; ++I)
1394 Signature[I] = LShift(Hash[I * 4 + 0], 24) | LShift(Hash[I * 4 + 1], 16) |
1395 LShift(Hash[I * 4 + 2], 8) | LShift(Hash[I * 4 + 3], 0);
1403 Stream.FlushToWord();
1404 auto StartOfUnhashedControl = Stream.GetCurrentBitNo() >> 3;
1412 if (WritingModule &&
1414 Signature = createSignature(StringRef(Buffer.begin(), StartOfUnhashedControl));
1415 Record.append(Signature.begin(), Signature.end());
1423 #define DIAGOPT(Name, Bits, Default) Record.push_back(DiagOpts.Name); 1424 #define ENUM_DIAGOPT(Name, Type, Bits, Default) \ 1425 Record.push_back(static_cast<unsigned>(DiagOpts.get##Name())); 1426 #include "clang/Basic/DiagnosticOptions.def" 1427 Record.push_back(DiagOpts.
Warnings.size());
1428 for (
unsigned I = 0, N = DiagOpts.
Warnings.size(); I != N; ++I)
1429 AddString(DiagOpts.
Warnings[I], Record);
1430 Record.push_back(DiagOpts.
Remarks.size());
1431 for (
unsigned I = 0, N = DiagOpts.
Remarks.size(); I != N; ++I)
1432 AddString(DiagOpts.
Remarks[I], Record);
1438 WritePragmaDiagnosticMappings(Diags, WritingModule);
1448 const std::string &OutputFile) {
1449 using namespace llvm;
1455 auto MetadataAbbrev = std::make_shared<BitCodeAbbrev>();
1456 MetadataAbbrev->Add(BitCodeAbbrevOp(
METADATA));
1457 MetadataAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 16));
1458 MetadataAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 16));
1459 MetadataAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 16));
1460 MetadataAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 16));
1461 MetadataAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
1462 MetadataAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
1463 MetadataAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
1464 MetadataAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
1465 MetadataAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
1466 unsigned MetadataAbbrevCode = Stream.EmitAbbrev(std::move(MetadataAbbrev));
1467 assert((!WritingModule || isysroot.empty()) &&
1468 "writing module as a relocatable PCH?");
1470 RecordData::value_type Record[] = {
1474 CLANG_VERSION_MAJOR,
1475 CLANG_VERSION_MINOR,
1479 ASTHasCompilerErrors};
1480 Stream.EmitRecordWithBlob(MetadataAbbrevCode, Record,
1484 if (WritingModule) {
1486 auto Abbrev = std::make_shared<BitCodeAbbrev>();
1488 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
1489 unsigned AbbrevCode = Stream.EmitAbbrev(std::move(Abbrev));
1491 Stream.EmitRecordWithBlob(AbbrevCode, Record, WritingModule->Name);
1494 if (WritingModule && WritingModule->Directory) {
1504 WritingModule->Directory->getName() != StringRef(
".")) {
1506 auto Abbrev = std::make_shared<BitCodeAbbrev>();
1508 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
1509 unsigned AbbrevCode = Stream.EmitAbbrev(std::move(Abbrev));
1512 Stream.EmitRecordWithBlob(AbbrevCode, Record, BaseDir);
1516 BaseDirectory.assign(BaseDir.begin(), BaseDir.end());
1517 }
else if (!isysroot.empty()) {
1519 BaseDirectory = isysroot;
1527 AddPath(WritingModule->PresumedModuleMapFile.empty()
1528 ? Map.getModuleMapFileForUniquing(WritingModule)->getName()
1529 : StringRef(WritingModule->PresumedModuleMapFile),
1533 if (
auto *AdditionalModMaps =
1534 Map.getAdditionalModuleMapFiles(WritingModule)) {
1535 Record.push_back(AdditionalModMaps->size());
1536 for (
const FileEntry *F : *AdditionalModMaps)
1537 AddPath(F->getName(), Record);
1539 Record.push_back(0);
1552 if (!M.isDirectlyImported())
1555 Record.push_back((
unsigned)M.Kind);
1556 AddSourceLocation(M.ImportLoc, Record);
1560 Record.push_back(M.Signature ? 0 : M.File->getSize());
1561 Record.push_back(M.Signature ? 0 : getTimestampForOutput(M.File));
1563 for (
auto I : M.Signature)
1564 Record.push_back(I);
1566 AddString(M.ModuleName, Record);
1567 AddPath(M.FileName, Record);
1569 Stream.EmitRecord(
IMPORTS, Record);
1578 #define LANGOPT(Name, Bits, Default, Description) \ 1579 Record.push_back(LangOpts.Name); 1580 #define ENUM_LANGOPT(Name, Type, Bits, Default, Description) \ 1581 Record.push_back(static_cast<unsigned>(LangOpts.get##Name())); 1582 #include "clang/Basic/LangOptions.def" 1583 #define SANITIZER(NAME, ID) \ 1584 Record.push_back(LangOpts.Sanitize.has(SanitizerKind::ID)); 1585 #include "clang/Basic/Sanitizers.def" 1589 AddString(Feature, Record);
1599 AddString(I, Record);
1606 AddString(T.getTriple(), Record);
1616 AddString(TargetOpts.
Triple, Record);
1617 AddString(TargetOpts.
CPU, Record);
1618 AddString(TargetOpts.
ABI, Record);
1623 Record.push_back(TargetOpts.
Features.size());
1624 for (
unsigned I = 0, N = TargetOpts.
Features.size(); I != N; ++I) {
1625 AddString(TargetOpts.
Features[I], Record);
1640 AddString(HSOpts.
Sysroot, Record);
1644 for (
unsigned I = 0, N = HSOpts.
UserEntries.size(); I != N; ++I) {
1646 AddString(Entry.
Path, Record);
1647 Record.push_back(static_cast<unsigned>(Entry.
Group));
1678 Record.push_back(PPOpts.
Macros.size());
1679 for (
unsigned I = 0, N = PPOpts.
Macros.size(); I != N; ++I) {
1680 AddString(PPOpts.
Macros[I].first, Record);
1681 Record.push_back(PPOpts.
Macros[I].second);
1685 Record.push_back(PPOpts.
Includes.size());
1686 for (
unsigned I = 0, N = PPOpts.
Includes.size(); I != N; ++I)
1687 AddString(PPOpts.
Includes[I], Record);
1691 for (
unsigned I = 0, N = PPOpts.
MacroIncludes.size(); I != N; ++I)
1707 auto FileAbbrev = std::make_shared<BitCodeAbbrev>();
1709 FileAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
1710 FileAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
1711 unsigned FileAbbrevCode = Stream.EmitAbbrev(std::move(FileAbbrev));
1716 EmitRecordWithPath(FileAbbrevCode, Record, MainFile->getName());
1724 if (!OutputFile.empty() && OutputFile !=
"-") {
1725 auto Abbrev = std::make_shared<BitCodeAbbrev>();
1727 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
1728 unsigned AbbrevCode = Stream.EmitAbbrev(std::move(Abbrev));
1733 StringRef origDir = llvm::sys::path::parent_path(OutputPath);
1736 Stream.EmitRecordWithBlob(AbbrevCode, Record, origDir);
1739 WriteInputFiles(Context.SourceMgr,
1748 struct InputFileEntry {
1752 bool BufferOverridden;
1753 bool IsTopLevelModuleMap;
1761 using namespace llvm;
1766 auto IFAbbrev = std::make_shared<BitCodeAbbrev>();
1768 IFAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
1769 IFAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 12));
1770 IFAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 32));
1771 IFAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
1772 IFAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
1773 IFAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
1774 IFAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
1775 unsigned IFAbbrevCode = Stream.EmitAbbrev(std::move(IFAbbrev));
1779 std::deque<InputFileEntry> SortedFiles;
1783 assert(&SourceMgr.
getSLocEntry(FileID::get(I)) == SLoc);
1793 InputFileEntry Entry;
1801 SortedFiles.push_back(Entry);
1803 SortedFiles.push_front(Entry);
1806 unsigned UserFilesNum = 0;
1808 std::vector<uint64_t> InputFileOffsets;
1809 for (
const auto &Entry : SortedFiles) {
1810 uint32_t &InputFileID = InputFileIDs[Entry.File];
1811 if (InputFileID != 0)
1815 InputFileOffsets.push_back(Stream.GetCurrentBitNo());
1817 InputFileID = InputFileOffsets.size();
1819 if (!Entry.IsSystemFile)
1824 RecordData::value_type Record[] = {
1826 InputFileOffsets.size(),
1827 (uint64_t)Entry.File->getSize(),
1828 (uint64_t)getTimestampForOutput(Entry.File),
1829 Entry.BufferOverridden,
1831 Entry.IsTopLevelModuleMap};
1833 EmitRecordWithPath(IFAbbrevCode, Record, Entry.File->getName());
1839 auto OffsetsAbbrev = std::make_shared<BitCodeAbbrev>();
1841 OffsetsAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
1842 OffsetsAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
1844 OffsetsAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
1845 unsigned OffsetsAbbrevCode = Stream.EmitAbbrev(std::move(OffsetsAbbrev));
1849 InputFileOffsets.size(), UserFilesNum};
1850 Stream.EmitRecordWithBlob(OffsetsAbbrevCode, Record,
bytes(InputFileOffsets));
1860 using namespace llvm;
1862 auto Abbrev = std::make_shared<BitCodeAbbrev>();
1864 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));
1865 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));
1866 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3));
1867 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
1869 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
1870 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));
1871 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 24));
1872 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));
1873 return Stream.EmitAbbrev(std::move(Abbrev));
1879 using namespace llvm;
1881 auto Abbrev = std::make_shared<BitCodeAbbrev>();
1883 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));
1884 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));
1885 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3));
1886 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
1887 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
1888 return Stream.EmitAbbrev(std::move(Abbrev));
1895 using namespace llvm;
1897 auto Abbrev = std::make_shared<BitCodeAbbrev>();
1901 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));
1902 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
1903 return Stream.EmitAbbrev(std::move(Abbrev));
1909 using namespace llvm;
1911 auto Abbrev = std::make_shared<BitCodeAbbrev>();
1913 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));
1914 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));
1915 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));
1916 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));
1917 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
1918 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
1919 return Stream.EmitAbbrev(std::move(Abbrev));
1925 class HeaderFileInfoTrait {
1930 llvm::StringMap<unsigned> FrameworkNameOffset;
1933 HeaderFileInfoTrait(
ASTWriter &Writer) : Writer(Writer) {}
1940 using key_type_ref =
const key_type &;
1942 using UnresolvedModule =
1943 llvm::PointerIntPair<Module *, 2, ModuleMap::ModuleHeaderRole>;
1948 UnresolvedModule Unresolved;
1950 using data_type_ref =
const data_type &;
1952 using hash_value_type = unsigned;
1953 using offset_type = unsigned;
1962 std::pair<unsigned, unsigned>
1963 EmitKeyDataLength(raw_ostream& Out, key_type_ref key, data_type_ref Data) {
1964 using namespace llvm::support;
1966 endian::Writer LE(Out, little);
1967 unsigned KeyLen = key.Filename.size() + 1 + 8 + 8;
1968 LE.write<uint16_t>(KeyLen);
1969 unsigned DataLen = 1 + 2 + 4 + 4;
1970 for (
auto ModInfo : Data.KnownHeaders)
1973 if (Data.Unresolved.getPointer())
1975 LE.write<uint8_t>(DataLen);
1976 return std::make_pair(KeyLen, DataLen);
1979 void EmitKey(raw_ostream& Out, key_type_ref key,
unsigned KeyLen) {
1980 using namespace llvm::support;
1982 endian::Writer LE(Out, little);
1983 LE.write<uint64_t>(key.Size);
1985 LE.write<uint64_t>(key.ModTime);
1987 Out.write(key.Filename.data(), KeyLen);
1990 void EmitData(raw_ostream &Out, key_type_ref key,
1991 data_type_ref Data,
unsigned DataLen) {
1992 using namespace llvm::support;
1994 endian::Writer LE(Out, little);
1995 uint64_t Start = Out.tell(); (void)Start;
1997 unsigned char Flags = (Data.HFI.isImport << 5)
1998 | (Data.HFI.isPragmaOnce << 4)
1999 | (Data.HFI.DirInfo << 1)
2000 | Data.HFI.IndexHeaderMapHeader;
2001 LE.write<uint8_t>(Flags);
2002 LE.write<uint16_t>(Data.HFI.NumIncludes);
2004 if (!Data.HFI.ControllingMacro)
2005 LE.write<uint32_t>(Data.HFI.ControllingMacroID);
2010 if (!Data.HFI.Framework.empty()) {
2012 llvm::StringMap<unsigned>::iterator Pos
2013 = FrameworkNameOffset.find(Data.HFI.Framework);
2014 if (Pos == FrameworkNameOffset.end()) {
2015 Offset = FrameworkStringData.size() + 1;
2016 FrameworkStringData.append(Data.HFI.Framework.begin(),
2017 Data.HFI.Framework.end());
2018 FrameworkStringData.push_back(0);
2020 FrameworkNameOffset[Data.HFI.Framework] =
Offset;
2022 Offset = Pos->second;
2024 LE.write<uint32_t>(
Offset);
2028 uint32_t
Value = (ModID << 2) | (
unsigned)Role;
2029 assert((Value >> 2) == ModID &&
"overflow in header module info");
2030 LE.write<uint32_t>(
Value);
2036 for (
auto ModInfo : Data.KnownHeaders)
2037 EmitModule(ModInfo.getModule(), ModInfo.getRole());
2038 if (Data.Unresolved.getPointer())
2039 EmitModule(Data.Unresolved.getPointer(), Data.Unresolved.getInt());
2041 assert(Out.tell() - Start == DataLen &&
"Wrong data length");
2044 const char *strings_begin()
const {
return FrameworkStringData.begin(); }
2045 const char *strings_end()
const {
return FrameworkStringData.end(); }
2053 void ASTWriter::WriteHeaderSearch(
const HeaderSearch &HS) {
2054 HeaderFileInfoTrait GeneratorTrait(*
this);
2055 llvm::OnDiskChainedHashTableGenerator<HeaderFileInfoTrait> Generator;
2057 unsigned NumHeaderSearchEntries = 0;
2064 if (WritingModule) {
2066 while (!Worklist.empty()) {
2067 Module *M = Worklist.pop_back_val();
2083 if (!U.Size || (!U.ModTime && IncludeTimestamps)) {
2084 PP->
Diag(U.FileNameLoc, diag::err_module_no_size_mtime_for_header)
2085 << WritingModule->getFullModuleName() << U.Size.hasValue()
2092 llvm::sys::path::append(
Filename, U.FileName);
2095 StringRef FilenameDup = strdup(
Filename.c_str());
2096 SavedStrings.push_back(FilenameDup.data());
2098 HeaderFileInfoTrait::key_type Key = {
2099 FilenameDup, *U.Size, IncludeTimestamps ? *U.ModTime : 0
2101 HeaderFileInfoTrait::data_type Data = {
2106 Generator.insert(Key, Data, GeneratorTrait);
2107 ++NumHeaderSearchEntries;
2120 for (
unsigned UID = 0, LastUID = FilesByUID.size(); UID != LastUID; ++UID) {
2121 const FileEntry *File = FilesByUID[UID];
2139 if (PreparePathForOutput(FilenameTmp)) {
2142 Filename = StringRef(strdup(FilenameTmp.c_str()));
2143 SavedStrings.push_back(Filename.data());
2146 HeaderFileInfoTrait::key_type Key = {
2149 HeaderFileInfoTrait::data_type Data = {
2152 Generator.insert(Key, Data, GeneratorTrait);
2153 ++NumHeaderSearchEntries;
2158 uint32_t BucketOffset;
2160 using namespace llvm::support;
2162 llvm::raw_svector_ostream Out(TableData);
2164 endian::write<uint32_t>(Out, 0, little);
2165 BucketOffset = Generator.Emit(Out, GeneratorTrait);
2169 using namespace llvm;
2171 auto Abbrev = std::make_shared<BitCodeAbbrev>();
2173 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
2174 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
2175 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
2176 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2177 unsigned TableAbbrev = Stream.EmitAbbrev(std::move(Abbrev));
2181 NumHeaderSearchEntries, TableData.size()};
2182 TableData.append(GeneratorTrait.strings_begin(),GeneratorTrait.strings_end());
2183 Stream.EmitRecordWithBlob(TableAbbrev, Record, TableData);
2186 for (
unsigned I = 0, N = SavedStrings.size(); I != N; ++I)
2187 free(const_cast<char *>(SavedStrings[I]));
2190 static void emitBlob(llvm::BitstreamWriter &Stream, StringRef Blob,
2191 unsigned SLocBufferBlobCompressedAbbrv,
2192 unsigned SLocBufferBlobAbbrv) {
2193 using RecordDataType = ASTWriter::RecordData::value_type;
2198 if (llvm::zlib::isAvailable()) {
2199 llvm::Error E = llvm::zlib::compress(Blob.drop_back(1), CompressedBuffer);
2203 Stream.EmitRecordWithBlob(SLocBufferBlobCompressedAbbrv, Record,
2207 llvm::consumeError(std::move(E));
2211 Stream.EmitRecordWithBlob(SLocBufferBlobAbbrv, Record, Blob);
2222 void ASTWriter::WriteSourceManagerBlock(
SourceManager &SourceMgr,
2233 unsigned SLocBufferBlobCompressedAbbrv =
2239 std::vector<uint32_t> SLocEntryOffsets;
2240 RecordData PreloadSLocs;
2246 FileID FID = FileID::get(I);
2250 SLocEntryOffsets.push_back(Stream.GetCurrentBitNo());
2263 Record.push_back(Code);
2266 Record.push_back(SLoc->
getOffset() - 2);
2274 bool EmitBlob =
false;
2277 "Writing to AST an overridden file is not supported");
2280 assert(InputFileIDs[Content->
OrigEntry] != 0 &&
"Missed file entry");
2281 Record.push_back(InputFileIDs[Content->
OrigEntry]);
2283 Record.push_back(File.NumCreatedFIDs);
2285 FileDeclIDsTy::iterator FDI = FileDeclIDs.find(FID);
2286 if (FDI != FileDeclIDs.end()) {
2287 Record.push_back(FDI->second->FirstDeclIndex);
2288 Record.push_back(FDI->second->DeclIDs.size());
2290 Record.push_back(0);
2291 Record.push_back(0);
2294 Stream.EmitRecordWithAbbrev(SLocFileAbbrv, Record);
2305 const llvm::MemoryBuffer *Buffer
2307 StringRef Name = Buffer->getBufferIdentifier();
2308 Stream.EmitRecordWithBlob(SLocBufferAbbrv, Record,
2309 StringRef(Name.data(), Name.size() + 1));
2312 if (Name ==
"<built-in>")
2313 PreloadSLocs.push_back(SLocEntryOffsets.size());
2319 const llvm::MemoryBuffer *Buffer =
2321 StringRef Blob(Buffer->getBufferStart(), Buffer->getBufferSize() + 1);
2322 emitBlob(Stream, Blob, SLocBufferBlobCompressedAbbrv,
2323 SLocBufferBlobAbbrv);
2340 Record.push_back(NextOffset - SLoc->
getOffset() - 1);
2341 Stream.EmitRecordWithAbbrev(SLocExpansionAbbrv, Record);
2347 if (SLocEntryOffsets.empty())
2352 using namespace llvm;
2354 auto Abbrev = std::make_shared<BitCodeAbbrev>();
2356 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 16));
2357 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 16));
2358 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2359 unsigned SLocOffsetsAbbrev = Stream.EmitAbbrev(std::move(Abbrev));
2361 RecordData::value_type Record[] = {
2364 Stream.EmitRecordWithBlob(SLocOffsetsAbbrev, Record,
2365 bytes(SLocEntryOffsets));
2379 llvm::DenseMap<int, int> FilenameMap;
2380 FilenameMap[-1] = -1;
2381 for (
const auto &L : LineTable) {
2384 for (
auto &LE : L.second) {
2385 if (FilenameMap.insert(std::make_pair(LE.FilenameID,
2386 FilenameMap.size() - 1)).second)
2387 AddPath(LineTable.getFilename(LE.FilenameID), Record);
2390 Record.push_back(0);
2393 for (
const auto &L : LineTable) {
2399 Record.push_back(L.first.ID);
2402 Record.push_back(L.second.size());
2403 for (
const auto &LE : L.second) {
2404 Record.push_back(LE.FileOffset);
2405 Record.push_back(LE.LineNo);
2406 Record.push_back(FilenameMap[LE.FilenameID]);
2407 Record.push_back((
unsigned)LE.FileKind);
2408 Record.push_back(LE.IncludeOffset);
2423 if (MI->isBuiltinMacro())
2439 void ASTWriter::WritePreprocessor(
const Preprocessor &PP,
bool IsModule) {
2442 WritePreprocessorDetail(*PPRec);
2445 RecordData ModuleMacroRecord;
2456 if (SkipInfo.hasValue()) {
2457 Record.push_back(
true);
2458 AddSourceLocation(SkipInfo->HashTokenLoc, Record);
2459 AddSourceLocation(SkipInfo->IfTokenLoc, Record);
2460 Record.push_back(SkipInfo->FoundNonSkipPortion);
2461 Record.push_back(SkipInfo->FoundElse);
2462 AddSourceLocation(SkipInfo->ElseLoc, Record);
2464 Record.push_back(
false);
2467 AddSourceLocation(Cond.IfLoc, Record);
2468 Record.push_back(Cond.WasSkipping);
2469 Record.push_back(Cond.FoundNonSkip);
2470 Record.push_back(Cond.FoundElse);
2491 if (
Id.second->hadMacroDefinition() &&
2492 (!
Id.second->isFromAST() ||
2493 Id.second->hasChangedSinceDeserialization()))
2494 MacroIdentifiers.push_back(
Id.second);
2497 llvm::sort(MacroIdentifiers, llvm::less_ptr<IdentifierInfo>());
2503 auto StartOffset = Stream.GetCurrentBitNo();
2513 Record.push_back(MD->
getKind());
2514 if (
auto *DefMD = dyn_cast<DefMacroDirective>(MD)) {
2515 Record.push_back(getMacroRef(DefMD->getInfo(), Name));
2516 }
else if (
auto *VisMD = dyn_cast<VisibilityMacroDirective>(MD)) {
2517 Record.push_back(VisMD->isPublic());
2522 bool EmittedModuleMacros =
false;
2526 llvm::DenseMap<ModuleMacro*, unsigned> Visits;
2527 while (!Worklist.empty()) {
2528 auto *Macro = Worklist.pop_back_val();
2531 ModuleMacroRecord.push_back(
2532 getSubmoduleID(Macro->getOwningModule()));
2533 ModuleMacroRecord.push_back(getMacroRef(Macro->getMacroInfo(), Name));
2534 for (
auto *M : Macro->overrides())
2535 ModuleMacroRecord.push_back(getSubmoduleID(M->getOwningModule()));
2538 ModuleMacroRecord.clear();
2541 for (
auto *M : Macro->overrides())
2542 if (++Visits[M] == M->getNumOverridingMacros())
2543 Worklist.push_back(M);
2545 EmittedModuleMacros =
true;
2548 if (Record.empty() && !EmittedModuleMacros)
2551 IdentMacroDirectivesOffsetMap[Name] = StartOffset;
2562 std::vector<uint32_t> MacroOffsets;
2564 for (
unsigned I = 0, N = MacroInfosToEmit.size(); I != N; ++I) {
2569 if (ID < FirstMacroID) {
2570 assert(0 &&
"Loaded MacroInfo entered MacroInfosToEmit ?");
2575 unsigned Index = ID - FirstMacroID;
2576 if (Index == MacroOffsets.size())
2577 MacroOffsets.push_back(Stream.GetCurrentBitNo());
2579 if (Index > MacroOffsets.size())
2580 MacroOffsets.resize(Index + 1);
2582 MacroOffsets[Index] = Stream.GetCurrentBitNo();
2585 AddIdentifierRef(Name, Record);
2588 Record.push_back(MI->
isUsed());
2601 AddIdentifierRef(Param, Record);
2609 Stream.EmitRecord(Code, Record);
2613 for (
unsigned TokNo = 0, e = MI->
getNumTokens(); TokNo != e; ++TokNo) {
2618 AddToken(Tok, Record);
2619 Stream.EmitRecord(
PP_TOKEN, Record);
2628 using namespace llvm;
2630 auto Abbrev = std::make_shared<BitCodeAbbrev>();
2632 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
2633 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
2634 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2636 unsigned MacroOffsetAbbrev = Stream.EmitAbbrev(std::move(Abbrev));
2638 RecordData::value_type Record[] = {
MACRO_OFFSET, MacroOffsets.size(),
2640 Stream.EmitRecordWithBlob(MacroOffsetAbbrev, Record,
bytes(MacroOffsets));
2654 unsigned NumPreprocessingRecords = 0;
2655 using namespace llvm;
2658 unsigned InclusionAbbrev = 0;
2660 auto Abbrev = std::make_shared<BitCodeAbbrev>();
2662 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
2663 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2664 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2));
2665 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2666 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2667 InclusionAbbrev = Stream.EmitAbbrev(std::move(Abbrev));
2670 unsigned FirstPreprocessorEntityID
2671 = (Chain ? PPRec.getNumLoadedPreprocessedEntities() : 0)
2673 unsigned NextPreprocessorEntityID = FirstPreprocessorEntityID;
2678 (void)++E, ++NumPreprocessingRecords, ++NextPreprocessorEntityID) {
2681 PreprocessedEntityOffsets.push_back(
2682 PPEntityOffset((*E)->getSourceRange(), Stream.GetCurrentBitNo()));
2684 if (
auto *MD = dyn_cast<MacroDefinitionRecord>(*E)) {
2686 MacroDefinitions[MD] = NextPreprocessorEntityID;
2688 AddIdentifierRef(MD->getName(), Record);
2693 if (
auto *ME = dyn_cast<MacroExpansion>(*E)) {
2694 Record.push_back(ME->isBuiltinMacro());
2695 if (ME->isBuiltinMacro())
2696 AddIdentifierRef(ME->getName(), Record);
2698 Record.push_back(MacroDefinitions[ME->getDefinition()]);
2703 if (
auto *
ID = dyn_cast<InclusionDirective>(*E)) {
2705 Record.push_back(
ID->getFileName().size());
2706 Record.push_back(
ID->wasInQuotes());
2707 Record.push_back(static_cast<unsigned>(
ID->getKind()));
2708 Record.push_back(
ID->importedModule());
2710 Buffer +=
ID->getFileName();
2714 Buffer +=
ID->getFile()->getName();
2715 Stream.EmitRecordWithBlob(InclusionAbbrev, Record, Buffer);
2719 llvm_unreachable(
"Unhandled PreprocessedEntity in ASTWriter");
2724 if (NumPreprocessingRecords > 0) {
2725 assert(PreprocessedEntityOffsets.size() == NumPreprocessingRecords);
2728 using namespace llvm;
2730 auto Abbrev = std::make_shared<BitCodeAbbrev>();
2732 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
2733 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2734 unsigned PPEOffsetAbbrev = Stream.EmitAbbrev(std::move(Abbrev));
2737 FirstPreprocessorEntityID -
2739 Stream.EmitRecordWithBlob(PPEOffsetAbbrev, Record,
2740 bytes(PreprocessedEntityOffsets));
2745 if (SkippedRanges.size() > 0) {
2746 std::vector<PPSkippedRange> SerializedSkippedRanges;
2747 SerializedSkippedRanges.reserve(SkippedRanges.size());
2748 for (
auto const& Range : SkippedRanges)
2749 SerializedSkippedRanges.emplace_back(Range);
2751 using namespace llvm;
2752 auto Abbrev = std::make_shared<BitCodeAbbrev>();
2754 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2755 unsigned PPESkippedRangeAbbrev = Stream.EmitAbbrev(std::move(Abbrev));
2759 Stream.EmitRecordWithBlob(PPESkippedRangeAbbrev, Record,
2760 bytes(SerializedSkippedRanges));
2768 llvm::DenseMap<Module *, unsigned>::iterator Known = SubmoduleIDs.find(Mod);
2769 if (Known != SubmoduleIDs.end())
2770 return Known->second;
2773 if (Top != WritingModule &&
2774 (getLangOpts().CompilingPCH ||
2775 !Top->fullModuleNameIs(StringRef(getLangOpts().CurrentModule))))
2778 return SubmoduleIDs[Mod] = NextSubmoduleID++;
2781 unsigned ASTWriter::getSubmoduleID(
Module *Mod) {
2785 unsigned ID = getLocalOrImportedSubmoduleID(Mod);
2786 assert((ID || !Mod) &&
2787 "asked for module ID for non-local, non-imported module");
2794 unsigned ChildModules = 0;
2796 Sub != SubEnd; ++Sub)
2799 return ChildModules + 1;
2802 void ASTWriter::WriteSubmodules(
Module *WritingModule) {
2807 using namespace llvm;
2809 auto Abbrev = std::make_shared<BitCodeAbbrev>();
2811 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2812 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2813 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2));
2814 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2815 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2816 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2817 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2818 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2819 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2820 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2821 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2822 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2823 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2824 unsigned DefinitionAbbrev = Stream.EmitAbbrev(std::move(Abbrev));
2826 Abbrev = std::make_shared<BitCodeAbbrev>();
2828 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2829 unsigned UmbrellaAbbrev = Stream.EmitAbbrev(std::move(Abbrev));
2831 Abbrev = std::make_shared<BitCodeAbbrev>();
2833 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2834 unsigned HeaderAbbrev = Stream.EmitAbbrev(std::move(Abbrev));
2836 Abbrev = std::make_shared<BitCodeAbbrev>();
2838 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2839 unsigned TopHeaderAbbrev = Stream.EmitAbbrev(std::move(Abbrev));
2841 Abbrev = std::make_shared<BitCodeAbbrev>();
2843 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2844 unsigned UmbrellaDirAbbrev = Stream.EmitAbbrev(std::move(Abbrev));
2846 Abbrev = std::make_shared<BitCodeAbbrev>();
2848 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2849 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2850 unsigned RequiresAbbrev = Stream.EmitAbbrev(std::move(Abbrev));
2852 Abbrev = std::make_shared<BitCodeAbbrev>();
2854 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2855 unsigned ExcludedHeaderAbbrev = Stream.EmitAbbrev(std::move(Abbrev));
2857 Abbrev = std::make_shared<BitCodeAbbrev>();
2859 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2860 unsigned TextualHeaderAbbrev = Stream.EmitAbbrev(std::move(Abbrev));
2862 Abbrev = std::make_shared<BitCodeAbbrev>();
2864 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2865 unsigned PrivateHeaderAbbrev = Stream.EmitAbbrev(std::move(Abbrev));
2867 Abbrev = std::make_shared<BitCodeAbbrev>();
2869 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2870 unsigned PrivateTextualHeaderAbbrev = Stream.EmitAbbrev(std::move(Abbrev));
2872 Abbrev = std::make_shared<BitCodeAbbrev>();
2874 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2875 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2876 unsigned LinkLibraryAbbrev = Stream.EmitAbbrev(std::move(Abbrev));
2878 Abbrev = std::make_shared<BitCodeAbbrev>();
2880 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2881 unsigned ConfigMacroAbbrev = Stream.EmitAbbrev(std::move(Abbrev));
2883 Abbrev = std::make_shared<BitCodeAbbrev>();
2885 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2886 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2887 unsigned ConflictAbbrev = Stream.EmitAbbrev(std::move(Abbrev));
2889 Abbrev = std::make_shared<BitCodeAbbrev>();
2891 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2892 unsigned ExportAsAbbrev = Stream.EmitAbbrev(std::move(Abbrev));
2895 RecordData::value_type Record[] = {
2901 std::queue<Module *> Q;
2902 Q.push(WritingModule);
2903 while (!Q.empty()) {
2906 unsigned ID = getSubmoduleID(Mod);
2908 uint64_t ParentID = 0;
2910 assert(SubmoduleIDs[Mod->
Parent] &&
"Submodule parent not written?");
2911 ParentID = SubmoduleIDs[Mod->
Parent];
2919 (RecordData::value_type)Mod->
Kind,
2929 Stream.EmitRecordWithBlob(DefinitionAbbrev, Record, Mod->
Name);
2935 Stream.EmitRecordWithBlob(RequiresAbbrev, Record, R.first);
2941 Stream.EmitRecordWithBlob(UmbrellaAbbrev, Record,
2942 UmbrellaHeader.NameAsWritten);
2945 Stream.EmitRecordWithBlob(UmbrellaDirAbbrev, Record,
2946 UmbrellaDir.NameAsWritten);
2951 unsigned RecordKind;
2962 for (
auto &HL : HeaderLists) {
2963 RecordData::value_type Record[] = {HL.RecordKind};
2964 for (
auto &H : Mod->
Headers[HL.HeaderKind])
2965 Stream.EmitRecordWithBlob(HL.Abbrev, Record, H.NameAsWritten);
2972 for (
auto *H : TopHeaders)
2973 Stream.EmitRecordWithBlob(TopHeaderAbbrev, Record, H->getName());
2980 Record.push_back(getSubmoduleID(I));
2987 for (
const auto &E : Mod->
Exports) {
2990 Record.push_back(getSubmoduleID(E.getPointer()));
2991 Record.push_back(E.getInt());
3004 Stream.EmitRecordWithBlob(LinkLibraryAbbrev, Record, LL.Library);
3012 getSubmoduleID(C.Other)};
3013 Stream.EmitRecordWithBlob(ConflictAbbrev, Record, C.Message);
3019 Stream.EmitRecordWithBlob(ConfigMacroAbbrev, Record, CM);
3025 Inits.push_back(GetDeclRef(D));
3032 Stream.EmitRecordWithBlob(ExportAsAbbrev, Record, Mod->
ExportAsModule);
3042 assert((NextSubmoduleID - FirstSubmoduleID ==
3044 "Wrong # of submodules; found a reference to a non-local, " 3045 "non-imported submodule?");
3050 llvm::SmallDenseMap<const DiagnosticsEngine::DiagState *, unsigned, 64>
3052 unsigned CurrID = 0;
3055 auto EncodeDiagStateFlags =
3056 [](
const DiagnosticsEngine::DiagState *DS) ->
unsigned {
3057 unsigned Result = (unsigned)DS->ExtBehavior;
3059 {(unsigned)DS->IgnoreAllWarnings, (
unsigned)DS->EnableAllWarnings,
3060 (unsigned)DS->WarningsAsErrors, (
unsigned)DS->ErrorsAsFatal,
3061 (unsigned)DS->SuppressSystemWarnings})
3062 Result = (Result << 1) | Val;
3066 unsigned Flags = EncodeDiagStateFlags(Diag.DiagStatesByLoc.FirstDiagState);
3067 Record.push_back(Flags);
3069 auto AddDiagState = [&](
const DiagnosticsEngine::DiagState *
State,
3070 bool IncludeNonPragmaStates) {
3073 assert(Flags == EncodeDiagStateFlags(State) &&
3074 "diag state flags vary in single AST file");
3076 unsigned &DiagStateID = DiagStateIDMap[
State];
3077 Record.push_back(DiagStateID);
3079 if (DiagStateID == 0) {
3080 DiagStateID = ++CurrID;
3083 auto SizeIdx = Record.size();
3084 Record.emplace_back();
3085 for (
const auto &I : *State) {
3086 if (I.second.isPragma() || IncludeNonPragmaStates) {
3087 Record.push_back(I.first);
3088 Record.push_back(I.second.serialize());
3092 Record[SizeIdx] = (Record.size() - SizeIdx) / 2;
3096 AddDiagState(Diag.DiagStatesByLoc.FirstDiagState, isModule);
3099 auto NumLocationsIdx = Record.size();
3100 Record.emplace_back();
3103 unsigned NumLocations = 0;
3104 for (
auto &FileIDAndFile : Diag.DiagStatesByLoc.Files) {
3105 if (!FileIDAndFile.first.isValid() ||
3106 !FileIDAndFile.second.HasLocalTransitions)
3111 assert(!Loc.
isInvalid() &&
"start loc for valid FileID is invalid");
3112 AddSourceLocation(Loc, Record);
3114 Record.push_back(FileIDAndFile.second.StateTransitions.size());
3115 for (
auto &StatePoint : FileIDAndFile.second.StateTransitions) {
3116 Record.push_back(StatePoint.Offset);
3117 AddDiagState(StatePoint.State,
false);
3122 Record[NumLocationsIdx] = NumLocations;
3130 AddSourceLocation(Diag.DiagStatesByLoc.CurDiagStateLoc, Record);
3131 AddDiagState(Diag.DiagStatesByLoc.CurDiagState,
false);
3141 void ASTWriter::WriteType(
QualType T) {
3142 TypeIdx &IdxRef = TypeIdxs[T];
3144 IdxRef =
TypeIdx(NextTypeID++);
3147 assert(Idx.
getIndex() >= FirstTypeID &&
"Re-writing a type from a prior AST");
3157 unsigned Index = Idx.
getIndex() - FirstTypeID;
3158 if (TypeOffsets.size() == Index)
3159 TypeOffsets.push_back(Offset);
3160 else if (TypeOffsets.size() < Index) {
3161 TypeOffsets.resize(Index + 1);
3162 TypeOffsets[Index] =
Offset;
3164 llvm_unreachable(
"Types emitted in wrong order");
3177 uint64_t ASTWriter::WriteDeclContextLexicalBlock(
ASTContext &Context,
3182 uint64_t
Offset = Stream.GetCurrentBitNo();
3184 for (
const auto *D : DC->
decls()) {
3185 KindDeclPairs.push_back(D->getKind());
3186 KindDeclPairs.push_back(GetDeclRef(D));
3189 ++NumLexicalDeclContexts;
3191 Stream.EmitRecordWithBlob(DeclContextLexicalAbbrev, Record,
3192 bytes(KindDeclPairs));
3196 void ASTWriter::WriteTypeDeclOffsets() {
3197 using namespace llvm;
3200 auto Abbrev = std::make_shared<BitCodeAbbrev>();
3202 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
3203 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
3204 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
3205 unsigned TypeOffsetAbbrev = Stream.EmitAbbrev(std::move(Abbrev));
3207 RecordData::value_type Record[] = {
TYPE_OFFSET, TypeOffsets.size(),
3209 Stream.EmitRecordWithBlob(TypeOffsetAbbrev, Record,
bytes(TypeOffsets));
3213 Abbrev = std::make_shared<BitCodeAbbrev>();
3215 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
3216 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
3217 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
3218 unsigned DeclOffsetAbbrev = Stream.EmitAbbrev(std::move(Abbrev));
3220 RecordData::value_type Record[] = {
DECL_OFFSET, DeclOffsets.size(),
3222 Stream.EmitRecordWithBlob(DeclOffsetAbbrev, Record,
bytes(DeclOffsets));
3226 void ASTWriter::WriteFileDeclIDsMap() {
3227 using namespace llvm;
3230 FileDeclIDs.begin(), FileDeclIDs.end());
3231 llvm::sort(SortedFileDeclIDs, llvm::less_first());
3235 for (
auto &FileDeclEntry : SortedFileDeclIDs) {
3236 DeclIDInFileInfo &Info = *FileDeclEntry.second;
3237 Info.FirstDeclIndex = FileGroupedDeclIDs.size();
3238 for (
auto &LocDeclEntry : Info.DeclIDs)
3239 FileGroupedDeclIDs.push_back(LocDeclEntry.second);
3242 auto Abbrev = std::make_shared<BitCodeAbbrev>();
3244 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
3245 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
3246 unsigned AbbrevCode = Stream.EmitAbbrev(std::move(Abbrev));
3248 FileGroupedDeclIDs.size()};
3249 Stream.EmitRecordWithBlob(AbbrevCode, Record,
bytes(FileGroupedDeclIDs));
3252 void ASTWriter::WriteComments() {
3254 auto _ = llvm::make_scope_exit([
this] { Stream.ExitBlock(); });
3259 for (
const auto *I : RawComments) {
3261 AddSourceRange(I->getSourceRange(), Record);
3262 Record.push_back(I->getKind());
3263 Record.push_back(I->isTrailingComment());
3264 Record.push_back(I->isAlmostTrailingComment());
3276 class ASTMethodPoolTrait {
3281 using key_type_ref = key_type;
3287 using data_type_ref =
const data_type &;
3289 using hash_value_type = unsigned;
3290 using offset_type = unsigned;
3292 explicit ASTMethodPoolTrait(
ASTWriter &Writer) : Writer(Writer) {}
3298 std::pair<unsigned, unsigned>
3299 EmitKeyDataLength(raw_ostream& Out,
Selector Sel,
3300 data_type_ref Methods) {
3301 using namespace llvm::support;
3303 endian::Writer LE(Out, little);
3305 LE.write<uint16_t>(KeyLen);
3306 unsigned DataLen = 4 + 2 + 2;
3309 if (Method->getMethod())
3313 if (Method->getMethod())
3315 LE.write<uint16_t>(DataLen);
3316 return std::make_pair(KeyLen, DataLen);
3319 void EmitKey(raw_ostream& Out,
Selector Sel,
unsigned) {
3320 using namespace llvm::support;
3322 endian::Writer LE(Out, little);
3323 uint64_t Start = Out.tell();
3324 assert((Start >> 32) == 0 &&
"Selector key offset too large");
3327 LE.write<uint16_t>(N);
3330 for (
unsigned I = 0; I != N; ++I)
3335 void EmitData(raw_ostream& Out, key_type_ref,
3336 data_type_ref Methods,
unsigned DataLen) {
3337 using namespace llvm::support;
3339 endian::Writer LE(Out, little);
3340 uint64_t Start = Out.tell(); (void)Start;
3341 LE.write<uint32_t>(Methods.ID);
3342 unsigned NumInstanceMethods = 0;
3345 if (Method->getMethod())
3346 ++NumInstanceMethods;
3348 unsigned NumFactoryMethods = 0;
3351 if (Method->getMethod())
3352 ++NumFactoryMethods;
3354 unsigned InstanceBits = Methods.Instance.getBits();
3355 assert(InstanceBits < 4);
3356 unsigned InstanceHasMoreThanOneDeclBit =
3357 Methods.Instance.hasMoreThanOneDecl();
3358 unsigned FullInstanceBits = (NumInstanceMethods << 3) |
3359 (InstanceHasMoreThanOneDeclBit << 2) |
3361 unsigned FactoryBits = Methods.Factory.getBits();
3362 assert(FactoryBits < 4);
3363 unsigned FactoryHasMoreThanOneDeclBit =
3364 Methods.Factory.hasMoreThanOneDecl();
3365 unsigned FullFactoryBits = (NumFactoryMethods << 3) |
3366 (FactoryHasMoreThanOneDeclBit << 2) |
3368 LE.write<uint16_t>(FullInstanceBits);
3369 LE.write<uint16_t>(FullFactoryBits);
3372 if (Method->getMethod())
3373 LE.write<uint32_t>(Writer.
getDeclID(Method->getMethod()));
3376 if (Method->getMethod())
3377 LE.write<uint32_t>(Writer.
getDeclID(Method->getMethod()));
3379 assert(Out.tell() - Start == DataLen &&
"Data length is wrong");
3390 void ASTWriter::WriteSelectors(
Sema &SemaRef) {
3391 using namespace llvm;
3394 if (SemaRef.
MethodPool.empty() && SelectorIDs.empty())
3396 unsigned NumTableEntries = 0;
3399 llvm::OnDiskChainedHashTableGenerator<ASTMethodPoolTrait> Generator;
3400 ASTMethodPoolTrait Trait(*
this);
3404 SelectorOffsets.resize(NextSelectorID - FirstSelectorID);
3405 for (
auto &SelectorAndID : SelectorIDs) {
3408 Sema::GlobalMethodPool::iterator F = SemaRef.
MethodPool.find(S);
3409 ASTMethodPoolTrait::data_type Data = {
3415 Data.Instance = F->second.first;
3416 Data.Factory = F->second.second;
3420 if (Chain && ID < FirstSelectorID) {
3422 bool changed =
false;
3424 !changed && M && M->
getMethod(); M = M->getNext()) {
3425 if (!M->getMethod()->isFromASTFile())
3430 if (!M->getMethod()->isFromASTFile())
3435 }
else if (Data.Instance.getMethod() || Data.Factory.getMethod()) {
3439 Generator.insert(S, Data, Trait);
3444 uint32_t BucketOffset;
3446 using namespace llvm::support;
3448 ASTMethodPoolTrait Trait(*
this);
3449 llvm::raw_svector_ostream Out(MethodPool);
3451 endian::write<uint32_t>(Out, 0, little);
3452 BucketOffset = Generator.Emit(Out, Trait);
3456 auto Abbrev = std::make_shared<BitCodeAbbrev>();
3458 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
3459 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
3460 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
3461 unsigned MethodPoolAbbrev = Stream.EmitAbbrev(std::move(Abbrev));
3465 RecordData::value_type Record[] = {
METHOD_POOL, BucketOffset,
3467 Stream.EmitRecordWithBlob(MethodPoolAbbrev, Record, MethodPool);
3471 Abbrev = std::make_shared<BitCodeAbbrev>();
3473 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
3474 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
3475 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
3476 unsigned SelectorOffsetAbbrev = Stream.EmitAbbrev(std::move(Abbrev));
3480 RecordData::value_type Record[] = {
3483 Stream.EmitRecordWithBlob(SelectorOffsetAbbrev, Record,
3484 bytes(SelectorOffsets));
3490 void ASTWriter::WriteReferencedSelectorsPool(
Sema &SemaRef) {
3491 using namespace llvm;
3503 Selector Sel = SelectorAndLocation.first;
3527 for (; Redecl; Redecl = Redecl->getPreviousDecl()) {
3529 if (!Redecl->isFromASTFile()) {
3533 if (!Redecl->getDeclContext()->getRedeclContext()->Equals(
3536 return cast<NamedDecl>(Redecl);
3541 if (Redecl->getOwningModuleID() == 0)
3546 if (!
First->isFromASTFile())
3547 return cast<NamedDecl>(
First);
3557 class ASTIdentifierTableTrait {
3582 using key_type_ref = key_type;
3585 using data_type_ref = data_type;
3587 using hash_value_type = unsigned;
3588 using offset_type = unsigned;
3593 : Writer(Writer), PP(PP), IdResolver(IdResolver), IsModule(IsModule),
3594 NeedDecls(!IsModule || !Writer.
getLangOpts().CPlusPlus),
3595 InterestingIdentifierOffsets(InterestingIdentifierOffsets) {}
3597 bool needDecls()
const {
return NeedDecls; }
3600 return llvm::djbHash(II->
getName());
3612 std::pair<unsigned, unsigned>
3615 unsigned DataLen = 4;
3625 DEnd = IdResolver.
end();
3631 using namespace llvm::support;
3633 endian::Writer LE(Out, little);
3635 assert((uint16_t)DataLen == DataLen && (uint16_t)KeyLen == KeyLen);
3636 LE.write<uint16_t>(DataLen);
3640 LE.write<uint16_t>(KeyLen);
3641 return std::make_pair(KeyLen, DataLen);
3653 InterestingIdentifierOffsets->push_back(Out.tell() - 4);
3660 using namespace llvm::support;
3662 endian::Writer LE(Out, little);
3666 LE.write<uint32_t>(ID << 1);
3670 LE.write<uint32_t>((ID << 1) | 0x01);
3672 assert((Bits & 0xffff) == Bits &&
"ObjCOrBuiltinID too big for ASTReader.");
3673 LE.write<uint16_t>(Bits);
3675 bool HadMacroDefinition = MacroOffset != 0;
3676 Bits = (Bits << 1) |
unsigned(HadMacroDefinition);
3678 Bits = (Bits << 1) |
unsigned(II->
isPoisoned());
3682 LE.write<uint16_t>(Bits);
3684 if (HadMacroDefinition)
3685 LE.write<uint32_t>(MacroOffset);
3697 DEnd = Decls.rend();
3715 using namespace llvm;
3717 RecordData InterestingIdents;
3722 llvm::OnDiskChainedHashTableGenerator<ASTIdentifierTableTrait> Generator;
3723 ASTIdentifierTableTrait Trait(
3724 *
this, PP, IdResolver, IsModule,
3725 (getLangOpts().
CPlusPlus && IsModule) ? &InterestingIdents :
nullptr);
3734 IIs.push_back(
ID.second);
3737 llvm::sort(IIs, llvm::less_ptr<IdentifierInfo>());
3739 if (Trait.isInterestingNonMacroIdentifier(II))
3740 getIdentifierRef(II);
3744 IdentifierOffsets.resize(NextIdentID - FirstIdentID);
3745 for (
auto IdentIDPair : IdentifierIDs) {
3748 assert(II &&
"NULL identifier in identifier table");
3751 if (ID >= FirstIdentID || !Chain || !II->isFromAST()
3752 || II->hasChangedSinceDeserialization() ||
3753 (Trait.needDecls() &&
3754 II->hasFETokenInfoChangedSinceDeserialization()))
3755 Generator.insert(II, ID, Trait);
3760 uint32_t BucketOffset;
3762 using namespace llvm::support;
3764 llvm::raw_svector_ostream Out(IdentifierTable);
3766 endian::write<uint32_t>(Out, 0, little);
3767 BucketOffset = Generator.Emit(Out, Trait);
3771 auto Abbrev = std::make_shared<BitCodeAbbrev>();
3773 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
3774 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
3775 unsigned IDTableAbbrev = Stream.EmitAbbrev(std::move(Abbrev));
3779 Stream.EmitRecordWithBlob(IDTableAbbrev, Record, IdentifierTable);
3783 auto Abbrev = std::make_shared<BitCodeAbbrev>();
3785 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
3786 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
3787 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
3788 unsigned IdentifierOffsetAbbrev = Stream.EmitAbbrev(std::move(Abbrev));
3791 for (
unsigned I = 0, N = IdentifierOffsets.size(); I != N; ++I)
3792 assert(IdentifierOffsets[I] &&
"Missing identifier offset?");
3796 IdentifierOffsets.size(),
3798 Stream.EmitRecordWithBlob(IdentifierOffsetAbbrev, Record,
3799 bytes(IdentifierOffsets));
3803 if (!InterestingIdents.empty())
3814 class ASTDeclContextNameLookupTrait {
3820 using key_type_ref = key_type;
3823 using data_type = std::pair<unsigned, unsigned>;
3824 using data_type_ref =
const data_type &;
3826 using hash_value_type = unsigned;
3827 using offset_type = unsigned;
3829 explicit ASTDeclContextNameLookupTrait(
ASTWriter &Writer) : Writer(Writer) {}
3831 template<
typename Coll>
3832 data_type getData(
const Coll &Decls) {
3833 unsigned Start = DeclIDs.size();
3838 return std::make_pair(Start, DeclIDs.size());
3842 unsigned Start = DeclIDs.size();
3843 for (
auto ID : FromReader)
3844 DeclIDs.push_back(
ID);
3845 return std::make_pair(Start, DeclIDs.size());
3848 static bool EqualKey(key_type_ref a, key_type_ref b) {
3856 void EmitFileRef(raw_ostream &Out,
ModuleFile *F)
const {
3858 "have reference to loaded module file but no chain?");
3860 using namespace llvm::support;
3865 std::pair<unsigned, unsigned> EmitKeyDataLength(raw_ostream &Out,
3867 data_type_ref Lookup) {
3868 using namespace llvm::support;
3870 endian::Writer LE(Out, little);
3871 unsigned KeyLen = 1;
3890 LE.write<uint16_t>(KeyLen);
3893 unsigned DataLen = 4 * (Lookup.second - Lookup.first);
3894 assert(uint16_t(DataLen) == DataLen &&
3895 "too many decls for serialized lookup result");
3896 LE.write<uint16_t>(DataLen);
3898 return std::make_pair(KeyLen, DataLen);
3902 using namespace llvm::support;
3904 endian::Writer LE(Out, little);
3905 LE.write<uint8_t>(Name.
getKind());
3919 "Invalid operator?");
3929 llvm_unreachable(
"Invalid name kind?");
3932 void EmitData(raw_ostream &Out, key_type_ref, data_type Lookup,
3934 using namespace llvm::support;
3936 endian::Writer LE(Out, little);
3937 uint64_t Start = Out.tell(); (void)Start;
3938 for (
unsigned I = Lookup.first, N = Lookup.second; I != N; ++I)
3939 LE.write<uint32_t>(DeclIDs[I]);
3940 assert(Out.tell() - Start == DataLen &&
"Data length is wrong");
3949 DC->hasNeedToReconcileExternalVisibleStorage();
3952 bool ASTWriter::isLookupResultEntirelyExternal(
StoredDeclsList &Result,
3962 ASTWriter::GenerateNameLookupTable(
const DeclContext *ConstDC,
3964 assert(!ConstDC->hasLazyLocalLexicalLookups() &&
3965 !ConstDC->hasLazyExternalLexicalLookups() &&
3966 "must call buildLookups first");
3970 assert(DC == DC->getPrimaryContext() &&
"only primary DC has lookup table");
3974 ASTDeclContextNameLookupTrait> Generator;
3975 ASTDeclContextNameLookupTrait Trait(*
this);
3984 llvm::SmallSet<DeclarationName, 8> ConstructorNameSet, ConversionNameSet;
3986 for (
auto &Lookup : *DC->buildLookup()) {
3987 auto &Name = Lookup.first;
3988 auto &Result = Lookup.second;
3994 if (isLookupResultExternal(Result, DC) &&
3995 isLookupResultEntirelyExternal(Result, DC))
4012 if (Lookup.second.getLookupResult().empty())
4015 switch (Lookup.first.getNameKind()) {
4017 Names.push_back(Lookup.first);
4021 assert(isa<CXXRecordDecl>(DC) &&
4022 "Cannot have a constructor name outside of a class!");
4023 ConstructorNameSet.insert(Name);
4027 assert(isa<CXXRecordDecl>(DC) &&
4028 "Cannot have a conversion function name outside of a class!");
4029 ConversionNameSet.insert(Name);
4037 if (
auto *D = dyn_cast<CXXRecordDecl>(DC)) {
4051 if (ConstructorNameSet.erase(ImplicitCtorName))
4052 Names.push_back(ImplicitCtorName);
4057 if (!ConstructorNameSet.empty() || !ConversionNameSet.empty())
4058 for (
Decl *ChildD : cast<CXXRecordDecl>(DC)->decls())
4059 if (
auto *ChildND = dyn_cast<NamedDecl>(ChildD)) {
4060 auto Name = ChildND->getDeclName();
4061 switch (Name.getNameKind()) {
4066 if (ConstructorNameSet.erase(Name))
4067 Names.push_back(Name);
4071 if (ConversionNameSet.erase(Name))
4072 Names.push_back(Name);
4076 if (ConstructorNameSet.empty() && ConversionNameSet.empty())
4080 assert(ConstructorNameSet.empty() &&
"Failed to find all of the visible " 4081 "constructors by walking all the " 4082 "lexical members of the context.");
4083 assert(ConversionNameSet.empty() &&
"Failed to find all of the visible " 4084 "conversion functions by walking all " 4085 "the lexical members of the context.");
4092 for (
auto &Name : Names)
4104 for (
auto &Name : Names) {
4107 switch (Name.getNameKind()) {
4109 Generator.insert(Name, Trait.getData(Result), Trait);
4113 ConstructorDecls.append(Result.
begin(), Result.
end());
4117 ConversionDecls.append(Result.
begin(), Result.
end());
4125 if (!ConstructorDecls.empty())
4126 Generator.insert(ConstructorDecls.front()->getDeclName(),
4127 Trait.getData(ConstructorDecls), Trait);
4128 if (!ConversionDecls.empty())
4129 Generator.insert(ConversionDecls.front()->getDeclName(),
4130 Trait.getData(ConversionDecls), Trait);
4134 auto *Lookups = Chain ? Chain->getLoadedLookupTables(DC) :
nullptr;
4135 Generator.emit(LookupTable, Trait, Lookups ? &Lookups->Table :
nullptr);
4143 uint64_t ASTWriter::WriteDeclContextVisibleBlock(
ASTContext &Context,
4148 if (isa<NamespaceDecl>(DC) && Chain &&
4149 Chain->getKeyDeclaration(cast<Decl>(DC))->isFromASTFile()) {
4151 for (
auto *Prev = cast<NamespaceDecl>(DC)->getPreviousDecl(); Prev;
4152 Prev = Prev->getPreviousDecl())
4153 if (!Prev->isFromASTFile())
4166 LookupResults.reserve(Map->size());
4167 for (
auto &Entry : *Map)
4168 LookupResults.push_back(
4169 std::make_pair(Entry.first, Entry.second.getLookupResult()));
4172 llvm::sort(LookupResults, llvm::less_first());
4173 for (
auto &NameAndResult : LookupResults) {
4181 assert(Result.
empty() &&
"Cannot have a constructor or conversion " 4182 "function name in a namespace!");
4187 if (!ND->isFromASTFile())
4211 uint64_t
Offset = Stream.GetCurrentBitNo();
4213 if (!Map || Map->empty())
4218 GenerateNameLookupTable(DC, LookupTable);
4222 Stream.EmitRecordWithBlob(DeclContextVisibleLookupAbbrev, Record,
4224 ++NumVisibleDeclContexts;
4234 void ASTWriter::WriteDeclContextVisibleUpdate(
const DeclContext *DC) {
4236 if (!Map || Map->empty())
4241 GenerateNameLookupTable(DC, LookupTable);
4245 if (isa<NamespaceDecl>(DC))
4246 DC = cast<DeclContext>(Chain->getKeyDeclaration(cast<Decl>(DC)));
4249 RecordData::value_type Record[] = {
UPDATE_VISIBLE, getDeclID(cast<Decl>(DC))};
4250 Stream.EmitRecordWithBlob(UpdateVisibleAbbrev, Record, LookupTable);
4254 void ASTWriter::WriteFPPragmaOptions(
const FPOptions &Opts) {
4255 RecordData::value_type Record[] = {Opts.
getInt()};
4260 void ASTWriter::WriteOpenCLExtensions(
Sema &SemaRef) {
4266 for (
const auto &I:Opts.OptMap) {
4267 AddString(I.getKey(), Record);
4268 auto V = I.getValue();
4269 Record.push_back(V.Supported ? 1 : 0);
4270 Record.push_back(V.Enabled ? 1 : 0);
4271 Record.push_back(V.Avail);
4272 Record.push_back(V.Core);
4277 void ASTWriter::WriteOpenCLExtensionTypes(
Sema &SemaRef) {
4282 for (
const auto &I : SemaRef.OpenCLTypeExtMap) {
4284 static_cast<unsigned>(getTypeID(I.first->getCanonicalTypeInternal())));
4285 Record.push_back(I.second.size());
4286 for (
auto Ext : I.second)
4287 AddString(Ext, Record);
4292 void ASTWriter::WriteOpenCLExtensionDecls(
Sema &SemaRef) {
4297 for (
const auto &I : SemaRef.OpenCLDeclExtMap) {
4298 Record.push_back(getDeclID(I.first));
4299 Record.push_back(static_cast<unsigned>(I.second.size()));
4300 for (
auto Ext : I.second)
4301 AddString(Ext, Record);
4306 void ASTWriter::WriteCUDAPragmas(
Sema &SemaRef) {
4307 if (SemaRef.ForceCUDAHostDeviceDepth > 0) {
4308 RecordData::value_type Record[] = {SemaRef.ForceCUDAHostDeviceDepth};
4313 void ASTWriter::WriteObjCCategories() {
4315 RecordData Categories;
4317 for (
unsigned I = 0, N = ObjCClassesWithCategories.size(); I != N; ++I) {
4319 unsigned StartIndex = Categories.size();
4324 Categories.push_back(0);
4330 Cat != CatEnd; ++Cat, ++Size) {
4331 assert(getDeclID(*Cat) != 0 &&
"Bogus category");
4332 AddDeclRef(*Cat, Categories);
4336 Categories[StartIndex] = Size;
4340 CategoriesMap.push_back(CatInfo);
4345 llvm::array_pod_sort(CategoriesMap.begin(), CategoriesMap.end());
4348 using namespace llvm;
4350 auto Abbrev = std::make_shared<BitCodeAbbrev>();
4352 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
4353 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
4354 unsigned AbbrevID = Stream.EmitAbbrev(std::move(Abbrev));
4357 Stream.EmitRecordWithBlob(AbbrevID, Record,
4358 reinterpret_cast<char *>(CategoriesMap.data()),
4365 void ASTWriter::WriteLateParsedTemplates(
Sema &SemaRef) {
4372 for (
auto &LPTMapEntry : LPTMap) {
4375 AddDeclRef(FD, Record);
4376 AddDeclRef(LPT.
D, Record);
4377 Record.push_back(LPT.
Toks.size());
4379 for (
const auto &
Tok : LPT.
Toks) {
4380 AddToken(
Tok, Record);
4387 void ASTWriter::WriteOptimizePragmaOptions(
Sema &SemaRef) {
4390 AddSourceLocation(PragmaLoc, Record);
4395 void ASTWriter::WriteMSStructPragmaOptions(
Sema &SemaRef) {
4403 void ASTWriter::WriteMSPointersToMembersPragmaOptions(
Sema &SemaRef) {
4411 void ASTWriter::WritePackPragmaOptions(
Sema &SemaRef) {
4422 Record.push_back(StackEntry.Value);
4423 AddSourceLocation(StackEntry.PragmaLocation, Record);
4424 AddSourceLocation(StackEntry.PragmaPushLocation, Record);
4425 AddString(StackEntry.StackSlotLabel, Record);
4430 void ASTWriter::WriteModuleFileExtension(
Sema &SemaRef,
4436 auto Abv = std::make_shared<llvm::BitCodeAbbrev>();
4438 Abv->Add(llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::VBR, 6));
4439 Abv->Add(llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::VBR, 6));
4440 Abv->Add(llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::VBR, 6));
4441 Abv->Add(llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::VBR, 6));
4442 Abv->Add(llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::Blob));
4443 unsigned Abbrev = Stream.EmitAbbrev(std::move(Abv));
4449 Record.push_back(Metadata.MajorVersion);
4450 Record.push_back(Metadata.MinorVersion);
4451 Record.push_back(Metadata.BlockName.size());
4452 Record.push_back(Metadata.UserInfo.size());
4454 Buffer += Metadata.BlockName;
4455 Buffer += Metadata.UserInfo;
4456 Stream.EmitRecordWithBlob(Abbrev, Record, Buffer);
4470 auto &Record = *
this;
4472 return Record.push_back(0);
4473 Record.push_back(A->
getKind() + 1);
4474 Record.AddSourceRange(A->
getRange());
4476 #include "clang/Serialization/AttrPCHWrite.inc" 4481 push_back(Attrs.size());
4482 for (
const auto *A : Attrs)
4494 Record.push_back(Tok.
getKind());
4500 Record.push_back(Str.size());
4501 Record.insert(Record.end(), Str.begin(), Str.end());
4505 assert(Context &&
"should have context when outputting path");
4511 const char *PathBegin = Path.data();
4512 const char *PathPtr =
4514 if (PathPtr != PathBegin) {
4515 Path.erase(Path.begin(), Path.begin() + (PathPtr - PathBegin));
4524 PreparePathForOutput(FilePath);
4525 AddString(FilePath, Record);
4531 PreparePathForOutput(FilePath);
4532 Stream.EmitRecordWithBlob(Abbrev, Record, FilePath);
4537 Record.push_back(Version.getMajor());
4539 Record.push_back(*Minor + 1);
4541 Record.push_back(0);
4543 Record.push_back(*Subminor + 1);
4545 Record.push_back(0);
4554 if (ID >= FirstIdentID)
4555 IdentifierOffsets[ID - FirstIdentID] =
Offset;
4561 unsigned ID = SelectorIDs[Sel];
4562 assert(ID &&
"Unknown selector");
4565 if (ID < FirstSelectorID)
4567 SelectorOffsets[ID - FirstSelectorID] =
Offset;
4572 ArrayRef<std::shared_ptr<ModuleFileExtension>> Extensions,
4573 bool IncludeTimestamps)
4574 : Stream(Stream), Buffer(Buffer), PCMCache(PCMCache),
4575 IncludeTimestamps(IncludeTimestamps) {
4576 for (
const auto &Ext : Extensions) {
4577 if (
auto Writer = Ext->createExtensionWriter(*
this))
4578 ModuleFileExtensionWriters.push_back(std::move(Writer));
4583 llvm::DeleteContainerSeconds(FileDeclIDs);
4587 assert(WritingAST &&
"can't determine lang opts when not writing AST");
4596 const std::string &OutputFile,
4597 Module *WritingModule, StringRef isysroot,
4601 ASTHasCompilerErrors = hasErrors;
4604 Stream.Emit((
unsigned)
'C', 8);
4605 Stream.Emit((
unsigned)
'P', 8);
4606 Stream.Emit((
unsigned)
'C', 8);
4607 Stream.Emit((
unsigned)
'H', 8);
4609 WriteBlockInfoBlock();
4613 this->WritingModule = WritingModule;
4615 WriteASTCore(SemaRef, isysroot, OutputFile, WritingModule);
4618 this->WritingModule =
nullptr;
4619 this->BaseDirectory.clear();
4625 llvm::MemoryBuffer::getMemBufferCopy(
4626 StringRef(Buffer.begin(), Buffer.size())));
4631 template<
typename Vector>
4634 for (
typename Vector::iterator I = Vec.begin(
nullptr,
true), E = Vec.end();
4641 const std::string &OutputFile,
4643 using namespace llvm;
4645 bool isModule = WritingModule !=
nullptr;
4649 Chain->finalizeForWriting();
4666 RegisterPredefDecl(Context.ObjCProtocolClassDecl,
4670 RegisterPredefDecl(Context.ObjCInstanceTypeDecl,
4674 RegisterPredefDecl(Context.BuiltinMSVaListDecl,
4677 RegisterPredefDecl(Context.MakeIntegerSeqDecl,
4679 RegisterPredefDecl(Context.CFConstantStringTypeDecl,
4681 RegisterPredefDecl(Context.CFConstantStringTagDecl,
4683 RegisterPredefDecl(Context.TypePackElementDecl,
4696 UnusedFileScopedDecls);
4710 WeakInfo &WI = WeakUndeclaredIdentifier.second;
4714 WeakUndeclaredIdentifiers.push_back(WI.
getUsed());
4724 for (
unsigned I = 0, N = SemaRef.
VTableUses.size(); I != N; ++I) {
4734 AddDeclRef(TD, UnusedLocalTypedefNameCandidates);
4743 "There are local ones at end of translation unit!");
4760 for (
const auto &I : SemaRef.KnownNamespaces) {
4770 for (
const auto &I : Undefined) {
4780 for (
const auto &DeleteExprsInfo :
4782 AddDeclRef(DeleteExprsInfo.first, DeleteExprsToAnalyze);
4783 DeleteExprsToAnalyze.push_back(DeleteExprsInfo.second.size());
4784 for (
const auto &DeleteLoc : DeleteExprsInfo.second) {
4786 DeleteExprsToAnalyze.push_back(DeleteLoc.second);
4792 WriteControlBlock(PP, Context, isysroot, OutputFile);
4810 NewGlobalKindDeclPairs.push_back(D->
getKind());
4811 NewGlobalKindDeclPairs.push_back(
GetDeclRef(D));
4815 auto Abv = std::make_shared<BitCodeAbbrev>();
4817 Abv->Add(llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::Blob));
4818 unsigned TuUpdateLexicalAbbrev = Stream.EmitAbbrev(std::move(Abv));
4821 Stream.EmitRecordWithBlob(TuUpdateLexicalAbbrev, Record,
4822 bytes(NewGlobalKindDeclPairs));
4826 Abv = std::make_shared<BitCodeAbbrev>();
4828 Abv->Add(llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::VBR, 6));
4829 Abv->Add(llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::Blob));
4830 UpdateVisibleAbbrev = Stream.EmitAbbrev(std::move(Abv));
4831 WriteDeclContextVisibleUpdate(TU);
4834 if (Context.ExternCContext)
4835 WriteDeclContextVisibleUpdate(Context.ExternCContext);
4849 for (
const auto &Number : Context.MangleNumbers)
4850 if (!Number.first->isFromASTFile())
4853 for (
const auto &Number : Context.StaticLocalNumbers)
4854 if (!Number.first->isFromASTFile())
4861 for (
const auto *I : DeclsToEmitEvenIfUnreferenced) {
4875 llvm::sort(IIs, llvm::less_ptr<IdentifierInfo>());
4893 for (
auto &SelectorAndID : SelectorIDs)
4894 AllSelectors.push_back(SelectorAndID.first);
4895 for (
auto &
Selector : AllSelectors)
4904 AddTypeRef(Context.ObjCIdRedefinitionType, SpecialTypes);
4905 AddTypeRef(Context.ObjCClassRedefinitionType, SpecialTypes);
4906 AddTypeRef(Context.ObjCSelRedefinitionType, SpecialTypes);
4929 auto Abbrev = std::make_shared<BitCodeAbbrev>();
4931 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
4932 unsigned ModuleOffsetMapAbbrev = Stream.EmitAbbrev(std::move(Abbrev));
4935 llvm::raw_svector_ostream Out(Buffer);
4937 using namespace llvm::support;
4939 endian::Writer LE(Out, little);
4940 LE.write<uint8_t>(
static_cast<uint8_t
>(M.
Kind));
4945 LE.write<uint16_t>(Name.size());
4946 Out.write(Name.data(), Name.size());
4952 auto writeBaseIDOrNone = [&](uint32_t BaseID,
bool ShouldWrite) {
4955 LE.write<uint32_t>(BaseID);
4957 LE.write<uint32_t>(
None);
4974 Stream.EmitRecordWithBlob(ModuleOffsetMapAbbrev, Record,
4975 Buffer.data(), Buffer.size());
4986 WriteDeclUpdatesBlocks(DeclUpdatesOffsetsRecord);
4987 while (!DeclTypesToEmit.empty()) {
4988 DeclOrType DOT = DeclTypesToEmit.front();
4989 DeclTypesToEmit.pop();
4991 WriteType(DOT.getType());
4993 WriteDecl(Context, DOT.getDecl());
4995 }
while (!DeclUpdates.empty());
4998 DoneWritingDeclsAndTypes =
true;
5001 WriteTypeDeclOffsets();
5002 if (!DeclUpdatesOffsetsRecord.empty())
5004 WriteFileDeclIDsMap();
5007 WritePreprocessor(PP, isModule);
5009 WriteSelectors(SemaRef);
5010 WriteReferencedSelectorsPool(SemaRef);
5011 WriteLateParsedTemplates(SemaRef);
5012 WriteIdentifierTable(PP, SemaRef.
IdResolver, isModule);
5014 WriteOpenCLExtensions(SemaRef);
5015 WriteOpenCLExtensionTypes(SemaRef);
5016 WriteCUDAPragmas(SemaRef);
5020 WriteSubmodules(WritingModule);
5024 WriteOpenCLExtensionDecls(SemaRef);
5029 if (!EagerlyDeserializedDecls.empty())
5032 if (!ModularCodegenDecls.empty())
5036 if (!TentativeDefinitions.empty())
5040 if (!UnusedFileScopedDecls.empty())
5044 if (!WeakUndeclaredIdentifiers.empty())
5046 WeakUndeclaredIdentifiers);
5049 if (!ExtVectorDecls.empty())
5053 if (!VTableUses.empty())
5057 if (!UnusedLocalTypedefNameCandidates.empty())
5059 UnusedLocalTypedefNameCandidates);
5062 if (!PendingInstantiations.empty())
5066 if (!SemaDeclRefs.empty())
5070 if (!CUDASpecialDeclRefs.empty())
5074 if (!DelegatingCtorDecls.empty())
5078 if (!KnownNamespaces.empty())
5082 if (!UndefinedButUsed.empty())
5085 if (!DeleteExprsToAnalyze.empty())
5089 for (
auto *DC : UpdatedDeclContexts)
5090 WriteDeclContextVisibleUpdate(DC);
5092 if (!WritingModule) {
5097 ModuleInfo(uint64_t ID,
Module *M) :
ID(ID), M(M) {}
5101 assert(SubmoduleIDs.find(I->getImportedModule()) != SubmoduleIDs.end());
5102 Imports.push_back(ModuleInfo(SubmoduleIDs[I->getImportedModule()],
5103 I->getImportedModule()));
5106 if (!Imports.empty()) {
5107 auto Cmp = [](
const ModuleInfo &A,
const ModuleInfo &B) {
5110 auto Eq = [](
const ModuleInfo &A,
const ModuleInfo &B) {
5111 return A.ID == B.ID;
5115 llvm::sort(Imports, Cmp);
5116 Imports.erase(std::unique(Imports.begin(), Imports.end(), Eq),
5120 for (
const auto &Import : Imports) {
5121 ImportedModules.push_back(Import.ID);
5132 WriteObjCCategories();
5133 if(!WritingModule) {
5134 WriteOptimizePragmaOptions(SemaRef);
5135 WriteMSStructPragmaOptions(SemaRef);
5136 WriteMSPointersToMembersPragmaOptions(SemaRef);
5138 WritePackPragmaOptions(SemaRef);
5141 RecordData::value_type Record[] = {
5142 NumStatements, NumMacros, NumLexicalDeclContexts, NumVisibleDeclContexts};
5147 for (
const auto &ExtWriter : ModuleFileExtensionWriters)
5148 WriteModuleFileExtension(SemaRef, *ExtWriter);
5150 return writeUnhashedControlBlock(PP, Context);
5153 void ASTWriter::WriteDeclUpdatesBlocks(
RecordDataImpl &OffsetsRecord) {
5154 if (DeclUpdates.empty())
5157 DeclUpdateMap LocalUpdates;
5158 LocalUpdates.swap(DeclUpdates);
5160 for (
auto &DeclUpdate : LocalUpdates) {
5161 const Decl *D = DeclUpdate.first;
5163 bool HasUpdatedBody =
false;
5166 for (
auto &
Update : DeclUpdate.second) {
5172 HasUpdatedBody =
true;
5180 assert(
Update.getDecl() &&
"no decl to add?");
5193 const VarDecl *VD = cast<VarDecl>(D);
5207 Record.
AddStmt(const_cast<Expr *>(
5208 cast<ParmVarDecl>(
Update.getDecl())->getDefaultArg()));
5213 cast<FieldDecl>(
Update.getDecl())->getInClassInitializer());
5217 auto *RD = cast<CXXRecordDecl>(D);
5218 UpdatedDeclContexts.insert(RD->getPrimaryContext());
5219 Record.
push_back(RD->isParamDestroyedInCallee());
5220 Record.
push_back(RD->getArgPassingRestrictions());
5222 Record.
AddOffset(WriteDeclContextLexicalBlock(
5223 *Context, const_cast<CXXRecordDecl *>(RD)));
5228 if (
auto *MSInfo = RD->getMemberSpecializationInfo()) {
5229 Record.
push_back(MSInfo->getTemplateSpecializationKind());
5232 auto *Spec = cast<ClassTemplateSpecializationDecl>(RD);
5233 Record.
push_back(Spec->getTemplateSpecializationKind());
5238 auto From = Spec->getInstantiatedFrom();
5239 if (
auto PartialSpec =
5244 &Spec->getTemplateInstantiationArgs());
5265 Record.
AddStmt(cast<CXXDestructorDecl>(D)->getOperatorDeleteThisArg());
5270 cast<FunctionDecl>(D)->getType()->castAs<FunctionProtoType>(),
5288 D->
getAttr<OMPThreadPrivateDeclAttr>()->getRange());
5294 D->
getAttr<OMPDeclareTargetDeclAttr>()->getRange());
5307 if (HasUpdatedBody) {
5308 const auto *Def = cast<FunctionDecl>(D);
5322 Record.push_back((Raw << 1) | (Raw >> 31));
5331 Record->push_back(Value.getBitWidth());
5332 const uint64_t *Words = Value.getRawData();
5333 Record->append(Words, Words + Value.getNumWords());
5337 Record->push_back(Value.isUnsigned());
5342 AddAPInt(Value.bitcastToAPInt());
5369 MacroInfoToEmitData Info = { Name, MI, ID };
5370 MacroInfosToEmit.push_back(Info);
5379 assert(MacroIDs.find(MI) != MacroIDs.end() &&
"Macro not emitted!");
5380 return MacroIDs[MI];
5384 return IdentMacroDirectivesOffsetMap.lookup(Name);
5388 Record->push_back(Writer->getSelectorRef(SelRef));
5397 if (SID == 0 && Chain) {
5400 Chain->LoadSelector(Sel);
5401 SID = SelectorIDs[Sel];
5404 SID = NextSelectorID++;
5405 SelectorIDs[Sel] = SID;
5446 bool InfoHasSameExpr
5448 Record->push_back(InfoHasSameExpr);
5449 if (InfoHasSameExpr)
5466 TypeLocWriter TLW(*
this);
5483 if (Idx.getIndex() == 0) {
5484 if (DoneWritingDeclsAndTypes) {
5485 assert(0 &&
"New type seen after serializing all the types to emit!");
5492 DeclTypesToEmit.push(T);
5505 TypeIdxMap::const_iterator I = TypeIdxs.find(T);
5506 assert(I != TypeIdxs.end() &&
"Type not emitted!");
5516 assert(WritingAST &&
"Cannot request a declaration ID before AST writing");
5527 assert(!(reinterpret_cast<uintptr_t>(D) & 0x01) &&
"Invalid decl pointer");
5530 if (DoneWritingDeclsAndTypes) {
5531 assert(0 &&
"New decl seen after serializing all the decls to emit!");
5538 DeclTypesToEmit.push(const_cast<Decl *>(D));
5553 assert(DeclIDs.find(D) != DeclIDs.end() &&
"Declaration not emitted!");
5557 void ASTWriter::associateDeclWithFile(
const Decl *D,
DeclID ID) {
5572 if (isa<ParmVarDecl>(D) || isa<TemplateTemplateParmDecl>(D))
5581 if (FID.isInvalid())
5585 DeclIDInFileInfo *&Info = FileDeclIDs[FID];
5587 Info =
new DeclIDInFileInfo();
5589 std::pair<unsigned, serialization::DeclID> LocDecl(Offset, ID);
5592 if (Decls.empty() || Decls.back().first <=
Offset) {
5593 Decls.push_back(LocDecl);
5597 LocDeclIDsTy::iterator I =
5598 std::upper_bound(Decls.begin(), Decls.end(), LocDecl, llvm::less_first());
5600 Decls.insert(I, LocDecl);
5643 "expected an anonymous declaration");
5647 auto It = AnonymousDeclarationNumbers.find(D);
5648 if (It == AnonymousDeclarationNumbers.end()) {
5651 AnonymousDeclarationNumbers[ND] = Number;
5654 It = AnonymousDeclarationNumbers.find(D);
5655 assert(It != AnonymousDeclarationNumbers.end() &&
5656 "declaration not found within its lexical context");
5695 AddDeclarationName(NameInfo.
getName());
5714 NestedNames.push_back(NNS);
5718 Record->push_back(NestedNames.size());
5719 while(!NestedNames.empty()) {
5720 NNS = NestedNames.pop_back_val();
5722 Record->push_back(Kind);
5761 NestedNames.push_back(NNS);
5765 Record->push_back(NestedNames.size());
5766 while(!NestedNames.empty()) {
5767 NNS = NestedNames.pop_back_val();
5770 Record->push_back(Kind);
5809 Record->push_back(Kind);
5817 Record->push_back(OvT->
size());
5818 for (
const auto &I : *OvT)
5861 Record->push_back(Arg.
getKind());
5885 Record->push_back(*NumExpansions + 1);
5887 Record->push_back(0);
5895 AddTemplateArgument(
P);
5902 assert(TemplateParams &&
"No TemplateParams!");
5907 Record->push_back(TemplateParams->
size());
5908 for (
const auto &
P : *TemplateParams)
5915 assert(TemplateArgs &&
"No TemplateArgs!");
5916 Record->push_back(TemplateArgs->
size());
5917 for (
int i = 0, e = TemplateArgs->
size(); i != e; ++i)
5918 AddTemplateArgument(TemplateArgs->
get(i));
5923 assert(ASTTemplArgList &&
"No ASTTemplArgList!");
5929 AddTemplateArgumentLoc(TemplArgs[i]);
5933 Record->push_back(Set.
size());
5935 I = Set.
begin(), E = Set.
end(); I != E; ++I) {
5937 Record->push_back(I.getAccess());
5959 for (
auto &
Base : Bases)
5977 for (
auto *Init : CtorInits) {
5978 if (Init->isBaseInitializer()) {
5981 Writer.
push_back(Init->isBaseVirtual());
5982 }
else if (Init->isDelegatingInitializer()) {
5985 }
else if (Init->isMemberInitializer()){
5990 Writer.
AddDeclRef(Init->getIndirectMember());
5994 Writer.
AddStmt(Init->getInit());
5998 if (Init->isWritten())
5999 Writer.
push_back(Init->getSourceOrder());
6012 auto &Data = D->data();
6013 Record->push_back(Data.IsLambda);
6014 Record->push_back(Data.UserDeclaredConstructor);
6015 Record->push_back(Data.UserDeclaredSpecialMembers);
6016 Record->push_back(Data.Aggregate);
6017 Record->push_back(Data.PlainOldData);
6018 Record->push_back(Data.Empty);
6019 Record->push_back(Data.Polymorphic);
6020 Record->push_back(Data.Abstract);
6021 Record->push_back(Data.IsStandardLayout);
6022 Record->push_back(Data.IsCXX11StandardLayout);
6023 Record->push_back(Data.HasBasesWithFields);
6024 Record->push_back(Data.HasBasesWithNonStaticDataMembers);
6025 Record->push_back(Data.HasPrivateFields);
6026 Record->push_back(Data.HasProtectedFields);
6027 Record->push_back(Data.HasPublicFields);
6028 Record->push_back(Data.HasMutableFields);
6029 Record->push_back(Data.HasVariantMembers);
6030 Record->push_back(Data.HasOnlyCMembers);
6031 Record->push_back(Data.HasInClassInitializer);
6032 Record->push_back(Data.HasUninitializedReferenceMember);
6033 Record->push_back(Data.HasUninitializedFields);
6034 Record->push_back(Data.HasInheritedConstructor);
6035 Record->push_back(Data.HasInheritedAssignment);
6036 Record->push_back(Data.NeedOverloadResolutionForCopyConstructor);
6037 Record->push_back(Data.NeedOverloadResolutionForMoveConstructor);
6038 Record->push_back(Data.NeedOverloadResolutionForMoveAssignment);
6039 Record->push_back(Data.NeedOverloadResolutionForDestructor);
6040 Record->push_back(Data.DefaultedCopyConstructorIsDeleted);
6041 Record->push_back(Data.DefaultedMoveConstructorIsDeleted);
6042 Record->push_back(Data.DefaultedMoveAssignmentIsDeleted);
6043 Record->push_back(Data.DefaultedDestructorIsDeleted);
6044 Record->push_back(Data.HasTrivialSpecialMembers);
6045 Record->push_back(Data.HasTrivialSpecialMembersForCall);
6046 Record->push_back(Data.DeclaredNonTrivialSpecialMembers);
6047 Record->push_back(Data.DeclaredNonTrivialSpecialMembersForCall);
6048 Record->push_back(Data.HasIrrelevantDestructor);
6049 Record->push_back(Data.HasConstexprNonCopyMoveConstructor);
6050 Record->push_back(Data.HasDefaultedDefaultConstructor);
6051 Record->push_back(Data.DefaultedDefaultConstructorIsConstexpr);
6052 Record->push_back(Data.HasConstexprDefaultConstructor);
6053 Record->push_back(Data.HasNonLiteralTypeFieldsOrBases);
6054 Record->push_back(Data.ComputedVisibleConversions);
6055 Record->push_back(Data.UserProvidedDefaultConstructor);
6056 Record->push_back(Data.DeclaredSpecialMembers);
6057 Record->push_back(Data.ImplicitCopyConstructorCanHaveConstParamForVBase);
6058 Record->push_back(Data.ImplicitCopyConstructorCanHaveConstParamForNonVBase);
6059 Record->push_back(Data.ImplicitCopyAssignmentHasConstParam);
6060 Record->push_back(Data.HasDeclaredCopyConstructorWithConstParam);
6061 Record->push_back(Data.HasDeclaredCopyAssignmentWithConstParam);
6065 bool ModulesDebugInfo = Writer->Context->getLangOpts().ModulesDebugInfo &&
6067 Record->push_back(ModulesDebugInfo);
6068 if (ModulesDebugInfo)
6069 Writer->ModularCodegenDecls.push_back(Writer->GetDeclRef(D));
6073 Record->push_back(Data.NumBases);
6074 if (Data.NumBases > 0)
6075 AddCXXBaseSpecifiers(Data.bases());
6078 Record->push_back(Data.NumVBases);
6079 if (Data.NumVBases > 0)
6080 AddCXXBaseSpecifiers(Data.vbases());
6082 AddUnresolvedSet(Data.Conversions.get(*Writer->Context));
6083 AddUnresolvedSet(Data.VisibleConversions.get(*Writer->Context));
6088 if (Data.IsLambda) {
6089 auto &Lambda = D->getLambdaData();
6090 Record->push_back(Lambda.Dependent);
6091 Record->push_back(Lambda.IsGenericLambda);
6092 Record->push_back(Lambda.CaptureDefault);
6093 Record->push_back(Lambda.NumCaptures);
6094 Record->push_back(Lambda.NumExplicitCaptures);
6095 Record->push_back(Lambda.ManglingNumber);
6097 AddTypeSourceInfo(Lambda.MethodTyInfo);
6098 for (
unsigned I = 0, N = Lambda.NumCaptures; I != N; ++I) {
6121 void ASTWriter::ReaderInitialized(
ASTReader *Reader) {
6122 assert(Reader &&
"Cannot remove chain");
6123 assert((!Chain || Chain == Reader) &&
"Cannot replace chain");
6124 assert(FirstDeclID == NextDeclID &&
6125 FirstTypeID == NextTypeID &&
6126 FirstIdentID == NextIdentID &&
6127 FirstMacroID == NextMacroID &&
6128 FirstSubmoduleID == NextSubmoduleID &&
6129 FirstSelectorID == NextSelectorID &&
6130 "Setting chain after writing has started.");
6142 NextDeclID = FirstDeclID;
6143 NextTypeID = FirstTypeID;
6144 NextIdentID = FirstIdentID;
6145 NextMacroID = FirstMacroID;
6146 NextSelectorID = FirstSelectorID;
6147 NextSubmoduleID = FirstSubmoduleID;
6152 IdentID &StoredID = IdentifierIDs[II];
6159 MacroID &StoredID = MacroIDs[MI];
6170 TypeIdx &StoredIdx = TypeIdxs[T];
6184 assert(MacroDefinitions.find(MD) == MacroDefinitions.end());
6185 MacroDefinitions[MD] =
ID;
6189 assert(SubmoduleIDs.find(Mod) == SubmoduleIDs.end());
6190 SubmoduleIDs[Mod] =
ID;
6193 void ASTWriter::CompletedTagDefinition(
const TagDecl *D) {
6194 if (Chain && Chain->isProcessingUpdateRecords())
return;
6196 assert(!WritingAST &&
"Already writing the AST!");
6197 if (
auto *RD = dyn_cast<CXXRecordDecl>(D)) {
6199 if (RD->isFromASTFile()) {
6204 "completed a tag from another module but not by instantiation?");
6205 DeclUpdates[RD].push_back(
6220 void ASTWriter::AddedVisibleDecl(
const DeclContext *DC,
const Decl *D) {
6221 if (Chain && Chain->isProcessingUpdateRecords())
return;
6223 "Should not add lookup results to non-lookup contexts!");
6226 if (isa<TranslationUnitDecl>(DC))
6234 !isa<FunctionTemplateDecl>(D))
6244 assert(!WritingAST &&
"Already writing the AST!");
6245 if (UpdatedDeclContexts.insert(DC) && !cast<Decl>(DC)->isFromASTFile()) {
6249 for (
auto *Child : DC->
decls())
6250 DeclsToEmitEvenIfUnreferenced.push_back(Child);
6252 DeclsToEmitEvenIfUnreferenced.push_back(D);
6255 void ASTWriter::AddedCXXImplicitMember(
const CXXRecordDecl *RD,
const Decl *D) {
6256 if (Chain && Chain->isProcessingUpdateRecords())
return;
6264 if (!isa<CXXMethodDecl>(D))
6269 assert(!WritingAST &&
"Already writing the AST!");
6273 void ASTWriter::ResolvedExceptionSpec(
const FunctionDecl *FD) {
6274 if (Chain && Chain->isProcessingUpdateRecords())
return;
6275 assert(!DoneWritingDeclsAndTypes &&
"Already done writing updates!");
6277 Chain->forEachImportedKeyDecl(FD, [&](
const Decl *D) {
6282 ->castAs<FunctionProtoType>()
6283 ->getExceptionSpecType()))
6289 if (Chain && Chain->isProcessingUpdateRecords())
return;
6290 assert(!WritingAST &&
"Already writing the AST!");
6292 Chain->forEachImportedKeyDecl(FD, [&](
const Decl *D) {
6293 DeclUpdates[D].push_back(
6301 if (Chain && Chain->isProcessingUpdateRecords())
return;
6302 assert(!WritingAST &&
"Already writing the AST!");
6303 assert(Delete &&
"Not given an operator delete");
6305 Chain->forEachImportedKeyDecl(DD, [&](
const Decl *D) {
6310 void ASTWriter::CompletedImplicitDefinition(
const FunctionDecl *D) {
6311 if (Chain && Chain->isProcessingUpdateRecords())
return;
6312 assert(!WritingAST &&
"Already writing the AST!");
6320 void ASTWriter::VariableDefinitionInstantiated(
const VarDecl *D) {
6321 if (Chain && Chain->isProcessingUpdateRecords())
return;
6322 assert(!WritingAST &&
"Already writing the AST!");
6329 void ASTWriter::FunctionDefinitionInstantiated(
const FunctionDecl *D) {
6330 if (Chain && Chain->isProcessingUpdateRecords())
return;
6331 assert(!WritingAST &&
"Already writing the AST!");
6338 void ASTWriter::InstantiationRequested(
const ValueDecl *D) {
6339 if (Chain && Chain->isProcessingUpdateRecords())
return;
6340 assert(!WritingAST &&
"Already writing the AST!");
6347 if (
auto *VD = dyn_cast<VarDecl>(D))
6348 POI = VD->getPointOfInstantiation();
6350 POI = cast<FunctionDecl>(D)->getPointOfInstantiation();
6354 void ASTWriter::DefaultArgumentInstantiated(
const ParmVarDecl *D) {
6355 if (Chain && Chain->isProcessingUpdateRecords())
return;
6356 assert(!WritingAST &&
"Already writing the AST!");
6360 DeclUpdates[D].push_back(
6364 void ASTWriter::DefaultMemberInitializerInstantiated(
const FieldDecl *D) {
6365 assert(!WritingAST &&
"Already writing the AST!");
6369 DeclUpdates[D].push_back(
6375 if (Chain && Chain->isProcessingUpdateRecords())
return;
6376 assert(!WritingAST &&
"Already writing the AST!");
6380 assert(IFD->
getDefinition() &&
"Category on a class without a definition?");
6381 ObjCClassesWithCategories.insert(
6385 void ASTWriter::DeclarationMarkedUsed(
const Decl *D) {
6386 if (Chain && Chain->isProcessingUpdateRecords())
return;
6387 assert(!WritingAST &&
"Already writing the AST!");
6399 void ASTWriter::DeclarationMarkedOpenMPThreadPrivate(
const Decl *D) {
6400 if (Chain && Chain->isProcessingUpdateRecords())
return;
6401 assert(!WritingAST &&
"Already writing the AST!");
6408 void ASTWriter::DeclarationMarkedOpenMPDeclareTarget(
const Decl *D,
6410 if (Chain && Chain->isProcessingUpdateRecords())
return;
6411 assert(!WritingAST &&
"Already writing the AST!");
6415 DeclUpdates[D].push_back(
6419 void ASTWriter::RedefinedHiddenDefinition(
const NamedDecl *D,
Module *M) {
6420 if (Chain && Chain->isProcessingUpdateRecords())
return;
6421 assert(!WritingAST &&
"Already writing the AST!");
6422 assert(D->
isHidden() &&
"expected a hidden declaration");
6426 void ASTWriter::AddedAttributeToRecord(
const Attr *Attr,
6428 if (Chain && Chain->isProcessingUpdateRecords())
return;
6429 assert(!WritingAST &&
"Already writing the AST!");
6435 void ASTWriter::AddedCXXTemplateSpecialization(
6437 assert(!WritingAST &&
"Already writing the AST!");
6441 if (Chain && Chain->isProcessingUpdateRecords())
6444 DeclsToEmitEvenIfUnreferenced.push_back(D);
6447 void ASTWriter::AddedCXXTemplateSpecialization(
6449 assert(!WritingAST &&
"Already writing the AST!");
6453 if (Chain && Chain->isProcessingUpdateRecords())
6456 DeclsToEmitEvenIfUnreferenced.push_back(D);
6461 assert(!WritingAST &&
"Already writing the AST!");
6465 if (Chain && Chain->isProcessingUpdateRecords())
6468 DeclsToEmitEvenIfUnreferenced.push_back(D);
6479 Record.AddSourceLocation(C->
getEndLoc());
6488 VisitOMPClauseWithPreInit(C);
6492 void OMPClauseWriter::VisitOMPIfClause(
OMPIfClause *
C) {
6493 VisitOMPClauseWithPreInit(C);
6507 VisitOMPClauseWithPreInit(C);
6540 VisitOMPClauseWithPreInit(C);
6556 Record.AddStmt(NumIter);
6568 void OMPClauseWriter::VisitOMPReadClause(
OMPReadClause *) {}
6580 void OMPClauseWriter::VisitOMPSIMDClause(
OMPSIMDClause *) {}
6597 VisitOMPClauseWithPreInit(C);
6605 for (
auto *VE : C->
inits()) {
6612 VisitOMPClauseWithPostUpdate(C);
6635 VisitOMPClauseWithPostUpdate(C);
6654 VisitOMPClauseWithPostUpdate(C);
6673 VisitOMPClauseWithPostUpdate(C);
6694 VisitOMPClauseWithPostUpdate(C);
6696 Record.AddSourceLocation(C->getColonLoc());
6697 Record.push_back(C->getModifier());
6698 Record.AddSourceLocation(C->getModifierLoc());
6702 for (
auto *VE : C->privates()) {
6705 for (
auto *VE : C->inits()) {
6708 for (
auto *VE : C->updates()) {
6711 for (
auto *VE : C->finals()) {
6714 Record.AddStmt(C->getStep());
6715 Record.AddStmt(C->getCalcStep());
6719 Record.push_back(C->varlist_size());
6720 Record.AddSourceLocation(C->getLParenLoc());
6722 for (
auto *VE : C->varlists())
6728 Record.push_back(C->varlist_size());
6729 Record.AddSourceLocation(C->getLParenLoc());
6730 for (
auto *VE : C->varlists())
6741 Record.push_back(C->varlist_size());
6742 Record.AddSourceLocation(C->getLParenLoc());
6743 for (
auto *VE : C->varlists())
6754 Record.push_back(C->varlist_size());
6755 Record.AddSourceLocation(C->getLParenLoc());
6756 for (
auto *VE : C->varlists())
6761 Record.push_back(C->varlist_size());
6763 Record.AddSourceLocation(C->getLParenLoc());
6767 for (
auto *VE : C->varlists())
6769 for (
unsigned I = 0, E = C->
getNumLoops(); I < E; ++I)
6774 VisitOMPClauseWithPreInit(C);
6779 void OMPClauseWriter::VisitOMPMapClause(
OMPMapClause *C) {
6780 Record.push_back(C->varlist_size());
6784 Record.AddSourceLocation(C->getLParenLoc());
6790 Record.AddSourceLocation(C->
getMapLoc());
6792 for (
auto *E : C->varlists())
6795 Record.AddDeclRef(D);
6797 Record.push_back(N);
6799 Record.push_back(N);
6801 Record.AddStmt(M.getAssociatedExpression());
6802 Record.AddDeclRef(M.getAssociatedDeclaration());
6807 VisitOMPClauseWithPreInit(C);
6813 VisitOMPClauseWithPreInit(C);
6833 void OMPClauseWriter::VisitOMPHintClause(
OMPHintClause *C) {
6839 VisitOMPClauseWithPreInit(C);
6855 void OMPClauseWriter::VisitOMPToClause(
OMPToClause *C) {
6856 Record.push_back(C->varlist_size());
6860 Record.AddSourceLocation(C->getLParenLoc());
6861 for (
auto *E : C->varlists())
6864 Record.AddDeclRef(D);
6866 Record.push_back(N);
6868 Record.push_back(N);
6870 Record.AddStmt(M.getAssociatedExpression());
6871 Record.AddDeclRef(M.getAssociatedDeclaration());
6875 void OMPClauseWriter::VisitOMPFromClause(
OMPFromClause *C) {
6876 Record.push_back(C->varlist_size());
6880 Record.AddSourceLocation(C->getLParenLoc());
6881 for (
auto *E : C->varlists())
6884 Record.AddDeclRef(D);
6886 Record.push_back(N);
6888 Record.push_back(N);
6890 Record.AddStmt(M.getAssociatedExpression());
6891 Record.AddDeclRef(M.getAssociatedDeclaration());
6896 Record.push_back(C->varlist_size());
6900 Record.AddSourceLocation(C->getLParenLoc());
6901 for (
auto *E : C->varlists())
6905 for (
auto *VE : C->
inits())
6908 Record.AddDeclRef(D);
6910 Record.push_back(N);
6912 Record.push_back(N);
6914 Record.AddStmt(M.getAssociatedExpression());
6915 Record.AddDeclRef(M.getAssociatedDeclaration());
6920 Record.push_back(C->varlist_size());
6924 Record.AddSourceLocation(C->getLParenLoc());
6925 for (
auto *E : C->varlists())
6928 Record.AddDeclRef(D);
6930 Record.push_back(N);
6932 Record.push_back(N);
6934 Record.AddStmt(M.getAssociatedExpression());
6935 Record.AddDeclRef(M.getAssociatedDeclaration());
6941 void OMPClauseWriter::VisitOMPUnifiedSharedMemoryClause(
6950 void OMPClauseWriter::VisitOMPAtomicDefaultMemOrderClause(
A CXXConstCastExpr record.
SourceLocation getLoc() const
getLoc - Returns the main location of the declaration name.
TemplateTemplateParmDecl * getParameterPack() const
Retrieve the template template parameter pack being substituted.
A FriendTemplateDecl record.
QualType getPattern() const
Retrieve the pattern of this pack expansion, which is the type that will be repeatedly instantiated w...
Defines the clang::ASTContext interface.
A CompoundLiteralExpr record.
A NonTypeTemplateParmDecl record.
QualType getDeducedType() const
Get the type deduced for this placeholder type, or null if it's either not been deduced or was deduce...
TargetOptions & getTargetOpts() const
Retrieve the target options.
Represents a type that was referred to using an elaborated type keyword, e.g., struct S...
const FileEntry * OrigEntry
Reference to the file entry representing this ContentCache.
UnusedFileScopedDeclsType UnusedFileScopedDecls
The set of file scoped decls seen so far that have not been used and must warn if not used...
Record code for the preprocessor options table.
VarDecl * getCapturedVar() const
Retrieve the declaration of the local variable being captured.
const CXXDestructorDecl * getDestructor() const
unsigned getAnonymousDeclarationNumber(const NamedDecl *D)
uint64_t getMacroDirectivesOffset(const IdentifierInfo *Name)
Represents a function declaration or definition.
SourceRange getExceptionSpecRange() const
llvm::SmallSetVector< const TypedefNameDecl *, 4 > UnusedLocalTypedefNameCandidates
Set containing all typedefs that are likely unused.
std::string Name
The name of this module.
helper_expr_const_range reduction_ops() const
bool isImplicit() const
Determine whether this was an implicit capture (not written between the square brackets introducing t...
NamespaceDecl * getStdNamespace() const
This represents 'thread_limit' clause in the '#pragma omp ...' directive.
SourceLocation getOptimizeOffPragmaLocation() const
Get the location for the currently active "\#pragma clang optimize off". If this location is invalid...
void VisitArrayType(const ArrayType *T)
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.
ExtVectorDeclsType ExtVectorDecls
ExtVectorDecls - This is a list all the extended vector types.
A UserDefinedLiteral record.
bool isKindOfTypeAsWritten() const
Whether this is a "__kindof" type as written.
Source range/offset of a preprocessed entity.
ASTWriter(llvm::BitstreamWriter &Stream, SmallVectorImpl< char > &Buffer, MemoryBufferCache &PCMCache, ArrayRef< std::shared_ptr< ModuleFileExtension >> Extensions, bool IncludeTimestamps=true)
Create a new precompiled header writer that outputs to the given bitstream.
std::vector< std::pair< std::string, bool > > Macros
no exception specification
Record code for potentially unused local typedef names.
Smart pointer class that efficiently represents Objective-C method names.
Record code for map of Objective-C class definition IDs to the ObjC categories in a module that are a...
This is a discriminated union of FileInfo and ExpansionInfo.
An IndirectGotoStmt record.
helper_expr_const_range lhs_exprs() const
const_all_decls_range all_decls() const
This represents clause 'copyin' in the '#pragma omp ...' directives.
unsigned getRawEncoding() const
When a SourceLocation itself cannot be used, this returns an (opaque) 32-bit integer encoding for it...
RefQualifierKind getRefQualifier() const
Retrieve the ref-qualifier associated with this function type.
PointerType - C99 6.7.5.1 - Pointer Declarators.
ArrayRef< QualType > getTypeArgsAsWritten() const
Retrieve the type arguments of this object type as they were written.
QualType getElementType() const
QualType getPointeeType() const
Represents the dependent type named by a dependently-scoped typename using declaration, e.g.
bool hasTemplateKeyword() const
Whether the template name was prefixed by the "template" keyword.
SmallVector< UnresolvedHeaderDirective, 1 > MissingHeaders
Headers that are mentioned in the module map file but could not be found on the file system...
A (possibly-)qualified type.
static void EmitBlockID(unsigned ID, const char *Name, llvm::BitstreamWriter &Stream, ASTWriter::RecordDataImpl &Record)
void * getAsOpaquePtr() const
OverloadedOperatorKind getOperator() const
Return the overloaded operator to which this template name refers.
bool getNoCfCheck() const
The macro directives history for a particular identifier.
QualType getInjectedSpecializationType() const
NestedNameSpecifier * getQualifier() const
Return the nested name specifier that qualifies this name.
Implements support for file system lookup, file system caching, and directory search management...
const DeclarationNameLoc & getInfo() const
const std::vector< SourceRange > & getSkippedRanges()
Retrieve all ranges that got skipped while preprocessing.
SourceLocation getSpellingLoc() const
void AddToken(const Token &Tok, RecordDataImpl &Record)
Emit a token.
unsigned getNumExceptions() const
Return the number of types in the exception specification.
LateParsedTemplateMapT LateParsedTemplateMap
SourceLocation getCommaLoc()
Get location of ','.
OpenCL supported extensions and optional core features.
A CXXStaticCastExpr record.
Defines the clang::FileManager interface and associated types.
time_t getModificationTime() const
Record code for the source manager line table information, which stores information about #line direc...
An AttributedStmt record.
A CXXReinterpretCastExpr record.
This represents 'atomic_default_mem_order' clause in the '#pragma omp requires' directive.
An OMPThreadPrivateDecl record.
bool isLookupContext() const
Test whether the context supports looking up names.
SourceLocation getKWLoc() const
helper_expr_const_range rhs_exprs() const
DominatorTree GraphTraits specialization so the DominatorTree can be iterable by generic graph iterat...
An ObjCBoolLiteralExpr record.
void getUndefinedButUsed(SmallVectorImpl< std::pair< NamedDecl *, SourceLocation > > &Undefined)
Obtain a sorted list of functions that are undefined but ODR-used.
submodule_iterator submodule_begin()
Expr * getUnderlyingExpr() const
private_copies_range private_copies()
TypeLoc getNextTypeLoc() const
Get the next TypeLoc pointed by this TypeLoc, e.g for "int*" the TypeLoc is a PointerLoc and next Typ...
const unsigned NUM_PREDEF_TYPE_IDS
The number of predefined type IDs that are reserved for the PREDEF_TYPE_* constants.
This represents clause 'in_reduction' in the '#pragma omp task' directives.
FunctionType - C99 6.7.5.3 - Function Declarators.
Expr * getLoopData(unsigned NumLoop)
Get the loop data.
unsigned IsExternC
Whether this is an 'extern "C"' module (which implicitly puts all headers in it within an 'extern "C"...
bool hasExtParameterInfos() const
Is there any interesting extra information for any of the parameters of this function type...
Class that handles pre-initialization statement for some clauses, like 'shedule', 'firstprivate' etc...
Module * getTopLevelModule()
Retrieve the top-level module for this (sub)module, which may be this module.
void AddUnresolvedSet(const ASTUnresolvedSet &Set)
Emit a UnresolvedSet structure.
void AddNestedNameSpecifierLoc(NestedNameSpecifierLoc NNS)
Emit a nested name specifier with source-location information.
C Language Family Type Representation.
Defines the SourceManager interface.
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in...
static bool isImportedDeclContext(ASTReader *Chain, const Decl *D)
bool isExpansionTokenRange() const
Represents a qualified type name for which the type name is dependent.
An OMPDeclareReductionDecl record.
SourceLocation getLParenLoc() const
Returns the location of '('.
The template argument is an expression, and we've not resolved it to one of the other forms yet...
unsigned size() const
Retrieve the number of template arguments in this template argument list.
FileManager & getFileManager() const
NestedNameSpecifier * getQualifier() const
Retrieve the qualification on this type.
RawCommentList Comments
All comments in this translation unit.
helper_expr_const_range rhs_exprs() const
bool isInitICE() const
Determines whether the initializer is an integral constant expression, or in C++11, whether the initializer is a constant expression.
void GetUniqueIDMapping(SmallVectorImpl< const FileEntry *> &UIDToFiles) const
Produce an array mapping from the unique IDs assigned to each file to the corresponding FileEntry poi...
An ImplicitValueInitExpr record.
Defines the clang::Module class, which describes a module in the source code.
const unsigned int NUM_PREDEF_SELECTOR_IDS
The number of predefined selector IDs.
bool isLocalSourceLocation(SourceLocation Loc) const
Returns true if Loc did not come from a PCH/Module.
Decl - This represents one declaration (or definition), e.g.
This represents 'grainsize' clause in the '#pragma omp ...' directive.
An ImplicitCastExpr record.
bool isVariadic() const
Whether this function prototype is variadic.
TagDecl * getDecl() const
static constexpr unsigned NumberOfModifiers
Number of allowed map-type-modifiers.
A VarTemplatePartialSpecializationDecl record.
bool isVirtual() const
Determines whether the base class is a virtual base class (or not).
std::deque< PendingImplicitInstantiation > PendingInstantiations
The queue of implicit template instantiations that are required but have not yet been performed...
Selector getObjCSelector() const
Get the Objective-C selector stored in this declaration name.
unsigned IsFramework
Whether this is a framework module.
NestedNameSpecifier * getPrefix() const
Return the prefix of this nested name specifier.
ModuleKind Kind
The type of this module.
This represents 'if' clause in the '#pragma omp ...' directive.
Defines the C++ template declaration subclasses.
Describes a source location entry (SLocEntry) for a macro expansion.
OverloadedOperatorKind getCXXOverloadedOperator() const
If this name is the name of an overloadable operator in C++ (e.g., operator+), retrieve the kind of o...
SourceLocation getAtomicDefaultMemOrderKindKwLoc() const
Returns location of clause kind.
Represents a C++11 auto or C++14 decltype(auto) type.
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...
std::vector< std::string > Includes
bool makeAbsolutePath(SmallVectorImpl< char > &Path) const
Makes Path absolute taking into account FileSystemOptions and the working directory option...
An LValueReferenceType record.
static unsigned getNumberOfModules(Module *Mod)
Compute the number of modules within the given tree (including the given module). ...
Decl * getPreviousDecl()
Retrieve the previous declaration that declares the same entity as this declaration, or NULL if there is no previous declaration.
Defines the clang::MacroInfo and clang::MacroDirective classes.
A CXXOperatorCallExpr record.
helper_expr_const_range assignment_ops() const
Defines types useful for describing an Objective-C runtime.
Specifies the submodules that are imported by this submodule.
std::string ModuleName
The name of the module.
A record that stores the set of declarations that are lexically stored within a given DeclContext...
This represents 'priority' clause in the '#pragma omp ...' directive.
Specifies an umbrella directory.
helper_expr_const_range lhs_exprs() const
A CXXTemporaryObjectExpr record.
std::deque< PendingImplicitInstantiation > PendingLocalImplicitInstantiations
The queue of implicit template instantiations that are required and must be performed within the curr...
llvm::MapVector< const FunctionDecl *, std::unique_ptr< LateParsedTemplate > > LateParsedTemplateMapT
QualType getsigjmp_bufType() const
Retrieve the C sigjmp_buf type.
Each ExpansionInfo encodes the expansion location - where the token was ultimately expanded...
DiagnosticsEngine & getDiagnostics() const
A SubstTemplateTypeParmType record.
Class that performs name lookup into a DeclContext stored in an AST file.
Writer for the on-disk hash table.
Declaration of a variable template.
Represents an array type, per C99 6.7.5.2 - Array Declarators.
The template argument is a declaration that was provided for a pointer, reference, or pointer to member non-type template parameter.
Represent a C++ namespace.
A ObjCPropertyDecl record.
Wrapper for source info for typedefs.
serialization::DeclID GetDeclRef(const Decl *D)
Force a declaration to be emitted and get its ID.
Expr * getCondition() const
Returns condition.
const TargetInfo & getTargetInfo() const
A container of type source information.
This represents 'update' clause in the '#pragma omp atomic' directive.
QualType getValueType() const
Gets the type contained by this atomic type, i.e.
Record code for enabled OpenCL extensions.
Record code for the module build directory.
Floating point control options.
bool isFromAST() const
Return true if the identifier in its current state was loaded from an AST file.
time_t getTimestampForOutput(const FileEntry *E) const
Get a timestamp for output into the AST file.
Expr * getCondition() const
Returns condition.
SourceLocation getAttributeLoc() const
void AddTypeRef(QualType T, RecordDataImpl &Record)
Emit a reference to a type.
An ElaboratedType record.
ObjCMethodDecl * getMethod() const
serialization::SelectorID BaseSelectorID
Base selector ID for selectors local to this module.
An UnresolvedUsingType record.
PreprocessorOptions - This class is used for passing the various options used in preprocessor initial...
static void AddStmtsExprs(llvm::BitstreamWriter &Stream, ASTWriter::RecordDataImpl &Record)
Wrapper for source info for pointers decayed from arrays and functions.
bool isPackExpansion() const
Determine whether this capture is a pack expansion, which captures a function parameter pack...
static uint64_t EmitCXXCtorInitializers(ASTWriter &W, ArrayRef< CXXCtorInitializer *> CtorInits)
Describes the capture of a variable or of this, or of a C++1y init-capture.
TemplateTypeParmDecl * getDecl() const
This is a module that was defined by a module map and built out of header files.
An IncompleteArrayType record.
The internal '__type_pack_element' template.
A template template parameter that has been substituted for some other template name.
Specifies a header that is part of the module but must be textually included.
Expr * getAlignment()
Returns alignment.
Expr * getNumForLoops() const
Return the number of associated for-loops.
SourceLocation getSecondScheduleModifierLoc() const
Get the second modifier location.
OpenMPMapModifierKind getMapTypeModifier(unsigned Cnt) const LLVM_READONLY
Fetches the map-type-modifier at 'Cnt' index of array of modifiers.
uint64_t Emit(unsigned Code, unsigned Abbrev=0)
Emit the record to the stream, followed by its substatements, and return its offset.
IdentifierInfo * getAlias() const
bool hasBaseTypeAsWritten() const
QualType getElementType() const
bool isCompleteDefinition() const
Return true if this decl has its body fully specified.
bool hasLocalNonFastQualifiers() const
Determine whether this particular QualType instance has any "non-fast" qualifiers, e.g., those that are stored in an ExtQualType instance.
const IdentifierInfo * getIdentifier() const
Returns the identifier to which this template name refers.
A ClassTemplateDecl record.
TemplateName getTemplateName() const
Retrieve the name of the template that we are deducing.
unsigned NumPreprocessedEntities
A PragmaDetectMismatchDecl record.
An UnresolvedUsingTypenameDecl record.
SourceLocation getRParenLoc() const
An identifier, stored as an IdentifierInfo*.
The internal '__builtin_va_list' typedef.
The stack of open #ifs/#ifdefs recorded in a preamble.
static uint64_t EmitCXXBaseSpecifiers(ASTWriter &W, ArrayRef< CXXBaseSpecifier > Bases)
SourceLocation getDependencyLoc() const
Get dependency type location.
Manages the set of modules loaded by an AST reader.
This represents 'read' clause in the '#pragma omp atomic' directive.
serialization::MacroID getMacroRef(MacroInfo *MI, const IdentifierInfo *Name)
Get the unique number used to refer to the given macro.
helper_expr_const_range assignment_ops() const
Represents a variable declaration or definition.
This represents clause 'private' in the '#pragma omp ...' directives.
Record code for #pragma pack options.
A block with unhashed content.
This represents 'num_threads' clause in the '#pragma omp ...' directive.
Wrapper for source info for member pointers.
An OMPCapturedExprDecl record.
void AddFunctionDefinition(const FunctionDecl *FD)
Add a definition for the given function to the queue of statements to emit.
unsigned getNumParams() const
Options for controlling the target.
Wrapper of type source information for a type with non-trivial direct qualifiers. ...
Manage memory buffers across multiple users.
Record code for declarations associated with OpenCL extensions.
A UsingShadowDecl record.
Represents an empty template argument, e.g., one that has not been deduced.
QualType getRawCFConstantStringType() const
Get the structure type used to representation CFStrings, or NULL if it hasn't yet been built...
This represents 'defaultmap' clause in the '#pragma omp ...' directive.
decl_range decls() const
decls_begin/decls_end - Iterate over the declarations stored in this context.
serialization::SubmoduleID BaseSubmoduleID
Base submodule ID for submodules local to this module.
const unsigned int NUM_PREDEF_DECL_IDS
The number of declaration IDs that are predefined.
SourceLocation getStarLoc() const
Represents a C++17 deduced template specialization type.
static unsigned CreateSLocFileAbbrev(llvm::BitstreamWriter &Stream)
Create an abbreviation for the SLocEntry that refers to a file.
QualifiedTemplateName * getAsQualifiedTemplateName() const
Retrieve the underlying qualified template name structure, if any.
Represents a variable template specialization, which refers to a variable template with a given set o...
The value of the next COUNTER to dispense.
unsigned getNextLocalOffset() const
SourceLocation getLAngleLoc() const
A ConditionOperator record.
const DeclContext * getDefinitiveDeclContext(const DeclContext *DC)
Retrieve the "definitive" declaration that provides all of the visible entries for the given declarat...
A TemplateTemplateParmDecl record that stores an expanded template template parameter pack...
Specifies the umbrella header used to create this module, if any.
SourceLocation getLBracketLoc() const
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>".
A namespace, stored as a NamespaceDecl*.
SourceLocation getColonLoc() const
Return the location of ':'.
iterator local_end()
End iterator for local, non-loaded, preprocessed entities.
Record code for header search information.
Stores a list of template parameters for a TemplateDecl and its derived classes.
unsigned getODRHash() const
This represents implicit clause 'flush' for the '#pragma omp flush' directive.
Describes a source location entry (SLocEntry) for a buffer.
Used to hold and unique data used to represent #line information.
llvm::MapVector< Selector, SourceLocation > ReferencedSelectors
Method selectors used in a @selector expression.
A CXXConstructExpr record.
Record code for the target options table.
serialization::IdentID getIdentifierRef(const IdentifierInfo *II)
Get the unique number used to refer to the given identifier.
const DeclarationNameInfo & getNameInfo() const
Gets the name info for specified reduction identifier.
static StringRef bytes(const std::vector< T, Allocator > &v)
SpecifierKind getKind() const
Determine what kind of nested name specifier is stored.
bool hasLineDirectives() const
Return true if this FileID has #line directives in it.
unsigned getTotalComponentsNum() const
Return the total number of components in all lists derived from the clause.
This represents 'reverse_offload' clause in the '#pragma omp requires' directive. ...
Decl * getVaListTagDecl() const
Retrieve the C type declaration corresponding to the predefined __va_list_tag type used to help defin...
A TemplateTemplateParmDecl record.
Record code for the array of eagerly deserialized decls.
Expr * getAttrExprOperand() const
The attribute's expression operand, if it has one.
Represents a parameter to a function.
Represents the result of substituting a type for a template type parameter.
QualType getLocalUnqualifiedType() const
Return this type with all of the instance-specific qualifiers removed, but without removing any quali...
OpenCLOptions & getOpenCLOptions()
Defines the clang::Expr interface and subclasses for C++ expressions.
FPOptions & getFPOptions()
const llvm::MapVector< FieldDecl *, DeleteLocs > & getMismatchingDeleteExpressions() const
Retrieves list of suspicious delete-expressions that will be checked at the end of translation unit...
A ObjCInterfaceDecl record.
QualType getIntegralType() const
Retrieve the type of the integral value.
const MacroDirective * getPrevious() const
Get previous definition of the macro with the same name.
tok::TokenKind getKind() const
SourceLocation getLParenLoc() const
Returns the location of '('.
void AddSourceRange(SourceRange Range)
Emit a source range.
void AddIdentifierRef(const IdentifierInfo *II, RecordDataImpl &Record)
Emit a reference to an identifier.
Expr * getGrainsize() const
Return safe iteration space distance.
This represents 'nogroup' clause in the '#pragma omp ...' directive.
SourceLocation getAmpAmpLoc() const
The collection of all-type qualifiers we support.
A ShuffleVectorExpr record.
This represents 'safelen' clause in the '#pragma omp ...' directive.
bool needsExtraLocalData() const
SourceLocation getLParenLoc() const
Returns the location of '('.
iterator begin(DeclarationName Name)
begin - Returns an iterator for decls with the name 'Name'.
ModuleKind Kind
The kind of this module.
void AddTypeSourceInfo(TypeSourceInfo *TInfo)
Emits a reference to a declarator info.
SubstTemplateTemplateParmStorage * getAsSubstTemplateTemplateParm() const
Retrieve the substituted template template parameter, if known.
SourceLocation getAttributeLoc() const
Base wrapper for a particular "section" of type source info.
A CXXConstructorDecl record for an inherited constructor.
Represents a struct/union/class.
const unsigned VERSION_MAJOR
AST file major version number supported by this version of Clang.
unsigned varlist_size() const
QualType getOriginalType() const
TypeSpecifierSign getWrittenSignSpec() const
SourceLocation getLParenLoc() const
Returns the location of '('.
Represents a class template specialization, which refers to a class template with a given set of temp...
One of these records is kept for each identifier that is lexed.
ArrayRef< PPConditionalInfo > getPreambleConditionalStack() const
A macro directive exported by a module.
An ObjCAtThrowStmt record.
FileManager & getFileManager() const
Specifies a top-level header that falls into this (sub)module.
The block containing comments.
const TemplateArgument & get(unsigned Idx) const
Retrieve the template argument at a given index.
void AddTypeRef(QualType T)
Emit a reference to a type.
A DesignatedInitExpr record.
The Objective-C 'SEL' type.
SourceLocation getColonLoc() const
Gets location of ':' symbol in clause.
unsigned getRegParm() const
Represents a class type in Objective C.
Iteration over the preprocessed entities.
QualType getPointeeType() const
Expr * getAsExpr() const
Retrieve the template argument as an expression.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
A C++ nested-name-specifier augmented with source location information.
Record the location of a macro definition.
Represents a dependent template name that cannot be resolved prior to template instantiation.
The results of name lookup within a DeclContext.
This represents 'simd' clause in the '#pragma omp ...' directive.
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
TemplateDecl * getAsTemplateDecl() const
Retrieve the underlying template declaration that this template name refers to, if known...
TypeSourceInfo * getUnderlyingTInfo() const
void resolveHeaderDirectives(const FileEntry *File) const
Resolve all lazy header directives for the specified file.
An ObjCProtocolExpr record.
bool isSpelledAsLValue() const
An ObjCSelectorExpr record.
Specifies a header that has been explicitly excluded from this submodule.
static SourceLocation getFromRawEncoding(unsigned Encoding)
Turn a raw encoding of a SourceLocation object into a real SourceLocation.
SmallVector< Requirement, 2 > Requirements
The set of language features required to use this module.
NameKind getNameKind() const
Determine what kind of name this is.
Represents a member of a struct/union/class.
TemplateName getTemplateName() const
Retrieve the name of the template that we are specializing.
const Type * getAsType() const
Retrieve the type stored in this nested name specifier.
This represents clause 'lastprivate' in the '#pragma omp ...' directives.
bool isCanonicalUnqualified() const
Determines if this type would be canonical if it had no further qualification.
bool isCPlusPlusOperatorKeyword() const
SubstTemplateTemplateParmPackStorage * getAsSubstTemplateTemplateParmPack() const
Retrieve the substituted template template parameter pack, if known.
The unsigned 128-bit integer type.
SourceLocation getLParenLoc() const
Returns the location of '('.
Record code for the module map file that was used to build this AST file.
One instance of this struct is kept for every file loaded or used.
SourceLocation getProtocolLAngleLoc() const
Delete expressions that will be analyzed later.
bool hasCommaPasting() const
NestedNameSpecifierLoc getQualifierLoc() const
Expr * getChunkSize()
Get chunk size.
Header getUmbrellaHeader() const
Retrieve the header that serves as the umbrella header for this module.
Optional< unsigned > getNumTemplateExpansions() const
Retrieve the number of expansions that a template template argument expansion will produce...
This represents clause 'map' in the '#pragma omp ...' directives.
SourceLocation getDefaultKindKwLoc() const
Returns location of clause kind.
CXXRecordDecl * getStdBadAlloc() const
The iterator over UnresolvedSets.
This represents clause 'to' in the '#pragma omp ...' directives.
Represents the result of substituting a set of types for a template type parameter pack...
Token - This structure provides full information about a lexed token.
TagDecl * getOwnedTagDecl() const
Return the (re)declaration of this type owned by this occurrence of this type, or nullptr if there is...
SourceLocation getProtocolRAngleLoc() const
ParmVarDecl * getParam(unsigned i) const
ASTReader * getChain() const
static unsigned CreateSLocExpansionAbbrev(llvm::BitstreamWriter &Stream)
Create an abbreviation for the SLocEntry that refers to a macro expansion.
Wrapper for source info for unresolved typename using decls.
SourceLocation getRParenLoc() const
An AttributedType record.
uint32_t MacroID
An ID number that refers to a macro in an AST file.
Expr * getSafelen() const
Return safe iteration space distance.
An object-like macro definition.
unsigned IsTransient
True if this file may be transient, that is, if it might not exist at some later point in time when t...
The signature of a module, which is a hash of the AST content.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
unsigned char getOpaqueValue() const
void AddTemplateParameterList(const TemplateParameterList *TemplateParams)
Emit a template parameter list.
SourceLocation getTemplateLoc() const
const LangOptions & getLangOpts() const
TemplateName getReplacement() const
Expr * getNumTeams()
Return NumTeams number.
QualType getParamTypeForDecl() const
Describes a module or submodule.
SourceLocation getLParenLoc() const
Qualifiers getLocalQualifiers() const
Retrieve the set of qualifiers local to this particular QualType instance, not including any qualifie...
A IndirectFieldDecl record.
Record code for the set of ext_vector type names.
iterator end()
end - Returns an iterator that has 'finished'.
void VisitTagType(const TagType *T)
SourceLocation getComposedLoc(FileID FID, unsigned Offset) const
Form a SourceLocation from a FileID and Offset pair.
bool getProducesResult() const
serialization::MacroID getMacroID(MacroInfo *MI)
Determine the ID of an already-emitted macro.
This represents clause 'copyprivate' in the '#pragma omp ...' directives.
static ModuleHeaderRole headerKindToRole(Module::HeaderKind Kind)
Convert a header kind to a role. Requires Kind to not be HK_Excluded.
SourceLocation getLAngleLoc() const
TypeSpecifierWidth getWrittenWidthSpec() const
Specifies the submodules that are re-exported from this submodule.
TemplateParameterList ** TemplParamLists
A new-allocated array of size NumTemplParamLists, containing pointers to the "outer" template paramet...
serialization::MacroID BaseMacroID
Base macro ID for macros local to this module.
An rvalue reference type, per C++11 [dcl.ref].
CXXRecordDecl * getAsRecordDecl() const
Retrieve the record declaration stored in this nested name specifier.
UnresolvedUsingTypenameDecl * getDecl() const
IdentifierInfo * getAsIdentifier() const
Retrieve the identifier stored in this nested name specifier.
The Objective-C 'id' type.
unsigned InferExportWildcard
Whether, when inferring submodules, the inferr submodules should export all modules they import (e...
A qualified template name, where the qualification is kept to describe the source code as written...
NestedNameSpecifierLoc getQualifierLoc() const
Gets the nested name specifier.
SourceLocation getLParenLoc() const
Wrapper for source info for injected class names of class templates.
A record of the steps taken while preprocessing a source file, including the various preprocessing di...
< Capturing the *this object by copy
HeaderSearch & getHeaderSearchInfo() const
SourceLocation getDefaultmapKindLoc()
Get kind location.
An AccessSpecDecl record.
unsigned getNumProtocols() const
const Token & getReplacementToken(unsigned Tok) const
SourceLocation getProtocolLoc(unsigned i) const
Describes a blob that contains the data for a buffer entry.
const FileInfo & getFile() const
Record code for the language options table.
QualType getExceptionType(unsigned i) const
Return the ith exception type, where 0 <= i < getNumExceptions().
bool getInheritConstructors() const
Determine whether this base class's constructors get inherited.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
Wrapper for source info for functions.
Specifies a conflict with another module.
The signed 128-bit integer type.
unsigned getHash() const
Compute a fingerprint of this key for use in on-disk hash table.
StoredDeclsMap * buildLookup()
Ensure the lookup structure is fully-built and return it.
A UnaryTransformType record.
A reference to a previously [de]serialized Stmt record.
SourceRange getLocalSourceRange() const
Retrieve the source range covering just the last part of this nested-name-specifier, not including the prefix.
QualType getNullPtrType() const
Retrieve the type for null non-type template argument.
A UsingDirecitveDecl record.
const Stmt * getPreInitStmt() const
Get pre-initialization statement for the clause.
SourceLocation getElaboratedKeywordLoc() const
An ObjCObjectType record.
NamespaceAliasDecl * getAsNamespaceAlias() const
Retrieve the namespace alias stored in this nested name specifier.
A ConstantArrayType record.
Wrapper for substituted template type parameters.
Concrete class used by the front-end to report problems and issues.
Represents a typeof (or typeof) expression (a GCC extension).
Record code for #pragma optimize options.
GlobalMethodPool MethodPool
Method Pool - allows efficient lookup when typechecking messages to "id".
void AddSourceRange(SourceRange Range, RecordDataImpl &Record)
Emit a source range.
Specifies a header that is private to this submodule but must be textually included.
Record code for pending implicit instantiations.
Wrapper for substituted template type parameters.
SourceLocation RAngleLoc
The source location of the right angle bracket ('>').
SourceLocation getColonLoc() const
Gets location of ':' symbol in clause.
The internal '__make_integer_seq' template.
ASTTypeWriter(ASTWriter &Writer, ASTWriter::RecordDataImpl &Record)
SourceLocation getLParenLoc() const
SourceLocation getMapTypeModifierLoc(unsigned Cnt) const LLVM_READONLY
Fetches the map-type-modifier location at 'Cnt' index of array of modifiers' locations.
Module * Parent
The parent of this module.
const Type * getClass() const
Record code for floating point #pragma options.
CXXRecordDecl * getDecl() const
void AddTypeLoc(TypeLoc TL)
Emits source location information for a type. Does not emit the type.
Class that handles post-update expression for some clauses, like 'lastprivate', 'reduction' etc...
Defines the Diagnostic-related interfaces.
LazyDeclPtr StdBadAlloc
The C++ "std::bad_alloc" class, which is defined by the C++ standard library.
This represents 'default' clause in the '#pragma omp ...' directive.
SourceLocation getTemplateKeywordLoc() const
Expr * getSizeExpr() const
Wrapper for source info for ObjC interfaces.
Record code for the set of known namespaces, which are used for typo correction.
CXXRecordDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
TypeID MakeTypeID(ASTContext &Context, QualType T, IdxForTypeTy IdxForType)
bool hasRevertedBuiltin() const
True if setNotBuiltin() was called.
Record code for an array of all of the (sub)modules that were imported by the AST file...
This represents 'final' clause in the '#pragma omp ...' directive.
This represents 'mergeable' clause in the '#pragma omp ...' directive.
submodule_iterator submodule_end()
serialization::DeclID BaseDeclID
Base declaration ID for declarations local to this module.
unsigned getInt() const
Used to serialize this.
OpenMPDependClauseKind getDependencyKind() const
Get dependency type.
import_range local_imports() const
std::vector< std::string > Warnings
The list of -W...
This represents clause 'reduction' in the '#pragma omp ...' directives.
A marker record that indicates that we are at the end of an expression.
A ClassTemplateSpecializationDecl record.
bool isUsed() const
Return false if this macro is defined in the main file and has not yet been used. ...
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC)...
SourceLocation getNameLoc() const
TemplateTemplateParmDecl * getParameter() const
A BlockPointerType record.
uint32_t getIndex() const
SourceLocation getDefaultmapModifierLoc() const
Get the modifier location.
SmallVector< uint64_t, 64 > RecordData
A MemberPointerType record.
TemplateArgumentLoc getArgLoc(unsigned i) const
helper_expr_const_range source_exprs() const
This represents clause 'is_device_ptr' in the '#pragma omp ...' directives.
Represents an ObjC class declaration.
SourceLocation getIncludeLoc() const
unsigned getUniqueDeclarationsNum() const
Return the number of unique base declarations in this clause.
unsigned getNumArgs() const
SourceLocation getProtocolRAngleLoc() const
Qualifiers getTypeQuals() const
A DependentSizedExtVectorType record.
SmallVectorImpl< uint64_t > RecordDataImpl
SourceLocation getElaboratedKeywordLoc() const
helper_expr_const_range source_exprs() const
unsigned getLength() const
Efficiently return the length of this identifier info.
Expr * getSizeExpr() const
Record code for the table of offsets into the block of source-location information.
bool isMacroArgExpansion() const
bool getNoCallerSavedRegs() const
QualType getPointeeTypeAsWritten() const
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
Expr * getSizeExpr() const
unsigned getNumProtocols() const
Return the number of qualifying protocols in this type, or 0 if there are none.
QualType getElementType() const
Represents an extended vector type where either the type or size is dependent.
helper_expr_const_range privates() const
private_copies_range private_copies()
A SubstTemplateTypeParmPackType record.
This represents clause 'from' in the '#pragma omp ...' directives.
TypeCode
Record codes for each kind of type.
SourceLocation getLParenLoc() const
Returns the location of '('.
std::vector< std::string > ModuleFeatures
The names of any features to enable in module 'requires' decls in addition to the hard-coded list in ...
Iterator that walks over the list of categories, filtering out those that do not meet specific criter...
SourceLocation getTemplateEllipsisLoc() const
SourceLocation getTemplateKeywordLoc() const
Represents a K&R-style 'int foo()' function, which has no information available about its arguments...
unsigned IsSystem
Whether this is a "system" module (which assumes that all headers in it are system headers)...
The block containing information about the source manager.
Expr * getAddrSpaceExpr() const
helper_expr_const_range reduction_ops() const
bool DetailedRecord
Whether we should maintain a detailed record of all macro definitions and expansions.
A VariableArrayType record.
This represents 'dynamic_allocators' clause in the '#pragma omp requires' directive.
unsigned local_sloc_entry_size() const
Get the number of local SLocEntries we have.
QualType getBaseType() const
Gets the base type of this object type.
SourceLocation getBuiltinLoc() const
unsigned getLocalFastQualifiers() const
bool hasExternalDecls() const
Sema - This implements semantic analysis and AST building for C.
const unsigned int NUM_PREDEF_PP_ENTITY_IDS
The number of predefined preprocessed entity IDs.
bool hasChangedSinceDeserialization() const
Determine whether this identifier has changed since it was loaded from an AST file.
OpenMPDefaultClauseKind getDefaultKind() const
Returns kind of the clause.
unsigned NumTemplParamLists
The number of "outer" template parameter lists.
FunctionDecl * getExceptionSpecDecl() const
If this function type has an exception specification which hasn't been determined yet (either because...
Represents a prototype with parameter type info, e.g.
TentativeDefinitionsType TentativeDefinitions
All the tentative definitions encountered in the TU.
Defines the major attributes of a submodule, including its name and parent.
This represents 'threads' clause in the '#pragma omp ...' directive.
void AddDeclarationNameLoc(const DeclarationNameLoc &DNLoc, DeclarationName Name)
std::string CurrentModule
The name of the current module, of which the main source file is a part.
helper_expr_const_range destination_exprs() const
Expr * getSimdlen() const
Return safe iteration space distance.
void AddCXXTemporary(const CXXTemporary *Temp)
Emit a CXXTemporary.
helper_expr_const_range source_exprs() const
ModuleHeaderRole
Flags describing the role of a module header.
This represents clause 'aligned' in the '#pragma omp ...' directives.
OverloadedOperatorKind getOperatorKind() const
OpenMPClauseKind getClauseKind() const
Returns kind of OpenMP clause (private, shared, reduction, etc.).
SourceLocation getNameLoc() const
decl_range noload_decls() const
noload_decls_begin/end - Iterate over the declarations stored in this context that are currently load...
llvm::SmallSetVector< Module *, 2 > Imports
The set of modules imported by this module, and on which this module depends.
A table of skipped ranges within the preprocessing record.
A dependent template name that has not been resolved to a template (or set of templates).
DeclarationNameTable DeclarationNames
helper_expr_const_range private_copies() const
This represents clause 'task_reduction' in the '#pragma omp taskgroup' directives.
unsigned LocalNumSLocEntries
The number of source location entries in this AST file.
SourceLocation getLParenLoc() const
Returns the location of '('.
ObjCTypeParamDecl * getDecl() const
bool isInlineSpecified() const
A StaticAssertDecl record.
Captures information about a #pragma weak directive.
for(unsigned I=0, E=TL.getNumArgs();I !=E;++I)
ValueDecl * getAsDecl() const
Retrieve the declaration for a declaration non-type template argument.
void AddPath(StringRef Path, RecordDataImpl &Record)
Add a path to the given record.
helper_expr_const_range destination_exprs() const
OpenMPProcBindClauseKind getProcBindKind() const
Returns kind of the clause.
A VarTemplateSpecializationDecl record.
Record code for the table of offsets of each macro ID.
SourceLocation getLParenLoc() const
Returns the locaiton of '('.
unsigned getNumParams() const
unsigned getNumLoops() const
Get number of loops associated with the clause.
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...
llvm::MemoryBuffer & addBuffer(llvm::StringRef Filename, std::unique_ptr< llvm::MemoryBuffer > Buffer)
Store the Buffer under the Filename.
CharacteristicKind getFileCharacteristic() const
Return whether this is a system header or not.
An ObjCTypeParamDecl record.
Exposes information about the current target.
This represents implicit clause 'depend' for the '#pragma omp task' directive.
A record containing CXXBaseSpecifiers.
Represents an array type in C++ whose size is a value-dependent expression.
void AddAttr(const Attr *A)
const_all_num_lists_range all_num_lists() const
CommentOptions CommentOpts
Options for parsing comments.
SourceLocation getTemplateNameLoc() const
bool isCanonicalDecl() const
Whether this particular Decl is a canonical one.
Specifies some declarations with initializers that must be emitted to initialize the module...
An ObjCObjectPointerType record.
An TemplateSpecializationType record.
File is from a prebuilt module path.
QualType getElementType() const
Type source information for an attributed type.
QualType getCXXNameType() const
If this name is one of the C++ names (of a constructor, destructor, or conversion function)...
An ObjCInterfaceType record.
unsigned getNumArgs() const
Retrieve the number of template arguments.
NamespaceDecl * getAsNamespace() const
Retrieve the namespace stored in this nested name specifier.
This represents 'proc_bind' clause in the '#pragma omp ...' directive.
This represents 'capture' clause in the '#pragma omp atomic' directive.
bool isDependentType() const
Whether this declaration declares a type that is dependent, i.e., a type that somehow depends on temp...
llvm::MemoryBuffer * getBuffer(DiagnosticsEngine &Diag, const SourceManager &SM, SourceLocation Loc=SourceLocation(), bool *Invalid=nullptr) const
Returns the memory buffer for the associated content.
Describes a zlib-compressed blob that contains the data for a buffer entry.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
This represents one expression.
unsigned getModuleFileID(ModuleFile *M)
Get an ID for the given module file.
A ObjCCategoryImplDecl record.
Defines the clang::LangOptions interface.
unsigned getCounterValue() const
SourceLocation getLocalRangeEnd() const
TemplateDecl * getTemplateDecl() const
The template declaration to which this qualified name refers.
Record code for the array of VTable uses.
ObjCMethodList * getNext() const
static bool isInterestingIdentifier(ASTReader &Reader, IdentifierInfo &II, bool IsModule)
Whether the given identifier is "interesting".
QualType getucontext_tType() const
Retrieve the C ucontext_t type.
The directory that the PCH was originally created in.
SourceLocation getMapLoc() const LLVM_READONLY
Fetches location of clause mapping kind.
unsigned getAsOpaqueValue() const
A ObjCPropertyImplDecl record.
const FileEntry * getFileEntryForID(FileID FID) const
Returns the FileEntry record for the provided FileID.
This represents 'simdlen' clause in the '#pragma omp ...' directive.
Expr * getNumTasks() const
Return safe iteration space distance.
SourceLocation getScheduleKindLoc()
Get kind location.
unsigned getIndex() const
std::string WorkingDir
If set, paths are resolved as if the working directory was set to the value of WorkingDir.
NamespaceDecl * getAnonymousNamespace() const
unsigned LocalNumIdentifiers
The number of identifiers in this AST file.
void AddCXXDefinitionData(const CXXRecordDecl *D)
unsigned NumTemplateArgs
The number of template arguments in TemplateArgs.
std::string OMPHostIRFile
Name of the IR file that contains the result of the OpenMP target host code generation.
Implements an efficient mapping from strings to IdentifierInfo nodes.
Defines implementation details of the clang::SourceManager class.
bool getHasRegParm() const
StoredDeclsMap * getLookupPtr() const
Retrieve the internal representation of the lookup structure.
The template argument is a null pointer or null pointer to member that was provided for a non-type te...
SourceLocation getLParenLoc() const
Returns the location of '('.
unsigned ConfigMacrosExhaustive
Whether the set of configuration macros is exhaustive.
Record code for the table of offsets to entries in the preprocessing record.
Represents a C++ destructor within a class.
LazyDeclPtr StdNamespace
The C++ "std" namespace, where the standard library resides.
Selector getSelector() const
A CXXConstructorDecl record.
Defines version macros and version-related utility functions for Clang.
const FileEntry * ContentsEntry
References the file which the contents were actually loaded from.
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
SourceLocation getLocation() const
Return a source location identifier for the specified offset in the current file. ...
Defines the clang::Preprocessor interface.
ArgKind
The kind of template argument we're storing.
Decl * getMostRecentDecl()
Retrieve the most recent declaration that declares the same entity as this declaration (which may be ...
The block containing the detailed preprocessing record.
llvm::MapVector< IdentifierInfo *, WeakInfo > WeakUndeclaredIdentifiers
WeakUndeclaredIdentifiers - Identifiers contained in #pragma weak before declared.
Record code for #pragma diagnostic mappings.
bool isFileContext() const
serialization::TypeID GetOrCreateTypeID(QualType T)
Force a type to be emitted and get its ID.
DeclContext * getDeclContext()
A structure for storing the information associated with a substituted template template parameter...
const IdentifierInfo * getIdentifier() const
Retrieve the type named by the typename specifier as an identifier.
unsigned LocalNumMacros
The number of macros in this AST file.
SourceLocation getCaretLoc() const
A CXXStdInitializerListExpr record.
SourceLocation getEllipsisLoc() const
A record containing CXXCtorInitializers.
ArrayRef< const FileEntry * > getTopHeaders(FileManager &FileMgr)
The top-level headers associated with this module.
A VarTemplateDecl record.
NestedNameSpecifierLoc getPrefix() const
Return the prefix of this nested-name-specifier.
IdentifierResolver - Keeps track of shadowed decls on enclosing scopes.
Record code for the original file that was used to generate the AST file, including both its file ID ...
OpenMPDistScheduleClauseKind getDistScheduleKind() const
Get kind of the clause.
An ArraySubscriptExpr record.
Represents a C++ template name within the type system.
llvm::Optional< PreambleSkipInfo > getPreambleSkipInfo() const
llvm::SmallVector< LinkLibrary, 2 > LinkLibraries
The set of libraries or frameworks to link against when an entity from this module is used...
Represents the type decltype(expr) (C++11).
helper_expr_const_range rhs_exprs() const
Information about a module that has been loaded by the ASTReader.
QualType getFILEType() const
Retrieve the C FILE type.
bool isIdentifier() const
Determine whether this template name refers to an identifier.
A namespace alias, stored as a NamespaceAliasDecl*.
void AddString(StringRef Str, RecordDataImpl &Record)
Add a string to the given record.
This represents 'ordered' clause in the '#pragma omp ...' directive.
Record code for the diagnostic options table.
IdentifierInfo * getAsIdentifierInfo() const
Retrieve the IdentifierInfo * stored in this declaration name, or null if this declaration name isn't...
A CXXDestructorDecl record.
unsigned getLocalOrImportedSubmoduleID(Module *Mod)
Retrieve or create a submodule ID for this module, or return 0 if the submodule is neither local (a s...
A FunctionProtoType record.
A NonTypeTemplateParmDecl record that stores an expanded non-type template parameter pack...
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
SourceLocation getColonLoc() const
Get colon location.
Describes a source location entry (SLocEntry) for a file.
SmallVector< VTableUse, 16 > VTableUses
The list of vtables that are required but have not yet been materialized.
SourceLocation getLocalRangeBegin() const
Wrapper for source info for enum types.
A block containing a module file extension.
SourceLocation getProtocolLAngleLoc() const
clang::ObjCRuntime ObjCRuntime
std::string FileName
The file name of the module file.
A NamespaceAliasDecl record.
Record code for an update to a decl context's lookup table.
ProtocolLAngleLoc, ProtocolRAngleLoc, and the source locations for protocol qualifiers are stored aft...
Record code for #pragma ms_struct options.
void AddDeclRef(const Decl *D)
Emit a reference to a declaration.
QualType getRecordType(const RecordDecl *Decl) const
const unsigned VERSION_MINOR
AST file minor version number supported by this version of Clang.
void AddQualifierInfo(const QualifierInfo &Info)
A DesignatedInitUpdateExpr record.
void AddStmt(Stmt *S)
Add the given statement or expression to the queue of statements to emit.
SourceLocation getEnd() const
void AddSelectorRef(Selector S)
Emit a Selector (which is a smart pointer reference).
Represents a GCC generic vector type.
ArraySizeModifier getSizeModifier() const
struct CXXOpName CXXOperatorName
An lvalue reference type, per C++11 [dcl.ref].
bool isBaseOfClass() const
Determine whether this base class is a base of a class declared with the 'class' keyword (vs...
An ImplicitParamDecl record.
unsigned getNumArgs() const
Expr * getDevice()
Return device number.
bool isAvailable() const
Determine whether this module is available for use within the current translation unit...
This represents 'collapse' clause in the '#pragma omp ...' directive.
This represents clause 'firstprivate' in the '#pragma omp ...' directives.
bool isObjectLike() const
SourceLocation getCommaLoc()
Get location of ','.
unsigned SLocEntryBaseOffset
The base offset in the source manager's view of this module.
An EnumConstantDecl record.
Record code for the table of offsets of each identifier ID.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
A type, stored as a Type*.
Record code for undefined but used functions and variables that need a definition in this TU...
bool isTemplateInstantiation(TemplateSpecializationKind Kind)
Determine whether this template specialization kind refers to an instantiation of an entity (as oppos...
A DependentNameType record.
Abstract base class that writes a module file extension block into a module file. ...
SourceLocation getLocation() const
An ImportDecl recording a module import.
A ObjCCategoryDecl record.
An ObjCPropertyRefExpr record.
const ExpansionInfo & getExpansion() const
unsigned getOffset() const
FriendObjectKind getFriendObjectKind() const
Determines whether this declaration is the object of a friend declaration and, if so...
An ObjCForCollectionStmt record.
Expr * getUnderlyingExpr() const
decl_type * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
Record code for the identifier table.
bool isRecordingPreamble() const
A FileScopeAsmDecl record.
ArrayRef< Expr * > getLoopNumIterations() const
Get number of iterations for all the loops.
A ObjCCompatibleAliasDecl record.
This represents 'seq_cst' clause in the '#pragma omp atomic' directive.
helper_expr_const_range assignment_ops() const
This represents 'untied' clause in the '#pragma omp ...' directive.
TypeSourceInfo * getAsTypeSourceInfo() const
SmallVector< ExportDecl, 2 > Exports
The set of export declarations.
DelegatingCtorDeclsType DelegatingCtorDecls
All the delegating constructors seen so far in the file, used for cycle detection at the end of the T...
std::string CPU
If given, the name of the target CPU to generate code for.
A MS-style AsmStmt record.
SourceManager & getSourceManager() const
bool hasTrailingReturn() const
Whether this function prototype has a trailing return type.
const DirectoryEntry * Directory
The build directory of this module.
void AddSourceLocation(SourceLocation Loc, RecordDataImpl &Record)
Emit a source location.
void push_back(uint64_t N)
Minimal vector-like interface.
bool capturesVariable() const
Determine whether this capture handles a variable.
const unsigned int NUM_PREDEF_IDENT_IDS
The number of predefined identifier IDs.
The Objective-C 'Class' type.
This represents 'unified_address' clause in the '#pragma omp requires' directive. ...
SpecifierKind
The kind of specifier that completes this nested name specifier.
NestedNameSpecifierLoc getTemplateQualifierLoc() const
uint32_t SubmoduleID
An ID number that refers to a submodule in a module file.
SourceLocation getExpansionLocEnd() const
Defines the clang::OpenCLOptions class.
SourceLocation getLParenLoc()
Get location of '('.
NestedNameSpecifier * getQualifier() const
Return the nested name specifier that qualifies this name.
A template template parameter pack that has been substituted for a template template argument pack...
Wrapper for source info for arrays.
bool isComputedNoexcept(ExceptionSpecificationType ESpecType)
SourceLocation getColonLoc() const
Returns the location of ':'.
Record code for the set of source location entries that need to be preloaded by the AST reader...
A struct with extended info about a syntactic name qualifier, to be used for the case of out-of-line ...
This represents 'num_teams' clause in the '#pragma omp ...' directive.
Information about a FileID, basically just the logical file that it represents and include stack info...
The list of delegating constructor declarations.
Record code for types associated with OpenCL extensions.
OverloadedTemplateStorage * getAsOverloadedTemplate() const
Retrieve the underlying, overloaded function template.
SourceLocation getTemplateNameLoc() const
DeclContext::lookup_result getLookupResult()
getLookupResult - Return an array of all the decls that this list represents.
Encapsulates changes to the "macros namespace" (the location where the macro name became active...
An UnresolvedUsingValueDecl record.
serialization::TypeID BaseTypeIndex
Base type ID for types local to this module as represented in the global type ID space.
std::string ABI
If given, the name of the target ABI to use.
SourceLocation getLParenLoc()
Get location of '('.
ExtParameterInfo getExtParameterInfo(unsigned I) const
IdentifierInfo * getIdentifierInfoForSlot(unsigned argIndex) const
Retrieve the identifier at a given position in the selector.
ElaboratedTypeKeyword getKeyword() const
const ContentCache * getContentCache() const
helper_expr_const_range taskgroup_descriptors() const
serialization::IdentID BaseIdentifierID
Base identifier ID for identifiers local to this module.
const Attr * getAttr() const
The type attribute.
LazyDeclPtr StdAlignValT
The C++ "std::align_val_t" enum class, which is defined by the C++ standard library.
unsigned getTotalComponentListNum() const
Return the number of lists derived from the clause expressions.
SourceLocation getEllipsisLoc() const
Retrieve the location of the ellipsis for a capture that is a pack expansion.
Encodes a location in the source.
ObjCInterfaceDecl * getDecl() const
Get the declaration of this interface.
SourceLocation getStarLoc() const
Sugar for parentheses used when specifying types.
QualType getAdjustedType() const
QualType getReturnType() const
This represents 'hint' clause in the '#pragma omp ...' directive.
SourceLocation CurrentPragmaLocation
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums...
void AddTemplateArgumentLocInfo(TemplateArgument::ArgKind Kind, const TemplateArgumentLocInfo &Arg)
Emits a template argument location info.
StringRef getName() const
FileSystemOptions & getFileSystemOpts()
Returns the current file system options.
A record that stores the set of declarations that are visible from a given DeclContext.
Specifies a library or framework to link against.
Record code for file ID of the file or buffer that was used to generate the AST file.
Represents a C++ temporary.
Represents typeof(type), a GCC extension.
Interfaces are the core concept in Objective-C for object oriented design.
Specifies a header that falls into this (sub)module.
std::string ImplicitPCHInclude
The implicit PCH included at the start of the translation unit, or empty.
std::string ExportAsModule
The module through which entities defined in this module will eventually be exposed, for use in "private" modules.
A structure for storing an already-substituted template template parameter pack.
private_copies_range private_copies()
Record code for special CUDA declarations.
MacroDirective * getLocalMacroDirectiveHistory(const IdentifierInfo *II) const
Given an identifier, return the latest non-imported macro directive for that identifier.
Options for controlling the compiler diagnostics engine.
A list of "interesting" identifiers.
The block of configuration options, used to check that a module is being used in a configuration comp...
void AddDeclarationName(DeclarationName Name)
Emit a declaration name.
unsigned IsSystemFile
True if this content cache was initially created for a source file considered as a system one...
DeclarationName getName() const
getName - Returns the embedded declaration name.
void AddOffset(uint64_t BitOffset)
Add a bit offset into the record.
Represents the declaration of a struct/union/class/enum.
TemplateArgument getArgumentPack() const
This represents 'schedule' clause in the '#pragma omp ...' directive.
ASTContext & getASTContext() const LLVM_READONLY
CallingConv getCC() const
QualType getElementType() const
IdentifierInfo * getIdentifierInfo() const
Defines several types used to describe C++ lambda expressions that are shared between the parser and ...
virtual void writeExtensionContents(Sema &SemaRef, llvm::BitstreamWriter &Stream)=0
Write the contents of the extension block into the given bitstream.
This is so that older clang versions, before the introduction of the control block, can read and reject the newer PCH format.
IdentifierTable & getIdentifierTable()
SourceLocation getLParenLoc() const
Returns the location of '('.
This represents clause 'shared' in the '#pragma omp ...' directives.
Represents a vector type where either the type or size is dependent.
TagDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
SourceLocation getProcBindKindKwLoc() const
Returns location of clause kind.
Cached information about one file (either on disk or in the virtual file system). ...
Metadata describing this particular extension.
const SrcMgr::SLocEntry & getLocalSLocEntry(unsigned Index, bool *Invalid=nullptr) const
Get a local SLocEntry. This is exposed for indexing.
static bool shouldIgnoreMacro(MacroDirective *MD, bool IsModule, const Preprocessor &PP)
An ObjCTypeParamType record.
SmallVector< Header, 2 > Headers[5]
The headers that are part of this module.
A CXXFunctionalCastExpr record.
std::vector< std::string > Remarks
The list of -R...
A FloatingLiteral record.
Record code for the offsets of each decl.
Metadata for submodules as a whole.
Expr * getPriority()
Return Priority number.
SourceLocation getFileLoc(SourceLocation Loc) const
Given Loc, if it is a macro location return the expansion location or the spelling location...
bool isModuleMap(CharacteristicKind CK)
Determine whether a file characteristic is for a module map.
void AddTemplateArgument(const TemplateArgument &Arg)
Emit a template argument.
An ObjCEncodeExpr record.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
std::string getClangFullRepositoryVersion()
Retrieves the full repository version that is an amalgamation of the information in getClangRepositor...
Record code for late parsed template functions.
A dependentSizedVectorType record.
const char * getNameStart() const
Return the beginning of the actual null-terminated string for this identifier.
OpenMPMapClauseKind getMapType() const LLVM_READONLY
Fetches mapping kind for the clause.
SourceLocation getRParenLoc() const
bool isPackExpansion() const
Determine whether this base specifier is a pack expansion.
Defines the clang::TargetOptions class.
A TemplateTypeParmDecl record.
bool isParameterPack() const
bool isPoisoned() const
Return true if this token has been poisoned.
An ImaginaryLiteral record.
Expr * getLoopCounter(unsigned NumLoop)
Get loops counter for the specified loop.
std::vector< std::string > Features
The list of target specific features to enable or disable – this should be a list of strings startin...
unsigned LocalNumDecls
The number of declarations in this AST file.
ObjCCategoryDecl - Represents a category declaration.
unsigned pack_size() const
The number of template arguments in the given template argument pack.
This is a basic class for representing single OpenMP clause.
const TemplateTypeParmType * getReplacedParameter() const
Gets the template parameter that was substituted for.
bool SawDateOrTime() const
Returns true if the preprocessor has seen a use of DATE or TIME in the file so far.
QualType getEquivalentType() const
Expr * getNoexceptExpr() const
Return the expression inside noexcept(expression), or a null pointer if there is none (because the ex...
The internal 'instancetype' typedef.
SourceLocation getStarLoc() const
void AddNestedNameSpecifier(NestedNameSpecifier *NNS)
Emit a nested name specifier.
serialization::TypeID getTypeID(QualType T) const
Determine the type ID of an already-emitted type.
QualType getInnerType() const
IdentifierInfo * getIdentifier() const
Describes the categories of an Objective-C class.
The AST block, which acts as a container around the full AST block.
SourceLocation getNameModifierLoc() const
Return the location of directive name modifier.
A DeducedTemplateSpecializationType record.
bool isFromASTFile() const
Determine whether this declaration came from an AST file (such as a precompiled header or module) rat...
uint32_t TypeID
An ID number that refers to a type in an AST file.
NestedNameSpecifier * getQualifier() const
Retrieve the qualification on this type.
void AddAttributes(ArrayRef< const Attr *> Attrs)
Emit a list of attributes.
std::vector< std::string > FeaturesAsWritten
The list of target specific features to enable or disable, as written on the command line...
const unsigned int DECL_UPDATES
Record of updates for a declaration that was modified after being deserialized.
const LangOptions & getLangOpts() const
void AddVersionTuple(const VersionTuple &Version, RecordDataImpl &Record)
Add a version tuple to the given record.
void updateOutOfDateSelector(Selector Sel)
void AddSourceLocation(SourceLocation Loc)
Emit a source location.
Expr * getNumForLoops() const
Return the number of associated for-loops.
AutoTypeKeyword getKeyword() const
TypeClass getTypeClass() const
static void emitBlob(llvm::BitstreamWriter &Stream, StringRef Blob, unsigned SLocBufferBlobCompressedAbbrv, unsigned SLocBufferBlobAbbrv)
void AddDeclRef(const Decl *D, RecordDataImpl &Record)
Emit a reference to a declaration.
An InjectedClassNameType record.
llvm::APSInt getAsIntegral() const
Retrieve the template argument as an integral value.
Record code for the extra statistics we gather while generating an AST file.
SourceLocation getRAngleLoc() const
FunctionDecl * getcudaConfigureCallDecl()
SourceLocation getRAngleLoc() const
bool isC99Varargs() const
SourceLocation getExpansionLocStart() const
const_all_lists_sizes_range all_lists_sizes() const
SourceRange getBracketsRange() const
An array of decls optimized for the common case of only containing one entry.
void AddAPFloat(const llvm::APFloat &Value)
Emit a floating-point value.
uint32_t PreprocessedEntityID
An ID number that refers to an entity in the detailed preprocessing record.
bool PreparePathForOutput(SmallVectorImpl< char > &Path)
Convert a path from this build process into one that is appropriate for emission in the module file...
const VersionTuple & getVersion() const
Optional< unsigned > getNumExpansions() const
Retrieve the number of expansions that this pack expansion will generate, if known.
unsigned LocalNumSubmodules
The number of submodules in this module.
TypeSourceInfo * getTypeSourceInfo() const
Retrieves the type and source location of the base class.
unsigned ComputeHash(Selector Sel)
SourceLocation getLParenLoc() const
Returns the location of '('.
helper_expr_const_range lhs_exprs() const
DependentTemplateName * getAsDependentTemplateName() const
Retrieve the underlying dependent template name structure, if any.
Record code for the signature that identifiers this AST file.
Record code for referenced selector pool.
ExceptionSpecificationType getExceptionSpecType() const
Get the kind of exception specification on this function.
std::vector< std::string > MacroIncludes
Represents a pointer type decayed from an array or function type.
const MacroInfo * getMacroInfo() const
void AddDeclarationNameInfo(const DeclarationNameInfo &NameInfo)
The injected class name of a C++ class template or class template partial specialization.
Record code for the set of non-builtin, special types.
QualType getPointeeType() const
A ObjCProtocolDecl record.
Represents a pack expansion of types.
OpenMPDirectiveKind getCaptureRegion() const
Get capture region for the stmt in the clause.
ArrayRef< TemplateArgument > pack_elements() const
Iterator range referencing all of the elements of a template argument pack.
Defines various enumerations that describe declaration and type specifiers.
DeclarationNameLoc - Additional source/type location info for a declaration name. ...
ArrayRef< Decl * > getModuleInitializers(Module *M)
Get the initializations to perform when importing a module, if any.
StringRef getName() const
Return the actual identifier string.
const TemplateArgumentLoc * getTemplateArgs() const
Retrieve the template arguments.
static void addExceptionSpec(const FunctionProtoType *T, ASTRecordWriter &Record)
void VisitOMPClauseWithPreInit(OMPClauseWithPreInit *C)
SourceRange getRange() const
Base class for declarations which introduce a typedef-name.
void SetIdentifierOffset(const IdentifierInfo *II, uint32_t Offset)
Note that the identifier II occurs at the given offset within the identifier table.
unsigned LocalNumSelectors
The number of selectors new to this file.
unsigned getObjCOrBuiltinID() const
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
SourceLocation getTypeofLoc() const
Represents a template argument.
Record code for the list of other AST files imported by this AST file.
A CXXConversionDecl record.
Describes a macro definition within the preprocessing record.
void VisitOMPClauseWithPostUpdate(OMPClauseWithPostUpdate *C)
Represents a type which was implicitly adjusted by the semantic engine for arbitrary reasons...
TypeSourceInfo * getClassTInfo() const
Represents a template name that was expressed as a qualified name.
The internal '__NSConstantString' typedef.
Record code for the module name.
uint32_t SelectorID
An ID number that refers to an ObjC selector in an AST file.
void writeClause(OMPClause *C)
Dataflow Directional Tag Classes.
SourceLocation getColonLoc() const
Get colon location.
This represents 'device' clause in the '#pragma omp ...' directive.
NestedNameSpecifier * getNestedNameSpecifier() const
Retrieve the nested-name-specifier to which this instance refers.
SourceLocation getRBracketLoc() const
An IntegerLiteral record.
Describes an inclusion directive within the preprocessing record.
SourceLocation ImplicitMSInheritanceAttrLoc
Source location for newly created implicit MSInheritanceAttrs.
The internal '__builtin_ms_va_list' typedef.
OpenMPDefaultmapClauseKind getDefaultmapKind() const
Get kind of the clause.
ExtInfo getExtInfo() const
const TemplateArgument & getArgument() const
unsigned getNumTokens() const
Return the number of tokens that this macro expands to.
not evaluated yet, for special member function
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
NestedNameSpecifier * getQualifier() const
Record code for a file sorted array of DeclIDs in a module.
A CXXBoolLiteralExpr record.
Record code for the array of Objective-C categories (including extensions).
SourceLocation getTemplateNameLoc() const
Specifies a configuration macro for this module.
virtual ModuleFileExtensionMetadata getExtensionMetadata() const =0
Retrieves the metadata for this module file extension.
helper_expr_const_range privates() const
bool isInitKnownICE() const
Determines whether it is already known whether the initializer is an integral constant expression or ...
bool UsePredefines
Initialize the preprocessor with the compiler and target specific predefines.
QualType getType() const
Get the type for which this source info wrapper provides information.
An ExtVectorElementExpr record.
The template argument is a pack expansion of a template name that was provided for a template templat...
Record code for the array of unused file scoped decls.
void AddCXXBaseSpecifiers(ArrayRef< CXXBaseSpecifier > Bases)
Emit a set of C++ base specifiers.
PreprocessingRecord * getPreprocessingRecord() const
Retrieve the preprocessing record, or NULL if there is no preprocessing record.
llvm::iterator_range< submodule_iterator > submodules()
A FunctionNoProtoType record.
std::vector< llvm::Triple > OMPTargetTriples
Triples of the OpenMP targets that the host code codegen should take into account in order to generat...
Reads an AST files chain containing the contents of a translation unit.
File is an explicitly-loaded module.
ArrayRef< KnownHeader > findAllModulesForHeader(const FileEntry *File) const
Retrieve all the modules that contain the given header file.
A ClassTemplatePartialSpecializationDecl record.
const_all_components_range all_components() const
An ObjCIvarRefExpr record.
TemplateArgumentLoc getArgLoc(unsigned i) const
ModuleFileExtension * getExtension() const
Retrieve the module file extension with which this writer is associated.
const Expr * getInit() const
ObjCInterfaceDecl * getDefinition()
Retrieve the definition of this class, or NULL if this class has been forward-declared (with @class) ...
FileID getMainFileID() const
Returns the FileID of the main source file.
QualType getUnderlyingType() const
LambdaCaptureKind getCaptureKind() const
Determine the kind of capture.
SourceLocation getRAngleLoc() const
void AddCXXCtorInitializers(ArrayRef< CXXCtorInitializer *> CtorInits)
Emit a CXXCtorInitializer array.
The name of a declaration.
A ClassScopeFunctionSpecializationDecl record a class scope function specialization.
VectorKind getVectorKind() const
Record code for the Objective-C method pool,.
bool isExtensionToken() const
get/setExtension - Initialize information about whether or not this language token is an extension...
static unsigned CreateSLocBufferAbbrev(llvm::BitstreamWriter &Stream)
Create an abbreviation for the SLocEntry that refers to a buffer.
A CharacterLiteral record.
Specifies a header that is private to this submodule.
SourceLocation getLParenLoc()
Get location of '('.
A LinkageSpecDecl record.
Describes a macro expansion within the preprocessing record.
An ObjCStringLiteral record.
A CXXDynamicCastExpr record.
This represents 'unified_shared_memory' clause in the '#pragma omp requires' directive.
This represents clause 'linear' in the '#pragma omp ...' directives.
A CXXForRangeStmt record.
SourceLocation LAngleLoc
The source location of the left angle bracket ('<').
void * getFETokenInfo() const
Get and set FETokenInfo.
SourceLocation getLocation() const
A pointer to member type per C++ 8.3.3 - Pointers to members.
IdentifierResolver IdResolver
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspnd...
An RValueReferenceType record.
OpenMPDefaultmapClauseModifier getDefaultmapModifier() const
Get the modifier of the clause.
SourceLocation getBeginLoc() const
Returns the starting location of the clause.
A type that was preceded by the 'template' keyword, stored as a Type*.
const TemplateTypeParmType * getReplacedParameter() const
Gets the template parameter that was substituted for.
bool isHidden() const
Determine whether this declaration might be hidden from name lookup.
SourceLocation getLParenLoc() const
Returns the location of '('.
unsigned getLength() const
uint32_t DeclID
An ID number that refers to a declaration in an AST file.
An ObjCAtFinallyStmt record.
NestedNameSpecifierLoc getQualifierLoc() const
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...
SourceLocation getElaboratedKeywordLoc() const
QualType getModifiedType() const
unsigned getNumParams() const
SourceLocation getRBracketLoc() const
SourceLocation getEndLoc() const
Returns the ending location of the clause.
Represents a pointer to an Objective C object.
helper_expr_const_range privates() const
Number of unmatched #pragma clang cuda_force_host_device begin directives we've seen.
unsigned ModuleMapIsPrivate
Whether this module came from a "private" module map, found next to a regular (public) module map...
Encapsulates the data about a macro definition (e.g.
Capturing variable-length array type.
A PragmaCommentDecl record.
FileID getFileID(SourceLocation SpellingLoc) const
Return the FileID for a SourceLocation.
struct CXXLitOpName CXXLiteralOperatorName
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
Complex values, per C99 6.2.5p11.
Location wrapper for a TemplateArgument.
unsigned getIndexTypeCVRQualifiers() const
unsigned getNumArgs() const
Retrieve the number of template arguments.
std::vector< Conflict > Conflicts
The list of conflicts.
TypeSourceInfo * getTypeArgTInfo(unsigned i) const
SourceLocation getLParenLoc() const
Returns the location of '('.
Record code for the table of offsets into the Objective-C method pool.
OpenMPDirectiveKind getNameModifier() const
Return directive name modifier associated with the clause.
QualType getCanonicalTypeInternal() const
Defines the clang::FileSystemOptions interface.
A DependentSizedArrayType record.
Record code for the remapping information used to relate loaded modules to the various offsets and ID...
An ObjCAtSynchronizedStmt record.
SourceLocation getTemplateNameLoc() const
uint32_t IdentID
An ID number that refers to an identifier in an AST file.
A key used when looking up entities by DeclarationName.
helper_expr_const_range destination_exprs() const
SourceLocation getKWLoc() const
SourceLocation getRParenLoc() const
An UnresolvedSet-like class which uses the ASTContext's allocator.
Record code for declarations that Sema keeps references of.
const llvm::APInt & getSize() const
A SizefAlignOfExpr record.
const unsigned int NUM_PREDEF_MACRO_IDS
The number of predefined macro IDs.
SourceLocation getLParenLoc() const
Returns the location of '('.
bool WriteCommentListToPCH
Whether to write comment locations into the PCH when building it.
Offsets into the input-files block where input files reside.
A CXXMemberCallExpr record.
ExtVectorType - Extended vector type.
SourceLocation getColonLoc() const
Gets location of ':' symbol in clause.
SourceLocation getProtocolLoc(unsigned i) const
Expr * getSizeExpr() const
void AddAPSInt(const llvm::APSInt &Value)
Emit a signed integral value.
unsigned getGlobalID() const
Retrieve the global declaration ID associated with this declaration, which specifies where this Decl ...
DeclContext * getRedeclContext()
getRedeclContext - Retrieve the context in which an entity conflicts with other entities of the same ...
The block containing the submodule structure.
Wrapper for source info for record types.
ObjCInterfaceDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this Objective-C class.
SourceLocation getLBracketLoc() const
The template argument is a type.
DirectoryName getUmbrellaDir() const
Retrieve the directory for which this module serves as the umbrella.
Wraps an ObjCPointerType with source location information.
QualType getUnderlyingType() const
unsigned getNumArgs() const
SourceLocation getDefinitionLoc() const
Return the location that the macro was defined at.
SourceLocation getDistScheduleKindLoc()
Get kind location.
ObjCXXARCStandardLibraryKind ObjCXXARCStandardLibrary
The Objective-C++ ARC standard library that we should support, by providing appropriate definitions t...
serialization::SelectorID getSelectorRef(Selector Sel)
Get the unique number used to refer to the given selector.
The template argument is actually a parameter pack.
serialization::PreprocessedEntityID BasePreprocessedEntityID
Base preprocessed entity ID for preprocessed entities local to this module.
bool isBeingDefined() const
Determines whether this type is in the process of being defined.
const DeclarationNameInfo & getNameInfo() const
Gets the name info for specified reduction identifier.
Capturing the *this object by reference.
void EmitRecordWithPath(unsigned Abbrev, RecordDataRef Record, StringRef Path)
Emit the current record with the given path as a blob.
Represents a base class of a C++ class.
PreprocessorOptions & getPreprocessorOpts() const
Retrieve the preprocessor options used to initialize this preprocessor.
This represents 'write' clause in the '#pragma omp atomic' directive.
SourceLocation getLParenLoc() const
unsigned BufferOverridden
Indicates whether the buffer itself was provided to override the actual file contents.
const SrcMgr::SLocEntry & getSLocEntry(FileID FID, bool *Invalid=nullptr) const
SourceManager & getSourceManager()
Keeps track of options that affect how file operations are performed.
SourceLocation getLParenLoc() const
Returns the location of '('.
SourceLocation getDefinitionEndLoc() const
Return the location of the last token in the macro.
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
EnumDecl * getStdAlignValT() const
A template argument list.
SourceLocation getModuleImportLoc(Module *M) const
VectorType::VectorKind getVectorKind() const
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
TypedefNameDecl * getDecl() const
SourceLocation getLAngleLoc() const
SourceLocation getTypeArgsLAngleLoc() const
SourceLocation getLParenLoc() const
Returns the location of '('.
NestedNameSpecifierLoc QualifierLoc
known_categories_iterator known_categories_end() const
Retrieve an iterator to the end of the known-categories list.
ArgKind getKind() const
Return the kind of stored template argument.
unsigned getDepth() const
An attributed type is a type to which a type attribute has been applied.
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
QualType getParamType(unsigned i) const
TemplateDecl * getCXXDeductionGuideTemplate() const
If this name is the name of a C++ deduction guide, return the template associated with that name...
const DeclarationNameInfo & getNameInfo() const
Gets the name info for specified reduction identifier.
Represents a type parameter type in Objective C.
OpenMPScheduleClauseModifier getSecondScheduleModifier() const
Get the second modifier of the clause.
TranslationUnitDecl * getTranslationUnitDecl() const
Defines the clang::SourceLocation class and associated facilities.
bool hasRevertedTokenIDToIdentifier() const
True if revertTokenIDToIdentifier() was called.
A GCC-style AsmStmt record.
void SetSelectorOffset(Selector Sel, uint32_t Offset)
Note that the selector Sel occurs at the given offset within the method pool/selector table...
This represents 'nowait' clause in the '#pragma omp ...' directive.
unsigned InferSubmodules
Whether we should infer submodules for this module based on the headers.
Represents a C++ struct/union/class.
Represents a template specialization type whose template cannot be resolved, e.g. ...
FileID getPredefinesFileID() const
Returns the FileID for the preprocessor predefines.
OpenMPScheduleClauseModifier getFirstScheduleModifier() const
Get the first modifier of the clause.
DiagnosticsEngine & getDiagnostics() const
An TemplateTypeParmType record.
This represents 'num_tasks' clause in the '#pragma omp ...' directive.
Decl * D
The template function declaration to be late parsed.
The template argument is a template name that was provided for a template template parameter...
Represents a C array with an unspecified size.
TemplateArgumentLocInfo getLocInfo() const
SourceLocation getEllipsisLoc() const
For a pack expansion, determine the location of the ellipsis.
OpenMPScheduleClauseKind getScheduleKind() const
Get kind of the clause.
Record code for the filesystem options table.
An object for streaming information to a record.
static void AddLazyVectorDecls(ASTWriter &Writer, Vector &Vec, ASTWriter::RecordData &Record)
An ObjCAtCatchStmt record.
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...
bool needsAnonymousDeclarationNumber(const NamedDecl *D)
Determine whether the given declaration needs an anonymous declaration number.
A ObjCImplementationDecl record.
QualType getNamedType() const
Retrieve the type named by the qualified-id.
LangOptions::PragmaMSPointersToMembersKind MSPointerToMemberRepresentationMethod
Controls member pointer representation format under the MS ABI.
SourceLocation getFirstScheduleModifierLoc() const
Get the first modifier location.
A structure for storing the information associated with an overloaded template name.
ASTFileSignature WriteAST(Sema &SemaRef, const std::string &OutputFile, Module *WritingModule, StringRef isysroot, bool hasErrors=false)
Write a precompiled header for the given semantic analysis.
unsigned getNumProtocols() const
helper_expr_const_range reduction_ops() const
bool isBuiltinMacro() const
Return true if this macro requires processing before expansion.
QualType getReplacementType() const
Gets the type that was substituted for the template parameter.
Location information for a TemplateArgument.
A ObjCAtDefsFieldDecl record.
Declaration of a class template.
Record code for the offsets of each type.
A DependentAddressSpaceType record.
Expr * getThreadLimit()
Return ThreadLimit number.
The block containing the definitions of all of the types and decls used within the AST file...
The internal '__va_list_tag' struct, if any.
This class is used for builtin types like 'int'.
Writes an AST file containing the contents of a translation unit.
Decl * getLambdaContextDecl() const
Retrieve the declaration that provides additional context for a lambda, when the normal declaration c...
TypeLoc getTypeLoc() const
For a nested-name-specifier that refers to a type, retrieve the type with source-location information...
bool hasRecordedPreamble() const
serialization::DeclID getDeclID(const Decl *D)
Determine the declaration ID of an already-emitted declaration.
const unsigned int LOCAL_REDECLARATIONS
Record code for a list of local redeclarations of a declaration.
void AddCXXBaseSpecifier(const CXXBaseSpecifier &Base)
Emit a C++ base specifier.
void AddASTTemplateArgumentListInfo(const ASTTemplateArgumentListInfo *ASTTemplArgList)
Emits an AST template argument list info.
SourceLocation getLocation() const
Retrieve the source location of the capture.
void AddAPInt(const llvm::APInt &Value)
Emit an integral value.
LineTableInfo & getLineTable()
Retrieve the stored line table.
Specifies the name of the module that will eventually re-export the entities in this module...
Defines the clang::TargetInfo interface.
MacroDefinitionRecord * findMacroDefinition(const MacroInfo *MI)
Retrieve the macro definition that corresponds to the given MacroInfo.
SourceLocation getNameLoc() const
ArrayRef< ModuleMacro * > getLeafModuleMacros(const IdentifierInfo *II) const
Get the list of leaf (non-overridden) module macros for a name.
a linked list of methods with the same selector name but different signatures.
Specifies a required feature.
This represents 'dist_schedule' clause in the '#pragma omp ...' directive.
SourceRange getAttrOperandParensRange() const
The location of the parentheses around the operand, if there is an operand.
std::vector< std::string > ConfigMacros
The set of "configuration macros", which are macros that (intentionally) change how this module is bu...
An ObjCMessageExpr record.
bool isGNUVarargs() const
QualType getjmp_bufType() const
Retrieve the C jmp_buf type.
__DEVICE__ int max(int __a, int __b)
unsigned getNumTypeArgs() const
unsigned getNumElements() const
Expr * getHint() const
Returns number of threads.
NestedNameSpecifierLoc getQualifierLoc() const
Gets the nested name specifier.
Record for offsets of DECL_UPDATES records for declarations that were modified after being deserializ...
SourceLocation getAmpLoc() const
The top declaration context.
A CompoundAssignOperator record.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
QualType getAsType() const
Retrieve the type for a type template argument.
void AddTemplateArgumentList(const TemplateArgumentList *TemplateArgs)
Emit a template argument list.
Represents an extended address space qualifier where the input address space value is dependent...
Represents a type template specialization; the template must be a class template, a type alias templa...
static unsigned CreateSLocBufferBlobAbbrev(llvm::BitstreamWriter &Stream, bool Compressed)
Create an abbreviation for the SLocEntry that refers to a buffer's blob.
NestedNameSpecifierLoc getQualifierLoc() const
Gets the nested name specifier.
DeclContext * getPrimaryContext()
getPrimaryContext - There may be many different declarations of the same entity (including forward de...
A FunctionTemplateDecl record.
Expr * getChunkSize()
Get chunk size.
llvm::DenseMap< CXXRecordDecl *, bool > VTablesUsed
The set of classes whose vtables have been used within this translation unit, and a bit that will be ...
A TypeAliasTemplateDecl record.
Contains a late templated function.
SourceLocation getAttrNameLoc() const
The location of the attribute name, i.e.
Record code for weak undeclared identifiers.
The block containing information about the preprocessor.
Expr * getNumThreads() const
Returns number of threads.
void AddTemplateName(TemplateName Name)
Emit a template name.
PragmaStack< unsigned > PackStack
TypeSpecifierType getWrittenTypeSpec() const
void AddTemplateArgumentLoc(const TemplateArgumentLoc &Arg)
Emits a template argument location.
IdentifierInfo * getCXXLiteralIdentifier() const
If this name is the name of a literal operator, retrieve the identifier associated with it...
AccessSpecifier getAccessSpecifierAsWritten() const
Retrieves the access specifier as written in the source code (which may mean that no access specifier...
Wrapper for source info for builtin types.
TemplateArgument getArgumentPack() const
Retrieve the template template argument pack with which this parameter was substituted.
bool isUnresolvedExceptionSpec(ExceptionSpecificationType ESpecType)
void VisitFunctionType(const FunctionType *T)
A set of overloaded template declarations.
Wrapper for template type parameters.
Record code for the headers search options table.
A trivial tuple used to represent a source range.
unsigned getFlags() const
Return the internal represtation of the flags.
known_categories_iterator known_categories_begin() const
Retrieve an iterator to the beginning of the known-categories list.
This represents a decl that may have a name.
bool isTranslationUnit() const
SourceLocation getLParenLoc() const
Returns the location of '('.
AST file metadata, including the AST file version number and information about the compiler used to b...
static void EmitRecordID(unsigned ID, const char *Name, llvm::BitstreamWriter &Stream, ASTWriter::RecordDataImpl &Record)
The block of input files, which were used as inputs to create this AST file.
FunctionDecl * getExceptionSpecTemplate() const
If this function type has an uninstantiated exception specification, this is the function whose excep...
unsigned IsExplicit
Whether this is an explicit submodule.
Represents a C array with a specified size that is not an integer-constant-expression.
void numberAnonymousDeclsWithin(const DeclContext *DC, Fn Visit)
Visit each declaration within DC that needs an anonymous declaration number and call Visit with the d...
unsigned LocalNumTypes
The number of types in this AST file.
NestedNameSpecifierLoc getQualifierLoc() const
SourceRange getSourceRange() const LLVM_READONLY
Retrieves the source range that contains the entire base specifier.
The internal '__NSConstantString' tag type.
SourceLocation getAttributeLoc() const
bool isInline() const
Whether this variable is (C++1z) inline.
A function-like macro definition.
QualType getElementType() const
attr::Kind getKind() const
The Objective-C 'Protocol' type.
const Expr * getPostUpdateExpr() const
Get post-update expression for the clause.
SourceLocation getLParenLoc() const
Returns the location of '('.
The global specifier '::'. There is no stored value.
TemplateName getAsTemplateOrTemplatePattern() const
Retrieve the template argument as a template name; if the argument is a pack expansion, return the pattern as a template name.
The control block, which contains all of the information that needs to be validated prior to committi...
OpenMPAtomicDefaultMemOrderClauseKind getAtomicDefaultMemOrderKind() const
Returns kind of the clause.
Wrapper for source info for pointers.
SourceLocation getBegin() const
SmallVector< Slot, 2 > Stack
std::string Triple
The name of the target triple to compile for.
const LangOptions & getLangOpts() const
Wrapper for source info for block pointers.
DiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID) const
Forwarding function for diagnostics.
This class handles loading and caching of source files into memory.
Represents the canonical version of C arrays with a specified constant size.
PredefinedDeclIDs
Predefined declaration IDs.
Declaration of a template function.
iterator - Iterate over the decls of a specified declaration name.
Record code for an update to the TU's lexically contained declarations.
bool isUsedForHeaderGuard() const
Determine whether this macro was used for a header guard.
A class which abstracts out some details necessary for making a call.
A GenericSelectionExpr record.
A type index; the type ID with the qualifier bits removed.
Attr - This represents one attribute.
SourceLocation getLocation() const
This represents clause 'use_device_ptr' in the '#pragma omp ...' directives.
SourceLocation getTypeArgsRAngleLoc() const
QualType getPointeeType() const
A PackExpansionType record.
QualType getType() const
Return the type wrapped by this type source info.
A single template declaration.
const unsigned int NUM_PREDEF_SUBMODULE_IDS
The number of predefined submodule IDs.
std::pair< FileID, unsigned > getDecomposedLoc(SourceLocation Loc) const
Decompose the specified location into a raw FileID + Offset pair.
Defines the LambdaCapture class.
unsigned InferExplicitSubmodules
Whether, when inferring submodules, the inferred submodules should be explicit.
Record code for #pragma ms_struct options.
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
const IdentifierInfo * getIdentifier() const
A DependentTemplateSpecializationType record.
Expr * getSizeExpr() const
bool hasLineTable() const
Determine if the source manager has a line table.
StringRef getName() const
ArrayRef< const IdentifierInfo * > params() const
Record code for the array of tentative definitions.
iterator local_begin()
Begin iterator for local, non-loaded, preprocessed entities.
QualType getPointeeType() const
Gets the type pointed to by this ObjC pointer.