llvm/clang/lib/Serialization/ASTWriterDecl.cpp

//===--- ASTWriterDecl.cpp - Declaration Serialization --------------------===//
//
// 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 implements serialization for Declarations.
//
//===----------------------------------------------------------------------===//

#include "ASTCommon.h"
#include "clang/AST/Attr.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclTemplate.h"
#include "clang/AST/DeclVisitor.h"
#include "clang/AST/Expr.h"
#include "clang/AST/OpenMPClause.h"
#include "clang/AST/PrettyDeclStackTrace.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Serialization/ASTReader.h"
#include "clang/Serialization/ASTRecordWriter.h"
#include "llvm/Bitstream/BitstreamWriter.h"
#include "llvm/Support/ErrorHandling.h"
#include <optional>
usingnamespaceclang;
usingnamespaceserialization;

//===----------------------------------------------------------------------===//
// Declaration serialization
//===----------------------------------------------------------------------===//

namespace clang {
  class ASTDeclWriter : public DeclVisitor<ASTDeclWriter, void> {};
}

bool clang::CanElideDeclDef(const Decl *D) {}

void ASTDeclWriter::Visit(Decl *D) {}

void ASTDeclWriter::VisitDecl(Decl *D) {}

void ASTDeclWriter::VisitPragmaCommentDecl(PragmaCommentDecl *D) {}

void ASTDeclWriter::VisitPragmaDetectMismatchDecl(
    PragmaDetectMismatchDecl *D) {}

void ASTDeclWriter::VisitTranslationUnitDecl(TranslationUnitDecl *D) {}

void ASTDeclWriter::VisitNamedDecl(NamedDecl *D) {}

void ASTDeclWriter::VisitTypeDecl(TypeDecl *D) {}

void ASTDeclWriter::VisitTypedefNameDecl(TypedefNameDecl *D) {}

void ASTDeclWriter::VisitTypedefDecl(TypedefDecl *D) {}

void ASTDeclWriter::VisitTypeAliasDecl(TypeAliasDecl *D) {}

void ASTDeclWriter::VisitTagDecl(TagDecl *D) {}

void ASTDeclWriter::VisitEnumDecl(EnumDecl *D) {}

void ASTDeclWriter::VisitRecordDecl(RecordDecl *D) {}

void ASTDeclWriter::VisitValueDecl(ValueDecl *D) {}

void ASTDeclWriter::VisitEnumConstantDecl(EnumConstantDecl *D) {}

void ASTDeclWriter::VisitDeclaratorDecl(DeclaratorDecl *D) {}

void ASTDeclWriter::VisitFunctionDecl(FunctionDecl *D) {}

static void addExplicitSpecifier(ExplicitSpecifier ES,
                                 ASTRecordWriter &Record) {}

void ASTDeclWriter::VisitCXXDeductionGuideDecl(CXXDeductionGuideDecl *D) {}

void ASTDeclWriter::VisitObjCMethodDecl(ObjCMethodDecl *D) {}

void ASTDeclWriter::VisitObjCTypeParamDecl(ObjCTypeParamDecl *D) {}

void ASTDeclWriter::VisitObjCContainerDecl(ObjCContainerDecl *D) {}

void ASTDeclWriter::VisitObjCInterfaceDecl(ObjCInterfaceDecl *D) {}

void ASTDeclWriter::VisitObjCIvarDecl(ObjCIvarDecl *D) {}

void ASTDeclWriter::VisitObjCProtocolDecl(ObjCProtocolDecl *D) {}

void ASTDeclWriter::VisitObjCAtDefsFieldDecl(ObjCAtDefsFieldDecl *D) {}

void ASTDeclWriter::VisitObjCCategoryDecl(ObjCCategoryDecl *D) {}

void ASTDeclWriter::VisitObjCCompatibleAliasDecl(ObjCCompatibleAliasDecl *D) {}

void ASTDeclWriter::VisitObjCPropertyDecl(ObjCPropertyDecl *D) {}

void ASTDeclWriter::VisitObjCImplDecl(ObjCImplDecl *D) {}

void ASTDeclWriter::VisitObjCCategoryImplDecl(ObjCCategoryImplDecl *D) {}

void ASTDeclWriter::VisitObjCImplementationDecl(ObjCImplementationDecl *D) {}

