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,12 +111,32 @@ string CPPCompile::LocalName(const ID* l) const {
|
|||
auto n = l->Name();
|
||||
auto without_module = strstr(n, "::");
|
||||
|
||||
if ( without_module )
|
||||
return Canonicalize(without_module + 2);
|
||||
else
|
||||
while ( without_module ) {
|
||||
n = without_module + 2;
|
||||
without_module = strstr(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 cname;
|
||||
|
||||
|
@ -127,7 +147,7 @@ string CPPCompile::Canonicalize(const char* name) const {
|
|||
if ( c == '<' || c == '>' )
|
||||
continue;
|
||||
|
||||
if ( c == ':' || c == '-' )
|
||||
if ( c == ':' || c == '-' || c == '.' )
|
||||
c = '_';
|
||||
|
||||
cname += c;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue