/// Add -fsyntax-only option to the command line arguments. ArgumentsAdjuster getClangSyntaxOnlyAdjuster() { return [](const CommandLineArguments &Args, StringRef /*unused*/) { CommandLineArguments AdjustedArgs; for (size_t i = 0, e = Args.size(); i != e; ++i) { StringRef Arg = Args[i]; // FIXME: Remove options that generate output. if (!Arg.startswith("-fcolor-diagnostics") && !Arg.startswith("-fdiagnostics-color")) AdjustedArgs.push_back(Args[i]); } AdjustedArgs.push_back("-fsyntax-only"); return AdjustedArgs; }; }
/// Add -fsyntax-only option to the commnand line arguments. CommandLineArguments LFortSyntaxOnlyAdjuster::Adjust(const CommandLineArguments &Args) { CommandLineArguments AdjustedArgs = Args; // FIXME: Remove options that generate output. AdjustedArgs.push_back("-fsyntax-only"); return AdjustedArgs; }
static void injectResourceDir(CommandLineArguments &Args, const char *Argv0, void *MainAddr) { // Allow users to override the resource dir. for (StringRef Arg : Args) if (Arg.startswith("-resource-dir")) return; // If there's no override in place add our resource dir. Args.push_back("-resource-dir=" + CompilerInvocation::GetResourcesPath(Argv0, MainAddr)); }
ArgumentsAdjuster getClangStripOutputAdjuster() { return [](const CommandLineArguments &Args, StringRef /*unused*/) { CommandLineArguments AdjustedArgs; for (size_t i = 0, e = Args.size(); i < e; ++i) { StringRef Arg = Args[i]; if (!Arg.startswith("-o")) AdjustedArgs.push_back(Args[i]); if (Arg == "-o") { // Output is specified as -o foo. Skip the next argument too. ++i; } // Else, the output is specified as -ofoo. Just do nothing. } return AdjustedArgs; }; }
ArgumentsAdjuster getClangStripDependencyFileAdjuster() { return [](const CommandLineArguments &Args, StringRef /*unused*/) { CommandLineArguments AdjustedArgs; for (size_t i = 0, e = Args.size(); i < e; ++i) { 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")) AdjustedArgs.push_back(Args[i]); if ((Arg == "-MF") || (Arg == "-MT") || (Arg == "-MQ") || (Arg == "-MD") || (Arg == "-MMD")) { // Output is specified as -MX foo. Skip the next argument also. ++i; } } return AdjustedArgs; }; }
CommandLineArguments Adjust(const CommandLineArguments &Args) { CommandLineArguments AdjustedArgs = Args; AdjustedArgs.push_back("-fsyntax-only"); AdjustedArgs.push_back("-std=c++11"); return AdjustedArgs; }