void ASTDeclWriter::VisitObjCPropertyImplDecl(ObjCPropertyImplDecl *D) {}

void ASTDeclWriter::VisitFieldDecl(FieldDecl *D) {}

void ASTDeclWriter::VisitMSPropertyDecl(MSPropertyDecl *D) {}

void ASTDeclWriter::VisitMSGuidDecl(MSGuidDecl *D) {}

void ASTDeclWriter::VisitUnnamedGlobalConstantDecl(
    UnnamedGlobalConstantDecl *D) {}

void ASTDeclWriter::VisitTemplateParamObjectDecl(TemplateParamObjectDecl *D) {}

void ASTDeclWriter::VisitIndirectFieldDecl(IndirectFieldDecl *D) {}

void ASTDeclWriter::VisitVarDecl(VarDecl *D) {}

void ASTDeclWriter::VisitImplicitParamDecl(ImplicitParamDecl *D) {}

void ASTDeclWriter::VisitParmVarDecl(ParmVarDecl *D) {}

void ASTDeclWriter::VisitDecompositionDecl(DecompositionDecl *D) {}

void ASTDeclWriter::VisitBindingDecl(BindingDecl *D) {}

void ASTDeclWriter::VisitFileScopeAsmDecl(FileScopeAsmDecl *D) {}

void ASTDeclWriter::VisitTopLevelStmtDecl(TopLevelStmtDecl *D) {}

void ASTDeclWriter::VisitEmptyDecl(EmptyDecl *D) {}

void ASTDeclWriter::VisitLifetimeExtendedTemporaryDecl(
    LifetimeExtendedTemporaryDecl *D) {}
void ASTDeclWriter::VisitBlockDecl(BlockDecl *D) {}

void ASTDeclWriter::VisitCapturedDecl(CapturedDecl *CD) {}

void ASTDeclWriter::VisitLinkageSpecDecl(LinkageSpecDecl *D) {}

void ASTDeclWriter::VisitExportDecl(ExportDecl *D) {}

void ASTDeclWriter::VisitLabelDecl(LabelDecl *D) {}


void ASTDeclWriter::VisitNamespaceDecl(NamespaceDecl *D) {}

void ASTDeclWriter::VisitNamespaceAliasDecl(NamespaceAliasDecl *D) {}

void ASTDeclWriter::VisitUsingDecl(UsingDecl *D) {}

void ASTDeclWriter::VisitUsingEnumDecl(UsingEnumDecl *D) {}

void ASTDeclWriter::VisitUsingPackDecl(UsingPackDecl *D) {}

void ASTDeclWriter::VisitUsingShadowDecl(UsingShadowDecl *D) {}

void ASTDeclWriter::VisitConstructorUsingShadowDecl(
    ConstructorUsingShadowDecl *D) {}

void ASTDeclWriter::VisitUsingDirectiveDecl(UsingDirectiveDecl *D) {}

void ASTDeclWriter::VisitUnresolvedUsingValueDecl(UnresolvedUsingValueDecl *D) {}

void ASTDeclWriter::VisitUnresolvedUsingTypenameDecl(
                                               UnresolvedUsingTypenameDecl *D) {}

void ASTDeclWriter::VisitUnresolvedUsingIfExistsDecl(
    UnresolvedUsingIfExistsDecl *D) {}

void ASTDeclWriter::VisitCXXRecordDecl(CXXRecordDecl *D) {}

void ASTDeclWriter::VisitCXXMethodDecl(CXXMethodDecl *D) {}

void ASTDeclWriter::VisitCXXConstructorDecl(CXXConstructorDecl *D) {}

void ASTDeclWriter::VisitCXXDestructorDecl(CXXDestructorDecl *D) {}

void ASTDeclWriter::VisitCXXConversionDecl(CXXConversionDecl *D) {}

void ASTDeclWriter::VisitImportDecl(ImportDecl *D) {}

void ASTDeclWriter::VisitAccessSpecDecl(AccessSpecDecl *D) {}

void ASTDeclWriter::VisitFriendDecl(FriendDecl *D) {}

void ASTDeclWriter::VisitFriendTemplateDecl(FriendTemplateDecl *D) {}

void ASTDeclWriter::VisitTemplateDecl(TemplateDecl *D) {}

