diff options
| author | Jordan Rose <jordan_rose@apple.com> | 2012-10-10 23:23:21 +0000 |
|---|---|---|
| committer | Jordan Rose <jordan_rose@apple.com> | 2012-10-10 23:23:21 +0000 |
| commit | e15fb77df80434716d79283bcbf59bfbc4775bf9 (patch) | |
| tree | 052e603459d83551e90ffadea95590c8f64034c0 /clang/lib | |
| parent | eae04111d0a6eb30a300c2a02703a746ac3ff72f (diff) | |
| download | bcm5719-llvm-e15fb77df80434716d79283bcbf59bfbc4775bf9.tar.gz bcm5719-llvm-e15fb77df80434716d79283bcbf59bfbc4775bf9.zip | |
Reapply "[analyzer] Treat fields of unions as having symbolic offsets."
This time, actually uncomment the code that's supposed to fix the problem.
This reverts r165671 / 8ceb837585ed973dc36fba8dfc57ef60fc8f2735.
llvm-svn: 165676
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/StaticAnalyzer/Core/MemRegion.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/MemRegion.cpp b/clang/lib/StaticAnalyzer/Core/MemRegion.cpp index 7c66739558a..fab10cfd3d0 100644 --- a/clang/lib/StaticAnalyzer/Core/MemRegion.cpp +++ b/clang/lib/StaticAnalyzer/Core/MemRegion.cpp @@ -1168,8 +1168,12 @@ RegionOffset MemRegion::getAsOffset() const { R = FR->getSuperRegion(); const RecordDecl *RD = FR->getDecl()->getParent(); - if (!RD->isCompleteDefinition()) { + if (RD->isUnion() || !RD->isCompleteDefinition()) { // We cannot compute offset for incomplete type. + // For unions, we could treat everything as offset 0, but we'd rather + // treat each field as a symbolic offset so they aren't stored on top + // of each other, since we depend on things in typed regions actually + // matching their types. SymbolicOffsetBase = R; } |

