[libc-commits] [PATCH] D85790: [libc][NFC] Extend <ASSERT|EXPECT>_STR* macros to compare with nullptr.

Chris Gyurgyik via Phabricator via libc-commits libc-commits at lists.llvm.org
Wed Aug 12 04:52:48 PDT 2020


cgyurgyik added inline comments.


================
Comment at: libc/utils/UnitTest/Test.cpp:256
                      unsigned long Line) {
+  if (LHS == nullptr)
+    LHS = "<nullptr>";
----------------
So if I'm not mistaken, this will just compare `"<nullptr>"` with the other string, which will (falsely) return true if the other string is also the string literal `"<nullptr>"`? Maybe we can put something else a bit longer, such as `___<nullptr>___` ? 
Or, just simply check here if the other string is actually the string literal `"<nullptr>"` to catch that case. 

Just blanket suggestions, please let me know if I'm mistaken here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85790



More information about the libc-commits mailing list