Introduce flatbuffer (#272)
Co-authored-by: star9029 <hengxings783@gmail.com>
This commit is contained in:
@@ -59,12 +59,12 @@ struct MergedIndex {
|
||||
/// A map between source file path and its header contexts.
|
||||
llvm::StringMap<HeaderContexts> contexts;
|
||||
|
||||
/// All merged symbol relations.
|
||||
llvm::DenseMap<SymbolHash, llvm::DenseMap<Relation, roaring::Roaring>> relations;
|
||||
|
||||
/// All merged symbol occurrences.
|
||||
llvm::DenseMap<Occurrence, roaring::Roaring> occurrences;
|
||||
|
||||
/// All merged symbol relations.
|
||||
llvm::DenseMap<SymbolHash, llvm::DenseMap<Relation, roaring::Roaring>> relations;
|
||||
|
||||
void remove(llvm::StringRef path);
|
||||
|
||||
void merge(llvm::StringRef path, std::uint32_t include, FileIndex& index);
|
||||
|
||||
65
include/Index/schema.fbs
Normal file
65
include/Index/schema.fbs
Normal file
@@ -0,0 +1,65 @@
|
||||
namespace clice.index.binary;
|
||||
|
||||
struct Range {
|
||||
begin: uint;
|
||||
end: uint;
|
||||
}
|
||||
|
||||
struct Occurrence {
|
||||
range: Range;
|
||||
target: ulong;
|
||||
}
|
||||
|
||||
struct Relation {
|
||||
kind: int;
|
||||
padding: int;
|
||||
range: Range;
|
||||
target_symbol: ulong;
|
||||
}
|
||||
|
||||
table CacheEntry {
|
||||
sha256: string;
|
||||
canonical_id: uint;
|
||||
}
|
||||
|
||||
struct Context {
|
||||
include_: uint;
|
||||
canonical_id: uint;
|
||||
}
|
||||
|
||||
table HeaderContexts {
|
||||
version: uint;
|
||||
includes: [Context];
|
||||
}
|
||||
|
||||
table HeaderContextsEntry {
|
||||
path: string;
|
||||
contexts: HeaderContexts;
|
||||
}
|
||||
|
||||
table OccurrenceEntry {
|
||||
occurrence: Occurrence;
|
||||
context: [ubyte];
|
||||
}
|
||||
|
||||
table RelationEntry {
|
||||
relation: Relation;
|
||||
context: [ubyte];
|
||||
}
|
||||
|
||||
table SymbolRelationsEntry {
|
||||
symbol: ulong;
|
||||
relations: [RelationEntry];
|
||||
}
|
||||
|
||||
table MergedIndex {
|
||||
max_canonical_id: uint;
|
||||
|
||||
canonical_cache: [CacheEntry];
|
||||
|
||||
contexts: [HeaderContextsEntry];
|
||||
|
||||
occurrences: [OccurrenceEntry];
|
||||
|
||||
relations: [SymbolRelationsEntry];
|
||||
}
|
||||
Reference in New Issue
Block a user