diff options
author | Artem Dergachev <artem.dergachev@gmail.com> | 2019-09-09 20:34:40 +0000 |
---|---|---|
committer | Artem Dergachev <artem.dergachev@gmail.com> | 2019-09-09 20:34:40 +0000 |
commit | 2f169e7cdd9973d2aa4cba6b0a09126a5e7268ec (patch) | |
tree | 583758bdf33ed6ba3d9780cd37cb30ebf977ee5e /clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp | |
parent | 48453bb8eda3d25b50ab098ebdc33a08724b2e2f (diff) | |
download | bcm5719-llvm-2f169e7cdd9973d2aa4cba6b0a09126a5e7268ec.tar.gz bcm5719-llvm-2f169e7cdd9973d2aa4cba6b0a09126a5e7268ec.zip |
[analyzer] NFC: Introduce sub-classes for path-sensitive and basic reports.
Checkers are now required to specify whether they're creating a
path-sensitive report or a path-insensitive report by constructing an
object of the respective type.
This makes BugReporter more independent from the rest of the Static Analyzer
because all Analyzer-specific code is now in sub-classes.
Differential Revision: https://reviews.llvm.org/D66572
llvm-svn: 371450
Diffstat (limited to 'clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp')
-rw-r--r-- | clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp index c4376c584f1..7285d27495a 100644 --- a/clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp @@ -162,7 +162,8 @@ void StackAddrEscapeChecker::EmitStackError(CheckerContext &C, llvm::raw_svector_ostream os(buf); SourceRange range = genName(os, R, C.getASTContext()); os << " returned to caller"; - auto report = std::make_unique<BugReport>(*BT_returnstack, os.str(), N); + auto report = + std::make_unique<PathSensitiveBugReport>(*BT_returnstack, os.str(), N); report->addRange(RetE->getSourceRange()); if (range.isValid()) report->addRange(range); @@ -199,8 +200,8 @@ void StackAddrEscapeChecker::checkAsyncExecutedBlockCaptures( llvm::raw_svector_ostream Out(Buf); SourceRange Range = genName(Out, Region, C.getASTContext()); Out << " is captured by an asynchronously-executed block"; - auto Report = - std::make_unique<BugReport>(*BT_capturedstackasync, Out.str(), N); + auto Report = std::make_unique<PathSensitiveBugReport>( + *BT_capturedstackasync, Out.str(), N); if (Range.isValid()) Report->addRange(Range); C.emitReport(std::move(Report)); @@ -222,8 +223,8 @@ void StackAddrEscapeChecker::checkReturnedBlockCaptures( llvm::raw_svector_ostream Out(Buf); SourceRange Range = genName(Out, Region, C.getASTContext()); Out << " is captured by a returned block"; - auto Report = - std::make_unique<BugReport>(*BT_capturedstackret, Out.str(), N); + auto Report = std::make_unique<PathSensitiveBugReport>(*BT_capturedstackret, + Out.str(), N); if (Range.isValid()) Report->addRange(Range); C.emitReport(std::move(Report)); @@ -351,7 +352,8 @@ void StackAddrEscapeChecker::checkEndFunction(const ReturnStmt *RS, const VarRegion *VR = cast<VarRegion>(P.first->getBaseRegion()); Out << *VR->getDecl() << "' upon returning to the caller. This will be a dangling reference"; - auto Report = std::make_unique<BugReport>(*BT_stackleak, Out.str(), N); + auto Report = + std::make_unique<PathSensitiveBugReport>(*BT_stackleak, Out.str(), N); if (Range.isValid()) Report->addRange(Range); |