diff options
| author | Anna Zaks <ganna@apple.com> | 2012-11-26 19:11:46 +0000 |
|---|---|---|
| committer | Anna Zaks <ganna@apple.com> | 2012-11-26 19:11:46 +0000 |
| commit | e3beeaa5e7de3f2ba2ec548fc84e9c81216fbd9a (patch) | |
| tree | db386661b29f5b5021de09337855c4a8376833c4 /clang/lib | |
| parent | c5a7f92854c4eb12651d82817f7c2a7a87fa0541 (diff) | |
| download | bcm5719-llvm-e3beeaa5e7de3f2ba2ec548fc84e9c81216fbd9a.tar.gz bcm5719-llvm-e3beeaa5e7de3f2ba2ec548fc84e9c81216fbd9a.zip | |
[analyzer] Fix a crash reported in PR 14400.
The AllocaRegion did not have the superRegion (based on LocationContext)
as part of it's hash. As a consequence, the AllocaRegions from
different frames were uniqued to be the same region.
llvm-svn: 168599
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/StaticAnalyzer/Checkers/BuiltinFunctionChecker.cpp | 1 | ||||
| -rw-r--r-- | clang/lib/StaticAnalyzer/Core/MemRegion.cpp | 3 |
2 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/BuiltinFunctionChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/BuiltinFunctionChecker.cpp index 6ef022b6092..24f8cdd74ed 100644 --- a/clang/lib/StaticAnalyzer/Checkers/BuiltinFunctionChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/BuiltinFunctionChecker.cpp @@ -68,6 +68,7 @@ bool BuiltinFunctionChecker::evalCall(const CallExpr *CE, DefinedOrUnknownSVal extentMatchesSizeArg = svalBuilder.evalEQ(state, Extent, Size); state = state->assume(extentMatchesSizeArg, true); + assert(state && "The region should not have any previous constraints"); C.addTransition(state->BindExpr(CE, LCtx, loc::MemRegionVal(R))); return true; diff --git a/clang/lib/StaticAnalyzer/Core/MemRegion.cpp b/clang/lib/StaticAnalyzer/Core/MemRegion.cpp index fab10cfd3d0..37f65ec31e9 100644 --- a/clang/lib/StaticAnalyzer/Core/MemRegion.cpp +++ b/clang/lib/StaticAnalyzer/Core/MemRegion.cpp @@ -272,10 +272,11 @@ void ObjCStringRegion::ProfileRegion(llvm::FoldingSetNodeID& ID, void AllocaRegion::ProfileRegion(llvm::FoldingSetNodeID& ID, const Expr *Ex, unsigned cnt, - const MemRegion *) { + const MemRegion *superRegion) { ID.AddInteger((unsigned) AllocaRegionKind); ID.AddPointer(Ex); ID.AddInteger(cnt); + ID.AddPointer(superRegion); } void AllocaRegion::Profile(llvm::FoldingSetNodeID& ID) const { |

