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/clang-tidy/readability/DeletedDefaultCheck.h | |
| 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/clang-tidy/readability/DeletedDefaultCheck.h')
| -rw-r--r-- | clang-tools-extra/clang-tidy/readability/DeletedDefaultCheck.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/clang-tools-extra/clang-tidy/readability/DeletedDefaultCheck.h b/clang-tools-extra/clang-tidy/readability/DeletedDefaultCheck.h new file mode 100644 index 00000000000..0608b07bf27 --- /dev/null +++ b/clang-tools-extra/clang-tidy/readability/DeletedDefaultCheck.h @@ -0,0 +1,36 @@ +//===--- DeletedDefaultCheck.h - clang-tidy----------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_DELETED_DEFAULT_H +#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_DELETED_DEFAULT_H + +#include "../ClangTidy.h" + +namespace clang { +namespace tidy { +namespace readability { + +/// Checks when a constructor or an assignment operator is marked as '= default' +/// but is actually deleted by the compiler. +/// +/// For the user-facing documentation see: +/// http://clang.llvm.org/extra/clang-tidy/checks/readability-deleted-default.html +class DeletedDefaultCheck : public ClangTidyCheck { +public: + DeletedDefaultCheck(StringRef Name, ClangTidyContext *Context) + : ClangTidyCheck(Name, Context) {} + void registerMatchers(ast_matchers::MatchFinder *Finder) override; + void check(const ast_matchers::MatchFinder::MatchResult &Result) override; +}; + +} // namespace readability +} // namespace tidy +} // namespace clang + +#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_DELETED_DEFAULT_H |

