llvm/clang/lib/Serialization/ASTWriter.cpp

//===- ASTWriter.cpp - AST File Writer ------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
//  This file defines the ASTWriter class, which writes AST files.
//
//===----------------------------------------------------------------------===//

#include "ASTCommon.h"
#include "ASTReaderInternals.h"
#include "MultiOnDiskHashTable.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/ASTUnresolvedSet.h"
#include "clang/AST/AbstractTypeWriter.h"
#include "clang/AST/Attr.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclBase.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclContextInternals.h"
#include "clang/AST/DeclFriend.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/DeclTemplate.h"
#include "clang/AST/DeclarationName.h"
#include "clang/AST/Expr.h"
#include "clang/AST/ExprCXX.h"
#include "clang/AST/LambdaCapture.h"
#include "clang/AST/NestedNameSpecifier.h"
#include "clang/AST/OpenACCClause.h"
#include "clang/AST/OpenMPClause.h"
#include "clang/AST/RawCommentList.h"
#include "clang/AST/TemplateName.h"
#include "clang/AST/Type.h"
#include "clang/AST/TypeLoc.h"
#include "clang/AST/TypeLocVisitor.h"
#include "clang/Basic/Diagnostic.h"
#include "clang/Basic/DiagnosticOptions.h"
#include "clang/Basic/FileManager.h"
#include "clang/Basic/FileSystemOptions.h"
#include "clang/Basic/IdentifierTable.h"
#include "clang/Basic/LLVM.h"
#include "clang/Basic/Lambda.h"
#include "clang/Basic/LangOptions.h"
#include "clang/Basic/Module.h"
#include "clang/Basic/ObjCRuntime.h"
#include "clang/Basic/OpenACCKinds.h"
#include "clang/Basic/OpenCLOptions.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/SourceManagerInternals.h"
#include "clang/Basic/Specifiers.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Basic/TargetOptions.h"
#include "clang/Basic/Version.h"
#include "clang/Lex/HeaderSearch.h"
#include "clang/Lex/HeaderSearchOptions.h"
#include "clang/Lex/MacroInfo.h"
#include "clang/Lex/ModuleMap.h"
#include "clang/Lex/PreprocessingRecord.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Lex/PreprocessorOptions.h"
#include "clang/Lex/Token.h"
#include "clang/Sema/IdentifierResolver.h"
#include "clang/Sema/ObjCMethodList.h"
#include "clang/Sema/Sema.h"
#include "clang/Sema/SemaCUDA.h"
#include "clang/Sema/SemaObjC.h"
#include "clang/Sema/Weak.h"
#include "clang/Serialization/ASTBitCodes.h"
#include "clang/Serialization/ASTReader.h"
#include "clang/Serialization/ASTRecordWriter.h"
#include "clang/Serialization/InMemoryModuleCache.h"
#include "clang/Serialization/ModuleFile.h"
#include "clang/Serialization/ModuleFileExtension.h"
#include "clang/Serialization/SerializationDiagnostic.h"
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/APSInt.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/Hashing.h"
#include "llvm/ADT/PointerIntPair.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/ScopeExit.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Bitstream/BitCodes.h"
#include "llvm/Bitstream/BitstreamWriter.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Compression.h"
#include "llvm/Support/DJB.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/EndianStream.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/LEB128.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/OnDiskHashTable.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/SHA1.h"
#include "llvm/Support/TimeProfiler.h"
#include "llvm/Support/VersionTuple.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <cassert>
#include <cstdint>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <limits>
#include <memory>
#include <optional>
#include <queue>
#include <tuple>
#include <utility>
#include <vector>

usingnamespaceclang;
usingnamespaceclang::serialization;

template <typename T, typename Allocator>
static StringRef bytes(const std::vector<T, Allocator> &v) {}

template <typename T>
static StringRef bytes(const SmallVectorImpl<T> &v) {}

static std::string bytes(const std::vector<bool> &V) {}

//===----------------------------------------------------------------------===//
// Type serialization
//===----------------------------------------------------------------------===//

static TypeCode getTypeCodeForTypeClass(Type::TypeClass id) {}

namespace {

std::optional<std::set<const FileEntry *>>
GetAffectingModuleMaps(const Preprocessor &PP, Module *RootModule) {}

class ASTTypeWriter {};

class TypeLocWriter : public TypeLocVisitor<TypeLocWriter> {};

} // namespace

void TypeLocWriter::VisitQualifiedTypeLoc(QualifiedTypeLoc TL) {}

void TypeLocWriter::VisitBuiltinTypeLoc(BuiltinTypeLoc TL) {}

void TypeLocWriter::VisitComplexTypeLoc(ComplexTypeLoc TL) {}

void TypeLocWriter::VisitPointerTypeLoc(PointerTypeLoc TL) {}

void TypeLocWriter::VisitDecayedTypeLoc(DecayedTypeLoc TL) {}

void TypeLocWriter::VisitAdjustedTypeLoc(AdjustedTypeLoc TL) {}

void TypeLocWriter::VisitArrayParameterTypeLoc(ArrayParameterTypeLoc TL) {}

void TypeLocWriter::VisitBlockPointerTypeLoc(BlockPointerTypeLoc TL) {}

void TypeLocWriter::VisitLValueReferenceTypeLoc(LValueReferenceTypeLoc TL) {}

void TypeLocWriter::VisitRValueReferenceTypeLoc(RValueReferenceTypeLoc TL) {}

void TypeLocWriter::VisitMemberPointerTypeLoc(MemberPointerTypeLoc TL) {}

void TypeLocWriter::VisitArrayTypeLoc(ArrayTypeLoc TL) {}

void TypeLocWriter::VisitConstantArrayTypeLoc(ConstantArrayTypeLoc TL) {}

void TypeLocWriter::VisitIncompleteArrayTypeLoc(IncompleteArrayTypeLoc TL) {}

