mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-26 01:21:57 +00:00
Put static const
into IndexVar::def (a definition is not required unless odr-used)
This commit is contained in:
parent
9b9bf1cd19
commit
a96d9613f4
@ -1495,13 +1495,17 @@ void OnIndexDeclaration(CXClientData client_data, const CXIdxDeclInfo* decl) {
|
|||||||
var.def.kind = lsSymbolKind::Parameter;
|
var.def.kind = lsSymbolKind::Parameter;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
if (decl->isDefinition) {
|
if (!decl->isDefinition)
|
||||||
|
var.declarations.push_back(
|
||||||
|
SetUse(db, spell, lex_parent, Role::Declaration));
|
||||||
|
// For `static const`, a definition at namespace scope is not required
|
||||||
|
// unless odr-used.
|
||||||
|
if (decl->isDefinition ||
|
||||||
|
(decl->entityInfo->kind == CXIdxEntity_CXXStaticVariable &&
|
||||||
|
clang_isConstQualifiedType(clang_getCursorType(decl->cursor)))) {
|
||||||
var.def.spell = SetUse(db, spell, sem_parent, Role::Definition);
|
var.def.spell = SetUse(db, spell, sem_parent, Role::Definition);
|
||||||
var.def.extent =
|
var.def.extent =
|
||||||
SetUse(db, cursor.get_extent(), lex_parent, Role::None);
|
SetUse(db, cursor.get_extent(), lex_parent, Role::None);
|
||||||
} else {
|
|
||||||
var.declarations.push_back(
|
|
||||||
SetUse(db, spell, lex_parent, Role::Declaration));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cursor.VisitChildren(&AddDeclInitializerUsagesVisitor, db);
|
cursor.VisitChildren(&AddDeclInitializerUsagesVisitor, db);
|
||||||
|
Loading…
Reference in New Issue
Block a user