Skip to content

Commit

Permalink
Remove WithFileContent & lex_utils.{cc,h}
Browse files Browse the repository at this point in the history
  • Loading branch information
MaskRay committed Jun 1, 2018
1 parent ec00f85 commit 39a17a9
Show file tree
Hide file tree
Showing 19 changed files with 100 additions and 254 deletions.
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ target_sources(ccls PRIVATE
src/indexer.cc
src/method.cc
src/language.cc
src/lex_utils.cc
src/log.cc
src/lsp.cc
src/match.cc
Expand Down
13 changes: 8 additions & 5 deletions src/indexer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
#include "log.hh"
#include "platform.h"
#include "serializer.h"
#include "timer.h"
#include "type_printer.h"

#include <llvm/Support/Timer.h>
using namespace llvm;

#include <assert.h>
#include <inttypes.h>
#include <limits.h>
Expand Down Expand Up @@ -2016,7 +2018,8 @@ std::vector<std::unique_ptr<IndexFile>> ClangIndexer::Index(

file = NormalizePath(file);

Timer timer;
Timer timer("parse", "parse tu");
timer.startTimer();

std::vector<CXUnsavedFile> unsaved_files;
for (const FileContents& contents : file_contents) {
Expand All @@ -2034,7 +2037,7 @@ std::vector<std::unique_ptr<IndexFile>> ClangIndexer::Index(
if (!tu)
return {};

perf->index_parse = timer.ElapsedMicrosecondsAndReset();
timer.stopTimer();

return ParseWithTu(vfs, perf, tu.get(), &index, file, args, unsaved_files);
}
Expand All @@ -2048,6 +2051,7 @@ std::vector<std::unique_ptr<IndexFile>> ParseWithTu(
const std::vector<std::string>& args,
const std::vector<CXUnsavedFile>& file_contents) {
Timer timer;
timer.startTimer();

IndexerCallbacks callback = {0};
// Available callbacks:
Expand Down Expand Up @@ -2085,13 +2089,12 @@ std::vector<std::unique_ptr<IndexFile>> ParseWithTu(
<< " failed with errno=" << index_result;
return {};
}

clang_IndexAction_dispose(index_action);

ClangCursor(clang_getTranslationUnitCursor(tu->cx_tu))
.VisitChildren(&VisitMacroDefinitionAndExpansions, &param);

perf->index_build = timer.ElapsedMicrosecondsAndReset();
timer.stopTimer();

std::unordered_map<std::string, int> inc_to_line;
// TODO
Expand Down
14 changes: 0 additions & 14 deletions src/indexer.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ struct IndexFunc;
struct IndexVar;
struct QueryFile;

using RawId = uint32_t;

struct SymbolIdx {
Usr usr;
SymbolKind kind;
Expand Down Expand Up @@ -153,19 +151,9 @@ struct TypeDef : NameMixin<TypeDef> {
NtString hover;
NtString comments;

// While a class/type can technically have a separate declaration/definition,
// it doesn't really happen in practice. The declaration never contains
// comments or insightful information. The user always wants to jump from
// the declaration to the definition - never the other way around like in
// functions and (less often) variables.
//
// It's also difficult to identify a `class Foo;` statement with the clang
// indexer API (it's doable using cursor AST traversal), so we don't bother
// supporting the feature.
Maybe<Use> spell;
Maybe<Use> extent;

// Immediate parent types.
std::vector<Usr> bases;

// Types, functions, and variables defined in this type.
Expand Down Expand Up @@ -221,8 +209,6 @@ struct VarDef : NameMixin<VarDef> {
std::string detailed_name;
NtString hover;
NtString comments;
// TODO: definitions should be a list of ranges, since there can be more
// than one - when??
Maybe<Use> spell;
Maybe<Use> extent;

Expand Down
87 changes: 0 additions & 87 deletions src/lex_utils.cc

This file was deleted.

16 changes: 0 additions & 16 deletions src/lex_utils.h

This file was deleted.

6 changes: 2 additions & 4 deletions src/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,10 @@ int main(int argc, char** argv) {
}
}

std::unordered_map<MethodType, Timer> request_times;

// The thread that reads from stdin and dispatchs commands to the main thread.
pipeline::LaunchStdin(&request_times);
pipeline::LaunchStdin();
// The thread that writes responses from the main thread to stdout.
pipeline::LaunchStdout(&request_times);
pipeline::LaunchStdout();
// Main thread which also spawns indexer threads upon the "initialize" request.
pipeline::MainLoop();
}
Expand Down
1 change: 0 additions & 1 deletion src/message_handler.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include "message_handler.h"

#include "lex_utils.h"
#include "log.hh"
#include "project.h"
#include "query_utils.h"
Expand Down
2 changes: 0 additions & 2 deletions src/messages/text_document_completion.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
#include "working_files.h"
using namespace ccls;

#include "lex_utils.h"

#include <regex>

namespace {
Expand Down
1 change: 0 additions & 1 deletion src/messages/text_document_definition.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#include "lex_utils.h"
#include "message_handler.h"
#include "pipeline.hh"
#include "query_utils.h"
Expand Down
72 changes: 0 additions & 72 deletions src/messages/text_document_range_formatting.cc

This file was deleted.

1 change: 0 additions & 1 deletion src/messages/workspace_symbol.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include "fuzzy_match.h"
#include "lex_utils.h"
#include "message_handler.h"
#include "pipeline.hh"
#include "query_utils.h"
Expand Down
Loading

0 comments on commit 39a17a9

Please sign in to comment.