Adding verbose setters and getters for diagnostics to make ResourceUtils
code able to print verbose message.

Bug: b/279977244
Test: Verified affected atests pass
Change-Id: Iafbf4cb8a63720c95748a339b1f48dd4213f0eac
diff --git a/tools/aapt2/link/ReferenceLinker.cpp b/tools/aapt2/link/ReferenceLinker.cpp
index 9dadfb2..c69b325 100644
--- a/tools/aapt2/link/ReferenceLinker.cpp
+++ b/tools/aapt2/link/ReferenceLinker.cpp
@@ -164,8 +164,8 @@
 std::unique_ptr<Item> ReferenceLinkerTransformer::ParseValueWithAttribute(
     std::unique_ptr<Item> value, const Attribute* attr) {
   if (RawString* raw_string = ValueCast<RawString>(value.get())) {
-    std::unique_ptr<Item> transformed =
-        ResourceUtils::TryParseItemForAttribute(*raw_string->value, attr);
+    std::unique_ptr<Item> transformed = ResourceUtils::TryParseItemForAttribute(
+        context_->GetDiagnostics(), *raw_string->value, attr);
 
     // If we could not parse as any specific type, try a basic STRING.
     if (!transformed && (attr->type_mask & android::ResTable_map::TYPE_STRING)) {
diff --git a/tools/aapt2/link/XmlReferenceLinker.cpp b/tools/aapt2/link/XmlReferenceLinker.cpp
index d2e9bd7..aec7ceb 100644
--- a/tools/aapt2/link/XmlReferenceLinker.cpp
+++ b/tools/aapt2/link/XmlReferenceLinker.cpp
@@ -90,7 +90,8 @@
         attribute = &attr.compiled_attribute.value().attribute;
       }
 
-      attr.compiled_value = ResourceUtils::TryParseItemForAttribute(attr.value, attribute);
+      attr.compiled_value = ResourceUtils::TryParseItemForAttribute(context_->GetDiagnostics(),
+                                                                    attr.value, attribute);
       if (attr.compiled_value) {
         // With a compiledValue, we must resolve the reference and assign it an ID.
         attr.compiled_value->SetSource(source);