From: Daniel Dunbar Date: Wed, 8 Dec 2010 21:33:40 +0000 (+0000) Subject: Driver: M and MM should be grouped together, . X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9eb93b07ea913e7ad0bcd15bd3e3662e2760c323;p=clang Driver: M and MM should be grouped together, . git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121284 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp index 98c1a21559..a3b7167c8b 100644 --- a/lib/Driver/Driver.cpp +++ b/lib/Driver/Driver.cpp @@ -800,8 +800,7 @@ void Driver::BuildActions(const ToolChain &TC, const ArgList &Args, // -{E,M,MM} only run the preprocessor. if ((FinalPhaseArg = Args.getLastArg(options::OPT_E)) || - (FinalPhaseArg = Args.getLastArg(options::OPT_M)) || - (FinalPhaseArg = Args.getLastArg(options::OPT_MM))) { + (FinalPhaseArg = Args.getLastArg(options::OPT_M, options::OPT_MM))) { FinalPhase = phases::Preprocess; // -{fsyntax-only,-analyze,emit-ast,S} only run up to the compiler. @@ -909,7 +908,7 @@ Action *Driver::ConstructPhaseAction(const ArgList &Args, phases::ID Phase, case phases::Preprocess: { types::ID OutputTy; // -{M, MM} alter the output type. - if (Args.hasArg(options::OPT_M) || Args.hasArg(options::OPT_MM)) { + if (Args.hasArg(options::OPT_M, options::OPT_MM)) { OutputTy = types::TY_Dependencies; } else { OutputTy = types::getPreprocessedType(Input->getType()); diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index e4f807e59e..7674fdcf38 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -136,8 +136,7 @@ void Clang::AddPreprocessingOptions(const Driver &D, Args.AddLastArg(CmdArgs, options::OPT_CC); // Handle dependency file generation. - if ((A = Args.getLastArg(options::OPT_M)) || - (A = Args.getLastArg(options::OPT_MM)) || + if ((A = Args.getLastArg(options::OPT_M, options::OPT_MM)) || (A = Args.getLastArg(options::OPT_MD)) || (A = Args.getLastArg(options::OPT_MMD))) { // Determine the output location. diff --git a/test/Driver/m_and_mm.c b/test/Driver/m_and_mm.c new file mode 100644 index 0000000000..eab2a04986 --- /dev/null +++ b/test/Driver/m_and_mm.c @@ -0,0 +1,3 @@ +// RUN: %clang -### \ +// RUN: -M -MM %s 2> %t +// RUN: grep '"-sys-header-deps"' %t | count 0