mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-22 23:55:08 +00:00
Simplify lsp.h and fix qual_name_offset when SetVarDetail is called on an existing variable
This commit is contained in:
parent
cdc7544471
commit
9ed024f5cc
@ -632,6 +632,7 @@ void SetVarDetail(IndexVar* var,
|
|||||||
else
|
else
|
||||||
hover += std::to_string(clang_getEnumConstantDeclValue(cursor.cx_cursor));
|
hover += std::to_string(clang_getEnumConstantDeclValue(cursor.cx_cursor));
|
||||||
def.detailed_name = std::move(qualified_name);
|
def.detailed_name = std::move(qualified_name);
|
||||||
|
def.qual_name_offset = 0;
|
||||||
def.hover = hover;
|
def.hover = hover;
|
||||||
} else {
|
} else {
|
||||||
#if 0 && CINDEX_HAVE_PRETTY
|
#if 0 && CINDEX_HAVE_PRETTY
|
||||||
@ -639,9 +640,9 @@ void SetVarDetail(IndexVar* var,
|
|||||||
#else
|
#else
|
||||||
int offset = type_name.size();
|
int offset = type_name.size();
|
||||||
offset += ConcatTypeAndName(type_name, qualified_name);
|
offset += ConcatTypeAndName(type_name, qualified_name);
|
||||||
|
def.detailed_name = type_name;
|
||||||
def.qual_name_offset = offset;
|
def.qual_name_offset = offset;
|
||||||
def.short_name_offset += offset;
|
def.short_name_offset += offset;
|
||||||
def.detailed_name = type_name;
|
|
||||||
// Append the textual initializer, bit field, constructor to |hover|.
|
// Append the textual initializer, bit field, constructor to |hover|.
|
||||||
// Omit |hover| for these types:
|
// Omit |hover| for these types:
|
||||||
// int (*a)(); int (&a)(); int (&&a)(); int a[1]; auto x = ...
|
// int (*a)(); int (&a)(); int (&&a)(); int a[1]; auto x = ...
|
||||||
@ -664,12 +665,6 @@ void SetVarDetail(IndexVar* var,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
// FIXME QualifiedName should return index
|
|
||||||
auto idx = def.detailed_name.rfind(short_name.begin(), std::string::npos,
|
|
||||||
short_name.size());
|
|
||||||
assert(idx != std::string::npos);
|
|
||||||
def.short_name_offset = idx;
|
|
||||||
def.short_name_size = short_name.size();
|
|
||||||
|
|
||||||
if (is_first_seen) {
|
if (is_first_seen) {
|
||||||
std::optional<IndexTypeId> var_type =
|
std::optional<IndexTypeId> var_type =
|
||||||
@ -1711,9 +1706,6 @@ void OnIndexDeclaration(CXClientData client_data, const CXIdxDeclInfo* decl) {
|
|||||||
// indexing the definition, then there will not be any (ie) outline
|
// indexing the definition, then there will not be any (ie) outline
|
||||||
// information.
|
// information.
|
||||||
if (!is_template_specialization) {
|
if (!is_template_specialization) {
|
||||||
// Build detailed name. The type desc looks like void (void *). We
|
|
||||||
// insert the qualified name before the first '('.
|
|
||||||
// FIXME GetFunctionSignature should set index
|
|
||||||
#if CINDEX_HAVE_PRETTY
|
#if CINDEX_HAVE_PRETTY
|
||||||
std::tie(func->def.detailed_name, func->def.qual_name_offset,
|
std::tie(func->def.detailed_name, func->def.qual_name_offset,
|
||||||
func->def.short_name_offset, func->def.short_name_size) =
|
func->def.short_name_offset, func->def.short_name_size) =
|
||||||
@ -2384,7 +2376,7 @@ void Reflect(Writer& visitor, Reference& value) {
|
|||||||
char buf[99];
|
char buf[99];
|
||||||
snprintf(buf, sizeof buf, "%s|%" PRId32 "|%d|%d",
|
snprintf(buf, sizeof buf, "%s|%" PRId32 "|%d|%d",
|
||||||
value.range.ToString().c_str(),
|
value.range.ToString().c_str(),
|
||||||
static_cast<std::make_signed<RawId>::type>(value.id.id),
|
static_cast<std::make_signed_t<RawId>>(value.id.id),
|
||||||
int(value.kind), int(value.role));
|
int(value.kind), int(value.role));
|
||||||
std::string s(buf);
|
std::string s(buf);
|
||||||
Reflect(visitor, s);
|
Reflect(visitor, s);
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <ctype.h>
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
@ -40,14 +39,13 @@ struct Id {
|
|||||||
explicit Id(RawId id) : id(id) {}
|
explicit Id(RawId id) : id(id) {}
|
||||||
// Id<T> -> Id<void> or Id<T> -> Id<T> is allowed implicitly.
|
// Id<T> -> Id<void> or Id<T> -> Id<T> is allowed implicitly.
|
||||||
template <typename U,
|
template <typename U,
|
||||||
typename std::enable_if<std::is_void<T>::value ||
|
typename std::enable_if_t<std::is_void_v<T> || std::is_same_v<T, U>,
|
||||||
std::is_same<T, U>::value,
|
bool> = false>
|
||||||
bool>::type = false>
|
|
||||||
Id(Id<U> o) : id(o.id) {}
|
Id(Id<U> o) : id(o.id) {}
|
||||||
template <typename U,
|
template <
|
||||||
typename std::enable_if<!(std::is_void<T>::value ||
|
typename U,
|
||||||
std::is_same<T, U>::value),
|
typename std::enable_if_t<!(std::is_void_v<T> || std::is_same_v<T, U>),
|
||||||
bool>::type = false>
|
bool> = false>
|
||||||
explicit Id(Id<U> o) : id(o.id) {}
|
explicit Id(Id<U> o) : id(o.id) {}
|
||||||
|
|
||||||
// Needed for google::dense_hash_map.
|
// Needed for google::dense_hash_map.
|
||||||
@ -84,15 +82,11 @@ struct SymbolIdx {
|
|||||||
bool operator==(const SymbolIdx& o) const {
|
bool operator==(const SymbolIdx& o) const {
|
||||||
return id == o.id && kind == o.kind;
|
return id == o.id && kind == o.kind;
|
||||||
}
|
}
|
||||||
bool operator!=(const SymbolIdx& o) const { return !(*this == o); }
|
|
||||||
bool operator<(const SymbolIdx& o) const {
|
bool operator<(const SymbolIdx& o) const {
|
||||||
if (id != o.id)
|
return !(id == o.id) ? id < o.id : kind < o.kind;
|
||||||
return id < o.id;
|
|
||||||
return kind < o.kind;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
MAKE_REFLECT_STRUCT(SymbolIdx, kind, id);
|
MAKE_REFLECT_STRUCT(SymbolIdx, kind, id);
|
||||||
MAKE_HASHABLE(SymbolIdx, t.kind, t.id);
|
|
||||||
|
|
||||||
struct Reference {
|
struct Reference {
|
||||||
Range range;
|
Range range;
|
||||||
@ -240,7 +234,6 @@ struct IndexType {
|
|||||||
|
|
||||||
bool operator<(const IndexType& other) const { return id < other.id; }
|
bool operator<(const IndexType& other) const { return id < other.id; }
|
||||||
};
|
};
|
||||||
MAKE_HASHABLE(IndexType, t.id);
|
|
||||||
|
|
||||||
template <typename F>
|
template <typename F>
|
||||||
struct FuncDef : NameMixin<FuncDef<F>> {
|
struct FuncDef : NameMixin<FuncDef<F>> {
|
||||||
@ -332,7 +325,6 @@ struct IndexFunc : NameMixin<IndexFunc> {
|
|||||||
|
|
||||||
bool operator<(const IndexFunc& other) const { return id < other.id; }
|
bool operator<(const IndexFunc& other) const { return id < other.id; }
|
||||||
};
|
};
|
||||||
MAKE_HASHABLE(IndexFunc, t.id);
|
|
||||||
MAKE_REFLECT_STRUCT(IndexFunc::Declaration, spell, param_spellings);
|
MAKE_REFLECT_STRUCT(IndexFunc::Declaration, spell, param_spellings);
|
||||||
|
|
||||||
template <typename F>
|
template <typename F>
|
||||||
@ -401,7 +393,6 @@ struct IndexVar {
|
|||||||
|
|
||||||
bool operator<(const IndexVar& other) const { return id < other.id; }
|
bool operator<(const IndexVar& other) const { return id < other.id; }
|
||||||
};
|
};
|
||||||
MAKE_HASHABLE(IndexVar, t.id);
|
|
||||||
|
|
||||||
struct IdCache {
|
struct IdCache {
|
||||||
std::string primary_file;
|
std::string primary_file;
|
||||||
|
@ -200,8 +200,6 @@ lsDocumentUri lsDocumentUri::FromPath(const std::string& path) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
lsDocumentUri::lsDocumentUri() {}
|
|
||||||
|
|
||||||
bool lsDocumentUri::operator==(const lsDocumentUri& other) const {
|
bool lsDocumentUri::operator==(const lsDocumentUri& other) const {
|
||||||
return raw_uri == other.raw_uri;
|
return raw_uri == other.raw_uri;
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,6 @@ struct lsResponseError {
|
|||||||
struct lsDocumentUri {
|
struct lsDocumentUri {
|
||||||
static lsDocumentUri FromPath(const std::string& path);
|
static lsDocumentUri FromPath(const std::string& path);
|
||||||
|
|
||||||
lsDocumentUri();
|
|
||||||
bool operator==(const lsDocumentUri& other) const;
|
bool operator==(const lsDocumentUri& other) const;
|
||||||
|
|
||||||
void SetPath(const std::string& path);
|
void SetPath(const std::string& path);
|
||||||
@ -97,7 +96,6 @@ struct lsDocumentUri {
|
|||||||
|
|
||||||
std::string raw_uri;
|
std::string raw_uri;
|
||||||
};
|
};
|
||||||
MAKE_HASHABLE(lsDocumentUri, t.raw_uri);
|
|
||||||
|
|
||||||
template <typename TVisitor>
|
template <typename TVisitor>
|
||||||
void Reflect(TVisitor& visitor, lsDocumentUri& value) {
|
void Reflect(TVisitor& visitor, lsDocumentUri& value) {
|
||||||
@ -115,7 +113,6 @@ struct lsPosition {
|
|||||||
}
|
}
|
||||||
std::string ToString() const;
|
std::string ToString() const;
|
||||||
};
|
};
|
||||||
MAKE_HASHABLE(lsPosition, t.line, t.character);
|
|
||||||
MAKE_REFLECT_STRUCT(lsPosition, line, character);
|
MAKE_REFLECT_STRUCT(lsPosition, line, character);
|
||||||
|
|
||||||
struct lsRange {
|
struct lsRange {
|
||||||
@ -128,7 +125,6 @@ struct lsRange {
|
|||||||
return !(start == o.start) ? start < o.start : end < o.end;
|
return !(start == o.start) ? start < o.start : end < o.end;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
MAKE_HASHABLE(lsRange, t.start, t.end);
|
|
||||||
MAKE_REFLECT_STRUCT(lsRange, start, end);
|
MAKE_REFLECT_STRUCT(lsRange, start, end);
|
||||||
|
|
||||||
struct lsLocation {
|
struct lsLocation {
|
||||||
@ -142,7 +138,6 @@ struct lsLocation {
|
|||||||
: range < o.range;
|
: range < o.range;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
MAKE_HASHABLE(lsLocation, t.uri, t.range);
|
|
||||||
MAKE_REFLECT_STRUCT(lsLocation, uri, range);
|
MAKE_REFLECT_STRUCT(lsLocation, uri, range);
|
||||||
|
|
||||||
enum class lsSymbolKind : uint8_t {
|
enum class lsSymbolKind : uint8_t {
|
||||||
@ -358,11 +353,13 @@ MAKE_REFLECT_STRUCT(lsTextDocumentDidChangeParams,
|
|||||||
// Show a message to the user.
|
// Show a message to the user.
|
||||||
enum class lsMessageType : int { Error = 1, Warning = 2, Info = 3, Log = 4 };
|
enum class lsMessageType : int { Error = 1, Warning = 2, Info = 3, Log = 4 };
|
||||||
MAKE_REFLECT_TYPE_PROXY(lsMessageType)
|
MAKE_REFLECT_TYPE_PROXY(lsMessageType)
|
||||||
|
|
||||||
struct Out_ShowLogMessageParams {
|
struct Out_ShowLogMessageParams {
|
||||||
lsMessageType type = lsMessageType::Error;
|
lsMessageType type = lsMessageType::Error;
|
||||||
std::string message;
|
std::string message;
|
||||||
};
|
};
|
||||||
MAKE_REFLECT_STRUCT(Out_ShowLogMessageParams, type, message);
|
MAKE_REFLECT_STRUCT(Out_ShowLogMessageParams, type, message);
|
||||||
|
|
||||||
struct Out_ShowLogMessage : public lsOutMessage<Out_ShowLogMessage> {
|
struct Out_ShowLogMessage : public lsOutMessage<Out_ShowLogMessage> {
|
||||||
enum class DisplayType { Show, Log };
|
enum class DisplayType { Show, Log };
|
||||||
DisplayType display_type = DisplayType::Show;
|
DisplayType display_type = DisplayType::Show;
|
||||||
@ -370,6 +367,7 @@ struct Out_ShowLogMessage : public lsOutMessage<Out_ShowLogMessage> {
|
|||||||
std::string method();
|
std::string method();
|
||||||
Out_ShowLogMessageParams params;
|
Out_ShowLogMessageParams params;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename TVisitor>
|
template <typename TVisitor>
|
||||||
void Reflect(TVisitor& visitor, Out_ShowLogMessage& value) {
|
void Reflect(TVisitor& visitor, Out_ShowLogMessage& value) {
|
||||||
REFLECT_MEMBER_START();
|
REFLECT_MEMBER_START();
|
||||||
|
@ -9,6 +9,8 @@
|
|||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
MAKE_HASHABLE(SymbolIdx, t.kind, t.id);
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
struct Out_CclsSetInactiveRegion
|
struct Out_CclsSetInactiveRegion
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
|
|
||||||
|
MAKE_HASHABLE(SymbolIdx, t.kind, t.id);
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
MethodType kMethodType = "$ccls/random";
|
MethodType kMethodType = "$ccls/random";
|
||||||
|
|
||||||
|
@ -59,13 +59,10 @@ void AddCodeLens(const char* singular,
|
|||||||
code_lens.command->arguments.position = code_lens.range.start;
|
code_lens.command->arguments.position = code_lens.range.start;
|
||||||
|
|
||||||
// Add unique uses.
|
// Add unique uses.
|
||||||
std::unordered_set<lsLocation> unique_uses;
|
std::vector<lsLocation> unique_uses;
|
||||||
for (Use use1 : uses) {
|
for (Use use1 : uses) {
|
||||||
std::optional<lsLocation> location =
|
if (auto ls_loc = GetLsLocation(common->db, common->working_files, use1))
|
||||||
GetLsLocation(common->db, common->working_files, use1);
|
unique_uses.push_back(*ls_loc);
|
||||||
if (!location)
|
|
||||||
continue;
|
|
||||||
unique_uses.insert(*location);
|
|
||||||
}
|
}
|
||||||
code_lens.command->arguments.locations.assign(unique_uses.begin(),
|
code_lens.command->arguments.locations.assign(unique_uses.begin(),
|
||||||
unique_uses.end());
|
unique_uses.end());
|
||||||
|
@ -41,7 +41,7 @@ struct Handler_TextDocumentDocumentSymbol
|
|||||||
|
|
||||||
for (SymbolRef sym : file->def->outline) {
|
for (SymbolRef sym : file->def->outline) {
|
||||||
std::optional<lsSymbolInformation> info =
|
std::optional<lsSymbolInformation> info =
|
||||||
GetSymbolInfo(db, working_files, sym, true /*use_short_name*/);
|
GetSymbolInfo(db, working_files, sym, false);
|
||||||
if (!info)
|
if (!info)
|
||||||
continue;
|
continue;
|
||||||
if (sym.kind == SymbolKind::Var) {
|
if (sym.kind == SymbolKind::Var) {
|
||||||
|
@ -20,13 +20,12 @@ bool InsertSymbolIntoResult(QueryDatabase* db,
|
|||||||
SymbolIdx symbol,
|
SymbolIdx symbol,
|
||||||
std::vector<lsSymbolInformation>* result) {
|
std::vector<lsSymbolInformation>* result) {
|
||||||
std::optional<lsSymbolInformation> info =
|
std::optional<lsSymbolInformation> info =
|
||||||
GetSymbolInfo(db, working_files, symbol, false /*use_short_name*/);
|
GetSymbolInfo(db, working_files, symbol, true);
|
||||||
if (!info)
|
if (!info)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Maybe<Use> location = GetDefinitionExtent(db, symbol);
|
|
||||||
Use loc;
|
Use loc;
|
||||||
if (location)
|
if (Maybe<Use> location = GetDefinitionExtent(db, symbol))
|
||||||
loc = *location;
|
loc = *location;
|
||||||
else {
|
else {
|
||||||
auto decls = GetNonDefDeclarations(db, symbol);
|
auto decls = GetNonDefDeclarations(db, symbol);
|
||||||
|
@ -284,7 +284,7 @@ lsSymbolKind GetSymbolKind(QueryDatabase* db, SymbolIdx sym) {
|
|||||||
std::optional<lsSymbolInformation> GetSymbolInfo(QueryDatabase* db,
|
std::optional<lsSymbolInformation> GetSymbolInfo(QueryDatabase* db,
|
||||||
WorkingFiles* working_files,
|
WorkingFiles* working_files,
|
||||||
SymbolIdx sym,
|
SymbolIdx sym,
|
||||||
bool use_short_name) {
|
bool detailed_name) {
|
||||||
switch (sym.kind) {
|
switch (sym.kind) {
|
||||||
case SymbolKind::Invalid:
|
case SymbolKind::Invalid:
|
||||||
break;
|
break;
|
||||||
@ -301,10 +301,10 @@ std::optional<lsSymbolInformation> GetSymbolInfo(QueryDatabase* db,
|
|||||||
default: {
|
default: {
|
||||||
lsSymbolInformation info;
|
lsSymbolInformation info;
|
||||||
EachEntityDef(db, sym, [&](const auto& def) {
|
EachEntityDef(db, sym, [&](const auto& def) {
|
||||||
if (use_short_name)
|
if (detailed_name)
|
||||||
info.name = def.Name(true);
|
|
||||||
else
|
|
||||||
info.name = def.detailed_name;
|
info.name = def.detailed_name;
|
||||||
|
else
|
||||||
|
info.name = def.Name(true);
|
||||||
info.kind = def.kind;
|
info.kind = def.kind;
|
||||||
info.containerName = def.detailed_name;
|
info.containerName = def.detailed_name;
|
||||||
return false;
|
return false;
|
||||||
|
@ -46,7 +46,7 @@ std::vector<lsLocationEx> GetLsLocationExs(QueryDatabase* db,
|
|||||||
std::optional<lsSymbolInformation> GetSymbolInfo(QueryDatabase* db,
|
std::optional<lsSymbolInformation> GetSymbolInfo(QueryDatabase* db,
|
||||||
WorkingFiles* working_files,
|
WorkingFiles* working_files,
|
||||||
SymbolIdx sym,
|
SymbolIdx sym,
|
||||||
bool use_short_name);
|
bool detailed_name);
|
||||||
|
|
||||||
std::vector<SymbolRef> FindSymbolsAtLocation(WorkingFile* working_file,
|
std::vector<SymbolRef> FindSymbolsAtLocation(WorkingFile* working_file,
|
||||||
QueryFile* file,
|
QueryFile* file,
|
||||||
|
@ -76,7 +76,7 @@ struct IndexFile;
|
|||||||
#define REFLECT_MEMBER2(name, value) ReflectMember(visitor, name, value)
|
#define REFLECT_MEMBER2(name, value) ReflectMember(visitor, name, value)
|
||||||
|
|
||||||
#define MAKE_REFLECT_TYPE_PROXY(type_name) \
|
#define MAKE_REFLECT_TYPE_PROXY(type_name) \
|
||||||
MAKE_REFLECT_TYPE_PROXY2(type_name, std::underlying_type<type_name>::type)
|
MAKE_REFLECT_TYPE_PROXY2(type_name, std::underlying_type_t<type_name>)
|
||||||
#define MAKE_REFLECT_TYPE_PROXY2(type, as_type) \
|
#define MAKE_REFLECT_TYPE_PROXY2(type, as_type) \
|
||||||
ATTRIBUTE_UNUSED inline void Reflect(Reader& visitor, type& value) { \
|
ATTRIBUTE_UNUSED inline void Reflect(Reader& visitor, type& value) { \
|
||||||
as_type value0; \
|
as_type value0; \
|
||||||
@ -243,19 +243,13 @@ struct ReflectVariant {
|
|||||||
// If T appears in Ts..., we should set the value of std::variant<Ts...> to
|
// If T appears in Ts..., we should set the value of std::variant<Ts...> to
|
||||||
// what we get from Reader.
|
// what we get from Reader.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
typename std::enable_if<std::disjunction<std::is_same<T, Ts>...>::value,
|
void ReflectTag(Reader& visitor, std::variant<Ts...>& value) {
|
||||||
void>::type
|
if constexpr (std::disjunction_v<std::is_same<T, Ts>...>) {
|
||||||
ReflectTag(Reader& visitor, std::variant<Ts...>& value) {
|
|
||||||
T a;
|
T a;
|
||||||
Reflect(visitor, a);
|
Reflect(visitor, a);
|
||||||
value = std::move(a);
|
value = std::move(a);
|
||||||
}
|
}
|
||||||
// This SFINAE overload is used to prevent compile error. value = a; is not
|
}
|
||||||
// allowed if T does not appear in Ts...
|
|
||||||
template <typename T>
|
|
||||||
typename std::enable_if<!std::disjunction<std::is_same<T, Ts>...>::value,
|
|
||||||
void>::type
|
|
||||||
ReflectTag(Reader&, std::variant<Ts...>&) {}
|
|
||||||
|
|
||||||
void operator()(Reader& visitor, std::variant<Ts...>& value) {
|
void operator()(Reader& visitor, std::variant<Ts...>& value) {
|
||||||
// Based on tag dispatch, call different ReflectTag helper.
|
// Based on tag dispatch, call different ReflectTag helper.
|
||||||
@ -263,7 +257,7 @@ struct ReflectVariant {
|
|||||||
ReflectTag<std::monostate>(visitor, value);
|
ReflectTag<std::monostate>(visitor, value);
|
||||||
// It is possible that IsInt64() && IsInt(). We don't call ReflectTag<int>
|
// It is possible that IsInt64() && IsInt(). We don't call ReflectTag<int>
|
||||||
// if int is not in Ts...
|
// if int is not in Ts...
|
||||||
else if (std::disjunction<std::is_same<int, Ts>...>::value && visitor.IsInt())
|
else if (std::disjunction_v<std::is_same<int, Ts>...> && visitor.IsInt())
|
||||||
ReflectTag<int>(visitor, value);
|
ReflectTag<int>(visitor, value);
|
||||||
else if (visitor.IsInt64())
|
else if (visitor.IsInt64())
|
||||||
ReflectTag<int64_t>(visitor, value);
|
ReflectTag<int64_t>(visitor, value);
|
||||||
|
@ -256,8 +256,7 @@ void WorkingFile::ComputeLineMapping() {
|
|||||||
// For index line i, set index_to_buffer[i] to -1 if line i is duplicated.
|
// For index line i, set index_to_buffer[i] to -1 if line i is duplicated.
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (auto& line : index_lines) {
|
for (auto& line : index_lines) {
|
||||||
std::string trimmed = Trim(line);
|
uint64_t h = HashUsr(line);
|
||||||
uint64_t h = HashUsr(trimmed);
|
|
||||||
auto it = hash_to_unique.find(h);
|
auto it = hash_to_unique.find(h);
|
||||||
if (it == hash_to_unique.end()) {
|
if (it == hash_to_unique.end()) {
|
||||||
hash_to_unique[h] = i;
|
hash_to_unique[h] = i;
|
||||||
@ -274,8 +273,7 @@ void WorkingFile::ComputeLineMapping() {
|
|||||||
i = 0;
|
i = 0;
|
||||||
hash_to_unique.clear();
|
hash_to_unique.clear();
|
||||||
for (auto& line : buffer_lines) {
|
for (auto& line : buffer_lines) {
|
||||||
std::string trimmed = Trim(line);
|
uint64_t h = HashUsr(line);
|
||||||
uint64_t h = HashUsr(trimmed);
|
|
||||||
auto it = hash_to_unique.find(h);
|
auto it = hash_to_unique.find(h);
|
||||||
if (it == hash_to_unique.end()) {
|
if (it == hash_to_unique.end()) {
|
||||||
hash_to_unique[h] = i;
|
hash_to_unique[h] = i;
|
||||||
|
Loading…
Reference in New Issue
Block a user