summaryrefslogtreecommitdiff
path: root/include/clang/Serialization/ASTWriter.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/clang/Serialization/ASTWriter.h')
-rw-r--r--include/clang/Serialization/ASTWriter.h99
1 files changed, 49 insertions, 50 deletions
diff --git a/include/clang/Serialization/ASTWriter.h b/include/clang/Serialization/ASTWriter.h
index 1469555ec21e6..0d6b0268109dc 100644
--- a/include/clang/Serialization/ASTWriter.h
+++ b/include/clang/Serialization/ASTWriter.h
@@ -107,16 +107,16 @@ private:
llvm::BitstreamWriter &Stream;
/// \brief The ASTContext we're writing.
- ASTContext *Context;
+ ASTContext *Context = nullptr;
/// \brief The preprocessor we're writing.
- Preprocessor *PP;
+ Preprocessor *PP = nullptr;
/// \brief The reader of existing AST files, if we're chaining.
- ASTReader *Chain;
+ ASTReader *Chain = nullptr;
/// \brief The module we're currently writing, if any.
- Module *WritingModule;
+ Module *WritingModule = nullptr;
/// \brief The base directory for any relative paths we emit.
std::string BaseDirectory;
@@ -129,14 +129,14 @@ private:
/// \brief Indicates when the AST writing is actively performing
/// serialization, rather than just queueing updates.
- bool WritingAST;
+ bool WritingAST = false;
/// \brief Indicates that we are done serializing the collection of decls
/// and types to emit.
- bool DoneWritingDeclsAndTypes;
+ bool DoneWritingDeclsAndTypes = false;
/// \brief Indicates that the AST contained compiler errors.
- bool ASTHasCompilerErrors;
+ bool ASTHasCompilerErrors = false;
/// \brief Mapping from input file entries to the index into the
/// offset table where information about that input file is stored.
@@ -170,10 +170,10 @@ private:
std::queue<DeclOrType> DeclTypesToEmit;
/// \brief The first ID number we can use for our own declarations.
- serialization::DeclID FirstDeclID;
+ serialization::DeclID FirstDeclID = serialization::NUM_PREDEF_DECL_IDS;
/// \brief The decl ID that will be assigned to the next new decl.
- serialization::DeclID NextDeclID;
+ serialization::DeclID NextDeclID = FirstDeclID;
/// \brief Map that provides the ID numbers of each declaration within
/// the output stream, as well as those deserialized from a chained PCH.
@@ -205,10 +205,10 @@ private:
void associateDeclWithFile(const Decl *D, serialization::DeclID);
/// \brief The first ID number we can use for our own types.
- serialization::TypeID FirstTypeID;
+ serialization::TypeID FirstTypeID = serialization::NUM_PREDEF_TYPE_IDS;
/// \brief The type ID that will be assigned to the next new type.
- serialization::TypeID NextTypeID;
+ serialization::TypeID NextTypeID = FirstTypeID;
/// \brief Map that provides the ID numbers of each type within the
/// output stream, plus those deserialized from a chained PCH.
@@ -226,10 +226,10 @@ private:
std::vector<uint32_t> TypeOffsets;
/// \brief The first ID number we can use for our own identifiers.
- serialization::IdentID FirstIdentID;
+ serialization::IdentID FirstIdentID = serialization::NUM_PREDEF_IDENT_IDS;
/// \brief The identifier ID that will be assigned to the next new identifier.
- serialization::IdentID NextIdentID;
+ serialization::IdentID NextIdentID = FirstIdentID;
/// \brief Map that provides the ID numbers of each identifier in
/// the output stream.
@@ -240,10 +240,10 @@ private:
llvm::MapVector<const IdentifierInfo *, serialization::IdentID> IdentifierIDs;
/// \brief The first ID number we can use for our own macros.
- serialization::MacroID FirstMacroID;
+ serialization::MacroID FirstMacroID = serialization::NUM_PREDEF_MACRO_IDS;
/// \brief The identifier ID that will be assigned to the next new identifier.
- serialization::MacroID NextMacroID;
+ serialization::MacroID NextMacroID = FirstMacroID;
/// \brief Map that provides the ID numbers of each macro.
llvm::DenseMap<MacroInfo *, serialization::MacroID> MacroIDs;
@@ -275,16 +275,18 @@ private:
std::vector<uint32_t> IdentifierOffsets;
/// \brief The first ID number we can use for our own submodules.
- serialization::SubmoduleID FirstSubmoduleID;
-
+ serialization::SubmoduleID FirstSubmoduleID =
+ serialization::NUM_PREDEF_SUBMODULE_IDS;
+
/// \brief The submodule ID that will be assigned to the next new submodule.
- serialization::SubmoduleID NextSubmoduleID;
+ serialization::SubmoduleID NextSubmoduleID = FirstSubmoduleID;
/// \brief The first ID number we can use for our own selectors.
- serialization::SelectorID FirstSelectorID;
+ serialization::SelectorID FirstSelectorID =
+ serialization::NUM_PREDEF_SELECTOR_IDS;
/// \brief The selector ID that will be assigned to the next new selector.
- serialization::SelectorID NextSelectorID;
+ serialization::SelectorID NextSelectorID = FirstSelectorID;
/// \brief Map that provides the ID numbers of each Selector.
llvm::MapVector<Selector, serialization::SelectorID> SelectorIDs;
@@ -394,18 +396,18 @@ private:
llvm::DenseMap<SwitchCase *, unsigned> SwitchCaseIDs;
/// \brief The number of statements written to the AST file.
- unsigned NumStatements;
+ unsigned NumStatements = 0;
/// \brief The number of macros written to the AST file.
- unsigned NumMacros;
+ unsigned NumMacros = 0;
/// \brief The number of lexical declcontexts written to the AST
/// file.
- unsigned NumLexicalDeclContexts;
+ unsigned NumLexicalDeclContexts = 0;
/// \brief The number of visible declcontexts written to the AST
/// file.
- unsigned NumVisibleDeclContexts;
+ unsigned NumVisibleDeclContexts = 0;
/// \brief A mapping from each known submodule to its ID number, which will
/// be a positive integer.
@@ -436,8 +438,8 @@ private:
void WritePragmaDiagnosticMappings(const DiagnosticsEngine &Diag,
bool isModule);
- unsigned TypeExtQualAbbrev;
- unsigned TypeFunctionProtoAbbrev;
+ unsigned TypeExtQualAbbrev = 0;
+ unsigned TypeFunctionProtoAbbrev = 0;
void WriteTypeAbbrevs();
void WriteType(QualType T);
@@ -470,22 +472,22 @@ private:
void WriteModuleFileExtension(Sema &SemaRef,
ModuleFileExtensionWriter &Writer);
- unsigned DeclParmVarAbbrev;
- unsigned DeclContextLexicalAbbrev;
- unsigned DeclContextVisibleLookupAbbrev;
- unsigned UpdateVisibleAbbrev;
- unsigned DeclRecordAbbrev;
- unsigned DeclTypedefAbbrev;
- unsigned DeclVarAbbrev;
- unsigned DeclFieldAbbrev;
- unsigned DeclEnumAbbrev;
- unsigned DeclObjCIvarAbbrev;
- unsigned DeclCXXMethodAbbrev;
-
- unsigned DeclRefExprAbbrev;
- unsigned CharacterLiteralAbbrev;
- unsigned IntegerLiteralAbbrev;
- unsigned ExprImplicitCastAbbrev;
+ unsigned DeclParmVarAbbrev = 0;
+ unsigned DeclContextLexicalAbbrev = 0;
+ unsigned DeclContextVisibleLookupAbbrev = 0;
+ unsigned UpdateVisibleAbbrev = 0;
+ unsigned DeclRecordAbbrev = 0;
+ unsigned DeclTypedefAbbrev = 0;
+ unsigned DeclVarAbbrev = 0;
+ unsigned DeclFieldAbbrev = 0;
+ unsigned DeclEnumAbbrev = 0;
+ unsigned DeclObjCIvarAbbrev = 0;
+ unsigned DeclCXXMethodAbbrev = 0;
+
+ unsigned DeclRefExprAbbrev = 0;
+ unsigned CharacterLiteralAbbrev = 0;
+ unsigned IntegerLiteralAbbrev = 0;
+ unsigned ExprImplicitCastAbbrev = 0;
void WriteDeclAbbrevs();
void WriteDecl(ASTContext &Context, Decl *D);
@@ -498,7 +500,7 @@ public:
/// \brief Create a new precompiled header writer that outputs to
/// the given bitstream.
ASTWriter(llvm::BitstreamWriter &Stream,
- ArrayRef<llvm::IntrusiveRefCntPtr<ModuleFileExtension>> Extensions,
+ ArrayRef<std::shared_ptr<ModuleFileExtension>> Extensions,
bool IncludeTimestamps = true);
~ASTWriter() override;
@@ -934,13 +936,10 @@ protected:
SmallVectorImpl<char> &getPCH() const { return Buffer->Data; }
public:
- PCHGenerator(
- const Preprocessor &PP, StringRef OutputFile,
- StringRef isysroot,
- std::shared_ptr<PCHBuffer> Buffer,
- ArrayRef<llvm::IntrusiveRefCntPtr<ModuleFileExtension>> Extensions,
- bool AllowASTWithErrors = false,
- bool IncludeTimestamps = true);
+ PCHGenerator(const Preprocessor &PP, StringRef OutputFile, StringRef isysroot,
+ std::shared_ptr<PCHBuffer> Buffer,
+ ArrayRef<std::shared_ptr<ModuleFileExtension>> Extensions,
+ bool AllowASTWithErrors = false, bool IncludeTimestamps = true);
~PCHGenerator() override;
void InitializeSema(Sema &S) override { SemaPtr = &S; }
void HandleTranslationUnit(ASTContext &Ctx) override;