clang: lib/StaticAnalyzer/Checkers/MPI-Checker/MPIBugReporter.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

18

20namespace ento {

21namespace mpi {

22

25 const MemRegion *const RequestRegion,

28

29 std::string ErrorText;

30 ErrorText = "Double nonblocking on request " +

32

33 auto Report = std::make_unique(

34 DoubleNonblockingBugType, ErrorText, ExplNode);

35

38

39 if (Range.isValid())

41

42 Report->addVisitor(std::make_unique(

43 RequestRegion, "Request is previously used by nonblocking call here. "));

44 Report->markInteresting(RequestRegion);

45

47}

48

53 std::string ErrorText{"Request " + RequestRegion->getDescriptiveName() +

54 " has no matching wait. "};

55

56 auto Report = std::make_unique(MissingWaitBugType,

57 ErrorText, ExplNode);

58

60 if (Range.isValid())

62 Report->addVisitor(std::make_unique(

63 RequestRegion, "Request is previously used by nonblocking call here. "));

64 Report->markInteresting(RequestRegion);

65

67}

68

73 std::string ErrorText{"Request " + RequestRegion->getDescriptiveName() +

74 " has no matching nonblocking call. "};

75

76 auto Report = std::make_unique(UnmatchedWaitBugType,

77 ErrorText, ExplNode);

78

81 if (Range.isValid())

83

85}

86

88MPIBugReporter::RequestNodeVisitor::VisitNode(const ExplodedNode *N,

91

92 if (IsNodeFound)

93 return nullptr;

94

96 assert(Req && "The region must be tracked and alive, given that we've "

97 "just emitted a report against it");

98 const Request *const PrevReq =

100

101

103 IsNodeFound = true;

104

108

109 return std::make_shared(L, ErrorText);

110 }

111

112 return nullptr;

113}

114

115}

116}

117}

This file defines prefabricated reports which are emitted in case of MPI related bugs,...

This file defines the main class of MPI-Checker which serves as an entry point.

A trivial tuple used to represent a source range.

const SourceManager & getSourceManager() const

BugReporter is a utility class for generating PathDiagnostics for analysis.

virtual void emitReport(std::unique_ptr< BugReport > R)

Add the given report to the set of reports tracked by BugReporter.

Represents an abstract call to a function or method along a particular path.

virtual SourceRange getSourceRange() const

Returns a source range for the entire call, suitable for outputting in diagnostics.

const ProgramStateRef & getState() const

ProgramPoint getLocation() const

getLocation - Returns the edge associated with the given node.

ExplodedNode * getFirstPred()

MemRegion - The root abstract class for all memory regions.

std::string getDescriptiveName(bool UseQuotes=true) const

Get descriptive name for memory region.

SourceRange sourceRange() const

Retrieve source range from memory region.

static PathDiagnosticLocation create(const Decl *D, const SourceManager &SM)

Create a location corresponding to the given declaration.

A Range represents the closed range [from, to].

void reportMissingWait(const Request &Req, const MemRegion *const RequestRegion, const ExplodedNode *const ExplNode, BugReporter &BReporter) const

Report a missing wait for a nonblocking call.

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.

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.

std::shared_ptr< PathDiagnosticPiece > PathDiagnosticPieceRef

The JSON file list parser is used to communicate input to InstallAPI.