Author: dblaikie Date: Thu Jan 5 12:45:43 2017 New Revision: 291154 URL: http://llvm.org/viewvc/llvm-project?rev=291154&view=rev Log: Simplify ASTReader ctor by using in-class initializers (NSDMIs to the rest of you) for many member variables
Modified: cfe/trunk/include/clang/Serialization/ASTReader.h cfe/trunk/lib/Serialization/ASTReader.cpp Modified: cfe/trunk/include/clang/Serialization/ASTReader.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTReader.h?rev=291154&r1=291153&r2=291154&view=diff ============================================================================== --- cfe/trunk/include/clang/Serialization/ASTReader.h (original) +++ cfe/trunk/include/clang/Serialization/ASTReader.h Thu Jan 5 12:45:43 2017 @@ -384,8 +384,8 @@ private: std::unique_ptr<ASTReaderListener> Listener; /// \brief The receiver of deserialization events. - ASTDeserializationListener *DeserializationListener; - bool OwnsDeserializationListener; + ASTDeserializationListener *DeserializationListener = nullptr; + bool OwnsDeserializationListener = false; SourceManager &SourceMgr; FileManager &FileMgr; @@ -394,7 +394,7 @@ private: /// \brief The semantic analysis object that will be processing the /// AST files and the translation unit that uses it. - Sema *SemaObj; + Sema *SemaObj = nullptr; /// \brief The preprocessor that will be loading the source file. Preprocessor &PP; @@ -403,7 +403,7 @@ private: ASTContext &Context; /// \brief The AST consumer. - ASTConsumer *Consumer; + ASTConsumer *Consumer = nullptr; /// \brief The module manager which manages modules and their dependencies ModuleManager ModuleMgr; @@ -802,10 +802,10 @@ private: SourceLocation OptimizeOffPragmaLocation; /// \brief The PragmaMSStructKind pragma ms_struct state if set, or -1. - int PragmaMSStructState; + int PragmaMSStructState = -1; /// \brief The PragmaMSPointersToMembersKind pragma pointers_to_members state. - int PragmaMSPointersToMembersState; + int PragmaMSPointersToMembersState = -1; SourceLocation PointersToMembersPragmaLocation; /// \brief The OpenCL extension settings. @@ -870,10 +870,10 @@ private: bool UseGlobalIndex; /// \brief Whether we have tried loading the global module index yet. - bool TriedLoadingGlobalIndex; + bool TriedLoadingGlobalIndex = false; ///\brief Whether we are currently processing update records. - bool ProcessingUpdateRecords; + bool ProcessingUpdateRecords = false; typedef llvm::DenseMap<unsigned, SwitchCase *> SwitchCaseMapTy; /// \brief Mapping from switch-case IDs in the chain to switch-case statements @@ -886,73 +886,73 @@ private: /// \brief The number of source location entries de-serialized from /// the PCH file. - unsigned NumSLocEntriesRead; + unsigned NumSLocEntriesRead = 0; /// \brief The number of source location entries in the chain. - unsigned TotalNumSLocEntries; + unsigned TotalNumSLocEntries = 0; /// \brief The number of statements (and expressions) de-serialized /// from the chain. - unsigned NumStatementsRead; + unsigned NumStatementsRead = 0; /// \brief The total number of statements (and expressions) stored /// in the chain. - unsigned TotalNumStatements; + unsigned TotalNumStatements = 0; /// \brief The number of macros de-serialized from the chain. - unsigned NumMacrosRead; + unsigned NumMacrosRead = 0; /// \brief The total number of macros stored in the chain. - unsigned TotalNumMacros; + unsigned TotalNumMacros = 0; /// \brief The number of lookups into identifier tables. - unsigned NumIdentifierLookups; + unsigned NumIdentifierLookups = 0; /// \brief The number of lookups into identifier tables that succeed. - unsigned NumIdentifierLookupHits; + unsigned NumIdentifierLookupHits = 0; /// \brief The number of selectors that have been read. - unsigned NumSelectorsRead; + unsigned NumSelectorsRead = 0; /// \brief The number of method pool entries that have been read. - unsigned NumMethodPoolEntriesRead; + unsigned NumMethodPoolEntriesRead = 0; /// \brief The number of times we have looked up a selector in the method /// pool. - unsigned NumMethodPoolLookups; + unsigned NumMethodPoolLookups = 0; /// \brief The number of times we have looked up a selector in the method /// pool and found something. - unsigned NumMethodPoolHits; + unsigned NumMethodPoolHits = 0; /// \brief The number of times we have looked up a selector in the method /// pool within a specific module. - unsigned NumMethodPoolTableLookups; + unsigned NumMethodPoolTableLookups = 0; /// \brief The number of times we have looked up a selector in the method /// pool within a specific module and found something. - unsigned NumMethodPoolTableHits; + unsigned NumMethodPoolTableHits = 0; /// \brief The total number of method pool entries in the selector table. - unsigned TotalNumMethodPoolEntries; + unsigned TotalNumMethodPoolEntries = 0; /// Number of lexical decl contexts read/total. - unsigned NumLexicalDeclContextsRead, TotalLexicalDeclContexts; + unsigned NumLexicalDeclContextsRead = 0, TotalLexicalDeclContexts = 0; /// Number of visible decl contexts read/total. - unsigned NumVisibleDeclContextsRead, TotalVisibleDeclContexts; + unsigned NumVisibleDeclContextsRead = 0, TotalVisibleDeclContexts = 0; /// Total size of modules, in bits, currently loaded - uint64_t TotalModulesSizeInBits; + uint64_t TotalModulesSizeInBits = 0; /// \brief Number of Decl/types that are currently deserializing. - unsigned NumCurrentElementsDeserializing; + unsigned NumCurrentElementsDeserializing = 0; /// \brief Set true while we are in the process of passing deserialized /// "interesting" decls to consumer inside FinishedDeserializing(). /// This is used as a guard to avoid recursively repeating the process of /// passing decls to consumer. - bool PassingDeclsToConsumer; + bool PassingDeclsToConsumer = false; /// \brief The set of identifiers that were read while the AST reader was /// (recursively) loading declarations. @@ -1055,7 +1055,7 @@ private: }; /// \brief What kind of records we are reading. - ReadingKind ReadingKind; + ReadingKind ReadingKind = Read_None; /// \brief RAII object to change the reading kind. class ReadingKindTracker { Modified: cfe/trunk/lib/Serialization/ASTReader.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=291154&r1=291153&r2=291154&view=diff ============================================================================== --- cfe/trunk/lib/Serialization/ASTReader.cpp (original) +++ cfe/trunk/lib/Serialization/ASTReader.cpp Thu Jan 5 12:45:43 2017 @@ -8901,29 +8901,15 @@ ASTReader::ASTReader(Preprocessor &PP, A : Listener(DisableValidation ? cast<ASTReaderListener>(new SimpleASTReaderListener(PP)) : cast<ASTReaderListener>(new PCHValidator(PP, *this))), - DeserializationListener(nullptr), OwnsDeserializationListener(false), SourceMgr(PP.getSourceManager()), FileMgr(PP.getFileManager()), - PCHContainerRdr(PCHContainerRdr), Diags(PP.getDiagnostics()), - SemaObj(nullptr), PP(PP), Context(Context), Consumer(nullptr), - ModuleMgr(PP.getFileManager(), PCHContainerRdr), DummyIdResolver(PP), - ReadTimer(std::move(ReadTimer)), PragmaMSStructState(-1), - PragmaMSPointersToMembersState(-1), isysroot(isysroot), + PCHContainerRdr(PCHContainerRdr), Diags(PP.getDiagnostics()), PP(PP), + Context(Context), ModuleMgr(PP.getFileManager(), PCHContainerRdr), + DummyIdResolver(PP), ReadTimer(std::move(ReadTimer)), isysroot(isysroot), DisableValidation(DisableValidation), AllowASTWithCompilerErrors(AllowASTWithCompilerErrors), AllowConfigurationMismatch(AllowConfigurationMismatch), ValidateSystemInputs(ValidateSystemInputs), - UseGlobalIndex(UseGlobalIndex), TriedLoadingGlobalIndex(false), - ProcessingUpdateRecords(false), CurrSwitchCaseStmts(&SwitchCaseStmts), - NumSLocEntriesRead(0), TotalNumSLocEntries(0), NumStatementsRead(0), - TotalNumStatements(0), NumMacrosRead(0), TotalNumMacros(0), - NumIdentifierLookups(0), NumIdentifierLookupHits(0), NumSelectorsRead(0), - NumMethodPoolEntriesRead(0), NumMethodPoolLookups(0), - NumMethodPoolHits(0), NumMethodPoolTableLookups(0), - NumMethodPoolTableHits(0), TotalNumMethodPoolEntries(0), - NumLexicalDeclContextsRead(0), TotalLexicalDeclContexts(0), - NumVisibleDeclContextsRead(0), TotalVisibleDeclContexts(0), - TotalModulesSizeInBits(0), NumCurrentElementsDeserializing(0), - PassingDeclsToConsumer(false), ReadingKind(Read_None) { + UseGlobalIndex(UseGlobalIndex), CurrSwitchCaseStmts(&SwitchCaseStmts) { SourceMgr.setExternalSLocEntrySource(this); for (const auto &Ext : Extensions) { _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits