summaryrefslogtreecommitdiffstats
path: root/clang/lib/Checker/MallocChecker.cpp
Commit message (Collapse)AuthorAgeFilesLines
* "I see dead code". IdempotentOperationChecker::isTruncationExtensionAssignmentChris Lattner2010-09-031-3/+3
| | | | | | | | | should probably be removed if it has no purpose, but I just #if'd it out in case it's usefulIdempotentOperationChecker::isTruncationExtensionAssignment should probably be removed if it has no purpose, but I just #if'd it out in case it's useful llvm-svn: 112949
* For GRExprEngine::EvalBind() (and called visitors), unifiy StoreE and ↵Ted Kremenek2010-09-021-4/+2
| | | | | | AssignE. Now StoreE (const Stmt*) represents the expression where the store took place, which is the assignment expression if it takes place in an assignment. This removes some conceptual dissidence as well as removes an extra parameter from the Checker::PreVisitBind() visitor. It also improves ranges and source location information in analyzer diagnostics. llvm-svn: 112789
* GCC didn't care for my attempt at API compatibility, so brute-force everythingJohn McCall2010-08-251-1/+1
| | | | | | to the new constants. llvm-svn: 112047
* Generate Attr subclasses with TableGen.Alexis Hunt2010-08-181-16/+21
| | | | | | | | | | | | | | | | | | | | | | | | Now all classes derived from Attr are generated from TableGen. Additionally, Attr* is no longer its own linked list; SmallVectors or Attr* are used. The accompanying LLVM commit contains the updates to TableGen necessary for this. Some other notes about newly-generated attribute classes: - The constructor arguments are a SourceLocation and a Context&, followed by the attributes arguments in the order that they were defined in Attr.td - Every argument in Attr.td has an appropriate accessor named getFoo, and there are sometimes a few extra ones (such as to get the length of a variadic argument). Additionally, specific_attr_iterator has been introduced, which will iterate over an AttrVec, but only over attributes of a certain type. It can be accessed through either Decl::specific_attr_begin/end or the global functions of the same name. llvm-svn: 111455
* Remove dead malloc symbols from the symbol-state map.Jordy Rose2010-08-181-0/+7
| | | | llvm-svn: 111353
* Use RegionStateTy everywhere we mean ImmutableMap<SymbolRef, RefState>Jordy Rose2010-08-181-4/+3
| | | | llvm-svn: 111351
* Generate a node instead of a sink. A leak is not a fatal error.Zhongxing Xu2010-08-171-1/+1
| | | | llvm-svn: 111217
* Implement MallocChecker::EvalDeadSymbols() with the new API. This time weZhongxing Xu2010-08-151-15/+16
| | | | | | iterate over symbols being tracked, instead of symbols being dead. llvm-svn: 111097
* Remove OwnershipAttr::Kind, since it's essentially redundant with attr::Kind ↵Jordy Rose2010-08-121-19/+17
| | | | | | the way it's being used. Also fix isa<OwnershipAttr> support, break more-than-80-char lines, and other miscellaneous ownership attr cleanup. llvm-svn: 110908
* Fix 80 col. violations.Ted Kremenek2010-08-061-6/+14
| | | | llvm-svn: 110473
* Nest variable declaration into into 'if' condition, thus restricting the ↵Ted Kremenek2010-08-061-7/+3
| | | | | | scope of the variable and condensing the code. llvm-svn: 110472
* Use 'GenerateNode()' instead of 'GenerateSink()' when reporting a leak. A ↵Ted Kremenek2010-08-061-3/+3
| | | | | | leak is not a hard enough bug to stop analyzing a path. llvm-svn: 110471
* Change the checker callback cache in GRExprEngine to be more compact (and ↵Jordy Rose2010-08-041-2/+4
| | | | | | | | IMHO a little easier to understand), and add the same sort of caching for EvalAssume (tied for least-used callback), mostly as proof-of-concept. Before we go further with these, we should figure out a way to reuse the visit-and-cache code in CheckerVisit. llvm-svn: 110191
* After a lengthy design discussion, add support for "ownership attributes" ↵Ted Kremenek2010-07-311-17/+156
| | | | | | for malloc/free checking. Patch by Andrew McGregor! llvm-svn: 109939
* Add a new symbol type, SymbolExtent, to represent the extents of memory ↵Jordy Rose2010-07-041-5/+13
| | | | | | | | | | regions that may not be known at compile-time (such as those created by malloc). This replaces the old setExtent/getExtent API on Store, which used the GRState's GDM to store SVals. Also adds a getKnownValue() method to SValuator, which gets the integer value of an SVal if it is known to only have one possible value. There are more places in the code that could be using this, but in general we want to be dealing entirely in SVals, so its usefulness is limited. The only visible functionality change is that extents are now honored for any DeclRegion, such as fields and Objective-C ivars, rather than just variables. This shows up in bounds-checking and cast-size-checking. llvm-svn: 107577
* Fix PR 7475 by enhancing the static analyzer to also invalidate bindings for ↵Ted Kremenek2010-07-011-1/+2
| | | | | | | | | | | non-static global variables when calling a function/method whose impact on global variables we cannot accurately estimate. This change introduces two new MemSpaceRegions that divide up the memory space of globals, and causes RegionStore and BasicStore to consult a binding to the NonStaticGlobalsMemSpaceRegion when lazily determining the value of a global. llvm-svn: 107423
* Add an ivar to SymbolReaper for the current statement, and then stop passing ↵Jordy Rose2010-07-011-3/+2
| | | | | | the current statement around everywhere. Preparation for symbolic extents. llvm-svn: 107422
* Code cleanup: remove explicit flush() in favor of using the ostream's str()Jordy Rose2010-06-081-2/+1
| | | | llvm-svn: 105657
* Catch free()s on non-regions and regions known to be not from malloc(), by ↵Jordy Rose2010-06-071-5/+180
| | | | | | checking the symbol type and memory space. llvm-svn: 105547
* Add support for calloc() in MallocChecker. Patch by Jordy Rose, with my Zhongxing Xu2010-06-011-9/+43
| | | | | | modification. llvm-svn: 105264
* Relax an assertion. Various cases could lead to non-symbol values.Zhongxing Xu2010-05-131-1/+4
| | | | llvm-svn: 103707
* Checker: random include cleanup.Benjamin Kramer2010-03-271-0/+1
| | | | llvm-svn: 99731
* Add use-after-free check to MallocChecker.Zhongxing Xu2010-03-101-1/+23
| | | | llvm-svn: 98136
* Fix pr6293. If ptr is NULL, no operation is preformed.Zhongxing Xu2010-02-141-0/+5
| | | | llvm-svn: 96154
* Revert 95541.Ted Kremenek2010-02-081-7/+6
| | | | llvm-svn: 95545
* Rename: GRState::getSVal(Stmt*) => getExprVal(),Zhongxing Xu2010-02-081-6/+7
| | | | | | GRState::getSVal(MemRegion*) => Load(). llvm-svn: 95541
* Split libAnalysis into two libraries: libAnalysis and libChecker.Ted Kremenek2010-01-251-0/+336
(1) libAnalysis is a generic analysis library that can be used by Sema. It defines the CFG, basic dataflow analysis primitives, and inexpensive flow-sensitive analyses (e.g. LiveVariables). (2) libChecker contains the guts of the static analyzer, incuding the path-sensitive analysis engine and domain-specific checks. Now any clients that want to use the frontend to build their own tools don't need to link in the entire static analyzer. This change exposes various obvious cleanups that can be made to the layout of files and headers in libChecker. More changes pending. :) This change also exposed a layering violation between AnalysisContext and MemRegion. BlockInvocationContext shouldn't explicitly know about BlockDataRegions. For now I've removed the BlockDataRegion* from BlockInvocationContext (removing context-sensitivity; although this wasn't used yet). We need to have a better way to extend BlockInvocationContext (and any LocationContext) to add context-sensitivty. llvm-svn: 94406
OpenPOWER on IntegriCloud