[cfe-commits] r164717 - in /cfe/trunk: lib/Driver/Tools.cpp test/Preprocessor/pr13851.c
Benjamin Kramer
benny.kra at googlemail.com
Wed Sep 26 12:01:49 PDT 2012
Author: d0k
Date: Wed Sep 26 14:01:49 2012
New Revision: 164717
URL: http://llvm.org/viewvc/llvm-project?rev=164717&view=rev
Log:
Allow -MF to be used in combination with -E -M or -E -MM.
Fixes PR13851. Patch by Dimitry Andric!
Added:
cfe/trunk/test/Preprocessor/pr13851.c
Modified:
cfe/trunk/lib/Driver/Tools.cpp
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=164717&r1=164716&r2=164717&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Wed Sep 26 14:01:49 2012
@@ -219,11 +219,11 @@
(A = Args.getLastArg(options::OPT_MMD))) {
// Determine the output location.
const char *DepFile;
- if (Output.getType() == types::TY_Dependencies) {
- DepFile = Output.getFilename();
- } else if (Arg *MF = Args.getLastArg(options::OPT_MF)) {
+ if (Arg *MF = Args.getLastArg(options::OPT_MF)) {
DepFile = MF->getValue(Args);
C.addFailureResultFile(DepFile);
+ } else if (Output.getType() == types::TY_Dependencies) {
+ DepFile = Output.getFilename();
} else if (A->getOption().matches(options::OPT_M) ||
A->getOption().matches(options::OPT_MM)) {
DepFile = "-";
Added: cfe/trunk/test/Preprocessor/pr13851.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/pr13851.c?rev=164717&view=auto
==============================================================================
--- cfe/trunk/test/Preprocessor/pr13851.c (added)
+++ cfe/trunk/test/Preprocessor/pr13851.c Wed Sep 26 14:01:49 2012
@@ -0,0 +1,11 @@
+// Check that -E -M -MF does not cause an "argument unused" error, by adding
+// -Werror to the clang invocation. Also check the dependency output, if any.
+// RUN: %clang -Werror -E -M -MF %t-M.d %s
+// RUN: FileCheck --input-file=%t-M.d %s
+// CHECK: pr13851.o:
+// CHECK: pr13851.c
+
+// Check that -E -MM -MF does not cause an "argument unused" error, by adding
+// -Werror to the clang invocation. Also check the dependency output, if any.
+// RUN: %clang -Werror -E -MM -MF %t-MM.d %s
+// RUN: FileCheck --input-file=%t-MM.d %s
More information about the cfe-commits
mailing list