void TypeLocWriter::VisitVariableArrayTypeLoc(VariableArrayTypeLoc TL) {}

void TypeLocWriter::VisitDependentSizedArrayTypeLoc(
                                            DependentSizedArrayTypeLoc TL) {}

void TypeLocWriter::VisitDependentAddressSpaceTypeLoc(
    DependentAddressSpaceTypeLoc TL) {}

void TypeLocWriter::VisitDependentSizedExtVectorTypeLoc(
                                        DependentSizedExtVectorTypeLoc TL) {}

void TypeLocWriter::VisitVectorTypeLoc(VectorTypeLoc TL) {}

void TypeLocWriter::VisitDependentVectorTypeLoc(
    DependentVectorTypeLoc TL) {}

void TypeLocWriter::VisitExtVectorTypeLoc(ExtVectorTypeLoc TL) {}

void TypeLocWriter::VisitConstantMatrixTypeLoc(ConstantMatrixTypeLoc TL) {}

void TypeLocWriter::VisitDependentSizedMatrixTypeLoc(
    DependentSizedMatrixTypeLoc TL) {}

void TypeLocWriter::VisitFunctionTypeLoc(FunctionTypeLoc TL) {}

void TypeLocWriter::VisitFunctionProtoTypeLoc(FunctionProtoTypeLoc TL) {}

void TypeLocWriter::VisitFunctionNoProtoTypeLoc(FunctionNoProtoTypeLoc TL) {}

void TypeLocWriter::VisitUnresolvedUsingTypeLoc(UnresolvedUsingTypeLoc TL) {}

void TypeLocWriter::VisitUsingTypeLoc(UsingTypeLoc TL) {}

void TypeLocWriter::VisitTypedefTypeLoc(TypedefTypeLoc TL) {}

void TypeLocWriter::VisitObjCTypeParamTypeLoc(ObjCTypeParamTypeLoc TL) {}

void TypeLocWriter::VisitTypeOfExprTypeLoc(TypeOfExprTypeLoc TL) {}

void TypeLocWriter::VisitTypeOfTypeLoc(TypeOfTypeLoc TL) {}

void TypeLocWriter::VisitDecltypeTypeLoc(DecltypeTypeLoc TL) {}

void TypeLocWriter::VisitUnaryTransformTypeLoc(UnaryTransformTypeLoc TL) {}

void ASTRecordWriter::AddConceptReference(const ConceptReference *CR) {}

void TypeLocWriter::VisitPackIndexingTypeLoc(PackIndexingTypeLoc TL) {}

void TypeLocWriter::VisitAutoTypeLoc(AutoTypeLoc TL) {}

void TypeLocWriter::VisitDeducedTemplateSpecializationTypeLoc(
    DeducedTemplateSpecializationTypeLoc TL) {}

void TypeLocWriter::VisitRecordTypeLoc(RecordTypeLoc TL) {}

void TypeLocWriter::VisitEnumTypeLoc(EnumTypeLoc TL) {}

void TypeLocWriter::VisitAttributedTypeLoc(AttributedTypeLoc TL) {}

void TypeLocWriter::VisitCountAttributedTypeLoc(CountAttributedTypeLoc TL) {}

void TypeLocWriter::VisitBTFTagAttributedTypeLoc(BTFTagAttributedTypeLoc TL) {}

void TypeLocWriter::VisitHLSLAttributedResourceTypeLoc(
    HLSLAttributedResourceTypeLoc TL) {}

void TypeLocWriter::VisitTemplateTypeParmTypeLoc(TemplateTypeParmTypeLoc TL) {}

void TypeLocWriter::VisitSubstTemplateTypeParmTypeLoc(
                                            SubstTemplateTypeParmTypeLoc TL) {}

void TypeLocWriter::VisitSubstTemplateTypeParmPackTypeLoc(
                                          SubstTemplateTypeParmPackTypeLoc TL) {}

void TypeLocWriter::VisitTemplateSpecializationTypeLoc(
                                           TemplateSpecializationTypeLoc TL) {}

void TypeLocWriter::VisitParenTypeLoc(ParenTypeLoc TL) {}

void TypeLocWriter::VisitMacroQualifiedTypeLoc(MacroQualifiedTypeLoc TL) {}

void TypeLocWriter::VisitElaboratedTypeLoc(ElaboratedTypeLoc TL) {}

void TypeLocWriter::VisitInjectedClassNameTypeLoc(InjectedClassNameTypeLoc TL) {}

void TypeLocWriter::VisitDependentNameTypeLoc(DependentNameTypeLoc TL) {}

void TypeLocWriter::VisitDependentTemplateSpecializationTypeLoc(
       DependentTemplateSpecializationTypeLoc TL) {}

void TypeLocWriter::VisitPackExpansionTypeLoc(PackExpansionTypeLoc TL) {}

void TypeLocWriter::VisitObjCInterfaceTypeLoc(ObjCInterfaceTypeLoc TL) {}

void TypeLocWriter::VisitObjCObjectTypeLoc(ObjCObjectTypeLoc TL) {}

void TypeLocWriter::VisitObjCObjectPointerTypeLoc(ObjCObjectPointerTypeLoc TL) {}

void TypeLocWriter::VisitAtomicTypeLoc(AtomicTypeLoc TL) {}

void TypeLocWriter::VisitPipeTypeLoc(PipeTypeLoc TL) {}

void TypeLocWriter::VisitBitIntTypeLoc(clang::BitIntTypeLoc TL) {}
void TypeLocWriter::VisitDependentBitIntTypeLoc(
    clang::DependentBitIntTypeLoc TL) {}

void ASTWriter::WriteTypeAbbrevs() {}

//===----------------------------------------------------------------------===//
// ASTWriter Implementation
//===----------------------------------------------------------------------===//

