diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Analysis/BugReporter.cpp | 44 | ||||
-rw-r--r-- | lib/Analysis/CFRefCount.cpp | 6 | ||||
-rw-r--r-- | lib/Analysis/PathDiagnostic.cpp | 4 |
3 files changed, 25 insertions, 29 deletions
diff --git a/lib/Analysis/BugReporter.cpp b/lib/Analysis/BugReporter.cpp index 88887b1d6c..12e50d3460 100644 --- a/lib/Analysis/BugReporter.cpp +++ b/lib/Analysis/BugReporter.cpp @@ -135,7 +135,7 @@ BugReport::getEndPath(BugReporter& BR, return NULL; FullSourceLoc L(S->getLocStart(), BR.getContext().getSourceManager()); - PathDiagnosticPiece* P = new PathDiagnosticPiece(L, getDescription()); + PathDiagnosticPiece* P = new PathDiagnosticEventPiece(L, getDescription()); const SourceRange *Beg, *End; getRanges(BR, Beg, End); @@ -481,7 +481,7 @@ public: std::string msg = "'" + std::string(VD->getNameAsString()) + "' now aliases '" + MostRecent->getNameAsString() + "'"; - PD.push_front(new PathDiagnosticPiece(L, msg)); + PD.push_front(new PathDiagnosticEventPiece(L, msg)); } return true; @@ -643,8 +643,7 @@ void GRBugReporter::GeneratePathDiagnostic(PathDiagnostic& PD, os << "Control jumps to line " << SMgr.getInstantiationLineNumber(S->getLocStart()) << ".\n"; - PD.push_front(new PathDiagnosticPiece(L, os.str(), - PathDiagnosticPiece::ControlFlow)); + PD.push_front(new PathDiagnosticControlFlowPiece(L, os.str())); break; } @@ -712,8 +711,7 @@ void GRBugReporter::GeneratePathDiagnostic(PathDiagnostic& PD, ExecutionContinues(os, SMgr, N, getStateManager().getCodeDecl()); } - PD.push_front(new PathDiagnosticPiece(L, os.str(), - PathDiagnosticPiece::ControlFlow)); + PD.push_front(new PathDiagnosticControlFlowPiece(L, os.str())); break; } @@ -722,8 +720,7 @@ void GRBugReporter::GeneratePathDiagnostic(PathDiagnostic& PD, std::string sbuf; llvm::raw_string_ostream os(sbuf); ExecutionContinues(os, SMgr, N, getStateManager().getCodeDecl()); - PD.push_front(new PathDiagnosticPiece(L, os.str(), - PathDiagnosticPiece::ControlFlow)); + PD.push_front(new PathDiagnosticControlFlowPiece(L, os.str())); break; } @@ -737,8 +734,7 @@ void GRBugReporter::GeneratePathDiagnostic(PathDiagnostic& PD, else os << "true."; - PD.push_front(new PathDiagnosticPiece(L, os.str(), - PathDiagnosticPiece::ControlFlow)); + PD.push_front(new PathDiagnosticControlFlowPiece(L, os.str())); break; } @@ -751,13 +747,11 @@ void GRBugReporter::GeneratePathDiagnostic(PathDiagnostic& PD, os << "Loop condition is true. "; ExecutionContinues(os, SMgr, N, getStateManager().getCodeDecl()); - PD.push_front(new PathDiagnosticPiece(L, os.str(), - PathDiagnosticPiece::ControlFlow)); + PD.push_front(new PathDiagnosticControlFlowPiece(L, os.str())); } else - PD.push_front(new PathDiagnosticPiece(L, - "Loop condition is false. Exiting loop.", - PathDiagnosticPiece::ControlFlow)); + PD.push_front(new PathDiagnosticControlFlowPiece(L, + "Loop condition is false. Exiting loop.")); break; } @@ -772,24 +766,22 @@ void GRBugReporter::GeneratePathDiagnostic(PathDiagnostic& PD, os << "Loop condition is false. "; ExecutionContinues(os, SMgr, N, getStateManager().getCodeDecl()); - PD.push_front(new PathDiagnosticPiece(L, os.str(), - PathDiagnosticPiece::ControlFlow)); + PD.push_front(new PathDiagnosticControlFlowPiece(L, os.str())); } else - PD.push_front(new PathDiagnosticPiece(L, - "Loop condition is true. Entering loop body.", - PathDiagnosticPiece::ControlFlow)); + PD.push_front(new PathDiagnosticControlFlowPiece(L, + "Loop condition is true. Entering loop body.")); break; } case Stmt::IfStmtClass: { if (*(Src->succ_begin()+1) == Dst) - PD.push_front(new PathDiagnosticPiece(L, "Taking false branch.", - PathDiagnosticPiece::ControlFlow)); + PD.push_front(new PathDiagnosticControlFlowPiece(L, + "Taking false branch.")); else - PD.push_front(new PathDiagnosticPiece(L, "Taking true branch.", - PathDiagnosticPiece::ControlFlow)); + PD.push_front(new PathDiagnosticControlFlowPiece(L, + "Taking true branch.")); break; } @@ -872,7 +864,9 @@ void BugReporter::FlushReport(BugReportEquivClass& EQ) { return; if (D->empty()) { - PathDiagnosticPiece* piece = new PathDiagnosticPiece(L, R.getDescription()); + PathDiagnosticPiece* piece = + new PathDiagnosticEventPiece(L, R.getDescription()); + for ( ; Beg != End; ++Beg) piece->addRange(*Beg); D->push_back(piece); } diff --git a/lib/Analysis/CFRefCount.cpp b/lib/Analysis/CFRefCount.cpp index 6caea59f3e..b08bce1d58 100644 --- a/lib/Analysis/CFRefCount.cpp +++ b/lib/Analysis/CFRefCount.cpp @@ -2506,7 +2506,7 @@ PathDiagnosticPiece* CFRefReport::VisitNode(const ExplodedNode<GRState>* N, } FullSourceLoc Pos(S->getLocStart(), BR.getContext().getSourceManager()); - PathDiagnosticPiece* P = new PathDiagnosticPiece(Pos, os.str()); + PathDiagnosticPiece* P = new PathDiagnosticEventPiece(Pos, os.str()); if (Expr* Exp = dyn_cast<Expr>(S)) P->addRange(Exp->getSourceRange()); @@ -2655,7 +2655,7 @@ PathDiagnosticPiece* CFRefReport::VisitNode(const ExplodedNode<GRState>* N, Stmt* S = cast<PostStmt>(N->getLocation()).getStmt(); FullSourceLoc Pos(S->getLocStart(), BR.getContext().getSourceManager()); - PathDiagnosticPiece* P = new PathDiagnosticPiece(Pos, os.str()); + PathDiagnosticPiece* P = new PathDiagnosticEventPiece(Pos, os.str()); // Add the range by scanning the children of the statement for any bindings // to Sym. @@ -2844,7 +2844,7 @@ CFRefLeakReport::getEndPath(BugReporter& br, const ExplodedNode<GRState>* EndN){ " +" << RV->getCount() << " (object leaked)."; - return new PathDiagnosticPiece(L, os.str()); + return new PathDiagnosticEventPiece(L, os.str()); } diff --git a/lib/Analysis/PathDiagnostic.cpp b/lib/Analysis/PathDiagnostic.cpp index 49af34dc1c..ae53ed9dbf 100644 --- a/lib/Analysis/PathDiagnostic.cpp +++ b/lib/Analysis/PathDiagnostic.cpp @@ -50,6 +50,8 @@ PathDiagnosticPiece::PathDiagnosticPiece(FullSourceLoc pos, } PathDiagnosticPiece::~PathDiagnosticPiece() {} +PathDiagnosticEventPiece::~PathDiagnosticEventPiece() {} +PathDiagnosticControlFlowPiece::~PathDiagnosticControlFlowPiece() {} PathDiagnosticMacroPiece::~PathDiagnosticMacroPiece() { for (iterator I = begin(), E = end(); I != E; ++I) delete *I; @@ -99,7 +101,7 @@ void PathDiagnosticClient::HandleDiagnostic(Diagnostic::Level DiagLevel, Info.FormatDiagnostic(StrC); PathDiagnosticPiece *P = - new PathDiagnosticPiece(Info.getLocation(), + new PathDiagnosticEventPiece(Info.getLocation(), std::string(StrC.begin(), StrC.end())); for (unsigned i = 0, e = Info.getNumRanges(); i != e; ++i) |