Skip to content

Commit 76950c1

Browse files
committed
Make CheckerFrontendWithBugType a subclass of BugType
1 parent 8459b2f commit 76950c1

File tree

3 files changed

+7
-11
lines changed

3 files changed

+7
-11
lines changed

clang/include/clang/StaticAnalyzer/Core/BugReporter/BugType.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,12 @@ class BugType {
7777
/// BugType LongCheckerFrontendNameBug{LongCheckerFrontendName, "..."};
7878
/// ```
7979
/// we can use `CheckerFrontendWithBugType LongCheckerFrontendName{"..."}`.
80-
class CheckerFrontendWithBugType : public CheckerFrontend {
81-
BugType BT;
82-
80+
class CheckerFrontendWithBugType : public CheckerFrontend, public BugType {
8381
public:
8482
CheckerFrontendWithBugType(StringRef Desc,
8583
StringRef Cat = categories::LogicError,
8684
bool SuppressOnSink = false)
87-
: BT(this, Desc, Cat, SuppressOnSink) {}
88-
const BugType &getBT() const { return BT; }
85+
: BugType(this, Desc, Cat, SuppressOnSink) {}
8986
};
9087

9188
} // namespace ento

clang/lib/StaticAnalyzer/Checkers/DivZeroChecker.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ void DivZeroChecker::reportBug(StringRef Msg, ProgramStateRef StateZero,
5656
if (!DivideZeroChecker.isEnabled())
5757
return;
5858
if (ExplodedNode *N = C.generateErrorNode(StateZero)) {
59-
auto R = std::make_unique<PathSensitiveBugReport>(DivideZeroChecker.getBT(),
60-
Msg, N);
59+
auto R =
60+
std::make_unique<PathSensitiveBugReport>(DivideZeroChecker, Msg, N);
6161
bugreporter::trackExpressionValue(N, getDenomExpr(N), *R);
6262
C.emitReport(std::move(R));
6363
}
@@ -69,8 +69,8 @@ void DivZeroChecker::reportTaintBug(
6969
if (!TaintedDivChecker.isEnabled())
7070
return;
7171
if (ExplodedNode *N = C.generateNonFatalErrorNode(StateZero)) {
72-
auto R = std::make_unique<PathSensitiveBugReport>(TaintedDivChecker.getBT(),
73-
Msg, N);
72+
auto R =
73+
std::make_unique<PathSensitiveBugReport>(TaintedDivChecker, Msg, N);
7474
bugreporter::trackExpressionValue(N, getDenomExpr(N), *R);
7575
for (auto Sym : TaintedSyms)
7676
R->markInteresting(Sym);

clang/lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,7 @@ void VirtualCallChecker::checkPreCall(const CallEvent &Call,
155155
return;
156156
}
157157

158-
auto Report =
159-
std::make_unique<PathSensitiveBugReport>(Part.getBT(), OS.str(), N);
158+
auto Report = std::make_unique<PathSensitiveBugReport>(Part, OS.str(), N);
160159

161160
if (ShowFixIts && !IsPure) {
162161
// FIXME: These hints are valid only when the virtual call is made

0 commit comments

Comments
 (0)