summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2009-06-23 19:32:16 +0000
committered <ed@FreeBSD.org>2009-06-23 19:32:16 +0000
commit14660dbe9881f68a6cc2b9f014e1fb7b7228bca4 (patch)
tree258c14596f927fd77ae8d727dc9c3d4471bf0f46 /lib
parentda468bf93e74598f985f4988936ee5ca2dc9a38c (diff)
downloadFreeBSD-src-14660dbe9881f68a6cc2b9f014e1fb7b7228bca4.zip
FreeBSD-src-14660dbe9881f68a6cc2b9f014e1fb7b7228bca4.tar.gz
Import Clang r73984.
Diffstat (limited to 'lib')
-rw-r--r--lib/Analysis/BugReporter.cpp2
-rw-r--r--lib/Analysis/CFRefCount.cpp2
-rw-r--r--lib/Analysis/CMakeLists.txt1
-rw-r--r--lib/Analysis/GRExprEngine.cpp2
-rw-r--r--lib/Analysis/GRState.cpp2
-rw-r--r--lib/Analysis/MemRegion.cpp47
-rw-r--r--lib/Analysis/RegionStore.cpp2
-rw-r--r--lib/Driver/CMakeLists.txt2
-rw-r--r--lib/Frontend/CMakeLists.txt2
9 files changed, 29 insertions, 33 deletions
diff --git a/lib/Analysis/BugReporter.cpp b/lib/Analysis/BugReporter.cpp
index 5dbbfc3..9c9029c 100644
--- a/lib/Analysis/BugReporter.cpp
+++ b/lib/Analysis/BugReporter.cpp
@@ -380,7 +380,7 @@ public:
return true;
// Check if the previous state has this binding.
- SVal X = VMgr.GetSVal(PrevSt, loc::MemRegionVal(R));
+ SVal X = PrevSt->getSVal(loc::MemRegionVal(R));
if (X == V) // Same binding?
return true;
diff --git a/lib/Analysis/CFRefCount.cpp b/lib/Analysis/CFRefCount.cpp
index 1ccd092..46333a7 100644
--- a/lib/Analysis/CFRefCount.cpp
+++ b/lib/Analysis/CFRefCount.cpp
@@ -3141,7 +3141,7 @@ void CFRefCount::EvalBind(GRStmtNodeBuilderRef& B, SVal location, SVal val) {
escapes = true;
else {
const MemRegion* R = cast<loc::MemRegionVal>(location).getRegion();
- escapes = !B.getStateManager().hasStackStorage(R);
+ escapes = !R->hasStackStorage();
if (!escapes) {
// To test (3), generate a new state with the binding removed. If it is
diff --git a/lib/Analysis/CMakeLists.txt b/lib/Analysis/CMakeLists.txt
index 9e8248f..e064e3c 100644
--- a/lib/Analysis/CMakeLists.txt
+++ b/lib/Analysis/CMakeLists.txt
@@ -31,6 +31,7 @@ add_clang_library(clangAnalysis
SVals.cpp
SymbolManager.cpp
UninitializedValues.cpp
+ ValueManager.cpp
)
add_dependencies(clangAnalysis ClangDiagnosticAnalysis)
diff --git a/lib/Analysis/GRExprEngine.cpp b/lib/Analysis/GRExprEngine.cpp
index d5f0e40..7d56d10 100644
--- a/lib/Analysis/GRExprEngine.cpp
+++ b/lib/Analysis/GRExprEngine.cpp
@@ -2764,7 +2764,7 @@ void GRExprEngine::VisitReturnStmt(ReturnStmt* S, NodeTy* Pred, NodeSet& Dst) {
// Determine if the value is on the stack.
const MemRegion* R = cast<loc::MemRegionVal>(&X)->getRegion();
- if (R && getStateManager().hasStackStorage(R)) {
+ if (R && R->hasStackStorage()) {
// Create a special node representing the error.
if (NodeTy* N = Builder->generateNode(S, GetState(*I), *I)) {
N->markAsSink();
diff --git a/lib/Analysis/GRState.cpp b/lib/Analysis/GRState.cpp
index aeb1c04..a64b2d7 100644
--- a/lib/Analysis/GRState.cpp
+++ b/lib/Analysis/GRState.cpp
@@ -282,7 +282,7 @@ bool GRState::scanReachableSymbols(SVal val, SymbolVisitor& visitor) const {
bool GRStateManager::isEqual(const GRState* state, Expr* Ex,
const llvm::APSInt& Y) {
- SVal V = GetSVal(state, Ex);
+ SVal V = state->getSVal(Ex);
if (loc::ConcreteInt* X = dyn_cast<loc::ConcreteInt>(&V))
return X->getValue() == Y;
diff --git a/lib/Analysis/MemRegion.cpp b/lib/Analysis/MemRegion.cpp
index 9bd93cd..c8e0275 100644
--- a/lib/Analysis/MemRegion.cpp
+++ b/lib/Analysis/MemRegion.cpp
@@ -313,45 +313,40 @@ AllocaRegion* MemRegionManager::getAllocaRegion(const Expr* E, unsigned cnt) {
return getRegion<AllocaRegion>(E, cnt);
}
-bool MemRegionManager::hasStackStorage(const MemRegion* R) {
- // Only subregions can have stack storage.
- const SubRegion* SR = dyn_cast<SubRegion>(R);
- if (!SR)
- return false;
-
- MemSpaceRegion* S = getStackRegion();
+const MemSpaceRegion *MemRegion::getMemorySpace() const {
+ const MemRegion *R = this;
+ const SubRegion* SR = dyn_cast<SubRegion>(this);
while (SR) {
R = SR->getSuperRegion();
- if (R == S)
- return true;
-
- SR = dyn_cast<SubRegion>(R);
+ SR = dyn_cast<SubRegion>(R);
}
-
- return false;
+
+ return dyn_cast<MemSpaceRegion>(R);
}
-bool MemRegionManager::hasHeapStorage(const MemRegion* R) {
- // Only subregions can have stack storage.
- const SubRegion* SR = dyn_cast<SubRegion>(R);
+bool MemRegion::hasStackStorage() const {
+ if (const MemSpaceRegion *MS = getMemorySpace())
+ return MS == getMemRegionManager()->getStackRegion();
- if (!SR)
- return false;
+ return false;
+}
- MemSpaceRegion* H = getHeapRegion();
+bool MemRegion::hasHeapStorage() const {
+ if (const MemSpaceRegion *MS = getMemorySpace())
+ return MS == getMemRegionManager()->getHeapRegion();
- while (SR) {
- R = SR->getSuperRegion();
- if (R == H)
- return true;
+ return false;
+}
- SR = dyn_cast<SubRegion>(R);
+bool MemRegion::hasHeapOrStackStorage() const {
+ if (const MemSpaceRegion *MS = getMemorySpace()) {
+ MemRegionManager *Mgr = getMemRegionManager();
+ return MS == Mgr->getHeapRegion() || MS == Mgr->getStackRegion();
}
-
return false;
-}
+}
//===----------------------------------------------------------------------===//
// View handling.
diff --git a/lib/Analysis/RegionStore.cpp b/lib/Analysis/RegionStore.cpp
index f76807b..77f5b7c 100644
--- a/lib/Analysis/RegionStore.cpp
+++ b/lib/Analysis/RegionStore.cpp
@@ -939,7 +939,7 @@ SVal RegionStoreManager::Retrieve(const GRState *state, Loc L, QualType T) {
}
}
- if (MRMgr.hasStackStorage(R) || MRMgr.hasHeapStorage(R)) {
+ if (R->hasHeapOrStackStorage()) {
// All stack variables are considered to have undefined values
// upon creation. All heap allocated blocks are considered to
// have undefined values as well unless they are explicitly bound
diff --git a/lib/Driver/CMakeLists.txt b/lib/Driver/CMakeLists.txt
index 42cbff9..b6998ab 100644
--- a/lib/Driver/CMakeLists.txt
+++ b/lib/Driver/CMakeLists.txt
@@ -18,4 +18,4 @@ add_clang_library(clangDriver
Types.cpp
)
-add_dependencies(clangSema ClangDiagnosticDriver)
+add_dependencies(clangDriver ClangDiagnosticDriver)
diff --git a/lib/Frontend/CMakeLists.txt b/lib/Frontend/CMakeLists.txt
index 330b4db..4ba39c9 100644
--- a/lib/Frontend/CMakeLists.txt
+++ b/lib/Frontend/CMakeLists.txt
@@ -36,4 +36,4 @@ add_clang_library(clangFrontend
Warnings.cpp
)
-add_dependencies(clangSema ClangDiagnosticFrontend)
+add_dependencies(clangFrontend ClangDiagnosticFrontend)
OpenPOWER on IntegriCloud