summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clangd/index/dex/Dex.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra/clangd/index/dex/Dex.cpp')
-rw-r--r--clang-tools-extra/clangd/index/dex/Dex.cpp33
1 files changed, 16 insertions, 17 deletions
diff --git a/clang-tools-extra/clangd/index/dex/Dex.cpp b/clang-tools-extra/clangd/index/dex/Dex.cpp
index 8d64e1b48c9..157d4668856 100644
--- a/clang-tools-extra/clangd/index/dex/Dex.cpp
+++ b/clang-tools-extra/clangd/index/dex/Dex.cpp
@@ -20,7 +20,6 @@
#include <algorithm>
#include <queue>
-using namespace llvm;
namespace clang {
namespace clangd {
namespace dex {
@@ -50,7 +49,7 @@ std::vector<Token> generateSearchTokens(const Symbol &Sym) {
std::vector<Token> Result = generateIdentifierTrigrams(Sym.Name);
Result.emplace_back(Token::Kind::Scope, Sym.Scope);
// Skip token generation for symbols with unknown declaration location.
- if (!StringRef(Sym.CanonicalDeclaration.FileURI).empty())
+ if (!llvm::StringRef(Sym.CanonicalDeclaration.FileURI).empty())
for (const auto &ProximityURI :
generateProximityURIs(Sym.CanonicalDeclaration.FileURI))
Result.emplace_back(Token::Kind::ProximityURI, ProximityURI);
@@ -60,14 +59,14 @@ std::vector<Token> generateSearchTokens(const Symbol &Sym) {
}
// Constructs BOOST iterators for Path Proximities.
-std::unique_ptr<Iterator>
-createFileProximityIterator(ArrayRef<std::string> ProximityPaths,
- const DenseMap<Token, PostingList> &InvertedIndex,
- const Corpus &Corpus) {
+std::unique_ptr<Iterator> createFileProximityIterator(
+ llvm::ArrayRef<std::string> ProximityPaths,
+ const llvm::DenseMap<Token, PostingList> &InvertedIndex,
+ const Corpus &Corpus) {
std::vector<std::unique_ptr<Iterator>> BoostingIterators;
// Deduplicate parent URIs extracted from the ProximityPaths.
- StringSet<> ParentURIs;
- StringMap<SourceParams> Sources;
+ llvm::StringSet<> ParentURIs;
+ llvm::StringMap<SourceParams> Sources;
for (const auto &Path : ProximityPaths) {
Sources[Path] = SourceParams();
auto PathURI = URI::create(Path);
@@ -124,7 +123,7 @@ void Dex::buildIndex() {
}
// Populate TempInvertedIndex with lists for index symbols.
- DenseMap<Token, std::vector<DocID>> TempInvertedIndex;
+ llvm::DenseMap<Token, std::vector<DocID>> TempInvertedIndex;
for (DocID SymbolRank = 0; SymbolRank < Symbols.size(); ++SymbolRank) {
const auto *Sym = Symbols[SymbolRank];
for (const auto &Token : generateSearchTokens(*Sym))
@@ -147,7 +146,7 @@ std::unique_ptr<Iterator> Dex::iterator(const Token &Tok) const {
/// while applying Callback to each symbol in the order of decreasing quality
/// of the matched symbols.
bool Dex::fuzzyFind(const FuzzyFindRequest &Req,
- function_ref<void(const Symbol &)> Callback) const {
+ llvm::function_ref<void(const Symbol &)> Callback) const {
assert(!StringRef(Req.Query).contains("::") &&
"There must be no :: in query.");
trace::Span Tracer("Dex fuzzyFind");
@@ -190,7 +189,7 @@ bool Dex::fuzzyFind(const FuzzyFindRequest &Req,
// FIXME(kbobyrev): Tune this ratio.
if (Req.Limit)
Root = Corpus.limit(move(Root), *Req.Limit * 100);
- SPAN_ATTACH(Tracer, "query", to_string(*Root));
+ SPAN_ATTACH(Tracer, "query", llvm::to_string(*Root));
vlog("Dex query tree: {0}", *Root);
using IDAndScore = std::pair<DocID, float>;
@@ -204,7 +203,7 @@ bool Dex::fuzzyFind(const FuzzyFindRequest &Req,
for (const auto &IDAndScore : IDAndScores) {
const DocID SymbolDocID = IDAndScore.first;
const auto *Sym = Symbols[SymbolDocID];
- const Optional<float> Score = Filter.match(Sym->Name);
+ const llvm::Optional<float> Score = Filter.match(Sym->Name);
if (!Score)
continue;
// Combine Fuzzy Matching score, precomputed symbol quality and boosting
@@ -225,7 +224,7 @@ bool Dex::fuzzyFind(const FuzzyFindRequest &Req,
}
void Dex::lookup(const LookupRequest &Req,
- function_ref<void(const Symbol &)> Callback) const {
+ llvm::function_ref<void(const Symbol &)> Callback) const {
trace::Span Tracer("Dex lookup");
for (const auto &ID : Req.IDs) {
auto I = LookupTable.find(ID);
@@ -235,7 +234,7 @@ void Dex::lookup(const LookupRequest &Req,
}
void Dex::refs(const RefsRequest &Req,
- function_ref<void(const Ref &)> Callback) const {
+ llvm::function_ref<void(const Ref &)> Callback) const {
trace::Span Tracer("Dex refs");
for (const auto &ID : Req.IDs)
for (const auto &Ref : Refs.lookup(ID))
@@ -254,13 +253,13 @@ size_t Dex::estimateMemoryUsage() const {
return Bytes + BackingDataSize;
}
-std::vector<std::string> generateProximityURIs(StringRef URIPath) {
+std::vector<std::string> generateProximityURIs(llvm::StringRef URIPath) {
std::vector<std::string> Result;
auto ParsedURI = URI::parse(URIPath);
assert(ParsedURI &&
"Non-empty argument of generateProximityURIs() should be a valid "
"URI.");
- StringRef Body = ParsedURI->body();
+ llvm::StringRef Body = ParsedURI->body();
// FIXME(kbobyrev): Currently, this is a heuristic which defines the maximum
// size of resulting vector. Some projects might want to have higher limit if
// the file hierarchy is deeper. For the generic case, it would be useful to
@@ -273,7 +272,7 @@ std::vector<std::string> generateProximityURIs(StringRef URIPath) {
while (!Body.empty() && --Limit > 0) {
// FIXME(kbobyrev): Parsing and encoding path to URIs is not necessary and
// could be optimized.
- Body = sys::path::parent_path(Body, sys::path::Style::posix);
+ Body = llvm::sys::path::parent_path(Body, llvm::sys::path::Style::posix);
URI TokenURI(ParsedURI->scheme(), ParsedURI->authority(), Body);
if (!Body.empty())
Result.emplace_back(TokenURI.toString());
OpenPOWER on IntegriCloud