summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Core/RegionStore.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2011-11-29 19:39:29 +0000
committerTed Kremenek <kremenek@apple.com>2011-11-29 19:39:29 +0000
commitcfe4ff9725c8f42f14627f6da433cf0b3fdcfcff (patch)
treec57b1147f418abc8204a5f8ef5bb3f3cb4f3aae6 /clang/lib/StaticAnalyzer/Core/RegionStore.cpp
parentb61cc442650156bfb3be4af72daea46c6fa4b4d0 (diff)
downloadbcm5719-llvm-cfe4ff9725c8f42f14627f6da433cf0b3fdcfcff.tar.gz
bcm5719-llvm-cfe4ff9725c8f42f14627f6da433cf0b3fdcfcff.zip
Relax RegionStore to allow loads from CodeTextRegions. Apparently you can actually write code that does this. This seems worthy of a checker, but the StoreManager should handle the memory abstraction without crashing. Fixes PR 11450.
llvm-svn: 145424
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/RegionStore.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Core/RegionStore.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/RegionStore.cpp b/clang/lib/StaticAnalyzer/Core/RegionStore.cpp
index 4ea465ff2e7..27077afadab 100644
--- a/clang/lib/StaticAnalyzer/Core/RegionStore.cpp
+++ b/clang/lib/StaticAnalyzer/Core/RegionStore.cpp
@@ -882,7 +882,9 @@ SVal RegionStoreManager::Retrieve(Store store, Loc L, QualType T) {
const MemRegion *MR = cast<loc::MemRegionVal>(L).getRegion();
- if (isa<AllocaRegion>(MR) || isa<SymbolicRegion>(MR)) {
+ if (isa<AllocaRegion>(MR) ||
+ isa<SymbolicRegion>(MR) ||
+ isa<CodeTextRegion>(MR)) {
if (T.isNull()) {
const SymbolicRegion *SR = cast<SymbolicRegion>(MR);
T = SR->getSymbol()->getType(Ctx);
@@ -890,10 +892,6 @@ SVal RegionStoreManager::Retrieve(Store store, Loc L, QualType T) {
MR = GetElementZeroRegion(MR, T);
}
- if (isa<CodeTextRegion>(MR)) {
- llvm_unreachable("Why load from a code text region?");
- }
-
// FIXME: Perhaps this method should just take a 'const MemRegion*' argument
// instead of 'Loc', and have the other Loc cases handled at a higher level.
const TypedValueRegion *R = cast<TypedValueRegion>(MR);
OpenPOWER on IntegriCloud