diff options
Diffstat (limited to 'lib/Tooling/ArgumentsAdjusters.cpp')
-rw-r--r-- | lib/Tooling/ArgumentsAdjusters.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/Tooling/ArgumentsAdjusters.cpp b/lib/Tooling/ArgumentsAdjusters.cpp index ac9fd3c5cade..7068ec2c4010 100644 --- a/lib/Tooling/ArgumentsAdjusters.cpp +++ b/lib/Tooling/ArgumentsAdjusters.cpp @@ -58,14 +58,14 @@ ArgumentsAdjuster getClangStripDependencyFileAdjuster() { StringRef Arg = Args[i]; // All dependency-file options begin with -M. These include -MM, // -MF, -MG, -MP, -MT, -MQ, -MD, and -MMD. - if (!Arg.startswith("-M")) + if (!Arg.startswith("-M")) { AdjustedArgs.push_back(Args[i]); + continue; + } - if ((Arg == "-MF") || (Arg == "-MT") || (Arg == "-MQ") || - (Arg == "-MD") || (Arg == "-MMD")) { - // Output is specified as -MX foo. Skip the next argument also. + if (Arg == "-MF" || Arg == "-MT" || Arg == "-MQ") + // These flags take an argument: -MX foo. Skip the next argument also. ++i; - } } return AdjustedArgs; }; @@ -96,6 +96,10 @@ ArgumentsAdjuster getInsertArgumentAdjuster(const char *Extra, ArgumentsAdjuster combineAdjusters(ArgumentsAdjuster First, ArgumentsAdjuster Second) { + if (!First) + return Second; + if (!Second) + return First; return [First, Second](const CommandLineArguments &Args, StringRef File) { return Second(First(Args, File), File); }; |