aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/BugReporter.cpp
AgeCommit message (Collapse)Author
2009-04-29BugReporter/PathDiagnostics:Ted Kremenek
- Add an (optional) short description for BugReports for clients that want to distinguish between long and short descriptions for bugs - Make the bug report for VLA less obscene for Plist diagnostics by using the short description git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70415 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-28Extensive diagnostics: Do not add a location context for do...while statements.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70286 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-28BugReporter (extensive diagnostics): Clean up do...while control-flow edges, andTed Kremenek
add "Looping back to the head of the loop" diagnostic for loops. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70285 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-26Implement function-try-blocks. However, there's a very subtle bug that I ↵Sebastian Redl
can't track down. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70155 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-26Minor code cleanup.Eli Friedman
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70144 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-26split ObjC and C++ Statements out into their own headers.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70105 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-23BugReporter (extensive diagnostics): Recursively adjust the referred expressionTed Kremenek
when popping location contexts. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69898 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-23BugReporter (extensive diagnostics): Ignore parentheses when added control-flowTed Kremenek
pieces for location contexts. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69895 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-22BugReporter (extensive diagnostics): Use correct location for location contexts.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69824 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-22BugReporter (extensive diagnostics): always add an edge if there is no locationTed Kremenek
context. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69823 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-22BugReporter (extensive diagnostics):Ted Kremenek
- Remove stale assertion that was breaking the test suite. - When popping location contexts, only add a control-flow piece for fileID locations. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69814 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-22BugReporter (extensive diagnostic algorithm): The initial control-flow edge nowTed Kremenek
starts from the first character of the first statement. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69813 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-18FunctionDecl::getBody() is getting an ASTContext argument for use inDouglas Gregor
lazy PCH deserialization. Propagate that argument wherever it needs to be. No functionality change, except that I've tightened up a few PCH tests in preparation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69406 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-07Removed some commented code.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68495 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-07PathDiagnostic generation: experiment with avoiding generation of control-flowTed Kremenek
pieces between block entrance and block end unless necessary. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68483 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-07Don't overguard to adding a control-flow piece when "alwaysAdd" is true.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68476 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-06Rewrite control-flow diagnostic generation "extensive" algorithm using "edgeTed Kremenek
contexts". This allows us to use a stack of contexts to keep track of what control-flow pieces to include when exiting blocks like 'if', 'for', etc. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68473 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-02Add another null pointer check. Simplify condition.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68283 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-02Add null pointer check.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68281 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-01BugReporter, extensive path-diagnostics: add an extra control-flow edge to theTed Kremenek
enclosing statement when jumping to a subexpression. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68244 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-01Fix comment.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68236 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-01BugReporter: for extensive path diagnostics:Ted Kremenek
- When processing BlockEdges with terminators, using the condition as the control-flow point for terminators that are expressions (e.g., '&&', '?') - When processing events, allow intra-compound statement "jumping" git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68228 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-01BugReporter: for extensive PathDiagnostic generation, add control-flow from theTed Kremenek
start of the function/method. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68217 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-01BugReporter: For the "extensive" PathDiagnostic generation algorithm, elide mostTed Kremenek
intra-compound statement jumps unless they are between terminators (i.e., branches). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68216 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-01- Changed PathDiagnosticPiece::getLocation() to return a PathDiagnosticLocationTed Kremenek
instead of a FullSourceLoc. This resulted in a bunch of small edits in various clients. - Updated BugReporter to include an alternate PathDiagnostic generation algorithm for PathDiagnosticClients desiring more control-flow pieces. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68193 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-31More code reshuffling. No functionality change.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68157 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-31Allow two codepaths for PathDiagnostic generation. This patch mainly consists ofTed Kremenek
refactoring to make this possible (no functionality change). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68141 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-30Simplify more code by using SVal::getAsSymbol().Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68052 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-30Convert use of loc::SymbolVal and nonloc::SymbolVal to V.getAsSymbol(). ThisTed Kremenek
also makes this code more correct as it transparently handles SVals that wrapped TypedViewRegions(SymbolicRegions). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68048 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-28Adjust control-flow endpoints for '&&' and '||'.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67948 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-28Text PathDiagnosticBuilder::getEnclosingStmt() about '?'Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67909 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-28Teach PathDiagnosticBuilder::getEnclosingStmtLocation() about while/if/do/for,Ted Kremenek
etc., so that the "body" is always considered a top-level statement for edge transitions (even if it is an expression). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67901 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-27BugReporter: For control-flow edges from 'if', 'for', 'do', 'while' toTed Kremenek
successor, using 'getEnclosingStmt()' to have the end location be the top-level Stmt* enclosing the target Expr*. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67869 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-27BugReporter: PathDiagnosticBuilder::ExecutionContinues now returns aTed Kremenek
PathDiagnosticLocation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67866 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-27BugReporter:Ted Kremenek
- Added an internal helper class 'PathDiagnosticBuilder' which now bundles the 'ExecutionContinues' methods. - Added preliminary diagnostics for short-circuit '&&' and '||' git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67822 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-26- Add class PathDiagosticLocationPair.Ted Kremenek
- Have PathDiagnosticControlFlowPiece use a vector of PathDiagnosticLocationPairs to represent transitions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67786 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-26analyzer infrastructure: make a bunch of changes to symbolic expressions thatTed Kremenek
Zhongxing and I discussed by email. Main changes: - Removed SymIntConstraintVal and SymIntConstraint - Added SymExpr as a parent class to SymbolData, SymSymExpr, SymIntExpr - Added nonloc::SymExprVal to wrap SymExpr - SymbolRef is now just a typedef of 'const SymbolData*' - Bunch of minor code cleanups in how some methods were invoked (no functionality change) This changes are part of a long-term plan to have full symbolic expression trees. This will be useful for lazily evaluating complicated expressions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67731 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-12Use the correct data structures!Ted Kremenek
ExplodedGraph::TrimGraph: - Just do a DFS both ways instead of BFS-DFS. We're just determining what subset of the nodes are reachable from the root and reverse-reachable from the bug nodes. DFS is more efficient for this task. BugReporter: - MakeReportGraph: Do a reverse-BFS instead of a reverse-DFS to determine the approximate shortest path through the simulation graph. We were seeing some weird cases where too many loops were being reported for simple bugs. Possibly we will need to replace this with actually computing the shortest path in terms of line numbers. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66842 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-12PathDiagnostics:Ted Kremenek
- PathDiagnosticControlFlowPiece now consists of a "start" and "end" location to indicating the branch location and where the branch goes. BugReporter: - Updated BugReporter to construct PathDiagnosticControlFlowPiece objects with "end" locations. PlistDiagnostics: - Plists now contain the bug "type" (not just bug "category") - Plists now encode control-flow pieces differently than events; now the "start" and "end" locations are recorded git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66818 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-10BugReporter:Ted Kremenek
- Group control flow and event PathDiagnosticPieces into PathDiagnosticMacroPieces. - Afterwards, eliminate any PathDiagnosticMacroPieces from a PathDiagnostic that contain no informative events. HTMLDiagnostics: - Use new information about PathDiagnosticMacroPieces to specially format message bubbles for macro expansions containing interesting events. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66524 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-06Create PathDiagnosticPiece subclasses PathDiagnosticEventPiece andTed Kremenek
PathDiagnosticControlFlowPiece to distinguish (in the class hierarchy) between events and control-flow diagnostic pieces. Clients must now use these directly when constructing PathDiagnosticPieces. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66310 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-05BasicStore:Ted Kremenek
- Store bindings using a MemRegion -> SVal binding instead of VarDecl -> SVal binding. This mirrors some of the idea of RegionStore, but is far simpler and not nearly as functional. This leads to some code simplification and some potential for some minor precision hacks. Along the way... - constify the use of MemRegion* in a few places - add operator<<(llvm::raw_ostream, const MemRegion*) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66163 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-03Rework use of loc::SymbolVal in the retain/release checker to use the new methodTed Kremenek
SVal::getAsLocSymbol(). This simplifies the code and allows the retain/release checker to (I believe) also correctly reason about location symbols wrapped in SymbolicRegions. Along the way I cleaned up SymbolRef a little, disallowing implicit casts to 'unsigned'. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65972 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-02BugReporter: Construct path-related PathDiagnosticPieces with kind ↵Ted Kremenek
"ControlFlow". git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65876 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-27When retrieving the location of a Node, for MemberExprs use the location of theTed Kremenek
'.' or '->'. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65651 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-26Use Loc::IsLocType() instead of isPointerType() and isReferenceType().Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65568 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-26Drop uses of isPointerLikeType.Daniel Dunbar
- No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65560 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-23Tidy up 'ExecutionContinues' to distinguish between jumping to the end of a ↵Ted Kremenek
'method' or 'funciton'. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65346 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-23Tidy up the path diagnostic generation logic in BugReporter and remove a ↵Ted Kremenek
case where an "Execution continues..." diagnostic could result in an empty message bubble. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65342 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-18Hooked up the necessary machinery to allow the retain/release checker referenceTed Kremenek
back to the summary used when evaluating the statement associated with a simulation node. This is now being used to help improve the checker's diagnostics. To get things started, the checker now emits a path diagnostic indicating that 'autorelease' is a no-op in GC mode. Some of these changes are exposing further grossness in the interface between BugReporter and the ExplodedGraph::Trim facilities. These really need to be cleaned up one day. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64881 91177308-0d34-0410-b5e6-96231b3b80d8