diff options
author | Ted Kremenek <kremenek@apple.com> | 2009-03-26 23:12:02 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2009-03-26 23:12:02 +0000 |
commit | 46dee7b0f636c1f56d63262b283f7a8c2d20a4a7 (patch) | |
tree | 25d166c87100195f763d8ceb73cc4b1c3dd9d087 /clang/lib/Analysis/BugReporter.cpp | |
parent | d88ebc352c685a5065a0047393f8e44931a7d4db (diff) | |
download | bcm5719-llvm-46dee7b0f636c1f56d63262b283f7a8c2d20a4a7.tar.gz bcm5719-llvm-46dee7b0f636c1f56d63262b283f7a8c2d20a4a7.zip |
- Add class PathDiagosticLocationPair.
- Have PathDiagnosticControlFlowPiece use a vector of PathDiagnosticLocationPairs to represent transitions.
llvm-svn: 67786
Diffstat (limited to 'clang/lib/Analysis/BugReporter.cpp')
-rw-r--r-- | clang/lib/Analysis/BugReporter.cpp | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/clang/lib/Analysis/BugReporter.cpp b/clang/lib/Analysis/BugReporter.cpp index 6807c9f08e0..f1340f48114 100644 --- a/clang/lib/Analysis/BugReporter.cpp +++ b/clang/lib/Analysis/BugReporter.cpp @@ -85,31 +85,31 @@ static inline Stmt* GetCurrentOrNextStmt(const ExplodedNode<GRState>* N) { // Diagnostics for 'execution continues on line XXX'. //===----------------------------------------------------------------------===// -static SourceLocation ExecutionContinues(SourceManager& SMgr, - const ExplodedNode<GRState>* N, - const Decl& D, - bool* OutHasStmt = 0) { +static FullSourceLoc ExecutionContinues(SourceManager& SMgr, + const ExplodedNode<GRState>* N, + const Decl& D, + bool* OutHasStmt = 0) { if (Stmt *S = GetNextStmt(N)) { if (OutHasStmt) *OutHasStmt = true; - return S->getLocStart(); + return FullSourceLoc(S->getLocStart(), SMgr); } else { if (OutHasStmt) *OutHasStmt = false; - return D.getBody()->getRBracLoc(); + return FullSourceLoc(D.getBody()->getRBracLoc(), SMgr); } } -static SourceLocation ExecutionContinues(llvm::raw_string_ostream& os, - SourceManager& SMgr, - const ExplodedNode<GRState>* N, - const Decl& D) { +static FullSourceLoc ExecutionContinues(llvm::raw_string_ostream& os, + SourceManager& SMgr, + const ExplodedNode<GRState>* N, + const Decl& D) { // Slow, but probably doesn't matter. if (os.str().empty()) os << ' '; bool hasStmt; - SourceLocation Loc = ExecutionContinues(SMgr, N, D, &hasStmt); + FullSourceLoc Loc = ExecutionContinues(SMgr, N, D, &hasStmt); if (hasStmt) os << "Execution continues on line " @@ -749,7 +749,7 @@ void GRBugReporter::GeneratePathDiagnostic(PathDiagnostic& PD, std::string sbuf; llvm::raw_string_ostream os(sbuf); - SourceLocation End = S->getLocStart(); + FullSourceLoc End(S->getLocStart(), SMgr); os << "Control jumps to line " << SMgr.getInstantiationLineNumber(End); PD.push_front(new PathDiagnosticControlFlowPiece(Start, End, @@ -761,10 +761,10 @@ void GRBugReporter::GeneratePathDiagnostic(PathDiagnostic& PD, // Figure out what case arm we took. std::string sbuf; llvm::raw_string_ostream os(sbuf); - SourceLocation End; + FullSourceLoc End; if (Stmt* S = Dst->getLabel()) { - End = S->getLocStart(); + End = FullSourceLoc(S->getLocStart(), SMgr); switch (S->getStmtClass()) { default: @@ -832,8 +832,8 @@ void GRBugReporter::GeneratePathDiagnostic(PathDiagnostic& PD, case Stmt::ContinueStmtClass: { std::string sbuf; llvm::raw_string_ostream os(sbuf); - SourceLocation End = ExecutionContinues(os, SMgr, N, - getStateManager().getCodeDecl()); + FullSourceLoc End = + ExecutionContinues(os, SMgr, N, getStateManager().getCodeDecl()); PD.push_front(new PathDiagnosticControlFlowPiece(Start, End, os.str())); break; @@ -849,7 +849,7 @@ void GRBugReporter::GeneratePathDiagnostic(PathDiagnostic& PD, else os << "true"; - SourceLocation End = + FullSourceLoc End = ExecutionContinues(SMgr, N, getStateManager().getCodeDecl()); PD.push_front(new PathDiagnosticControlFlowPiece(Start, End, @@ -863,13 +863,13 @@ void GRBugReporter::GeneratePathDiagnostic(PathDiagnostic& PD, llvm::raw_string_ostream os(sbuf); os << "Loop condition is true. "; - SourceLocation End = + FullSourceLoc End = ExecutionContinues(os, SMgr, N, getStateManager().getCodeDecl()); PD.push_front(new PathDiagnosticControlFlowPiece(Start, End, os.str())); } else { - SourceLocation End = + FullSourceLoc End = ExecutionContinues(SMgr, N, getStateManager().getCodeDecl()); PD.push_front(new PathDiagnosticControlFlowPiece(Start, End, "Loop condition is false. Exiting loop")); @@ -885,14 +885,14 @@ void GRBugReporter::GeneratePathDiagnostic(PathDiagnostic& PD, llvm::raw_string_ostream os(sbuf); os << "Loop condition is false. "; - SourceLocation End = + FullSourceLoc End = ExecutionContinues(os, SMgr, N, getStateManager().getCodeDecl()); PD.push_front(new PathDiagnosticControlFlowPiece(Start, End, os.str())); } else { - SourceLocation End = + FullSourceLoc End = ExecutionContinues(SMgr, N, getStateManager().getCodeDecl()); PD.push_front(new PathDiagnosticControlFlowPiece(Start, End, @@ -903,7 +903,7 @@ void GRBugReporter::GeneratePathDiagnostic(PathDiagnostic& PD, } case Stmt::IfStmtClass: { - SourceLocation End = + FullSourceLoc End = ExecutionContinues(SMgr, N, getStateManager().getCodeDecl()); if (*(Src->succ_begin()+1) == Dst) |