<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - r287138 causes -MP output to be incorrect"
href="https://llvm.org/bugs/show_bug.cgi?id=31644">31644</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>r287138 causes -MP output to be incorrect
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>dimitry@andric.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Before r287138:
$ cat a.c
int main(void) { return 0; }
$ clang -MD -MP -c a.c
$ cat a.d
a.o: a.c
After r287138:
$ clang -MD -MP -c a.c
$ cat a.d
a.o: a.c
a.c:
E.g. one additional dependency for the main source file itself is printed,
while it should not be.
The relevant piece of code is in 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) {
OS << '\n';
PrintFilename(OS, File, OutputFormat);
OS << ":\n";
}
}
Unfortunately the comment does not match the range-based for loop anymore, as
this does *not* skip the first entry. The code used to do:
for (std::vector<std::string>::iterator I = Files.begin() + 1,
E = Files.end(); I != E; ++I) {
I am unsure how to achieve this effect with range-based for loops though, it
may be best to just revert that part.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>