Split functions relating to type-nullability out of pointer_nullability.h

The former has been kind of an "everything that needs to be shared" grab-bag,
and it's growing...
The functionality here today splits neatly into two groups, one that interacts
with the Value world and one that interacts with the Type world, with analysis
depending on both.

The exception is getNullabilityForChild, which fits naturally into analysis.
It was moved here with the plan of being shared with diagnosis. but hasn't been.
It doesn't seem suitable to sharein its current form - it causes other layering
problems too, and its preconditions/API are defined in terms of analysis.
So I've moved this back into analysis for now.

Wrote a few words about the type-nullability model.
I'd like to follow up by renaming a few functions, adding a TypeNullability
alias, adding more tests, but trying to keep the scope for discussion smaller.

PiperOrigin-RevId: 528755134
diff --git a/nullability/BUILD b/nullability/BUILD
index 7272c47..0fffa9b 100644
--- a/nullability/BUILD
+++ b/nullability/BUILD
@@ -31,8 +31,8 @@
         ":pointer_nullability",
         ":pointer_nullability_lattice",
         ":pointer_nullability_matchers",
+        ":type_nullability",
         "@absl//absl/log:check",
-        "@absl//absl/strings",
         "@llvm-project//clang:analysis",
         "@llvm-project//clang:ast",
         "@llvm-project//clang:ast_matchers",
@@ -49,20 +49,17 @@
         ":pointer_nullability",
         ":pointer_nullability_lattice",
         ":pointer_nullability_matchers",
+        ":type_nullability",
         "@llvm-project//clang:analysis",
         "@llvm-project//clang:ast",
         "@llvm-project//clang:ast_matchers",
         "@llvm-project//clang:basic",
-        "@llvm-project//llvm:Support",
     ],
 )
 
 cc_library(
     name = "pointer_nullability",
-    srcs = [
-        "pointer_nullability.cc",
-        "type_nullability.cc",
-    ],
+    srcs = ["pointer_nullability.cc"],
     hdrs = ["pointer_nullability.h"],
     deps = [
         ":pointer_nullability_lattice",
@@ -86,3 +83,29 @@
         "@llvm-project//third-party/unittest:gtest_main",
     ],
 )
+
+cc_library(
+    name = "type_nullability",
+    srcs = ["type_nullability.cc"],
+    hdrs = ["type_nullability.h"],
+    deps = [
+        "@absl//absl/log:check",
+        "@llvm-project//clang:ast",
+        "@llvm-project//clang:basic",
+        "@llvm-project//llvm:Support",
+    ],
+)
+
+cc_test(
+    name = "type_nullability_test",
+    srcs = ["type_nullability_test.cc"],
+    deps = [
+        ":type_nullability",
+        "@absl//absl/log:check",
+        "@llvm-project//clang:testing",
+        "@llvm-project//llvm:Support",
+        "@llvm-project//third-party/unittest:gmock",
+        "@llvm-project//third-party/unittest:gtest",
+        "@llvm-project//third-party/unittest:gtest_main",
+    ],
+)