Get the canonical type for struct initialization. The original code would crash on TypedefType.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58236 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/RegionStore.cpp b/lib/Analysis/RegionStore.cpp
index 0a31bc8..536e149 100644
--- a/lib/Analysis/RegionStore.cpp
+++ b/lib/Analysis/RegionStore.cpp
@@ -233,6 +233,9 @@
}
Store RegionStoreManager::Bind(Store store, Loc LV, SVal V) {
+ if (LV.getSubKind() == loc::SymbolValKind)
+ return store;
+
assert(LV.getSubKind() == loc::MemRegionKind);
const MemRegion* R = cast<loc::MemRegionVal>(LV).getRegion();
@@ -373,7 +376,8 @@
Store RegionStoreManager::InitializeStructToUndefined(Store store, QualType T,
MemRegion* BaseR) {
- const RecordType* RT = cast<RecordType>(T.getTypePtr());
+ QualType CT = T->getCanonicalTypeInternal();
+ const RecordType* RT = cast<RecordType>(CT.getTypePtr());
RecordDecl* RD = RT->getDecl();
assert(RD->isDefinition());