static void EmitBlockID(unsigned ID, const char *Name,
                        llvm::BitstreamWriter &Stream,
                        ASTWriter::RecordDataImpl &Record) {}

static void EmitRecordID(unsigned ID, const char *Name,
                         llvm::BitstreamWriter &Stream,
                         ASTWriter::RecordDataImpl &Record) {}

static void AddStmtsExprs(llvm::BitstreamWriter &Stream,
                          ASTWriter::RecordDataImpl &Record) {}

void ASTWriter::WriteBlockInfoBlock() {}

/// Prepares a path for being written to an AST file by converting it
/// to an absolute path and removing nested './'s.
///
/// \return \c true if the path was changed.
static bool cleanPathForOutput(FileManager &FileMgr,
                               SmallVectorImpl<char> &Path) {}

/// Adjusts the given filename to only write out the portion of the
/// filename that is not part of the system root directory.
///
/// \param Filename the file name to adjust.
///
/// \param BaseDir When non-NULL, the PCH file is a relocatable AST file and
/// the returned filename will be adjusted by this root directory.
///
/// \returns either the original filename (if it needs no adjustment) or the
/// adjusted filename (which points into the @p Filename parameter).
static const char *
adjustFilenameForRelocatableAST(const char *Filename, StringRef BaseDir) {}

std::pair<ASTFileSignature, ASTFileSignature>
ASTWriter::createSignature() const {}

ASTFileSignature ASTWriter::createSignatureForNamedModule() const {}

static void BackpatchSignatureAt(llvm::BitstreamWriter &Stream,
                                 const ASTFileSignature &S, uint64_t BitNo) {}

ASTFileSignature ASTWriter::backpatchSignature() {}

void ASTWriter::writeUnhashedControlBlock(Preprocessor &PP,
                                          ASTContext &Context) {}

/// Write the control block.
void ASTWriter::WriteControlBlock(Preprocessor &PP, ASTContext &Context,
                                  StringRef isysroot) {}

namespace  {

/// An input file.
struct InputFileEntry {};

} // namespace

SourceLocation ASTWriter::getAffectingIncludeLoc(const SourceManager &SourceMgr,
                                                 const SrcMgr::FileInfo &File) {}

void ASTWriter::WriteInputFiles(SourceManager &SourceMgr,
                                HeaderSearchOptions &HSOpts) {}

//===----------------------------------------------------------------------===//
// Source Manager Serialization
//===----------------------------------------------------------------------===//

/// Create an abbreviation for the SLocEntry that refers to a
/// file.
static unsigned CreateSLocFileAbbrev(llvm::BitstreamWriter &Stream) {}

/// Create an abbreviation for the SLocEntry that refers to a
/// buffer.
static unsigned CreateSLocBufferAbbrev(llvm::BitstreamWriter &Stream) {}

/// Create an abbreviation for the SLocEntry that refers to a
/// buffer's blob.
static unsigned CreateSLocBufferBlobAbbrev(llvm::BitstreamWriter &Stream,
                                           bool Compressed) {}

/// Create an abbreviation for the SLocEntry that refers to a macro
/// expansion.
static unsigned CreateSLocExpansionAbbrev(llvm::BitstreamWriter &Stream) {}

/// Emit key length and data length as ULEB-encoded data, and return them as a
/// pair.
static std::pair<unsigned, unsigned>
emitULEBKeyDataLength(unsigned KeyLen, unsigned DataLen, raw_ostream &Out) {}

namespace {

  // Trait used for the on-disk hash table of header search information.
  class HeaderFileInfoTrait {};

} // namespace

/// Write the header search block for the list of files that
///
/// \param HS The header search structure to save.
void ASTWriter::WriteHeaderSearch(const HeaderSearch &HS) {}

static void emitBlob(llvm::BitstreamWriter &Stream, StringRef Blob,
                     unsigned SLocBufferBlobCompressedAbbrv,
                     unsigned SLocBufferBlobAbbrv) {}

/// Writes the block containing the serialized form of the
/// source manager.
///
/// TODO: We should probably use an on-disk hash table (stored in a
/// blob), indexed based on the file name, so that we only create
/// entries for files that we actually need. In the common case (no
/// errors), we probably won't have to create file entries for any of
/// the files in the AST.
void ASTWriter::WriteSourceManagerBlock(SourceManager &SourceMgr,
                                        const Preprocessor &PP) {}

//===----------------------------------------------------------------------===//
// Preprocessor Serialization
//===----------------------------------------------------------------------===//

static bool shouldIgnoreMacro(MacroDirective *MD, bool IsModule,
                              const Preprocessor &PP) {}

/// Writes the block containing the serialized form of the
/// preprocessor.
void ASTWriter::WritePreprocessor(const Preprocessor &PP, bool IsModule) {}

void ASTWriter::WritePreprocessorDetail(PreprocessingRecord &PPRec,
                                        uint64_t MacroOffsetsBase) {}

unsigned ASTWriter::getLocalOrImportedSubmoduleID(const Module *Mod) {}

unsigned ASTWriter::getSubmoduleID(Module *Mod) {}

/// Compute the number of modules within the given tree (including the
/// given module).
static unsigned getNumberOfModules(Module *Mod) {}

void ASTWriter::WriteSubmodules(Module *WritingModule) {}

void ASTWriter::WritePragmaDiagnosticMappings(const DiagnosticsEngine &Diag,
                                              bool isModule) {}

//===----------------------------------------------------------------------===//
// Type Serialization
//===----------------------------------------------------------------------===//

/// Write the representation of a type to the AST stream.
void ASTWriter::WriteType(QualType T) {}

//===----------------------------------------------------------------------===//
// Declaration Serialization
//===----------------------------------------------------------------------===//

static bool IsInternalDeclFromFileContext(const Decl *D) {}

