mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-22 23:55:08 +00:00
Enable "Make" hack only if config->index.make_unique is true.
This commit is contained in:
parent
871ae34a1b
commit
768f4ecb6e
@ -22,7 +22,7 @@ Range ResolveCXSourceRange(const CXSourceRange& range, CXFile* cx_file) {
|
||||
}
|
||||
|
||||
// TODO Place this global variable into config
|
||||
int g_enable_comments;
|
||||
extern int g_index_comments;
|
||||
|
||||
ClangType::ClangType() : cx_type() {}
|
||||
|
||||
@ -225,7 +225,7 @@ std::string ClangCursor::get_type_description() const {
|
||||
}
|
||||
|
||||
std::string ClangCursor::get_comments() const {
|
||||
if (!g_enable_comments)
|
||||
if (!g_index_comments)
|
||||
return "";
|
||||
CXSourceRange range = clang_Cursor_getCommentRange(cx_cursor);
|
||||
if (clang_Range_isNull(range))
|
||||
|
@ -145,6 +145,10 @@ struct Config {
|
||||
// - https://github.com/emacs-lsp/lsp-mode/pull/224
|
||||
// - https://github.com/autozimu/LanguageClient-neovim/issues/224
|
||||
int comments = 2;
|
||||
|
||||
// A hack to convert calls of make_shared/make_unique and other |Make|
|
||||
// variants to constructor calls.
|
||||
bool make_unique = false;
|
||||
};
|
||||
Index index;
|
||||
|
||||
@ -155,7 +159,7 @@ struct Config {
|
||||
};
|
||||
MAKE_REFLECT_STRUCT(Config::ClientCapability, snippetSupport);
|
||||
MAKE_REFLECT_STRUCT(Config::Completion, filterAndSort);
|
||||
MAKE_REFLECT_STRUCT(Config::Index, comments);
|
||||
MAKE_REFLECT_STRUCT(Config::Index, comments, make_unique);
|
||||
MAKE_REFLECT_STRUCT(Config,
|
||||
compilationDatabaseDirectory,
|
||||
cacheDirectory,
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
// Defined in command_line.cc
|
||||
extern bool g_debug;
|
||||
extern bool g_index_make_unique;
|
||||
|
||||
namespace {
|
||||
|
||||
@ -1951,7 +1952,8 @@ void OnIndexReference(CXClientData client_data, const CXIdxEntityRefInfo* ref) {
|
||||
|
||||
bool is_template = ref->referencedEntity->templateKind !=
|
||||
CXIdxEntityCXXTemplateKind::CXIdxEntity_NonTemplate;
|
||||
if (is_template && str_begin("make", ref->referencedEntity->name)) {
|
||||
if (g_index_make_unique && is_template &&
|
||||
str_begin("make", ref->referencedEntity->name)) {
|
||||
// Try to find the return type of called function. That type will have
|
||||
// the constructor function we add a usage to.
|
||||
optional<ClangCursor> opt_found_type = FindType(ref->cursor);
|
||||
|
@ -16,7 +16,8 @@
|
||||
|
||||
// TODO Cleanup global variables
|
||||
extern std::string g_init_options;
|
||||
extern int g_enable_comments;
|
||||
int g_index_comments;
|
||||
bool g_index_make_unique;
|
||||
|
||||
namespace {
|
||||
|
||||
@ -502,7 +503,8 @@ struct InitializeHandler : BaseMessageHandler<Ipc_InitializeRequest> {
|
||||
}
|
||||
}
|
||||
|
||||
g_enable_comments = config->index.comments;
|
||||
g_index_comments = config->index.comments;
|
||||
g_index_make_unique = config->index.make_unique;
|
||||
if (config->cacheDirectory.empty()) {
|
||||
LOG_S(ERROR) << "cacheDirectory cannot be empty.";
|
||||
exit(1);
|
||||
|
Loading…
Reference in New Issue
Block a user