Skip to content

Commit 314e5fd

Browse files
zeyi2mahesh-attarde
authored andcommitted
[clang-tidy] Rename cert-env33-c to bugprone-command-processor (llvm#160275)
Moves `cert-env33-c` check into `bugprone` module and gives it a clearer name: `bugprone-command-processor` This is part of the cleanup described in llvm#157287. Closes llvm#157288
1 parent e605813 commit 314e5fd

File tree

11 files changed

+43
-18
lines changed

11 files changed

+43
-18
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "CapturingThisInMemberVariableCheck.h"
2020
#include "CastingThroughVoidCheck.h"
2121
#include "ChainedComparisonCheck.h"
22+
#include "CommandProcessorCheck.h"
2223
#include "ComparePointerToMemberVirtualFunctionCheck.h"
2324
#include "CopyConstructorInitCheck.h"
2425
#include "CrtpConstructorAccessibilityCheck.h"
@@ -130,6 +131,8 @@ class BugproneModule : public ClangTidyModule {
130131
"bugprone-casting-through-void");
131132
CheckFactories.registerCheck<ChainedComparisonCheck>(
132133
"bugprone-chained-comparison");
134+
CheckFactories.registerCheck<CommandProcessorCheck>(
135+
"bugprone-command-processor");
133136
CheckFactories.registerCheck<ComparePointerToMemberVirtualFunctionCheck>(
134137
"bugprone-compare-pointer-to-member-virtual-function");
135138
CheckFactories.registerCheck<CopyConstructorInitCheck>(

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ add_clang_library(clangTidyBugproneModule STATIC
1515
CapturingThisInMemberVariableCheck.cpp
1616
CastingThroughVoidCheck.cpp
1717
ChainedComparisonCheck.cpp
18+
CommandProcessorCheck.cpp
1819
ComparePointerToMemberVirtualFunctionCheck.cpp
1920
CopyConstructorInitCheck.cpp
2021
CrtpConstructorAccessibilityCheck.cpp

clang-tools-extra/clang-tidy/cert/CommandProcessorCheck.cpp renamed to clang-tools-extra/clang-tidy/bugprone/CommandProcessorCheck.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
using namespace clang::ast_matchers;
1313

14-
namespace clang::tidy::cert {
14+
namespace clang::tidy::bugprone {
1515

1616
void CommandProcessorCheck::registerMatchers(MatchFinder *Finder) {
1717
Finder->addMatcher(
@@ -35,4 +35,4 @@ void CommandProcessorCheck::check(const MatchFinder::MatchResult &Result) {
3535
diag(E->getExprLoc(), "calling %0 uses a command processor") << Fn;
3636
}
3737

38-
} // namespace clang::tidy::cert
38+
} // namespace clang::tidy::bugprone

clang-tools-extra/clang-tidy/cert/CommandProcessorCheck.h renamed to clang-tools-extra/clang-tidy/bugprone/CommandProcessorCheck.h

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

9-
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CERT_COMMAND_PROCESSOR_CHECK_H
10-
#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CERT_COMMAND_PROCESSOR_CHECK_H
9+
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_COMMANDPROCESSORCHECK_H
10+
#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_COMMANDPROCESSORCHECK_H
1111

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

14-
namespace clang::tidy::cert {
14+
namespace clang::tidy::bugprone {
1515

1616
/// Execution of a command processor can lead to security vulnerabilities,
1717
/// and is generally not required. Instead, prefer to launch executables
1818
/// directly via mechanisms that give you more control over what executable is
1919
/// actually launched.
2020
///
2121
/// For the user-facing documentation see:
22-
/// https://clang.llvm.org/extra/clang-tidy/checks/cert/env33-c.html
22+
/// https://clang.llvm.org/extra/clang-tidy/checks/bugprone/command-processor.html
2323
class CommandProcessorCheck : public ClangTidyCheck {
2424
public:
2525
CommandProcessorCheck(StringRef Name, ClangTidyContext *Context)
@@ -28,6 +28,6 @@ class CommandProcessorCheck : public ClangTidyCheck {
2828
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
2929
};
3030

31-
} // namespace clang::tidy::cert
31+
} // namespace clang::tidy::bugprone
3232

33-
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CERT_COMMAND_PROCESSOR_CHECK_H
33+
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_COMMANDPROCESSORCHECK_H

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "../ClangTidyModule.h"
1111
#include "../ClangTidyModuleRegistry.h"
1212
#include "../bugprone/BadSignalToKillThreadCheck.h"
13+
#include "../bugprone/CommandProcessorCheck.h"
1314
#include "../bugprone/PointerArithmeticOnPolymorphicObjectCheck.h"
1415
#include "../bugprone/ReservedIdentifierCheck.h"
1516
#include "../bugprone/SignalHandlerCheck.h"
@@ -33,7 +34,6 @@
3334
#include "../performance/MoveConstructorInitCheck.h"
3435
#include "../readability/EnumInitialValueCheck.h"
3536
#include "../readability/UppercaseLiteralSuffixCheck.h"
36-
#include "CommandProcessorCheck.h"
3737
#include "DefaultOperatorNewAlignmentCheck.h"
3838
#include "DontModifyStdNamespaceCheck.h"
3939
#include "FloatLoopCounter.h"
@@ -296,7 +296,8 @@ class CERTModule : public ClangTidyModule {
296296
CheckFactories.registerCheck<bugprone::ReservedIdentifierCheck>(
297297
"cert-dcl37-c");
298298
// ENV
299-
CheckFactories.registerCheck<CommandProcessorCheck>("cert-env33-c");
299+
CheckFactories.registerCheck<bugprone::CommandProcessorCheck>(
300+
"cert-env33-c");
300301
// ERR
301302
CheckFactories.registerCheck<bugprone::UnusedReturnValueCheck>(
302303
"cert-err33-c");

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ set(LLVM_LINK_COMPONENTS
55

66
add_clang_library(clangTidyCERTModule STATIC
77
CERTTidyModule.cpp
8-
CommandProcessorCheck.cpp
98
DefaultOperatorNewAlignmentCheck.cpp
109
DontModifyStdNamespaceCheck.cpp
1110
FloatLoopCounter.cpp

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,11 @@ New check aliases
211211
<clang-tidy/checks/modernize/avoid-variadic-functions>`
212212
keeping initial check as an alias to the new one.
213213

214+
- Renamed :doc:`cert-env33-c <clang-tidy/checks/cert/env33-c>` to
215+
:doc:`bugprone-command-processor
216+
<clang-tidy/checks/bugprone/command-processor>`
217+
keeping initial check as an alias to the new one.
218+
214219
- Renamed :doc:`cert-err34-c <clang-tidy/checks/cert/err34-c>` to
215220
:doc:`bugprone-unchecked-string-to-number-conversion
216221
<clang-tidy/checks/bugprone/unchecked-string-to-number-conversion>`
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
.. title:: clang-tidy - bugprone-command-processor
2+
3+
bugprone-command-processor
4+
==========================
5+
6+
Flags calls to ``system()``, ``popen()``, and ``_popen()``, which
7+
execute a command processor. It does not flag calls to ``system()`` with a null
8+
pointer argument, as such a call checks for the presence of a command processor
9+
but does not actually attempt to execute a command.
10+
11+
References
12+
----------
13+
14+
This check corresponds to the CERT C Coding Standard rule
15+
`ENV33-C. Do not call system()
16+
<https://www.securecoding.cert.org/confluence/display/c/ENV33-C.+Do+not+call+system()>`_.

clang-tools-extra/docs/clang-tidy/checks/cert/env33-c.rst

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
33
cert-env33-c
44
============
55

6-
This check flags calls to ``system()``, ``popen()``, and ``_popen()``, which
7-
execute a command processor. It does not flag calls to ``system()`` with a null
8-
pointer argument, as such a call checks for the presence of a command processor
9-
but does not actually attempt to execute a command.
6+
The `cert-env33-c` check is an alias, please see
7+
`bugprone-command-processor <../bugprone/command-processor.html>`_
8+
for more information.
109

1110
This check corresponds to the CERT C Coding Standard rule
1211
`ENV33-C. Do not call system()

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ Clang-Tidy Checks
8787
:doc:`bugprone-capturing-this-in-member-variable <bugprone/capturing-this-in-member-variable>`,
8888
:doc:`bugprone-casting-through-void <bugprone/casting-through-void>`,
8989
:doc:`bugprone-chained-comparison <bugprone/chained-comparison>`,
90+
:doc:`bugprone-command-processor <bugprone/command-processor>`,
9091
:doc:`bugprone-compare-pointer-to-member-virtual-function <bugprone/compare-pointer-to-member-virtual-function>`,
9192
:doc:`bugprone-copy-constructor-init <bugprone/copy-constructor-init>`, "Yes"
9293
:doc:`bugprone-crtp-constructor-accessibility <bugprone/crtp-constructor-accessibility>`, "Yes"
@@ -173,7 +174,6 @@ Clang-Tidy Checks
173174
:doc:`bugprone-use-after-move <bugprone/use-after-move>`,
174175
:doc:`bugprone-virtual-near-miss <bugprone/virtual-near-miss>`, "Yes"
175176
:doc:`cert-dcl58-cpp <cert/dcl58-cpp>`,
176-
:doc:`cert-env33-c <cert/env33-c>`,
177177
:doc:`cert-err33-c <cert/err33-c>`,
178178
:doc:`cert-err60-cpp <cert/err60-cpp>`,
179179
:doc:`cert-flp30-c <cert/flp30-c>`,
@@ -440,6 +440,7 @@ Check aliases
440440
:doc:`cert-dcl54-cpp <cert/dcl54-cpp>`, :doc:`misc-new-delete-overloads <misc/new-delete-overloads>`,
441441
:doc:`cert-dcl59-cpp <cert/dcl59-cpp>`, :doc:`google-build-namespaces <google/build-namespaces>`,
442442
:doc:`cert-err09-cpp <cert/err09-cpp>`, :doc:`misc-throw-by-value-catch-by-reference <misc/throw-by-value-catch-by-reference>`,
443+
:doc:`cert-env33-c <cert/env33-c>`, :doc:`bugprone-command-processor <bugprone/command-processor>`,
443444
:doc:`cert-err34-c <cert/err34-c>`, :doc:`bugprone-unchecked-string-to-number-conversion <bugprone/unchecked-string-to-number-conversion>`,
444445
:doc:`cert-err52-cpp <cert/err52-cpp>`, :doc:`modernize-avoid-setjmp-longjmp <modernize/avoid-setjmp-longjmp>`,
445446
:doc:`cert-err58-cpp <cert/err58-cpp>`, :doc:`bugprone-throwing-static-initialization <bugprone/throwing-static-initialization>`,

0 commit comments

Comments
 (0)