/// Write the block containing all of the declaration IDs
/// lexically declared within the given DeclContext.
///
/// \returns the offset of the DECL_CONTEXT_LEXICAL block within the
/// bitstream, or 0 if no block was written.
uint64_t ASTWriter::WriteDeclContextLexicalBlock(ASTContext &Context,
                                                 const DeclContext *DC) {}

void ASTWriter::WriteTypeDeclOffsets() {}

void ASTWriter::WriteFileDeclIDsMap() {}

void ASTWriter::WriteComments() {}

//===----------------------------------------------------------------------===//
// Global Method Pool and Selector Serialization
//===----------------------------------------------------------------------===//

namespace {

// Trait used for the on-disk hash table used in the method pool.
class ASTMethodPoolTrait {};

} // namespace

/// Write ObjC data: selectors and the method pool.
///
/// The method pool contains both instance and factory methods, stored
/// in an on-disk hash table indexed by the selector. The hash table also
/// contains an empty entry for every other selector known to Sema.
void ASTWriter::WriteSelectors(Sema &SemaRef) {}

/// Write the selectors referenced in @selector expression into AST file.
void ASTWriter::WriteReferencedSelectorsPool(Sema &SemaRef) {}

//===----------------------------------------------------------------------===//
// Identifier Table Serialization
//===----------------------------------------------------------------------===//

/// Determine the declaration that should be put into the name lookup table to
/// represent the given declaration in this module. This is usually D itself,
/// but if D was imported and merged into a local declaration, we want the most
/// recent local declaration instead. The chosen declaration will be the most
/// recent declaration in any module that imports this one.
static NamedDecl *getDeclForLocalLookup(const LangOptions &LangOpts,
                                        NamedDecl *D) {}

namespace {

bool IsInterestingIdentifier(const IdentifierInfo *II, uint64_t MacroOffset,
                             bool IsModule, bool IsCPlusPlus) {}

bool IsInterestingNonMacroIdentifier(const IdentifierInfo *II,
                                     ASTWriter &Writer) {}

class ASTIdentifierTableTrait {};

} // namespace

/// If the \param IdentifierID ID is a local Identifier ID. If the higher
/// bits of ID is 0, it implies that the ID doesn't come from AST files.
static bool isLocalIdentifierID(IdentifierID ID) {}

/// Write the identifier table into the AST file.
///
/// The identifier table consists of a blob containing string data
/// (the actual identifiers themselves) and a separate "offsets" index
/// that maps identifier IDs to locations within the blob.
void ASTWriter::WriteIdentifierTable(Preprocessor &PP,
                                     IdentifierResolver &IdResolver,
                                     bool IsModule) {}

void ASTWriter::handleVTable(CXXRecordDecl *RD) {}

//===----------------------------------------------------------------------===//
// DeclContext's Name Lookup Table Serialization
//===----------------------------------------------------------------------===//

namespace {

// Trait used for the on-disk hash table used in the method pool.
class ASTDeclContextNameLookupTrait {};

} // namespace

bool ASTWriter::isLookupResultExternal(StoredDeclsList &Result,
                                       DeclContext *DC) {}

/// Returns ture if all of the lookup result are either external, not emitted or
/// predefined. In such cases, the lookup result is not interesting and we don't
/// need to record the result in the current being written module. Return false
/// otherwise.
static bool isLookupResultNotInteresting(ASTWriter &Writer,
                                         StoredDeclsList &Result) {}

void
ASTWriter::GenerateNameLookupTable(const DeclContext *ConstDC,
                                   llvm::SmallVectorImpl<char> &LookupTable) {}

/// Write the block containing all of the declaration IDs
/// visible from the given DeclContext.
///
/// \returns the offset of the DECL_CONTEXT_VISIBLE block within the
/// bitstream, or 0 if no block was written.
uint64_t ASTWriter::WriteDeclContextVisibleBlock(ASTContext &Context,
                                                 DeclContext *DC) {}

/// Write an UPDATE_VISIBLE block for the given context.
///
/// UPDATE_VISIBLE blocks contain the declarations that are added to an existing
/// DeclContext in a dependent AST file. As such, they only exist for the TU
/// (in C++), for namespaces, and for classes with forward-declared unscoped
/// enumeration members (in C++11).
void ASTWriter::WriteDeclContextVisibleUpdate(const DeclContext *DC) {}

/// Write an FP_PRAGMA_OPTIONS block for the given FPOptions.
void ASTWriter::WriteFPPragmaOptions(const FPOptionsOverride &Opts) {}

/// Write an OPENCL_EXTENSIONS block for the given OpenCLOptions.
void ASTWriter::WriteOpenCLExtensions(Sema &SemaRef) {}
void ASTWriter::WriteCUDAPragmas(Sema &SemaRef) {}

void ASTWriter::WriteObjCCategories() {}

void ASTWriter::WriteLateParsedTemplates(Sema &SemaRef) {}

/// Write the state of 'pragma clang optimize' at the end of the module.
void ASTWriter::WriteOptimizePragmaOptions(Sema &SemaRef) {}

/// Write the state of 'pragma ms_struct' at the end of the module.
void ASTWriter::WriteMSStructPragmaOptions(Sema &SemaRef) {}

/// Write the state of 'pragma pointers_to_members' at the end of the
//module.
void ASTWriter::WriteMSPointersToMembersPragmaOptions(Sema &SemaRef) {}

/// Write the state of 'pragma align/pack' at the end of the module.
void ASTWriter::WritePackPragmaOptions(Sema &SemaRef) {}

/// Write the state of 'pragma float_control' at the end of the module.
void ASTWriter::WriteFloatControlPragmaOptions(Sema &SemaRef) {}

/// Write Sema's collected list of declarations with unverified effects.
void ASTWriter::WriteDeclsWithEffectsToVerify(Sema &SemaRef) {}

void ASTWriter::WriteModuleFileExtension(Sema &SemaRef,
                                         ModuleFileExtensionWriter &Writer) {}

