summaryrefslogtreecommitdiffstats
path: root/clang/lib/Tooling/ArgumentsAdjusters.cpp
blob: c44b20dd5a82a51c263cdd14eaf8cd1b3e52f2a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//===--- ArgumentsAdjusters.cpp - Command line arguments adjuster ---------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file contains definitions of classes which implement ArgumentsAdjuster
// interface.
//
//===----------------------------------------------------------------------===//

#include "clang/Tooling/ArgumentsAdjusters.h"
#include "clang/Basic/LLVM.h"
#include "llvm/ADT/StringRef.h"

namespace clang {
namespace tooling {

void ArgumentsAdjuster::anchor() {
}

/// Add -fsyntax-only option to the commnand line arguments.
CommandLineArguments
ClangSyntaxOnlyAdjuster::Adjust(const CommandLineArguments &Args) {
  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;
}

} // end namespace tooling
} // end namespace clang

OpenPOWER on IntegriCloud