Closed aaronpuchert closed 5 years ago
It's amazing what gets put into symbols these days... Also, parsing C++ is hard.
I'll stew on this and see what I can come up with. The potential upside is that maybe I'll be able to deal with op<< and op>> as well.
I have a band-aid fix for this that I'm not ready to post yet, but it basically does an if (nasty case) return uncollapsedName;
That isn't a real fix, as you can still get into some situations where my trivial matching code matches things that it isn't supposed to, and gives misleading results. That situation is probably preferable to where we are right now though.
I have a band-aid fix for this that I'm not ready to post yet, but it basically does an
if (nasty case) return uncollapsedName;
I've done something similar for now, because effectively it shouldn't change the statistic.
diff --git a/src/Analysis.cpp b/src/Analysis.cpp
index a556b0a..f969a73 100755
--- a/src/Analysis.cpp
+++ b/src/Analysis.cpp
@@ -278,6 +278,8 @@ std::string collapseName(const std::string &elt)
// pos is now pointing at a close angle, or it is at the end of the string
}
// append the footer
+ if (pos > new_pos)
+ pos = new_pos;
retval.append(pos, new_pos);
return retval;
}
That isn't a real fix, as you can still get into some situations where my trivial matching code matches things that it isn't supposed to, and gives misleading results. That situation is probably preferable to where we are right now though.
I think this is a pretty hard problem, because the parentheses around the comparison expression that one would expect are no longer there. Maybe something needs to be changed in the demangling code.
Should be fixed by #24
With code like
the parsing in collapseName breaks down, because
<
and>
no longer match up. Then we go intoretval.append(pos, new_pos);
withpos > new_pos
, which causes astd::length_error
to be thrown in libstdc++.Note that while C++11 syntax requires parantheses around comparisons in template arguments (like in the code above), they don't seem to appear in the string that we have here, which looks like
std::enable_if<(2u) < (sizeof(int)), int>::type
.