From d45d7eae053111e8f0e33849f28e412b8b718f1c Mon Sep 17 00:00:00 2001 From: David Stenberg Date: Tue, 29 May 2018 13:07:58 +0000 Subject: Fix emission of phony dependency targets when adding extra deps Summary: This commit fixes a bug where passing extra dependency entries (using -fdepfile-entry) would result in -MP incorrectly emitting a phony target for the input file, and no phony target for the first extra dependency. The extra dependencies are added first to the filename vector in DFGImpl. That clashed with the emission of the phony targets, as the code assumed that the first index always correspond to the input file. Reviewers: rsmith, pcc, krasin, bruno, vsapsai Reviewed By: vsapsai Subscribers: vsapsai, bruno, cfe-commits Differential Revision: https://reviews.llvm.org/D44568 llvm-svn: 333413 --- clang/test/Frontend/dependency-gen-extradeps-phony.c | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 clang/test/Frontend/dependency-gen-extradeps-phony.c (limited to 'clang/test/Frontend') diff --git a/clang/test/Frontend/dependency-gen-extradeps-phony.c b/clang/test/Frontend/dependency-gen-extradeps-phony.c new file mode 100644 index 00000000000..2d67a959ed8 --- /dev/null +++ b/clang/test/Frontend/dependency-gen-extradeps-phony.c @@ -0,0 +1,10 @@ +// RUN: %clang -MM -MP -Xclang -fdepfile-entry=1.extra -Xclang -fdepfile-entry=2.extra -Xclang -fdepfile-entry=2.extra %s | \ +// RUN: FileCheck %s --implicit-check-not=.c: +// +// Verify that phony targets are only created for the extra dependency files, +// and not the input file. + +// CHECK: dependency-gen-extradeps-phony.o: 1.extra 2.extra \ +// CHECK-NEXT: dependency-gen-extradeps-phony.c +// CHECK: 1.extra: +// CHECK: 2.extra: -- cgit v1.2.3