aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/GRStateTrait.h16
1 files changed, 15 insertions, 1 deletions
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<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;