blob: c44b20dd5a82a51c263cdd14eaf8cd1b3e52f2a9 [file] [log] [blame]
Simon Atanasyana01ddc72012-05-09 16:18:30 +00001//===--- ArgumentsAdjusters.cpp - Command line arguments adjuster ---------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file contains definitions of classes which implement ArgumentsAdjuster
11// interface.
12//
13//===----------------------------------------------------------------------===//
14
15#include "clang/Tooling/ArgumentsAdjusters.h"
Alexander Kornienkoe7b04862013-06-05 11:33:11 +000016#include "clang/Basic/LLVM.h"
17#include "llvm/ADT/StringRef.h"
Simon Atanasyana01ddc72012-05-09 16:18:30 +000018
19namespace clang {
20namespace tooling {
21
David Blaikie025983a2012-05-09 18:31:50 +000022void ArgumentsAdjuster::anchor() {
23}
24
Simon Atanasyana01ddc72012-05-09 16:18:30 +000025/// Add -fsyntax-only option to the commnand line arguments.
26CommandLineArguments
27ClangSyntaxOnlyAdjuster::Adjust(const CommandLineArguments &Args) {
Alexander Kornienkoe7b04862013-06-05 11:33:11 +000028 CommandLineArguments AdjustedArgs;
29 for (size_t i = 0, e = Args.size(); i != e; ++i) {
30 StringRef Arg = Args[i];
31 // FIXME: Remove options that generate output.
32 if (!Arg.startswith("-fcolor-diagnostics") &&
33 !Arg.startswith("-fdiagnostics-color"))
34 AdjustedArgs.push_back(Args[i]);
35 }
Simon Atanasyana01ddc72012-05-09 16:18:30 +000036 AdjustedArgs.push_back("-fsyntax-only");
37 return AdjustedArgs;
38}
39
40} // end namespace tooling
41} // end namespace clang
42