diff options
author | Daniel Jasper <djasper@google.com> | 2013-02-06 14:22:40 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2013-02-06 14:22:40 +0000 |
commit | 8ff690ab478b33e0d830a6203de12d191d94f8ff (patch) | |
tree | af093e6e11e4cdec73d16e5268f690f720f66113 /include/clang/Format/Format.h | |
parent | 6b5ba8be528bf614d5f4477a4cdbd7c3b19714a6 (diff) |
Optionally derive formatting information from the input file.
With this patch, clang-format can analyze the input file for two
properties:
1. Is "int *a" or "int* a" more common.
2. Are non-C++03 constructs used, e.g. A<A<A>>.
With Google-style, clang-format will now use the more common style for
(1) and format C++03 compatible, unless it finds C++11 constructs in the
input.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174504 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Format/Format.h')
-rw-r--r-- | include/clang/Format/Format.h | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/include/clang/Format/Format.h b/include/clang/Format/Format.h index f9bd1308b6..75b809baab 100644 --- a/include/clang/Format/Format.h +++ b/include/clang/Format/Format.h @@ -39,14 +39,26 @@ struct FormatStyle { unsigned MaxEmptyLinesToKeep; /// \brief Set whether & and * bind to the type as opposed to the variable. - bool PointerAndReferenceBindToType; + bool PointerBindsToType; + + /// \brief If \c true, analyze the formatted file for the most common binding. + bool DerivePointerBinding; /// \brief The extra indent or outdent of access modifiers (e.g.: public:). int AccessModifierOffset; - /// \brief Split two consecutive closing '>' by a space, i.e. use - /// A<A<int> > instead of A<A<int>>. - bool SplitTemplateClosingGreater; + enum LanguageStandard { + LS_Cpp03, + LS_Cpp11, + LS_Auto + }; + + /// \brief Format compatible with this standard, e.g. use \c A<A<int> > + /// instead of \c A<A<int>> for LS_Cpp03. + LanguageStandard Standard; + + /// \brief If \c true, analyze the formatted file for C++03 compatibility. + bool DeriveBackwardsCompatibility; /// \brief Indent case labels one level from the switch statement. /// |