Always construct an ASTReader with a non-NULL ASTContext and
Preprocessor, eliminating the constructor that was used by ASTUnit
(which didn't provide an ASTContext or Prepreprocessor). Ensuring that
both objects are non-NULL will simplify module loading (but none of
that is done yet).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138986 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Serialization/ASTReader.cpp b/lib/Serialization/ASTReader.cpp
index 10b01d8..37a23fa 100644
--- a/lib/Serialization/ASTReader.cpp
+++ b/lib/Serialization/ASTReader.cpp
@@ -5515,12 +5515,12 @@
--NumCurrentElementsDeserializing;
}
-ASTReader::ASTReader(Preprocessor &PP, ASTContext *Context,
+ASTReader::ASTReader(Preprocessor &PP, ASTContext &Context,
StringRef isysroot, bool DisableValidation,
bool DisableStatCache)
: Listener(new PCHValidator(PP, *this)), DeserializationListener(0),
SourceMgr(PP.getSourceManager()), FileMgr(PP.getFileManager()),
- Diags(PP.getDiagnostics()), SemaObj(0), PP(&PP), Context(Context),
+ Diags(PP.getDiagnostics()), SemaObj(0), PP(&PP), Context(&Context),
Consumer(0), ModuleMgr(FileMgr.getFileSystemOptions()),
RelocatablePCH(false), isysroot(isysroot),
DisableValidation(DisableValidation),
@@ -5537,26 +5537,6 @@
SourceMgr.setExternalSLocEntrySource(this);
}
-ASTReader::ASTReader(SourceManager &SourceMgr, FileManager &FileMgr,
- Diagnostic &Diags, StringRef isysroot,
- bool DisableValidation, bool DisableStatCache)
- : DeserializationListener(0), SourceMgr(SourceMgr), FileMgr(FileMgr),
- Diags(Diags), SemaObj(0), PP(0), Context(0),
- Consumer(0), ModuleMgr(FileMgr.getFileSystemOptions()),
- RelocatablePCH(false), isysroot(isysroot),
- DisableValidation(DisableValidation), DisableStatCache(DisableStatCache),
- NumStatHits(0), NumStatMisses(0), NumSLocEntriesRead(0),
- TotalNumSLocEntries(0), NumStatementsRead(0),
- TotalNumStatements(0), NumMacrosRead(0), TotalNumMacros(0),
- NumSelectorsRead(0), NumMethodPoolEntriesRead(0), NumMethodPoolMisses(0),
- TotalNumMethodPoolEntries(0), NumLexicalDeclContextsRead(0),
- TotalLexicalDeclContexts(0), NumVisibleDeclContextsRead(0),
- TotalVisibleDeclContexts(0), TotalModulesSizeInBits(0),
- NumCurrentElementsDeserializing(0), NumCXXBaseSpecifiersLoaded(0)
-{
- SourceMgr.setExternalSLocEntrySource(this);
-}
-
ASTReader::~ASTReader() {
for (DeclContextVisibleUpdatesPending::iterator
I = PendingVisibleUpdates.begin(),
diff --git a/lib/Serialization/ChainedIncludesSource.cpp b/lib/Serialization/ChainedIncludesSource.cpp
index e354054..04c3f81 100644
--- a/lib/Serialization/ChainedIncludesSource.cpp
+++ b/lib/Serialization/ChainedIncludesSource.cpp
@@ -32,7 +32,7 @@
ASTDeserializationListener *deserialListener = 0) {
Preprocessor &PP = CI.getPreprocessor();
llvm::OwningPtr<ASTReader> Reader;
- Reader.reset(new ASTReader(PP, &CI.getASTContext(), /*isysroot=*/"",
+ Reader.reset(new ASTReader(PP, CI.getASTContext(), /*isysroot=*/"",
/*DisableValidation=*/true));
for (unsigned ti = 0; ti < bufNames.size(); ++ti) {
StringRef sr(bufNames[ti]);