Move is_operator from indexer to semantic highlighting

This commit is contained in:
Fangrui Song 2018-01-26 10:08:56 -08:00
parent 351e7b6c95
commit 723c78409f
5 changed files with 1 additions and 12 deletions

View File

@ -1540,11 +1540,6 @@ void OnIndexDeclaration(CXClientData client_data, const CXIdxDeclInfo* decl) {
if (!is_template_specialization) { if (!is_template_specialization) {
func->def.short_name = decl->entityInfo->name; func->def.short_name = decl->entityInfo->name;
// Set the |is_operator| flag to true if the function name starts with
// "operator"
func->def.is_operator =
func->def.short_name.compare(0, 8, "operator") == 0;
// Build detailed name. The type desc looks like void (void *). We // Build detailed name. The type desc looks like void (void *). We
// insert the qualified name before the first '('. // insert the qualified name before the first '('.
func->def.detailed_name = GetFunctionSignature(db, ns, decl); func->def.detailed_name = GetFunctionSignature(db, ns, decl);

View File

@ -271,9 +271,6 @@ struct FuncDefDefinitionData {
// Functions that this function calls. // Functions that this function calls.
std::vector<FuncRef> callees; std::vector<FuncRef> callees;
// Used for semantic highlighting
bool is_operator = false;
bool operator==( bool operator==(
const FuncDefDefinitionData<TypeId, FuncId, VarId, FuncRef, Range>& other) const FuncDefDefinitionData<TypeId, FuncId, VarId, FuncRef, Range>& other)
const { const {
@ -314,7 +311,6 @@ void Reflect(
REFLECT_MEMBER(base); REFLECT_MEMBER(base);
REFLECT_MEMBER(locals); REFLECT_MEMBER(locals);
REFLECT_MEMBER(callees); REFLECT_MEMBER(callees);
REFLECT_MEMBER(is_operator);
REFLECT_MEMBER_END(); REFLECT_MEMBER_END();
} }

View File

@ -134,7 +134,7 @@ void EmitSemanticHighlighting(QueryDatabase* db,
QueryFunc* func = &db->funcs[sym.idx.idx]; QueryFunc* func = &db->funcs[sym.idx.idx];
if (!func->def) if (!func->def)
continue; // applies to for loop continue; // applies to for loop
if (func->def->is_operator) if (func->def->short_name.compare(0, 8, "operator") == 0)
continue; // applies to for loop continue; // applies to for loop
kind = func->def->kind; kind = func->def->kind;
is_type_member = func->def->declaring_type.has_value(); is_type_member = func->def->declaring_type.has_value();

View File

@ -69,7 +69,6 @@ optional<QueryFunc::Def> ToQuery(const IdMap& id_map,
result.base = id_map.ToQuery(func.base); result.base = id_map.ToQuery(func.base);
result.locals = id_map.ToQuery(func.locals); result.locals = id_map.ToQuery(func.locals);
result.callees = id_map.ToQuery(func.callees); result.callees = id_map.ToQuery(func.callees);
result.is_operator = func.is_operator;
return result; return result;
} }

View File

@ -159,7 +159,6 @@ template <typename TVisitor>
void Reflect(TVisitor& visitor, IndexFunc& value) { void Reflect(TVisitor& visitor, IndexFunc& value) {
REFLECT_MEMBER_START(); REFLECT_MEMBER_START();
REFLECT_MEMBER2("id", value.id); REFLECT_MEMBER2("id", value.id);
REFLECT_MEMBER2("is_operator", value.def.is_operator);
REFLECT_MEMBER2("usr", value.usr); REFLECT_MEMBER2("usr", value.usr);
REFLECT_MEMBER2("short_name", value.def.short_name); REFLECT_MEMBER2("short_name", value.def.short_name);
REFLECT_MEMBER2("detailed_name", value.def.detailed_name); REFLECT_MEMBER2("detailed_name", value.def.detailed_name);