diff options
author | Jordan Rose <jordan_rose@apple.com> | 2013-10-23 20:08:55 +0000 |
---|---|---|
committer | Jordan Rose <jordan_rose@apple.com> | 2013-10-23 20:08:55 +0000 |
commit | bb61c8cc739bc29ea9d15a1b486273eb98023321 (patch) | |
tree | 77e1e59e0b36e0d0599f161c6d892cbcc90126fe /clang/lib/StaticAnalyzer/Core/RegionStore.cpp | |
parent | 48342ee908aababa7ffda5a9e82b73fa96d965ee (diff) | |
download | bcm5719-llvm-bb61c8cc739bc29ea9d15a1b486273eb98023321.tar.gz bcm5719-llvm-bb61c8cc739bc29ea9d15a1b486273eb98023321.zip |
[analyzer] Generate a LazyCompoundVal when loading from a union-typed region.
This ensures that variables accessible through a union are invalidated when
the union value is passed to a function. We still don't fully handle union
values, but this should at least quiet some false positives.
PR16596
llvm-svn: 193265
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/RegionStore.cpp')
-rw-r--r-- | clang/lib/StaticAnalyzer/Core/RegionStore.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/RegionStore.cpp b/clang/lib/StaticAnalyzer/Core/RegionStore.cpp index 3cf1e5acde9..0b519768aa0 100644 --- a/clang/lib/StaticAnalyzer/Core/RegionStore.cpp +++ b/clang/lib/StaticAnalyzer/Core/RegionStore.cpp @@ -1312,7 +1312,7 @@ SVal RegionStoreManager::getBinding(RegionBindingsConstRef B, Loc L, QualType T) // FIXME: Handle unions. if (RTy->isUnionType()) - return UnknownVal(); + return createLazyBinding(B, R); if (RTy->isArrayType()) { if (RTy->isConstantArrayType()) @@ -1906,6 +1906,8 @@ RegionStoreManager::bind(RegionBindingsConstRef B, Loc L, SVal V) { return bindStruct(B, TR, V); if (Ty->isVectorType()) return bindVector(B, TR, V); + if (Ty->isUnionType()) + return bindAggregate(B, TR, V); } if (const SymbolicRegion *SR = dyn_cast<SymbolicRegion>(R)) { |