Skip to content

Commit 908c89e

Browse files
authored
[analyzer][NFC] Improve documentation of invalidateRegion methods (#102477)
... within the classes `StoreManager` and `ProgramState` and describe the connection between the two methods.
1 parent ebf530c commit 908c89e

File tree

2 files changed

+23
-13
lines changed

2 files changed

+23
-13
lines changed

clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -304,24 +304,27 @@ class ProgramState : public llvm::FoldingSetNode {
304304

305305
[[nodiscard]] ProgramStateRef killBinding(Loc LV) const;
306306

307-
/// Returns the state with bindings for the given regions
308-
/// cleared from the store.
307+
/// Returns the state with bindings for the given regions cleared from the
308+
/// store. If \p Call is non-null, also invalidates global regions (but if
309+
/// \p Call is from a system header, then this is limited to globals declared
310+
/// in system headers).
309311
///
310-
/// Optionally invalidates global regions as well.
312+
/// This calls the lower-level method \c StoreManager::invalidateRegions to
313+
/// do the actual invalidation, then calls the checker callbacks which should
314+
/// be triggered by this event.
311315
///
312316
/// \param Regions the set of regions to be invalidated.
313317
/// \param E the expression that caused the invalidation.
314318
/// \param BlockCount The number of times the current basic block has been
315-
// visited.
316-
/// \param CausesPointerEscape the flag is set to true when
317-
/// the invalidation entails escape of a symbol (representing a
318-
/// pointer). For example, due to it being passed as an argument in a
319-
/// call.
319+
/// visited.
320+
/// \param CausesPointerEscape the flag is set to true when the invalidation
321+
/// entails escape of a symbol (representing a pointer). For example,
322+
/// due to it being passed as an argument in a call.
320323
/// \param IS the set of invalidated symbols.
321324
/// \param Call if non-null, the invalidated regions represent parameters to
322325
/// the call and should be considered directly invalidated.
323-
/// \param ITraits information about special handling for a particular
324-
/// region/symbol.
326+
/// \param ITraits information about special handling for particular regions
327+
/// or symbols.
325328
[[nodiscard]] ProgramStateRef
326329
invalidateRegions(ArrayRef<const MemRegion *> Regions, const Expr *E,
327330
unsigned BlockCount, const LocationContext *LCtx,
@@ -330,7 +333,7 @@ class ProgramState : public llvm::FoldingSetNode {
330333
RegionAndSymbolInvalidationTraits *ITraits = nullptr) const;
331334

332335
[[nodiscard]] ProgramStateRef
333-
invalidateRegions(ArrayRef<SVal> Regions, const Expr *E, unsigned BlockCount,
336+
invalidateRegions(ArrayRef<SVal> Values, const Expr *E, unsigned BlockCount,
334337
const LocationContext *LCtx, bool CausesPointerEscape,
335338
InvalidatedSymbols *IS = nullptr,
336339
const CallEvent *Call = nullptr,

clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,15 @@ class StoreManager {
205205
/// invalidateRegions - Clears out the specified regions from the store,
206206
/// marking their values as unknown. Depending on the store, this may also
207207
/// invalidate additional regions that may have changed based on accessing
208-
/// the given regions. Optionally, invalidates non-static globals as well.
209-
/// \param[in] store The initial store
208+
/// the given regions. If \p Call is non-null, then this also invalidates
209+
/// non-static globals (but if \p Call is from a system header, then this is
210+
/// limited to globals declared in system headers).
211+
///
212+
/// Instead of calling this method directly, you should probably use
213+
/// \c ProgramState::invalidateRegions, which calls this and then ensures that
214+
/// the relevant checker callbacks are triggered.
215+
///
216+
/// \param[in] store The initial store.
210217
/// \param[in] Values The values to invalidate.
211218
/// \param[in] E The current statement being evaluated. Used to conjure
212219
/// symbols to mark the values of invalidated regions.

0 commit comments

Comments
 (0)