//===----------------------------------------------------------------------===//
// General Serialization Routines
//===----------------------------------------------------------------------===//

void ASTRecordWriter::AddAttr(const Attr *A) {}

/// Emit the list of attributes to the specified record.
void ASTRecordWriter::AddAttributes(ArrayRef<const Attr *> Attrs) {}

void ASTWriter::AddToken(const Token &Tok, RecordDataImpl &Record) {}

void ASTWriter::AddString(StringRef Str, RecordDataImpl &Record) {}

bool ASTWriter::PreparePathForOutput(SmallVectorImpl<char> &Path) {}

void ASTWriter::AddPath(StringRef Path, RecordDataImpl &Record) {}

void ASTWriter::EmitRecordWithPath(unsigned Abbrev, RecordDataRef Record,
                                   StringRef Path) {}

void ASTWriter::AddVersionTuple(const VersionTuple &Version,
                                RecordDataImpl &Record) {}

/// Note that the identifier II occurs at the given offset
/// within the identifier table.
void ASTWriter::SetIdentifierOffset(const IdentifierInfo *II, uint32_t Offset) {}

/// Note that the selector Sel occurs at the given offset
/// within the method pool/selector table.
void ASTWriter::SetSelectorOffset(Selector Sel, uint32_t Offset) {}

ASTWriter::ASTWriter(llvm::BitstreamWriter &Stream,
                     SmallVectorImpl<char> &Buffer,
                     InMemoryModuleCache &ModuleCache,
                     ArrayRef<std::shared_ptr<ModuleFileExtension>> Extensions,
                     bool IncludeTimestamps, bool BuildingImplicitModule,
                     bool GeneratingReducedBMI)
    :{}

ASTWriter::~ASTWriter() = default;

const LangOptions &ASTWriter::getLangOpts() const {}

time_t ASTWriter::getTimestampForOutput(const FileEntry *E) const {}

ASTFileSignature ASTWriter::WriteAST(Sema &SemaRef, StringRef OutputFile,
                                     Module *WritingModule, StringRef isysroot,
                                     bool ShouldCacheASTInMemory) {}

template<typename Vector>
static void AddLazyVectorDecls(ASTWriter &Writer, Vector &Vec) {}

template <typename Vector>
static void AddLazyVectorEmiitedDecls(ASTWriter &Writer, Vector &Vec,
                                      ASTWriter::RecordData &Record) {}

void ASTWriter::computeNonAffectingInputFiles() {}

void ASTWriter::PrepareWritingSpecialDecls(Sema &SemaRef) {}

void ASTWriter::WriteSpecialDeclRecords(Sema &SemaRef) {}

ASTFileSignature ASTWriter::WriteASTCore(Sema &SemaRef, StringRef isysroot,
                                         Module *WritingModule) {}

void ASTWriter::EnteringModulePurview() {}

// Add update records for all mangling numbers and static local numbers.
// These aren't really update records, but this is a convenient way of
// tagging this rare extra data onto the declarations.
void ASTWriter::AddedManglingNumber(const Decl *D, unsigned Number) {}
void ASTWriter::AddedStaticLocalNumbers(const Decl *D, unsigned Number) {}

void ASTWriter::AddedAnonymousNamespace(const TranslationUnitDecl *TU,
                                        NamespaceDecl *AnonNamespace) {}

void ASTWriter::WriteDeclAndTypes(ASTContext &Context) {}

void ASTWriter::WriteDeclUpdatesBlocks(RecordDataImpl &OffsetsRecord) {}

void ASTWriter::AddAlignPackInfo(const Sema::AlignPackInfo &Info,
                                 RecordDataImpl &Record) {}

FileID ASTWriter::getAdjustedFileID(FileID FID) const {}

unsigned ASTWriter::getAdjustedNumCreatedFIDs(FileID FID) const {}

SourceLocation ASTWriter::getAdjustedLocation(SourceLocation Loc) const {}

SourceRange ASTWriter::getAdjustedRange(SourceRange Range) const {}

SourceLocation::UIntTy
ASTWriter::getAdjustedOffset(SourceLocation::UIntTy Offset) const {}

SourceLocation::UIntTy
ASTWriter::getAdjustment(SourceLocation::UIntTy Offset) const {}

void ASTWriter::AddFileID(FileID FID, RecordDataImpl &Record) {}

SourceLocationEncoding::RawLocEncoding
ASTWriter::getRawSourceLocationEncoding(SourceLocation Loc, LocSeq *Seq) {}

void ASTWriter::AddSourceLocation(SourceLocation Loc, RecordDataImpl &Record,
                                  SourceLocationSequence *Seq) {}

void ASTWriter::AddSourceRange(SourceRange Range, RecordDataImpl &Record,
                               SourceLocationSequence *Seq) {}

void ASTRecordWriter::AddAPFloat(const llvm::APFloat &Value) {}

void ASTWriter::AddIdentifierRef(const IdentifierInfo *II, RecordDataImpl &Record) {}

IdentifierID ASTWriter::getIdentifierRef(const IdentifierInfo *II) {}

MacroID ASTWriter::getMacroRef(MacroInfo *MI, const IdentifierInfo *Name) {}

MacroID ASTWriter::getMacroID(MacroInfo *MI) {}

uint32_t ASTWriter::getMacroDirectivesOffset(const IdentifierInfo *Name) {}

void ASTRecordWriter::AddSelectorRef(const Selector SelRef) {}

SelectorID ASTWriter::getSelectorRef(Selector Sel) {}

void ASTRecordWriter::AddCXXTemporary(const CXXTemporary *Temp) {}

void ASTRecordWriter::AddTemplateArgumentLocInfo(
    TemplateArgument::ArgKind Kind, const TemplateArgumentLocInfo &Arg) {}

