[libcxx-commits] [PATCH] D154876: [Demangle] use std::string_view::data rather than &*std::string_view::begin

Nico Weber via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jul 11 09:07:41 PDT 2023


thakis added inline comments.


================
Comment at: llvm/lib/Demangle/MicrosoftDemangle.cpp:2408
+    *NMangled =
+        Name.empty() ? MangledName.size() : Name.data() - MangledName.data();
 
----------------
I think you no longer need the `.empty()` check once you use `data()`. If `Name` _is_ empty, then `*Name.begin()` is I think UB, but `Name.data()` isn't.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154876



More information about the libcxx-commits mailing list