Граф коммитов

18 Коммитов

Автор SHA1 Сообщение Дата
Ted Kremenek dde201b9b5 Fix 80 col. violations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110473 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-06 21:12:55 +00:00
Ted Kremenek 8c91230a68 Nest variable declaration into into 'if' condition, thus restricting the scope of the variable and condensing the code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110472 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-06 21:12:53 +00:00
Ted Kremenek cea68654a4 Use 'GenerateNode()' instead of 'GenerateSink()' when reporting a leak. A leak is not a hard enough bug to stop analyzing a path.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110471 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-06 21:12:49 +00:00
Jordy Rose 72905cfa81 Change the checker callback cache in GRExprEngine to be more compact (and 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110191 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-04 07:10:57 +00:00
Ted Kremenek dd0e490c24 After a lengthy design discussion, add support for "ownership attributes" for malloc/free checking. Patch by Andrew McGregor!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109939 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-31 01:52:11 +00:00
Jordy Rose 32f2656b90 Add a new symbol type, SymbolExtent, to represent the extents of memory 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107577 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-04 00:00:41 +00:00
Ted Kremenek dcee3ce97f Fix PR 7475 by enhancing the static analyzer to also invalidate bindings for 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107423 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-01 20:16:50 +00:00
Jordy Rose 7dadf79bd8 Add an ivar to SymbolReaper for the current statement, and then stop passing the current statement around everywhere. Preparation for symbolic extents.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107422 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-01 20:09:55 +00:00
Jordy Rose 3104124fda Code cleanup: remove explicit flush() in favor of using the ostream's str()
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105657 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-08 22:59:01 +00:00
Jordy Rose 43859f66cd Catch free()s on non-regions and regions known to be not from malloc(), by checking the symbol type and memory space.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105547 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-07 19:32:37 +00:00
Zhongxing Xu a5ce966d1a Add support for calloc() in MallocChecker. Patch by Jordy Rose, with my
modification.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105264 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-01 03:01:33 +00:00
Zhongxing Xu 8e98ac162a Relax an assertion. Various cases could lead to non-symbol values.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103707 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-13 08:26:32 +00:00
Benjamin Kramer 5e2d2c2ee3 Checker: random include cleanup.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99731 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-27 21:19:47 +00:00
Zhongxing Xu c8023788ac Add use-after-free check to MallocChecker.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98136 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-10 04:58:55 +00:00
Zhongxing Xu 181cc3df6e Fix pr6293. If ptr is NULL, no operation is preformed.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96154 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-14 06:49:48 +00:00
Ted Kremenek 1397663af9 Revert 95541.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95545 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-08 16:18:51 +00:00
Zhongxing Xu 6f8c430a95 Rename: GRState::getSVal(Stmt*) => getExprVal(),
GRState::getSVal(MemRegion*) => Load().


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95541 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-08 09:30:02 +00:00
Ted Kremenek 1309f9a3b2 Split libAnalysis into two libraries: libAnalysis and libChecker.
(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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94406 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-25 04:41:41 +00:00