44 #include "llvm/ADT/APFloat.h"
45 #include "llvm/ADT/APInt.h"
46 #include "llvm/ADT/Hashing.h"
47 #include "llvm/ADT/StringExtras.h"
48 #include "llvm/Bitcode/BitstreamWriter.h"
49 #include "llvm/Support/EndianStream.h"
50 #include "llvm/Support/FileSystem.h"
51 #include "llvm/Support/MemoryBuffer.h"
52 #include "llvm/Support/OnDiskHashTable.h"
53 #include "llvm/Support/Path.h"
54 #include "llvm/Support/Process.h"
59 using namespace clang;
60 using namespace clang::serialization;
62 template <
typename T,
typename Allocator>
63 static StringRef
bytes(
const std::vector<T, Allocator> &
v) {
64 if (v.empty())
return StringRef();
65 return StringRef(reinterpret_cast<const char*>(&v[0]),
66 sizeof(T) * v.size());
71 return StringRef(reinterpret_cast<const char*>(v.data()),
72 sizeof(T) * v.size());
95 void VisitTagType(
const TagType *T);
97 #define TYPE(Class, Base) void Visit##Class##Type(const Class##Type *T);
98 #define ABSTRACT_TYPE(Class, Base)
99 #include "clang/AST/TypeNodes.def"
103 void ASTTypeWriter::VisitBuiltinType(
const BuiltinType *T) {
104 llvm_unreachable(
"Built-in types are never serialized");
107 void ASTTypeWriter::VisitComplexType(
const ComplexType *T) {
112 void ASTTypeWriter::VisitPointerType(
const PointerType *T) {
117 void ASTTypeWriter::VisitDecayedType(
const DecayedType *T) {
122 void ASTTypeWriter::VisitAdjustedType(
const AdjustedType *T) {
150 void ASTTypeWriter::VisitArrayType(
const ArrayType *T) {
158 Writer.AddAPInt(T->
getSize(), Record);
175 void ASTTypeWriter::VisitVectorType(
const VectorType *T) {
182 void ASTTypeWriter::VisitExtVectorType(
const ExtVectorType *T) {
187 void ASTTypeWriter::VisitFunctionType(
const FunctionType *T) {
194 Record.push_back(C.
getCC());
202 VisitFunctionType(T);
224 VisitFunctionType(T);
233 for (
unsigned I = 0, N = T->
getNumParams(); I != N; ++I)
244 Writer.AddDeclRef(T->
getDecl(), Record);
248 void ASTTypeWriter::VisitTypedefType(
const TypedefType *T) {
249 Writer.AddDeclRef(T->
getDecl(), Record);
255 void ASTTypeWriter::VisitTypeOfExprType(
const TypeOfExprType *T) {
260 void ASTTypeWriter::VisitTypeOfType(
const TypeOfType *T) {
265 void ASTTypeWriter::VisitDecltypeType(
const DecltypeType *T) {
278 void ASTTypeWriter::VisitAutoType(
const AutoType *T) {
286 void ASTTypeWriter::VisitTagType(
const TagType *T) {
290 "Cannot serialize in the middle of a type definition");
293 void ASTTypeWriter::VisitRecordType(
const RecordType *T) {
298 void ASTTypeWriter::VisitEnumType(
const EnumType *T) {
303 void ASTTypeWriter::VisitAttributedType(
const AttributedType *T) {
311 ASTTypeWriter::VisitSubstTemplateTypeParmType(
319 ASTTypeWriter::VisitSubstTemplateTypeParmPackType(
327 ASTTypeWriter::VisitTemplateSpecializationType(
333 ArgI != ArgE; ++ArgI)
334 Writer.AddTemplateArgument(*ArgI, Record);
337 : T->getCanonicalTypeInternal(),
351 ASTTypeWriter::VisitDependentSizedExtVectorType(
354 llvm_unreachable(
"Cannot serialize dependent sized extended vector types");
362 Writer.AddDeclRef(T->
getDecl(), Record);
369 Writer.AddNestedNameSpecifier(T->
getQualifier(), Record);
372 : T->getCanonicalTypeInternal(),
378 ASTTypeWriter::VisitDependentTemplateSpecializationType(
381 Writer.AddNestedNameSpecifier(T->
getQualifier(), Record);
385 I = T->
begin(), E = T->
end(); I != E; ++I)
386 Writer.AddTemplateArgument(*I, Record);
393 Record.push_back(*NumExpansions + 1);
399 void ASTTypeWriter::VisitParenType(
const ParenType *T) {
404 void ASTTypeWriter::VisitElaboratedType(
const ElaboratedType *T) {
406 Writer.AddNestedNameSpecifier(T->
getQualifier(), Record);
422 void ASTTypeWriter::VisitObjCObjectType(
const ObjCObjectType *T) {
426 Writer.AddTypeRef(TypeArg, Record);
428 for (
const auto *I : T->
quals())
429 Writer.AddDeclRef(I, Record);
441 ASTTypeWriter::VisitAtomicType(
const AtomicType *T) {
454 : Writer(Writer), Record(Record) { }
456 #define ABSTRACT_TYPELOC(CLASS, PARENT)
457 #define TYPELOC(CLASS, PARENT) \
458 void Visit##CLASS##TypeLoc(CLASS##TypeLoc TyLoc);
459 #include "clang/AST/TypeLocNodes.def"
480 Writer.AddSourceLocation(TL.
getNameLoc(), Record);
483 Writer.AddSourceLocation(TL.
getStarLoc(), Record);
492 Writer.AddSourceLocation(TL.
getCaretLoc(), Record);
495 Writer.AddSourceLocation(TL.
getAmpLoc(), Record);
501 Writer.AddSourceLocation(TL.
getStarLoc(), Record);
504 void TypeLocWriter::VisitArrayTypeLoc(
ArrayTypeLoc TL) {
512 VisitArrayTypeLoc(TL);
515 VisitArrayTypeLoc(TL);
518 VisitArrayTypeLoc(TL);
520 void TypeLocWriter::VisitDependentSizedArrayTypeLoc(
522 VisitArrayTypeLoc(TL);
524 void TypeLocWriter::VisitDependentSizedExtVectorTypeLoc(
526 Writer.AddSourceLocation(TL.
getNameLoc(), Record);
529 Writer.AddSourceLocation(TL.
getNameLoc(), Record);
532 Writer.AddSourceLocation(TL.
getNameLoc(), Record);
539 for (
unsigned i = 0, e = TL.
getNumParams(); i != e; ++i)
540 Writer.AddDeclRef(TL.
getParam(i), Record);
543 VisitFunctionTypeLoc(TL);
546 VisitFunctionTypeLoc(TL);
549 Writer.AddSourceLocation(TL.
getNameLoc(), Record);
552 Writer.AddSourceLocation(TL.
getNameLoc(), Record);
566 Writer.AddSourceLocation(TL.
getNameLoc(), Record);
569 Writer.AddSourceLocation(TL.
getKWLoc(), Record);
574 void TypeLocWriter::VisitAutoTypeLoc(
AutoTypeLoc TL) {
575 Writer.AddSourceLocation(TL.
getNameLoc(), Record);
578 Writer.AddSourceLocation(TL.
getNameLoc(), Record);
580 void TypeLocWriter::VisitEnumTypeLoc(
EnumTypeLoc TL) {
581 Writer.AddSourceLocation(TL.
getNameLoc(), Record);
584 Writer.AddSourceLocation(TL.getAttrNameLoc(), Record);
587 Writer.AddSourceLocation(range.
getBegin(), Record);
588 Writer.AddSourceLocation(range.
getEnd(), Record);
591 Expr *operand = TL.getAttrExprOperand();
592 Record.push_back(operand ? 1 : 0);
593 if (operand) Writer.AddStmt(operand);
599 Writer.AddSourceLocation(TL.
getNameLoc(), Record);
601 void TypeLocWriter::VisitSubstTemplateTypeParmTypeLoc(
603 Writer.AddSourceLocation(TL.
getNameLoc(), Record);
605 void TypeLocWriter::VisitSubstTemplateTypeParmPackTypeLoc(
607 Writer.AddSourceLocation(TL.
getNameLoc(), Record);
609 void TypeLocWriter::VisitTemplateSpecializationTypeLoc(
615 for (
unsigned i = 0, e = TL.
getNumArgs(); i != e; ++i)
619 void TypeLocWriter::VisitParenTypeLoc(
ParenTypeLoc TL) {
628 Writer.AddSourceLocation(TL.
getNameLoc(), Record);
633 Writer.AddSourceLocation(TL.
getNameLoc(), Record);
635 void TypeLocWriter::VisitDependentTemplateSpecializationTypeLoc(
643 for (
unsigned I = 0, E = TL.
getNumArgs(); I != E; ++I)
651 Writer.AddSourceLocation(TL.
getNameLoc(), Record);
665 Writer.AddSourceLocation(TL.
getStarLoc(), Record);
668 Writer.AddSourceLocation(TL.
getKWLoc(), Record);
673 void ASTWriter::WriteTypeAbbrevs() {
674 using namespace llvm;
679 Abv =
new BitCodeAbbrev();
681 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
682 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 3));
683 TypeExtQualAbbrev = Stream.EmitAbbrev(Abv);
686 Abv =
new BitCodeAbbrev();
689 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
690 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
691 Abv->Add(BitCodeAbbrevOp(0));
692 Abv->Add(BitCodeAbbrevOp(0));
693 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 4));
694 Abv->Add(BitCodeAbbrevOp(0));
696 Abv->Add(BitCodeAbbrevOp(0));
697 Abv->Add(BitCodeAbbrevOp(0));
698 Abv->Add(BitCodeAbbrevOp(0));
699 Abv->Add(BitCodeAbbrevOp(0));
700 Abv->Add(BitCodeAbbrevOp(
EST_None));
701 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
702 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
703 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
704 TypeFunctionProtoAbbrev = Stream.EmitAbbrev(Abv);
712 llvm::BitstreamWriter &Stream,
715 Record.push_back(ID);
716 Stream.EmitRecord(llvm::bitc::BLOCKINFO_CODE_SETBID, Record);
719 if (!Name || Name[0] == 0)
723 Record.push_back(*Name++);
724 Stream.EmitRecord(llvm::bitc::BLOCKINFO_CODE_BLOCKNAME, Record);
728 llvm::BitstreamWriter &Stream,
731 Record.push_back(ID);
733 Record.push_back(*Name++);
734 Stream.EmitRecord(llvm::bitc::BLOCKINFO_CODE_SETRECORDNAME, Record);
739 #define RECORD(X) EmitRecordID(X, #X, Stream, Record)
866 void ASTWriter::WriteBlockInfoBlock() {
868 Stream.EnterSubblock(llvm::bitc::BLOCKINFO_BLOCK_ID, 3);
870 #define BLOCK(X) EmitBlockID(X ## _ID, #X, Stream, Record)
871 #define RECORD(X) EmitRecordID(X, #X, Stream, Record)
874 BLOCK(CONTROL_BLOCK);
892 BLOCK(INPUT_FILES_BLOCK);
944 BLOCK(SOURCE_MANAGER_BLOCK);
951 BLOCK(PREPROCESSOR_BLOCK);
959 BLOCK(DECLTYPES_BLOCK);
1061 BLOCK(PREPROCESSOR_DETAIL_BLOCK);
1077 bool Changed =
false;
1079 if (!llvm::sys::path::is_absolute(StringRef(Path.data(), Path.size()))) {
1080 llvm::sys::fs::make_absolute(Path);
1099 assert(Filename &&
"No file name to adjust?");
1101 if (BaseDir.empty())
1106 for (; Filename[Pos] && Pos < BaseDir.size(); ++Pos)
1107 if (Filename[Pos] != BaseDir[Pos])
1116 if (!llvm::sys::path::is_separator(Filename[Pos])) {
1117 if (!llvm::sys::path::is_separator(BaseDir.back()))
1131 return Filename + Pos;
1145 const std::string &OutputFile) {
1146 using namespace llvm;
1151 BitCodeAbbrev *MetadataAbbrev =
new BitCodeAbbrev();
1152 MetadataAbbrev->Add(BitCodeAbbrevOp(
METADATA));
1153 MetadataAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 16));
1154 MetadataAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 16));
1155 MetadataAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 16));
1156 MetadataAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 16));
1157 MetadataAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
1158 MetadataAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
1159 MetadataAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
1160 unsigned MetadataAbbrevCode = Stream.EmitAbbrev(MetadataAbbrev);
1164 Record.push_back(CLANG_VERSION_MAJOR);
1165 Record.push_back(CLANG_VERSION_MINOR);
1166 assert((!WritingModule || isysroot.empty()) &&
1167 "writing module as a relocatable PCH?");
1168 Record.push_back(!isysroot.empty());
1169 Record.push_back(ASTHasCompilerErrors);
1170 Stream.EmitRecordWithBlob(MetadataAbbrevCode, Record,
1173 if (WritingModule) {
1185 BitCodeAbbrev *Abbrev =
new BitCodeAbbrev();
1187 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
1188 unsigned AbbrevCode = Stream.EmitAbbrev(Abbrev);
1191 Stream.EmitRecordWithBlob(AbbrevCode, Record, WritingModule->Name);
1194 if (WritingModule && WritingModule->Directory) {
1196 BitCodeAbbrev *Abbrev =
new BitCodeAbbrev();
1198 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
1199 unsigned AbbrevCode = Stream.EmitAbbrev(Abbrev);
1205 Stream.EmitRecordWithBlob(AbbrevCode, Record, BaseDir);
1208 BaseDirectory.assign(BaseDir.begin(), BaseDir.end());
1209 }
else if (!isysroot.empty()) {
1211 BaseDirectory = isysroot;
1215 if (WritingModule) {
1221 AddPath(
Map.getModuleMapFileForUniquing(WritingModule)->getName(), Record);
1224 if (
auto *AdditionalModMaps =
1225 Map.getAdditionalModuleMapFiles(WritingModule)) {
1226 Record.push_back(AdditionalModMaps->size());
1227 for (
const FileEntry *F : *AdditionalModMaps)
1228 AddPath(F->getName(), Record);
1230 Record.push_back(0);
1241 for (
auto *M : Mgr) {
1243 if (!M->isDirectlyImported())
1246 Record.push_back((
unsigned)M->Kind);
1247 AddSourceLocation(M->ImportLoc, Record);
1248 Record.push_back(M->File->getSize());
1249 Record.push_back(M->File->getModificationTime());
1250 Record.push_back(M->Signature);
1251 AddPath(M->FileName, Record);
1253 Stream.EmitRecord(
IMPORTS, Record);
1259 for (
auto *E : Mgr.getAdditionalKnownModuleFiles())
1260 AddPath(E->getName(), Record);
1261 if (!Record.empty())
1268 #define LANGOPT(Name, Bits, Default, Description) \
1269 Record.push_back(LangOpts.Name);
1270 #define ENUM_LANGOPT(Name, Type, Bits, Default, Description) \
1271 Record.push_back(static_cast<unsigned>(LangOpts.get##Name()));
1272 #include "clang/Basic/LangOptions.def"
1273 #define SANITIZER(NAME, ID) \
1274 Record.push_back(LangOpts.Sanitize.has(SanitizerKind::ID));
1275 #include "clang/Basic/Sanitizers.def"
1277 Record.push_back(LangOpts.ModuleFeatures.size());
1278 for (StringRef Feature : LangOpts.ModuleFeatures)
1279 AddString(Feature, Record);
1281 Record.push_back((
unsigned) LangOpts.ObjCRuntime.getKind());
1282 AddVersionTuple(LangOpts.ObjCRuntime.getVersion(), Record);
1284 AddString(LangOpts.CurrentModule, Record);
1287 Record.push_back(LangOpts.CommentOpts.BlockCommandNames.size());
1288 for (CommentOptions::BlockCommandNamesTy::const_iterator
1289 I = LangOpts.CommentOpts.BlockCommandNames.begin(),
1290 IEnd = LangOpts.CommentOpts.BlockCommandNames.end();
1292 AddString(*I, Record);
1294 Record.push_back(LangOpts.CommentOpts.ParseAllComments);
1302 AddString(TargetOpts.Triple, Record);
1303 AddString(TargetOpts.CPU, Record);
1304 AddString(TargetOpts.ABI, Record);
1305 Record.push_back(TargetOpts.FeaturesAsWritten.size());
1306 for (
unsigned I = 0, N = TargetOpts.FeaturesAsWritten.size(); I != N; ++I) {
1307 AddString(TargetOpts.FeaturesAsWritten[I], Record);
1309 Record.push_back(TargetOpts.Features.size());
1310 for (
unsigned I = 0, N = TargetOpts.Features.size(); I != N; ++I) {
1311 AddString(TargetOpts.Features[I], Record);
1319 #define DIAGOPT(Name, Bits, Default) Record.push_back(DiagOpts.Name);
1320 #define ENUM_DIAGOPT(Name, Type, Bits, Default) \
1321 Record.push_back(static_cast<unsigned>(DiagOpts.get##Name()));
1322 #include "clang/Basic/DiagnosticOptions.def"
1323 Record.push_back(DiagOpts.Warnings.size());
1324 for (
unsigned I = 0, N = DiagOpts.Warnings.size(); I != N; ++I)
1325 AddString(DiagOpts.Warnings[I], Record);
1326 Record.push_back(DiagOpts.Remarks.size());
1327 for (
unsigned I = 0, N = DiagOpts.Remarks.size(); I != N; ++I)
1328 AddString(DiagOpts.Remarks[I], Record);
1337 AddString(FSOpts.WorkingDir, Record);
1344 AddString(HSOpts.Sysroot, Record);
1347 Record.push_back(HSOpts.UserEntries.size());
1348 for (
unsigned I = 0, N = HSOpts.UserEntries.size(); I != N; ++I) {
1350 AddString(Entry.
Path, Record);
1351 Record.push_back(static_cast<unsigned>(Entry.
Group));
1357 Record.push_back(HSOpts.SystemHeaderPrefixes.size());
1358 for (
unsigned I = 0, N = HSOpts.SystemHeaderPrefixes.size(); I != N; ++I) {
1359 AddString(HSOpts.SystemHeaderPrefixes[I].Prefix, Record);
1360 Record.push_back(HSOpts.SystemHeaderPrefixes[I].IsSystemHeader);
1363 AddString(HSOpts.ResourceDir, Record);
1364 AddString(HSOpts.ModuleCachePath, Record);
1365 AddString(HSOpts.ModuleUserBuildPath, Record);
1366 Record.push_back(HSOpts.DisableModuleHash);
1367 Record.push_back(HSOpts.UseBuiltinIncludes);
1368 Record.push_back(HSOpts.UseStandardSystemIncludes);
1369 Record.push_back(HSOpts.UseStandardCXXIncludes);
1370 Record.push_back(HSOpts.UseLibcxx);
1380 Record.push_back(PPOpts.Macros.size());
1381 for (
unsigned I = 0, N = PPOpts.Macros.size(); I != N; ++I) {
1382 AddString(PPOpts.Macros[I].first, Record);
1383 Record.push_back(PPOpts.Macros[I].second);
1387 Record.push_back(PPOpts.Includes.size());
1388 for (
unsigned I = 0, N = PPOpts.Includes.size(); I != N; ++I)
1389 AddString(PPOpts.Includes[I], Record);
1392 Record.push_back(PPOpts.MacroIncludes.size());
1393 for (
unsigned I = 0, N = PPOpts.MacroIncludes.size(); I != N; ++I)
1394 AddString(PPOpts.MacroIncludes[I], Record);
1396 Record.push_back(PPOpts.UsePredefines);
1398 Record.push_back(PPOpts.DetailedRecord);
1399 AddString(PPOpts.ImplicitPCHInclude, Record);
1400 AddString(PPOpts.ImplicitPTHInclude, Record);
1401 Record.push_back(static_cast<unsigned>(PPOpts.ObjCXXARCStandardLibrary));
1407 BitCodeAbbrev *FileAbbrev =
new BitCodeAbbrev();
1409 FileAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
1410 FileAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
1411 unsigned FileAbbrevCode = Stream.EmitAbbrev(FileAbbrev);
1416 EmitRecordWithPath(FileAbbrevCode, Record, MainFile->getName());
1424 if (!OutputFile.empty() && OutputFile !=
"-") {
1425 BitCodeAbbrev *Abbrev =
new BitCodeAbbrev();
1427 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
1428 unsigned AbbrevCode = Stream.EmitAbbrev(Abbrev);
1432 llvm::sys::fs::make_absolute(OutputPath);
1433 StringRef origDir = llvm::sys::path::parent_path(OutputPath);
1437 Stream.EmitRecordWithBlob(AbbrevCode, Record, origDir);
1440 WriteInputFiles(Context.SourceMgr,
1448 struct InputFileEntry {
1451 bool BufferOverridden;
1458 using namespace llvm;
1463 BitCodeAbbrev *IFAbbrev =
new BitCodeAbbrev();
1465 IFAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
1466 IFAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 12));
1467 IFAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 32));
1468 IFAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
1469 IFAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
1470 unsigned IFAbbrevCode = Stream.EmitAbbrev(IFAbbrev);
1474 std::deque<InputFileEntry> SortedFiles;
1478 assert(&SourceMgr.
getSLocEntry(FileID::get(I)) == SLoc);
1484 if (!Cache->OrigEntry)
1487 InputFileEntry Entry;
1488 Entry.File = Cache->OrigEntry;
1489 Entry.IsSystemFile = Cache->IsSystemFile;
1490 Entry.BufferOverridden = Cache->BufferOverridden;
1491 if (Cache->IsSystemFile)
1492 SortedFiles.push_back(Entry);
1494 SortedFiles.push_front(Entry);
1497 unsigned UserFilesNum = 0;
1499 std::vector<uint64_t> InputFileOffsets;
1500 for (std::deque<InputFileEntry>::iterator
1501 I = SortedFiles.begin(), E = SortedFiles.end(); I != E; ++I) {
1502 const InputFileEntry &Entry = *I;
1504 uint32_t &InputFileID = InputFileIDs[Entry.File];
1505 if (InputFileID != 0)
1509 InputFileOffsets.push_back(Stream.GetCurrentBitNo());
1511 InputFileID = InputFileOffsets.size();
1513 if (!Entry.IsSystemFile)
1518 Record.push_back(InputFileOffsets.size());
1521 Record.push_back(Entry.File->getSize());
1522 Record.push_back(Entry.File->getModificationTime());
1525 Record.push_back(Entry.BufferOverridden);
1527 EmitRecordWithPath(IFAbbrevCode, Record, Entry.File->getName());
1533 BitCodeAbbrev *OffsetsAbbrev =
new BitCodeAbbrev();
1535 OffsetsAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
1536 OffsetsAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
1538 OffsetsAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
1539 unsigned OffsetsAbbrevCode = Stream.EmitAbbrev(OffsetsAbbrev);
1544 Record.push_back(InputFileOffsets.size());
1545 Record.push_back(UserFilesNum);
1546 Stream.EmitRecordWithBlob(OffsetsAbbrevCode, Record,
bytes(InputFileOffsets));
1556 using namespace llvm;
1557 BitCodeAbbrev *Abbrev =
new BitCodeAbbrev();
1559 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));
1560 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));
1561 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2));
1562 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
1564 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
1565 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));
1566 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 24));
1567 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));
1568 return Stream.EmitAbbrev(Abbrev);
1574 using namespace llvm;
1575 BitCodeAbbrev *Abbrev =
new BitCodeAbbrev();
1577 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));
1578 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));
1579 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2));
1580 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
1581 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
1582 return Stream.EmitAbbrev(Abbrev);
1588 using namespace llvm;
1589 BitCodeAbbrev *Abbrev =
new BitCodeAbbrev();
1591 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
1592 return Stream.EmitAbbrev(Abbrev);
1598 using namespace llvm;
1599 BitCodeAbbrev *Abbrev =
new BitCodeAbbrev();
1601 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));
1602 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));
1603 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));
1604 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));
1605 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
1606 return Stream.EmitAbbrev(Abbrev);
1611 class HeaderFileInfoTrait {
1617 llvm::StringMap<unsigned> FrameworkNameOffset;
1621 : Writer(Writer), HS(HS) { }
1625 const char *Filename;
1627 typedef const key_type &key_type_ref;
1630 typedef const data_type &data_type_ref;
1631 typedef unsigned hash_value_type;
1632 typedef unsigned offset_type;
1634 static hash_value_type
ComputeHash(key_type_ref key) {
1641 return llvm::hash_combine(key.FE->getSize(),
1642 key.FE->getModificationTime());
1645 std::pair<unsigned,unsigned>
1646 EmitKeyDataLength(raw_ostream& Out, key_type_ref key, data_type_ref Data) {
1647 using namespace llvm::support;
1648 endian::Writer<little> Writer(Out);
1649 unsigned KeyLen = strlen(key.Filename) + 1 + 8 + 8;
1650 Writer.write<uint16_t>(KeyLen);
1651 unsigned DataLen = 1 + 2 + 4 + 4;
1652 if (Data.isModuleHeader)
1654 Writer.write<uint8_t>(DataLen);
1655 return std::make_pair(KeyLen, DataLen);
1658 void EmitKey(raw_ostream& Out, key_type_ref key,
unsigned KeyLen) {
1659 using namespace llvm::support;
1660 endian::Writer<little> LE(Out);
1661 LE.write<uint64_t>(key.FE->getSize());
1663 LE.write<uint64_t>(key.FE->getModificationTime());
1665 Out.write(key.Filename, KeyLen);
1668 void EmitData(raw_ostream &Out, key_type_ref key,
1669 data_type_ref Data,
unsigned DataLen) {
1670 using namespace llvm::support;
1671 endian::Writer<little> LE(Out);
1672 uint64_t Start = Out.tell(); (void)Start;
1674 unsigned char Flags = (Data.HeaderRole << 6)
1675 | (Data.isImport << 5)
1676 | (Data.isPragmaOnce << 4)
1677 | (Data.DirInfo << 2)
1678 | (Data.Resolved << 1)
1679 | Data.IndexHeaderMapHeader;
1680 LE.write<uint8_t>(Flags);
1681 LE.write<uint16_t>(Data.NumIncludes);
1683 if (!Data.ControllingMacro)
1684 LE.write<uint32_t>(Data.ControllingMacroID);
1686 LE.write<uint32_t>(Writer.getIdentifierRef(Data.ControllingMacro));
1689 if (!Data.Framework.empty()) {
1691 llvm::StringMap<unsigned>::iterator Pos
1692 = FrameworkNameOffset.find(Data.Framework);
1693 if (Pos == FrameworkNameOffset.end()) {
1694 Offset = FrameworkStringData.size() + 1;
1695 FrameworkStringData.append(Data.Framework.begin(),
1696 Data.Framework.end());
1697 FrameworkStringData.push_back(0);
1699 FrameworkNameOffset[Data.Framework] =
Offset;
1703 LE.write<uint32_t>(
Offset);
1705 if (Data.isModuleHeader) {
1706 Module *Mod = HS.findModuleForHeader(key.FE).getModule();
1707 LE.write<uint32_t>(Writer.getExistingSubmoduleID(Mod));
1710 assert(Out.tell() - Start == DataLen &&
"Wrong data length");
1713 const char *strings_begin()
const {
return FrameworkStringData.begin(); }
1714 const char *strings_end()
const {
return FrameworkStringData.end(); }
1721 void ASTWriter::WriteHeaderSearch(
const HeaderSearch &HS) {
1728 HeaderFileInfoTrait GeneratorTrait(*
this, HS);
1729 llvm::OnDiskChainedHashTableGenerator<HeaderFileInfoTrait> Generator;
1731 unsigned NumHeaderSearchEntries = 0;
1732 for (
unsigned UID = 0, LastUID = FilesByUID.size(); UID != LastUID; ++UID) {
1733 const FileEntry *File = FilesByUID[UID];
1746 const char *Filename = File->
getName();
1748 if (PreparePathForOutput(FilenameTmp)) {
1751 Filename = strdup(FilenameTmp.c_str());
1752 SavedStrings.push_back(Filename);
1755 HeaderFileInfoTrait::key_type key = { File, Filename };
1756 Generator.insert(key, HFI, GeneratorTrait);
1757 ++NumHeaderSearchEntries;
1762 uint32_t BucketOffset;
1764 using namespace llvm::support;
1765 llvm::raw_svector_ostream Out(TableData);
1767 endian::Writer<little>(Out).write<uint32_t>(0);
1768 BucketOffset = Generator.Emit(Out, GeneratorTrait);
1772 using namespace llvm;
1773 BitCodeAbbrev *Abbrev =
new BitCodeAbbrev();
1775 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
1776 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
1777 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
1778 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
1779 unsigned TableAbbrev = Stream.EmitAbbrev(Abbrev);
1784 Record.push_back(BucketOffset);
1785 Record.push_back(NumHeaderSearchEntries);
1786 Record.push_back(TableData.size());
1787 TableData.append(GeneratorTrait.strings_begin(),GeneratorTrait.strings_end());
1788 Stream.EmitRecordWithBlob(TableAbbrev, Record, TableData);
1791 for (
unsigned I = 0, N = SavedStrings.size(); I != N; ++I)
1792 free(const_cast<char *>(SavedStrings[I]));
1803 void ASTWriter::WriteSourceManagerBlock(
SourceManager &SourceMgr,
1818 std::vector<uint32_t> SLocEntryOffsets;
1819 RecordData PreloadSLocs;
1825 FileID FID = FileID::get(I);
1829 SLocEntryOffsets.push_back(Stream.GetCurrentBitNo());
1835 if (Cache->OrigEntry) {
1842 Record.push_back(Code);
1845 Record.push_back(SLoc->
getOffset() - 2);
1853 if (Content->OrigEntry) {
1854 assert(Content->OrigEntry == Content->ContentsEntry &&
1855 "Writing to AST an overridden file is not supported");
1858 assert(InputFileIDs[Content->OrigEntry] != 0 &&
"Missed file entry");
1859 Record.push_back(InputFileIDs[Content->OrigEntry]);
1861 Record.push_back(File.NumCreatedFIDs);
1863 FileDeclIDsTy::iterator FDI = FileDeclIDs.find(FID);
1864 if (FDI != FileDeclIDs.end()) {
1865 Record.push_back(FDI->second->FirstDeclIndex);
1866 Record.push_back(FDI->second->DeclIDs.size());
1868 Record.push_back(0);
1869 Record.push_back(0);
1872 Stream.EmitRecordWithAbbrev(SLocFileAbbrv, Record);
1874 if (Content->BufferOverridden) {
1877 const llvm::MemoryBuffer *Buffer
1879 Stream.EmitRecordWithBlob(SLocBufferBlobAbbrv, Record,
1880 StringRef(Buffer->getBufferStart(),
1881 Buffer->getBufferSize() + 1));
1890 const llvm::MemoryBuffer *Buffer
1892 const char *Name = Buffer->getBufferIdentifier();
1893 Stream.EmitRecordWithBlob(SLocBufferAbbrv, Record,
1894 StringRef(Name, strlen(Name) + 1));
1897 Stream.EmitRecordWithBlob(SLocBufferBlobAbbrv, Record,
1898 StringRef(Buffer->getBufferStart(),
1899 Buffer->getBufferSize() + 1));
1901 if (strcmp(Name,
"<built-in>") == 0) {
1902 PreloadSLocs.push_back(SLocEntryOffsets.size());
1917 Record.push_back(NextOffset - SLoc->
getOffset() - 1);
1918 Stream.EmitRecordWithAbbrev(SLocExpansionAbbrv, Record);
1924 if (SLocEntryOffsets.empty())
1929 using namespace llvm;
1930 BitCodeAbbrev *Abbrev =
new BitCodeAbbrev();
1932 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 16));
1933 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 16));
1934 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
1935 unsigned SLocOffsetsAbbrev = Stream.EmitAbbrev(Abbrev);
1939 Record.push_back(SLocEntryOffsets.size());
1941 Stream.EmitRecordWithBlob(SLocOffsetsAbbrev, Record,
bytes(SLocEntryOffsets));
1962 if (L->first.ID < 0)
1966 Record.push_back(L->first.ID);
1969 Record.push_back(L->second.size());
1970 for (std::vector<LineEntry>::iterator LE = L->second.begin(),
1971 LEEnd = L->second.end();
1972 LE != LEEnd; ++LE) {
1973 Record.push_back(LE->FileOffset);
1974 Record.push_back(LE->LineNo);
1975 Record.push_back(LE->FilenameID);
1976 Record.push_back((
unsigned)LE->FileKind);
1977 Record.push_back(LE->IncludeOffset);
1991 if (MI->isBuiltinMacro())
2008 void ASTWriter::WritePreprocessor(
const Preprocessor &PP,
bool IsModule) {
2011 WritePreprocessorDetail(*PPRec);
2014 RecordData ModuleMacroRecord;
2029 fprintf(stderr,
"warning: precompiled header used __DATE__ or __TIME__.\n");
2039 if (Id.second->hadMacroDefinition() &&
2040 (!Id.second->isFromAST() ||
2041 Id.second->hasChangedSinceDeserialization()))
2042 MacroIdentifiers.push_back(Id.second);
2045 std::sort(MacroIdentifiers.begin(), MacroIdentifiers.end(),
2046 llvm::less_ptr<IdentifierInfo>());
2052 auto StartOffset = Stream.GetCurrentBitNo();
2062 Record.push_back(MD->
getKind());
2063 if (
auto *DefMD = dyn_cast<DefMacroDirective>(MD)) {
2064 Record.push_back(getMacroRef(DefMD->getInfo(), Name));
2065 }
else if (
auto *VisMD = dyn_cast<VisibilityMacroDirective>(MD)) {
2066 Record.push_back(VisMD->isPublic());
2071 bool EmittedModuleMacros =
false;
2075 llvm::DenseMap<ModuleMacro*, unsigned> Visits;
2076 while (!Worklist.empty()) {
2077 auto *Macro = Worklist.pop_back_val();
2080 ModuleMacroRecord.push_back(
2081 getSubmoduleID(Macro->getOwningModule()));
2082 ModuleMacroRecord.push_back(getMacroRef(Macro->getMacroInfo(), Name));
2083 for (
auto *M : Macro->overrides())
2084 ModuleMacroRecord.push_back(getSubmoduleID(M->getOwningModule()));
2087 ModuleMacroRecord.clear();
2090 for (
auto *M : Macro->overrides())
2091 if (++Visits[M] == M->getNumOverridingMacros())
2092 Worklist.push_back(M);
2094 EmittedModuleMacros =
true;
2098 if (Record.empty() && !EmittedModuleMacros)
2101 IdentMacroDirectivesOffsetMap[Name] = StartOffset;
2112 std::vector<uint32_t> MacroOffsets;
2114 for (
unsigned I = 0, N = MacroInfosToEmit.size(); I != N; ++I) {
2119 if (ID < FirstMacroID) {
2120 assert(0 &&
"Loaded MacroInfo entered MacroInfosToEmit ?");
2125 unsigned Index = ID - FirstMacroID;
2126 if (Index == MacroOffsets.size())
2127 MacroOffsets.push_back(Stream.GetCurrentBitNo());
2129 if (Index > MacroOffsets.size())
2130 MacroOffsets.resize(Index + 1);
2132 MacroOffsets[Index] = Stream.GetCurrentBitNo();
2135 AddIdentifierRef(Name, Record);
2139 Record.push_back(MI->
isUsed());
2152 AddIdentifierRef(Arg, Record);
2160 Stream.EmitRecord(Code, Record);
2164 for (
unsigned TokNo = 0, e = MI->
getNumTokens(); TokNo != e; ++TokNo) {
2169 AddToken(Tok, Record);
2170 Stream.EmitRecord(
PP_TOKEN, Record);
2179 using namespace llvm;
2180 auto *Abbrev =
new BitCodeAbbrev();
2182 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
2183 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
2184 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2186 unsigned MacroOffsetAbbrev = Stream.EmitAbbrev(Abbrev);
2189 Record.push_back(MacroOffsets.size());
2191 Stream.EmitRecordWithBlob(MacroOffsetAbbrev, Record,
2192 bytes(MacroOffsets));
2205 unsigned NumPreprocessingRecords = 0;
2206 using namespace llvm;
2209 unsigned InclusionAbbrev = 0;
2211 BitCodeAbbrev *Abbrev =
new BitCodeAbbrev();
2213 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
2214 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2215 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2));
2216 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2217 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2218 InclusionAbbrev = Stream.EmitAbbrev(Abbrev);
2221 unsigned FirstPreprocessorEntityID
2222 = (Chain ? PPRec.getNumLoadedPreprocessedEntities() : 0)
2224 unsigned NextPreprocessorEntityID = FirstPreprocessorEntityID;
2229 (void)++E, ++NumPreprocessingRecords, ++NextPreprocessorEntityID) {
2232 PreprocessedEntityOffsets.push_back(
2233 PPEntityOffset((*E)->getSourceRange(), Stream.GetCurrentBitNo()));
2237 MacroDefinitions[MD] = NextPreprocessorEntityID;
2239 AddIdentifierRef(MD->getName(), Record);
2245 Record.push_back(ME->isBuiltinMacro());
2246 if (ME->isBuiltinMacro())
2247 AddIdentifierRef(ME->getName(), Record);
2249 Record.push_back(MacroDefinitions[ME->getDefinition()]);
2256 Record.push_back(ID->getFileName().size());
2257 Record.push_back(ID->wasInQuotes());
2258 Record.push_back(static_cast<unsigned>(ID->getKind()));
2259 Record.push_back(ID->importedModule());
2261 Buffer += ID->getFileName();
2265 Buffer += ID->getFile()->getName();
2266 Stream.EmitRecordWithBlob(InclusionAbbrev, Record, Buffer);
2270 llvm_unreachable(
"Unhandled PreprocessedEntity in ASTWriter");
2275 if (NumPreprocessingRecords > 0) {
2276 assert(PreprocessedEntityOffsets.size() == NumPreprocessingRecords);
2279 using namespace llvm;
2280 BitCodeAbbrev *Abbrev =
new BitCodeAbbrev();
2282 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
2283 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2284 unsigned PPEOffsetAbbrev = Stream.EmitAbbrev(Abbrev);
2289 Stream.EmitRecordWithBlob(PPEOffsetAbbrev, Record,
2290 bytes(PreprocessedEntityOffsets));
2294 unsigned ASTWriter::getSubmoduleID(
Module *Mod) {
2295 llvm::DenseMap<Module *, unsigned>::iterator Known = SubmoduleIDs.find(Mod);
2296 if (Known != SubmoduleIDs.end())
2297 return Known->second;
2299 return SubmoduleIDs[Mod] = NextSubmoduleID++;
2306 llvm::DenseMap<Module *, unsigned>::const_iterator
2307 Known = SubmoduleIDs.find(Mod);
2308 if (Known != SubmoduleIDs.end())
2309 return Known->second;
2317 unsigned ChildModules = 0;
2320 Sub != SubEnd; ++Sub)
2323 return ChildModules + 1;
2326 void ASTWriter::WriteSubmodules(
Module *WritingModule) {
2331 using namespace llvm;
2332 BitCodeAbbrev *Abbrev =
new BitCodeAbbrev();
2334 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2335 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2336 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2337 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2338 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2339 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2340 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2341 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2342 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2343 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2344 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2345 unsigned DefinitionAbbrev = Stream.EmitAbbrev(Abbrev);
2347 Abbrev =
new BitCodeAbbrev();
2349 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2350 unsigned UmbrellaAbbrev = Stream.EmitAbbrev(Abbrev);
2352 Abbrev =
new BitCodeAbbrev();
2354 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2355 unsigned HeaderAbbrev = Stream.EmitAbbrev(Abbrev);
2357 Abbrev =
new BitCodeAbbrev();
2359 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2360 unsigned TopHeaderAbbrev = Stream.EmitAbbrev(Abbrev);
2362 Abbrev =
new BitCodeAbbrev();
2364 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2365 unsigned UmbrellaDirAbbrev = Stream.EmitAbbrev(Abbrev);
2367 Abbrev =
new BitCodeAbbrev();
2369 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2370 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2371 unsigned RequiresAbbrev = Stream.EmitAbbrev(Abbrev);
2373 Abbrev =
new BitCodeAbbrev();
2375 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2376 unsigned ExcludedHeaderAbbrev = Stream.EmitAbbrev(Abbrev);
2378 Abbrev =
new BitCodeAbbrev();
2380 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2381 unsigned TextualHeaderAbbrev = Stream.EmitAbbrev(Abbrev);
2383 Abbrev =
new BitCodeAbbrev();
2385 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2386 unsigned PrivateHeaderAbbrev = Stream.EmitAbbrev(Abbrev);
2388 Abbrev =
new BitCodeAbbrev();
2390 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2391 unsigned PrivateTextualHeaderAbbrev = Stream.EmitAbbrev(Abbrev);
2393 Abbrev =
new BitCodeAbbrev();
2395 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2396 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2397 unsigned LinkLibraryAbbrev = Stream.EmitAbbrev(Abbrev);
2399 Abbrev =
new BitCodeAbbrev();
2401 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2402 unsigned ConfigMacroAbbrev = Stream.EmitAbbrev(Abbrev);
2404 Abbrev =
new BitCodeAbbrev();
2406 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2407 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2408 unsigned ConflictAbbrev = Stream.EmitAbbrev(Abbrev);
2417 std::queue<Module *> Q;
2418 Q.push(WritingModule);
2419 while (!Q.empty()) {
2422 unsigned ID = getSubmoduleID(Mod);
2427 Record.push_back(ID);
2429 assert(SubmoduleIDs[Mod->
Parent] &&
"Submodule parent not written?");
2430 Record.push_back(SubmoduleIDs[Mod->
Parent]);
2432 Record.push_back(0);
2442 Stream.EmitRecordWithBlob(DefinitionAbbrev, Record, Mod->
Name);
2445 for (
unsigned I = 0, N = Mod->
Requirements.size(); I != N; ++I) {
2449 Stream.EmitRecordWithBlob(RequiresAbbrev, Record,
2457 Stream.EmitRecordWithBlob(UmbrellaAbbrev, Record,
2458 UmbrellaHeader.NameAsWritten);
2462 Stream.EmitRecordWithBlob(UmbrellaDirAbbrev, Record,
2463 UmbrellaDir.NameAsWritten);
2468 unsigned RecordKind;
2479 for (
auto &HL : HeaderLists) {
2481 Record.push_back(HL.RecordKind);
2482 for (
auto &H : Mod->
Headers[HL.HeaderKind])
2483 Stream.EmitRecordWithBlob(HL.Abbrev, Record, H.NameAsWritten);
2491 for (
auto *H : TopHeaders)
2492 Stream.EmitRecordWithBlob(TopHeaderAbbrev, Record, H->getName());
2498 for (
unsigned I = 0, N = Mod->
Imports.size(); I != N; ++I) {
2499 unsigned ImportedID = getSubmoduleID(Mod->
Imports[I]);
2500 assert(ImportedID &&
"Unknown submodule!");
2501 Record.push_back(ImportedID);
2509 for (
unsigned I = 0, N = Mod->
Exports.size(); I != N; ++I) {
2511 unsigned ExportedID = getSubmoduleID(Exported);
2512 Record.push_back(ExportedID);
2514 Record.push_back(0);
2517 Record.push_back(Mod->
Exports[I].getInt());
2527 for (
unsigned I = 0, N = Mod->
LinkLibraries.size(); I != N; ++I) {
2531 Stream.EmitRecordWithBlob(LinkLibraryAbbrev, Record,
2536 for (
unsigned I = 0, N = Mod->
Conflicts.size(); I != N; ++I) {
2539 unsigned OtherID = getSubmoduleID(Mod->
Conflicts[I].Other);
2540 assert(OtherID &&
"Unknown submodule!");
2541 Record.push_back(OtherID);
2542 Stream.EmitRecordWithBlob(ConflictAbbrev, Record,
2547 for (
unsigned I = 0, N = Mod->
ConfigMacros.size(); I != N; ++I) {
2550 Stream.EmitRecordWithBlob(ConfigMacroAbbrev, Record,
2557 Sub != SubEnd; ++Sub)
2566 assert((NextSubmoduleID - FirstSubmoduleID ==
2568 "Wrong # of submodules; found a reference to a non-local, "
2569 "non-imported submodule?");
2585 if (WritingModule != OwningMod && !OwningMod->
isSubModuleOf(WritingModule))
2588 return getSubmoduleID(OwningMod);
2599 llvm::SmallDenseMap<const DiagnosticsEngine::DiagState *, unsigned, 64>
2601 unsigned CurrID = 0;
2602 DiagStateIDMap[&Diag.DiagStates.front()] = ++CurrID;
2604 for (DiagnosticsEngine::DiagStatePointsTy::const_iterator
2605 I = Diag.DiagStatePoints.begin(), E = Diag.DiagStatePoints.end();
2607 const DiagnosticsEngine::DiagStatePoint &point = *I;
2608 if (point.Loc.isInvalid())
2611 Record.push_back(point.Loc.getRawEncoding());
2612 unsigned &DiagStateID = DiagStateIDMap[point.State];
2613 Record.push_back(DiagStateID);
2615 if (DiagStateID == 0) {
2616 DiagStateID = ++CurrID;
2617 for (DiagnosticsEngine::DiagState::const_iterator
2618 I = point.State->begin(), E = point.State->end(); I != E; ++I) {
2619 if (I->second.isPragma()) {
2620 Record.push_back(I->first);
2621 Record.push_back((
unsigned)I->second.getSeverity());
2624 Record.push_back(-1);
2629 if (!Record.empty())
2633 void ASTWriter::WriteCXXCtorInitializersOffsets() {
2634 if (CXXCtorInitializersOffsets.empty())
2640 using namespace llvm;
2642 BitCodeAbbrev *Abbrev =
new BitCodeAbbrev();
2644 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
2645 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2646 unsigned CtorInitializersOffsetAbbrev = Stream.EmitAbbrev(Abbrev);
2651 Record.push_back(CXXCtorInitializersOffsets.size());
2652 Stream.EmitRecordWithBlob(CtorInitializersOffsetAbbrev, Record,
2653 bytes(CXXCtorInitializersOffsets));
2656 void ASTWriter::WriteCXXBaseSpecifiersOffsets() {
2657 if (CXXBaseSpecifiersOffsets.empty())
2663 using namespace llvm;
2665 BitCodeAbbrev *Abbrev =
new BitCodeAbbrev();
2667 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
2668 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2669 unsigned BaseSpecifierOffsetAbbrev = Stream.EmitAbbrev(Abbrev);
2674 Record.push_back(CXXBaseSpecifiersOffsets.size());
2675 Stream.EmitRecordWithBlob(BaseSpecifierOffsetAbbrev, Record,
2676 bytes(CXXBaseSpecifiersOffsets));
2684 void ASTWriter::WriteType(
QualType T) {
2689 assert(Idx.
getIndex() >= FirstTypeID &&
"Re-writing a type from a prior AST");
2692 unsigned Index = Idx.
getIndex() - FirstTypeID;
2693 if (TypeOffsets.size() == Index)
2694 TypeOffsets.push_back(Stream.GetCurrentBitNo());
2695 else if (TypeOffsets.size() < Index) {
2696 TypeOffsets.resize(Index + 1);
2697 TypeOffsets[Index] = Stream.GetCurrentBitNo();
2703 ASTTypeWriter W(*
this, Record);
2711 W.AbbrevToUse = TypeExtQualAbbrev;
2716 #define TYPE(Class, Base) \
2717 case Type::Class: W.Visit##Class##Type(cast<Class##Type>(T)); break;
2718 #define ABSTRACT_TYPE(Class, Base)
2719 #include "clang/AST/TypeNodes.def"
2724 Stream.EmitRecord(W.Code, Record, W.AbbrevToUse);
2739 uint64_t ASTWriter::WriteDeclContextLexicalBlock(
ASTContext &Context,
2744 uint64_t
Offset = Stream.GetCurrentBitNo();
2748 for (
const auto *D : DC->
decls())
2749 Decls.push_back(std::make_pair(D->getKind(), GetDeclRef(D)));
2751 ++NumLexicalDeclContexts;
2752 Stream.EmitRecordWithBlob(DeclContextLexicalAbbrev, Record,
bytes(Decls));
2756 void ASTWriter::WriteTypeDeclOffsets() {
2757 using namespace llvm;
2761 BitCodeAbbrev *Abbrev =
new BitCodeAbbrev();
2763 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
2764 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
2765 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2766 unsigned TypeOffsetAbbrev = Stream.EmitAbbrev(Abbrev);
2769 Record.push_back(TypeOffsets.size());
2771 Stream.EmitRecordWithBlob(TypeOffsetAbbrev, Record,
bytes(TypeOffsets));
2774 Abbrev =
new BitCodeAbbrev();
2776 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
2777 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
2778 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2779 unsigned DeclOffsetAbbrev = Stream.EmitAbbrev(Abbrev);
2782 Record.push_back(DeclOffsets.size());
2784 Stream.EmitRecordWithBlob(DeclOffsetAbbrev, Record,
bytes(DeclOffsets));
2787 void ASTWriter::WriteFileDeclIDsMap() {
2788 using namespace llvm;
2792 FileDeclIDs.begin(), FileDeclIDs.end());
2793 std::sort(SortedFileDeclIDs.begin(), SortedFileDeclIDs.end(),
2794 llvm::less_first());
2798 for (
auto &FileDeclEntry : SortedFileDeclIDs) {
2799 DeclIDInFileInfo &Info = *FileDeclEntry.second;
2800 Info.FirstDeclIndex = FileGroupedDeclIDs.size();
2801 for (
auto &LocDeclEntry : Info.DeclIDs)
2802 FileGroupedDeclIDs.push_back(LocDeclEntry.second);
2805 BitCodeAbbrev *Abbrev =
new BitCodeAbbrev();
2807 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
2808 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2809 unsigned AbbrevCode = Stream.EmitAbbrev(Abbrev);
2811 Record.push_back(FileGroupedDeclIDs.size());
2812 Stream.EmitRecordWithBlob(AbbrevCode, Record,
bytes(FileGroupedDeclIDs));
2815 void ASTWriter::WriteComments() {
2820 E = RawComments.end();
2823 AddSourceRange((*I)->getSourceRange(), Record);
2824 Record.push_back((*I)->getKind());
2825 Record.push_back((*I)->isTrailingComment());
2826 Record.push_back((*I)->isAlmostTrailingComment());
2838 class ASTMethodPoolTrait {
2843 typedef key_type key_type_ref;
2849 typedef const data_type& data_type_ref;
2851 typedef unsigned hash_value_type;
2852 typedef unsigned offset_type;
2854 explicit ASTMethodPoolTrait(
ASTWriter &Writer) : Writer(Writer) { }
2860 std::pair<unsigned,unsigned>
2861 EmitKeyDataLength(raw_ostream& Out,
Selector Sel,
2862 data_type_ref Methods) {
2863 using namespace llvm::support;
2864 endian::Writer<little> LE(Out);
2866 LE.write<uint16_t>(KeyLen);
2867 unsigned DataLen = 4 + 2 + 2;
2870 if (Method->getMethod())
2874 if (Method->getMethod())
2876 LE.write<uint16_t>(DataLen);
2877 return std::make_pair(KeyLen, DataLen);
2880 void EmitKey(raw_ostream& Out,
Selector Sel,
unsigned) {
2881 using namespace llvm::support;
2882 endian::Writer<little> LE(Out);
2883 uint64_t Start = Out.tell();
2884 assert((Start >> 32) == 0 &&
"Selector key offset too large");
2885 Writer.SetSelectorOffset(Sel, Start);
2887 LE.write<uint16_t>(N);
2890 for (
unsigned I = 0; I != N; ++I)
2895 void EmitData(raw_ostream& Out, key_type_ref,
2896 data_type_ref Methods,
unsigned DataLen) {
2897 using namespace llvm::support;
2898 endian::Writer<little> LE(Out);
2899 uint64_t Start = Out.tell(); (void)Start;
2900 LE.write<uint32_t>(Methods.ID);
2901 unsigned NumInstanceMethods = 0;
2904 if (Method->getMethod())
2905 ++NumInstanceMethods;
2907 unsigned NumFactoryMethods = 0;
2910 if (Method->getMethod())
2911 ++NumFactoryMethods;
2913 unsigned InstanceBits = Methods.Instance.getBits();
2914 assert(InstanceBits < 4);
2915 unsigned InstanceHasMoreThanOneDeclBit =
2916 Methods.Instance.hasMoreThanOneDecl();
2917 unsigned FullInstanceBits = (NumInstanceMethods << 3) |
2918 (InstanceHasMoreThanOneDeclBit << 2) |
2920 unsigned FactoryBits = Methods.Factory.getBits();
2921 assert(FactoryBits < 4);
2922 unsigned FactoryHasMoreThanOneDeclBit =
2923 Methods.Factory.hasMoreThanOneDecl();
2924 unsigned FullFactoryBits = (NumFactoryMethods << 3) |
2925 (FactoryHasMoreThanOneDeclBit << 2) |
2927 LE.write<uint16_t>(FullInstanceBits);
2928 LE.write<uint16_t>(FullFactoryBits);
2931 if (Method->getMethod())
2932 LE.write<uint32_t>(Writer.getDeclID(Method->getMethod()));
2935 if (Method->getMethod())
2936 LE.write<uint32_t>(Writer.getDeclID(Method->getMethod()));
2938 assert(Out.tell() - Start == DataLen &&
"Data length is wrong");
2948 void ASTWriter::WriteSelectors(
Sema &SemaRef) {
2949 using namespace llvm;
2952 if (SemaRef.
MethodPool.empty() && SelectorIDs.empty())
2954 unsigned NumTableEntries = 0;
2957 llvm::OnDiskChainedHashTableGenerator<ASTMethodPoolTrait> Generator;
2958 ASTMethodPoolTrait Trait(*
this);
2962 SelectorOffsets.resize(NextSelectorID - FirstSelectorID);
2963 for (
auto &SelectorAndID : SelectorIDs) {
2966 Sema::GlobalMethodPool::iterator F = SemaRef.
MethodPool.find(S);
2967 ASTMethodPoolTrait::data_type Data = {
2973 Data.Instance = F->second.first;
2974 Data.Factory = F->second.second;
2978 if (Chain && ID < FirstSelectorID) {
2980 bool changed =
false;
2982 !changed && M && M->
getMethod(); M = M->getNext()) {
2983 if (!M->getMethod()->isFromASTFile())
2988 if (!M->getMethod()->isFromASTFile())
2993 }
else if (Data.Instance.getMethod() || Data.Factory.getMethod()) {
2997 Generator.insert(S, Data, Trait);
3002 uint32_t BucketOffset;
3004 using namespace llvm::support;
3005 ASTMethodPoolTrait Trait(*
this);
3006 llvm::raw_svector_ostream Out(MethodPool);
3008 endian::Writer<little>(Out).write<uint32_t>(0);
3009 BucketOffset = Generator.Emit(Out, Trait);
3013 BitCodeAbbrev *Abbrev =
new BitCodeAbbrev();
3015 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
3016 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
3017 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
3018 unsigned MethodPoolAbbrev = Stream.EmitAbbrev(Abbrev);
3023 Record.push_back(BucketOffset);
3024 Record.push_back(NumTableEntries);
3025 Stream.EmitRecordWithBlob(MethodPoolAbbrev, Record, MethodPool);
3028 Abbrev =
new BitCodeAbbrev();
3030 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
3031 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
3032 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
3033 unsigned SelectorOffsetAbbrev = Stream.EmitAbbrev(Abbrev);
3038 Record.push_back(SelectorOffsets.size());
3040 Stream.EmitRecordWithBlob(SelectorOffsetAbbrev, Record,
3041 bytes(SelectorOffsets));
3046 void ASTWriter::WriteReferencedSelectorsPool(
Sema &SemaRef) {
3047 using namespace llvm;
3057 Selector Sel = SelectorAndLocation.first;
3059 AddSelectorRef(Sel, Record);
3060 AddSourceLocation(Loc, Record);
3081 for (; Redecl; Redecl = Redecl->getPreviousDecl()) {
3082 if (!Redecl->isFromASTFile())
3083 return cast<NamedDecl>(Redecl);
3091 if (!First->isFromASTFile())
3092 return cast<NamedDecl>(First);
3101 class ASTIdentifierTableTrait {
3124 typedef key_type key_type_ref;
3127 typedef data_type data_type_ref;
3129 typedef unsigned hash_value_type;
3130 typedef unsigned offset_type;
3134 : Writer(Writer), PP(PP), IdResolver(IdResolver) {}
3137 return llvm::HashString(II->
getName());
3140 std::pair<unsigned,unsigned>
3143 unsigned DataLen = 4;
3144 auto MacroOffset = Writer.getMacroDirectivesOffset(II);
3152 DEnd = IdResolver.end();
3156 using namespace llvm::support;
3157 endian::Writer<little> LE(Out);
3159 assert((uint16_t)DataLen == DataLen && (uint16_t)KeyLen == KeyLen);
3160 LE.write<uint16_t>(DataLen);
3164 LE.write<uint16_t>(KeyLen);
3165 return std::make_pair(KeyLen, DataLen);
3172 Writer.SetIdentifierOffset(II, Out.tell());
3178 using namespace llvm::support;
3179 endian::Writer<little> LE(Out);
3181 auto MacroOffset = Writer.getMacroDirectivesOffset(II);
3183 LE.write<uint32_t>(ID << 1);
3187 LE.write<uint32_t>((ID << 1) | 0x01);
3189 assert((Bits & 0xffff) == Bits &&
"ObjCOrBuiltinID too big for ASTReader.");
3190 LE.write<uint16_t>(Bits);
3192 bool HadMacroDefinition = MacroOffset != 0;
3193 Bits = (Bits << 1) |
unsigned(HadMacroDefinition);
3195 Bits = (Bits << 1) |
unsigned(II->
isPoisoned());
3198 LE.write<uint16_t>(Bits);
3200 if (HadMacroDefinition)
3201 LE.write<uint32_t>(MacroOffset);
3211 DEnd = Decls.rend();
3227 using namespace llvm;
3232 llvm::OnDiskChainedHashTableGenerator<ASTIdentifierTableTrait> Generator;
3233 ASTIdentifierTableTrait Trait(*
this, PP, IdResolver);
3244 IIs.push_back(ID->second);
3247 std::sort(IIs.begin(), IIs.end(), llvm::less_ptr<IdentifierInfo>());
3249 getIdentifierRef(II);
3253 IdentifierOffsets.resize(NextIdentID - FirstIdentID);
3254 for (
auto IdentIDPair : IdentifierIDs) {
3256 IdentID ID = IdentIDPair.second;
3257 assert(II &&
"NULL identifier in identifier table");
3259 Generator.insert(II, ID, Trait);
3264 uint32_t BucketOffset;
3266 using namespace llvm::support;
3267 llvm::raw_svector_ostream Out(IdentifierTable);
3269 endian::Writer<little>(Out).write<uint32_t>(0);
3270 BucketOffset = Generator.Emit(Out, Trait);
3274 BitCodeAbbrev *Abbrev =
new BitCodeAbbrev();
3276 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
3277 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
3278 unsigned IDTableAbbrev = Stream.EmitAbbrev(Abbrev);
3283 Record.push_back(BucketOffset);
3284 Stream.EmitRecordWithBlob(IDTableAbbrev, Record, IdentifierTable);
3288 BitCodeAbbrev *Abbrev =
new BitCodeAbbrev();
3290 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
3291 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
3292 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
3293 unsigned IdentifierOffsetAbbrev = Stream.EmitAbbrev(Abbrev);
3296 for (
unsigned I = 0, N = IdentifierOffsets.size(); I != N; ++I)
3297 assert(IdentifierOffsets[I] &&
"Missing identifier offset?");
3302 Record.push_back(IdentifierOffsets.size());
3304 Stream.EmitRecordWithBlob(IdentifierOffsetAbbrev, Record,
3305 bytes(IdentifierOffsets));
3314 class ASTDeclContextNameLookupTrait {
3319 typedef key_type key_type_ref;
3322 typedef const data_type& data_type_ref;
3324 typedef unsigned hash_value_type;
3325 typedef unsigned offset_type;
3327 explicit ASTDeclContextNameLookupTrait(
ASTWriter &Writer) : Writer(Writer) { }
3330 llvm::FoldingSetNodeID
ID;
3355 return ID.ComputeHash();
3358 std::pair<unsigned,unsigned>
3360 data_type_ref Lookup) {
3361 using namespace llvm::support;
3362 endian::Writer<little> LE(Out);
3363 unsigned KeyLen = 1;
3381 LE.write<uint16_t>(KeyLen);
3384 unsigned DataLen = 2 + 4 * Lookup.size();
3385 LE.write<uint16_t>(DataLen);
3387 return std::make_pair(KeyLen, DataLen);
3391 using namespace llvm::support;
3392 endian::Writer<little> LE(Out);
3405 "Invalid operator?");
3418 llvm_unreachable(
"Invalid name kind?");
3421 void EmitData(raw_ostream& Out, key_type_ref,
3422 data_type Lookup,
unsigned DataLen) {
3423 using namespace llvm::support;
3424 endian::Writer<little> LE(Out);
3425 uint64_t Start = Out.tell(); (void)Start;
3426 LE.write<uint16_t>(Lookup.size());
3432 assert(Out.tell() - Start == DataLen &&
"Data length is wrong");
3439 return Result.
hasExternalDecls() && DC->NeedToReconcileExternalVisibleStorage;
3442 bool ASTWriter::isLookupResultEntirelyExternal(
StoredDeclsList &Result,
3452 ASTWriter::GenerateNameLookupTable(
const DeclContext *ConstDC,
3454 assert(!ConstDC->HasLazyLocalLexicalLookups &&
3455 !ConstDC->HasLazyExternalLexicalLookups &&
3456 "must call buildLookups first");
3463 llvm::OnDiskChainedHashTableGenerator<ASTDeclContextNameLookupTrait>
3465 ASTDeclContextNameLookupTrait Trait(*
this);
3474 llvm::SmallSet<DeclarationName, 8> ConstructorNameSet, ConversionNameSet;
3477 auto &Name = Lookup.first;
3478 auto &Result = Lookup.second;
3484 if (isLookupResultExternal(Result, DC) && !isRewritten(cast<Decl>(DC)) &&
3485 isLookupResultEntirelyExternal(Result, DC))
3502 if (Lookup.second.getLookupResult().empty())
3505 switch (Lookup.first.getNameKind()) {
3507 Names.push_back(Lookup.first);
3511 assert(isa<CXXRecordDecl>(DC) &&
3512 "Cannot have a constructor name outside of a class!");
3513 ConstructorNameSet.insert(Name);
3517 assert(isa<CXXRecordDecl>(DC) &&
3518 "Cannot have a conversion function name outside of a class!");
3519 ConversionNameSet.insert(Name);
3525 std::sort(Names.begin(), Names.end());
3527 if (
auto *D = dyn_cast<CXXRecordDecl>(DC)) {
3541 if (ConstructorNameSet.erase(ImplicitCtorName))
3542 Names.push_back(ImplicitCtorName);
3547 if (!ConstructorNameSet.empty() || !ConversionNameSet.empty())
3548 for (
Decl *ChildD : cast<CXXRecordDecl>(DC)->decls())
3549 if (
auto *ChildND = dyn_cast<NamedDecl>(ChildD)) {
3550 auto Name = ChildND->getDeclName();
3556 if (ConstructorNameSet.erase(Name))
3557 Names.push_back(Name);
3561 if (ConversionNameSet.erase(Name))
3562 Names.push_back(Name);
3566 if (ConstructorNameSet.empty() && ConversionNameSet.empty())
3570 assert(ConstructorNameSet.empty() &&
"Failed to find all of the visible "
3571 "constructors by walking all the "
3572 "lexical members of the context.");
3573 assert(ConversionNameSet.empty() &&
"Failed to find all of the visible "
3574 "conversion functions by walking all "
3575 "the lexical members of the context.");
3582 for (
auto &Name : Names)
3594 for (
auto &Name : Names) {
3599 Generator.insert(Name, Result, Trait);
3603 ConstructorDecls.append(Result.
begin(), Result.
end());
3607 ConversionDecls.append(Result.
begin(), Result.
end());
3615 if (!ConstructorDecls.empty())
3616 Generator.insert(ConstructorDecls.front()->getDeclName(),
3618 if (!ConversionDecls.empty())
3619 Generator.insert(ConversionDecls.front()->getDeclName(),
3623 llvm::raw_svector_ostream Out(LookupTable);
3625 using namespace llvm::support;
3626 endian::Writer<little>(Out).write<uint32_t>(0);
3627 return Generator.Emit(Out, Trait);
3635 uint64_t ASTWriter::WriteDeclContextVisibleBlock(
ASTContext &Context,
3640 if (isa<NamespaceDecl>(DC) && Chain &&
3641 Chain->getKeyDeclaration(cast<Decl>(DC))->isFromASTFile()) {
3645 if (!Prev->isFromASTFile())
3658 LookupResults.reserve(Map->size());
3659 for (
auto &Entry : *Map)
3660 LookupResults.push_back(
3661 std::make_pair(Entry.first, Entry.second.getLookupResult()));
3664 std::sort(LookupResults.begin(), LookupResults.end(), llvm::less_first());
3665 for (
auto &NameAndResult : LookupResults) {
3673 assert(Result.
empty() &&
"Cannot have a constructor or conversion "
3674 "function name in a namespace!");
3679 if (!ND->isFromASTFile())
3703 uint64_t Offset = Stream.GetCurrentBitNo();
3705 if (!Map || Map->empty())
3710 uint32_t BucketOffset = GenerateNameLookupTable(DC, LookupTable);
3715 Record.push_back(BucketOffset);
3716 Stream.EmitRecordWithBlob(DeclContextVisibleLookupAbbrev, Record,
3718 ++NumVisibleDeclContexts;
3728 void ASTWriter::WriteDeclContextVisibleUpdate(
const DeclContext *DC) {
3730 if (!Map || Map->empty())
3735 uint32_t BucketOffset = GenerateNameLookupTable(DC, LookupTable);
3739 if (isa<NamespaceDecl>(DC))
3740 DC = cast<DeclContext>(Chain->getKeyDeclaration(cast<Decl>(DC)));
3745 Record.push_back(getDeclID(cast<Decl>(DC)));
3746 Record.push_back(BucketOffset);
3747 Stream.EmitRecordWithBlob(UpdateVisibleAbbrev, Record, LookupTable);
3751 void ASTWriter::WriteFPPragmaOptions(
const FPOptions &Opts) {
3758 void ASTWriter::WriteOpenCLExtensions(
Sema &SemaRef) {
3764 #define OPENCLEXT(nm) Record.push_back(Opts.nm);
3765 #include "clang/Basic/OpenCLExtensions.def"
3769 void ASTWriter::WriteRedeclarations() {
3770 RecordData LocalRedeclChains;
3773 for (
unsigned I = 0, N = Redeclarations.size(); I != N; ++I) {
3774 const Decl *Key = Redeclarations[I];
3775 assert((Chain ? Chain->getKeyDeclaration(Key) == Key
3777 "not the key declaration");
3783 "should not have imported key decls for predefined decl");
3787 if (First == MostRecent)
3790 unsigned Offset = LocalRedeclChains.size();
3792 LocalRedeclChains.push_back(0);
3795 for (
const Decl *Prev = MostRecent; Prev;
3797 if (!Prev->isFromASTFile() && Prev != Key) {
3798 AddDeclRef(Prev, LocalRedeclChains);
3803 LocalRedeclChains[
Offset] = Size;
3807 std::reverse(LocalRedeclChains.end() - Size, LocalRedeclChains.end());
3812 LocalRedeclsMap.push_back(Info);
3814 assert(N == Redeclarations.size() &&
3815 "Deserialized a declaration we shouldn't have");
3818 if (LocalRedeclChains.empty())
3823 llvm::array_pod_sort(LocalRedeclsMap.begin(), LocalRedeclsMap.end());
3826 using namespace llvm;
3827 llvm::BitCodeAbbrev *Abbrev =
new BitCodeAbbrev();
3829 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
3830 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
3831 unsigned AbbrevID = Stream.EmitAbbrev(Abbrev);
3835 Record.push_back(LocalRedeclsMap.size());
3836 Stream.EmitRecordWithBlob(AbbrevID, Record,
3837 reinterpret_cast<char*>(LocalRedeclsMap.data()),
3844 void ASTWriter::WriteObjCCategories() {
3846 RecordData Categories;
3848 for (
unsigned I = 0, N = ObjCClassesWithCategories.size(); I != N; ++I) {
3850 unsigned StartIndex = Categories.size();
3855 Categories.push_back(0);
3861 Cat != CatEnd; ++Cat, ++Size) {
3862 assert(getDeclID(*Cat) != 0 &&
"Bogus category");
3863 AddDeclRef(*Cat, Categories);
3867 Categories[StartIndex] = Size;
3871 CategoriesMap.push_back(CatInfo);
3876 llvm::array_pod_sort(CategoriesMap.begin(), CategoriesMap.end());
3879 using namespace llvm;
3880 llvm::BitCodeAbbrev *Abbrev =
new BitCodeAbbrev();
3882 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
3883 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
3884 unsigned AbbrevID = Stream.EmitAbbrev(Abbrev);
3888 Record.push_back(CategoriesMap.size());
3889 Stream.EmitRecordWithBlob(AbbrevID, Record,
3890 reinterpret_cast<char*>(CategoriesMap.data()),
3897 void ASTWriter::WriteLateParsedTemplates(
Sema &SemaRef) {
3904 for (
auto LPTMapEntry : LPTMap) {
3907 AddDeclRef(FD, Record);
3908 AddDeclRef(LPT->
D, Record);
3909 Record.push_back(LPT->
Toks.size());
3911 for (CachedTokens::iterator TokIt = LPT->
Toks.begin(),
3912 TokEnd = LPT->
Toks.end();
3913 TokIt != TokEnd; ++TokIt) {
3914 AddToken(*TokIt, Record);
3921 void ASTWriter::WriteOptimizePragmaOptions(
Sema &SemaRef) {
3924 AddSourceLocation(PragmaLoc, Record);
3934 RecordDataImpl &Record) {
3935 Record.push_back(Attrs.size());
3937 e = Attrs.end(); i != e; ++i){
3939 Record.push_back(A->
getKind());
3940 AddSourceRange(A->
getRange(), Record);
3942 #include "clang/Serialization/AttrPCHWrite.inc"
3955 Record.push_back(Tok.
getKind());
3961 Record.push_back(Str.size());
3962 Record.insert(Record.end(), Str.begin(), Str.end());
3966 assert(Context &&
"should have context when outputting path");
3972 const char *PathBegin = Path.data();
3973 const char *PathPtr =
3975 if (PathPtr != PathBegin) {
3976 Path.erase(Path.begin(), Path.begin() + (PathPtr - PathBegin));
3985 PreparePathForOutput(FilePath);
3986 AddString(FilePath, Record);
3992 PreparePathForOutput(FilePath);
3993 Stream.EmitRecordWithBlob(Abbrev, Record, FilePath);
3998 Record.push_back(Version.
getMajor());
4000 Record.push_back(*Minor + 1);
4002 Record.push_back(0);
4004 Record.push_back(*Subminor + 1);
4006 Record.push_back(0);
4012 IdentID ID = IdentifierIDs[II];
4015 if (ID >= FirstIdentID)
4016 IdentifierOffsets[ID - FirstIdentID] =
Offset;
4022 unsigned ID = SelectorIDs[Sel];
4023 assert(ID &&
"Unknown selector");
4026 if (ID < FirstSelectorID)
4028 SelectorOffsets[ID - FirstSelectorID] =
Offset;
4032 : Stream(Stream), Context(nullptr), PP(nullptr), Chain(nullptr),
4033 WritingModule(nullptr), WritingAST(
false),
4034 DoneWritingDeclsAndTypes(
false), ASTHasCompilerErrors(
false),
4040 NextSubmoduleID(FirstSubmoduleID),
4042 CollectedStmts(&StmtsToEmit), NumStatements(0), NumMacros(0),
4043 NumLexicalDeclContexts(0), NumVisibleDeclContexts(0),
4044 NextCXXBaseSpecifiersID(1), NextCXXCtorInitializersID(1),
4045 TypeExtQualAbbrev(0),
4046 TypeFunctionProtoAbbrev(0), DeclParmVarAbbrev(0),
4047 DeclContextLexicalAbbrev(0), DeclContextVisibleLookupAbbrev(0),
4048 UpdateVisibleAbbrev(0), DeclRecordAbbrev(0), DeclTypedefAbbrev(0),
4049 DeclVarAbbrev(0), DeclFieldAbbrev(0), DeclEnumAbbrev(0),
4050 DeclObjCIvarAbbrev(0), DeclCXXMethodAbbrev(0), DeclRefExprAbbrev(0),
4051 CharacterLiteralAbbrev(0), IntegerLiteralAbbrev(0),
4052 ExprImplicitCastAbbrev(0) {}
4055 llvm::DeleteContainerSeconds(FileDeclIDs);
4059 assert(WritingAST &&
"can't determine lang opts when not writing AST");
4064 const std::string &OutputFile,
4065 Module *WritingModule, StringRef isysroot,
4069 ASTHasCompilerErrors = hasErrors;
4072 Stream.Emit((
unsigned)
'C', 8);
4073 Stream.Emit((
unsigned)
'P', 8);
4074 Stream.Emit((
unsigned)
'C', 8);
4075 Stream.Emit((
unsigned)
'H', 8);
4077 WriteBlockInfoBlock();
4081 this->WritingModule = WritingModule;
4082 WriteASTCore(SemaRef, isysroot, OutputFile, WritingModule);
4085 this->WritingModule =
nullptr;
4086 this->BaseDirectory.clear();
4091 template<
typename Vector>
4094 for (
typename Vector::iterator I = Vec.begin(
nullptr,
true), E = Vec.end();
4100 void ASTWriter::WriteASTCore(
Sema &SemaRef,
4102 const std::string &OutputFile,
4104 using namespace llvm;
4106 bool isModule = WritingModule !=
nullptr;
4110 Chain->finalizeForWriting();
4118 assert(D->isCanonicalDecl() &&
"predefined decl is not canonical");
4120 if (D->getMostRecentDecl() != D)
4121 Redeclarations.push_back(D);
4129 RegisterPredefDecl(Context.ObjCProtocolClassDecl,
4133 RegisterPredefDecl(Context.ObjCInstanceTypeDecl,
4148 UnusedFileScopedDecls);
4162 WeakInfo &WI = WeakUndeclaredIdentifier.second;
4166 WeakUndeclaredIdentifiers.push_back(WI.
getUsed());
4176 for (
unsigned I = 0, N = SemaRef.
VTableUses.size(); I != N; ++I) {
4186 AddDeclRef(TD, UnusedLocalTypedefNameCandidates);
4190 for (std::deque<Sema::PendingImplicitInstantiation>::iterator
4197 "There are local ones at end of translation unit!");
4213 for (llvm::MapVector<NamespaceDecl*, bool>::iterator
4214 I = SemaRef.KnownNamespaces.begin(),
4215 IEnd = SemaRef.KnownNamespaces.end();
4226 for (
SmallVectorImpl<std::pair<NamedDecl *, SourceLocation> >::iterator
4227 I = Undefined.begin(), E = Undefined.end(); I != E; ++I) {
4236 for (
const auto &DeleteExprsInfo :
4238 AddDeclRef(DeleteExprsInfo.first, DeleteExprsToAnalyze);
4239 DeleteExprsToAnalyze.push_back(DeleteExprsInfo.second.size());
4240 for (
const auto &DeleteLoc : DeleteExprsInfo.second) {
4242 DeleteExprsToAnalyze.push_back(DeleteLoc.second);
4247 WriteControlBlock(PP, Context, isysroot, OutputFile);
4263 for (
const auto *I : TU->noload_decls()) {
4264 if (!I->isFromASTFile())
4265 NewGlobalDecls.push_back(std::make_pair(I->getKind(),
GetDeclRef(I)));
4268 llvm::BitCodeAbbrev *Abv =
new llvm::BitCodeAbbrev();
4270 Abv->Add(llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::Blob));
4271 unsigned TuUpdateLexicalAbbrev = Stream.EmitAbbrev(Abv);
4274 Stream.EmitRecordWithBlob(TuUpdateLexicalAbbrev, Record,
4275 bytes(NewGlobalDecls));
4278 Abv =
new llvm::BitCodeAbbrev();
4280 Abv->Add(llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::VBR, 6));
4281 Abv->Add(llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::Fixed, 32));
4282 Abv->Add(llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::Blob));
4283 UpdateVisibleAbbrev = Stream.EmitAbbrev(Abv);
4284 WriteDeclContextVisibleUpdate(TU);
4287 if (Context.ExternCContext)
4288 WriteDeclContextVisibleUpdate(Context.ExternCContext);
4302 for (
const auto &Number : Context.MangleNumbers)
4303 if (!Number.first->isFromASTFile())
4306 for (
const auto &Number : Context.StaticLocalNumbers)
4307 if (!Number.first->isFromASTFile())
4314 I = UpdatingVisibleDecls.begin(),
4315 E = UpdatingVisibleDecls.end(); I != E; ++I) {
4324 ID != IDEnd; ++
ID) {
4330 std::sort(IIs.begin(), IIs.end(), llvm::less_ptr<IdentifierInfo>());
4345 AddTypeRef(Context.ObjCIdRedefinitionType, SpecialTypes);
4346 AddTypeRef(Context.ObjCClassRedefinitionType, SpecialTypes);
4347 AddTypeRef(Context.ObjCSelRedefinitionType, SpecialTypes);
4366 llvm::BitCodeAbbrev *Abbrev =
new BitCodeAbbrev();
4368 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
4369 unsigned ModuleOffsetMapAbbrev = Stream.EmitAbbrev(Abbrev);
4372 llvm::raw_svector_ostream Out(Buffer);
4374 using namespace llvm::support;
4375 endian::Writer<little> LE(Out);
4377 LE.write<uint16_t>(FileName.size());
4378 Out.write(FileName.data(), FileName.size());
4382 uint32_t
None = std::numeric_limits<uint32_t>::max();
4384 auto writeBaseIDOrNone = [&](uint32_t BaseID,
bool ShouldWrite) {
4385 assert(BaseID < std::numeric_limits<uint32_t>::max() &&
"base id too high");
4387 LE.write<uint32_t>(BaseID);
4389 LE.write<uint32_t>(
None);
4407 Stream.EmitRecordWithBlob(ModuleOffsetMapAbbrev, Record,
4408 Buffer.data(), Buffer.size());
4418 for (DeclsToRewriteTy::iterator I = DeclsToRewrite.begin(),
4419 E = DeclsToRewrite.end();
4421 DeclTypesToEmit.push(const_cast<Decl*>(*I));
4423 WriteDeclUpdatesBlocks(DeclUpdatesOffsetsRecord);
4424 while (!DeclTypesToEmit.empty()) {
4425 DeclOrType DOT = DeclTypesToEmit.front();
4426 DeclTypesToEmit.pop();
4428 WriteType(DOT.getType());
4430 WriteDecl(Context, DOT.getDecl());
4432 }
while (!DeclUpdates.empty());
4435 DoneWritingDeclsAndTypes =
true;
4438 WriteTypeDeclOffsets();
4439 if (!DeclUpdatesOffsetsRecord.empty())
4441 WriteCXXBaseSpecifiersOffsets();
4442 WriteCXXCtorInitializersOffsets();
4443 WriteFileDeclIDsMap();
4447 WritePreprocessor(PP, isModule);
4449 WriteSelectors(SemaRef);
4450 WriteReferencedSelectorsPool(SemaRef);
4451 WriteIdentifierTable(PP, SemaRef.
IdResolver, isModule);
4453 WriteOpenCLExtensions(SemaRef);
4454 WritePragmaDiagnosticMappings(Context.
getDiagnostics(), isModule);
4458 WriteSubmodules(WritingModule);
4463 if (!EagerlyDeserializedDecls.empty())
4467 if (!TentativeDefinitions.empty())
4471 if (!UnusedFileScopedDecls.empty())
4475 if (!WeakUndeclaredIdentifiers.empty())
4477 WeakUndeclaredIdentifiers);
4480 if (!ExtVectorDecls.empty())
4484 if (!VTableUses.empty())
4488 if (!UnusedLocalTypedefNameCandidates.empty())
4490 UnusedLocalTypedefNameCandidates);
4493 if (!PendingInstantiations.empty())
4497 if (!SemaDeclRefs.empty())
4501 if (!CUDASpecialDeclRefs.empty())
4505 if (!DelegatingCtorDecls.empty())
4509 if (!KnownNamespaces.empty())
4513 if (!UndefinedButUsed.empty())
4516 if (!DeleteExprsToAnalyze.empty())
4520 for (
auto *DC : UpdatedDeclContexts)
4521 WriteDeclContextVisibleUpdate(DC);
4523 if (!WritingModule) {
4528 ModuleInfo(uint64_t ID,
Module *M) : ID(ID), M(M) {}
4532 assert(SubmoduleIDs.find(I->getImportedModule()) != SubmoduleIDs.end());
4533 Imports.push_back(ModuleInfo(SubmoduleIDs[I->getImportedModule()],
4534 I->getImportedModule()));
4537 if (!Imports.empty()) {
4538 auto Cmp = [](
const ModuleInfo &A,
const ModuleInfo &B) {
4541 auto Eq = [](
const ModuleInfo &A,
const ModuleInfo &B) {
4542 return A.ID == B.ID;
4546 std::sort(Imports.begin(), Imports.end(), Cmp);
4547 Imports.erase(std::unique(Imports.begin(), Imports.end(), Eq),
4551 for (
const auto &Import : Imports) {
4552 ImportedModules.push_back(Import.ID);
4563 WriteDeclReplacementsBlock();
4564 WriteRedeclarations();
4565 WriteObjCCategories();
4566 WriteLateParsedTemplates(SemaRef);
4568 WriteOptimizePragmaOptions(SemaRef);
4572 Record.push_back(NumStatements);
4573 Record.push_back(NumMacros);
4574 Record.push_back(NumLexicalDeclContexts);
4575 Record.push_back(NumVisibleDeclContexts);
4580 void ASTWriter::WriteDeclUpdatesBlocks(
RecordDataImpl &OffsetsRecord) {
4581 if (DeclUpdates.empty())
4584 DeclUpdateMap LocalUpdates;
4585 LocalUpdates.swap(DeclUpdates);
4587 for (
auto &DeclUpdate : LocalUpdates) {
4588 const Decl *D = DeclUpdate.first;
4592 bool HasUpdatedBody =
false;
4594 for (
auto &Update : DeclUpdate.second) {
4597 Record.push_back(Kind);
4602 assert(Update.getDecl() &&
"no decl to add?");
4603 Record.push_back(
GetDeclRef(Update.getDecl()));
4610 HasUpdatedBody =
true;
4618 auto *RD = cast<CXXRecordDecl>(D);
4619 UpdatedDeclContexts.insert(RD->getPrimaryContext());
4621 Record.push_back(WriteDeclContextLexicalBlock(
4622 *Context, const_cast<CXXRecordDecl *>(RD)));
4627 if (
auto *MSInfo = RD->getMemberSpecializationInfo()) {
4628 Record.push_back(MSInfo->getTemplateSpecializationKind());
4631 auto *Spec = cast<ClassTemplateSpecializationDecl>(RD);
4632 Record.push_back(Spec->getTemplateSpecializationKind());
4637 auto From = Spec->getInstantiatedFrom();
4638 if (
auto PartialSpec =
4640 Record.push_back(
true);
4645 Record.push_back(
false);
4648 Record.push_back(RD->getTagKind());
4656 WriteAttributes(llvm::makeArrayRef(D->
getAttrs().begin(),
4670 cast<FunctionDecl>(D)->getType()->castAs<FunctionProtoType>(),
4683 Record.push_back(Update.getNumber());
4692 Record.push_back(getSubmoduleID(Update.getModule()));
4696 WriteAttributes(llvm::makeArrayRef(Update.getAttr()), Record);
4701 if (HasUpdatedBody) {
4706 AddFunctionDefinition(Def, Record);
4710 OffsetsRecord.push_back(Stream.GetCurrentBitNo());
4718 void ASTWriter::WriteDeclReplacementsBlock() {
4719 if (ReplacedDecls.empty())
4724 I = ReplacedDecls.begin(), E = ReplacedDecls.end(); I != E; ++I) {
4725 Record.push_back(I->ID);
4726 Record.push_back(I->Offset);
4727 Record.push_back(I->Loc);
4742 Record.push_back(Value.getBitWidth());
4743 const uint64_t *Words = Value.getRawData();
4744 Record.append(Words, Words + Value.getNumWords());
4748 Record.push_back(Value.isUnsigned());
4753 AddAPInt(Value.bitcastToAPInt(), Record);
4764 IdentID &ID = IdentifierIDs[II];
4780 MacroInfoToEmitData Info = { Name, MI, ID };
4781 MacroInfosToEmit.push_back(Info);
4790 assert(MacroIDs.find(MI) != MacroIDs.end() &&
"Macro not emitted!");
4791 return MacroIDs[MI];
4795 return IdentMacroDirectivesOffsetMap.lookup(Name);
4808 if (SID == 0 && Chain) {
4811 Chain->LoadSelector(Sel);
4812 SID = SelectorIDs[Sel];
4815 SID = NextSelectorID++;
4816 SelectorIDs[Sel] = SID;
4827 assert(!Inits.empty() &&
"Empty ctor initializer sets are not recorded");
4828 CXXCtorInitializersToWrite.push_back(
4829 QueuedCXXCtorInitializers(NextCXXCtorInitializersID, Inits));
4830 Record.push_back(NextCXXCtorInitializersID++);
4836 assert(Bases != BasesEnd &&
"Empty base-specifier sets are not recorded");
4837 CXXBaseSpecifiersToWrite.push_back(
4838 QueuedCXXBaseSpecifiers(NextCXXBaseSpecifiersID,
4840 Record.push_back(NextCXXBaseSpecifiersID++);
4877 bool InfoHasSameExpr
4879 Record.push_back(InfoHasSameExpr);
4880 if (InfoHasSameExpr)
4900 TypeLocWriter TLW(*
this, Record);
4917 if (Idx.getIndex() == 0) {
4918 if (DoneWritingDeclsAndTypes) {
4919 assert(0 &&
"New type seen after serializing all the types to emit!");
4926 DeclTypesToEmit.push(T);
4939 TypeIdxMap::const_iterator I = TypeIdxs.find(T);
4940 assert(I != TypeIdxs.end() &&
"Type not emitted!");
4950 assert(WritingAST &&
"Cannot request a declaration ID before AST writing");
4961 assert(!(reinterpret_cast<uintptr_t>(D) & 0x01) &&
"Invalid decl pointer");
4964 if (DoneWritingDeclsAndTypes) {
4965 assert(0 &&
"New decl seen after serializing all the decls to emit!");
4972 DeclTypesToEmit.push(const_cast<Decl *>(D));
4987 assert(DeclIDs.find(D) != DeclIDs.end() &&
"Declaration not emitted!");
4991 void ASTWriter::associateDeclWithFile(
const Decl *D,
DeclID ID) {
5004 if (isa<ParmVarDecl>(D))
5013 if (FID.isInvalid())
5017 DeclIDInFileInfo *&Info = FileDeclIDs[FID];
5019 Info =
new DeclIDInFileInfo();
5021 std::pair<unsigned, serialization::DeclID> LocDecl(Offset, ID);
5022 LocDeclIDsTy &Decls = Info->DeclIDs;
5024 if (Decls.empty() || Decls.back().first <=
Offset) {
5025 Decls.push_back(LocDecl);
5029 LocDeclIDsTy::iterator I =
5030 std::upper_bound(Decls.begin(), Decls.end(), LocDecl, llvm::less_first());
5032 Decls.insert(I, LocDecl);
5071 "expected an anonymous declaration");
5075 auto It = AnonymousDeclarationNumbers.find(D);
5076 if (It == AnonymousDeclarationNumbers.end()) {
5079 AnonymousDeclarationNumbers[ND] = Number;
5082 It = AnonymousDeclarationNumbers.find(D);
5083 assert(It != AnonymousDeclarationNumbers.end() &&
5084 "declaration not found within its lexical context");
5146 NestedNames.push_back(NNS);
5150 Record.push_back(NestedNames.size());
5151 while(!NestedNames.empty()) {
5152 NNS = NestedNames.pop_back_val();
5154 Record.push_back(Kind);
5194 NestedNames.push_back(NNS);
5198 Record.push_back(NestedNames.size());
5199 while(!NestedNames.empty()) {
5200 NNS = NestedNames.pop_back_val();
5203 Record.push_back(Kind);
5241 Record.push_back(Kind);
5249 Record.push_back(OvT->
size());
5295 Record.push_back(Arg.
getKind());
5319 Record.push_back(*NumExpansions + 1);
5321 Record.push_back(0);
5337 assert(TemplateParams &&
"No TemplateParams!");
5341 Record.push_back(TemplateParams->
size());
5343 P = TemplateParams->
begin(), PEnd = TemplateParams->
end();
5352 assert(TemplateArgs &&
"No TemplateArgs!");
5353 Record.push_back(TemplateArgs->
size());
5354 for (
int i=0, e = TemplateArgs->
size(); i != e; ++i)
5361 assert(ASTTemplArgList &&
"No ASTTemplArgList!");
5372 Record.push_back(Set.
size());
5374 I = Set.
begin(), E = Set.
end(); I != E; ++I) {
5376 Record.push_back(I.getAccess());
5395 unsigned N = CXXBaseSpecifiersToWrite.size();
5396 for (
unsigned I = 0; I != N; ++I) {
5400 unsigned Index = CXXBaseSpecifiersToWrite[I].ID - 1;
5401 if (Index == CXXBaseSpecifiersOffsets.size())
5402 CXXBaseSpecifiersOffsets.push_back(Stream.GetCurrentBitNo());
5404 if (Index > CXXBaseSpecifiersOffsets.size())
5405 CXXBaseSpecifiersOffsets.resize(Index + 1);
5406 CXXBaseSpecifiersOffsets[Index] = Stream.GetCurrentBitNo();
5410 *BEnd = CXXBaseSpecifiersToWrite[I].BasesEnd;
5411 Record.push_back(BEnd - B);
5412 for (; B != BEnd; ++B)
5420 assert(N == CXXBaseSpecifiersToWrite.size() &&
5421 "added more base specifiers while writing base specifiers");
5422 CXXBaseSpecifiersToWrite.clear();
5427 unsigned NumCtorInitializers,
5429 Record.push_back(NumCtorInitializers);
5430 for (
unsigned i=0; i != NumCtorInitializers; ++i) {
5466 unsigned N = CXXCtorInitializersToWrite.size();
5468 for (
auto &Init : CXXCtorInitializersToWrite) {
5472 unsigned Index = Init.ID - 1;
5473 if (Index == CXXCtorInitializersOffsets.size())
5474 CXXCtorInitializersOffsets.push_back(Stream.GetCurrentBitNo());
5476 if (Index > CXXCtorInitializersOffsets.size())
5477 CXXCtorInitializersOffsets.resize(Index + 1);
5478 CXXCtorInitializersOffsets[Index] = Stream.GetCurrentBitNo();
5488 assert(N == CXXCtorInitializersToWrite.size() &&
5489 "added more ctor initializers while writing ctor initializers");
5490 CXXCtorInitializersToWrite.clear();
5494 auto &Data = D->data();
5495 Record.push_back(Data.IsLambda);
5496 Record.push_back(Data.UserDeclaredConstructor);
5497 Record.push_back(Data.UserDeclaredSpecialMembers);
5498 Record.push_back(Data.Aggregate);
5499 Record.push_back(Data.PlainOldData);
5500 Record.push_back(Data.Empty);
5501 Record.push_back(Data.Polymorphic);
5502 Record.push_back(Data.Abstract);
5503 Record.push_back(Data.IsStandardLayout);
5504 Record.push_back(Data.HasNoNonEmptyBases);
5505 Record.push_back(Data.HasPrivateFields);
5506 Record.push_back(Data.HasProtectedFields);
5507 Record.push_back(Data.HasPublicFields);
5508 Record.push_back(Data.HasMutableFields);
5509 Record.push_back(Data.HasVariantMembers);
5510 Record.push_back(Data.HasOnlyCMembers);
5511 Record.push_back(Data.HasInClassInitializer);
5512 Record.push_back(Data.HasUninitializedReferenceMember);
5513 Record.push_back(Data.NeedOverloadResolutionForMoveConstructor);
5514 Record.push_back(Data.NeedOverloadResolutionForMoveAssignment);
5515 Record.push_back(Data.NeedOverloadResolutionForDestructor);
5516 Record.push_back(Data.DefaultedMoveConstructorIsDeleted);
5517 Record.push_back(Data.DefaultedMoveAssignmentIsDeleted);
5518 Record.push_back(Data.DefaultedDestructorIsDeleted);
5519 Record.push_back(Data.HasTrivialSpecialMembers);
5520 Record.push_back(Data.DeclaredNonTrivialSpecialMembers);
5521 Record.push_back(Data.HasIrrelevantDestructor);
5522 Record.push_back(Data.HasConstexprNonCopyMoveConstructor);
5523 Record.push_back(Data.DefaultedDefaultConstructorIsConstexpr);
5524 Record.push_back(Data.HasConstexprDefaultConstructor);
5525 Record.push_back(Data.HasNonLiteralTypeFieldsOrBases);
5526 Record.push_back(Data.ComputedVisibleConversions);
5527 Record.push_back(Data.UserProvidedDefaultConstructor);
5528 Record.push_back(Data.DeclaredSpecialMembers);
5529 Record.push_back(Data.ImplicitCopyConstructorHasConstParam);
5530 Record.push_back(Data.ImplicitCopyAssignmentHasConstParam);
5531 Record.push_back(Data.HasDeclaredCopyConstructorWithConstParam);
5532 Record.push_back(Data.HasDeclaredCopyAssignmentWithConstParam);
5535 Record.push_back(Data.NumBases);
5536 if (Data.NumBases > 0)
5541 Record.push_back(Data.NumVBases);
5542 if (Data.NumVBases > 0)
5552 if (Data.IsLambda) {
5553 auto &Lambda = D->getLambdaData();
5554 Record.push_back(Lambda.Dependent);
5555 Record.push_back(Lambda.IsGenericLambda);
5556 Record.push_back(Lambda.CaptureDefault);
5557 Record.push_back(Lambda.NumCaptures);
5558 Record.push_back(Lambda.NumExplicitCaptures);
5559 Record.push_back(Lambda.ManglingNumber);
5562 for (
unsigned I = 0, N = Lambda.NumCaptures; I != N; ++I) {
5586 assert(Reader &&
"Cannot remove chain");
5587 assert((!Chain || Chain == Reader) &&
"Cannot replace chain");
5588 assert(FirstDeclID == NextDeclID &&
5589 FirstTypeID == NextTypeID &&
5590 FirstIdentID == NextIdentID &&
5591 FirstMacroID == NextMacroID &&
5592 FirstSubmoduleID == NextSubmoduleID &&
5593 FirstSelectorID == NextSelectorID &&
5594 "Setting chain after writing has started.");
5606 NextDeclID = FirstDeclID;
5607 NextTypeID = FirstTypeID;
5608 NextIdentID = FirstIdentID;
5609 NextMacroID = FirstMacroID;
5610 NextSelectorID = FirstSelectorID;
5611 NextSubmoduleID = FirstSubmoduleID;
5616 IdentID &StoredID = IdentifierIDs[II];
5623 MacroID &StoredID = MacroIDs[MI];
5634 TypeIdx &StoredIdx = TypeIdxs[T];
5648 assert(MacroDefinitions.find(MD) == MacroDefinitions.end());
5649 MacroDefinitions[MD] =
ID;
5653 assert(SubmoduleIDs.find(Mod) == SubmoduleIDs.end());
5654 SubmoduleIDs[Mod] =
ID;
5659 assert(!WritingAST &&
"Already writing the AST!");
5662 if (RD->isFromASTFile()) {
5667 "completed a tag from another module but not by instantiation?");
5668 DeclUpdates[RD].push_back(
5676 if (isa<TranslationUnitDecl>(DC) || isa<NamespaceDecl>(DC))
5679 if (!(!D->
isFromASTFile() && cast<Decl>(DC)->isFromASTFile()))
5683 assert(!WritingAST &&
"Already writing the AST!");
5684 UpdatedDeclContexts.insert(DC);
5685 UpdatingVisibleDecls.push_back(D);
5692 if (!isa<CXXMethodDecl>(D))
5697 assert(!WritingAST &&
"Already writing the AST!");
5708 assert(!WritingAST &&
"Already writing the AST!");
5720 assert(!WritingAST &&
"Already writing the AST!");
5732 assert(!WritingAST &&
"Already writing the AST!");
5738 assert(!DoneWritingDeclsAndTypes &&
"Already done writing updates!");
5740 Chain->forEachImportedKeyDecl(FD, [&](
const Decl *D) {
5745 ->castAs<FunctionProtoType>()
5746 ->getExceptionSpecType()))
5752 assert(!WritingAST &&
"Already writing the AST!");
5754 Chain->forEachImportedKeyDecl(FD, [&](
const Decl *D) {
5755 DeclUpdates[D].push_back(
5762 assert(!WritingAST &&
"Already writing the AST!");
5763 assert(Delete &&
"Not given an operator delete");
5765 Chain->forEachImportedKeyDecl(DD, [&](
const Decl *D) {
5771 assert(!WritingAST &&
"Already writing the AST!");
5780 assert(!WritingAST &&
"Already writing the AST!");
5788 assert(!WritingAST &&
"Already writing the AST!");
5794 DeclUpdates[D].push_back(
5801 assert(!WritingAST &&
"Already writing the AST!");
5805 assert(IFD->
getDefinition() &&
"Category on a class without a definition?");
5806 ObjCClassesWithCategories.insert(
5818 assert(!WritingAST &&
"Already writing the AST!");
5826 assert(!WritingAST &&
"Already writing the AST!");
5834 assert(!WritingAST &&
"Already writing the AST!");
5842 assert(!WritingAST &&
"Already writing the AST!");
5843 assert(D->
isHidden() &&
"expected a hidden declaration");
5849 assert(!WritingAST &&
"Already writing the AST!");
void AddTemplateArgument(const TemplateArgument &Arg, RecordDataImpl &Record)
Emit a template argument.
static bool removeDotPaths(SmallVectorImpl< char > &Path)
Remove any './' components from a path.
A CXXConstCastExpr record.
bool hasLineDirectives() const
Return true if this FileID has #line directives in it.
unsigned getNumElements() const
TypeSourceInfo * getUnderlyingTInfo() const
SourceManager & getSourceManager() const
bool isPoisoned() const
Return true if this token has been poisoned.
SourceLocation getOptimizeOffPragmaLocation() const
Get the location for the currently active "\#pragma clang optimize off". If this location is invalid...
A FriendTemplateDecl record.
Defines the clang::ASTContext interface.
unsigned getNumArrayIndices() const
Determine the number of implicit array indices used while described an array member initialization...
A CompoundLiteralExpr record.
A NonTypeTemplateParmDecl record.
QualType getExceptionType(unsigned i) const
Represents a type that was referred to using an elaborated type keyword, e.g., struct S...
SourceLocation getEnd() const
QualType getUnderlyingType() const
UnusedFileScopedDeclsType UnusedFileScopedDecls
The set of file scoped decls seen so far that have not been used and must warn if not used...
Qualifiers getLocalQualifiers() const
Retrieve the set of qualifiers local to this particular QualType instance, not including any qualifie...
ObjCInterfaceDecl * getDecl() const
getDecl - Get the declaration of this interface.
unsigned getAnonymousDeclarationNumber(const NamedDecl *D)
uint64_t getMacroDirectivesOffset(const IdentifierInfo *Name)
void AddedVisibleDecl(const DeclContext *DC, const Decl *D) override
A new declaration with name has been added to a DeclContext.
llvm::SmallSetVector< const TypedefNameDecl *, 4 > UnusedLocalTypedefNameCandidates
Set containing all typedefs that are likely unused.
std::string Name
The name of this module.
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.
void EmitRecordWithPath(unsigned Abbrev, RecordDataImpl &Record, StringRef Path)
Emit the current record with the given path as a blob.
ExtVectorDeclsType ExtVectorDecls
A UserDefinedLiteral record.
Source range/offset of a preprocessed entity.
Header getUmbrellaHeader() const
Retrieve the header that serves as the umbrella header for this module.
SourceLocation getElaboratedKeywordLoc() const
unsigned getDepth() const
Record code for the signature that identifiers this AST file.
no exception specification
void AddDeclarationNameInfo(const DeclarationNameInfo &NameInfo, RecordDataImpl &Record)
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.
SubstTemplateTemplateParmStorage * getAsSubstTemplateTemplateParm() const
Retrieve the substituted template template parameter, if known.
An IndirectGotoStmt record.
llvm::iterator_range< pack_iterator > pack_elements() const
Iterator range referencing all of the elements of a template argument pack.
Represents the dependent type named by a dependently-scoped typename using declaration, e.g. using typename Base<T>::foo; Template instantiation turns these into the underlying type.
static void EmitBlockID(unsigned ID, const char *Name, llvm::BitstreamWriter &Stream, ASTWriter::RecordDataImpl &Record)
bool isVirtual() const
Determines whether the base class is a virtual base class (or not).
TemplateName getReplacement() const
void FunctionDefinitionInstantiated(const FunctionDecl *D) override
A function template's definition was instantiated.
bool isBaseOfClass() const
Determine whether this base class is a base of a class declared with the 'class' keyword (vs...
The macro directives history for a particular identifier.
bool isCanonicalUnqualified() const
Represents a version number in the form major[.minor[.subminor[.build]]].
llvm::APSInt getAsIntegral() const
Retrieve the template argument as an integral value.
ObjCInterfaceDecl * getClassInterface()
Implements support for file system lookup, file system caching, and directory search management...
SourceLocation getNameLoc() const
void AddToken(const Token &Tok, RecordDataImpl &Record)
Emit a token.
unsigned local_sloc_entry_size() const
Get the number of local SLocEntries we have.
LateParsedTemplateMapT LateParsedTemplateMap
ArrayRef< const IdentifierInfo * > args() const
FunctionDecl * getExceptionSpecDecl() const
If this function type has an exception specification which hasn't been determined yet (either because...
A CXXStaticCastExpr record.
Defines the clang::FileManager interface and associated types.
Record code for the source manager line table information, which stores information about #line direc...
An AttributedStmt record.
void AddAPInt(const llvm::APInt &Value, RecordDataImpl &Record)
Emit an integral value.
A CXXReinterpretCastExpr record.
bool isKindOfTypeAsWritten() const
Whether this is a "__kindof" type as written.
A ObjCBoolLiteralExpr record.
void AddedObjCPropertyInClassExtension(const ObjCPropertyDecl *Prop, const ObjCPropertyDecl *OrigProp, const ObjCCategoryDecl *ClassExt) override
A objc class extension redeclared or introduced a property.
void getUndefinedButUsed(SmallVectorImpl< std::pair< NamedDecl *, SourceLocation > > &Undefined)
Obtain a sorted list of functions that are undefined but ODR-used.
submodule_iterator submodule_begin()
const unsigned NUM_PREDEF_TYPE_IDS
The number of predefined type IDs that are reserved for the PREDEF_TYPE_* constants.
TemplateDecl * getAsTemplateDecl() const
Retrieve the underlying template declaration that this template name refers to, if known...
void MacroDefinitionRead(serialization::PreprocessedEntityID ID, MacroDefinitionRecord *MD) override
A macro definition was read from the AST file.
SourceLocation getLAngleLoc() const
unsigned getNumArgs() const
Retrieve the number of template arguments.
unsigned IsExternC
Whether this is an 'extern "C"' module (which implicitly puts all headers in it within an 'extern "...
IdentifierInfo * getCXXLiteralIdentifier() const
OverloadedOperatorKind getOperator() const
Return the overloaded operator to which this template name refers.
Defines the SourceManager interface.
uint32_t IdentID
An ID number that refers to an identifier in an AST file.
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in...
const LangOptions & getLangOpts() const
Represents a qualified type name for which the type name is dependent.
CXXRecordDecl * getDecl() const
RawCommentList Comments
All comments in this translation unit.
NestedNameSpecifierLoc getPrefix() const
Return the prefix of this nested-name-specifier.
An ImplicitValueInitExpr record.
unsigned getNextLocalOffset() const
const unsigned int NUM_PREDEF_SELECTOR_IDS
The number of predefined selector IDs.
An ImplicitCastExpr record.
Defines the FileSystemStatCache interface.
void CompletedTagDefinition(const TagDecl *D) override
A new TagDecl definition was completed.
const SrcMgr::SLocEntry & getSLocEntry(FileID FID, bool *Invalid=nullptr) const
A VarTemplatePartialSpecializationDecl record.
bool isObjectLike() const
std::deque< PendingImplicitInstantiation > PendingInstantiations
The queue of implicit template instantiations that are required but have not yet been performed...
unsigned IsFramework
Whether this is a framework module.
bool hasCommaPasting() const
Defines the C++ template declaration subclasses.
Describes a source location entry (SLocEntry) for a macro expansion.
Represents a C++11 auto or C++1y decltype(auto) type.
static NamedDecl * getDeclForLocalLookup(const LangOptions &LangOpts, NamedDecl *D)
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.
Optional< unsigned > getMinor() const
Retrieve the minor version number, if provided.
Specifies the submodules that are imported by this submodule.
A record that stores the set of declarations that are lexically stored within a given DeclContext...
void ReaderInitialized(ASTReader *Reader) override
The ASTReader was initialized.
QualType getPointeeType() const
IdentifierInfo * getAsIdentifierInfo() const
Specifies an umbrella directory.
A CXXTemporaryObjectExpr record.
CXXRecordDecl * getAsRecordDecl() const
Retrieve the record declaration stored in this nested name specifier.
std::deque< PendingImplicitInstantiation > PendingLocalImplicitInstantiations
The queue of implicit template instantiations that are required and must be performed within the curr...
uint32_t DeclID
An ID number that refers to a declaration in an AST file.
SourceLocation getLocalRangeBegin() const
Each ExpansionInfo encodes the expansion location - where the token was ultimately expanded...
const ExpansionInfo & getExpansion() const
unsigned getLength() const
Efficiently return the length of this identifier info.
A SubstTemplateTypeParmType record.
QualType getRecordType(const RecordDecl *Decl) const
void AddTypeSourceInfo(TypeSourceInfo *TInfo, RecordDataImpl &Record)
Emits a reference to a declarator info.
Declaration of a variable template.
SourceLocation getRParenLoc() const
TemplateTemplateParmDecl * getParameterPack() const
Retrieve the template template parameter pack being substituted.
NamespaceDecl - Represent a C++ namespace.
A ObjCPropertyDecl record.
NestedNameSpecifier * getPrefix() const
Return the prefix of this nested name specifier.
StoredDeclsMap * getLookupPtr() const
Retrieve the internal representation of the lookup structure. This may omit some names if we are lazi...
Wrapper for source info for typedefs.
void AddTemplateName(TemplateName Name, RecordDataImpl &Record)
Emit a template name.
bool hasBaseTypeAsWritten() const
serialization::DeclID GetDeclRef(const Decl *D)
Force a declaration to be emitted and get its ID.
bool isDecltypeAuto() const
A container of type source information.
void AddCXXCtorInitializersRef(ArrayRef< CXXCtorInitializer * > Inits, RecordDataImpl &Record)
Emit the ID for a CXXCtorInitializer array and register the array for later serialization.
unsigned getIndex() const
Record code for the module build directory.
Record code for enabled OpenCL extensions.
Floating point control options.
void * getAsOpaquePtr() const
An ElaboratedType record.
void AddTypeRef(QualType T, RecordDataImpl &Record)
Emit a reference to a type.
Expr * getAsExpr() const
Retrieve the template argument as an expression.
serialization::SelectorID BaseSelectorID
Base selector ID for selectors local to this module.
An UnresolvedUsingType record.
static void AddStmtsExprs(llvm::BitstreamWriter &Stream, ASTWriter::RecordDataImpl &Record)
const TemplateArgument & get(unsigned Idx) const
Retrieve the template argument at a given index.
unsigned getRawEncoding() const
When a SourceLocation itself cannot be used, this returns an (opaque) 32-bit integer encoding for it...
Wrapper for source info for pointers decayed from arrays and functions.
bool hasAttrEnumOperand() const
Describes the capture of a variable or of this, or of a C++1y init-capture.
SourceRange getAttrOperandParensRange() const
bool isSpelledAsLValue() const
An IncompleteArrayType record.
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.
NamedDecl *const * const_iterator
Iterates through the template parameters in this list.
const llvm::APInt & getSize() const
static unsigned CreateSLocBufferBlobAbbrev(llvm::BitstreamWriter &Stream)
Create an abbreviation for the SLocEntry that refers to a buffer's blob.
A ClassTemplateDecl record.
SourceLocation getIncludeLoc() const
unsigned NumPreprocessedEntities
CharacteristicKind getFileCharacteristic() const
Return whether this is a system header or not.
An UnresolvedUsingTypenameDecl record.
unsigned getCounterValue() const
An identifier, stored as an IdentifierInfo*.
The internal '__builtin_va_list' typedef.
Manages the set of modules loaded by an AST reader.
serialization::MacroID getMacroRef(MacroInfo *MI, const IdentifierInfo *Name)
Get the unique number used to refer to the given macro.
Expr * getInit() const
Get the initializer.
Wrapper for source info for member pointers.
Options for controlling the target.
Wrapper of type source information for a type with non-trivial direct qualifiers. ...
bool hasAttrExprOperand() const
A UsingShadowDecl record.
SourceLocation getDefinitionLoc() const
Return the location that the macro was defined at.
Represents an empty template argument, e.g., one that has not been deduced.
void DeclarationMarkedOpenMPThreadPrivate(const Decl *D) override
A declaration is marked as OpenMP threadprivate which was not previously marked as threadprivate...
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.
static unsigned CreateSLocFileAbbrev(llvm::BitstreamWriter &Stream)
Create an abbreviation for the SLocEntry that refers to a file.
QualType getucontext_tType() const
Retrieve the C ucontext_t type.
Represents a variable template specialization, which refers to a variable template with a given set o...
The value of the next COUNTER to dispense. [PP_COUNTER_VALUE, Val].
ASTWriter(llvm::BitstreamWriter &Stream)
Create a new precompiled header writer that outputs to the given bitstream.
A ConditionOperator record.
const DeclContext * getDefinitiveDeclContext(const DeclContext *DC)
Retrieve the "definitive" declaration that provides all of the visible entries for the given declarat...
TemplateTypeParmDecl * getDecl() const
Specifies the umbrella header used to create this module, if any.
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>". This is safe to be used inside an AST node, in contrast with TemplateArgumentListInfo.
A namespace, stored as a NamespaceDecl*.
void AddCXXTemporary(const CXXTemporary *Temp, RecordDataImpl &Record)
Emit a CXXTemporary.
QualType getOriginalType() const
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.
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
A CXXConstructExpr record.
serialization::IdentID getIdentifierRef(const IdentifierInfo *II)
Get the unique number used to refer to the given identifier.
static StringRef bytes(const std::vector< T, Allocator > &v)
bool hasAttrOperand() const
A TemplateTemplateParmDecl record.
Record code for the array of eagerly deserialized decls.
TemplateTemplateParmDecl * getParameter() const
Represents the result of substituting a type for a template type parameter.
OpenCLOptions & getOpenCLOptions()
Defines the clang::Expr interface and subclasses for C++ expressions.
unsigned getNumArgs() const
Retrieve the number of template arguments.
FPOptions & getFPOptions()
A ObjCInterfaceDecl record.
QualType getRawCFConstantStringType() const
SourceLocation getAmpAmpLoc() const
void AddIdentifierRef(const IdentifierInfo *II, RecordDataImpl &Record)
Emit a reference to an identifier.
Record code for the array of redeclaration chains.
bool isBaseInitializer() const
Determine whether this initializer is initializing a base class.
A ShuffleVectorExpr record.
iterator begin(DeclarationName Name)
begin - Returns an iterator for decls with the name 'Name'.
const IdentifierInfo * getIdentifier() const
Returns the identifier to which this template name refers.
known_categories_iterator known_categories_begin() const
Retrieve an iterator to the beginning of the known-categories list.
Base wrapper for a particular "section" of type source info.
unsigned getNumParams() const
const unsigned VERSION_MAJOR
AST file major version number supported by this version of Clang.
void AddQualifierInfo(const QualifierInfo &Info, RecordDataImpl &Record)
SourceRange getLocalSourceRange() const
Retrieve the source range covering just the last part of this nested-name-specifier, not including the prefix.
const IdentifierInfo * getIdentifier() const
Retrieve the type named by the typename specifier as an identifier.
DeclarationName getName() const
getName - Returns the embedded declaration name.
Represents a class template specialization, which refers to a class template with a given set of temp...
unsigned getIndexTypeCVRQualifiers() const
A macro directive exported by a module. [PP_MODULE_MACRO, SubmoduleID, MacroID, (Overridden Submodule...
An ObjCAtThrowStmt record.
Specifies a top-level header that falls into this (sub)module.
The block containing comments.
A DesignatedInitExpr record.
The Objective-C 'SEL' type.
bool isFromAST() const
Return true if the identifier in its current state was loaded from an AST file.
Expr * getSizeExpr() const
void AddTypeLoc(TypeLoc TL, RecordDataImpl &Record)
Emits a type with source-location information.
IdentifierInfo * getIdentifierInfoForSlot(unsigned argIndex) const
Retrieve the identifier at a given position in the selector.
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 is either a single result (with no stable stora...
unsigned getNumArgs() const
bool isIdentifier() const
Determine whether this template name refers to an identifier.
void RedefinedHiddenDefinition(const NamedDecl *D, Module *M) override
A definition has been made visible by being redefined locally.
An ObjCProtocolExpr record.
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.
TypeSourceInfo * getTypeArgTInfo(unsigned i) const
SourceLocation getLocalRangeEnd() const
SourceLocation getEllipsisLoc() const
Retrieve the location of the ellipsis for a capture that is a pack expansion.
bool isCompleteDefinition() const
SourceLocation getTypeArgsRAngleLoc() const
bool isMemberInitializer() const
Determine whether this initializer is initializing a non-static data member.
The unsigned 128-bit integer type.
Record code for the module map file that was used to build this AST file.
void ResolvedOperatorDelete(const CXXDestructorDecl *DD, const FunctionDecl *Delete) override
A virtual destructor's operator delete has been resolved.
Delete expressions that will be analyzed later.
unsigned ASTFileSignature
bool isBeingDefined() const
Determines whether this type is in the process of being defined.
llvm::MapVector< const FunctionDecl *, LateParsedTemplate * > LateParsedTemplateMapT
ParmVarDecl * getParam(unsigned i) const
bool isTranslationUnit() const
unsigned size() const
Retrieve the number of template arguments in this template argument list.
NestedNameSpecifier * getQualifier() const
Retrieve the qualification on this type.
const LangOptions & getLangOpts() const
Represents the result of substituting a set of types for a template type parameter pack...
static unsigned CreateSLocExpansionAbbrev(llvm::BitstreamWriter &Stream)
Create an abbreviation for the SLocEntry that refers to a macro expansion.
unsigned getNumProtocols() const
Wrapper for source info for unresolved typename using decls.
SourceLocation getBuiltinLoc() const
An AttributedType record.
unsigned getAsOpaqueValue() const
An object-like macro definition. [PP_MACRO_OBJECT_LIKE, IdentInfoID, SLoc, IsUsed].
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
unsigned getRegParm() const
SubstTemplateTemplateParmPackStorage * getAsSubstTemplateTemplateParmPack() const
Retrieve the substituted template template parameter pack, if known.
Describes one token. [PP_TOKEN, SLoc, Length, IdentInfoID, Kind, Flags].
Describes a module or submodule.
QualType getUnderlyingType() const
Expr * getUnderlyingExpr() const
Record code for the diagnostic options table.
A IndirectFieldDecl record.
std::map< FileID, std::vector< LineEntry > >::iterator iterator
FileManager & getFileManager() const
Record code for the set of ext_vector type names.
iterator end()
end - Returns an iterator that has 'finished'.
Record code for the headers search options table.
serialization::MacroID getMacroID(MacroInfo *MI)
Determine the ID of an already-emitted macro.
FunctionTemplateDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this template.
Specifies the submodules that are re-exported from this submodule.
TemplateParameterList ** TemplParamLists
serialization::MacroID BaseMacroID
Base macro ID for macros local to this module.
TemplateArgument getArgumentPack() const
uint32_t SubmoduleID
An ID number that refers to a submodule in a module file.
SourceLocation getLAngleLoc() const
SmallVector< uint64_t, 64 > RecordData
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...
const TargetInfo & getTargetInfo() const
const LangOptions & getLangOpts() 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 by copy (a.k.a., by value)
IndirectFieldDecl * getIndirectMember() const
An AccessSpecDecl record.
SourceLocation getRAngleLoc() const
Describes a blob that contains the data for a buffer entry. This kind of record always directly follo...
QualType getBaseType() const
TemplateName getTemplateName() const
Retrieve the name of the template that we are specializing.
QualType getReturnType() const
Wrapper for source info for functions.
Specifies a conflict with another module.
The signed 128-bit integer type.
StoredDeclsMap * buildLookup()
Ensure the lookup structure is fully-built and return it.
bool isUsedForHeaderGuard() const
Determine whether this macro was used for a header guard.
SourceLocation getEllipsisLoc() const
For a pack expansion, determine the location of the ellipsis.
A UnaryTransformType record.
UnresolvedUsingTypenameDecl * getDecl() const
OverloadedTemplateStorage * getAsOverloadedTemplate() const
Retrieve the underlying, overloaded function template.
A reference to a previously [de]serialized Stmt record.
NestedNameSpecifierLoc getQualifierLoc() const
A UsingDirecitveDecl record.
An ObjCObjectType record.
void IdentifierRead(serialization::IdentID ID, IdentifierInfo *II) override
An identifier was deserialized from the AST file.
A ConstantArrayType record.
TemplateArgument getArgumentPack() const
Retrieve the template template argument pack with which this parameter was substituted.
Wrapper for substituted template type parameters.
Concrete class used by the front-end to report problems and issues.
TypeOfExprType (GCC extension).
Record code for #pragma optimize options.
GlobalMethodPool MethodPool
HeaderSearch & getHeaderSearchInfo() const
void AddSourceRange(SourceRange Range, RecordDataImpl &Record)
Emit a source range.
Specifies a header that is private to this submodule but must be textually included.
Expr * getNoexceptExpr() const
TypeSourceInfo * getClassTInfo() const
Record code for pending implicit instantiations.
Wrapper for substituted template type parameters.
SourceLocation RAngleLoc
The source location of the right angle bracket ('>').
bool needsExtraLocalData() const
Record code for #pragma diagnostic mappings.
Module * Parent
The parent of this module. This will be NULL for the top-level module.
void AddTemplateParameterList(const TemplateParameterList *TemplateParams, RecordDataImpl &Record)
Emit a template parameter list.
Record code for floating point #pragma options.
void AddSelectorRef(Selector, RecordDataImpl &Record)
Emit a Selector (which is a smart pointer reference).
LazyDeclPtr StdBadAlloc
The C++ "std::bad_alloc" class, which is defined by the C++ standard library.
TemplateDecl * getTemplateDecl() const
The template declaration to which this qualified name refers.
SourceLocation getRParenLoc() 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.
SourceLocation getFileLoc(SourceLocation Loc) const
Given Loc, if it is a macro location return the expansion location or the spelling location...
TypeID MakeTypeID(ASTContext &Context, QualType T, IdxForTypeTy IdxForType)
Record code for an array of all of the (sub)modules that were imported by the AST file...
submodule_iterator submodule_end()
bool isDelegatingInitializer() const
Determine whether this initializer is creating a delegating constructor.
serialization::DeclID BaseDeclID
Base declaration ID for declarations local to this module.
QualType getsigjmp_bufType() const
Retrieve the C sigjmp_buf type.
NestedNameSpecifier * getQualifier() const
Retrieve the qualification on this type.
TypeClass getTypeClass() const
void AddTemplateArgumentLoc(const TemplateArgumentLoc &Arg, RecordDataImpl &Record)
Emits a template argument location.
VarDecl * getCapturedVar() const
Retrieve the declaration of the local variable being captured.
A marker record that indicates that we are at the end of an expression.
A ClassTemplateSpecializationDecl record.
DeclContext * getLexicalDeclContext()
tok::TokenKind getKind() const
A BlockPointerType record.
NestedNameSpecifier * getQualifier() const
Return the nested name specifier that qualifies this name.
void StaticDataMemberInstantiated(const VarDecl *D) override
A static data member was implicitly instantiated.
A MemberPointerType record.
Represents an ObjC class declaration.
bool isWritten() const
Determine whether this initializer is explicitly written in the source code.
ObjCMethodDecl * getMethod() const
SourceLocation getTypeofLoc() const
QualType getAliasedType() const
SourceLocation getTypeArgsLAngleLoc() const
unsigned getNumParams() const
void AddDeclarationName(DeclarationName Name, RecordDataImpl &Record)
Emit a declaration name.
serialization::TypeID getTypeID(QualType T) const
Determine the type ID of an already-emitted type.
QualType getCanonicalTypeInternal() const
Record code for the table of offsets into the block of source-location information.
serialization::SubmoduleID inferSubmoduleIDFromLocation(SourceLocation Loc)
Infer the submodule ID that contains an entity at the given source location.
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
const TemplateTypeParmType * getReplacedParameter() const
Gets the template parameter that was substituted for.
A SubstTemplateTypeParmPackType record.
Records the location of a macro expansion.
TypeCode
Record codes for each kind of type.
DiagnosticsEngine & getDiagnostics() const
std::vector< Module * >::iterator submodule_iterator
Iterator that walks over the list of categories, filtering out those that do not meet specific criter...
void WriteAST(Sema &SemaRef, const std::string &OutputFile, Module *WritingModule, StringRef isysroot, bool hasErrors=false)
Write a precompiled header for the given semantic analysis.
SourceLocation getLoc() const
getLoc - Returns the main location of the declaration name.
unsigned getObjCOrBuiltinID() const
IdentifierInfo * getAlias() const
unsigned IsSystem
Whether this is a "system" module (which assumes that all headers in it are system headers)...
DependentTemplateName * getAsDependentTemplateName() const
Retrieve the underlying dependent template name structure, if any.
The block containing information about the source manager.
bool isCPlusPlusOperatorKeyword() const
Record code for the array describing the locations (in the LOCAL_REDECLARATIONS record) of the redecl...
void AddedObjCCategoryToInterface(const ObjCCategoryDecl *CatD, const ObjCInterfaceDecl *IFD) override
A new objc category class was added for an interface.
void AddedAttributeToRecord(const Attr *Attr, const RecordDecl *Record) override
An attribute was added to a RecordDecl.
void SelectorRead(serialization::SelectorID ID, Selector Sel) override
A selector was read from the AST file.
TypeLoc getNextTypeLoc() const
Get the next TypeLoc pointed by this TypeLoc, e.g for "int*" the TypeLoc is a PointerLoc and next Typ...
A VariableArrayType record.
QualType getValueType() const
void AddNestedNameSpecifierLoc(NestedNameSpecifierLoc NNS, RecordDataImpl &Record)
Emit a nested name specifier with source-location information.
Optional< unsigned > getNumTemplateExpansions() const
Retrieve the number of expansions that a template template argument expansion will produce...
QualType getInjectedSpecializationType() const
void ModuleRead(serialization::SubmoduleID ID, Module *Mod) override
A module definition was read from the AST file.
ExtInfo getExtInfo() 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.
TypeLoc getTypeLoc() const
For a nested-name-specifier that refers to a type, retrieve the type with source-location information...
const FileEntry * getFileEntryForID(FileID FID) const
Returns the FileEntry record for the provided FileID.
unsigned NumTemplParamLists
QualType getParamType(unsigned i) const
ExceptionSpecificationType getExceptionSpecType() const
Get the kind of exception specification on this function.
TentativeDefinitionsType TentativeDefinitions
All the tentative definitions encountered in the TU.
Defines the major attributes of a submodule, including its name and parent.
const llvm::MapVector< FieldDecl *, DeleteLocs > & getMismatchingDeleteExpressions() const
FileID getFileID(SourceLocation SpellingLoc) const
Return the FileID for a SourceLocation.
SourceLocation getAttrEnumOperandLoc() const
llvm::SmallSetVector< Module *, 2 > Imports
The set of modules imported by this module, and on which this module depends.
A dependent template name that has not been resolved to a template (or set of templates).
DeclarationNameTable DeclarationNames
SourceLocation getLBracketLoc() const
Record code for the preprocessor options table.
unsigned getOwningModuleID() const
Retrieve the global ID of the module that owns this particular declaration.
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this variable is an instantiation of a static data member of a class template specialization, retrieves the member specialization information.
unsigned LocalNumSLocEntries
The number of source location entries in this AST file.
A StaticAssertDecl record.
Captures information about a #pragma weak directive.
SourceRange getRange() const
void AddPath(StringRef Path, RecordDataImpl &Record)
Add a path to the given record.
ID
Defines the set of possible language-specific address spaces.
A VarTemplateSpecializationDecl record.
Record code for the table of offsets of each macro ID.
unsigned getNumFilenames() const
NameKind getNameKind() const
getNameKind - Determine what kind of name this is.
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...
Exposes information about the current target.
A record containing CXXBaseSpecifiers.
void AddTemplateArgumentList(const TemplateArgumentList *TemplateArgs, RecordDataImpl &Record)
Emit a template argument list.
SpecifierKind getKind() const
Determine what kind of nested name specifier is stored.
SourceLocation getElaboratedKeywordLoc() const
void FlushCXXBaseSpecifiers()
Flush all of the C++ base specifier sets that have been added via AddCXXBaseSpecifiersRef().
bool isImplicit() const
Determine whether this was an implicit capture (not written between the square brackets introducing t...
An ObjCObjectPointerType record.
An TemplateSpecializationType record.
Type source information for an attributed type.
An ObjCInterfaceType record.
SourceLocation getRBracketLoc() const
QualType getPointeeType() const
A ObjCCategoryImplDecl record.
StringRef getName() const
Return the actual identifier string.
Record code for the array of VTable uses.
bool isLookupContext() const
Test whether the context supports looking up names.
Record code for the target options table.
SourceLocation getLParenLoc() const
The directory that the PCH was originally created in.
unsigned getNumArgs() const
A ObjCPropertyImplDecl record.
TypeSpecifierWidth getWrittenWidthSpec() const
unsigned LocalNumIdentifiers
The number of identifiers in this AST file.
unsigned NumTemplateArgs
The number of template arguments in TemplateArgs. The actual template arguments (if any) are stored a...
Implements an efficient mapping from strings to IdentifierInfo nodes.
bool hasLineTable() const
Determine if the source manager has a line table.
Defines implementation details of the clang::SourceManager class.
FileManager & getFileManager() const
unsigned getNumArgs() const
Inits[]
Gets the list of initial values for linear variables.
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.
bool isTypeAlias() const
Determine if this template specialization type is for a type alias template that has been substituted...
TranslationUnitDecl * getTranslationUnitDecl() const
A CXXConstructorDecl record.
Defines version macros and version-related utility functions for Clang.
Expr * getUnderlyingExpr() const
Defines the clang::Preprocessor interface.
ArgKind
The kind of template argument we're storing.
const SrcMgr::SLocEntry & getLocalSLocEntry(unsigned Index, bool *Invalid=nullptr) const
Get a local SLocEntry. This is exposed for indexing.
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.
AccessSpecifier getAccessSpecifierAsWritten() const
Retrieves the access specifier as written in the source code (which may mean that no access specifier...
QualType getNamedType() const
Retrieve the type named by the qualified-id.
ArgKind getKind() const
Return the kind of stored template argument.
llvm::MapVector< IdentifierInfo *, WeakInfo > WeakUndeclaredIdentifiers
serialization::TypeID GetOrCreateTypeID(QualType T)
Force a type to be emitted and get its ID.
SourceLocation getLParenLoc() const
SourceLocation getLocation() const
Retrieve the source location of the capture.
A structure for storing the information associated with a substituted template template parameter...
lookup_result noload_lookup(DeclarationName Name)
Find the declarations with the given name that are visible within this context; don't attempt to retr...
unsigned LocalNumMacros
The number of macros in this AST file.
A CXXStdInitializerListExpr record.
A record containing CXXCtorInitializers.
ArrayRef< const FileEntry * > getTopHeaders(FileManager &FileMgr)
The top-level headers associated with this module.
A VarTemplateDecl record.
Record code for the original file that was used to generate the AST file, including both its file ID ...
An ArraySubscriptExpr record.
Represents a C++ template name within the type system.
llvm::SmallVector< LinkLibrary, 2 > LinkLibraries
The set of libraries or frameworks to link against when an entity from this module is used...
Information about a module that has been loaded by the ASTReader.
A namespace alias, stored as a NamespaceAliasDecl*.
void AddString(StringRef Str, RecordDataImpl &Record)
Add a string to the given record.
bool isInlined() const
Determine whether this function should be inlined, because it is either marked "inline" or "constexpr...
SourceLocation getLocation() const
Return a source location identifier for the specified offset in the current file. ...
A CXXDestructorDecl record.
SourceLocation getMemberLocation() const
bool isSubModuleOf(const Module *Other) const
Determine whether this module is a submodule of the given other module.
void AddCXXBaseSpecifier(const CXXBaseSpecifier &Base, RecordDataImpl &Record)
Emit a C++ base specifier.
A FunctionProtoType record.
A NonTypeTemplateParmDecl record that stores an expanded non-type template parameter pack...
SourceLocation getTemplateNameLoc() const
QualType getType() const
Get the type for which this source info wrapper provides information.
QualType getFILEType() const
Retrieve the C FILE type.
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.
void FlushPendingAfterDecl()
Flush all pending records that are tacked onto the end of decl and decl update records.
Wrapper for source info for enum types.
bool isDependentType() const
unsigned getNumTokens() const
Return the number of tokens that this macro expands to.
bool hasTrailingReturn() const
std::string FileName
The file name of the module file.
A NamespaceAliasDecl record.
QualType getCXXNameType() const
bool isFromASTFile() const
Determine whether this declaration came from an AST file (such as a precompiled header or module) rat...
Record code for an update to a decl context's lookup table.
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.
Record the location of an inclusion directive, such as an #include or #import statement.
const unsigned VERSION_MINOR
AST file minor version number supported by this version of Clang.
SourceLocation getModuleImportLoc(Module *M) const
A DesignatedInitUpdateExpr record.
bool isRewritten(const Decl *D) const
Record code for the filesystem options table.
struct CXXOpName CXXOperatorName
CXXRecordDecl * getStdBadAlloc() const
TemplateArgumentLoc * getTemplateArgs()
Retrieve the template arguments.
An ImplicitParamDecl record.
DirectoryName getUmbrellaDir() const
Retrieve the directory for which this module serves as the umbrella.
const Type * getAsType() const
Retrieve the type stored in this nested name specifier.
SourceLocation getExpansionLocEnd() const
QualType getElementType() const
void MacroRead(serialization::MacroID ID, MacroInfo *MI) override
A macro was read from the AST file.
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.
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.
A ObjCCategoryDecl record.
QualType getReplacementType() const
An ObjCPropertyRefExpr record.
SourceLocation getRAngleLoc() const
bool isC99Varargs() const
LambdaCaptureKind getCaptureKind() const
Determine the kind of capture.
An ObjCForCollectionStmt record.
Record code for the identifier table.
A FileScopeAsmDecl record.
A ObjCCompatibleAliasDecl record.
SourceLocation getProtocolRAngleLoc() const
SmallVector< ExportDecl, 2 > Exports
The set of export declarations.
SourceLocation getTemplateNameLoc() const
SourceRange getBracketsRange() const
DelegatingCtorDeclsType DelegatingCtorDecls
All the delegating constructors seen so far in the file, used for cycle detection at the end of the T...
A MS-style AsmStmt record.
void AddSourceLocation(SourceLocation Loc, RecordDataImpl &Record)
Emit a source location.
unsigned getLocalFastQualifiers() const
const unsigned int NUM_PREDEF_IDENT_IDS
The number of predefined identifier IDs.
const TemplateTypeParmType * getReplacedParameter() const
Gets the template parameter that was substituted for.
The Objective-C 'Class' type.
SpecifierKind
The kind of specifier that completes this nested name specifier.
NamespaceDecl * getAsNamespace() const
Retrieve the namespace stored in this nested name specifier.
NestedNameSpecifierLoc getTemplateQualifierLoc() const
const IdentifierInfo * getIdentifier() const
TemplateArgumentLoc getArgLoc(unsigned i) const
A template template parameter pack that has been substituted for a template template argument pack...
Wrapper for source info for arrays.
Record code for the set of source location entries that need to be preloaded by the AST reader...
TemplateArgumentLoc getArgLoc(unsigned i) const
Information about a FileID, basically just the logical file that it represents and include stack info...
The list of delegating constructor declarations.
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
DeclContext::lookup_result getLookupResult()
Encapsulates changes to the "macros namespace" (the location where the macro name became active...
SourceLocation getTemplateKeywordLoc() const
SourceLocation getRParenLoc() const
An UnresolvedUsingValueDecl record.
serialization::TypeID BaseTypeIndex
Base type ID for types local to this module as represented in the global type ID space.
void AddAPSInt(const llvm::APSInt &Value, RecordDataImpl &Record)
Emit a signed integral value.
decl_type * getPreviousDecl()
Return the previous declaration of this declaration or NULL if this is the first declaration.
bool hasChangedSinceDeserialization() const
Determine whether this identifier has changed since it was loaded from an AST file.
serialization::IdentID BaseIdentifierID
Base identifier ID for identifiers local to this module.
const char * getName() const
Encodes a location in the source. The SourceManager can decode this to get at the full include stack...
const char * getNameStart() const
Return the beginning of the actual null-terminated string for this identifier.
Record code for the language options table.
void AddTemplateArgumentLocInfo(TemplateArgument::ArgKind Kind, const TemplateArgumentLocInfo &Arg, RecordDataImpl &Record)
Emits a template argument location info.
QualType getElementType() const
A record that stores the set of declarations that are visible from a given DeclContext.
Specifies a library or framework to link against.
RefQualifierKind getRefQualifier() const
Retrieve the ref-qualifier associated with this function type.
Record code for file ID of the file or buffer that was used to generate the AST file.
Represents a C++ temporary.
TypeOfType (GCC extension).
Specifies a header that falls into this (sub)module.
Record code for the table of offsets to CXXBaseSpecifier sets.
A structure for storing an already-substituted template template parameter pack.
Record code for special CUDA declarations.
OverloadedOperatorKind getCXXOverloadedOperator() const
Options for controlling the compiler diagnostics engine.
SourceLocation getLParenLoc() const
TagDecl - Represents the declaration of a struct/union/class/enum.
unsigned getOffset() const
bool isPackExpansion() const
Determine whether this base specifier is a pack expansion.
This is so that older clang versions, before the introduction of the control block, can read and reject the newer PCH format. DON"T CHANGE THIS NUMBER.
IdentifierTable & getIdentifierTable()
VectorKind getVectorKind() const
TagDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
Cached information about one file (either on disk or in the virtual file system). ...
static bool shouldIgnoreMacro(MacroDirective *MD, bool IsModule, const Preprocessor &PP)
SmallVector< Header, 2 > Headers[5]
The headers that are part of this module.
A CXXFunctionalCastExpr record.
A FloatingLiteral record.
Record code for the offsets of each decl.
SourceLocation getTemplateEllipsisLoc() const
SourceLocation getNameLoc() const
Metadata for submodules as a whole.
SourceLocation getDefinitionEndLoc() const
Return the location of the last token in the macro.
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.
bool isBaseVirtual() const
Returns whether the base is virtual or not.
Defines the clang::TargetOptions class.
A TemplateTypeParmDecl record.
An ImaginaryLiteral record.
unsigned LocalNumDecls
The number of declarations in this AST file.
unsigned getMajor() const
Retrieve the major version number.
The internal 'instancetype' typedef.
unsigned getNumTypeArgs() const
FunctionDecl * getExceptionSpecTemplate() const
If this function type has an uninstantiated exception specification, this is the function whose excep...
void CompletedImplicitDefinition(const FunctionDecl *D) override
An implicit member got a definition.
SourceLocation getRParenLoc() const
Describes the categories of an Objective-C class.
static ASTFileSignature getSignature()
uint32_t MacroID
An ID number that refers to a macro in an AST file.
const FileInfo & getFile() const
void AddCXXDefinitionData(const CXXRecordDecl *D, RecordDataImpl &Record)
The AST block, which acts as a container around the full AST block.
Record code for the list of other AST files made available by this AST file but not actually used by ...
Represents one property declaration in an Objective-C interface.
TypedefNameDecl * getDecl() const
DiagnosticOptions & getDiagnosticOptions() const
Retrieve the diagnostic options.
TypeSpecifierType getWrittenTypeSpec() const
unsigned getNumProtocols() const
NamespaceAliasDecl * getAsNamespaceAlias() const
Retrieve the namespace alias stored in this nested name specifier.
SourceLocation getBegin() const
void AddVersionTuple(const VersionTuple &Version, RecordDataImpl &Record)
Add a version tuple to the given record.
lookup_result lookup(DeclarationName Name) const
void AddNestedNameSpecifier(NestedNameSpecifier *NNS, RecordDataImpl &Record)
Emit a nested name specifier.
const Token & getReplacementToken(unsigned Tok) const
void AddDeclRef(const Decl *D, RecordDataImpl &Record)
Emit a reference to a declaration.
An InjectedClassNameType record.
FileID getMainFileID() const
Returns the FileID of the main source file.
bool getInheritConstructors() const
Determine whether this base class's constructors get inherited.
bool isFileContext() const
Record code for the extra statistics we gather while generating an AST file.
FunctionDecl * getcudaConfigureCallDecl()
int getSourceOrder() const
Return the source position of the initializer, counting from 0. If the initializer was implicit...
DeclContextLookupResult lookup_result
SourceLocation getKWLoc() const
static void addExceptionSpec(ASTWriter &Writer, const FunctionProtoType *T, ASTWriter::RecordDataImpl &Record)
An array of decls optimized for the common case of only containing one entry.
bool PreparePathForOutput(SmallVectorImpl< char > &Path)
Convert a path from this build process into one that is appropriate for emission in the module file...
HashTableTy::const_iterator iterator
unsigned LocalNumSubmodules
The number of submodules in this module.
QualifiedTemplateName * getAsQualifiedTemplateName() const
Retrieve the underlying qualified template name structure, if any.
unsigned ComputeHash(Selector Sel)
void AddCXXBaseSpecifiersRef(CXXBaseSpecifier const *Bases, CXXBaseSpecifier const *BasesEnd, RecordDataImpl &Record)
Emit a set of C++ base specifiers to the record.
DiagnosticsEngine & getDiagnostics() const
Record code for referenced selector pool.
ValueDecl * getAsDecl() const
Retrieve the declaration for a declaration non-type template argument.
bool isLocalSourceLocation(SourceLocation Loc) const
Returns true if Loc did not come from a PCH/Module.
SourceLocation getNameLoc() const
Represents a pointer type decayed from an array or function type.
FileID getPredefinesFileID() const
Returns the FileID for the preprocessor predefines.
The injected class name of a C++ class template or class template partial specialization. Used to record that a type was spelled with a bare identifier rather than as a template-id; the equivalent for non-templated classes is just RecordType.
QualType getPointeeType() const
Record code for the set of non-builtin, special types.
A ObjCProtocolDecl record.
Represents a pack expansion of types.
SmallVectorImpl< uint64_t > RecordDataImpl
ArrayRef< QualType > getTypeArgsAsWritten() const
Expr * getSizeExpr() const
unsigned getFlags() const
Return the internal represtation of the flags.
SourceLocation getLocation() 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.
attr::Kind getKind() const
unsigned LocalNumSelectors
The number of selectors new to this file.
Record code for a decl replacement block.
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
void AddDeclarationNameLoc(const DeclarationNameLoc &DNLoc, DeclarationName Name, RecordDataImpl &Record)
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 DeducedReturnType(const FunctionDecl *FD, QualType ReturnType) override
A function's return type has been deduced.
Represents a type which was implicitly adjusted by the semantic engine for arbitrary reasons...
QualType getAsType() const
Retrieve the type for a type template argument.
Represents a template name that was expressed as a qualified name.
TypeSourceInfo * getTypeSourceInfo() const
Returns the declarator information for a base class or delegating initializer.
Record code for the module name.
Selector getObjCSelector() const
An IntegerLiteral record.
Describes an inclusion directive within the preprocessing record.
bool hasTemplateKeyword() const
Whether the template name was prefixed by the "template" keyword.
not evaluated yet, for special member function
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).
Specifies a configuration macro for this module.
void AddASTTemplateArgumentListInfo(const ASTTemplateArgumentListInfo *ASTTemplArgList, RecordDataImpl &Record)
Emits an AST template argument list info.
const char * getFilename(unsigned ID) const
Module * inferModuleFromLocation(FullSourceLoc Loc)
Infers the (sub)module based on the given source location and source manager.
SourceLocation getEllipsisLoc() const
bool hasLocalNonFastQualifiers() const
Determine whether this particular QualType instance has any "non-fast" qualifiers, e.g., those that are stored in an ExtQualType instance.
An ExtVectorElementExpr record.
Record code for the array of unused file scoped decls.
A FunctionNoProtoType record.
void RewriteDecl(const Decl *D)
Reads an AST files chain containing the contents of a translation unit.
bool getProducesResult() const
const FileSystemOptions & getFileSystemOptions()
Returns the current file system options.
QualType getEquivalentType() const
A ClassTemplatePartialSpecializationDecl record.
An ObjCIvarRefExpr record.
SourceLocation getStarLoc() const
ObjCInterfaceDecl * getDefinition()
Retrieve the definition of this class, or NULL if this class has been forward-declared (with @class) ...
IdentifierInfo * getAsIdentifier() const
Retrieve the identifier stored in this nested name specifier.
SourceLocation getTemplateKeywordLoc() const
bool isGNUVarargs() const
bool isParameterPack() const
const ContentCache * getContentCache() const
void AddUnresolvedSet(const ASTUnresolvedSet &Set, RecordDataImpl &Record)
Emit a UnresolvedSet structure.
Record code for the Objective-C method pool,.
const MacroInfo * getMacroInfo() const
Record of updates for a declaration that was modified after being deserialized.
static unsigned CreateSLocBufferAbbrev(llvm::BitstreamWriter &Stream)
Create an abbreviation for the SLocEntry that refers to a buffer.
unsigned getExistingSubmoduleID(Module *Mod) const
Retrieve a submodule ID for this module. Returns 0 If no ID has been associated with the module...
A CharacterLiteral record.
CallingConv getCC() const
SourceLocation getCaretLoc() const
Specifies a header that is private to this submodule.
Expr * getSizeExpr() const
A LinkageSpecDecl record.
Describes a macro expansion within the preprocessing record.
An ObjCStringLiteral record.
A CXXDynamicCastExpr record.
A CXXForRangeStmt record.
SourceLocation LAngleLoc
The source location of the left angle bracket ('<').
SourceLocation getElaboratedKeywordLoc() const
QualType getModifiedType() const
PreprocessingRecord * getPreprocessingRecord() const
Retrieve the preprocessing record, or NULL if there is no preprocessing record.
IdentifierResolver IdResolver
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
FieldDecl * getMember() const
If this is a member initializer, returns the declaration of the non-static data member being initiali...
SourceLocation getExpansionLocStart() const
An RValueReferenceType record.
A type that was preceded by the 'template' keyword, stored as a Type*.
bool isExtensionToken() const
An ObjCAtFinallyStmt record.
QualType getPointeeType() const
Encapsulates the data about a macro definition (e.g. its tokens).
Capturing variable-length array type.
bool isMacroArgExpansion() const
QualType getLocalUnqualifiedType() const
Return this type with all of the instance-specific qualifiers removed, but without removing any quali...
struct CXXLitOpName CXXLiteralOperatorName
TypeSpecifierSign getWrittenSignSpec() const
std::vector< Conflict > Conflicts
The list of conflicts.
Record code for the table of offsets into the Objective-C method pool.
unsigned getTypeQuals() const
Represents a C++ base or member initializer.
SourceLocation getPointOfInstantiation() const
Retrieve the first point of instantiation of this member. If the point of instantiation is an invalid...
A DependentSizedArrayType record.
Record code for the remapping information used to relate loaded modules to the various offsets and ID...
An ObjCAtSynchronizedStmt record.
MacroDirective * getLocalMacroDirectiveHistory(const IdentifierInfo *II) const
Given an identifier, return the latest non-imported macro directive for that identifier.
An UnresolvedSet-like class which uses the ASTContext's allocator.
unsigned getNumArgs() const
Record code for declarations that Sema keeps references of.
QualType getIntegralType() const
Retrieve the type of the integral value.
A SizefAlignOfExpr record.
void AddedCXXTemplateSpecialization(const ClassTemplateDecl *TD, const ClassTemplateSpecializationDecl *D) override
A template specialization (or partial one) was added to the template declaration. ...
const unsigned int NUM_PREDEF_MACRO_IDS
The number of predefined macro IDs.
Offsets into the input-files block where input files reside.
A CXXMemberCallExpr record.
QualType getInnerType() const
ClassTemplateDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this template.
void ResolvedExceptionSpec(const FunctionDecl *FD) override
A function's exception specification has been evaluated or instantiated.
const DeclarationNameLoc & getInfo() const
void FlushCXXCtorInitializers()
Flush all of the C++ constructor initializer lists that have been added via AddCXXCtorInitializersRef...
bool isBuiltinMacro() const
Return true if this macro requires processing before expansion.
The block containing the submodule structure.
Wrapper for source info for record types.
TypeSourceInfo * getTypeSourceInfo() const
Retrieves the type and source location of the base class.
ObjCInterfaceDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this Objective-C class.
The template argument is a type.
Wraps an ObjCPointerType with source location information.
import_range local_imports() const
Optional< unsigned > getSubminor() const
Retrieve the subminor version number, if provided.
NestedNameSpecifier * getQualifier() const
serialization::SelectorID getSelectorRef(Selector Sel)
Get the unique number used to refer to the given selector.
serialization::PreprocessedEntityID BasePreprocessedEntityID
Base preprocessed entity ID for preprocessed entities local to this module.
Capturing the this pointer.
Represents a base class of a C++ class.
SourceLocation getProtocolLAngleLoc() const
SourceManager & getSourceManager()
Keeps track of options that affect how file operations are performed.
NestedNameSpecifierLoc getQualifierLoc() const
A template argument list.
TemplateArgumentLocInfo getLocInfo() const
const Type * getClass() const
QualType getNullPtrType() const
Retrieve the type for null non-type template argument.
NestedNameSpecifierLoc QualifierLoc
PreprocessorOptions & getPreprocessorOpts() const
Retrieve the preprocessor options used to initialize this preprocessor.
bool hasRevertedTokenIDToIdentifier() const
True if RevertTokenIDToIdentifier() was called.
uint32_t PreprocessedEntityID
An ID number that refers to an entity in the detailed preprocessing record.
SourceLocation getProtocolLoc(unsigned i) const
unsigned pack_size() const
The number of template arguments in the given template argument pack.
known_categories_iterator known_categories_end() const
Retrieve an iterator to the end of the known-categories list.
void AddStmt(Stmt *S)
Add the given statement or expression to the queue of statements to emit.
bool isPackExpansion() const
Determine whether this capture is a pack expansion, which captures a function parameter pack...
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...
unsigned InferSubmodules
Whether we should infer submodules for this module based on the headers.
Represents a C++ struct/union/class.
void FlushStmts()
Flush all of the statements and expressions that have been added to the queue via AddStmt()...
uint32_t SelectorID
An ID number that refers to an ObjC selector in an AST file.
An TemplateTypeParmType record.
void DeclarationMarkedUsed(const Decl *D) override
A declaration is marked used which was not previously marked used.
Decl * D
The template function declaration to be late parsed.
SourceLocation getTemplateNameLoc() const
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.
NestedNameSpecifier * getNestedNameSpecifier() const
Retrieve the nested-name-specifier to which this instance refers.
ArraySizeModifier getSizeModifier() const
ElaboratedTypeKeyword getKeyword() const
A structure for storing the information associated with an overloaded template name.
SourceLocation getRParenLoc() const
Location information for a TemplateArgument.
A ObjCAtDefsFieldDecl record.
Declaration of a class template.
Record code for the offsets of each type.
The block containing the definitions of all of the types and decls used within the AST file...
Writes an AST file containing the contents of a translation unit.
VarTemplateDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this template.
Record code for the table of offsets to CXXCtorInitializers lists.
SourceLocation getLBracketLoc() const
serialization::DeclID getDeclID(const Decl *D)
Determine the declaration ID of an already-emitted declaration.
QualType getAdjustedType() const
LineTableInfo & getLineTable()
Retrieve the stored line table.
QualType getParamTypeForDecl() const
NestedNameSpecifier * getQualifier() const
Return the nested name specifier that qualifies this name.
Defines the clang::TargetInfo interface.
MacroDefinitionRecord * findMacroDefinition(const MacroInfo *MI)
Retrieve the macro definition that corresponds to the given MacroInfo.
A SourceLocation and its associated SourceManager.
QualType getPattern() const
Retrieve the pattern of this pack expansion, which is the type that will be repeatedly instantiated w...
Defines the clang::VersionTuple class, which represents a version in the form major[.minor[.subminor]].
ArrayRef< ModuleMacro * > getLeafModuleMacros(const IdentifierInfo *II) const
Get the list of leaf (non-overridden) module macros for a name.
Describes the redeclarations of a declaration.
a linked list of methods with the same selector name but different signatures.
Specifies a required feature.
bool hasExternalDecls() const
QualType getPointeeTypeAsWritten() const
std::vector< std::string > ConfigMacros
The set of "configuration macros", which are macros that (intentionally) change how this module is bu...
bool getHasRegParm() const
TypeSourceInfo * getAsTypeSourceInfo() const
uint32_t getIndex() const
An ObjCMessageExpr record.
TagDecl * getDecl() const
SourceLocation getRBracketLoc() const
Record for offsets of DECL_UPDATES records for declarations that were modified after being deserializ...
TranslationUnitDecl - The top declaration context.
A CompoundAssignOperator record.
VarDecl * getArrayIndex(unsigned I)
Retrieve a particular array index variable used to describe an array member initialization.
NamespaceDecl * getAnonymousNamespace() const
Retrieve the anonymous namespace nested inside this namespace, if any.
Represents a type template specialization; the template must be a class template, a type alias templa...
QualType getjmp_bufType() const
Retrieve the C jmp_buf type.
SourceLocation getRAngleLoc() const
unsigned getLength() const
QualType getElementType() const
SourceLocation getStarLoc() const
DeclContext * getPrimaryContext()
A FunctionTemplateDecl record.
llvm::DenseMap< CXXRecordDecl *, bool > VTablesUsed
The set of classes whose vtables have been used within this translation unit, and a bit that will be ...
SourceLocation getInnerLocStart() const
void AddCXXCtorInitializers(const CXXCtorInitializer *const *CtorInitializers, unsigned NumCtorInitializers, RecordDataImpl &Record)
Emit a CXXCtorInitializer array.
Contains a late templated function. Will be parsed at the end of the translation unit, used by Sema & Parser.
Record code for weak undeclared identifiers.
The block containing information about the preprocessor.
SourceLocation getAmpLoc() const
SourceLocation getLAngleLoc() const
uint32_t TypeID
An ID number that refers to a type in an AST file.
unsigned getGlobalID() const
Retrieve the global declaration ID associated with this declaration, which specifies where in the...
Wrapper for source info for builtin types.
bool isUnresolvedExceptionSpec(ExceptionSpecificationType ESpecType)
A set of overloaded template declarations.
Wrapper for template type parameters.
A trivial tuple used to represent a source range.
SourceLocation getLocation() const
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.
ObjCMethodList * getNext() const
unsigned IsExplicit
Whether this is an explicit submodule.
NestedNameSpecifierLoc getQualifierLoc() const
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.
std::pair< FileID, unsigned > getDecomposedLoc(SourceLocation Loc) const
Decompose the specified location into a raw FileID + Offset pair.
SourceRange getSourceRange() const LLVM_READONLY
Retrieves the source range that contains the entire base specifier.
bool isFirstDecl() const
True if this is the first declaration in its redeclaration chain.
A function-like macro definition. [PP_MACRO_FUNCTION_LIKE, <ObjectLikeStuff>, IsC99Varargs, IsGNUVarars, NumArgs, ArgIdentInfoID* ].
bool isNull() const
isNull - Return true if this QualType doesn't point to a type yet.
The Objective-C 'Protocol' type.
The global specifier '::'. There is no stored value.
T * getFETokenInfo() const
NamespaceDecl * getStdNamespace() const
The control block, which contains all of the information that needs to be validated prior to committi...
const TemplateArgument & getArgument() const
Wrapper for source info for pointers.
Wrapper for source info for block pointers.
void AddedCXXImplicitMember(const CXXRecordDecl *RD, const Decl *D) override
An implicit member was added after the definition was completed.
Optional< unsigned > getNumExpansions() const
Retrieve the number of expansions that this pack expansion will generate, if known.
This class handles loading and caching of source files into memory.
const CXXDestructorDecl * getDestructor() const
PredefinedDeclIDs
Predefined declaration IDs.
Declaration of a template function.
Record code for an update to the TU's lexically contained declarations.
A GenericSelectionExpr record.
A type index; the type ID with the qualifier bits removed.
Attr - This represents one attribute.
void TypeRead(serialization::TypeIdx Idx, QualType T) override
A type was deserialized from the AST file. The ID here has the qualifier bits already removed...
const MacroDirective * getPrevious() const
Get previous definition of the macro with the same name.
bool SawDateOrTime() const
Returns true if the preprocessor has seen a use of DATE or TIME in the file so far.
A PackExpansionType record.
A single template declaration.
const unsigned int NUM_PREDEF_SUBMODULE_IDS
The number of predefined submodule IDs.
SourceLocation getLocation() const
SourceLocation getStarLoc() const
unsigned InferExplicitSubmodules
Whether, when inferring submodules, the inferred submodules should be explicit.
NamedDecl *const * iterator
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
void GetUniqueIDMapping(SmallVectorImpl< const FileEntry * > &UIDToFiles) const
Produce an array mapping from the unique IDs assigned to each file to the corresponding FileEntry poi...
A DependentTemplateSpecializationType record.
bool isUsed() const
Return false if this macro is defined in the main file and has not yet been used. ...
void AddAPFloat(const llvm::APFloat &Value, RecordDataImpl &Record)
Emit a floating-point value.
static bool isInterestingIdentifier(IdentifierInfo &II)
Whether the given identifier is "interesting".
SourceLocation getSpellingLoc() const
bool capturesVariable() const
Determine whether this capture handles a variable.
bool isHidden() const
Determine whether this declaration is hidden from name lookup.
SourceLocation getLParenLoc() const
Record code for the array of tentative definitions.
unsigned getNumExceptions() const
SourceLocation getLParenLoc() const
iterator local_begin()
Begin iterator for local, non-loaded, preprocessed entities.
IdentifierInfo * getIdentifierInfo() const
SourceLocation getTemplateLoc() const
QualType getDeducedType() const
Get the type deduced for this auto type, or null if it's either not been deduced or was deduced to a ...