void ASTRecordWriter::AddTemplateArgumentLoc(const TemplateArgumentLoc &Arg) {}

void ASTRecordWriter::AddTypeSourceInfo(TypeSourceInfo *TInfo) {}

void ASTRecordWriter::AddTypeLoc(TypeLoc TL, LocSeq *OuterSeq) {}

void ASTWriter::AddTypeRef(QualType T, RecordDataImpl &Record) {}

template <typename IdxForTypeTy>
static TypeID MakeTypeID(ASTContext &Context, QualType T,
                         IdxForTypeTy IdxForType) {}

TypeID ASTWriter::GetOrCreateTypeID(QualType T) {}

void ASTWriter::AddEmittedDeclRef(const Decl *D, RecordDataImpl &Record) {}

void ASTWriter::AddDeclRef(const Decl *D, RecordDataImpl &Record) {}

LocalDeclID ASTWriter::GetDeclRef(const Decl *D) {}

LocalDeclID ASTWriter::getDeclID(const Decl *D) {}

bool ASTWriter::wasDeclEmitted(const Decl *D) const {}

void ASTWriter::associateDeclWithFile(const Decl *D, LocalDeclID ID) {}

unsigned ASTWriter::getAnonymousDeclarationNumber(const NamedDecl *D) {}

void ASTRecordWriter::AddDeclarationNameLoc(const DeclarationNameLoc &DNLoc,
                                            DeclarationName Name) {}

void ASTRecordWriter::AddDeclarationNameInfo(
    const DeclarationNameInfo &NameInfo) {}

void ASTRecordWriter::AddQualifierInfo(const QualifierInfo &Info) {}

void ASTRecordWriter::AddNestedNameSpecifierLoc(NestedNameSpecifierLoc NNS) {}

void ASTRecordWriter::AddTemplateParameterList(
    const TemplateParameterList *TemplateParams) {}

/// Emit a template argument list.
void ASTRecordWriter::AddTemplateArgumentList(
    const TemplateArgumentList *TemplateArgs) {}

void ASTRecordWriter::AddASTTemplateArgumentListInfo(
    const ASTTemplateArgumentListInfo *ASTTemplArgList) {}

void ASTRecordWriter::AddUnresolvedSet(const ASTUnresolvedSet &Set) {}

// FIXME: Move this out of the main ASTRecordWriter interface.
void ASTRecordWriter::AddCXXBaseSpecifier(const CXXBaseSpecifier &Base) {}

static uint64_t EmitCXXBaseSpecifiers(ASTWriter &W,
                                      ArrayRef<CXXBaseSpecifier> Bases) {}

// FIXME: Move this out of the main ASTRecordWriter interface.
void ASTRecordWriter::AddCXXBaseSpecifiers(ArrayRef<CXXBaseSpecifier> Bases) {}

static uint64_t
EmitCXXCtorInitializers(ASTWriter &W,
                        ArrayRef<CXXCtorInitializer *> CtorInits) {}

// FIXME: Move this out of the main ASTRecordWriter interface.
void ASTRecordWriter::AddCXXCtorInitializers(
    ArrayRef<CXXCtorInitializer *> CtorInits) {}

void ASTRecordWriter::AddCXXDefinitionData(const CXXRecordDecl *D) {}

void ASTRecordWriter::AddVarDeclInit(const VarDecl *VD) {}

void ASTWriter::ReaderInitialized(ASTReader *Reader) {}

void ASTWriter::IdentifierRead(IdentifierID ID, IdentifierInfo *II) {}

void ASTWriter::MacroRead(serialization::MacroID ID, MacroInfo *MI) {}

void ASTWriter::TypeRead(TypeIdx Idx, QualType T) {}

void ASTWriter::PredefinedDeclBuilt(PredefinedDeclIDs ID, const Decl *D) {}

void ASTWriter::SelectorRead(SelectorID ID, Selector S) {}

void ASTWriter::MacroDefinitionRead(serialization::PreprocessedEntityID ID,
                                    MacroDefinitionRecord *MD) {}

void ASTWriter::ModuleRead(serialization::SubmoduleID ID, Module *Mod) {}

void ASTWriter::CompletedTagDefinition(const TagDecl *D) {}

static bool isImportedDeclContext(ASTReader *Chain, const Decl *D) {}

void ASTWriter::AddedVisibleDecl(const DeclContext *DC, const Decl *D) {}

void ASTWriter::AddedCXXImplicitMember(const CXXRecordDecl *RD, const Decl *D) {}

void ASTWriter::ResolvedExceptionSpec(const FunctionDecl *FD) {}

void ASTWriter::DeducedReturnType(const FunctionDecl *FD, QualType ReturnType) {}

void ASTWriter::ResolvedOperatorDelete(const CXXDestructorDecl *DD,
                                       const FunctionDecl *Delete,
                                       Expr *ThisArg) {}

void ASTWriter::CompletedImplicitDefinition(const FunctionDecl *D) {}

void ASTWriter::VariableDefinitionInstantiated(const VarDecl *D) {}

void ASTWriter::FunctionDefinitionInstantiated(const FunctionDecl *D) {}

void ASTWriter::InstantiationRequested(const ValueDecl *D) {}

void ASTWriter::DefaultArgumentInstantiated(const ParmVarDecl *D) {}

void ASTWriter::DefaultMemberInitializerInstantiated(const FieldDecl *D) {}

void ASTWriter::AddedObjCCategoryToInterface(const ObjCCategoryDecl *CatD,
                                             const ObjCInterfaceDecl *IFD) {}

void ASTWriter::DeclarationMarkedUsed(const Decl *D) {}

void ASTWriter::DeclarationMarkedOpenMPThreadPrivate(const Decl *D) {}

void ASTWriter::DeclarationMarkedOpenMPAllocate(const Decl *D, const Attr *A) {}

