]> granicus.if.org Git - clang/commitdiff
[analyzer] Fix GRStatePartialTrait<bool> and introduce GRStatePartialTrait<unsigned>.
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Tue, 22 Feb 2011 17:30:28 +0000 (17:30 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Tue, 22 Feb 2011 17:30:28 +0000 (17:30 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126227 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/StaticAnalyzer/Core/PathSensitive/GRStateTrait.h

index 411441f8fe344d8f104925f7c9e4e359cf88b6ae..07cdbf523427d554d627ce68bf1ccc58ceae1784 100644 (file)
@@ -151,7 +151,21 @@ namespace ento {
     typedef bool data_type;
 
     static inline data_type MakeData(void* const* p) {
-      return (bool) (uintptr_t) p;
+      return p ? (data_type) (uintptr_t) *p
+               : data_type();
+    }
+    static inline void *MakeVoidPtr(data_type d) {
+      return (void*) (uintptr_t) d;
+    }
+  };
+  
+  // Partial specialization for unsigned.
+  template <> struct GRStatePartialTrait<unsigned> {
+    typedef unsigned data_type;
+
+    static inline data_type MakeData(void* const* p) {
+      return p ? (data_type) (uintptr_t) *p
+               : data_type();
     }
     static inline void *MakeVoidPtr(data_type d) {
       return (void*) (uintptr_t) d;