diff options
| author | Ted Kremenek <kremenek@apple.com> | 2008-08-25 19:33:03 +0000 |
|---|---|---|
| committer | Ted Kremenek <kremenek@apple.com> | 2008-08-25 19:33:03 +0000 |
| commit | 2a2c875b9cf2fa408e1997684f84d439feeec0bb (patch) | |
| tree | 19e515def4ca7569f347f605c7c905e727329b93 /clang/lib/Analysis/Regions.cpp | |
| parent | 17d5be2d0a42c93ef6e615bf0fba855df046f99e (diff) | |
| download | bcm5719-llvm-2a2c875b9cf2fa408e1997684f84d439feeec0bb.tar.gz bcm5719-llvm-2a2c875b9cf2fa408e1997684f84d439feeec0bb.zip | |
Added 'extents' for Regions.
Added 'getExtent()' to StoreManager.
Implemented 'getExtent()' for BasicStoreManager.
llvm-svn: 55321
Diffstat (limited to 'clang/lib/Analysis/Regions.cpp')
| -rw-r--r-- | clang/lib/Analysis/Regions.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/clang/lib/Analysis/Regions.cpp b/clang/lib/Analysis/Regions.cpp new file mode 100644 index 00000000000..b7253162431 --- /dev/null +++ b/clang/lib/Analysis/Regions.cpp @@ -0,0 +1,34 @@ +//==- Regions.cpp - Abstract memory locations ----------------------*- C++ -*-// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file defines Region and its subclasses. Regions represent abstract +// memory locations. +// +//===----------------------------------------------------------------------===// + +#include "clang/Analysis/PathSensitive/Regions.h" +#include "clang/Analysis/PathSensitive/BasicValueFactory.h" +#include "clang/AST/ASTContext.h" + +using namespace clang; + +RegionExtent VarRegion::getExtent(BasicValueFactory& BV) const { + QualType T = getDecl()->getType(); + + // FIXME: Add support for VLAs. This may require passing in additional + // information, or tracking a different region type. + if (!T.getTypePtr()->isConstantSizeType()) + return UnknownExtent(); + + ASTContext& C = BV.getContext(); + assert (!T->isObjCInterfaceType()); // @interface not a possible VarDecl type. + assert (T != C.VoidTy); // void not a possible VarDecl type. + return IntExtent(BV.getValue(C.getTypeSize(T), C.VoidPtrTy)); +} + |

