From: Ted Kremenek Date: Wed, 4 Mar 2009 22:55:18 +0000 (+0000) Subject: MemRegion: X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1b9b883a95215e38e153d253a46a2a2fcac25896;p=clang MemRegion: - Have 'TypedRegion::getRValueType()' return a null QualType for 'id<...>' instead of aborting. - Change 'TypedRegion::isBoundable()' to return true for all objects with a non-null RValueType (this may not be the final behavior). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66093 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Analysis/PathSensitive/MemRegion.h b/include/clang/Analysis/PathSensitive/MemRegion.h index 743a3b9098..2ddaa20d32 100644 --- a/include/clang/Analysis/PathSensitive/MemRegion.h +++ b/include/clang/Analysis/PathSensitive/MemRegion.h @@ -154,18 +154,16 @@ public: } QualType getDesugaredRValueType(ASTContext& C) const { - return getRValueType(C)->getDesugaredType(); + QualType T = getRValueType(C); + return T.getTypePtr() ? T->getDesugaredType() : T; } QualType getDesugaredLValueType(ASTContext& C) const { return getLValueType(C)->getDesugaredType(); } - + bool isBoundable(ASTContext &C) const { - // FIXME: This needs to be adjusted for structures and arrays. - // All this will reject right now is ObjCQualifiedIdType and - // BlockPointerType. - return getLValueType(C)->isPointerType(); + return !getRValueType(C).isNull(); } static bool classof(const MemRegion* R) { diff --git a/lib/Analysis/MemRegion.cpp b/lib/Analysis/MemRegion.cpp index 8dd31b54b0..c304b659b6 100644 --- a/lib/Analysis/MemRegion.cpp +++ b/lib/Analysis/MemRegion.cpp @@ -123,8 +123,9 @@ QualType SymbolicRegion::getRValueType(ASTContext& C) const { if (const BlockPointerType* PTy = T->getAsBlockPointerType()) return PTy->getPointeeType(); - assert(!T->getAsObjCQualifiedIdType() && - "There is no rvalue type for id<...>"); + // There is no rvalue type of id<...>. + if (T->getAsObjCQualifiedIdType()) + return QualType(); assert(Loc::IsLocType(T) && "Non-location type."); return QualType();