|
clang 22.0.0git
|
A record of the "type" of an APSInt, used for conversions. More...
#include "clang/StaticAnalyzer/Core/PathSensitive/APSIntType.h"
Public Types | |
| enum | RangeTestResultKind { RTR_Below = -1 , RTR_Within = 0 , RTR_Above = 1 } |
| Used to classify whether a value is representable using this type. More... | |
Public Member Functions | |
| constexpr | APSIntType (uint32_t Width, bool Unsigned) |
| APSIntType (const llvm::APSInt &Value) | |
| uint32_t | getBitWidth () const |
| bool | isUnsigned () const |
| void | apply (llvm::APSInt &Value) const |
| Convert a given APSInt, in place, to match this type. | |
| llvm::APSInt | convert (const llvm::APSInt &Value) const LLVM_READONLY |
| Convert and return a new APSInt with the given value, but this type's bit width and signedness. | |
| llvm::APSInt | getZeroValue () const LLVM_READONLY |
| Returns an all-zero value for this type. | |
| llvm::APSInt | getMinValue () const LLVM_READONLY |
| Returns the minimum value for this type. | |
| llvm::APSInt | getMaxValue () const LLVM_READONLY |
| Returns the maximum value for this type. | |
| llvm::APSInt | getValue (uint64_t RawValue) const LLVM_READONLY |
| RangeTestResultKind | testInRange (const llvm::APSInt &Val, bool AllowMixedSign) const LLVM_READONLY |
| Tests whether a given value is losslessly representable using this type. | |
| bool | operator== (const APSIntType &Other) const |
| bool | operator< (const APSIntType &Other) const |
| Provide an ordering for finding a common conversion type. | |
A record of the "type" of an APSInt, used for conversions.
Definition at line 19 of file APSIntType.h.
Used to classify whether a value is representable using this type.
| Enumerator | |
|---|---|
| RTR_Below | Value is less than the minimum representable value. |
| RTR_Within | Value is representable using this type. |
| RTR_Above | Value is greater than the maximum representable value. |
Definition at line 76 of file APSIntType.h.
|
inlineconstexpr |
Definition at line 24 of file APSIntType.h.
References clang::Unsigned.
Referenced by operator<(), and operator==().
|
inline |
Definition at line 27 of file APSIntType.h.
References getBitWidth(), and isUnsigned().
|
inline |
Convert a given APSInt, in place, to match this type.
This behaves like a C cast: converting 255u8 (0xFF) to s16 gives 255 (0x00FF), and converting -1s8 (0xFF) to u16 gives 65535 (0xFFFF).
Definition at line 37 of file APSIntType.h.
Referenced by convert().
|
inline |
Convert and return a new APSInt with the given value, but this type's bit width and signedness.
Definition at line 48 of file APSIntType.h.
References apply(), and clang::Result.
Referenced by clang::ento::RangedConstraintManager::assumeSymInclusiveRange(), clang::ento::RangedConstraintManager::assumeSymRel(), clang::ento::SMTConv::castAPSInt(), clang::ento::BasicValueFactory::Convert(), clang::ento::BasicValueFactory::Convert(), and getSimplifiedOffsets().
|
inline |
Definition at line 30 of file APSIntType.h.
Referenced by APSIntType(), clang::ento::RangedConstraintManager::assumeSymInclusiveRange(), clang::ento::RangedConstraintManager::assumeSymRel(), clang::ento::RangeSet::Factory::castTo(), and isNegationValuePreserving().
|
inline |
Returns the maximum value for this type.
Definition at line 65 of file APSIntType.h.
Referenced by clang::ento::iterator::assumeNoOverflow(), clang::ento::SValBuilder::evalIntegralCast(), isWithinConstantOverflowBounds(), and isWithinConstantOverflowBounds().
|
inline |
Returns the minimum value for this type.
Definition at line 60 of file APSIntType.h.
|
inline |
Definition at line 69 of file APSIntType.h.
Referenced by clang::ento::iterator::assumeNoOverflow(), isWithinConstantOverflowBounds(), and isWithinConstantOverflowBounds().
|
inline |
Returns an all-zero value for this type.
Definition at line 55 of file APSIntType.h.
Referenced by clang::ento::RangedConstraintManager::assumeSymInclusiveRange(), and clang::ento::RangedConstraintManager::assumeSymRel().
|
inline |
|
inline |
Provide an ordering for finding a common conversion type.
Unsigned integers are considered to be better conversion types than signed integers of the same width.
Definition at line 99 of file APSIntType.h.
References APSIntType(), and clang::Other.
|
inline |
Definition at line 91 of file APSIntType.h.
References APSIntType(), and clang::Other.
| APSIntType::RangeTestResultKind APSIntType::testInRange | ( | const llvm::APSInt & | Val, |
| bool | AllowMixedSign ) const |
Tests whether a given value is losslessly representable using this type.
| Val | The value to test. |
| AllowMixedSign | Whether or not to allow signedness conversions. This determines whether -1s8 is considered in range for 'unsigned char' (u8). |
Definition at line 15 of file APSIntType.cpp.
References RTR_Above, RTR_Below, and RTR_Within.