[cfe-commits] r126227 - /cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/GRStateTrait.h

Argyrios Kyrtzidis akyrtzi at gmail.com
Tue Feb 22 09:30:28 PST 2011


Author: akirtzidis
Date: Tue Feb 22 11:30:28 2011
New Revision: 126227

URL: http://llvm.org/viewvc/llvm-project?rev=126227&view=rev
Log:
[analyzer] Fix GRStatePartialTrait<bool> and introduce GRStatePartialTrait<unsigned>.

Modified:
    cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/GRStateTrait.h

Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/GRStateTrait.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/GRStateTrait.h?rev=126227&r1=126226&r2=126227&view=diff
==============================================================================
--- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/GRStateTrait.h (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/GRStateTrait.h Tue Feb 22 11:30:28 2011
@@ -151,7 +151,21 @@
     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;





More information about the cfe-commits mailing list