void ASTWriter::DeclarationMarkedOpenMPDeclareTarget(const Decl *D,
                                                     const Attr *Attr) {}

void ASTWriter::RedefinedHiddenDefinition(const NamedDecl *D, Module *M) {}

void ASTWriter::AddedAttributeToRecord(const Attr *Attr,
                                       const RecordDecl *Record) {}

void ASTWriter::AddedCXXTemplateSpecialization(
    const ClassTemplateDecl *TD, const ClassTemplateSpecializationDecl *D) {}

void ASTWriter::AddedCXXTemplateSpecialization(
    const VarTemplateDecl *TD, const VarTemplateSpecializationDecl *D) {}

void ASTWriter::AddedCXXTemplateSpecialization(const FunctionTemplateDecl *TD,
                                               const FunctionDecl *D) {}

//===----------------------------------------------------------------------===//
//// OMPClause Serialization
////===----------------------------------------------------------------------===//

namespace {

class OMPClauseWriter : public OMPClauseVisitor<OMPClauseWriter> {};

}

void ASTRecordWriter::writeOMPClause(OMPClause *C) {}

void OMPClauseWriter::writeClause(OMPClause *C) {}

void OMPClauseWriter::VisitOMPClauseWithPreInit(OMPClauseWithPreInit *C) {}

void OMPClauseWriter::VisitOMPClauseWithPostUpdate(OMPClauseWithPostUpdate *C) {}

void OMPClauseWriter::VisitOMPIfClause(OMPIfClause *C) {}

void OMPClauseWriter::VisitOMPFinalClause(OMPFinalClause *C) {}

void OMPClauseWriter::VisitOMPNumThreadsClause(OMPNumThreadsClause *C) {}

void OMPClauseWriter::VisitOMPSafelenClause(OMPSafelenClause *C) {}

void OMPClauseWriter::VisitOMPSimdlenClause(OMPSimdlenClause *C) {}

void OMPClauseWriter::VisitOMPSizesClause(OMPSizesClause *C) {}

void OMPClauseWriter::VisitOMPFullClause(OMPFullClause *C) {}

void OMPClauseWriter::VisitOMPPartialClause(OMPPartialClause *C) {}

void OMPClauseWriter::VisitOMPAllocatorClause(OMPAllocatorClause *C) {}

void OMPClauseWriter::VisitOMPCollapseClause(OMPCollapseClause *C) {}

void OMPClauseWriter::VisitOMPDetachClause(OMPDetachClause *C) {}

void OMPClauseWriter::VisitOMPDefaultClause(OMPDefaultClause *C) {}

void OMPClauseWriter::VisitOMPProcBindClause(OMPProcBindClause *C) {}

void OMPClauseWriter::VisitOMPScheduleClause(OMPScheduleClause *C) {}

void OMPClauseWriter::VisitOMPOrderedClause(OMPOrderedClause *C) {}

void OMPClauseWriter::VisitOMPNowaitClause(OMPNowaitClause *) {}

void OMPClauseWriter::VisitOMPUntiedClause(OMPUntiedClause *) {}

void OMPClauseWriter::VisitOMPMergeableClause(OMPMergeableClause *) {}

void OMPClauseWriter::VisitOMPReadClause(OMPReadClause *) {}

void OMPClauseWriter::VisitOMPWriteClause(OMPWriteClause *) {}

void OMPClauseWriter::VisitOMPUpdateClause(OMPUpdateClause *C) {}

void OMPClauseWriter::VisitOMPCaptureClause(OMPCaptureClause *) {}

void OMPClauseWriter::VisitOMPCompareClause(OMPCompareClause *) {}

// Save the parameter of fail clause.
void OMPClauseWriter::VisitOMPFailClause(OMPFailClause *C) {}

void OMPClauseWriter::VisitOMPSeqCstClause(OMPSeqCstClause *) {}

void OMPClauseWriter::VisitOMPAcqRelClause(OMPAcqRelClause *) {}

void OMPClauseWriter::VisitOMPAbsentClause(OMPAbsentClause *C) {}

void OMPClauseWriter::VisitOMPHoldsClause(OMPHoldsClause *C) {}

void OMPClauseWriter::VisitOMPContainsClause(OMPContainsClause *C) {}

void OMPClauseWriter::VisitOMPNoOpenMPClause(OMPNoOpenMPClause *) {}

void OMPClauseWriter::VisitOMPNoOpenMPRoutinesClause(
    OMPNoOpenMPRoutinesClause *) {}

void OMPClauseWriter::VisitOMPNoParallelismClause(OMPNoParallelismClause *) {}

void OMPClauseWriter::VisitOMPAcquireClause(OMPAcquireClause *) {}

void OMPClauseWriter::VisitOMPReleaseClause(OMPReleaseClause *) {}

void OMPClauseWriter::VisitOMPRelaxedClause(OMPRelaxedClause *) {}

void OMPClauseWriter::VisitOMPWeakClause(OMPWeakClause *) {}

void OMPClauseWriter::VisitOMPThreadsClause(OMPThreadsClause *) {}

void OMPClauseWriter::VisitOMPSIMDClause(OMPSIMDClause *) {}

void OMPClauseWriter::VisitOMPNogroupClause(OMPNogroupClause *) {}

void OMPClauseWriter::VisitOMPInitClause(OMPInitClause *C) {}

void OMPClauseWriter::VisitOMPUseClause(OMPUseClause *C) {}

void OMPClauseWriter::VisitOMPDestroyClause(OMPDestroyClause *C) {}

void OMPClauseWriter::VisitOMPNovariantsClause(OMPNovariantsClause *C) {}

void OMPClauseWriter::VisitOMPNocontextClause(OMPNocontextClause *C) {}

void OMPClauseWriter::VisitOMPFilterClause(OMPFilterClause *C) {}

void OMPClauseWriter::VisitOMPAlignClause(OMPAlignClause *C) {}

