[clangd] clang-format the source code. NFC

llvm-svn: 320577
This commit is contained in:
Ilya Biryukov 2017-12-13 12:53:16 +00:00
parent 940901e8b1
commit 5a85b8e6dd
5 changed files with 15 additions and 24 deletions

View File

@ -23,25 +23,18 @@ ArrayRef<uint8_t> 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);
}

View File

@ -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<SymbolID, Symbol>::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<SymbolID, Symbol> Symbols;

View File

@ -94,9 +94,7 @@ bool SymbolCollector::handleDeclOccurence(
return true;
}
void SymbolCollector::finish() {
Symbols.freeze();
}
void SymbolCollector::finish() { Symbols.freeze(); }
} // namespace clangd
} // namespace clang

View File

@ -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"

View File

@ -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 <memory>
#include <string>
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 {