[llvm] [NFC][ADT] Introduce a test harness for StringRefTest (PR #105500)

Sergei Barannikov via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 21 04:24:45 PDT 2024


================
@@ -16,20 +16,7 @@
 #include "gtest/gtest.h"
 using namespace llvm;
 
-namespace llvm {
-
-std::ostream &operator<<(std::ostream &OS, const StringRef &S) {
----------------
s-barannikov wrote:

These are not unused.
They are used by gtest on a test failure to print human readable representation of StringRefs.
They must be in llvm namespace.

They *should* be moved to a place where *all* GTests can see them, otherwise there is an ODR violation as explained [here](https://stackoverflow.com/questions/24673515/googletest-printto-not-getting-called-for-a-class) and they may fail to work.


https://github.com/llvm/llvm-project/pull/105500


More information about the llvm-commits mailing list