aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/StaticAnalyzer/Checkers/ConversionChecker.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2024-01-03 16:57:07 +0000
committerDimitry Andric <dim@FreeBSD.org>2024-01-03 16:57:07 +0000
commit77dbea07356e1ab2f37a777d4d1ddc5dd3e301c2 (patch)
treebdb0bc8db7a91e1f8b4bb8729fc391e2adf45380 /clang/lib/StaticAnalyzer/Checkers/ConversionChecker.cpp
parent99aabd70801bd4bc72c4942747f6d62c675112f5 (diff)
Diffstat (limited to 'clang/lib/StaticAnalyzer/Checkers/ConversionChecker.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Checkers/ConversionChecker.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/ConversionChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/ConversionChecker.cpp
index 8b34b41bab21..eca8d3cc0722 100644
--- a/clang/lib/StaticAnalyzer/Checkers/ConversionChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/ConversionChecker.cpp
@@ -42,7 +42,7 @@ public:
void checkPreStmt(const ImplicitCastExpr *Cast, CheckerContext &C) const;
private:
- mutable std::unique_ptr<BugType> BT;
+ const BugType BT{this, "Conversion"};
bool isLossOfPrecision(const ImplicitCastExpr *Cast, QualType DestType,
CheckerContext &C) const;
@@ -126,11 +126,8 @@ void ConversionChecker::checkPreStmt(const ImplicitCastExpr *Cast,
void ConversionChecker::reportBug(ExplodedNode *N, const Expr *E,
CheckerContext &C, const char Msg[]) const {
- if (!BT)
- BT.reset(new BugType(this, "Conversion"));
-
// Generate a report for this bug.
- auto R = std::make_unique<PathSensitiveBugReport>(*BT, Msg, N);
+ auto R = std::make_unique<PathSensitiveBugReport>(BT, Msg, N);
bugreporter::trackExpressionValue(N, E, *R);
C.emitReport(std::move(R));
}