[PATCH] D33368: [libcxxabi][demangler] Fix a crash in the demangler
Duncan P. N. Exon Smith via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun May 21 22:43:02 PDT 2017
dexonsmith added inline comments.
================
Comment at: src/cxa_demangle.cpp:3042-3051
+ for (size_t k = k0; k < k1; ++k) {
+ auto tmp = db.names[k].move_full();
+ if (!tmp.empty())
+ {
+ if (!is_first_it)
+ db.names[lambda_pos].first.append(", ");
+ is_first_it = false;
----------------
compnerd wrote:
> I think that using a bit of algorithm here might be nice.
>
> std::ostringstream oss(db.names[lambda_pos]);
> std::copy_if(db.names[k0], db.names[k1], std::ostream_iterator<std::string>(oss, ", "),
> [](const std::string &s) -> bool { return !s.empty(); });
Introducing a dependency on `std::ostream` would be awkward. libc++abi.dylib cannot link against libc++.dylib, and it would bloat libc++abi.dylib to use custom traits to pull in a full copy.
https://reviews.llvm.org/D33368
More information about the cfe-commits
mailing list