Index: clang-tools-extra/clangd/CMakeLists.txt =================================================================== --- clang-tools-extra/clangd/CMakeLists.txt +++ clang-tools-extra/clangd/CMakeLists.txt @@ -38,17 +38,16 @@ XRefs.cpp index/CanonicalIncludes.cpp + index/Dex.cpp index/FileIndex.cpp index/Index.cpp + index/Iterator.cpp index/MemIndex.cpp index/Merge.cpp index/Serialization.cpp index/SymbolCollector.cpp index/SymbolYAML.cpp - - index/dex/DexIndex.cpp - index/dex/Iterator.cpp - index/dex/Trigram.cpp + index/Trigram.cpp LINK_LIBS clangAST Index: clang-tools-extra/clangd/index/Dex.h =================================================================== --- clang-tools-extra/clangd/index/Dex.h +++ clang-tools-extra/clangd/index/Dex.h @@ -1,4 +1,4 @@ -//===--- DexIndex.h - Dex Symbol Index Implementation -----------*- C++ -*-===// +//===--- Dex.h - Efficient Symbol Index Implementation ----------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -17,19 +17,18 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_DEX_DEXINDEX_H -#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_DEX_DEXINDEX_H +#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_DEXINDEX_H +#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_DEXINDEX_H -#include "../Index.h" -#include "../MemIndex.h" -#include "../SymbolCollector.h" +#include "Index.h" #include "Iterator.h" +#include "MemIndex.h" +#include "SymbolCollector.h" #include "Token.h" #include "Trigram.h" namespace clang { namespace clangd { -namespace dex { /// In-memory Dex trigram-based index implementation. // FIXME(kbobyrev): Introduce serialization and deserialization of the symbol @@ -106,8 +105,7 @@ /// This function is exposed for testing only. std::vector generateProximityURIs(llvm::StringRef URIPath); -} // namespace dex } // namespace clangd } // namespace clang -#endif // LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_DEX_DEXINDEX_H +#endif // LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_DEXINDEX_H Index: clang-tools-extra/clangd/index/Dex.cpp =================================================================== --- clang-tools-extra/clangd/index/Dex.cpp +++ clang-tools-extra/clangd/index/Dex.cpp @@ -1,4 +1,4 @@ -//===--- DexIndex.cpp - Dex Symbol Index Implementation ---------*- C++ -*-===// +//===--- Dex.cpp - Efficient Symbol Index Implementation --------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -7,18 +7,17 @@ // //===----------------------------------------------------------------------===// -#include "DexIndex.h" -#include "../../FileDistance.h" -#include "../../FuzzyMatch.h" -#include "../../Logger.h" -#include "../../Quality.h" +#include "Dex.h" +#include "../FileDistance.h" +#include "../FuzzyMatch.h" +#include "../Logger.h" +#include "../Quality.h" #include "llvm/ADT/StringSet.h" #include #include namespace clang { namespace clangd { -namespace dex { namespace { @@ -266,6 +265,5 @@ return Result; } -} // namespace dex } // namespace clangd } // namespace clang Index: clang-tools-extra/clangd/index/Iterator.h =================================================================== --- clang-tools-extra/clangd/index/Iterator.h +++ clang-tools-extra/clangd/index/Iterator.h @@ -28,8 +28,8 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_DEX_ITERATOR_H -#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_DEX_ITERATOR_H +#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_ITERATOR_H +#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_ITERATOR_H #include "llvm/ADT/ArrayRef.h" #include "llvm/Support/raw_ostream.h" @@ -39,7 +39,6 @@ namespace clang { namespace clangd { -namespace dex { /// Symbol position in the list of all index symbols sorted by a pre-computed /// symbol quality. @@ -200,7 +199,6 @@ Children.push_back(move(Head)); } -} // namespace dex } // namespace clangd } // namespace clang Index: clang-tools-extra/clangd/index/Iterator.cpp =================================================================== --- clang-tools-extra/clangd/index/Iterator.cpp +++ clang-tools-extra/clangd/index/Iterator.cpp @@ -14,7 +14,6 @@ namespace clang { namespace clangd { -namespace dex { namespace { @@ -424,6 +423,5 @@ return llvm::make_unique(move(Child), Limit); } -} // namespace dex } // namespace clangd } // namespace clang Index: clang-tools-extra/clangd/index/SymbolYAML.cpp =================================================================== --- clang-tools-extra/clangd/index/SymbolYAML.cpp +++ clang-tools-extra/clangd/index/SymbolYAML.cpp @@ -11,7 +11,7 @@ #include "../Trace.h" #include "Index.h" #include "Serialization.h" -#include "dex/DexIndex.h" +#include "Dex.h" #include "llvm/ADT/Optional.h" #include "llvm/ADT/SmallVector.h" #include "llvm/Support/Errc.h" @@ -225,7 +225,7 @@ if (!Slab) return nullptr; trace::Span Tracer("BuildIndex"); - return UseDex ? dex::DexIndex::build(std::move(*Slab), URISchemes) + return UseDex ? DexIndex::build(std::move(*Slab), URISchemes) : MemIndex::build(std::move(*Slab), RefSlab()); } Index: clang-tools-extra/clangd/index/Token.h =================================================================== --- clang-tools-extra/clangd/index/Token.h +++ clang-tools-extra/clangd/index/Token.h @@ -19,10 +19,10 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_DEX_TOKEN_H -#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_DEX_TOKEN_H +#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_TOKEN_H +#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_TOKEN_H -#include "../Index.h" +#include "Index.h" #include "llvm/ADT/DenseMap.h" #include "llvm/Support/raw_ostream.h" #include @@ -30,7 +30,6 @@ namespace clang { namespace clangd { -namespace dex { /// A Token represents an attribute of a symbol, such as a particular trigram /// present in the name (used for fuzzy search). @@ -90,32 +89,31 @@ } }; -} // namespace dex } // namespace clangd } // namespace clang namespace llvm { // Support Tokens as DenseMap keys. -template <> struct DenseMapInfo { - static inline clang::clangd::dex::Token getEmptyKey() { - return {clang::clangd::dex::Token::Kind::Sentinel, "EmptyKey"}; +template <> struct DenseMapInfo { + static inline clang::clangd::Token getEmptyKey() { + return {clang::clangd::Token::Kind::Sentinel, "EmptyKey"}; } - static inline clang::clangd::dex::Token getTombstoneKey() { - return {clang::clangd::dex::Token::Kind::Sentinel, "TombstoneKey"}; + static inline clang::clangd::Token getTombstoneKey() { + return {clang::clangd::Token::Kind::Sentinel, "TombstoneKey"}; } - static unsigned getHashValue(const clang::clangd::dex::Token &Tag) { + static unsigned getHashValue(const clang::clangd::Token &Tag) { return hash_value(Tag); } - static bool isEqual(const clang::clangd::dex::Token &LHS, - const clang::clangd::dex::Token &RHS) { + static bool isEqual(const clang::clangd::Token &LHS, + const clang::clangd::Token &RHS) { return LHS == RHS; } }; } // namespace llvm -#endif // LLVM_CLANG_TOOLS_EXTRA_CLANGD_DEX_TOKEN_H +#endif // LLVM_CLANG_TOOLS_EXTRA_CLANGD_TOKEN_H Index: clang-tools-extra/clangd/index/Trigram.h =================================================================== --- clang-tools-extra/clangd/index/Trigram.h +++ clang-tools-extra/clangd/index/Trigram.h @@ -29,7 +29,6 @@ namespace clang { namespace clangd { -namespace dex { /// Returns list of unique fuzzy-search trigrams from unqualified symbol. /// @@ -65,7 +64,6 @@ /// characters (up to 3) to perform prefix match. std::vector generateQueryTrigrams(llvm::StringRef Query); -} // namespace dex } // namespace clangd } // namespace clang Index: clang-tools-extra/clangd/index/Trigram.cpp =================================================================== --- clang-tools-extra/clangd/index/Trigram.cpp +++ clang-tools-extra/clangd/index/Trigram.cpp @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// #include "Trigram.h" -#include "../../FuzzyMatch.h" +#include "../FuzzyMatch.h" #include "Token.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/DenseSet.h" @@ -21,7 +21,6 @@ namespace clang { namespace clangd { -namespace dex { /// This is used to mark unigrams and bigrams and distinct them from complete /// trigrams. Since '$' is not present in valid identifier names, it is safe to @@ -154,6 +153,5 @@ return Result; } -} // namespace dex } // namespace clangd } // namespace clang Index: clang-tools-extra/clangd/tool/ClangdMain.cpp =================================================================== --- clang-tools-extra/clangd/tool/ClangdMain.cpp +++ clang-tools-extra/clangd/tool/ClangdMain.cpp @@ -13,7 +13,6 @@ #include "RIFF.h" #include "Trace.h" #include "index/SymbolYAML.h" -#include "index/dex/DexIndex.h" #include "clang/Basic/Version.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/FileSystem.h" Index: clang-tools-extra/unittests/clangd/DexIndexTests.cpp =================================================================== --- clang-tools-extra/unittests/clangd/DexIndexTests.cpp +++ clang-tools-extra/unittests/clangd/DexIndexTests.cpp @@ -10,12 +10,12 @@ #include "FuzzyMatch.h" #include "TestFS.h" #include "TestIndex.h" +#include "index/Dex.h" #include "index/Index.h" +#include "index/Iterator.h" #include "index/Merge.h" -#include "index/dex/DexIndex.h" -#include "index/dex/Iterator.h" -#include "index/dex/Token.h" -#include "index/dex/Trigram.h" +#include "index/Token.h" +#include "index/Trigram.h" #include "llvm/Support/ScopedPrinter.h" #include "llvm/Support/raw_ostream.h" #include "gmock/gmock.h" @@ -29,7 +29,6 @@ namespace clang { namespace clangd { -namespace dex { namespace { std::vector URISchemes = {"unittest"}; @@ -610,6 +609,5 @@ } } // namespace -} // namespace dex } // namespace clangd } // namespace clang Index: clang-tools-extra/unittests/clangd/TestIndex.h =================================================================== --- clang-tools-extra/unittests/clangd/TestIndex.h +++ clang-tools-extra/unittests/clangd/TestIndex.h @@ -1,4 +1,4 @@ -//===-- IndexHelpers.h ------------------------------------------*- C++ -*-===// +//===-- TestIndex.h ---------------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -12,10 +12,6 @@ #include "index/Index.h" #include "index/Merge.h" -#include "index/dex/DexIndex.h" -#include "index/dex/Iterator.h" -#include "index/dex/Token.h" -#include "index/dex/Trigram.h" namespace clang { namespace clangd { Index: clang-tools-extra/unittests/clangd/TestIndex.cpp =================================================================== --- clang-tools-extra/unittests/clangd/TestIndex.cpp +++ clang-tools-extra/unittests/clangd/TestIndex.cpp @@ -1,4 +1,4 @@ -//===-- IndexHelpers.cpp ----------------------------------------*- C++ -*-===// +//===-- TestIndex.cpp -------------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure //