Simon Atanasyan | a01ddc7 | 2012-05-09 16:18:30 +0000 | [diff] [blame] | 1 | //===--- 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 Kornienko | e7b0486 | 2013-06-05 11:33:11 +0000 | [diff] [blame] | 16 | #include "clang/Basic/LLVM.h" |
| 17 | #include "llvm/ADT/StringRef.h" |
Simon Atanasyan | a01ddc7 | 2012-05-09 16:18:30 +0000 | [diff] [blame] | 18 | |
| 19 | namespace clang { |
| 20 | namespace tooling { |
| 21 | |
David Blaikie | 025983a | 2012-05-09 18:31:50 +0000 | [diff] [blame] | 22 | void ArgumentsAdjuster::anchor() { |
| 23 | } |
| 24 | |
Simon Atanasyan | a01ddc7 | 2012-05-09 16:18:30 +0000 | [diff] [blame] | 25 | /// Add -fsyntax-only option to the commnand line arguments. |
| 26 | CommandLineArguments |
| 27 | ClangSyntaxOnlyAdjuster::Adjust(const CommandLineArguments &Args) { |
Alexander Kornienko | e7b0486 | 2013-06-05 11:33:11 +0000 | [diff] [blame] | 28 | 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 Atanasyan | a01ddc7 | 2012-05-09 16:18:30 +0000 | [diff] [blame] | 36 | AdjustedArgs.push_back("-fsyntax-only"); |
| 37 | return AdjustedArgs; |
| 38 | } |
| 39 | |
| 40 | } // end namespace tooling |
| 41 | } // end namespace clang |
| 42 | |