]> granicus.if.org Git - clang/commit
Add a new symbol type, SymbolExtent, to represent the extents of memory regions that...
authorJordy Rose <jediknil@belkadan.com>
Sun, 4 Jul 2010 00:00:41 +0000 (00:00 +0000)
committerJordy Rose <jediknil@belkadan.com>
Sun, 4 Jul 2010 00:00:41 +0000 (00:00 +0000)
commit32f2656b90900ac04c4b50e87c16749d0ceb9ef2
treeacae7c710bac71acbec0fd07a3c6547c43977feb
parent6b855121f3c23e9cf2b548cbf2dd3d16fdcf610c
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
14 files changed:
include/clang/Checker/PathSensitive/MemRegion.h
include/clang/Checker/PathSensitive/SValuator.h
include/clang/Checker/PathSensitive/Store.h
include/clang/Checker/PathSensitive/SymbolManager.h
lib/Checker/BuiltinFunctionChecker.cpp
lib/Checker/CastSizeChecker.cpp
lib/Checker/MallocChecker.cpp
lib/Checker/MemRegion.cpp
lib/Checker/RegionStore.cpp
lib/Checker/SimpleSValuator.cpp
lib/Checker/SymbolManager.cpp
test/Analysis/no-outofbounds.c
test/Analysis/outofbound.c
test/Analysis/rdar-6442306-1.m