Skip to content

Commit f988c2d

Browse files
committed
Rename
1 parent 20656a7 commit f988c2d

File tree

11 files changed

+34
-31
lines changed

11 files changed

+34
-31
lines changed

clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#include "CopyConstructorInitCheck.h"
2525
#include "CrtpConstructorAccessibilityCheck.h"
2626
#include "DanglingHandleCheck.h"
27-
#include "DefaultOperatorNewAlignmentCheck.h"
27+
#include "DefaultOperatorNewOnOveralignedTypeCheck.h"
2828
#include "DerivedMethodShadowingBaseMethodCheck.h"
2929
#include "DynamicStaticInitializersCheck.h"
3030
#include "EasilySwappableParametersCheck.h"
@@ -140,8 +140,8 @@ class BugproneModule : public ClangTidyModule {
140140
"bugprone-copy-constructor-init");
141141
CheckFactories.registerCheck<DanglingHandleCheck>(
142142
"bugprone-dangling-handle");
143-
CheckFactories.registerCheck<DefaultOperatorNewAlignmentCheck>(
144-
"bugprone-default-operator-new-alignment");
143+
CheckFactories.registerCheck<DefaultOperatorNewOnOveralignedTypeCheck>(
144+
"bugprone-default-operator-new-on-overaligned-type");
145145
CheckFactories.registerCheck<DerivedMethodShadowingBaseMethodCheck>(
146146
"bugprone-derived-method-shadowing-base-method");
147147
CheckFactories.registerCheck<DynamicStaticInitializersCheck>(

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ add_clang_library(clangTidyBugproneModule STATIC
2020
CopyConstructorInitCheck.cpp
2121
CrtpConstructorAccessibilityCheck.cpp
2222
DanglingHandleCheck.cpp
23-
DefaultOperatorNewAlignmentCheck.cpp
23+
DefaultOperatorNewOnOveralignedTypeCheck.cpp
2424
DerivedMethodShadowingBaseMethodCheck.cpp
2525
DynamicStaticInitializersCheck.cpp
2626
EasilySwappableParametersCheck.cpp

clang-tools-extra/clang-tidy/bugprone/DefaultOperatorNewAlignmentCheck.cpp renamed to clang-tools-extra/clang-tidy/bugprone/DefaultOperatorNewOnOveralignedTypeCheck.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#include "DefaultOperatorNewAlignmentCheck.h"
9+
#include "DefaultOperatorNewOnOveralignedTypeCheck.h"
1010
#include "clang/AST/ASTContext.h"
1111
#include "clang/ASTMatchers/ASTMatchFinder.h"
1212
#include "clang/Basic/TargetInfo.h"
@@ -15,12 +15,13 @@ using namespace clang::ast_matchers;
1515

1616
namespace clang::tidy::bugprone {
1717

18-
void DefaultOperatorNewAlignmentCheck::registerMatchers(MatchFinder *Finder) {
18+
void DefaultOperatorNewOnOveralignedTypeCheck::registerMatchers(
19+
MatchFinder *Finder) {
1920
Finder->addMatcher(
2021
cxxNewExpr(unless(hasAnyPlacementArg(anything()))).bind("new"), this);
2122
}
2223

23-
void DefaultOperatorNewAlignmentCheck::check(
24+
void DefaultOperatorNewOnOveralignedTypeCheck::check(
2425
const MatchFinder::MatchResult &Result) {
2526
// Get the found 'new' expression.
2627
const auto *NewExpr = Result.Nodes.getNodeAs<CXXNewExpr>("new");

clang-tools-extra/clang-tidy/bugprone/DefaultOperatorNewAlignmentCheck.h renamed to clang-tools-extra/clang-tidy/bugprone/DefaultOperatorNewOnOveralignedTypeCheck.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_DEFAULTOPERATORNEWALIGNMENTCHECK_H
10-
#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_DEFAULTOPERATORNEWALIGNMENTCHECK_H
9+
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_DEFAULTOPERATORNEWONOVERALIGNEDTYPECHECK_H
10+
#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_DEFAULTOPERATORNEWONOVERALIGNEDTYPECHECK_H
1111

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

@@ -17,10 +17,11 @@ namespace clang::tidy::bugprone {
1717
/// the default operator new.
1818
///
1919
/// For the user-facing documentation see:
20-
/// https://clang.llvm.org/extra/clang-tidy/checks/bugprone/default-operator-new-alignment.html
21-
class DefaultOperatorNewAlignmentCheck : public ClangTidyCheck {
20+
/// https://clang.llvm.org/extra/clang-tidy/checks/bugprone/bugprone-default-operator-new-on-overaligned-type.html
21+
class DefaultOperatorNewOnOveralignedTypeCheck : public ClangTidyCheck {
2222
public:
23-
DefaultOperatorNewAlignmentCheck(StringRef Name, ClangTidyContext *Context)
23+
DefaultOperatorNewOnOveralignedTypeCheck(StringRef Name,
24+
ClangTidyContext *Context)
2425
: ClangTidyCheck(Name, Context) {}
2526
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
2627
return !LangOpts.CPlusPlus17;

clang-tools-extra/clang-tidy/cert/CERTTidyModule.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include "../ClangTidyModuleRegistry.h"
1212
#include "../bugprone/BadSignalToKillThreadCheck.h"
1313
#include "../bugprone/CommandProcessorCheck.h"
14-
#include "../bugprone/DefaultOperatorNewAlignmentCheck.h"
14+
#include "../bugprone/DefaultOperatorNewOnOveralignedTypeCheck.h"
1515
#include "../bugprone/PointerArithmeticOnPolymorphicObjectCheck.h"
1616
#include "../bugprone/ReservedIdentifierCheck.h"
1717
#include "../bugprone/SignalHandlerCheck.h"
@@ -265,8 +265,9 @@ class CERTModule : public ClangTidyModule {
265265
CheckFactories.registerCheck<misc::ThrowByValueCatchByReferenceCheck>(
266266
"cert-err61-cpp");
267267
// MEM
268-
CheckFactories.registerCheck<bugprone::DefaultOperatorNewAlignmentCheck>(
269-
"cert-mem57-cpp");
268+
CheckFactories
269+
.registerCheck<bugprone::DefaultOperatorNewOnOveralignedTypeCheck>(
270+
"cert-mem57-cpp");
270271
// MSC
271272
CheckFactories.registerCheck<LimitedRandomnessCheck>("cert-msc50-cpp");
272273
CheckFactories.registerCheck<ProperlySeededRandomGeneratorCheck>(

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,8 @@ New check aliases
255255
keeping initial check as an alias to the new one.
256256

257257
- Renamed :doc:`cert-mem57-cpp <clang-tidy/checks/cert/mem57-cpp>` to
258-
:doc:`bugprone-default-operator-new-alignment
259-
<clang-tidy/checks/bugprone/default-operator-new-alignment>`
258+
:doc:`bugprone-default-operator-new-on-overaligned-type
259+
<clang-tidy/checks/bugprone/default-operator-new-on-overaligned-type>`
260260
keeping initial check as an alias to the new one.
261261

262262
Changes in existing checks

clang-tools-extra/docs/clang-tidy/checks/bugprone/default-operator-new-alignment.rst renamed to clang-tools-extra/docs/clang-tidy/checks/bugprone/default-operator-new-on-overaligned-type.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
.. title:: clang-tidy - bugprone-default-operator-new-alignment
1+
.. title:: clang-tidy - bugprone-default-operator-new-on-overaligned-type
22

3-
bugprone-default-operator-new-alignment
4-
=======================================
3+
bugprone-default-operator-new-on-overaligned-type
4+
=================================================
55

66
This check flags uses of default ``operator new`` where the type has extended
77
alignment (an alignment greater than the fundamental alignment). (The default

clang-tools-extra/docs/clang-tidy/checks/cert/mem57-cpp.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ cert-mem57-cpp
44
==============
55

66
The `cert-mem57-cpp` is an aliaes, please see
7-
`bugprone-default-operator-new-alignment <../bugprone/default-operator-new-alignment.html>`_
7+
`bugprone-default-operator-new-on-overaligned-type <../bugprone/default-operator-new-on-overaligned-type>`_
88
for more information.
99

1010
This check corresponds to the CERT C++ Coding Standard rule

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ Clang-Tidy Checks
9393
:doc:`bugprone-crtp-constructor-accessibility <bugprone/crtp-constructor-accessibility>`, "Yes"
9494
:doc:`bugprone-dangling-handle <bugprone/dangling-handle>`,
9595
:doc:`bugprone-derived-method-shadowing-base-method <bugprone/derived-method-shadowing-base-method>`,
96-
:doc:`bugprone-default-operator-new-alignment <bugprone/default-operator-new-alignment>`,
96+
:doc:`bugprone-default-operator-new-on-overaligned-type <bugprone/default-operator-new-on-overaligned-type>`,
9797
:doc:`bugprone-dynamic-static-initializers <bugprone/dynamic-static-initializers>`,
9898
:doc:`bugprone-easily-swappable-parameters <bugprone/easily-swappable-parameters>`,
9999
:doc:`bugprone-empty-catch <bugprone/empty-catch>`,
@@ -452,7 +452,7 @@ Check aliases
452452
:doc:`cert-fio38-c <cert/fio38-c>`, :doc:`misc-non-copyable-objects <misc/non-copyable-objects>`,
453453
:doc:`cert-flp37-c <cert/flp37-c>`, :doc:`bugprone-suspicious-memory-comparison <bugprone/suspicious-memory-comparison>`,
454454
:doc:`cert-int09-c <cert/int09-c>`, :doc:`readability-enum-initial-value <readability/enum-initial-value>`, "Yes"
455-
:doc:`cert-mem57-cpp <cert/mem57-cpp>`, :doc:`bugprone-default-operator-new-alignment <bugprone/default-operator-new-alignment>`,
455+
:doc:`cert-mem57-cpp <cert/mem57-cpp>`, :doc:`bugprone-default-operator-new-on-overaligned-type <bugprone/default-operator-new-on-overaligned-type>`,
456456
:doc:`cert-msc24-c <cert/msc24-c>`, :doc:`bugprone-unsafe-functions <bugprone/unsafe-functions>`,
457457
:doc:`cert-msc30-c <cert/msc30-c>`, :doc:`cert-msc50-cpp <cert/msc50-cpp>`,
458458
:doc:`cert-msc32-c <cert/msc32-c>`, :doc:`cert-msc51-cpp <cert/msc51-cpp>`,
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
// RUN: %check_clang_tidy %s -std=c++14 bugprone-default-operator-new-alignment %t
2-
// RUN: clang-tidy -checks='-*,bugprone-default-operator-new-alignment' --extra-arg=-Wno-unused-variable --warnings-as-errors='*' %s -- -std=c++17 -faligned-allocation
3-
// RUN: clang-tidy -checks='-*,bugprone-default-operator-new-alignment' --extra-arg=-Wno-unused-variable --warnings-as-errors='*' %s -- -std=c++17 -faligned-allocation
1+
// RUN: %check_clang_tidy %s -std=c++14 bugprone-default-operator-new-on-overaligned-type %t
2+
// RUN: clang-tidy -checks='-*,bugprone-default-operator-new-on-overaligned-type' --extra-arg=-Wno-unused-variable --warnings-as-errors='*' %s -- -std=c++17 -faligned-allocation
3+
// RUN: clang-tidy -checks='-*,bugprone-default-operator-new-on-overaligned-type' --extra-arg=-Wno-unused-variable --warnings-as-errors='*' %s -- -std=c++17 -faligned-allocation
44

55
struct alignas(128) Vector {
66
char Elems[128];
77
};
88

99
void f() {
10-
auto *V1 = new Vector; // CHECK-MESSAGES: warning: allocation function returns a pointer with alignment {{[0-9]+}} but the over-aligned type being allocated requires alignment 128 [bugprone-default-operator-new-alignment]
11-
auto *V1_Arr = new Vector[2]; // CHECK-MESSAGES: warning: allocation function returns a pointer with alignment {{[0-9]+}} but the over-aligned type being allocated requires alignment 128 [bugprone-default-operator-new-alignment]
10+
auto *V1 = new Vector; // CHECK-MESSAGES: warning: allocation function returns a pointer with alignment {{[0-9]+}} but the over-aligned type being allocated requires alignment 128 [bugprone-default-operator-new-on-overaligned-type]
11+
auto *V1_Arr = new Vector[2]; // CHECK-MESSAGES: warning: allocation function returns a pointer with alignment {{[0-9]+}} but the over-aligned type being allocated requires alignment 128 [bugprone-default-operator-new-on-overaligned-type]
1212
}

0 commit comments

Comments
 (0)