[OptTable] Fix typo VALUE => VALUES (NFCI) (#121523)
[llvm-project.git] / clang-tools-extra / clang-tidy / performance / NoexceptMoveConstructorCheck.h
blob51728d2ce0d8d0c12bfac543e7a41b563f66f13f
1 //===--- NoexceptMoveConstructorCheck.h - clang-tidy-------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PERFORMANCE_NOEXCEPTMOVECONSTRUCTORCHECK_H
10 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PERFORMANCE_NOEXCEPTMOVECONSTRUCTORCHECK_H
12 #include "../ClangTidyCheck.h"
13 #include "NoexceptFunctionBaseCheck.h"
15 namespace clang::tidy::performance {
17 /// The check flags user-defined move constructors and assignment operators not
18 /// marked with `noexcept` or marked with `noexcept(expr)` where `expr`
19 /// evaluates to `false` (but is not a `false` literal itself).
20 ///
21 /// Move constructors of all the types used with STL containers, for example,
22 /// need to be declared `noexcept`. Otherwise STL will choose copy constructors
23 /// instead. The same is valid for move assignment operations.
24 ///
25 /// For the user-facing documentation see:
26 /// https://clang.llvm.org/extra/clang-tidy/checks/performance/noexcept-move-constructor.html
27 class NoexceptMoveConstructorCheck : public NoexceptFunctionBaseCheck {
28 public:
29 using NoexceptFunctionBaseCheck::NoexceptFunctionBaseCheck;
31 void registerMatchers(ast_matchers::MatchFinder *Finder) override;
33 private:
34 DiagnosticBuilder
35 reportMissingNoexcept(const FunctionDecl *FuncDecl) final override;
36 void reportNoexceptEvaluatedToFalse(const FunctionDecl *FuncDecl,
37 const Expr *NoexceptExpr) final override;
40 } // namespace clang::tidy::performance
42 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PERFORMANCE_NOEXCEPTMOVECONSTRUCTORCHECK_H