Improve index format.

This commit is contained in:
ykiko
2024-11-02 14:04:15 +08:00
parent 54fc28cec3
commit 5c405241fa
2 changed files with 8 additions and 8 deletions

View File

@@ -23,6 +23,8 @@ using String = Array<char>;
#undef MAKE_CLANGD_HAPPY
using SymbolID = uint64_t;
struct File {
String path;
// TODO: some flags.
@@ -30,19 +32,17 @@ struct File {
Value<Location> include;
};
struct SymbolID {
uint64_t value;
String USR;
};
struct Relation {
RelationKind kind;
Value<Location> location;
Value<SymbolID> related;
SymbolID related;
};
struct Symbol {
Value<SymbolID> id;
/// The hash of this symbol, used for quick lookup.
SymbolID id;
/// The unique identifier of this symbol.
String USR;
/// The name of this symbol.
String name;
/// The document of this symbol.

View File

@@ -145,7 +145,7 @@ public:
static memory::SymbolID generateSymbolID(const clang::Decl* decl) {
llvm::SmallString<128> USR;
clang::index::generateUSRForDecl(decl, USR);
return memory::SymbolID{llvm::hash_value(USR), USR.str().str()};
return llvm::hash_value(USR);
}
/// Add a symbol to the index.