[LLVMbugs] [Bug 13851] New: -MF option is ignored

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Sep 14 15:02:51 PDT 2012


             Bug #: 13851
           Summary: -MF option is ignored
           Product: clang
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Driver
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: dimitry at andric.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 9219
  --> http://llvm.org/bugs/attachment.cgi?id=9219
Fix -MF to always use the specified filename for dependency output

Clang (trunk r163208) seems to ignore any -MF option that is used in
combination with -E -M or -E -MM.   For example:

  $ clang -E -MM -MF .depend helloworld.c
  clang: warning: argument unused during compilation: '-MF .depend'

and no dependency file is generated, the dependency information is
dumped to standard output instead.

It does work when also compiling, e.g if -MD or -MMD is used:

  $ clang -MMD -MF .depend -c helloworld.c
  $ cat .depend
  helloworld.o: helloworld.c

Looking at Clang::AddPreprocessingOptions() in lib/Driver/Tools.cpp, it
seems the check for a -MF option is done too late: if dependency output
is requested in any way, the DepFile is always the default filename,
which is standard output if -E is used.

I propose the attached patch to fix this.

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list