diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-11-17 06:02:29 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-11-17 06:02:29 +0000 |
commit | b3375cba7938e01895bb504e7e48ad94a2e07dd1 (patch) | |
tree | a887d9882c7647f3fa4e3c5902d44cf176c925d0 /include/clang/Frontend/CompilerInvocation.h | |
parent | 9488ea120e093068021f944176c3d610dd540914 (diff) |
Add initial cut at CompilerInvocation::toArgs, which "serializes" the CompilerInvocation into a list of arguments which can be passed to clang-cc (eventually, clang -cc1).
- Unfortunately, this is currently a tedious and manual translation. Eventually it would be nice to automatically generate this code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89049 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Frontend/CompilerInvocation.h')
-rw-r--r-- | include/clang/Frontend/CompilerInvocation.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/include/clang/Frontend/CompilerInvocation.h b/include/clang/Frontend/CompilerInvocation.h index 33234ec898..9d068c523c 100644 --- a/include/clang/Frontend/CompilerInvocation.h +++ b/include/clang/Frontend/CompilerInvocation.h @@ -20,8 +20,14 @@ #include "clang/Frontend/HeaderSearchOptions.h" #include "clang/Frontend/PreprocessorOptions.h" #include "clang/Frontend/PreprocessorOutputOptions.h" +#include "llvm/ADT/StringRef.h" #include "llvm/ADT/StringMap.h" #include <string> +#include <vector> + +namespace llvm { + template<typename T> class SmallVectorImpl; +} namespace clang { @@ -65,6 +71,23 @@ class CompilerInvocation { public: CompilerInvocation() {} + /// @name Utility Methods + /// @{ + + /// CreateFromArgs - Create a compiler invocation from a list of input + /// options. + /// + /// FIXME: Documenting error behavior. + /// + /// \param Res [out] - The resulting invocation. + /// \param Args - The input argument strings. + static void CreateFromArgs(CompilerInvocation &Res, + const llvm::SmallVectorImpl<llvm::StringRef> &Args); + + /// toArgs - Convert the CompilerInvocation to a list of strings suitable for + /// passing to CreateFromArgs. + void toArgs(std::vector<std::string> &Res); + /// @} /// @name Option Subgroups /// @{ |