From 5a85b8e6ddc13b48efdf0f9726188b1dfcbe6343 Mon Sep 17 00:00:00 2001 From: Ilya Biryukov Date: Wed, 13 Dec 2017 12:53:16 +0000 Subject: [PATCH] [clangd] clang-format the source code. NFC llvm-svn: 320577 --- clang-tools-extra/clangd/index/Index.cpp | 17 +++++------------ clang-tools-extra/clangd/index/Index.h | 8 ++++---- .../clangd/index/SymbolCollector.cpp | 4 +--- .../unittests/clangd/CodeCompleteTests.cpp | 2 +- .../unittests/clangd/SymbolCollectorTests.cpp | 8 ++++---- 5 files changed, 15 insertions(+), 24 deletions(-) diff --git a/clang-tools-extra/clangd/index/Index.cpp b/clang-tools-extra/clangd/index/Index.cpp index 1914cf57df2f..79006bf27c58 100644 --- a/clang-tools-extra/clangd/index/Index.cpp +++ b/clang-tools-extra/clangd/index/Index.cpp @@ -23,25 +23,18 @@ ArrayRef toArrayRef(StringRef S) { SymbolID::SymbolID(llvm::StringRef USR) : HashValue(llvm::SHA1::hash(toArrayRef(USR))) {} -SymbolSlab::const_iterator SymbolSlab::begin() const { - return Symbols.begin(); -} +SymbolSlab::const_iterator SymbolSlab::begin() const { return Symbols.begin(); } -SymbolSlab::const_iterator SymbolSlab::end() const { - return Symbols.end(); -} +SymbolSlab::const_iterator SymbolSlab::end() const { return Symbols.end(); } -SymbolSlab::const_iterator SymbolSlab::find(const SymbolID& SymID) const { +SymbolSlab::const_iterator SymbolSlab::find(const SymbolID &SymID) const { return Symbols.find(SymID); } -void SymbolSlab::freeze() { - Frozen = true; -} +void SymbolSlab::freeze() { Frozen = true; } void SymbolSlab::insert(Symbol S) { - assert(!Frozen && - "Can't insert a symbol after the slab has been frozen!"); + assert(!Frozen && "Can't insert a symbol after the slab has been frozen!"); Symbols[S.ID] = std::move(S); } diff --git a/clang-tools-extra/clangd/index/Index.h b/clang-tools-extra/clangd/index/Index.h index 6d4711cccb13..4c960865773b 100644 --- a/clang-tools-extra/clangd/index/Index.h +++ b/clang-tools-extra/clangd/index/Index.h @@ -45,7 +45,7 @@ public: SymbolID() = default; SymbolID(llvm::StringRef USR); - bool operator==(const SymbolID& Sym) const { + bool operator==(const SymbolID &Sym) const { return HashValue == Sym.HashValue; } @@ -89,14 +89,14 @@ struct Symbol { // FIXME: Use a space-efficient implementation, a lot of Symbol fields could // share the same storage. class SymbolSlab { - public: +public: using const_iterator = llvm::DenseMap::const_iterator; SymbolSlab() = default; const_iterator begin() const; const_iterator end() const; - const_iterator find(const SymbolID& SymID) const; + const_iterator find(const SymbolID &SymID) const; // Once called, no more symbols would be added to the SymbolSlab. This // operation is irreversible. @@ -104,7 +104,7 @@ class SymbolSlab { void insert(Symbol S); - private: +private: bool Frozen = false; llvm::DenseMap Symbols; diff --git a/clang-tools-extra/clangd/index/SymbolCollector.cpp b/clang-tools-extra/clangd/index/SymbolCollector.cpp index 06a80f4d14b5..c2ddecbfc47b 100644 --- a/clang-tools-extra/clangd/index/SymbolCollector.cpp +++ b/clang-tools-extra/clangd/index/SymbolCollector.cpp @@ -94,9 +94,7 @@ bool SymbolCollector::handleDeclOccurence( return true; } -void SymbolCollector::finish() { - Symbols.freeze(); -} +void SymbolCollector::finish() { Symbols.freeze(); } } // namespace clangd } // namespace clang diff --git a/clang-tools-extra/unittests/clangd/CodeCompleteTests.cpp b/clang-tools-extra/unittests/clangd/CodeCompleteTests.cpp index 8609873fa191..5739dc0efa5b 100644 --- a/clang-tools-extra/unittests/clangd/CodeCompleteTests.cpp +++ b/clang-tools-extra/unittests/clangd/CodeCompleteTests.cpp @@ -8,8 +8,8 @@ //===----------------------------------------------------------------------===// #include "ClangdServer.h" #include "Compiler.h" -#include "Matchers.h" #include "Context.h" +#include "Matchers.h" #include "Protocol.h" #include "TestFS.h" #include "gmock/gmock.h" diff --git a/clang-tools-extra/unittests/clangd/SymbolCollectorTests.cpp b/clang-tools-extra/unittests/clangd/SymbolCollectorTests.cpp index 77b2a087e7dd..f0aef3599ec8 100644 --- a/clang-tools-extra/unittests/clangd/SymbolCollectorTests.cpp +++ b/clang-tools-extra/unittests/clangd/SymbolCollectorTests.cpp @@ -8,25 +8,25 @@ //===----------------------------------------------------------------------===// #include "index/SymbolCollector.h" -#include "clang/Index/IndexingAction.h" #include "clang/Basic/FileManager.h" #include "clang/Basic/FileSystemOptions.h" #include "clang/Basic/VirtualFileSystem.h" #include "clang/Frontend/CompilerInstance.h" +#include "clang/Index/IndexingAction.h" #include "clang/Tooling/Tooling.h" #include "llvm/ADT/IntrusiveRefCntPtr.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/MemoryBuffer.h" -#include "gtest/gtest.h" #include "gmock/gmock.h" +#include "gtest/gtest.h" #include #include -using testing::UnorderedElementsAre; using testing::Eq; using testing::Field; +using testing::UnorderedElementsAre; // GMock helpers for matching Symbol. MATCHER_P(QName, Name, "") { return arg.second.QualifiedName == Name; } @@ -36,7 +36,7 @@ namespace clangd { namespace { class SymbolIndexActionFactory : public tooling::FrontendActionFactory { - public: +public: SymbolIndexActionFactory() = default; clang::FrontendAction *create() override {