diff options
| author | Samuel Benzaquen <sbenza@google.com> | 2016-04-14 21:15:57 +0000 |
|---|---|---|
| committer | Samuel Benzaquen <sbenza@google.com> | 2016-04-14 21:15:57 +0000 |
| commit | 4fa2d57c6db8c7c5e017761643606697c050787c (patch) | |
| tree | b5d64e06f0870cbd790306e8334bec61808321c8 /clang-tools-extra/docs/clang-tidy/checks | |
| parent | 1ca263c8903b765349d48490de1bfa7def0dc48d (diff) | |
| download | bcm5719-llvm-4fa2d57c6db8c7c5e017761643606697c050787c.tar.gz bcm5719-llvm-4fa2d57c6db8c7c5e017761643606697c050787c.zip | |
[clang-tidy] Add check misc-multiple-statement-macro
Summary:
The check detects multi-statement macros that are used in unbraced conditionals.
Only the first statement will be part of the conditionals and the rest will fall
outside of it and executed unconditionally.
Reviewers: alexfh
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D18766
llvm-svn: 266369
Diffstat (limited to 'clang-tools-extra/docs/clang-tidy/checks')
| -rw-r--r-- | clang-tools-extra/docs/clang-tidy/checks/list.rst | 1 | ||||
| -rw-r--r-- | clang-tools-extra/docs/clang-tidy/checks/misc-multiple-statement-macro.rst | 16 |
2 files changed, 17 insertions, 0 deletions
diff --git a/clang-tools-extra/docs/clang-tidy/checks/list.rst b/clang-tools-extra/docs/clang-tidy/checks/list.rst index 99414bceaac..5fab245a14c 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/list.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/list.rst @@ -61,6 +61,7 @@ Clang-Tidy Checks misc-macro-repeated-side-effects misc-misplaced-widening-cast misc-move-constructor-init + misc-multiple-statement-macro misc-new-delete-overloads misc-noexcept-move-constructor misc-non-copyable-objects diff --git a/clang-tools-extra/docs/clang-tidy/checks/misc-multiple-statement-macro.rst b/clang-tools-extra/docs/clang-tidy/checks/misc-multiple-statement-macro.rst new file mode 100644 index 00000000000..b2b47601929 --- /dev/null +++ b/clang-tools-extra/docs/clang-tidy/checks/misc-multiple-statement-macro.rst @@ -0,0 +1,16 @@ +.. title:: clang-tidy - misc-multiple-statement-macro + +misc-multiple-statement-macro +============================= + +Detect multiple statement macros that are used in unbraced conditionals. +Only the first statement of the macro will be inside the conditional and the other ones will be executed unconditionally. + +Example: + +.. code:: c++ + + #define INCREMENT_TWO(x, y) (x)++; (y)++ + if (do_increment) + INCREMENT_TWO(a, b); // `(b)++;` will be executed unconditionally. + |