void ASTDeclWriter::VisitConceptDecl(ConceptDecl *D) {}

void ASTDeclWriter::VisitImplicitConceptSpecializationDecl(
    ImplicitConceptSpecializationDecl *D) {}

void ASTDeclWriter::VisitRequiresExprBodyDecl(RequiresExprBodyDecl *D) {}

void ASTDeclWriter::VisitRedeclarableTemplateDecl(RedeclarableTemplateDecl *D) {}

void ASTDeclWriter::VisitClassTemplateDecl(ClassTemplateDecl *D) {}

void ASTDeclWriter::VisitClassTemplateSpecializationDecl(
                                           ClassTemplateSpecializationDecl *D) {}

void ASTDeclWriter::VisitClassTemplatePartialSpecializationDecl(
                                    ClassTemplatePartialSpecializationDecl *D) {}

void ASTDeclWriter::VisitVarTemplateDecl(VarTemplateDecl *D) {}

void ASTDeclWriter::VisitVarTemplateSpecializationDecl(
    VarTemplateSpecializationDecl *D) {}

void ASTDeclWriter::VisitVarTemplatePartialSpecializationDecl(
    VarTemplatePartialSpecializationDecl *D) {}

void ASTDeclWriter::VisitFunctionTemplateDecl(FunctionTemplateDecl *D) {}

void ASTDeclWriter::VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D) {}

void ASTDeclWriter::VisitNonTypeTemplateParmDecl(NonTypeTemplateParmDecl *D) {}

void ASTDeclWriter::VisitTemplateTemplateParmDecl(TemplateTemplateParmDecl *D) {}

void ASTDeclWriter::VisitTypeAliasTemplateDecl(TypeAliasTemplateDecl *D) {}

void ASTDeclWriter::VisitStaticAssertDecl(StaticAssertDecl *D) {}

/// Emit the DeclContext part of a declaration context decl.
void ASTDeclWriter::VisitDeclContext(DeclContext *DC) {}

const Decl *ASTWriter::getFirstLocalDecl(const Decl *D) {}

template <typename T>
void ASTDeclWriter::VisitRedeclarable(Redeclarable<T> *D) {}

void ASTDeclWriter::VisitHLSLBufferDecl(HLSLBufferDecl *D) {}

void ASTDeclWriter::VisitOMPThreadPrivateDecl(OMPThreadPrivateDecl *D) {}

void ASTDeclWriter::VisitOMPAllocateDecl(OMPAllocateDecl *D) {}

void ASTDeclWriter::VisitOMPRequiresDecl(OMPRequiresDecl *D) {}

void ASTDeclWriter::VisitOMPDeclareReductionDecl(OMPDeclareReductionDecl *D) {}

void ASTDeclWriter::VisitOMPDeclareMapperDecl(OMPDeclareMapperDecl *D) {}

void ASTDeclWriter::VisitOMPCapturedExprDecl(OMPCapturedExprDecl *D) {}

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

namespace {
template <FunctionDecl::TemplatedKind Kind>
std::shared_ptr<llvm::BitCodeAbbrev>
getFunctionDeclAbbrev(serialization::DeclCode Code) {}

template <FunctionDecl::TemplatedKind Kind>
std::shared_ptr<llvm::BitCodeAbbrev> getCXXMethodAbbrev() {}
} // namespace

void ASTWriter::WriteDeclAbbrevs() {}

/// isRequiredDecl - Check if this is a "required" Decl, which must be seen by
/// consumers of the AST.
///
/// Such decls will always be deserialized from the AST file, so we would like
/// this to be as restrictive as possible. Currently the predicate is driven by
/// code generation requirements, if other clients have a different notion of
/// what is "required" then we may have to consider an alternate scheme where
/// clients can iterate over the top-level decls and get information on them,
/// without necessary deserializing them. We could explicitly require such
/// clients to use a separate API call to "realize" the decl. This should be
/// relatively painless since they would presumably only do it for top-level
/// decls.
static bool isRequiredDecl(const Decl *D, ASTContext &Context,
                           Module *WritingModule) {}

void ASTWriter::WriteDecl(ASTContext &Context, Decl *D) {}

void ASTRecordWriter::AddFunctionDefinition(const FunctionDecl *FD) {}