mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 15:48:19 +00:00
-O gen-C++ fix for dealing with use of more than one module qualifier
This commit is contained in:
parent
77c34787f3
commit
a93a69ba62
1 changed files with 25 additions and 5 deletions
|
@ -111,10 +111,30 @@ string CPPCompile::LocalName(const ID* l) const {
|
||||||
auto n = l->Name();
|
auto n = l->Name();
|
||||||
auto without_module = strstr(n, "::");
|
auto without_module = strstr(n, "::");
|
||||||
|
|
||||||
if ( without_module )
|
while ( without_module ) {
|
||||||
return Canonicalize(without_module + 2);
|
n = without_module + 2;
|
||||||
else
|
without_module = strstr(n, "::");
|
||||||
return Canonicalize(n);
|
}
|
||||||
|
|
||||||
|
return Canonicalize(n);
|
||||||
|
}
|
||||||
|
|
||||||
|
string CPPCompile::CaptureName(const ID* l) const {
|
||||||
|
// We want to strip both the module and any inlining appendage.
|
||||||
|
auto n = l->Name();
|
||||||
|
auto without_module = strstr(n, "::");
|
||||||
|
|
||||||
|
while ( without_module ) {
|
||||||
|
n = without_module + 2;
|
||||||
|
without_module = strstr(n, "::");
|
||||||
|
}
|
||||||
|
|
||||||
|
auto appendage = strchr(n, '.');
|
||||||
|
|
||||||
|
if ( appendage )
|
||||||
|
return string(n, appendage - n) + "_";
|
||||||
|
|
||||||
|
return string(n) + "_";
|
||||||
}
|
}
|
||||||
|
|
||||||
string CPPCompile::Canonicalize(const char* name) const {
|
string CPPCompile::Canonicalize(const char* name) const {
|
||||||
|
@ -127,7 +147,7 @@ string CPPCompile::Canonicalize(const char* name) const {
|
||||||
if ( c == '<' || c == '>' )
|
if ( c == '<' || c == '>' )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if ( c == ':' || c == '-' )
|
if ( c == ':' || c == '-' || c == '.' )
|
||||||
c = '_';
|
c = '_';
|
||||||
|
|
||||||
cname += c;
|
cname += c;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue