Skip to content

Commit 181130f

Browse files
committed
rename
1 parent 434687b commit 181130f

File tree

11 files changed

+49
-50
lines changed

11 files changed

+49
-50
lines changed

clang-tools-extra/clang-tidy/misc/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ add_clang_library(clangTidyMiscModule STATIC
3232
NoRecursionCheck.cpp
3333
NonCopyableObjects.cpp
3434
NonPrivateMemberVariablesInClassesCheck.cpp
35+
OverrideWithDifferentVisibilityCheck.cpp
3536
RedundantExpressionCheck.cpp
3637
StaticAssertCheck.cpp
3738
ThrowByValueCatchByReferenceCheck.cpp
@@ -42,7 +43,6 @@ add_clang_library(clangTidyMiscModule STATIC
4243
UnusedUsingDeclsCheck.cpp
4344
UseAnonymousNamespaceCheck.cpp
4445
UseInternalLinkageCheck.cpp
45-
VisibilityChangeToVirtualFunctionCheck.cpp
4646

4747
LINK_LIBS
4848
clangTidy

clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "NoRecursionCheck.h"
2323
#include "NonCopyableObjects.h"
2424
#include "NonPrivateMemberVariablesInClassesCheck.h"
25+
#include "OverrideWithDifferentVisibilityCheck.h"
2526
#include "RedundantExpressionCheck.h"
2627
#include "StaticAssertCheck.h"
2728
#include "ThrowByValueCatchByReferenceCheck.h"
@@ -32,7 +33,6 @@
3233
#include "UnusedUsingDeclsCheck.h"
3334
#include "UseAnonymousNamespaceCheck.h"
3435
#include "UseInternalLinkageCheck.h"
35-
#include "VisibilityChangeToVirtualFunctionCheck.h"
3636

3737
namespace clang::tidy {
3838
namespace misc {
@@ -82,8 +82,8 @@ class MiscModule : public ClangTidyModule {
8282
"misc-use-anonymous-namespace");
8383
CheckFactories.registerCheck<UseInternalLinkageCheck>(
8484
"misc-use-internal-linkage");
85-
CheckFactories.registerCheck<VisibilityChangeToVirtualFunctionCheck>(
86-
"misc-visibility-change-to-virtual-function");
85+
CheckFactories.registerCheck<OverrideWithDifferentVisibilityCheck>(
86+
"misc-override-with-different-visibility");
8787
}
8888
};
8989

clang-tools-extra/clang-tidy/misc/VisibilityChangeToVirtualFunctionCheck.cpp renamed to clang-tools-extra/clang-tidy/misc/OverrideWithDifferentVisibilityCheck.cpp

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
//===--- VisibilityChangeToVirtualFunctionCheck.cpp - clang-tidy ----------===//
1+
//===--- OverrideWithDifferentVisibilityCheck.cpp - clang-tidy ------------===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
55
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#include "VisibilityChangeToVirtualFunctionCheck.h"
9+
#include "OverrideWithDifferentVisibilityCheck.h"
1010
#include "../utils/Matchers.h"
1111
#include "../utils/OptionsUtils.h"
1212
#include "clang/ASTMatchers/ASTMatchFinder.h"
@@ -29,19 +29,18 @@ namespace clang::tidy {
2929

3030
template <>
3131
struct OptionEnumMapping<
32-
misc::VisibilityChangeToVirtualFunctionCheck::ChangeKind> {
32+
misc::OverrideWithDifferentVisibilityCheck::ChangeKind> {
3333
static llvm::ArrayRef<std::pair<
34-
misc::VisibilityChangeToVirtualFunctionCheck::ChangeKind, StringRef>>
34+
misc::OverrideWithDifferentVisibilityCheck::ChangeKind, StringRef>>
3535
getEnumMapping() {
3636
static constexpr std::pair<
37-
misc::VisibilityChangeToVirtualFunctionCheck::ChangeKind, StringRef>
37+
misc::OverrideWithDifferentVisibilityCheck::ChangeKind, StringRef>
3838
Mapping[] = {
39-
{misc::VisibilityChangeToVirtualFunctionCheck::ChangeKind::Any,
39+
{misc::OverrideWithDifferentVisibilityCheck::ChangeKind::Any,
4040
"any"},
41-
{misc::VisibilityChangeToVirtualFunctionCheck::ChangeKind::Widening,
41+
{misc::OverrideWithDifferentVisibilityCheck::ChangeKind::Widening,
4242
"widening"},
43-
{misc::VisibilityChangeToVirtualFunctionCheck::ChangeKind::
44-
Narrowing,
43+
{misc::OverrideWithDifferentVisibilityCheck::ChangeKind::Narrowing,
4544
"narrowing"},
4645
};
4746
return {Mapping};
@@ -50,7 +49,7 @@ struct OptionEnumMapping<
5049

5150
namespace misc {
5251

53-
VisibilityChangeToVirtualFunctionCheck::VisibilityChangeToVirtualFunctionCheck(
52+
OverrideWithDifferentVisibilityCheck::OverrideWithDifferentVisibilityCheck(
5453
StringRef Name, ClangTidyContext *Context)
5554
: ClangTidyCheck(Name, Context),
5655
DetectVisibilityChange(
@@ -60,7 +59,7 @@ VisibilityChangeToVirtualFunctionCheck::VisibilityChangeToVirtualFunctionCheck(
6059
IgnoredFunctions(utils::options::parseStringList(
6160
Options.get("IgnoredFunctions", ""))) {}
6261

63-
void VisibilityChangeToVirtualFunctionCheck::storeOptions(
62+
void OverrideWithDifferentVisibilityCheck::storeOptions(
6463
ClangTidyOptions::OptionMap &Opts) {
6564
Options.store(Opts, "DisallowedVisibilityChange", DetectVisibilityChange);
6665
Options.store(Opts, "CheckDestructors", CheckDestructors);
@@ -69,7 +68,7 @@ void VisibilityChangeToVirtualFunctionCheck::storeOptions(
6968
utils::options::serializeStringList(IgnoredFunctions));
7069
}
7170

72-
void VisibilityChangeToVirtualFunctionCheck::registerMatchers(
71+
void OverrideWithDifferentVisibilityCheck::registerMatchers(
7372
MatchFinder *Finder) {
7473
auto IgnoredDecl =
7574
namedDecl(matchers::matchesAnyListedName(IgnoredFunctions));
@@ -89,7 +88,7 @@ void VisibilityChangeToVirtualFunctionCheck::registerMatchers(
8988
this);
9089
}
9190

92-
void VisibilityChangeToVirtualFunctionCheck::check(
91+
void OverrideWithDifferentVisibilityCheck::check(
9392
const MatchFinder::MatchResult &Result) {
9493
const auto *MatchedFunction = Result.Nodes.getNodeAs<FunctionDecl>("func");
9594
if (!MatchedFunction->isCanonicalDecl())

clang-tools-extra/clang-tidy/misc/VisibilityChangeToVirtualFunctionCheck.h renamed to clang-tools-extra/clang-tidy/misc/OverrideWithDifferentVisibilityCheck.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
//===--- VisibilityChangeToVirtualFunctionCheck.h - clang-tidy --*- C++ -*-===//
1+
//===--- OverrideWithDifferentVisibilityCheck.h - clang-tidy --*- C++ -*---===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
55
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_VISIBILITYCHANGETOVIRTUALFUNCTIONCHECK_H
10-
#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_VISIBILITYCHANGETOVIRTUALFUNCTIONCHECK_H
9+
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_OVERRIDEWITHDIFFERENTVISIBILITYCHECK_H
10+
#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_OVERRIDEWITHDIFFERENTVISIBILITYCHECK_H
1111

1212
#include "../ClangTidyCheck.h"
1313

@@ -17,13 +17,13 @@ namespace clang::tidy::misc {
1717
/// in the base class.
1818
///
1919
/// For the user-facing documentation see:
20-
/// http://clang.llvm.org/extra/clang-tidy/checks/misc/visibility-change-to-virtual-function.html
21-
class VisibilityChangeToVirtualFunctionCheck : public ClangTidyCheck {
20+
/// http://clang.llvm.org/extra/clang-tidy/checks/misc/override-with-different-visibility.html
21+
class OverrideWithDifferentVisibilityCheck : public ClangTidyCheck {
2222
public:
2323
enum class ChangeKind { Any, Widening, Narrowing };
2424

25-
VisibilityChangeToVirtualFunctionCheck(StringRef Name,
26-
ClangTidyContext *Context);
25+
OverrideWithDifferentVisibilityCheck(StringRef Name,
26+
ClangTidyContext *Context);
2727
void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
2828
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
2929
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
@@ -40,4 +40,4 @@ class VisibilityChangeToVirtualFunctionCheck : public ClangTidyCheck {
4040

4141
} // namespace clang::tidy::misc
4242

43-
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_VISIBILITYCHANGETOVIRTUALFUNCTIONCHECK_H
43+
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_OVERRIDEWITHDIFFERENTVISIBILITYCHECK_H

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ New checks
106106
Checks for uses of MLIR's old/to be deprecated ``OpBuilder::create<T>`` form
107107
and suggests using ``T::create`` instead.
108108

109-
- New :doc:`misc-visibility-change-to-virtual-function
110-
<clang-tidy/checks/misc/visibility-change-to-virtual-function>` check.
109+
- New :doc:`misc-override-with-different-visibility
110+
<clang-tidy/checks/misc/override-with-different-visibility>` check.
111111

112112
Finds virtual function overrides with different visibility than the function
113113
in the base class.

clang-tools-extra/docs/clang-tidy/checks/list.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ Clang-Tidy Checks
270270
:doc:`misc-no-recursion <misc/no-recursion>`,
271271
:doc:`misc-non-copyable-objects <misc/non-copyable-objects>`,
272272
:doc:`misc-non-private-member-variables-in-classes <misc/non-private-member-variables-in-classes>`,
273+
:doc:`misc-override-with-different-visibility <misc/override-with-different-visibility>`,
273274
:doc:`misc-redundant-expression <misc/redundant-expression>`, "Yes"
274275
:doc:`misc-static-assert <misc/static-assert>`, "Yes"
275276
:doc:`misc-throw-by-value-catch-by-reference <misc/throw-by-value-catch-by-reference>`,
@@ -280,7 +281,6 @@ Clang-Tidy Checks
280281
:doc:`misc-unused-using-decls <misc/unused-using-decls>`, "Yes"
281282
:doc:`misc-use-anonymous-namespace <misc/use-anonymous-namespace>`,
282283
:doc:`misc-use-internal-linkage <misc/use-internal-linkage>`, "Yes"
283-
:doc:`misc-visibility-change-to-virtual-function <misc/visibility-change-to-virtual-function>`,
284284
:doc:`modernize-avoid-bind <modernize/avoid-bind>`, "Yes"
285285
:doc:`modernize-avoid-c-arrays <modernize/avoid-c-arrays>`,
286286
:doc:`modernize-concat-nested-namespaces <modernize/concat-nested-namespaces>`, "Yes"
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
.. title:: clang-tidy - misc-visibility-change-to-virtual-function
1+
.. title:: clang-tidy - misc-override-with-different-visibility
22

3-
misc-visibility-change-to-virtual-function
4-
==========================================
3+
misc-override-with-different-visibility
4+
=======================================
55

66
Finds virtual function overrides with different visibility than the function
77
in the base class. This includes for example if a virtual function declared as
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// RUN: %check_clang_tidy %s misc-visibility-change-to-virtual-function %t -- \
2-
// RUN: -config="{CheckOptions: {misc-visibility-change-to-virtual-function.IgnoredFunctions: 'IgnoreAlways::.*;::a::IgnoreSelected::.*;IgnoreFunctions::f1;ignored_f'}}"
1+
// RUN: %check_clang_tidy %s misc-override-with-different-visibility %t -- \
2+
// RUN: -config="{CheckOptions: {misc-override-with-different-visibility.IgnoredFunctions: 'IgnoreAlways::.*;::a::IgnoreSelected::.*;IgnoreFunctions::f1;ignored_f'}}"
33

44
class IgnoreAlways {
55
virtual void f();
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
// RUN: %check_clang_tidy -check-suffixes=DTORS,WIDENING,NARROWING %s misc-visibility-change-to-virtual-function %t -- \
2-
// RUN: -config="{CheckOptions: {misc-visibility-change-to-virtual-function.CheckDestructors: true}}"
1+
// RUN: %check_clang_tidy -check-suffixes=DTORS,WIDENING,NARROWING %s misc-override-with-different-visibility %t -- \
2+
// RUN: -config="{CheckOptions: {misc-override-with-different-visibility.CheckDestructors: true}}"
33

4-
// RUN: %check_clang_tidy -check-suffixes=OPS,WIDENING,NARROWING %s misc-visibility-change-to-virtual-function %t -- \
5-
// RUN: -config="{CheckOptions: {misc-visibility-change-to-virtual-function.CheckOperators: true}}"
4+
// RUN: %check_clang_tidy -check-suffixes=OPS,WIDENING,NARROWING %s misc-override-with-different-visibility %t -- \
5+
// RUN: -config="{CheckOptions: {misc-override-with-different-visibility.CheckOperators: true}}"
66

7-
// RUN: %check_clang_tidy -check-suffixes=WIDENING %s misc-visibility-change-to-virtual-function %t -- \
8-
// RUN: -config="{CheckOptions: {misc-visibility-change-to-virtual-function.DisallowedVisibilityChange: 'widening'}}"
7+
// RUN: %check_clang_tidy -check-suffixes=WIDENING %s misc-override-with-different-visibility %t -- \
8+
// RUN: -config="{CheckOptions: {misc-override-with-different-visibility.DisallowedVisibilityChange: 'widening'}}"
99

10-
// RUN: %check_clang_tidy -check-suffixes=NARROWING %s misc-visibility-change-to-virtual-function %t -- \
11-
// RUN: -config="{CheckOptions: {misc-visibility-change-to-virtual-function.DisallowedVisibilityChange: 'narrowing'}}"
10+
// RUN: %check_clang_tidy -check-suffixes=NARROWING %s misc-override-with-different-visibility %t -- \
11+
// RUN: -config="{CheckOptions: {misc-override-with-different-visibility.DisallowedVisibilityChange: 'narrowing'}}"
1212

1313
namespace test_change {
1414

0 commit comments

Comments
 (0)