Don't show code lens on include/header guards.

This commit is contained in:
Jacob Dufault 2017-06-28 23:34:04 -07:00
parent 6ab8a27313
commit b4000fa956
2 changed files with 8 additions and 1 deletions

View File

@ -2322,7 +2322,13 @@ bool QueryDbMainLoop(
if (var->def.is_local && !config->codeLensOnLocalVariables)
continue;
AddCodeLens("ref", "refs", &common, ref.loc.OffsetStartColumn(0), var->uses, var->def.definition_spelling, true /*force_display*/);
bool force_display = true;
// Do not show 0 refs on macro with no uses, as it is most likely a
// header guard.
if (var->def.is_macro)
force_display = false;
AddCodeLens("ref", "refs", &common, ref.loc.OffsetStartColumn(0), var->uses, var->def.definition_spelling, force_display);
break;
}
case SymbolKind::File:

View File

@ -64,6 +64,7 @@ optional<QueryVar::DefUpdate> ToQuery(const IdMap& id_map, const IndexVar::Def&
result.variable_type = id_map.ToQuery(var.variable_type);
result.declaring_type = id_map.ToQuery(var.declaring_type);
result.is_local = var.is_local;
result.is_macro = var.is_macro;
return result;
}