aboutsummaryrefslogtreecommitdiff
path: root/clang/docs
diff options
context:
space:
mode:
authorFrancois Ferrand <thetypz@gmail.com>2018-10-02 16:37:51 +0000
committerFrancois Ferrand <thetypz@gmail.com>2018-10-02 16:37:51 +0000
commit6f40e21a1601aa1b83a13282918ddae47e58b7d5 (patch)
treee913d7ae400a1074b73dee48d3a0f01eb48911de /clang/docs
parent59500f7a0b8a492fec8b571a4a47cf163204247e (diff)
clang-format: better handle statement macros
Summary: Some macros are used in the body of function, and actually contain the trailing semicolon: they should thus be automatically followed by a new line, and not get merged with the next line. This is for example the case with Qt's Q_UNUSED macro: void foo(int a, int b) { Q_UNUSED(a) return b; } This patch deals with these cases by introducing a new option to specify list of statement macros. This re-uses the system already in place for foreach macros, to ensure there is no impact on performance. Reviewers: krasimir, djasper, klimek Reviewed By: krasimir Subscribers: acoomans, mgrang, alexfh, klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D33440 llvm-svn: 343602
Diffstat (limited to 'clang/docs')
-rw-r--r--clang/docs/ClangFormatStyleOptions.rst9
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/docs/ClangFormatStyleOptions.rst b/clang/docs/ClangFormatStyleOptions.rst
index 49f9f68088bc..60696b3bb96d 100644
--- a/clang/docs/ClangFormatStyleOptions.rst
+++ b/clang/docs/ClangFormatStyleOptions.rst
@@ -1979,6 +1979,15 @@ the configuration (without a prefix: ``Auto``).
+**StatementMacros** (``std::vector<std::string>``)
+ A vector of macros that should be interpreted as complete statements.
+
+ Typical macros are expressions, and require a semi-colon to be
+ added; sometimes this is not the case, and this allows to make
+ clang-format aware of such cases.
+
+ For example: Q_UNUSED
+
**TabWidth** (``unsigned``)
The number of columns used for tab stops.