[webkit.NoUncountedMemberChecker] Fix a regression that every class is treated as if it's ref countable. (#131249)

This PR fixes a regression that webkit.NoUncountedMemberChecker and
alpha.webkit.NoUncheckedMemberChecker emits warnings for every class as
if they supported ref counting and checked ptr because we were
erroneously coercing the return value of isRefCountable and
isCheckedPtrCapable, which is std::optional<bool>, to boolean values.
diff --git a/clang/lib/StaticAnalyzer/Checkers/WebKit/RawPtrRefMemberChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/WebKit/RawPtrRefMemberChecker.cpp
index 593e6e3..dc4e2c7 100644
--- a/clang/lib/StaticAnalyzer/Checkers/WebKit/RawPtrRefMemberChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/WebKit/RawPtrRefMemberChecker.cpp
@@ -223,7 +223,7 @@
   std::optional<bool>
   isPtrCompatible(const clang::QualType,
                   const clang::CXXRecordDecl *R) const final {
-    return R && isRefCountable(R);
+    return R ? isRefCountable(R) : std::nullopt;
   }
 
   bool isPtrCls(const clang::CXXRecordDecl *R) const final {
@@ -246,7 +246,7 @@
   std::optional<bool>
   isPtrCompatible(const clang::QualType,
                   const clang::CXXRecordDecl *R) const final {
-    return R && isCheckedPtrCapable(R);
+    return R ? isCheckedPtrCapable(R) : std::nullopt;
   }
 
   bool isPtrCls(const clang::CXXRecordDecl *R) const final {
diff --git a/clang/test/Analysis/Checkers/WebKit/uncounted-members.cpp b/clang/test/Analysis/Checkers/WebKit/uncounted-members.cpp
index bca7b3b..1bdbaed 100644
--- a/clang/test/Analysis/Checkers/WebKit/uncounted-members.cpp
+++ b/clang/test/Analysis/Checkers/WebKit/uncounted-members.cpp
@@ -36,7 +36,6 @@
   };
 }
 
-
 namespace ignore_unions {
   union Foo {
     RefCountable* a;
@@ -60,3 +59,12 @@
 }
 
 } // ignore_system_header
+
+namespace ignore_non_ref_countable {
+  struct Foo {
+  };
+
+  struct Bar {
+    Foo* foo;
+  };
+}
\ No newline at end of file