From 0aee1cd5a35406a78b0f41b0521161206238aed3 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Tue, 21 Oct 2008 06:00:04 +0000 Subject: [PATCH] Add partial specialization of ImmutableList for GRStatePartialTrait. llvm-svn: 57895 --- .../Analysis/PathSensitive/GRStateTrait.h | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/clang/include/clang/Analysis/PathSensitive/GRStateTrait.h b/clang/include/clang/Analysis/PathSensitive/GRStateTrait.h index 9409aafaa583..83ea2ca1e0b9 100644 --- a/clang/include/clang/Analysis/PathSensitive/GRStateTrait.h +++ b/clang/include/clang/Analysis/PathSensitive/GRStateTrait.h @@ -20,11 +20,15 @@ namespace llvm { class BumpPtrAllocator; template class ImmutableMap; + template class ImmutableList; + template class ImmutableListImpl; } namespace clang { template struct GRStatePartialTrait; + // Partial-specialization for ImmutableMap. + template struct GRStatePartialTrait< llvm::ImmutableMap > { typedef llvm::ImmutableMap data_type; @@ -62,6 +66,34 @@ namespace clang { delete (typename data_type::Factory*) Ctx; } }; + + // Partial-specialization for ImmutableList. + + template + struct GRStatePartialTrait< llvm::ImmutableList > { + typedef llvm::ImmutableList data_type; + typedef typename data_type::Factory& context_type; + + static inline data_type MakeData(void* const* p) { + return p ? data_type((const llvm::ImmutableListImpl*) *p) : data_type(0); + } + + static inline void* MakeVoidPtr(data_type D) { + return D.getInternalPointer(); + } + + 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; + } + }; } // end clang namespace #endif