Skip to content

Commit e4c7ee3

Browse files
authored
[analyzer][NFC] Simplify BugType handling in core.BitwiseShift (#74609)
Eliminate the `mutable unique_ptr` hack because it's no longer needed. (This cleanup could be done anywhere, I'm doing it here now because it was me who published this checker with the old hack when it was already superfluous.)
1 parent b768b39 commit e4c7ee3

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

clang/lib/StaticAnalyzer/Checkers/BitwiseShiftChecker.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ BitwiseShiftValidator::createBugReport(StringRef ShortMsg, StringRef Msg) const
344344
} // anonymous namespace
345345

346346
class BitwiseShiftChecker : public Checker<check::PreStmt<BinaryOperator>> {
347-
mutable std::unique_ptr<BugType> BTPtr;
347+
BugType BT{this, "Bitwise shift", "Suspicious operation"};
348348

349349
public:
350350
void checkPreStmt(const BinaryOperator *B, CheckerContext &Ctx) const {
@@ -353,11 +353,7 @@ class BitwiseShiftChecker : public Checker<check::PreStmt<BinaryOperator>> {
353353
if (Op != BO_Shl && Op != BO_Shr)
354354
return;
355355

356-
if (!BTPtr)
357-
BTPtr = std::make_unique<BugType>(this, "Bitwise shift",
358-
"Suspicious operation");
359-
360-
BitwiseShiftValidator(B, Ctx, *BTPtr, Pedantic).run();
356+
BitwiseShiftValidator(B, Ctx, BT, Pedantic).run();
361357
}
362358

363359
bool Pedantic = false;

0 commit comments

Comments
 (0)