]> granicus.if.org Git - clang/commitdiff
Get the canonical type for struct initialization. The original code would crash on...
authorZhongxing Xu <xuzhongxing@gmail.com>
Mon, 27 Oct 2008 09:24:07 +0000 (09:24 +0000)
committerZhongxing Xu <xuzhongxing@gmail.com>
Mon, 27 Oct 2008 09:24:07 +0000 (09:24 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58236 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/RegionStore.cpp

index 0a31bc8f5d7710249eabc6b0f36ffd63b6c42463..536e14944b686ea5df69418c259071bf0ad9e381 100644 (file)
@@ -233,6 +233,9 @@ SVal RegionStoreManager::Retrieve(Store S, Loc L, QualType T) {
 }
 
 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::InitializeArrayToUndefined(Store store, QualType T,
 
 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());