diff options
| author | Ted Kremenek <kremenek@apple.com> | 2008-12-03 20:48:33 +0000 |
|---|---|---|
| committer | Ted Kremenek <kremenek@apple.com> | 2008-12-03 20:48:33 +0000 |
| commit | 217dc8de69ce5b4bcfb0a2994ca3dfeb337a6fd0 (patch) | |
| tree | 8c2bc06f8ea6dc7641c39063d65e885b0f609acb | |
| parent | faf6808e7ac9fdf1f1e905531e6350c2ec677b9d (diff) | |
| download | bcm5719-llvm-217dc8de69ce5b4bcfb0a2994ca3dfeb337a6fd0.tar.gz bcm5719-llvm-217dc8de69ce5b4bcfb0a2994ca3dfeb337a6fd0.zip | |
Added partial specialization of GRStatePartialTrait<T> with T = ImmutableSet<...>.
llvm-svn: 60504
| -rw-r--r-- | clang/include/clang/Analysis/PathSensitive/GRStateTrait.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/clang/include/clang/Analysis/PathSensitive/GRStateTrait.h b/clang/include/clang/Analysis/PathSensitive/GRStateTrait.h index cf5ce553ef3..077b9bcf438 100644 --- a/clang/include/clang/Analysis/PathSensitive/GRStateTrait.h +++ b/clang/include/clang/Analysis/PathSensitive/GRStateTrait.h @@ -20,6 +20,7 @@ namespace llvm { class BumpPtrAllocator; template <typename K, typename D, typename I> class ImmutableMap; + template <typename K, typename I> class ImmutableSet; template <typename T> class ImmutableList; template <typename T> class ImmutableListImpl; } @@ -67,6 +68,44 @@ namespace clang { } }; + + // Partial-specialization for ImmutableSet. + + template <typename Key, typename Info> + struct GRStatePartialTrait< llvm::ImmutableSet<Key,Info> > { + typedef llvm::ImmutableSet<Key,Info> 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 <typename T> |

