clang-tools
22.0.0git
llvm-project
clang-tools-extra
clang-tidy
performance
NoexceptDestructorCheck.cpp
Go to the documentation of this file.
1
//===----------------------------------------------------------------------===//
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
//===----------------------------------------------------------------------===//
8
9
#include "
NoexceptDestructorCheck.h
"
10
#include "clang/ASTMatchers/ASTMatchFinder.h"
11
12
using namespace
clang::ast_matchers
;
13
14
// FixItHint - comment added to fix list.rst generation in add_new_check.py.
15
// Do not remove. Fixes are generated in base class.
16
17
namespace
clang::tidy::performance
{
18
19
void
NoexceptDestructorCheck::registerMatchers
(MatchFinder *Finder) {
20
Finder->addMatcher(functionDecl(unless(isDeleted()), cxxDestructorDecl())
21
.bind(
BindFuncDeclName
),
22
this
);
23
}
24
25
DiagnosticBuilder
26
NoexceptDestructorCheck::reportMissingNoexcept(
const
FunctionDecl *
FuncDecl
) {
27
return
diag(
FuncDecl
->getLocation(),
"destructors should "
28
"be marked noexcept"
);
29
}
30
31
void
NoexceptDestructorCheck::reportNoexceptEvaluatedToFalse(
32
const
FunctionDecl *
FuncDecl
,
const
Expr *NoexceptExpr) {
33
diag(NoexceptExpr->getExprLoc(),
34
"noexcept specifier on the destructor evaluates to 'false'"
);
35
}
36
37
}
// namespace clang::tidy::performance
NoexceptDestructorCheck.h
clang::tidy::performance::NoexceptDestructorCheck::registerMatchers
void registerMatchers(ast_matchers::MatchFinder *Finder) override
Definition
NoexceptDestructorCheck.cpp:19
clang::tidy::performance::NoexceptFunctionBaseCheck::BindFuncDeclName
static constexpr StringRef BindFuncDeclName
Definition
NoexceptFunctionBaseCheck.h:42
clang::ast_matchers
Definition
AbseilMatcher.h:13
clang::tidy::performance
Definition
AvoidEndlCheck.cpp:20
FuncDecl
static constexpr const char FuncDecl[]
Definition
utils/UseRangesCheck.cpp:36
Generated on
for clang-tools by
1.14.0