From 9fc8fdd79c5ecf30833ccc0dd5e14be7aa884470 Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Tue, 22 Feb 2011 17:30:28 +0000 Subject: [PATCH] [analyzer] Fix GRStatePartialTrait and introduce GRStatePartialTrait. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126227 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../Core/PathSensitive/GRStateTrait.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/GRStateTrait.h b/include/clang/StaticAnalyzer/Core/PathSensitive/GRStateTrait.h index 411441f8fe..07cdbf5234 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/GRStateTrait.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/GRStateTrait.h @@ -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 { + 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; -- 2.40.0