Skip to content

Commit

Permalink
Fix short_name_size when getNameAsString does not return a prefix (Ma…
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangjunphy authored and MaskRay committed Mar 31, 2021
1 parent 4cd308d commit 0ada56e
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/indexer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -534,15 +534,18 @@ class IndexDataConsumer : public index::IndexDataConsumer {
// e.g. operator type-parameter-1
i = 0;
def.short_name_offset = 0;
} else if (short_name.empty() || (i >= 2 && name[i - 2] == ':')) {
// Don't replace name with qualified name in ns::name Cls::*name
def.short_name_offset = i;
def.short_name_size = name.size();
} else {
name.replace(i, short_name.size(), qualified);
def.short_name_offset = i + qualified.size() - short_name.size();
if (short_name.empty() || (i >= 2 && name[i - 2] == ':')) {
// Don't replace name with qualified name in ns::name Cls::*name
def.short_name_offset = i;
} else {
name.replace(i, short_name.size(), qualified);
def.short_name_offset = i + qualified.size() - short_name.size();
}
// name may be empty while short_name is not.
def.short_name_size = name.empty() ? 0 : short_name.size();
}
// name may be empty while short_name is not.
def.short_name_size = name.empty() ? 0 : short_name.size();
for (int paren = 0; i; i--) {
// Skip parentheses in "(anon struct)::name"
if (name[i - 1] == ')')
Expand Down

0 comments on commit 0ada56e

Please sign in to comment.