Skip to content

Commit 8a51547

Browse files
committed
inverse StrictMode option
1 parent 0addf55 commit 8a51547

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ static std::string translate(llvm::StringRef Value) {
7171
BoolBitwiseOperationCheck::BoolBitwiseOperationCheck(StringRef Name,
7272
ClangTidyContext *Context)
7373
: ClangTidyCheck(Name, Context),
74-
StrictMode(Options.get("StrictMode", true)),
74+
StrictMode(Options.get("StrictMode", false)),
7575
IgnoreMacros(Options.get("IgnoreMacros", false)) {}
7676

7777
void BoolBitwiseOperationCheck::storeOptions(
@@ -114,8 +114,8 @@ void BoolBitwiseOperationCheck::check(const MatchFinder::MatchResult &Result) {
114114
if (HasVolatileOperand)
115115
return;
116116

117-
const bool HasSideEffects =
118-
MatchedExpr->getRHS()->HasSideEffects(*Result.Context, StrictMode);
117+
const bool HasSideEffects = MatchedExpr->getRHS()->HasSideEffects(
118+
*Result.Context, /*IncludePossibleEffects=*/!StrictMode);
119119
if (HasSideEffects)
120120
return;
121121

clang-tools-extra/docs/clang-tidy/checks/misc/bool-bitwise-operation.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ Options
3838

3939
.. option:: StrictMode
4040

41-
Disabling this option promotes more fix-it hints even when they might
42-
change evaluation order or skip side effects. Default value is `true`.
41+
Enabling this option promotes more fix-it hints even when they might
42+
change evaluation order or skip side effects. Default value is `false`.
4343

4444
.. option:: IgnoreMacros
4545

clang-tools-extra/test/clang-tidy/checkers/misc/bool-bitwise-operation-change-possible-side-effect.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %check_clang_tidy %s misc-bool-bitwise-operation %t \
22
// RUN: -config="{CheckOptions: { \
3-
// RUN: misc-bool-bitwise-operation.StrictMode: false }}"
3+
// RUN: misc-bool-bitwise-operation.StrictMode: true }}"
44

55
bool function_with_possible_side_effects();
66

0 commit comments

Comments
 (0)