[PATCH] D132747: [llvm][ADT] Overload output stream operator `<<` for `StringMapEntry` and `StringMap`.

weiyi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 9 02:35:21 PDT 2022


wyt added inline comments.


================
Comment at: llvm/include/llvm/Testing/ADT/StringMap.h:26
+  if (M.empty()) {
+    return OS << "{ }";
+  }
----------------
dblaikie wrote:
> wyt wrote:
> > ymandel wrote:
> > > Is there a standard representation for empty maps and, if so, is this it? 
> > I'm not aware of one, imo { } seemed pretty representative of maps.
> > Do you have a preference?
> do we need the special case for `empty`, or can it flow out of the general case naturally?
The special case keeps the braces on the same line for readability, otherwise they would be on separate lines.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132747/new/

https://reviews.llvm.org/D132747



More information about the llvm-commits mailing list