summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/CompilerInstance.cpp
diff options
context:
space:
mode:
authorAlex Lorenz <arphaman@gmail.com>2019-06-19 17:07:36 +0000
committerAlex Lorenz <arphaman@gmail.com>2019-06-19 17:07:36 +0000
commit8d9eb7acd548d592b9cf5775a00a6db2ee6933dd (patch)
tree207cc1d3a0686e16bb4bbb6518f48dc6df8860ba /clang/lib/Frontend/CompilerInstance.cpp
parenta7ed3a627b4bee2c94524e07d7934350193f114c (diff)
downloadbcm5719-llvm-8d9eb7acd548d592b9cf5775a00a6db2ee6933dd.tar.gz
bcm5719-llvm-8d9eb7acd548d592b9cf5775a00a6db2ee6933dd.zip
Unify DependencyFileGenerator class and DependencyCollector interface (NFCI)
Make DependencyFileGenerator a DependencyCollector as it was intended when DependencyCollector was introduced. The missing PPCallbacks overrides are added to the DependencyCollector as well. This change will allow clang-scan-deps to access the produced dependencies without writing them out to .d files to disk, so that it will be able collate them and report them to the user. Differential Revision: https://reviews.llvm.org/D63290 llvm-svn: 363840
Diffstat (limited to 'clang/lib/Frontend/CompilerInstance.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInstance.cpp14
1 files changed, 4 insertions, 10 deletions
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp
index fd33b85b31d..9cbc9ed1f79 100644
--- a/clang/lib/Frontend/CompilerInstance.cpp
+++ b/clang/lib/Frontend/CompilerInstance.cpp
@@ -415,8 +415,7 @@ void CompilerInstance::createPreprocessor(TranslationUnitKind TUKind) {
// Handle generating dependencies, if requested.
const DependencyOutputOptions &DepOpts = getDependencyOutputOpts();
if (!DepOpts.OutputFile.empty())
- TheDependencyFileGenerator.reset(
- DependencyFileGenerator::CreateAndAttachToPreprocessor(*PP, DepOpts));
+ addDependencyCollector(std::make_shared<DependencyFileGenerator>(DepOpts));
if (!DepOpts.DOTOutputFile.empty())
AttachDependencyGraphGen(*PP, DepOpts.DOTOutputFile,
getHeaderSearchOpts().Sysroot);
@@ -490,9 +489,9 @@ void CompilerInstance::createPCHExternalASTSource(
Path, getHeaderSearchOpts().Sysroot, DisablePCHValidation,
AllowPCHWithCompilerErrors, getPreprocessor(), getModuleCache(),
getASTContext(), getPCHContainerReader(),
- getFrontendOpts().ModuleFileExtensions, TheDependencyFileGenerator.get(),
- DependencyCollectors, DeserializationListener, OwnDeserializationListener,
- Preamble, getFrontendOpts().UseGlobalModuleIndex);
+ getFrontendOpts().ModuleFileExtensions, DependencyCollectors,
+ DeserializationListener, OwnDeserializationListener, Preamble,
+ getFrontendOpts().UseGlobalModuleIndex);
}
IntrusiveRefCntPtr<ASTReader> CompilerInstance::createPCHExternalASTSource(
@@ -501,7 +500,6 @@ IntrusiveRefCntPtr<ASTReader> CompilerInstance::createPCHExternalASTSource(
InMemoryModuleCache &ModuleCache, ASTContext &Context,
const PCHContainerReader &PCHContainerRdr,
ArrayRef<std::shared_ptr<ModuleFileExtension>> Extensions,
- DependencyFileGenerator *DependencyFile,
ArrayRef<std::shared_ptr<DependencyCollector>> DependencyCollectors,
void *DeserializationListener, bool OwnDeserializationListener,
bool Preamble, bool UseGlobalModuleIndex) {
@@ -521,8 +519,6 @@ IntrusiveRefCntPtr<ASTReader> CompilerInstance::createPCHExternalASTSource(
static_cast<ASTDeserializationListener *>(DeserializationListener),
/*TakeOwnership=*/OwnDeserializationListener);
- if (DependencyFile)
- DependencyFile->AttachToASTReader(*Reader);
for (auto &Listener : DependencyCollectors)
Listener->attachToASTReader(*Reader);
@@ -1492,8 +1488,6 @@ void CompilerInstance::createModuleManager() {
if (hasASTConsumer())
ModuleManager->StartTranslationUnit(&getASTConsumer());
- if (TheDependencyFileGenerator)
- TheDependencyFileGenerator->AttachToASTReader(*ModuleManager);
for (auto &Listener : DependencyCollectors)
Listener->attachToASTReader(*ModuleManager);
}
OpenPOWER on IntegriCloud