summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/BugReporter.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Use BugReport::getDescription() for the compiler warning text.Ted Kremenek2009-02-071-2/+2
| | | | llvm-svn: 64038
* Overhaul BugReporter interface and implementation. The new interface cleans upTed Kremenek2009-02-041-182/+196
| | | | | | | | | | | | | | | | | | | | | the ownership of BugTypes and BugReports. Now BugReports are owned by BugTypes, and BugTypes are owned by the BugReporter object. The major functionality change in this patch is that reports are not immediately emitted by a call to BugReporter::EmitWarning (now called EmitReport), but instead of queued up in report "equivalence classes". When BugReporter::FlushReports() is called, it emits one diagnostic per report equivalence class. This provides a nice cleanup with the caching of reports as well as enables the BugReporter engine to select the "best" path for reporting a path-sensitive bug based on all the locations in the ExplodedGraph that the same bug could occur. Along with this patch, Leaks are now coalesced into a common equivalence class by their allocation site, and the "summary" diagnostic for leaks now reports the allocation site as the location of the bug (this may later be augmented to also provide an example location where the leak occurs). llvm-svn: 63796
* PathDiagnostics:Ted Kremenek2009-01-271-0/+1
| | | | | | | | | | | | | - Add the distinction between the 'bug type' and the 'bug description' HTMLDiagnostics: - Output the bug type field as HTML comments scan-build: - Use the bug type field instead of the bug description for the HTML table. - Radar filing now automatically picks up the bug description in the title (addresses <rdar://problem/6265970>) llvm-svn: 63084
* More hacking on static analyzer diagnostics. When emitting summary ↵Ted Kremenek2009-01-241-108/+76
| | | | | | diagnostics the code paths for diagnostics involving paths or single locations are now unified. This patch also constifies many arguments/methods that are touched by this logic, leading to a nice overall code cleanup. llvm-svn: 62903
* Output summary diagnostic for each bug report.Ted Kremenek2009-01-231-7/+12
| | | | llvm-svn: 62885
* Added virtual method DiagnosticClient::IncludeInDiagnosticCounts(). This is ↵Ted Kremenek2009-01-231-0/+42
| | | | | | | | used by Diagnostics to determine if a diagnostic sent to a given DiagnosticClient should be included in the count of diagnostics. The default implementation of this method returns 'true'. Implemented DiagCollector::IncludeInDiagnosticCounts() to return 'false' so that the batching of diagnostics for use with BugReporter doesn't mess up the count of real diagnostics. llvm-svn: 62873
* more SourceLocation lexicon change: instead of referring to theChris Lattner2009-01-161-15/+8
| | | | | | "logical" location, refer to the "instantiation" location. llvm-svn: 62316
* Fix <rdar://problem/6454568>: BugReporter should correctly handle switch ↵Ted Kremenek2008-12-201-5/+7
| | | | | | statements with no default case. llvm-svn: 61270
* Rename SymbolID to SymbolRef. This is a precursor to some overhauling of ↵Ted Kremenek2008-12-051-6/+6
| | | | | | the representation of symbolic values. llvm-svn: 60575
* Rename NamedDecl::getName() to getNameAsString(). Replace a bunch of Chris Lattner2008-11-241-3/+3
| | | | | | | | | | | uses of getName() with uses of getDeclName(). This upgrades a bunch of diags to take DeclNames instead of std::strings. This also tweaks a couple of diagnostics to be cleaner and changes CheckInitializerTypes/PerformInitializationByConstructor to pass around DeclarationNames instead of std::strings. llvm-svn: 59947
* This reworks some of the Diagnostic interfaces a bit to change how diagnosticsChris Lattner2008-11-181-11/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | are formed. In particular, a diagnostic with all its strings and ranges is now packaged up and sent to DiagnosticClients as a DiagnosticInfo instead of as a ton of random stuff. This has the benefit of simplifying the interface, making it more extensible, and allowing us to do more checking for things like access past the end of the various arrays passed in. In addition to introducing DiagnosticInfo, this also substantially changes how Diagnostic::Report works. Instead of being passed in all of the info required to issue a diagnostic, Report now takes only the required info (a location and ID) and returns a fresh DiagnosticInfo *by value*. The caller is then free to stuff strings and ranges into the DiagnosticInfo with the << operator. When the dtor runs on the DiagnosticInfo object (which should happen at the end of the statement), the diagnostic is actually emitted with all of the accumulated information. This is a somewhat tricky dance, but it means that the accumulated DiagnosticInfo is allowed to keep pointers to other expression temporaries without those pointers getting invalidated. This is just the minimal change to get this stuff working, but this will allow us to eliminate the zillions of variant "Diag" methods scattered throughout (e.g.) sema. For example, instead of calling: Diag(BuiltinLoc, diag::err_overload_no_match, typeNames, SourceRange(BuiltinLoc, RParenLoc)); We will soon be able to just do: Diag(BuiltinLoc, diag::err_overload_no_match) << typeNames << SourceRange(BuiltinLoc, RParenLoc)); This scales better to support arbitrary types being passed in (not just strings) in a type-safe way. Go operator overloading?! llvm-svn: 59502
* eliminate dependence of strange "Diagnostic::Report" method, Chris Lattner2008-11-181-4/+6
| | | | | | delete huge trailing whitespace to fit in 80 cols. llvm-svn: 59497
* This patch did the following renaming. There should be no functional changes.Zhongxing Xu2008-10-171-9/+9
| | | | | | | | | | RVal => SVal LVal => Loc NonLVal => NonLoc lval => loc nonlval => nonloc llvm-svn: 57671
* Use DeclStmt::decl_iterator instead of using Decl::getDecl(). Soon ↵Ted Kremenek2008-10-061-2/+6
| | | | | | | | DeclStmts will wrap group of Decls. Added FIXME. llvm-svn: 57189
* This is a big patch, but the functionality change is small and the rest of ↵Ted Kremenek2008-10-041-78/+102
| | | | | | | | | | | | | | the patch consists of deltas due to API changes. This patch overhauls the "memory region" abstraction that was prototyped (but never really used) as part of the Store.h. This patch adds MemRegion.h and MemRegion.cpp, which defines the class MemRegion and its subclasses. This classes serve to define an abstract representation of memory, with regions being layered on other regions to to capture the relationships between fields and variables, variables and the address space they are allocated in, and so on. The main motivation of this patch is that key parts of the analyzer assumed that all value bindings were to VarDecls. In the future this won't be the case, and this patch removes lval::DeclVal and replaces it with lval::MemRegionVal. Now all pieces of the analyzer must reason about abstract memory blocks instead of just variables. There should be no functionality change from this patch, but it opens the door for significant improvements to the analyzer such as field-sensitivity and object-sensitivity, both which were on hold until the memory abstraction got generalized. The memory region abstraction also allows type-information to literally be affixed to a memory region. This will allow the some now redundant logic to be removed from the retain/release checker. llvm-svn: 57042
* Add "category" to BugTypes, allowing bugs to be grouped.Ted Kremenek2008-09-201-6/+12
| | | | | | Changed casing of many bug names. The convention will be to have bug names (mostly) lower cased, and categories use some capitalization. llvm-svn: 56385
* ProgramPoint now takes the space of two pointers instead of one. This change wasTed Kremenek2008-09-161-5/+2
| | | | | | | | | motivated because it became clear that the number of subclasses of ProgramPoint would expand and we ran out of bits to represent a pointer variant. As a plus of this change, BlockEdge program points can now be represented explicitly without using a cache of CFGBlock* pairs in CFG. llvm-svn: 56245
* Add missing spaces in path diagnostics.Ted Kremenek2008-09-121-3/+3
| | | | llvm-svn: 56166
* adjust to changes in various APIs from LLVM. We can't printChris Lattner2008-08-231-1/+3
| | | | | | | | an APInt directly to an ostream now, so add some hacks. It would be better to switch all of the bugreport (and friends) stuff over to raw_ostream. llvm-svn: 55264
* various updates to match r54873 on mainline.Chris Lattner2008-08-171-1/+1
| | | | llvm-svn: 54874
* Rename ValueState -> GRState.Ted Kremenek2008-08-131-40/+40
| | | | | | Rename ValueStateManager -> GRStateManager. llvm-svn: 54721
* Refactor Dead Stores error reporting to use the simplified ↵Ted Kremenek2008-07-141-2/+3
| | | | | | BugReporter::EmitBasicReport interface. llvm-svn: 53573
* Added method "EmitBasicReport" to BugReporter to simplify the emission of ↵Ted Kremenek2008-07-141-7/+23
| | | | | | | | simple bug diagnostics. Refactored error reporting in CheckObjCDealloc and CheckObjCInstMethSignature to use this new bug reporting interface (major code simplification). llvm-svn: 53560
* Refactored most of the "Store" piece of ValueState into a Store type. TheTed Kremenek2008-07-101-3/+3
| | | | | | | | | current store implementation is now encapsulated by BasicStore. These changes prompted some long due constification of ValueState. Much of the diffs in this patch include adding "const" qualifiers. llvm-svn: 53423
* Have BugReporter::getCFG and BugReporter::getLiveVariables returns pointers ↵Ted Kremenek2008-07-031-1/+1
| | | | | | | | instead of references, because they can both fail on functions we cannot construct full CFGs for yet. llvm-svn: 53081
* Refactored some of the BugReporter interface so that data such as the ↵Ted Kremenek2008-07-021-11/+12
| | | | | | | | ASTContext&, PathDiagnosticClient*, can be provided by an external source. Split BugReporter into BugReporter and GRBugReporter so checkers not based on GRExprEngine can still use the BugReporter mechanism. llvm-svn: 53048
* Modified the dead stores checker to...Ted Kremenek2008-06-201-0/+4
| | | | | | | | | | | | | | | | | 1) Check if a dead store appears as a subexpression. For such cases, we emit a verbose diagnostic so that users aren't confused. This addresses: <rdar://problem/5968508> checker gives misleading report for dead store in loop 2) Don't emit a dead store warning when assigning a null value to a pointer. This is a common form of defensive programming. We may wish to make this an option to the the checker one day. This addresses the feature request in the following email: http://lists.cs.uiuc.edu/pipermail/cfe-dev/2008-June/001978.html llvm-svn: 52555
* Added a new ProgramPoint: PostPurgeDeadSymbols. This new program point ↵Ted Kremenek2008-06-181-27/+70
| | | | | | distinguishes between the cases when we just evaluated the transfer function of a Stmt* (PostStmt) or performed a load (PostLoad). This solves a caching bug observed in a recent bug report. llvm-svn: 52443
* Fix non-termination bug reported by Thomas Clement!Ted Kremenek2008-06-171-1/+25
| | | | llvm-svn: 52426
* Prototyped support in the BugReporter to emit diagnostics of the form "p now ↵Ted Kremenek2008-05-221-2/+167
| | | | | | aliases q". llvm-svn: 51453
* Partitioned BugTypeCachedLocation::isCached() into two methods: one that ↵Ted Kremenek2008-05-161-1/+6
| | | | | | | | accepts and ExplodedNode, and the other that accepts a ProgramPoint. The default behavior is to cache bug reports by the location they occur (the end node). Subclasses can override this behavior by providing a different ProgramPoint. llvm-svn: 51197
* More refactorings in GeneratePathDiagnostic: use ExecutionContinues to displayTed Kremenek2008-05-061-14/+28
| | | | | | "Execution continues..." message, which does a better job at handling corner cases. llvm-svn: 50751
* Rename member variable.Ted Kremenek2008-05-021-4/+4
| | | | llvm-svn: 50597
* Added line number diagnostics to indicate the allocation site of the leaked ↵Ted Kremenek2008-05-011-4/+2
| | | | | | object. llvm-svn: 50553
* Do not highlight bogus ranges for leaks.Ted Kremenek2008-05-011-38/+42
| | | | llvm-svn: 50549
* added preliminary diagnostics in scan-build results to denote whetherTed Kremenek2008-04-301-0/+7
| | | | | | a CF memory leak occurred with GC enabled, etc. llvm-svn: 50507
* Fix bug in BugReporter where we didn't handle emitting diagnostics forTed Kremenek2008-04-251-10/+28
| | | | | | | | | | empty CFGBlocks that only contained a terminator. Added improved diagnostics for break and continue statements and default branches in switch statements. This fixes <rdar://problem/5889244>. llvm-svn: 50286
* Don't emit empty strings for path diagnostics when taking the default branch ↵Ted Kremenek2008-04-251-0/+7
| | | | | | of a switch statement that has no label. llvm-svn: 50242
* Do a better job at computing dead symbols.Ted Kremenek2008-04-251-3/+5
| | | | | | | | | Implemented support for better localized leaks in the CF reference count checker. Now leaks should be flagged close to where they occur. This should implement the desired functionality in <rdar://problem/5879592>, although the diagnostics still need to be improved. llvm-svn: 50241
* For case statements involving enums, BugReporter now generates PathDiagnosticsTed Kremenek2008-04-231-32/+38
| | | | | | | | that say that we are jumping to "case a" instead of "case 0". This is a feature implementation for <rdar://problem/5880430>. llvm-svn: 50197
* Fix minor regression in bug report generation.Ted Kremenek2008-04-231-2/+3
| | | | llvm-svn: 50195
* When building PathDiagnostics for bug reports, generate a trimmed ↵Ted Kremenek2008-04-231-18/+50
| | | | | | ExplodedGraph with a single path that BugReport objects can safely walk and introspect. llvm-svn: 50194
* For default branches in switch statements with no default label, print outTed Kremenek2008-04-221-3/+1
| | | | | | the line we are going to. llvm-svn: 50113
* PathDiagnosticClients now retain ownership of passed PathDiagnostics, requiringTed Kremenek2008-04-221-14/+13
| | | | | | | | | | them to not be stack-allocated. HTMLDiagnostics now batches PathDiagnostics before emitting HTML in its dtor. This is a workaround for a problem when we trampled the Preprocessor state when highlighting macros (sometimes resulting in an assertion failure). llvm-svn: 50102
* Another bug fix in emitting warnings without a path: construct a unit ↵Ted Kremenek2008-04-181-17/+25
| | | | | | | | PathDiagnostic as we did before. This allows the HTMLDiagnostic object to retrieve the bug type, bug description, etc. llvm-svn: 49939
* Reenable using the PathDiagnosticClient for BugReports without paths.Ted Kremenek2008-04-181-2/+5
| | | | llvm-svn: 49934
* Generalize caching mechanism for bugs reports. Now individual BugTypesTed Kremenek2008-04-181-6/+7
| | | | | | | | can decide the policy on how to cache related bugs. This allows us to properly to handle warning about multiple leaks in the same location in the ref count checker (not yet done). llvm-svn: 49918
* BugReport::VisitNode now takes BugReporter& instead of ASTContext&.Ted Kremenek2008-04-181-2/+2
| | | | | | | | Shuffled around code in CFRefCount to better pair classes with implementation, and started adding subclasses of RangedBugReport to handle better diagnostics for reference count bugs. llvm-svn: 49889
* Added null check.Ted Kremenek2008-04-181-0/+3
| | | | llvm-svn: 49887
* Simplified internal logic of BugReporter, consolidating EmitWarning andTed Kremenek2008-04-181-42/+40
| | | | | | | | EmitPathWarning into one method. We now properly handle emitting warnings without a PathDiagnosticClient when the warning does not involve a particular statement. llvm-svn: 49884
OpenPOWER on IntegriCloud