[nullability] Model return values for const methods returning bool.

So far, we were only modeling return values for const methods returning
pointers, but it makes sense to do this for booleans too:

- This allows us to model `operator bool()` and `has_value()` on types such as
  `std::optional` and `std::function`. We've seen a pattern where a pointer
  is nonnull iff a `std::optional` or `std::function` has a value, and the
  pointer is then later dereferenced only if the corresponding other object has
  a value. This pattern appears to be common enough to be worth supporting.

- Producing a value for these boolean return values may actually help
  convergence. It's likely that they will be used in a terminator condition at
  some point; if we don't have a value for them, we will create a fresh atom
  for the terminator condition, and this is likely worse for convergence.

PiperOrigin-RevId: 619932515
Change-Id: Ifac0cb4f814c7697484a3c52f198f097bbb952d1
diff --git a/nullability/pointer_nullability_lattice.h b/nullability/pointer_nullability_lattice.h
index b05254a..c9c0c6e 100644
--- a/nullability/pointer_nullability_lattice.h
+++ b/nullability/pointer_nullability_lattice.h
@@ -59,10 +59,10 @@
       absl::Nonnull<const Expr *> E,
       const std::function<TypeNullability()> &GetNullability);
 
-  // Gets the PointerValue associated with the RecordStorageLocation and
-  // MethodDecl of the CallExpr, creating one if it doesn't yet exist. Requires
-  // the CXXMemberCallExpr to have a supported pointer type.
-  absl::Nullable<dataflow::PointerValue *> getConstMethodReturnValue(
+  // Returns the `Value` associated with the `RecordStorageLocation` and
+  // `MethodDecl` of `CE`, creating one if it doesn't yet exist.
+  // The type of `CE` must be either a raw pointer or boolean.
+  absl::Nullable<dataflow::Value *> getConstMethodReturnValue(
       const dataflow::RecordStorageLocation &RecordLoc,
       absl::Nonnull<const CallExpr *> CE, dataflow::Environment &Env);
 
@@ -89,7 +89,7 @@
   // from that const method.
   using ConstMethodReturnValuesType = llvm::SmallDenseMap<
       const dataflow::RecordStorageLocation *,
-      llvm::SmallDenseMap<const FunctionDecl *, dataflow::PointerValue *>>;
+      llvm::SmallDenseMap<const FunctionDecl *, dataflow::Value *>>;
   ConstMethodReturnValuesType ConstMethodReturnValues;
 };