From: Ted Kremenek Date: Wed, 3 Dec 2008 20:48:33 +0000 (+0000) Subject: Added partial specialization of GRStatePartialTrait with T = ImmutableSet<...>. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=32d600ce59e780b7ff969309cbf742159abe018b;p=clang Added partial specialization of GRStatePartialTrait with T = ImmutableSet<...>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60504 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Analysis/PathSensitive/GRStateTrait.h b/include/clang/Analysis/PathSensitive/GRStateTrait.h index cf5ce553ef..077b9bcf43 100644 --- a/include/clang/Analysis/PathSensitive/GRStateTrait.h +++ b/include/clang/Analysis/PathSensitive/GRStateTrait.h @@ -20,6 +20,7 @@ namespace llvm { class BumpPtrAllocator; template class ImmutableMap; + template class ImmutableSet; template class ImmutableList; template class ImmutableListImpl; } @@ -67,6 +68,44 @@ namespace clang { } }; + + // Partial-specialization for ImmutableSet. + + template + struct GRStatePartialTrait< llvm::ImmutableSet > { + typedef llvm::ImmutableSet data_type; + typedef typename data_type::Factory& context_type; + typedef Key key_type; + + static inline data_type MakeData(void* const* p) { + return p ? data_type((typename data_type::TreeTy*) *p) : data_type(0); + } + + static inline void* MakeVoidPtr(data_type B) { + return B.getRoot(); + } + + static data_type Remove(data_type B, key_type K, context_type F) { + return F.Remove(B, K); + } + + static bool Contains(data_type B, key_type K) { + return B.contains(K); + } + + static inline context_type MakeContext(void* p) { + return *((typename data_type::Factory*) p); + } + + static void* CreateContext(llvm::BumpPtrAllocator& Alloc) { + return new typename data_type::Factory(Alloc); + } + + static void DeleteContext(void* Ctx) { + delete (typename data_type::Factory*) Ctx; + } + }; + // Partial-specialization for ImmutableList. template