diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2014-03-14 03:07:38 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2014-03-14 03:07:38 +0000 |
commit | 6d0753d42a8344a23cc8b170ac29184cac47e8ce (patch) | |
tree | 92be428f1d5353a65c290af8d61f710f614380ca /clang/lib/Frontend/DependencyFile.cpp | |
parent | f88731f293c7c6e9268e7d298a806bf29ea8aa2d (diff) | |
download | llvm-6d0753d42a8344a23cc8b170ac29184cac47e8ce.zip llvm-6d0753d42a8344a23cc8b170ac29184cac47e8ce.tar.gz llvm-6d0753d42a8344a23cc8b170ac29184cac47e8ce.tar.bz2 |
[Modules] Emit the module file paths as dependencies of the PCH when we are building one.
This is because the PCH is tied to the module files, if one of the module files changes or gets removed
the build system should re-build the PCH file.
rdar://16321245
llvm-svn: 203885
Diffstat (limited to 'clang/lib/Frontend/DependencyFile.cpp')
-rw-r--r-- | clang/lib/Frontend/DependencyFile.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/clang/lib/Frontend/DependencyFile.cpp b/clang/lib/Frontend/DependencyFile.cpp index 8457770..b472eaa 100644 --- a/clang/lib/Frontend/DependencyFile.cpp +++ b/clang/lib/Frontend/DependencyFile.cpp @@ -40,6 +40,7 @@ class DFGImpl : public PPCallbacks { bool PhonyTarget; bool AddMissingHeaderDeps; bool SeenMissingHeader; + bool IncludeModuleFiles; private: bool FileMatchesDepCriteria(const char *Filename, SrcMgr::CharacteristicKind FileType); @@ -51,7 +52,8 @@ public: IncludeSystemHeaders(Opts.IncludeSystemHeaders), PhonyTarget(Opts.UsePhonyTargets), AddMissingHeaderDeps(Opts.AddMissingHeaderDeps), - SeenMissingHeader(false) {} + SeenMissingHeader(false), + IncludeModuleFiles(Opts.IncludeModuleFiles) {} void FileChanged(SourceLocation Loc, FileChangeReason Reason, SrcMgr::CharacteristicKind FileType, @@ -68,6 +70,7 @@ public: void AddFilename(StringRef Filename); bool includeSystemHeaders() const { return IncludeSystemHeaders; } + bool includeModuleFiles() const { return IncludeModuleFiles; } }; class DFGASTReaderListener : public ASTReaderListener { @@ -79,6 +82,7 @@ public: bool needsSystemInputFileVisitation() override { return Parent.includeSystemHeaders(); } + void visitModuleFile(StringRef Filename) override; bool visitInputFile(StringRef Filename, bool isSystem, bool isOverridden) override; }; @@ -268,3 +272,7 @@ bool DFGASTReaderListener::visitInputFile(llvm::StringRef Filename, return true; } +void DFGASTReaderListener::visitModuleFile(llvm::StringRef Filename) { + if (Parent.includeModuleFiles()) + Parent.AddFilename(Filename); +} |