diff options
author | Alexander Kornienko <alexfh@google.com> | 2016-04-13 11:33:40 +0000 |
---|---|---|
committer | Alexander Kornienko <alexfh@google.com> | 2016-04-13 11:33:40 +0000 |
commit | 4191b90c7560c500cb67defbb10c9ab3bc0563c7 (patch) | |
tree | 415e0baf71df9038b23f989b28c241d83c3966d9 /clang-tools-extra/docs/clang-tidy | |
parent | 7d20a5afdbe77bccea3d854de2b6d86ee8fc8c8c (diff) | |
download | bcm5719-llvm-4191b90c7560c500cb67defbb10c9ab3bc0563c7.tar.gz bcm5719-llvm-4191b90c7560c500cb67defbb10c9ab3bc0563c7.zip |
[clang-tidy] Add a readability-deleted-default clang-tidy check.
Checks if constructors and assignment operators that are marked '= default' are
actually deleted by the compiler.
Patch by Alex Pilkiewicz!
Differential Revision: http://reviews.llvm.org/D18961
llvm-svn: 266190
Diffstat (limited to 'clang-tools-extra/docs/clang-tidy')
-rw-r--r-- | clang-tools-extra/docs/clang-tidy/checks/list.rst | 1 | ||||
-rw-r--r-- | clang-tools-extra/docs/clang-tidy/checks/readability-deleted-default.rst | 21 |
2 files changed, 22 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 548028365ee..99414bceaac 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/list.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/list.rst @@ -98,6 +98,7 @@ Clang-Tidy Checks readability-avoid-const-params-in-decls readability-braces-around-statements readability-container-size-empty + readability-deleted-default readability-else-after-return readability-function-size readability-identifier-naming diff --git a/clang-tools-extra/docs/clang-tidy/checks/readability-deleted-default.rst b/clang-tools-extra/docs/clang-tidy/checks/readability-deleted-default.rst new file mode 100644 index 00000000000..3012911d279 --- /dev/null +++ b/clang-tools-extra/docs/clang-tidy/checks/readability-deleted-default.rst @@ -0,0 +1,21 @@ +.. title:: clang-tidy - readability-deleted-default + +readability-deleted-default +=========================== + +Checks that constructors and assignment operators marked as ``= default`` are +not actually deleted by the compiler. + +.. code:: c++ + class Example { + public: + // This constructor is deleted because I is missing a default value. + Example() = default; + // This is fine. + Example(const Example& Other) = default; + // This operator is deleted because I cannot be assigned (it is const). + Example& operator=(const Example& Other) = default; + private: + const int I; + }; + |