From: Zhongxing Xu Date: Mon, 27 Oct 2008 09:24:07 +0000 (+0000) Subject: Get the canonical type for struct initialization. The original code would crash on... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8fe63af0bd8feba4034848211e4e250e1c9ef302;p=clang 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 0a31bc8f5d..536e14944b 100644 --- a/lib/Analysis/RegionStore.cpp +++ b/lib/Analysis/RegionStore.cpp @@ -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(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(T.getTypePtr()); + QualType CT = T->getCanonicalTypeInternal(); + const RecordType* RT = cast(CT.getTypePtr()); RecordDecl* RD = RT->getDecl(); assert(RD->isDefinition());