Skip to content

Commit 40f5913

Browse files
bulbazordhaoNoQ
authored andcommitted
[NFCI] Return PathSensitiveBugReport where appropriate
Some compilers have trouble converting unique_ptr<PathSensitiveBugReport> to unique_ptr<BugReport> causing some functions to fail to compile. Changing the return type of the functions that fail to compile does not appear to have any issues. I ran into this issue building with clang 3.8 on Ubuntu 16.04. llvm-svn: 372668 (cherry picked from commit 86c3af9)
1 parent d7cbbf0 commit 40f5913

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

clang/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,10 @@ class MacOSKeychainAPIChecker : public Checker<check::PreStmt<CallExpr>,
113113
const ExplodedNode *getAllocationNode(const ExplodedNode *N, SymbolRef Sym,
114114
CheckerContext &C) const;
115115

116-
std::unique_ptr<BugReport> generateAllocatedDataNotReleasedReport(
117-
const AllocationPair &AP, ExplodedNode *N, CheckerContext &C) const;
116+
std::unique_ptr<PathSensitiveBugReport>
117+
generateAllocatedDataNotReleasedReport(const AllocationPair &AP,
118+
ExplodedNode *N,
119+
CheckerContext &C) const;
118120

119121
/// Mark an AllocationPair interesting for diagnostic reporting.
120122
void markInteresting(PathSensitiveBugReport *R,
@@ -467,7 +469,7 @@ MacOSKeychainAPIChecker::getAllocationNode(const ExplodedNode *N,
467469
return AllocNode;
468470
}
469471

470-
std::unique_ptr<BugReport>
472+
std::unique_ptr<PathSensitiveBugReport>
471473
MacOSKeychainAPIChecker::generateAllocatedDataNotReleasedReport(
472474
const AllocationPair &AP, ExplodedNode *N, CheckerContext &C) const {
473475
const ADFunctionInfo &FI = FunctionsToTrack[AP.second->AllocatorIdx];

clang/lib/StaticAnalyzer/Checkers/NonNullParamChecker.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ class NonNullParamChecker
3535

3636
void checkPreCall(const CallEvent &Call, CheckerContext &C) const;
3737

38-
std::unique_ptr<BugReport>
38+
std::unique_ptr<PathSensitiveBugReport>
3939
genReportNullAttrNonNull(const ExplodedNode *ErrorN,
4040
const Expr *ArgE,
4141
unsigned IdxOfArg) const;
42-
std::unique_ptr<BugReport>
42+
std::unique_ptr<PathSensitiveBugReport>
4343
genReportReferenceToNullPointer(const ExplodedNode *ErrorN,
4444
const Expr *ArgE) const;
4545
};
@@ -179,7 +179,7 @@ void NonNullParamChecker::checkPreCall(const CallEvent &Call,
179179
C.addTransition(state);
180180
}
181181

182-
std::unique_ptr<BugReport>
182+
std::unique_ptr<PathSensitiveBugReport>
183183
NonNullParamChecker::genReportNullAttrNonNull(const ExplodedNode *ErrorNode,
184184
const Expr *ArgE,
185185
unsigned IdxOfArg) const {
@@ -204,7 +204,8 @@ NonNullParamChecker::genReportNullAttrNonNull(const ExplodedNode *ErrorNode,
204204
return R;
205205
}
206206

207-
std::unique_ptr<BugReport> NonNullParamChecker::genReportReferenceToNullPointer(
207+
std::unique_ptr<PathSensitiveBugReport>
208+
NonNullParamChecker::genReportReferenceToNullPointer(
208209
const ExplodedNode *ErrorNode, const Expr *ArgE) const {
209210
if (!BTNullRefArg)
210211
BTNullRefArg.reset(new BuiltinBug(this, "Dereference of null pointer"));

0 commit comments

Comments
 (0)