diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2010-12-04 01:50:27 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2010-12-04 01:50:27 +0000 |
commit | 53c92be3b233cede6114702a5f86f146f55d6c6e (patch) | |
tree | 5339bdc0fc182b931ed86cc38288cb239d087ee2 /include/clang/Frontend/CompilerInvocation.h | |
parent | 640ccf071076e684713cc3c3276bb51982bff607 (diff) |
Introduce CompilerInvocation::setLangDefaults function
This patch refactors the CompilerInvocation code to introduce a
CompilerInvocation::setLangDefaults function, which can set up a
LangOptions with the defaults for a given language and language
standard. This function is useful for non-command line based Clang
clients which need to set up a CompilerInvocation manually for a
specific language.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120874 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Frontend/CompilerInvocation.h')
-rw-r--r-- | include/clang/Frontend/CompilerInvocation.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/include/clang/Frontend/CompilerInvocation.h b/include/clang/Frontend/CompilerInvocation.h index 641c5f6650..e0329dbc96 100644 --- a/include/clang/Frontend/CompilerInvocation.h +++ b/include/clang/Frontend/CompilerInvocation.h @@ -19,6 +19,7 @@ #include "clang/Frontend/DiagnosticOptions.h" #include "clang/Frontend/FrontendOptions.h" #include "clang/Frontend/HeaderSearchOptions.h" +#include "clang/Frontend/LangStandard.h" #include "clang/Frontend/PreprocessorOptions.h" #include "clang/Frontend/PreprocessorOutputOptions.h" #include "llvm/ADT/StringRef.h" @@ -106,6 +107,25 @@ public: /// passing to CreateFromArgs. void toArgs(std::vector<std::string> &Res); + /// setLangDefaults - Set language defaults for the given input language and + /// language standard in this CompilerInvocation. + /// + /// \param IK - The input language. + /// \param LangStd - The input language standard. + void setLangDefaults(InputKind IK, + LangStandard::Kind LangStd = LangStandard::lang_unspecified) { + setLangDefaults(LangOpts, IK, LangStd); + } + + /// setLangDefaults - Set language defaults for the given input language and + /// language standard in the given LangOptions object. + /// + /// \param LangOpts - The LangOptions object to set up. + /// \param IK - The input language. + /// \param LangStd - The input language standard. + static void setLangDefaults(LangOptions &Opts, InputKind IK, + LangStandard::Kind LangStd = LangStandard::lang_unspecified); + /// @} /// @name Option Subgroups /// @{ |