[cfe-commits] r167523 - /cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h

Jordan Rose jordan_rose at apple.com
Tue Nov 6 18:35:34 PST 2012


Author: jrose
Date: Tue Nov  6 20:35:33 2012
New Revision: 167523

URL: http://llvm.org/viewvc/llvm-project?rev=167523&view=rev
Log:
[analyzer] Add some examples for the common REGISTER_*_WITH_PROGRAMSTATEs.

No functionality change (doc comments only).

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

Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h?rev=167523&r1=167522&r2=167523&view=diff
==============================================================================
--- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h Tue Nov  6 20:35:33 2012
@@ -22,7 +22,14 @@
 namespace ento {
 
   /// Declares an immutable map of type \p NameTy, suitable for placement into
-  /// the ProgramState.
+  /// the ProgramState. This is implementing using llvm::ImmutableMap.
+  ///
+  /// \code
+  /// State = State->set<Name>(K, V);
+  /// const Value *V = State->get<Name>(K); // Returns NULL if not in the map.
+  /// State = State->remove<Name>(K);
+  /// NameTy Map = State->get<Name>();
+  /// \endcode
   ///
   /// The macro should not be used inside namespaces, or for traits that must
   /// be accessible from more than one translation unit.
@@ -30,8 +37,15 @@
     REGISTER_TRAIT_WITH_PROGRAMSTATE(Name, \
                                      CLANG_ENTO_PROGRAMSTATE_MAP(Key, Value))
 
-  /// Declares an immutable list of type \p NameTy, suitable for placement into
-  /// the ProgramState.
+  /// Declares an immutable set of type \p NameTy, suitable for placement into
+  /// the ProgramState. This is implementing using llvm::ImmutableSet.
+  ///
+  /// \code
+  /// State = State->add<Name>(E);
+  /// State = State->remove<Name>(E);
+  /// bool Present = State->contains<Name>(E);
+  /// NameTy Set = State->get<Name>();
+  /// \endcode
   ///
   /// The macro should not be used inside namespaces, or for traits that must
   /// be accessible from more than one translation unit.
@@ -39,7 +53,13 @@
     REGISTER_TRAIT_WITH_PROGRAMSTATE(Name, llvm::ImmutableSet<Elem>)
   
   /// Declares an immutable list of type \p NameTy, suitable for placement into
-  /// the ProgramState.
+  /// the ProgramState. This is implementing using llvm::ImmutableList.
+  ///
+  /// \code
+  /// State = State->add<Name>(E); // Adds to the /end/ of the list.
+  /// bool Present = State->contains<Name>(E);
+  /// NameTy List = State->get<Name>();
+  /// \endcode
   ///
   /// The macro should not be used inside namespaces, or for traits that must
   /// be accessible from more than one translation unit.





More information about the cfe-commits mailing list