summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clangd/index/Index.cpp
diff options
context:
space:
mode:
authorIlya Biryukov <ibiryukov@google.com>2019-01-07 15:45:19 +0000
committerIlya Biryukov <ibiryukov@google.com>2019-01-07 15:45:19 +0000
commitf2001aa74394885dc178c5997b83687acb4f55e4 (patch)
tree80666e16bbebadef8f35d1d962e09da8a7812d13 /clang-tools-extra/clangd/index/Index.cpp
parent25d3de8a0ac4d65f2ac9820ba62a372414780649 (diff)
downloadbcm5719-llvm-f2001aa74394885dc178c5997b83687acb4f55e4.tar.gz
bcm5719-llvm-f2001aa74394885dc178c5997b83687acb4f55e4.zip
[clangd] Remove 'using namespace llvm' from .cpp files. NFC
The new guideline is to qualify with 'llvm::' explicitly both in '.h' and '.cpp' files. This simplifies moving the code between header and source files and is easier to keep consistent. llvm-svn: 350531
Diffstat (limited to 'clang-tools-extra/clangd/index/Index.cpp')
-rw-r--r--clang-tools-extra/clangd/index/Index.cpp45
1 files changed, 22 insertions, 23 deletions
diff --git a/clang-tools-extra/clangd/index/Index.cpp b/clang-tools-extra/clangd/index/Index.cpp
index dd4b5eb32a7..4036d671827 100644
--- a/clang-tools-extra/clangd/index/Index.cpp
+++ b/clang-tools-extra/clangd/index/Index.cpp
@@ -14,7 +14,6 @@
#include "llvm/Support/Error.h"
#include "llvm/Support/raw_ostream.h"
-using namespace llvm;
namespace clang {
namespace clangd {
@@ -35,14 +34,14 @@ void SymbolLocation::Position::setColumn(uint32_t Col) {
Column = Col;
}
-raw_ostream &operator<<(raw_ostream &OS, const SymbolLocation &L) {
+llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const SymbolLocation &L) {
if (!L)
return OS << "(none)";
return OS << L.FileURI << "[" << L.Start.line() << ":" << L.Start.column()
<< "-" << L.End.line() << ":" << L.End.column() << ")";
}
-raw_ostream &operator<<(raw_ostream &OS, SymbolOrigin O) {
+llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, SymbolOrigin O) {
if (O == SymbolOrigin::Unknown)
return OS << "unknown";
constexpr static char Sigils[] = "ADSM4567";
@@ -52,7 +51,7 @@ raw_ostream &operator<<(raw_ostream &OS, SymbolOrigin O) {
return OS;
}
-raw_ostream &operator<<(raw_ostream &OS, Symbol::SymbolFlag F) {
+llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, Symbol::SymbolFlag F) {
if (F == Symbol::None)
return OS << "None";
std::string s;
@@ -60,10 +59,10 @@ raw_ostream &operator<<(raw_ostream &OS, Symbol::SymbolFlag F) {
s += "deprecated|";
if (F & Symbol::IndexedForCodeCompletion)
s += "completion|";
- return OS << StringRef(s).rtrim('|');
+ return OS << llvm::StringRef(s).rtrim('|');
}
-raw_ostream &operator<<(raw_ostream &OS, const Symbol &S) {
+llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const Symbol &S) {
return OS << S.Scope << S.Name;
}
@@ -85,8 +84,8 @@ SymbolSlab::const_iterator SymbolSlab::find(const SymbolID &ID) const {
}
// Copy the underlying data of the symbol into the owned arena.
-static void own(Symbol &S, UniqueStringSaver &Strings) {
- visitStrings(S, [&](StringRef &V) { V = Strings.save(V); });
+static void own(Symbol &S, llvm::UniqueStringSaver &Strings) {
+ visitStrings(S, [&](llvm::StringRef &V) { V = Strings.save(V); });
}
void SymbolSlab::Builder::insert(const Symbol &S) {
@@ -106,14 +105,14 @@ SymbolSlab SymbolSlab::Builder::build() && {
llvm::sort(Symbols,
[](const Symbol &L, const Symbol &R) { return L.ID < R.ID; });
// We may have unused strings from overwritten symbols. Build a new arena.
- BumpPtrAllocator NewArena;
- UniqueStringSaver Strings(NewArena);
+ llvm::BumpPtrAllocator NewArena;
+ llvm::UniqueStringSaver Strings(NewArena);
for (auto &S : Symbols)
own(S, Strings);
return SymbolSlab(std::move(NewArena), std::move(Symbols));
}
-raw_ostream &operator<<(raw_ostream &OS, RefKind K) {
+llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, RefKind K) {
if (K == RefKind::Unknown)
return OS << "Unknown";
static const std::vector<const char *> Messages = {"Decl", "Def", "Ref"};
@@ -129,7 +128,7 @@ raw_ostream &operator<<(raw_ostream &OS, RefKind K) {
return OS;
}
-raw_ostream &operator<<(raw_ostream &OS, const Ref &R) {
+llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const Ref &R) {
return OS << R.Location << ":" << R.Kind;
}
@@ -143,7 +142,7 @@ void RefSlab::Builder::insert(const SymbolID &ID, const Ref &S) {
RefSlab RefSlab::Builder::build() && {
// We can reuse the arena, as it only has unique strings and we need them all.
// Reallocate refs on the arena to reduce waste and indirections when reading.
- std::vector<std::pair<SymbolID, ArrayRef<Ref>>> Result;
+ std::vector<std::pair<SymbolID, llvm::ArrayRef<Ref>>> Result;
Result.reserve(Refs.size());
size_t NumRefs = 0;
for (auto &Sym : Refs) {
@@ -155,7 +154,7 @@ RefSlab RefSlab::Builder::build() && {
NumRefs += SymRefs.size();
auto *Array = Arena.Allocate<Ref>(SymRefs.size());
std::uninitialized_copy(SymRefs.begin(), SymRefs.end(), Array);
- Result.emplace_back(Sym.first, ArrayRef<Ref>(Array, SymRefs.size()));
+ Result.emplace_back(Sym.first, llvm::ArrayRef<Ref>(Array, SymRefs.size()));
}
return RefSlab(std::move(Result), std::move(Arena), NumRefs);
}
@@ -174,8 +173,8 @@ std::shared_ptr<SymbolIndex> SwapIndex::snapshot() const {
return Index;
}
-bool fromJSON(const json::Value &Parameters, FuzzyFindRequest &Request) {
- json::ObjectMapper O(Parameters);
+bool fromJSON(const llvm::json::Value &Parameters, FuzzyFindRequest &Request) {
+ llvm::json::ObjectMapper O(Parameters);
int64_t Limit;
bool OK =
O && O.map("Query", Request.Query) && O.map("Scopes", Request.Scopes) &&
@@ -187,27 +186,27 @@ bool fromJSON(const json::Value &Parameters, FuzzyFindRequest &Request) {
return OK;
}
-json::Value toJSON(const FuzzyFindRequest &Request) {
- return json::Object{
+llvm::json::Value toJSON(const FuzzyFindRequest &Request) {
+ return llvm::json::Object{
{"Query", Request.Query},
- {"Scopes", json::Array{Request.Scopes}},
+ {"Scopes", llvm::json::Array{Request.Scopes}},
{"AnyScope", Request.AnyScope},
{"Limit", Request.Limit},
{"RestrictForCodeCompletion", Request.RestrictForCodeCompletion},
- {"ProximityPaths", json::Array{Request.ProximityPaths}},
+ {"ProximityPaths", llvm::json::Array{Request.ProximityPaths}},
};
}
bool SwapIndex::fuzzyFind(const FuzzyFindRequest &R,
- function_ref<void(const Symbol &)> CB) const {
+ llvm::function_ref<void(const Symbol &)> CB) const {
return snapshot()->fuzzyFind(R, CB);
}
void SwapIndex::lookup(const LookupRequest &R,
- function_ref<void(const Symbol &)> CB) const {
+ llvm::function_ref<void(const Symbol &)> CB) const {
return snapshot()->lookup(R, CB);
}
void SwapIndex::refs(const RefsRequest &R,
- function_ref<void(const Ref &)> CB) const {
+ llvm::function_ref<void(const Ref &)> CB) const {
return snapshot()->refs(R, CB);
}
size_t SwapIndex::estimateMemoryUsage() const {
OpenPOWER on IntegriCloud