[Lldb-commits] [PATCH] D40519: Remove some duplicated code in UUID.cpp

Zachary Turner via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Nov 27 14:28:13 PST 2017


zturner added inline comments.


================
Comment at: source/Utility/UUID.cpp:77-78
 void UUID::Dump(Stream *s) const {
-  const uint8_t *u = (const uint8_t *)GetBytes();
-  s->Printf("%2.2X%2.2X%2.2X%2.2X-%2.2X%2.2X-%2.2X%2.2X-%2.2X%2.2X-%2.2X%2.2X%"
-            "2.2X%2.2X%2.2X%2.2X",
-            u[0], u[1], u[2], u[3], u[4], u[5], u[6], u[7], u[8], u[9], u[10],
-            u[11], u[12], u[13], u[14], u[15]);
-  if (m_num_uuid_bytes == 20) {
-    s->Printf("-%2.2X%2.2X%2.2X%2.2X", u[16], u[17], u[18], u[19]);
-  }
+  auto str = GetAsString();
+  s->Printf("%s", str.c_str());
 }
----------------
Minor nit, but when you have a string and only want to print that string and nothing else, I would usually prefer not using printf syntax and instead just using `PutCString`.


https://reviews.llvm.org/D40519





More information about the lldb-commits mailing list