本文整理汇总了C++中CallEvent::getSourceRange方法的典型用法代码示例。如果您正苦于以下问题:C++ CallEvent::getSourceRange方法的具体用法?C++ CallEvent::getSourceRange怎么用?C++ CallEvent::getSourceRange使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CallEvent
的用法示例。
在下文中一共展示了CallEvent::getSourceRange方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: reportUnmatchedWait
/**
* Report there's no matching nonblocking call for request var used by wait.
*
* @param callExpr
* @param requestVar
* @param node
*/
void MPIBugReporter::reportUnmatchedWait(
const CallEvent &callEvent, const clang::ento::MemRegion *requestRegion,
const ExplodedNode *const node) const {
std::string errorText{"Request '" + util::variableName(requestRegion) +
"' has no matching nonblocking call. "};
auto bugReport =
llvm::make_unique<BugReport>(*unmatchedWaitBugType_, errorText, node);
bugReport->addRange(callEvent.getSourceRange());
SourceRange r = util::sourceRange(requestRegion);
if (r.isValid()) bugReport->addRange(r);
bugReporter_.emitReport(std::move(bugReport));
}
示例2: reportDoubleFetch
void DoubleFetchChecker::reportDoubleFetch(CheckerContext &Ctx, const CallEvent &Call) const {
// We reached a bug, stop exploring the path here by generating a sink.
ExplodedNode *ErrNode = Ctx.generateErrorNode(Ctx.getState());
// If we've already reached this node on another path, return.
if (!ErrNode)
return;
// Generate the report.
auto R = llvm::make_unique<BugReport>(*DoubleFetchType,
"Double-Fetch", ErrNode);
R->addRange(Call.getSourceRange());
Ctx.emitReport(std::move(R));
}
示例3: reportBlockInCritSection
void BlockInCriticalSectionChecker::reportBlockInCritSection(
SymbolRef BlockDescSym, const CallEvent &Call, CheckerContext &C) const {
ExplodedNode *ErrNode = C.generateNonFatalErrorNode();
if (!ErrNode)
return;
std::string msg;
llvm::raw_string_ostream os(msg);
os << "Call to blocking function '" << Call.getCalleeIdentifier()->getName()
<< "' inside of critical section";
auto R = llvm::make_unique<BugReport>(*BlockInCritSectionBugType, os.str(), ErrNode);
R->addRange(Call.getSourceRange());
R->markInteresting(BlockDescSym);
C.emitReport(std::move(R));
}
示例4: reportDoubleClose
void SimpleStreamChecker::reportDoubleClose(SymbolRef FileDescSym,
const CallEvent &Call,
CheckerContext &C) const {
// We reached a bug, stop exploring the path here by generating a sink.
ExplodedNode *ErrNode = C.generateErrorNode();
// If we've already reached this node on another path, return.
if (!ErrNode)
return;
// Generate the report.
auto R = llvm::make_unique<BugReport>(*DoubleCloseBugType,
"Closing a previously closed file stream", ErrNode);
R->addRange(Call.getSourceRange());
R->markInteresting(FileDescSym);
C.emitReport(std::move(R));
}
示例5: reportDoubleWait
/**
* Report duplicate request use by waits.
*
* @param observedCall
* @param requestVar
* @param node
*/
void MPIBugReporter::reportDoubleWait(const CallEvent &observedCall,
const RequestVar &requestVar,
const ExplodedNode *const node) const {
std::string lineNo{lineNumber(requestVar.lastUser_)};
std::string lastUser =
requestVar.lastUser_->getCalleeIdentifier()->getName();
std::string errorText{"Request '" + requestVar.variableName() +
"' is already waited upon by '" + lastUser +
"' in line " + lineNo + ". "};
auto bugReport =
llvm::make_unique<BugReport>(*doubleWaitBugType_, errorText, node);
bugReport->addRange(observedCall.getSourceRange());
bugReport->addRange(requestVar.lastUser_->getSourceRange());
SourceRange r = util::sourceRange(requestVar.memRegion_);
if (r.isValid()) bugReport->addRange(r);
bugReporter_.emitReport(std::move(bugReport));
}