16#include "llvm/ADT/STLExtras.h"
17#include "llvm/ADT/StringRef.h"
25 for (
const auto &Arg : Args) {
26 StringRef ArgRef = Arg;
27 if (ArgRef.consume_front(
"--driver-mode=")) {
38 bool HasSyntaxOnly =
false;
39 constexpr llvm::StringRef OutputCommands[] = {
44 for (
size_t i = 0, e = Args.size(); i < e; ++i) {
45 StringRef Arg = Args[i];
47 if (llvm::any_of(OutputCommands, [&Arg](llvm::StringRef OutputCommand) {
48 return Arg.starts_with(OutputCommand);
52 if (Arg !=
"-c" && Arg !=
"-S" &&
53 !Arg.starts_with(
"-fcolor-diagnostics") &&
54 !Arg.starts_with(
"-fdiagnostics-color"))
55 AdjustedArgs.push_back(Args[i]);
59 else if (!AdjustedArgs.empty() && AdjustedArgs.back() ==
"-Xclang")
60 AdjustedArgs.pop_back();
62 if (Arg ==
"-fsyntax-only")
75 for (
size_t i = 0, e = Args.size(); i < e; ++i) {
76 StringRef Arg = Args[i];
77 if (!Arg.starts_with(
"-o"))
78 AdjustedArgs.push_back(Args[i]);
95 for (
size_t i = 0, e = Args.size(); i < e; ++i) {
96 StringRef Arg = Args[i];
99 if (!UsingClDriver && (Arg ==
"-MF" || Arg ==
"-MT" || Arg ==
"-MQ")) {
106 if (!UsingClDriver && Arg.starts_with(
"-M"))
110 if (Arg.starts_with(
"/showIncludes") || Arg.starts_with(
"-showIncludes"))
113 AdjustedArgs.push_back(Args[i]);
124 CommandLineArguments::iterator I;
126 I = llvm::find(Return,
"--");
132 Return.insert(I, Extra.begin(), Extra.end());
156 for (
size_t I = 0,
E = Args.size(); I !=
E; I++) {
161 if (I + 4 <
E && Args[I] ==
"-Xclang" &&
162 (Args[I + 1] ==
"-load" || Args[I + 1] ==
"-plugin" ||
163 llvm::StringRef(Args[I + 1]).starts_with(
"-plugin-arg-") ||
164 Args[I + 1] ==
"-add-plugin") &&
165 Args[I + 2] ==
"-Xclang") {
169 AdjustedArgs.push_back(Args[I]);
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
The JSON file list parser is used to communicate input to InstallAPI.