summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2017-01-05 18:45:43 +0000
committerDavid Blaikie <dblaikie@gmail.com>2017-01-05 18:45:43 +0000
commit9d7c1ba5cfcae83bbaee5cfdeff31256b2f566f3 (patch)
tree93c6fcf7c53da25f16879056a337f5dbef4cef01
parent430d34fc14bfd3ba7fe71d72e5d1e8aa74306947 (diff)
downloadbcm5719-llvm-9d7c1ba5cfcae83bbaee5cfdeff31256b2f566f3.tar.gz
bcm5719-llvm-9d7c1ba5cfcae83bbaee5cfdeff31256b2f566f3.zip
Simplify ASTReader ctor by using in-class initializers (NSDMIs to the rest of you) for many member variables
llvm-svn: 291154
-rw-r--r--clang/include/clang/Serialization/ASTReader.h58
-rw-r--r--clang/lib/Serialization/ASTReader.cpp22
2 files changed, 33 insertions, 47 deletions
diff --git a/clang/include/clang/Serialization/ASTReader.h b/clang/include/clang/Serialization/ASTReader.h
index 7c2c8948d09..93994e2c519 100644
--- a/clang/include/clang/Serialization/ASTReader.h
+++ b/clang/include/clang/Serialization/ASTReader.h
@@ -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 {
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp
index 09bf42d2ec4..7f890051e64 100644
--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/lib/Serialization/ASTReader.cpp
@@ -8901,29 +8901,15 @@ ASTReader::ASTReader(Preprocessor &PP, ASTContext &Context,
: 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) {
OpenPOWER on IntegriCloud