clang 19.0.0git
Classes | Namespaces | Functions
ASTWriterDecl.cpp File Reference
#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>

Go to the source code of this file.


class  clang::ASTDeclWriter


namespace  clang
 The JSON file list parser is used to communicate input to InstallAPI.


static void addExplicitSpecifier (ExplicitSpecifier ES, ASTRecordWriter &Record)
static bool isRequiredDecl (const Decl *D, ASTContext &Context, Module *WritingModule)
 isRequiredDecl - Check if this is a "required" Decl, which must be seen by consumers of the AST.

Function Documentation

◆ addExplicitSpecifier()

static void addExplicitSpecifier ( ExplicitSpecifier  ES,
ASTRecordWriter Record 

◆ isRequiredDecl()

static bool isRequiredDecl ( const Decl D,
ASTContext Context,
Module WritingModule 

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.

Definition at line 2770 of file ASTWriterDecl.cpp.

References clang::ASTContext::DeclMustBeEmitted(), clang::Module::isNamedModule(), and clang::serialization::isPartOfPerModuleInitializer().