[PATCH] D33368: [libcxxabi][demangler] Fix a crash in the demangler
Saleem Abdulrasool via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun May 21 20:27:20 PDT 2017
compnerd requested changes to this revision.
compnerd added inline comments.
This revision now requires changes to proceed.
================
Comment at: src/cxa_demangle.cpp:3036
break;
- if (db.names.size() < 2)
+ if (k1 <= k0)
return first;
----------------
I'm not sure how `k1` can be `<` than `k0`. Isn't this effectively always going down the `==` path? If I'm just mistaken, then I think that this needs a comment.
================
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;
----------------
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(); });
https://reviews.llvm.org/D33368
More information about the cfe-commits
mailing list