[llvm-bugs] [Bug 31644] New: r287138 causes -MP output to be incorrect

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Jan 14 09:29:10 PST 2017


https://llvm.org/bugs/show_bug.cgi?id=31644

            Bug ID: 31644
           Summary: r287138 causes -MP output to be incorrect
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: dimitry at andric.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170114/f8ab827a/attachment.html>


More information about the llvm-bugs mailing list