[PATCH] D159471: [DWARFVerifier] Allow ObjectiveC names in dwarf_debug tables

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 15 22:38:33 PDT 2023


dblaikie added inline comments.


================
Comment at: llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp:1367
+        // a vector resize which may destroy the StringRef memory.
+        Result.push_back(StrippedName->str());
+    }
----------------
Technically, that'd be the behavior of this code even if it used `*` instead of `->str()`, right? Since `push_back` takes a `T&&` parameter the `StringRef`->`std::string` implicit conversion would happen first, before the function call.

So I'm not sure the use of `->str()` is sufficiently more explicit to make it clear what's going on here. Maybe the comment is sufficient and we could use `*`, or maybe it isn't, and a named temporary (`std::string X = *y; func(std::move(X);`) might be better, or an explicit cast (I guess that's no better than the `->str()`)?

I'm not feeling strongly about any of this - if the comment and the slightly different syntax feels like the right tradeoff to you folks, I won't stand in the way.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159471



More information about the llvm-commits mailing list