[PATCH] D114684: Add ScopedPrinter unit tests

Jayson Yan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 30 22:04:43 PST 2021


Jaysonyan added inline comments.


================
Comment at: llvm/unittests/Support/ScopedPrinterTest.cpp:124-125
+      DictScope D(W);
+      W.printEnum("Exists", EnumList[1].Value, makeArrayRef(EnumList));
+      W.printEnum("DoesNotExist", OtherEnum.Value, makeArrayRef(EnumList));
+    }
----------------
jhenderson wrote:
> More unnecessary(?) `makeArrayRef` calls.
After trying for a bit, I don't think I can get rid of these `makeArrayRef` calls. I think it can't implicitly cast to an `ArrayRef` because the `printEnum` method takes in a template list rather than a list of concrete type. 


================
Comment at: llvm/unittests/Support/ScopedPrinterTest.cpp:153
+      DictScope D(W);
+      W.printFlags("ZeroFlag", 0, makeArrayRef(SingleBitFlags));
+      W.printFlags("NoFlag", 1 << 3, makeArrayRef(SingleBitFlags));
----------------
jhenderson wrote:
> Lots of `makeArrayRef` calls in this test, which could be simplified by using `std::vector` or other containers.
Similar comment about template lists not allowing for implicit casts to `ArrayRef`.


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

https://reviews.llvm.org/D114684



More information about the llvm-commits mailing list