summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Frontend/DependencyFile.cpp4
-rw-r--r--clang/test/Preprocessor/dependencies-and-pp.c7
2 files changed, 9 insertions, 2 deletions
diff --git a/clang/lib/Frontend/DependencyFile.cpp b/clang/lib/Frontend/DependencyFile.cpp
index 059f116a3c3..bd14c53e4d1 100644
--- a/clang/lib/Frontend/DependencyFile.cpp
+++ b/clang/lib/Frontend/DependencyFile.cpp
@@ -447,9 +447,9 @@ void DFGImpl::OutputDependencyFile() {
// Create phony targets if requested.
if (PhonyTarget && !Files.empty()) {
// Skip the first entry, this is always the input file itself.
- for (StringRef File : Files) {
+ for (auto I = Files.begin() + 1, E = Files.end(); I != E; ++I) {
OS << '\n';
- PrintFilename(OS, File, OutputFormat);
+ PrintFilename(OS, *I, OutputFormat);
OS << ":\n";
}
}
diff --git a/clang/test/Preprocessor/dependencies-and-pp.c b/clang/test/Preprocessor/dependencies-and-pp.c
index fb496380409..8bf32dc0fd6 100644
--- a/clang/test/Preprocessor/dependencies-and-pp.c
+++ b/clang/test/Preprocessor/dependencies-and-pp.c
@@ -32,5 +32,12 @@
// RUN: FileCheck -check-prefix=TEST5 %s < %t.d
// TEST5: foo $$(bar) b az qu\ ux \ space:
+// Test self dependency, PR31644
+
+// RUN: %clang -E -MD -MP -MF %t.d %s
+// RUN: FileCheck -check-prefix=TEST6 %s < %t.d
+// TEST6: dependencies-and-pp.c
+// TEST6-NOT: dependencies-and-pp.c:
+
// TODO: Test default target without quoting
// TODO: Test default target with quoting
OpenPOWER on IntegriCloud