From 4a7ca6168fe30bb40471decb2e8c38c7f3008173 Mon Sep 17 00:00:00 2001 From: Jacob Dufault Date: Thu, 7 Dec 2017 11:53:48 -0800 Subject: [PATCH] Reformat --- src/clang_complete.cc | 28 +++++++++++++++------------- src/clang_index.cc | 8 ++++---- src/query.cc | 2 +- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/src/clang_complete.cc b/src/clang_complete.cc index 560344ef..660b263f 100644 --- a/src/clang_complete.cc +++ b/src/clang_complete.cc @@ -28,8 +28,8 @@ unsigned Flags() { } unsigned GetCompletionPriority(const CXCompletionString& str, - CXCursorKind result_kind, - const std::string& label) { + CXCursorKind result_kind, + const std::string& label) { unsigned priority = clang_getCompletionPriority(str); // XXX: What happens if priority overflows? @@ -46,14 +46,15 @@ unsigned GetCompletionPriority(const CXCompletionString& str, return priority; } -template -char *tofixedbase64(T input, char *out) { - const char *digits = "./0123456789" - "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "abcdefghijklmnopqrstuvwxyz"; - int len = (sizeof(T)*8-1)/6+1; - for (int i = len-1; i >= 0; i--) { - out[i] = digits[input%64]; +template +char* tofixedbase64(T input, char* out) { + const char* digits = + "./0123456789" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz"; + int len = (sizeof(T) * 8 - 1) / 6 + 1; + for (int i = len - 1; i >= 0; i--) { + out[i] = digits[input % 64]; input /= 64; } out[len] = '\0'; @@ -450,9 +451,10 @@ void CompletionQueryMain(ClangCompleteManager* completion_manager) { char buf[16]; ls_completion_item.sortText = - tofixedbase64(GetCompletionPriority( - result.CompletionString, result.CursorKind, - ls_completion_item.label), buf); + tofixedbase64(GetCompletionPriority(result.CompletionString, + result.CursorKind, + ls_completion_item.label), + buf); ls_result.push_back(ls_completion_item); } diff --git a/src/clang_index.cc b/src/clang_index.cc index 41c7b65b..9c74fdfa 100644 --- a/src/clang_index.cc +++ b/src/clang_index.cc @@ -6,10 +6,10 @@ ClangIndex::ClangIndex() : ClangIndex(1, 0) {} ClangIndex::ClangIndex(int exclude_declarations_from_pch, int display_diagnostics) { - // llvm::InitializeAllTargets (and possibly others) called by clang_createIndex - // transtively modifies/reads lib/Support/TargetRegistry.cpp FirstTarget. - // There will be a race condition if two threads call clang_createIndex - // concurrently. + // llvm::InitializeAllTargets (and possibly others) called by + // clang_createIndex transtively modifies/reads lib/Support/TargetRegistry.cpp + // FirstTarget. There will be a race condition if two threads call + // clang_createIndex concurrently. static std::mutex mutex_; std::lock_guard lock(mutex_); diff --git a/src/query.cc b/src/query.cc index e6c74a67..c7ccfbe6 100644 --- a/src/query.cc +++ b/src/query.cc @@ -618,7 +618,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);