Skip to content

Commit

Permalink
indexer: fix getAdjustedDecl for explicit instantiations; fix incorre…
Browse files Browse the repository at this point in the history
…ct short_offset_size=1 when name is empty

Fix #516
  • Loading branch information
MaskRay committed Nov 10, 2019
1 parent 6f915fc commit e0c921f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/indexer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ const Decl *getAdjustedDecl(const Decl *d) {
while (d) {
if (auto *r = dyn_cast<CXXRecordDecl>(d)) {
if (auto *s = dyn_cast<ClassTemplateSpecializationDecl>(r)) {
if (!s->getTypeAsWritten()) {
if (!s->isExplicitSpecialization()) {
llvm::PointerUnion<ClassTemplateDecl *,
ClassTemplatePartialSpecializationDecl *>
result = s->getSpecializedTemplateOrPartial();
Expand Down Expand Up @@ -533,7 +533,8 @@ class IndexDataConsumer : public index::IndexDataConsumer {
name.replace(i, short_name.size(), qualified);
def.short_name_offset = i + qualified.size() - short_name.size();
}
def.short_name_size = 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 e0c921f

Please sign in to comment.