summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2014-03-14 03:07:38 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2014-03-14 03:07:38 +0000
commit6d0753d42a8344a23cc8b170ac29184cac47e8ce (patch)
tree92be428f1d5353a65c290af8d61f710f614380ca /clang/lib/Frontend
parentf88731f293c7c6e9268e7d298a806bf29ea8aa2d (diff)
downloadbcm5719-llvm-6d0753d42a8344a23cc8b170ac29184cac47e8ce.tar.gz
bcm5719-llvm-6d0753d42a8344a23cc8b170ac29184cac47e8ce.zip
[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')
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp1
-rw-r--r--clang/lib/Frontend/DependencyFile.cpp10
2 files changed, 10 insertions, 1 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index f368837a5f0..7cc0b1bee30 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -528,6 +528,7 @@ static void ParseDependencyOutputArgs(DependencyOutputOptions &Opts,
Opts.OutputFile = Args.getLastArgValue(OPT_dependency_file);
Opts.Targets = Args.getAllArgValues(OPT_MT);
Opts.IncludeSystemHeaders = Args.hasArg(OPT_sys_header_deps);
+ Opts.IncludeModuleFiles = Args.hasArg(OPT_module_file_deps);
Opts.UsePhonyTargets = Args.hasArg(OPT_MP);
Opts.ShowHeaderIncludes = Args.hasArg(OPT_H);
Opts.HeaderIncludeOutputFile = Args.getLastArgValue(OPT_header_include_file);
diff --git a/clang/lib/Frontend/DependencyFile.cpp b/clang/lib/Frontend/DependencyFile.cpp
index 8457770abb9..b472eaaae05 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);
+}
OpenPOWER on IntegriCloud