Skip to content

Commit 468a2fb

Browse files
committed
indexer: fix getAdjustedDecl for explicit instantiations; fix incorrect short_offset_size=1 when name is empty
Fix #516
1 parent a7a982a commit 468a2fb

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/indexer.cc

+3-2
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ const Decl *getAdjustedDecl(const Decl *d) {
357357
while (d) {
358358
if (auto *r = dyn_cast<CXXRecordDecl>(d)) {
359359
if (auto *s = dyn_cast<ClassTemplateSpecializationDecl>(r)) {
360-
if (!s->getTypeAsWritten()) {
360+
if (!s->isExplicitSpecialization()) {
361361
llvm::PointerUnion<ClassTemplateDecl *,
362362
ClassTemplatePartialSpecializationDecl *>
363363
result = s->getSpecializedTemplateOrPartial();
@@ -533,7 +533,8 @@ class IndexDataConsumer : public index::IndexDataConsumer {
533533
name.replace(i, short_name.size(), qualified);
534534
def.short_name_offset = i + qualified.size() - short_name.size();
535535
}
536-
def.short_name_size = short_name.size();
536+
// name may be empty while short_name is not.
537+
def.short_name_size = name.empty() ? 0 : short_name.size();
537538
for (int paren = 0; i; i--) {
538539
// Skip parentheses in "(anon struct)::name"
539540
if (name[i - 1] == ')')

0 commit comments

Comments
 (0)