mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 15:48:19 +00:00
fixed "-O gen-C++" naming of "when" captures to avoid ambiguities due to inlining
Previously there was logic for doing this, but it was ineffectual due to the order in which canonicalization was done. This problem manifested non-deterministically depending on order-of-generation of "when" lambdas, which is why previous testing didn't catch it.
This commit is contained in:
parent
e18ab5be95
commit
1f1200e5e8
1 changed files with 5 additions and 7 deletions
|
@ -133,15 +133,13 @@ string CPPCompile::LocalName(const ID* l) const { return Canonicalize(trim_name(
|
||||||
|
|
||||||
string CPPCompile::CaptureName(const ID* c) const {
|
string CPPCompile::CaptureName(const ID* c) const {
|
||||||
// We want to strip both the module and any inlining appendage.
|
// We want to strip both the module and any inlining appendage.
|
||||||
auto n = Canonicalize(trim_name(c).c_str());
|
auto tn = trim_name(c);
|
||||||
|
|
||||||
auto appendage = n.find(".");
|
auto appendage = tn.find(".");
|
||||||
if ( appendage != string::npos ) {
|
if ( appendage != string::npos )
|
||||||
n.erase(n.begin() + appendage, n.end());
|
tn.erase(tn.begin() + appendage, tn.end());
|
||||||
n.push_back('_');
|
|
||||||
}
|
|
||||||
|
|
||||||
return n;
|
return Canonicalize(tn.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
string CPPCompile::Canonicalize(const char* name) const {
|
string CPPCompile::Canonicalize(const char* name) const {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue