2018-08-21 05:27:52 +00:00
|
|
|
// Copyright 2017-2018 ccls Authors
|
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
2017-02-22 08:52:00 +00:00
|
|
|
#pragma once
|
|
|
|
|
2018-10-28 17:49:31 +00:00
|
|
|
#include "lsp.hh"
|
2018-10-29 04:21:21 +00:00
|
|
|
#include "position.hh"
|
2018-10-28 17:49:31 +00:00
|
|
|
#include "serializer.hh"
|
2018-10-29 04:21:21 +00:00
|
|
|
#include "utils.hh"
|
2017-09-22 01:14:57 +00:00
|
|
|
|
2018-09-23 20:31:06 +00:00
|
|
|
#include <clang/Basic/FileManager.h>
|
2018-06-01 21:22:55 +00:00
|
|
|
#include <clang/Basic/Specifiers.h>
|
2018-09-19 07:51:15 +00:00
|
|
|
#include <llvm/ADT/CachedHashString.h>
|
|
|
|
#include <llvm/ADT/DenseMap.h>
|
2018-05-15 05:13:18 +00:00
|
|
|
|
2018-08-09 17:08:14 +00:00
|
|
|
#include <stdint.h>
|
2018-03-31 05:05:21 +00:00
|
|
|
#include <string_view>
|
2018-05-04 04:20:10 +00:00
|
|
|
#include <unordered_map>
|
2017-04-14 22:30:33 +00:00
|
|
|
#include <vector>
|
2017-03-25 20:32:44 +00:00
|
|
|
|
2018-10-28 17:49:31 +00:00
|
|
|
namespace std {
|
|
|
|
template <> struct hash<llvm::sys::fs::UniqueID> {
|
|
|
|
std::size_t operator()(llvm::sys::fs::UniqueID ID) const {
|
|
|
|
size_t ret = ID.getDevice();
|
|
|
|
ccls::hash_combine(ret, ID.getFile());
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
} // namespace std
|
|
|
|
|
|
|
|
namespace ccls {
|
2018-07-07 22:25:25 +00:00
|
|
|
using Usr = uint64_t;
|
2018-11-04 18:30:18 +00:00
|
|
|
|
|
|
|
// The order matters. In FindSymbolsAtLocation, we want Var/Func ordered in
|
|
|
|
// front of others.
|
|
|
|
enum class Kind : uint8_t { Invalid, File, Type, Func, Var };
|
2018-12-02 23:53:33 +00:00
|
|
|
REFLECT_UNDERLYING_B(Kind);
|
2018-11-04 18:30:18 +00:00
|
|
|
|
|
|
|
enum class Role : uint16_t {
|
|
|
|
None = 0,
|
|
|
|
Declaration = 1 << 0,
|
|
|
|
Definition = 1 << 1,
|
|
|
|
Reference = 1 << 2,
|
|
|
|
Read = 1 << 3,
|
|
|
|
Write = 1 << 4,
|
|
|
|
Call = 1 << 5,
|
|
|
|
Dynamic = 1 << 6,
|
|
|
|
Address = 1 << 7,
|
|
|
|
Implicit = 1 << 8,
|
|
|
|
All = (1 << 9) - 1,
|
|
|
|
};
|
2018-12-02 23:53:33 +00:00
|
|
|
REFLECT_UNDERLYING_B(Role);
|
2018-11-04 18:30:18 +00:00
|
|
|
inline uint16_t operator&(Role lhs, Role rhs) {
|
|
|
|
return uint16_t(lhs) & uint16_t(rhs);
|
|
|
|
}
|
|
|
|
inline Role operator|(Role lhs, Role rhs) {
|
|
|
|
return Role(uint16_t(lhs) | uint16_t(rhs));
|
|
|
|
}
|
2018-07-07 22:25:25 +00:00
|
|
|
|
2018-02-11 18:25:37 +00:00
|
|
|
struct SymbolIdx {
|
2018-04-30 04:49:03 +00:00
|
|
|
Usr usr;
|
2018-11-03 20:52:43 +00:00
|
|
|
Kind kind;
|
2018-02-11 18:25:37 +00:00
|
|
|
|
2018-08-09 17:08:14 +00:00
|
|
|
bool operator==(const SymbolIdx &o) const {
|
2018-04-30 04:49:03 +00:00
|
|
|
return usr == o.usr && kind == o.kind;
|
2018-02-11 18:25:37 +00:00
|
|
|
}
|
2018-08-09 17:08:14 +00:00
|
|
|
bool operator<(const SymbolIdx &o) const {
|
2018-04-30 04:49:03 +00:00
|
|
|
return usr != o.usr ? usr < o.usr : kind < o.kind;
|
2018-02-11 18:25:37 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2018-10-04 23:13:30 +00:00
|
|
|
// |id,kind| refer to the referenced entity.
|
|
|
|
struct SymbolRef {
|
2018-02-08 18:38:27 +00:00
|
|
|
Range range;
|
2018-04-30 04:49:03 +00:00
|
|
|
Usr usr;
|
2018-11-03 20:52:43 +00:00
|
|
|
Kind kind;
|
2018-02-11 04:01:10 +00:00
|
|
|
Role role;
|
2018-04-30 04:49:03 +00:00
|
|
|
operator SymbolIdx() const { return {usr, kind}; }
|
2018-11-03 20:52:43 +00:00
|
|
|
std::tuple<Range, Usr, Kind, Role> ToTuple() const {
|
2018-04-30 04:49:03 +00:00
|
|
|
return std::make_tuple(range, usr, kind, role);
|
2018-02-08 18:38:27 +00:00
|
|
|
}
|
2018-10-04 23:13:30 +00:00
|
|
|
bool operator==(const SymbolRef &o) const { return ToTuple() == o.ToTuple(); }
|
|
|
|
bool Valid() const { return range.Valid(); }
|
2018-02-08 02:29:34 +00:00
|
|
|
};
|
2018-02-10 20:53:18 +00:00
|
|
|
|
2018-10-15 06:33:24 +00:00
|
|
|
struct ExtentRef : SymbolRef {
|
|
|
|
Range extent;
|
2018-11-03 20:52:43 +00:00
|
|
|
std::tuple<Range, Usr, Kind, Role, Range> ToTuple() const {
|
2018-10-15 06:33:24 +00:00
|
|
|
return std::make_tuple(range, usr, kind, role, extent);
|
|
|
|
}
|
|
|
|
bool operator==(const ExtentRef &o) const { return ToTuple() == o.ToTuple(); }
|
|
|
|
};
|
|
|
|
|
2018-10-04 23:13:30 +00:00
|
|
|
struct Ref {
|
|
|
|
Range range;
|
|
|
|
Role role;
|
|
|
|
|
|
|
|
bool Valid() const { return range.Valid(); }
|
|
|
|
std::tuple<Range, Role> ToTuple() const {
|
|
|
|
return std::make_tuple(range, role);
|
|
|
|
}
|
|
|
|
bool operator==(const Ref &o) const { return ToTuple() == o.ToTuple(); }
|
|
|
|
bool operator<(const Ref &o) const { return ToTuple() < o.ToTuple(); }
|
|
|
|
};
|
|
|
|
|
2018-05-30 06:56:14 +00:00
|
|
|
// Represents an occurrence of a variable/type, |usr,kind| refer to the lexical
|
2018-02-10 20:53:18 +00:00
|
|
|
// parent.
|
2018-10-04 23:13:30 +00:00
|
|
|
struct Use : Ref {
|
2018-02-12 04:22:47 +00:00
|
|
|
// |file| is used in Query* but not in Index*
|
2018-04-30 04:49:03 +00:00
|
|
|
int file_id = -1;
|
2018-08-09 17:08:14 +00:00
|
|
|
bool operator==(const Use &o) const {
|
2018-07-31 01:00:43 +00:00
|
|
|
// lexical container info is ignored.
|
|
|
|
return range == o.range && file_id == o.file_id;
|
2018-07-13 02:13:01 +00:00
|
|
|
}
|
2017-02-22 08:52:00 +00:00
|
|
|
};
|
|
|
|
|
2018-09-08 05:29:36 +00:00
|
|
|
struct DeclRef : Use {
|
|
|
|
Range extent;
|
|
|
|
};
|
|
|
|
|
2018-12-02 23:53:33 +00:00
|
|
|
void Reflect(JsonReader &visitor, SymbolRef &value);
|
|
|
|
void Reflect(JsonReader &visitor, Use &value);
|
|
|
|
void Reflect(JsonReader &visitor, DeclRef &value);
|
|
|
|
void Reflect(JsonWriter &visitor, SymbolRef &value);
|
|
|
|
void Reflect(JsonWriter &visitor, Use &value);
|
|
|
|
void Reflect(JsonWriter &visitor, DeclRef &value);
|
|
|
|
void Reflect(BinaryReader &visitor, SymbolRef &value);
|
|
|
|
void Reflect(BinaryReader &visitor, Use &value);
|
|
|
|
void Reflect(BinaryReader &visitor, DeclRef &value);
|
|
|
|
void Reflect(BinaryWriter &visitor, SymbolRef &value);
|
|
|
|
void Reflect(BinaryWriter &visitor, Use &value);
|
|
|
|
void Reflect(BinaryWriter &visitor, DeclRef &value);
|
2017-02-22 08:52:00 +00:00
|
|
|
|
2019-03-15 16:33:44 +00:00
|
|
|
template <typename T>
|
|
|
|
using VectorAdapter = std::vector<T, std::allocator<T>>;
|
|
|
|
|
2018-08-09 17:08:14 +00:00
|
|
|
template <typename D> struct NameMixin {
|
2018-04-06 00:00:07 +00:00
|
|
|
std::string_view Name(bool qualified) const {
|
2018-08-09 17:08:14 +00:00
|
|
|
auto self = static_cast<const D *>(this);
|
2018-06-08 04:53:41 +00:00
|
|
|
return qualified
|
|
|
|
? std::string_view(self->detailed_name + self->qual_name_offset,
|
|
|
|
self->short_name_offset -
|
|
|
|
self->qual_name_offset +
|
|
|
|
self->short_name_size)
|
|
|
|
: std::string_view(self->detailed_name + self->short_name_offset,
|
|
|
|
self->short_name_size);
|
2018-04-06 00:00:07 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2019-03-15 16:33:44 +00:00
|
|
|
template <template <typename T> class V>
|
|
|
|
struct FuncDef : NameMixin<FuncDef<V>> {
|
2017-02-22 08:52:00 +00:00
|
|
|
// General metadata.
|
2018-08-09 17:08:14 +00:00
|
|
|
const char *detailed_name = "";
|
|
|
|
const char *hover = "";
|
|
|
|
const char *comments = "";
|
2018-10-04 23:59:33 +00:00
|
|
|
Maybe<DeclRef> spell;
|
2017-04-05 08:06:18 +00:00
|
|
|
|
2018-04-30 04:49:03 +00:00
|
|
|
// Method this method overrides.
|
2019-03-15 16:33:44 +00:00
|
|
|
V<Usr> bases;
|
2018-04-30 04:49:03 +00:00
|
|
|
// Local variables or parameters.
|
2019-03-15 16:33:44 +00:00
|
|
|
V<Usr> vars;
|
2018-04-30 04:49:03 +00:00
|
|
|
// Functions that this function calls.
|
2019-03-15 16:33:44 +00:00
|
|
|
V<SymbolRef> callees;
|
2018-02-08 03:14:44 +00:00
|
|
|
|
2018-10-04 23:13:30 +00:00
|
|
|
int file_id = -1; // not serialized
|
2018-04-06 00:00:07 +00:00
|
|
|
int16_t qual_name_offset = 0;
|
2018-01-31 07:01:45 +00:00
|
|
|
int16_t short_name_offset = 0;
|
|
|
|
int16_t short_name_size = 0;
|
2018-11-03 20:52:43 +00:00
|
|
|
SymbolKind kind = SymbolKind::Unknown;
|
|
|
|
SymbolKind parent_kind = SymbolKind::Unknown;
|
2018-07-20 03:50:52 +00:00
|
|
|
uint8_t storage = clang::SC_None;
|
2018-01-31 07:01:45 +00:00
|
|
|
|
2019-03-15 16:33:44 +00:00
|
|
|
const Usr *bases_begin() const { return bases.begin(); }
|
|
|
|
const Usr *bases_end() const { return bases.end(); }
|
2017-02-25 06:08:14 +00:00
|
|
|
};
|
2019-03-15 16:33:44 +00:00
|
|
|
REFLECT_STRUCT(FuncDef<VectorAdapter>, detailed_name, hover, comments, spell,
|
|
|
|
bases, vars, callees, qual_name_offset, short_name_offset,
|
|
|
|
short_name_size, kind, parent_kind, storage);
|
2017-02-25 06:08:14 +00:00
|
|
|
|
2018-04-30 04:49:03 +00:00
|
|
|
struct IndexFunc : NameMixin<IndexFunc> {
|
2019-03-15 16:33:44 +00:00
|
|
|
using Def = FuncDef<VectorAdapter>;
|
2018-01-13 08:10:39 +00:00
|
|
|
Usr usr;
|
2017-12-12 07:56:50 +00:00
|
|
|
Def def;
|
2018-09-08 05:29:36 +00:00
|
|
|
std::vector<DeclRef> declarations;
|
2018-04-30 04:49:03 +00:00
|
|
|
std::vector<Usr> derived;
|
2018-10-04 23:13:30 +00:00
|
|
|
std::vector<Use> uses;
|
2017-02-22 08:52:00 +00:00
|
|
|
};
|
2017-02-25 23:59:09 +00:00
|
|
|
|
2019-03-15 16:33:44 +00:00
|
|
|
template <template <typename T> class V>
|
|
|
|
struct TypeDef : NameMixin<TypeDef<V>> {
|
2018-08-09 17:08:14 +00:00
|
|
|
const char *detailed_name = "";
|
|
|
|
const char *hover = "";
|
|
|
|
const char *comments = "";
|
2018-10-04 23:59:33 +00:00
|
|
|
Maybe<DeclRef> spell;
|
2017-02-22 08:52:00 +00:00
|
|
|
|
2019-03-15 16:33:44 +00:00
|
|
|
V<Usr> bases;
|
2018-04-30 04:49:03 +00:00
|
|
|
// Types, functions, and variables defined in this type.
|
2019-03-15 16:33:44 +00:00
|
|
|
V<Usr> funcs;
|
|
|
|
V<Usr> types;
|
|
|
|
V<std::pair<Usr, int64_t>> vars;
|
2017-02-22 08:52:00 +00:00
|
|
|
|
2018-04-30 04:49:03 +00:00
|
|
|
// If set, then this is the same underlying type as the given value (ie, this
|
|
|
|
// type comes from a using or typedef statement).
|
|
|
|
Usr alias_of = 0;
|
2018-10-04 23:13:30 +00:00
|
|
|
int file_id = -1; // not serialized
|
2018-04-06 00:00:07 +00:00
|
|
|
int16_t qual_name_offset = 0;
|
2018-01-31 07:01:45 +00:00
|
|
|
int16_t short_name_offset = 0;
|
|
|
|
int16_t short_name_size = 0;
|
2018-11-03 20:52:43 +00:00
|
|
|
SymbolKind kind = SymbolKind::Unknown;
|
|
|
|
SymbolKind parent_kind = SymbolKind::Unknown;
|
2018-01-31 06:39:39 +00:00
|
|
|
|
2019-03-15 16:33:44 +00:00
|
|
|
const Usr *bases_begin() const { return bases.begin(); }
|
|
|
|
const Usr *bases_end() const { return bases.end(); }
|
2017-02-25 06:08:14 +00:00
|
|
|
};
|
2019-03-15 16:33:44 +00:00
|
|
|
REFLECT_STRUCT(TypeDef<VectorAdapter>, detailed_name, hover, comments, spell,
|
|
|
|
bases, funcs, types, vars, alias_of, qual_name_offset,
|
|
|
|
short_name_offset, short_name_size, kind, parent_kind);
|
2017-02-25 06:08:14 +00:00
|
|
|
|
2018-04-30 04:49:03 +00:00
|
|
|
struct IndexType {
|
2019-03-15 16:33:44 +00:00
|
|
|
using Def = TypeDef<VectorAdapter>;
|
2018-01-13 08:10:39 +00:00
|
|
|
Usr usr;
|
2017-12-12 07:56:50 +00:00
|
|
|
Def def;
|
2018-09-08 05:29:36 +00:00
|
|
|
std::vector<DeclRef> declarations;
|
2018-04-30 04:49:03 +00:00
|
|
|
std::vector<Usr> derived;
|
|
|
|
std::vector<Usr> instances;
|
2018-10-04 23:13:30 +00:00
|
|
|
std::vector<Use> uses;
|
2017-02-22 08:52:00 +00:00
|
|
|
};
|
2017-02-25 23:59:09 +00:00
|
|
|
|
2018-04-30 04:49:03 +00:00
|
|
|
struct VarDef : NameMixin<VarDef> {
|
2017-02-22 08:52:00 +00:00
|
|
|
// General metadata.
|
2018-08-09 17:08:14 +00:00
|
|
|
const char *detailed_name = "";
|
|
|
|
const char *hover = "";
|
|
|
|
const char *comments = "";
|
2018-10-04 23:59:33 +00:00
|
|
|
Maybe<DeclRef> spell;
|
2017-02-22 08:52:00 +00:00
|
|
|
|
|
|
|
// Type of the variable.
|
2018-04-30 04:49:03 +00:00
|
|
|
Usr type = 0;
|
2018-10-04 23:13:30 +00:00
|
|
|
int file_id = -1; // not serialized
|
2018-04-06 00:00:07 +00:00
|
|
|
int16_t qual_name_offset = 0;
|
2018-01-31 07:01:45 +00:00
|
|
|
int16_t short_name_offset = 0;
|
|
|
|
int16_t short_name_size = 0;
|
2018-11-03 20:52:43 +00:00
|
|
|
SymbolKind kind = SymbolKind::Unknown;
|
|
|
|
SymbolKind parent_kind = SymbolKind::Unknown;
|
2018-01-28 04:25:14 +00:00
|
|
|
// Note a variable may have instances of both |None| and |Extern|
|
|
|
|
// (declaration).
|
2018-07-20 03:50:52 +00:00
|
|
|
uint8_t storage = clang::SC_None;
|
2018-01-15 18:08:03 +00:00
|
|
|
|
2018-05-30 06:56:14 +00:00
|
|
|
bool is_local() const {
|
2018-10-04 23:13:30 +00:00
|
|
|
return spell &&
|
2018-11-03 20:52:43 +00:00
|
|
|
(parent_kind == SymbolKind::Function ||
|
|
|
|
parent_kind == SymbolKind::Method ||
|
|
|
|
parent_kind == SymbolKind::StaticMethod ||
|
|
|
|
parent_kind == SymbolKind::Constructor) &&
|
2018-10-15 15:25:46 +00:00
|
|
|
(storage == clang::SC_None || storage == clang::SC_Auto ||
|
|
|
|
storage == clang::SC_Register);
|
2018-05-30 06:56:14 +00:00
|
|
|
}
|
2017-05-21 01:26:50 +00:00
|
|
|
|
2019-03-15 16:33:44 +00:00
|
|
|
const Usr *bases_begin() const { return nullptr; }
|
|
|
|
const Usr *bases_end() const { return nullptr; }
|
2017-02-25 06:08:14 +00:00
|
|
|
};
|
2018-12-02 23:53:33 +00:00
|
|
|
REFLECT_STRUCT(VarDef, detailed_name, hover, comments, spell, type,
|
2018-10-04 23:13:30 +00:00
|
|
|
qual_name_offset, short_name_offset, short_name_size, kind,
|
|
|
|
parent_kind, storage);
|
2017-03-14 08:33:39 +00:00
|
|
|
|
2017-05-12 06:08:15 +00:00
|
|
|
struct IndexVar {
|
2018-04-30 04:49:03 +00:00
|
|
|
using Def = VarDef;
|
2018-01-13 08:10:39 +00:00
|
|
|
Usr usr;
|
2017-12-12 07:56:50 +00:00
|
|
|
Def def;
|
2018-09-08 05:29:36 +00:00
|
|
|
std::vector<DeclRef> declarations;
|
2018-02-10 20:53:18 +00:00
|
|
|
std::vector<Use> uses;
|
2017-02-25 23:59:09 +00:00
|
|
|
};
|
|
|
|
|
2017-05-21 03:46:15 +00:00
|
|
|
struct IndexInclude {
|
|
|
|
// Line that has the include directive. We don't have complete range
|
|
|
|
// information - a line is good enough for clicking.
|
|
|
|
int line = 0;
|
|
|
|
// Absolute path to the index.
|
2018-09-19 07:51:15 +00:00
|
|
|
const char *resolved_path;
|
2017-05-21 03:46:15 +00:00
|
|
|
};
|
|
|
|
|
2017-05-12 06:08:15 +00:00
|
|
|
struct IndexFile {
|
2018-01-28 05:47:37 +00:00
|
|
|
// For both JSON and MessagePack cache files.
|
|
|
|
static const int kMajorVersion;
|
|
|
|
// For MessagePack cache files.
|
2018-01-28 03:21:35 +00:00
|
|
|
// JSON has good forward compatibility because field addition/deletion do not
|
|
|
|
// harm but currently no efforts have been made to make old MessagePack cache
|
2018-03-31 03:16:33 +00:00
|
|
|
// files accepted by newer ccls.
|
2018-01-28 05:47:37 +00:00
|
|
|
static const int kMinorVersion;
|
2017-04-20 06:02:24 +00:00
|
|
|
|
2017-02-27 07:23:43 +00:00
|
|
|
std::string path;
|
2018-09-19 16:31:45 +00:00
|
|
|
std::vector<const char *> args;
|
2018-09-08 17:37:48 +00:00
|
|
|
// This is unfortunately time_t as used by clang::FileEntry
|
|
|
|
int64_t mtime = 0;
|
2018-09-02 21:51:25 +00:00
|
|
|
LanguageId language = LanguageId::C;
|
2017-04-20 04:57:44 +00:00
|
|
|
|
2018-07-13 02:13:01 +00:00
|
|
|
// uid2lid_and_path is used to generate lid2path, but not serialized.
|
|
|
|
std::unordered_map<llvm::sys::fs::UniqueID, std::pair<int, std::string>>
|
|
|
|
uid2lid_and_path;
|
|
|
|
std::vector<std::pair<int, std::string>> lid2path;
|
|
|
|
|
2017-04-20 07:25:38 +00:00
|
|
|
// The path to the translation unit cc file which caused the creation of this
|
2017-05-12 06:08:15 +00:00
|
|
|
// IndexFile. When parsing a translation unit we generate many IndexFile
|
2017-04-20 07:25:38 +00:00
|
|
|
// instances (ie, each header has a separate one). When the user edits a
|
|
|
|
// header we need to lookup the original translation unit and reindex that.
|
|
|
|
std::string import_file;
|
|
|
|
|
2017-05-20 21:45:46 +00:00
|
|
|
// Source ranges that were not processed.
|
2018-07-06 00:53:33 +00:00
|
|
|
std::vector<Range> skipped_ranges;
|
2017-05-20 21:45:46 +00:00
|
|
|
|
2017-05-21 03:46:15 +00:00
|
|
|
std::vector<IndexInclude> includes;
|
2018-09-19 07:51:15 +00:00
|
|
|
llvm::DenseMap<llvm::CachedHashStringRef, int64_t> dependencies;
|
2018-04-30 04:49:03 +00:00
|
|
|
std::unordered_map<Usr, IndexFunc> usr2func;
|
|
|
|
std::unordered_map<Usr, IndexType> usr2type;
|
|
|
|
std::unordered_map<Usr, IndexVar> usr2var;
|
2017-02-22 08:52:00 +00:00
|
|
|
|
2017-07-30 04:24:02 +00:00
|
|
|
// File contents at the time of index. Not serialized.
|
2018-01-30 05:34:28 +00:00
|
|
|
std::string file_contents;
|
2017-06-20 01:52:25 +00:00
|
|
|
|
2018-12-21 04:53:50 +00:00
|
|
|
IndexFile(const std::string &path, const std::string &contents);
|
2017-02-22 08:52:00 +00:00
|
|
|
|
2018-08-09 17:08:14 +00:00
|
|
|
IndexFunc &ToFunc(Usr usr);
|
|
|
|
IndexType &ToType(Usr usr);
|
|
|
|
IndexVar &ToVar(Usr usr);
|
2017-02-22 08:52:00 +00:00
|
|
|
|
|
|
|
std::string ToString();
|
|
|
|
};
|
|
|
|
|
2018-12-01 06:44:52 +00:00
|
|
|
struct SemaManager;
|
2018-09-08 19:07:43 +00:00
|
|
|
struct WorkingFiles;
|
2018-09-21 01:04:55 +00:00
|
|
|
struct VFS;
|
2018-09-08 19:07:43 +00:00
|
|
|
|
2018-10-28 17:49:31 +00:00
|
|
|
namespace idx {
|
2018-09-03 19:21:32 +00:00
|
|
|
void Init();
|
2018-07-08 07:46:53 +00:00
|
|
|
std::vector<std::unique_ptr<IndexFile>>
|
2018-12-01 06:44:52 +00:00
|
|
|
Index(SemaManager *complete, WorkingFiles *wfiles, VFS *vfs,
|
2018-09-08 19:07:43 +00:00
|
|
|
const std::string &opt_wdir, const std::string &file,
|
2018-09-19 16:31:45 +00:00
|
|
|
const std::vector<const char *> &args,
|
2018-09-23 01:00:50 +00:00
|
|
|
const std::vector<std::pair<std::string, std::string>> &remapped,
|
|
|
|
bool &ok);
|
2018-10-28 17:49:31 +00:00
|
|
|
} // namespace idx
|
|
|
|
} // namespace ccls
|
|
|
|
|
|
|
|
MAKE_HASHABLE(ccls::SymbolRef, t.range, t.usr, t.kind, t.role);
|
|
|
|
MAKE_HASHABLE(ccls::ExtentRef, t.range, t.usr, t.kind, t.role, t.extent);
|
|
|
|
MAKE_HASHABLE(ccls::Use, t.range, t.file_id)
|
|
|
|
MAKE_HASHABLE(ccls::DeclRef, t.range, t.file_id)
|