36 if (!isa<TypedRegion>(MR) || (ER && !isa<TypedRegion>(ER->
getSuperRegion())))
43 if (Req && Req->
CurrentState == Request::State::Nonblocking) {
51 State = State->set<
RequestMap>(MR, Request::State::Nonblocking);
60 const MemRegion *
const MR = topRegionUsedByWait(PreCallEvent);
66 if (!isa<TypedRegion>(MR) || (ER && !isa<TypedRegion>(ER->
getSuperRegion())))
70 allRegionsUsedByWait(ReqRegions, MR, PreCallEvent, Ctx);
71 if (ReqRegions.empty())
79 for (
const auto &ReqRegion : ReqRegions) {
81 State = State->set<
RequestMap>(ReqRegion, Request::State::Wait);
85 State = ErrorNode->getState();
103 const auto &Requests = State->get<
RequestMap>();
104 if (Requests.isEmpty())
111 for (
const auto &Req : ReqMap) {
113 if (Req.second.CurrentState == Request::State::Nonblocking) {
117 State = ErrorNode->getState();
145 void MPIChecker::allRegionsUsedByWait(
154 SuperRegion = cast<SubRegion>(ER->getSuperRegion());
159 ReqRegions.push_back(MR);
168 for (
size_t i = 0; i < ArrSize; ++i) {
178 ReqRegions.push_back(MR);
191 bool clang::ento::shouldRegisterMPIChecker(
const LangOptions &LO) {
virtual DefinedOrUnknownSVal getSizeInElements(ProgramStateRef state, const MemRegion *region, QualType EleTy)
MemRegion - The root abstract class for all memory regions.
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee...
ExplodedNode * addTransition(ProgramStateRef State=nullptr, const ProgramPointTag *Tag=nullptr)
Generates a new transition in the program state graph (ExplodedGraph).
const ProgramStateRef & getState() const
Value representing integer constant.
NonLoc makeArrayIndex(uint64_t idx)
void checkDoubleNonblocking(const clang::ento::CallEvent &PreCallEvent, clang::ento::CheckerContext &Ctx) const
Checks if a request is used by nonblocking calls multiple times in sequence without intermediate wait...
const MemRegion * getSuperRegion() const
void reportDoubleNonblocking(const CallEvent &MPICallEvent, const Request &Req, const MemRegion *const RequestRegion, const ExplodedNode *const ExplNode, BugReporter &BReporter) const
Report duplicate request use by nonblocking calls without intermediate wait.
virtual const Expr * getArgExpr(unsigned Index) const
Returns the expression associated with a given argument.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
BugReporter & getBugReporter()
void reportUnmatchedWait(const CallEvent &CE, const MemRegion *const RequestRegion, const ExplodedNode *const ExplNode, BugReporter &BReporter) const
Report a wait on a request that has not been used at all before.
bool isLiveRegion(const MemRegion *region)
void reportMissingWait(const Request &Req, const MemRegion *const RequestRegion, const ExplodedNode *const ExplNode, BugReporter &BReporter) const
Report a missing wait for a nonblocking call.
const RegionTy * getAs() const
This file defines the main class of MPI-Checker which serves as an entry point.
const IdentifierInfo * getCalleeIdentifier() const
Returns the name of the callee, if its name is a simple identifier.
static SVal getValue(SVal val, SValBuilder &svalBuilder)
ExplodedNode * generateNonFatalErrorNode(ProgramStateRef State=nullptr, const ProgramPointTag *Tag=nullptr)
Generate a transition to a node that will be used to report an error.
StoreManager & getStoreManager()
CHECKER * registerChecker(AT &&... Args)
Used to register checkers.
const MemRegion * getAsRegion() const
A class responsible for cleaning up unused symbols.
Dataflow Directional Tag Classes.
ASTContext & getASTContext()
const ElementRegion * getElementRegion(QualType elementType, NonLoc Idx, const SubRegion *superRegion, ASTContext &Ctx)
getElementRegion - Retrieve the memory region associated with the associated element type...
Represents an abstract call to a function or method along a particular path.
virtual MemRegionManager * getMemRegionManager() const =0
SubRegion - A region that subsets another larger region.
const ProgramStateRef & getState() const
virtual unsigned getNumArgs() const =0
Returns the number of arguments (explicit and implicit).
SValBuilder & getSValBuilder()
ElementRegion is used to represent both array elements and casts.
void checkUnmatchedWaits(const clang::ento::CallEvent &PreCallEvent, clang::ento::CheckerContext &Ctx) const
Checks if the request used by the wait function was not used at all before.
virtual SVal getArgSVal(unsigned Index) const
Returns the value of a given argument at the time of the call.
Tag that can use a checker name as a message provider (see SimpleProgramPointTag).
void checkMissingWaits(clang::ento::SymbolReaper &SymReaper, clang::ento::CheckerContext &Ctx) const
Check if a nonblocking call is not matched by a wait.