diff options
Diffstat (limited to 'contrib/llvm-project/clang/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h')
-rw-r--r-- | contrib/llvm-project/clang/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/contrib/llvm-project/clang/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h b/contrib/llvm-project/clang/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h index 8a778389bcbe..ec503b41b381 100644 --- a/contrib/llvm-project/clang/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h +++ b/contrib/llvm-project/clang/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h @@ -66,10 +66,14 @@ class LazyCompoundValData : public llvm::FoldingSetNode { public: LazyCompoundValData(const StoreRef &st, const TypedValueRegion *r) : store(st), region(r) { + assert(r); assert(NonLoc::isCompoundType(r->getValueType())); } + /// It might return null. const void *getStore() const { return store.getStore(); } + + LLVM_ATTRIBUTE_RETURNS_NONNULL const TypedValueRegion *getRegion() const { return region; } static void Profile(llvm::FoldingSetNodeID& ID, @@ -97,6 +101,8 @@ public: llvm::ImmutableList<const CXXBaseSpecifier *> L); void Profile(llvm::FoldingSetNodeID &ID) { Profile(ID, D, L); } + + /// It might return null. const NamedDecl *getDeclaratorDecl() const { return D; } llvm::ImmutableList<const CXXBaseSpecifier *> getCXXBaseList() const { @@ -146,9 +152,15 @@ public: T = AT->getValueType(); } - assert(T->isIntegralOrEnumerationType() || Loc::isLocType(T)); - return APSIntType(Ctx.getIntWidth(T), - !T->isSignedIntegerOrEnumerationType()); + if (T->isIntegralOrEnumerationType() || Loc::isLocType(T)) { + return APSIntType(Ctx.getIntWidth(T), + !T->isSignedIntegerOrEnumerationType()); + } else { + // implicitly handle case of T->isFixedPointType() + return APSIntType(Ctx.getIntWidth(T), T->isUnsignedFixedPointType()); + } + + llvm_unreachable("Unsupported type in getAPSIntType!"); } /// Convert - Create a new persistent APSInt with the same value as 'From' @@ -220,14 +232,6 @@ public: return getValue(0, Ctx.getTypeSize(T), true); } - const llvm::APSInt &getZeroWithPtrWidth(bool isUnsigned = true) { - return getValue(0, Ctx.getTypeSize(Ctx.VoidPtrTy), isUnsigned); - } - - const llvm::APSInt &getIntWithPtrWidth(uint64_t X, bool isUnsigned) { - return getValue(X, Ctx.getTypeSize(Ctx.VoidPtrTy), isUnsigned); - } - const llvm::APSInt &getTruthValue(bool b, QualType T) { return getValue(b ? 1 : 0, Ctx.getIntWidth(T), T->isUnsignedIntegerOrEnumerationType()); |