blob: b7253162431967ed918a6a7350a6e52c1b8584cd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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));
}
|