void OMPClauseWriter::VisitOMPPrivateClause(OMPPrivateClause *C) {}

void OMPClauseWriter::VisitOMPFirstprivateClause(OMPFirstprivateClause *C) {}

void OMPClauseWriter::VisitOMPLastprivateClause(OMPLastprivateClause *C) {}

void OMPClauseWriter::VisitOMPSharedClause(OMPSharedClause *C) {}

void OMPClauseWriter::VisitOMPReductionClause(OMPReductionClause *C) {}

void OMPClauseWriter::VisitOMPTaskReductionClause(OMPTaskReductionClause *C) {}

void OMPClauseWriter::VisitOMPInReductionClause(OMPInReductionClause *C) {}

void OMPClauseWriter::VisitOMPLinearClause(OMPLinearClause *C) {}

void OMPClauseWriter::VisitOMPAlignedClause(OMPAlignedClause *C) {}

void OMPClauseWriter::VisitOMPCopyinClause(OMPCopyinClause *C) {}

void OMPClauseWriter::VisitOMPCopyprivateClause(OMPCopyprivateClause *C) {}

void OMPClauseWriter::VisitOMPFlushClause(OMPFlushClause *C) {}

void OMPClauseWriter::VisitOMPDepobjClause(OMPDepobjClause *C) {}

void OMPClauseWriter::VisitOMPDependClause(OMPDependClause *C) {}

void OMPClauseWriter::VisitOMPDeviceClause(OMPDeviceClause *C) {}

void OMPClauseWriter::VisitOMPMapClause(OMPMapClause *C) {}

void OMPClauseWriter::VisitOMPAllocateClause(OMPAllocateClause *C) {}

void OMPClauseWriter::VisitOMPNumTeamsClause(OMPNumTeamsClause *C) {}

void OMPClauseWriter::VisitOMPThreadLimitClause(OMPThreadLimitClause *C) {}

void OMPClauseWriter::VisitOMPPriorityClause(OMPPriorityClause *C) {}

void OMPClauseWriter::VisitOMPGrainsizeClause(OMPGrainsizeClause *C) {}

void OMPClauseWriter::VisitOMPNumTasksClause(OMPNumTasksClause *C) {}

void OMPClauseWriter::VisitOMPHintClause(OMPHintClause *C) {}

void OMPClauseWriter::VisitOMPDistScheduleClause(OMPDistScheduleClause *C) {}

void OMPClauseWriter::VisitOMPDefaultmapClause(OMPDefaultmapClause *C) {}

void OMPClauseWriter::VisitOMPToClause(OMPToClause *C) {}

void OMPClauseWriter::VisitOMPFromClause(OMPFromClause *C) {}

void OMPClauseWriter::VisitOMPUseDevicePtrClause(OMPUseDevicePtrClause *C) {}

void OMPClauseWriter::VisitOMPUseDeviceAddrClause(OMPUseDeviceAddrClause *C) {}

void OMPClauseWriter::VisitOMPIsDevicePtrClause(OMPIsDevicePtrClause *C) {}

void OMPClauseWriter::VisitOMPHasDeviceAddrClause(OMPHasDeviceAddrClause *C) {}

void OMPClauseWriter::VisitOMPUnifiedAddressClause(OMPUnifiedAddressClause *) {}

void OMPClauseWriter::VisitOMPUnifiedSharedMemoryClause(
    OMPUnifiedSharedMemoryClause *) {}

void OMPClauseWriter::VisitOMPReverseOffloadClause(OMPReverseOffloadClause *) {}

void
OMPClauseWriter::VisitOMPDynamicAllocatorsClause(OMPDynamicAllocatorsClause *) {}

void OMPClauseWriter::VisitOMPAtomicDefaultMemOrderClause(
    OMPAtomicDefaultMemOrderClause *C) {}

void OMPClauseWriter::VisitOMPAtClause(OMPAtClause *C) {}

void OMPClauseWriter::VisitOMPSeverityClause(OMPSeverityClause *C) {}

void OMPClauseWriter::VisitOMPMessageClause(OMPMessageClause *C) {}

void OMPClauseWriter::VisitOMPNontemporalClause(OMPNontemporalClause *C) {}

void OMPClauseWriter::VisitOMPInclusiveClause(OMPInclusiveClause *C) {}

void OMPClauseWriter::VisitOMPExclusiveClause(OMPExclusiveClause *C) {}

void OMPClauseWriter::VisitOMPOrderClause(OMPOrderClause *C) {}

void OMPClauseWriter::VisitOMPUsesAllocatorsClause(OMPUsesAllocatorsClause *C) {}

void OMPClauseWriter::VisitOMPAffinityClause(OMPAffinityClause *C) {}

void OMPClauseWriter::VisitOMPBindClause(OMPBindClause *C) {}

void OMPClauseWriter::VisitOMPXDynCGroupMemClause(OMPXDynCGroupMemClause *C) {}

void OMPClauseWriter::VisitOMPDoacrossClause(OMPDoacrossClause *C) {}

void OMPClauseWriter::VisitOMPXAttributeClause(OMPXAttributeClause *C) {}

void OMPClauseWriter::VisitOMPXBareClause(OMPXBareClause *C) {}

void ASTRecordWriter::writeOMPTraitInfo(const OMPTraitInfo *TI) {}

void ASTRecordWriter::writeOMPChildren(OMPChildren *Data) {}

void ASTRecordWriter::writeOpenACCVarList(const OpenACCClauseWithVarList *C) {}

void ASTRecordWriter::writeOpenACCIntExprList(ArrayRef<Expr *> Exprs) {}

void ASTRecordWriter::writeOpenACCClause(const OpenACCClause *C) {}

void ASTRecordWriter::writeOpenACCClauseList(
    ArrayRef<const OpenACCClause *> Clauses) {}