This commit is contained in:
Jacob Dufault 2017-12-07 11:53:48 -08:00
parent d8d794fb4e
commit 4a7ca6168f
3 changed files with 20 additions and 18 deletions

View File

@ -48,7 +48,8 @@ unsigned GetCompletionPriority(const CXCompletionString& str,
template <typename T> template <typename T>
char* tofixedbase64(T input, char* out) { char* tofixedbase64(T input, char* out) {
const char *digits = "./0123456789" const char* digits =
"./0123456789"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"; "abcdefghijklmnopqrstuvwxyz";
int len = (sizeof(T) * 8 - 1) / 6 + 1; int len = (sizeof(T) * 8 - 1) / 6 + 1;
@ -450,9 +451,10 @@ void CompletionQueryMain(ClangCompleteManager* completion_manager) {
char buf[16]; char buf[16];
ls_completion_item.sortText = ls_completion_item.sortText =
tofixedbase64(GetCompletionPriority( tofixedbase64(GetCompletionPriority(result.CompletionString,
result.CompletionString, result.CursorKind, result.CursorKind,
ls_completion_item.label), buf); ls_completion_item.label),
buf);
ls_result.push_back(ls_completion_item); ls_result.push_back(ls_completion_item);
} }

View File

@ -6,10 +6,10 @@ ClangIndex::ClangIndex() : ClangIndex(1, 0) {}
ClangIndex::ClangIndex(int exclude_declarations_from_pch, ClangIndex::ClangIndex(int exclude_declarations_from_pch,
int display_diagnostics) { int display_diagnostics) {
// llvm::InitializeAllTargets (and possibly others) called by clang_createIndex // llvm::InitializeAllTargets (and possibly others) called by
// transtively modifies/reads lib/Support/TargetRegistry.cpp FirstTarget. // clang_createIndex transtively modifies/reads lib/Support/TargetRegistry.cpp
// There will be a race condition if two threads call clang_createIndex // FirstTarget. There will be a race condition if two threads call
// concurrently. // clang_createIndex concurrently.
static std::mutex mutex_; static std::mutex mutex_;
std::lock_guard<std::mutex> lock(mutex_); std::lock_guard<std::mutex> lock(mutex_);