diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-08-13 17:57:10 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-08-13 17:57:10 +0000 |
commit | 216a3bd70de7f92397371f8d9c8f42683b8ecb19 (patch) | |
tree | 8c5e9d33b56b36a8209d5e71e95a06648ad13595 /clang/lib/Frontend/DependencyFile.cpp | |
parent | 6cf4a6ba9b3fb7d0b2eab26c35146b5ab3c3c8be (diff) | |
download | bcm5719-llvm-216a3bd70de7f92397371f8d9c8f42683b8ecb19.tar.gz bcm5719-llvm-216a3bd70de7f92397371f8d9c8f42683b8ecb19.zip |
[modules] Change the way we deal with .d output for explicitly-specified module
files: include the .pcm file itself in the .d output, rather than including its
own input files. Other forms of module file continue to be transparent for .d
output.
Arguably, the input files for the .pcm file are still inputs to the
compilation, but that's unnecessary for make-like build systems (where the
mtime of the .pcm file is sufficient) and harmful for smarter build systems
that know about module files and want to track only the local dependencies.
llvm-svn: 244923
Diffstat (limited to 'clang/lib/Frontend/DependencyFile.cpp')
-rw-r--r-- | clang/lib/Frontend/DependencyFile.cpp | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/clang/lib/Frontend/DependencyFile.cpp b/clang/lib/Frontend/DependencyFile.cpp index 67a24c42629..ba61bbabfdb 100644 --- a/clang/lib/Frontend/DependencyFile.cpp +++ b/clang/lib/Frontend/DependencyFile.cpp @@ -104,14 +104,15 @@ struct DepCollectorASTListener : public ASTReaderListener { bool needsSystemInputFileVisitation() override { return DepCollector.needSystemDependencies(); } - void visitModuleFile(StringRef Filename) override { + void visitModuleFile(StringRef Filename, + serialization::ModuleKind Kind) override { DepCollector.maybeAddDependency(Filename, /*FromModule*/true, /*IsSystem*/false, /*IsModuleFile*/true, /*IsMissing*/false); } bool visitInputFile(StringRef Filename, bool IsSystem, - bool IsOverridden) override { - if (IsOverridden) + bool IsOverridden, bool IsExplicitModule) override { + if (IsOverridden || IsExplicitModule) return true; DepCollector.maybeAddDependency(Filename, /*FromModule*/true, IsSystem, @@ -226,9 +227,10 @@ public: bool needsSystemInputFileVisitation() override { return Parent.includeSystemHeaders(); } - void visitModuleFile(StringRef Filename) override; + void visitModuleFile(StringRef Filename, + serialization::ModuleKind Kind) override; bool visitInputFile(StringRef Filename, bool isSystem, - bool isOverridden) override; + bool isOverridden, bool isExplicitModule) override; }; } @@ -472,16 +474,18 @@ void DFGImpl::OutputDependencyFile() { } bool DFGASTReaderListener::visitInputFile(llvm::StringRef Filename, - bool IsSystem, bool IsOverridden) { + bool IsSystem, bool IsOverridden, + bool IsExplicitModule) { assert(!IsSystem || needsSystemInputFileVisitation()); - if (IsOverridden) + if (IsOverridden || IsExplicitModule) return true; Parent.AddFilename(Filename); return true; } -void DFGASTReaderListener::visitModuleFile(llvm::StringRef Filename) { - if (Parent.includeModuleFiles()) +void DFGASTReaderListener::visitModuleFile(llvm::StringRef Filename, + serialization::ModuleKind Kind) { + if (Parent.includeModuleFiles() || Kind == MK_ExplicitModule) Parent.AddFilename(Filename); } |