From: Jordan Rose Date: Wed, 7 Nov 2012 02:35:33 +0000 (+0000) Subject: [analyzer] Add some examples for the common REGISTER_*_WITH_PROGRAMSTATEs. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=964490c0a8bd3398dc85d224a167ca9c35a36c85;p=clang [analyzer] Add some examples for the common REGISTER_*_WITH_PROGRAMSTATEs. No functionality change (doc comments only). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167523 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h b/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h index da7e6de735..4558cd9c94 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h @@ -22,7 +22,14 @@ namespace clang { 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(K, V); + /// const Value *V = State->get(K); // Returns NULL if not in the map. + /// State = State->remove(K); + /// NameTy Map = State->get(); + /// \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 @@ namespace ento { 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(E); + /// State = State->remove(E); + /// bool Present = State->contains(E); + /// NameTy Set = State->get(); + /// \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 @@ namespace ento { REGISTER_TRAIT_WITH_PROGRAMSTATE(Name, llvm::ImmutableSet) /// 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(E); // Adds to the /end/ of the list. + /// bool Present = State->contains(E); + /// NameTy List = State->get(); + /// \endcode /// /// The macro should not be used inside namespaces, or for traits that must /// be accessible from more than one translation unit.