From 77349436205f5ee0ea857c0e115c5064a62b72ce Mon Sep 17 00:00:00 2001 From: Jacob Dufault Date: Tue, 31 Oct 2017 12:49:19 -0700 Subject: [PATCH] Format all code in src/ --- src/clang_utils.h | 1 - src/file_consumer.h | 1 - src/indexer.cc | 164 +----------------------------- src/language_server_api.h | 205 -------------------------------------- src/libclangmm/Cursor.h | 1 - src/message_queue.h | 1 - src/platform.cc | 1 - src/platform_linux.cc | 6 -- src/project.cc | 2 +- src/query.cc | 2 +- src/query_utils.cc | 3 +- src/timer.cc | 4 +- 12 files changed, 8 insertions(+), 383 deletions(-) diff --git a/src/clang_utils.h b/src/clang_utils.h index 0bd8057e..16573602 100644 --- a/src/clang_utils.h +++ b/src/clang_utils.h @@ -7,7 +7,6 @@ #include #include - using namespace std::experimental; optional BuildAndDisposeDiagnostic(CXDiagnostic diagnostic, diff --git a/src/file_consumer.h b/src/file_consumer.h index 562823bc..e980777e 100644 --- a/src/file_consumer.h +++ b/src/file_consumer.h @@ -9,7 +9,6 @@ #include #include - struct IndexFile; // Needed for unordered_map usage below. diff --git a/src/indexer.cc b/src/indexer.cc index 172f2a19..f165b3cd 100644 --- a/src/indexer.cc +++ b/src/indexer.cc @@ -264,39 +264,6 @@ std::string GetDocumentContentInRange(CXTranslationUnit cx_tu, } // namespace - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // static int IndexFile::kCurrentVersion = 4; @@ -903,57 +870,6 @@ clang::VisiterResult VisitMacroDefinitionAndExpansions(clang::Cursor cursor, return clang::VisiterResult::Continue; } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void indexDeclaration(CXClientData client_data, const CXIdxDeclInfo* decl) { if (!kIndexStdDeclarations && clang_Location_isInSystemHeader( @@ -1339,53 +1255,6 @@ bool IsFunctionCallContext(CXCursorKind kind) { return false; } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void indexEntityReference(CXClientData client_data, const CXIdxEntityRefInfo* ref) { // Don't index references from or to system headers. @@ -1562,35 +1431,6 @@ void indexEntityReference(CXClientData client_data, } } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - FileContents::FileContents(const std::string& path, const std::string& content) : path(path), content(content) {} @@ -1621,8 +1461,8 @@ std::vector> Parse( std::unique_ptr tu = clang::TranslationUnit::Create( index, file, args, unsaved_files, - CXTranslationUnit_KeepGoing | - CXTranslationUnit_DetailedPreprocessingRecord); + CXTranslationUnit_KeepGoing | + CXTranslationUnit_DetailedPreprocessingRecord); if (!tu) return {}; diff --git a/src/language_server_api.h b/src/language_server_api.h index 1e4d3383..9d5d6c1e 100644 --- a/src/language_server_api.h +++ b/src/language_server_api.h @@ -32,41 +32,6 @@ struct lsRequestId { void Reflect(Writer& visitor, lsRequestId& value); void Reflect(Reader& visitor, lsRequestId& id); - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// @@ -146,55 +111,6 @@ struct lsResponseError { void Write(Writer& visitor); }; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// @@ -577,96 +493,6 @@ MAKE_REFLECT_STRUCT(lsDiagnostic, range, severity, source, message); // TODO: DocumentFilter // TODO: DocumentSelector - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// @@ -1092,42 +918,11 @@ struct Ipc_InitializedNotification }; MAKE_REFLECT_STRUCT(Ipc_InitializedNotification, id); - - - - - - - struct Ipc_Exit : public IpcMessage { static const IpcId kIpcId = IpcId::Exit; }; MAKE_REFLECT_EMPTY_STRUCT(Ipc_Exit); - - - - - - - - - - - - - - - - - - - - - - - - enum class lsErrorCodes { // Defined by JSON RPC ParseError = -32700, diff --git a/src/libclangmm/Cursor.h b/src/libclangmm/Cursor.h index 6e0f9c8c..e1862705 100644 --- a/src/libclangmm/Cursor.h +++ b/src/libclangmm/Cursor.h @@ -5,7 +5,6 @@ #include #include - #include namespace clang { diff --git a/src/message_queue.h b/src/message_queue.h index 7919eb23..d8a58db9 100644 --- a/src/message_queue.h +++ b/src/message_queue.h @@ -4,7 +4,6 @@ #include #include - #include "buffer.h" struct ResizableBuffer; diff --git a/src/platform.cc b/src/platform.cc index 15cd8e56..5a90284c 100644 --- a/src/platform.cc +++ b/src/platform.cc @@ -7,7 +7,6 @@ #include #include - #include namespace { diff --git a/src/platform_linux.cc b/src/platform_linux.cc index c26ecfa8..ecc11ec1 100644 --- a/src/platform_linux.cc +++ b/src/platform_linux.cc @@ -11,7 +11,6 @@ #include #include - #include #include #include @@ -23,23 +22,19 @@ #include #include - #include #include #include // required for stat.h - #include #include #include - #include /* For O_* constants */ #include #include #include /* For mode constants */ - #ifndef __APPLE__ #include #endif @@ -156,7 +151,6 @@ std::string GetWorkingDirectory() { return working_dir; } - std::string NormalizePath(const std::string& path) { errno = 0; char name[PATH_MAX + 1]; diff --git a/src/project.cc b/src/project.cc index c694f91d..26bcc462 100644 --- a/src/project.cc +++ b/src/project.cc @@ -4,8 +4,8 @@ #include "match.h" #include "platform.h" #include "serializer.h" -#include "utils.h" #include "timer.h" +#include "utils.h" #include #include diff --git a/src/query.cc b/src/query.cc index 217050f0..68bb417a 100644 --- a/src/query.cc +++ b/src/query.cc @@ -606,7 +606,7 @@ IndexUpdate::IndexUpdate(const IdMap& previous_id_map, } void IndexUpdate::Merge(const IndexUpdate& update) { -// This function runs on an indexer thread. + // This function runs on an indexer thread. #define INDEX_UPDATE_APPEND(name) AddRange(&name, update.name); #define INDEX_UPDATE_MERGE(name) AddMergeableRange(&name, update.name); diff --git a/src/query_utils.cc b/src/query_utils.cc index 3ea72139..dc5901e6 100644 --- a/src/query_utils.cc +++ b/src/query_utils.cc @@ -484,8 +484,7 @@ optional GetSymbolInfo(QueryDatabase* db, info.kind = lsSymbolKind::Function; if (func.def->declaring_type.has_value()) { - QueryType& container = - db->types[func.def->declaring_type->id]; + QueryType& container = db->types[func.def->declaring_type->id]; if (container.def) info.kind = lsSymbolKind::Method; } diff --git a/src/timer.cc b/src/timer.cc index 81e0e6b0..6867e4bd 100644 --- a/src/timer.cc +++ b/src/timer.cc @@ -13,7 +13,9 @@ long long Timer::ElapsedMicroseconds() const { long long elapsed = elapsed_; if (start_.has_value()) { // TODO: clang-format this file. - elapsed += std::chrono::duration_cast(end - *start_).count(); + elapsed += + std::chrono::duration_cast(end - *start_) + .count(); } return elapsed; }