[cfe-commits] r57895 - /cfe/trunk/include/clang/Analysis/PathSensitive/GRStateTrait.h
Ted Kremenek
kremenek at apple.com
Mon Oct 20 23:00:04 PDT 2008
Author: kremenek
Date: Tue Oct 21 01:00:04 2008
New Revision: 57895
URL: http://llvm.org/viewvc/llvm-project?rev=57895&view=rev
Log:
Add partial specialization of ImmutableList for GRStatePartialTrait.
Modified:
cfe/trunk/include/clang/Analysis/PathSensitive/GRStateTrait.h
Modified: cfe/trunk/include/clang/Analysis/PathSensitive/GRStateTrait.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/PathSensitive/GRStateTrait.h?rev=57895&r1=57894&r2=57895&view=diff
==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/GRStateTrait.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/GRStateTrait.h Tue Oct 21 01:00:04 2008
@@ -20,11 +20,15 @@
namespace llvm {
class BumpPtrAllocator;
template <typename K, typename D, typename I> class ImmutableMap;
+ template <typename T> class ImmutableList;
+ template <typename T> class ImmutableListImpl;
}
namespace clang {
template <typename T> struct GRStatePartialTrait;
+ // Partial-specialization for ImmutableMap.
+
template <typename Key, typename Data, typename Info>
struct GRStatePartialTrait< llvm::ImmutableMap<Key,Data,Info> > {
typedef llvm::ImmutableMap<Key,Data,Info> data_type;
@@ -62,6 +66,34 @@
delete (typename data_type::Factory*) Ctx;
}
};
+
+ // Partial-specialization for ImmutableList.
+
+ template <typename T>
+ struct GRStatePartialTrait< llvm::ImmutableList<T> > {
+ typedef llvm::ImmutableList<T> data_type;
+ typedef typename data_type::Factory& context_type;
+
+ static inline data_type MakeData(void* const* p) {
+ return p ? data_type((const llvm::ImmutableListImpl<T>*) *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
More information about the cfe-commits
mailing list