clang 20.0.0git
DynamicExtent.h
Go to the documentation of this file.
1//===- DynamicExtent.h - Dynamic extent related APIs ------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file defines APIs that track and query dynamic extent information.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_DYNAMICEXTENT_H
14#define LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_DYNAMICEXTENT_H
15
21
22namespace clang {
23namespace ento {
24
25/// \returns The stored dynamic extent for the region \p MR.
27 const MemRegion *MR, SValBuilder &SVB);
28
29/// \returns The element extent of the type \p Ty.
31
32/// \returns The stored element count of the region \p MR.
34 const MemRegion *MR,
35 SValBuilder &SVB, QualType Ty);
36
37/// Set the dynamic extent \p Extent of the region \p MR.
40
41/// Get the dynamic extent for a symbolic value that represents a buffer. If
42/// there is an offsetting to the underlying buffer we consider that too.
43/// Returns with an SVal that represents the extent, this is Unknown if the
44/// engine cannot deduce the extent.
45/// E.g.
46/// char buf[3];
47/// (buf); // extent is 3
48/// (buf + 1); // extent is 2
49/// (buf + 3); // extent is 0
50/// (buf + 4); // extent is -1
51///
52/// char *bufptr;
53/// (bufptr) // extent is unknown
55
56/// \returns The stored element count of the region represented by a symbolic
57/// value \p BufV.
59 SVal BufV, QualType Ty);
60
61} // namespace ento
62} // namespace clang
63
64#endif // LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_DYNAMICEXTENT_H
A (possibly-)qualified type.
Definition: Type.h:941
MemRegion - The root abstract class for all memory regions.
Definition: MemRegion.h:97
SVal - This represents a symbolic expression, which can be either an L-value or an R-value.
Definition: SVals.h:55
DefinedOrUnknownSVal getDynamicElementCount(ProgramStateRef State, const MemRegion *MR, SValBuilder &SVB, QualType Ty)
SVal getDynamicExtentWithOffset(ProgramStateRef State, SVal BufV)
Get the dynamic extent for a symbolic value that represents a buffer.
DefinedOrUnknownSVal getDynamicExtent(ProgramStateRef State, const MemRegion *MR, SValBuilder &SVB)
DefinedOrUnknownSVal getElementExtent(QualType Ty, SValBuilder &SVB)
ProgramStateRef setDynamicExtent(ProgramStateRef State, const MemRegion *MR, DefinedOrUnknownSVal Extent, SValBuilder &SVB)
Set the dynamic extent Extent of the region MR.
DefinedOrUnknownSVal getDynamicElementCountWithOffset(ProgramStateRef State, SVal BufV, QualType Ty)
The JSON file list parser is used to communicate input to InstallAPI.