diff options
Diffstat (limited to 'lib/StaticAnalyzer/Checkers/MPI-Checker/MPIBugReporter.cpp')
-rw-r--r-- | lib/StaticAnalyzer/Checkers/MPI-Checker/MPIBugReporter.cpp | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIBugReporter.cpp b/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIBugReporter.cpp index b250d3f8795e..bbf2ddec5762 100644 --- a/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIBugReporter.cpp +++ b/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIBugReporter.cpp @@ -30,8 +30,8 @@ void MPIBugReporter::reportDoubleNonblocking( ErrorText = "Double nonblocking on request " + RequestRegion->getDescriptiveName() + ". "; - auto Report = llvm::make_unique<BugReport>(*DoubleNonblockingBugType, - ErrorText, ExplNode); + auto Report = std::make_unique<PathSensitiveBugReport>( + *DoubleNonblockingBugType, ErrorText, ExplNode); Report->addRange(MPICallEvent.getSourceRange()); SourceRange Range = RequestRegion->sourceRange(); @@ -39,7 +39,7 @@ void MPIBugReporter::reportDoubleNonblocking( if (Range.isValid()) Report->addRange(Range); - Report->addVisitor(llvm::make_unique<RequestNodeVisitor>( + Report->addVisitor(std::make_unique<RequestNodeVisitor>( RequestRegion, "Request is previously used by nonblocking call here. ")); Report->markInteresting(RequestRegion); @@ -53,13 +53,13 @@ void MPIBugReporter::reportMissingWait( std::string ErrorText{"Request " + RequestRegion->getDescriptiveName() + " has no matching wait. "}; - auto Report = - llvm::make_unique<BugReport>(*MissingWaitBugType, ErrorText, ExplNode); + auto Report = std::make_unique<PathSensitiveBugReport>(*MissingWaitBugType, + ErrorText, ExplNode); SourceRange Range = RequestRegion->sourceRange(); if (Range.isValid()) Report->addRange(Range); - Report->addVisitor(llvm::make_unique<RequestNodeVisitor>( + Report->addVisitor(std::make_unique<RequestNodeVisitor>( RequestRegion, "Request is previously used by nonblocking call here. ")); Report->markInteresting(RequestRegion); @@ -73,8 +73,8 @@ void MPIBugReporter::reportUnmatchedWait( std::string ErrorText{"Request " + RequestRegion->getDescriptiveName() + " has no matching nonblocking call. "}; - auto Report = - llvm::make_unique<BugReport>(*UnmatchedWaitBugType, ErrorText, ExplNode); + auto Report = std::make_unique<PathSensitiveBugReport>(*UnmatchedWaitBugType, + ErrorText, ExplNode); Report->addRange(CE.getSourceRange()); SourceRange Range = RequestRegion->sourceRange(); @@ -84,20 +84,22 @@ void MPIBugReporter::reportUnmatchedWait( BReporter.emitReport(std::move(Report)); } -std::shared_ptr<PathDiagnosticPiece> +PathDiagnosticPieceRef MPIBugReporter::RequestNodeVisitor::VisitNode(const ExplodedNode *N, BugReporterContext &BRC, - BugReport &BR) { + PathSensitiveBugReport &BR) { if (IsNodeFound) return nullptr; const Request *const Req = N->getState()->get<RequestMap>(RequestRegion); + assert(Req && "The region must be tracked and alive, given that we've " + "just emitted a report against it"); const Request *const PrevReq = N->getFirstPred()->getState()->get<RequestMap>(RequestRegion); // Check if request was previously unused or in a different state. - if ((Req && !PrevReq) || (Req->CurrentState != PrevReq->CurrentState)) { + if (!PrevReq || (Req->CurrentState != PrevReq->CurrentState)) { IsNodeFound = true; ProgramPoint P = N->getFirstPred()->getLocation(); |