r286306 - [analyzer] Provide Contains() on ImmutableMap program state partial trait.

Dominic Chen via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 8 14:39:14 PST 2016


Author: ddcc
Date: Tue Nov  8 16:39:14 2016
New Revision: 286306

URL: http://llvm.org/viewvc/llvm-project?rev=286306&view=rev
Log:
[analyzer] Provide Contains() on ImmutableMap program state partial trait.

Reviewers: zaks.anna, dcoughlin

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D26373

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

Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h?rev=286306&r1=286305&r2=286306&view=diff
==============================================================================
--- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h Tue Nov  8 16:39:14 2016
@@ -8,7 +8,7 @@
 //===----------------------------------------------------------------------===//
 //
 //  This file defines partial implementations of template specializations of
-//  the class ProgramStateTrait<>.  ProgramStateTrait<> is used by ProgramState 
+//  the class ProgramStateTrait<>.  ProgramStateTrait<> is used by ProgramState
 //  to implement set/get methods for manipulating a ProgramState's
 //  generic data map.
 //
@@ -81,6 +81,10 @@ namespace ento {
       return F.remove(B, K);
     }
 
+    static bool Contains(data_type B, key_type K) {
+      return B.contains(K);
+    }
+
     static inline context_type MakeContext(void *p) {
       return *((typename data_type::Factory*) p);
     }
@@ -185,7 +189,7 @@ namespace ento {
     }
   };
 
-  
+
   // Partial specialization for bool.
   template <> struct ProgramStatePartialTrait<bool> {
     typedef bool data_type;
@@ -198,7 +202,7 @@ namespace ento {
       return (void*) (uintptr_t) d;
     }
   };
-  
+
   // Partial specialization for unsigned.
   template <> struct ProgramStatePartialTrait<unsigned> {
     typedef unsigned data_type;




More information about the cfe-commits mailing list