1 //===--- ArgumentsAdjusters.h - Command line arguments adjuster -*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file declares typedef ArgumentsAdjuster and functions to create several
11 // useful argument adjusters.
12 // ArgumentsAdjusters modify command line arguments obtained from a compilation
13 // database before they are used to run a frontend action.
15 //===----------------------------------------------------------------------===//
17 #ifndef LLVM_CLANG_TOOLING_ARGUMENTSADJUSTERS_H
18 #define LLVM_CLANG_TOOLING_ARGUMENTSADJUSTERS_H
27 /// \brief A sequence of command line arguments.
28 typedef std::vector<std::string> CommandLineArguments;
30 /// \brief A prototype of a command line adjuster.
32 /// Command line argument adjuster is responsible for command line arguments
33 /// modification before the arguments are used to run a frontend action.
34 typedef std::function<CommandLineArguments(const CommandLineArguments &)>
37 /// \brief Gets an argument adjuster that converts input command line arguments
38 /// to the "syntax check only" variant.
39 ArgumentsAdjuster getClangSyntaxOnlyAdjuster();
41 /// \brief Gets an argument adjuster which removes output-related command line
43 ArgumentsAdjuster getClangStripOutputAdjuster();
45 enum class ArgumentInsertPosition { BEGIN, END };
47 /// \brief Gets an argument adjuster which inserts \p Extra arguments in the
48 /// specified position.
49 ArgumentsAdjuster getInsertArgumentAdjuster(const CommandLineArguments &Extra,
50 ArgumentInsertPosition Pos);
52 /// \brief Gets an argument adjuster which inserts an \p Extra argument in the
53 /// specified position.
54 ArgumentsAdjuster getInsertArgumentAdjuster(
56 ArgumentInsertPosition Pos = ArgumentInsertPosition::END);
58 /// \brief Gets an argument adjuster which adjusts the arguments in sequence
59 /// with the \p First adjuster and then with the \p Second one.
60 ArgumentsAdjuster combineAdjusters(ArgumentsAdjuster First,
61 ArgumentsAdjuster Second);
63 } // namespace tooling
66 #endif // LLVM_CLANG_TOOLING_ARGUMENTSADJUSTERS_H