diff options
Diffstat (limited to 'include/clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h')
-rw-r--r-- | include/clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h b/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h index ea2a852..eb52ae4 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h @@ -18,6 +18,8 @@ #ifndef LLVM_CLANG_GR_PROGRAMSTATETRAIT_H #define LLVM_CLANG_GR_PROGRAMSTATETRAIT_H +#include "llvm/Support/DataTypes.h" + namespace llvm { class BumpPtrAllocator; template <typename K, typename D, typename I> class ImmutableMap; @@ -165,7 +167,7 @@ namespace ento { } static inline void *MakeVoidPtr(data_type D) { - return (void*) D.getInternalPointer(); + return const_cast<llvm::ImmutableListImpl<T> *>(D.getInternalPointer()); } static inline context_type MakeContext(void *p) { @@ -221,7 +223,20 @@ namespace ento { } }; -} // end GR namespace + // Partial specialization for const void *. + template <> struct ProgramStatePartialTrait<const void *> { + typedef const void *data_type; + + static inline data_type MakeData(void * const *p) { + return p ? *p : data_type(); + } + + static inline void *MakeVoidPtr(data_type d) { + return const_cast<void *>(d); + } + }; + +} // end ento namespace } // end clang namespace |