================
@@ -271,6 +224,104 @@ class FindUninitializedField {
 };
 } // namespace
 
+namespace llvm {
+template <> struct format_provider<FindUninitializedField::FieldChainTy> {
+  static void format(const FindUninitializedField::FieldChainTy &V,
+                     raw_ostream &Stream, StringRef Style) {
+    if (V.size() == 1)
+      Stream << "(e.g., field: '" << *V[0] << "')";
+    else {
+      Stream << "(e.g., via the field chain: '";
+      bool First = true;
+      for (FindUninitializedField::FieldChainTy::const_iterator DI = V.begin(),
+                                                                DE = V.end();
+           DI != DE; ++DI) {
+        if (First)
+          First = false;
+        else
+          Stream << '.';
+        Stream << **DI;
+      }
----------------
NagyDonat wrote:

One more last minute request: please replace this with a range-base for loop.

This PR moves this loop here from a different location, while on Sunday another 
PR https://github.com/llvm/llvm-project/pull/169175 was merged which refactored 
this loop into a range-based for loop. It would be nice to preserve this minor 
code quality improvement in this PR as well.

https://github.com/llvm/llvm-project/pull/164600
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to