[clang-tools-extra] ad97ccf - [clangd] Move non-clang base pieces into separate support/ lib. NFCI

Sam McCall via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 29 07:00:01 PDT 2020


Author: Sam McCall
Date: 2020-04-29T15:57:12+02:00
New Revision: ad97ccf6b26a29262c9cbf5b3e7f6e84c6dcf55f

URL: https://github.com/llvm/llvm-project/commit/ad97ccf6b26a29262c9cbf5b3e7f6e84c6dcf55f
DIFF: https://github.com/llvm/llvm-project/commit/ad97ccf6b26a29262c9cbf5b3e7f6e84c6dcf55f.diff

LOG: [clangd] Move non-clang base pieces into separate support/ lib. NFCI

Summary:
This enforces layering, reduces a sprawling clangd/ directory, and makes life
easier for embedders.

Reviewers: kbobyrev

Subscribers: mgorny, ilya-biryukov, javed.absar, MaskRay, jkorous, arphaman, jfb, kadircet, usaxena95, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D79014

Added: 
    clang-tools-extra/clangd/support/CMakeLists.txt
    clang-tools-extra/clangd/support/Cancellation.cpp
    clang-tools-extra/clangd/support/Cancellation.h
    clang-tools-extra/clangd/support/Context.cpp
    clang-tools-extra/clangd/support/Context.h
    clang-tools-extra/clangd/support/FSProvider.cpp
    clang-tools-extra/clangd/support/FSProvider.h
    clang-tools-extra/clangd/support/Function.h
    clang-tools-extra/clangd/support/Logger.cpp
    clang-tools-extra/clangd/support/Logger.h
    clang-tools-extra/clangd/support/Path.h
    clang-tools-extra/clangd/support/Shutdown.cpp
    clang-tools-extra/clangd/support/Shutdown.h
    clang-tools-extra/clangd/support/Threading.cpp
    clang-tools-extra/clangd/support/Threading.h
    clang-tools-extra/clangd/support/Trace.cpp
    clang-tools-extra/clangd/support/Trace.h
    clang-tools-extra/clangd/unittests/support/CancellationTests.cpp
    clang-tools-extra/clangd/unittests/support/ContextTests.cpp
    clang-tools-extra/clangd/unittests/support/FunctionTests.cpp
    clang-tools-extra/clangd/unittests/support/ThreadingTests.cpp
    clang-tools-extra/clangd/unittests/support/TraceTests.cpp

Modified: 
    clang-tools-extra/clangd/CMakeLists.txt
    clang-tools-extra/clangd/ClangdLSPServer.cpp
    clang-tools-extra/clangd/ClangdLSPServer.h
    clang-tools-extra/clangd/ClangdServer.cpp
    clang-tools-extra/clangd/ClangdServer.h
    clang-tools-extra/clangd/CodeComplete.cpp
    clang-tools-extra/clangd/CodeComplete.h
    clang-tools-extra/clangd/CompileCommands.cpp
    clang-tools-extra/clangd/Compiler.cpp
    clang-tools-extra/clangd/Diagnostics.cpp
    clang-tools-extra/clangd/Diagnostics.h
    clang-tools-extra/clangd/DraftStore.cpp
    clang-tools-extra/clangd/DraftStore.h
    clang-tools-extra/clangd/FS.h
    clang-tools-extra/clangd/FileDistance.cpp
    clang-tools-extra/clangd/FindSymbols.cpp
    clang-tools-extra/clangd/FindTarget.cpp
    clang-tools-extra/clangd/Format.cpp
    clang-tools-extra/clangd/GlobalCompilationDatabase.cpp
    clang-tools-extra/clangd/GlobalCompilationDatabase.h
    clang-tools-extra/clangd/HeaderSourceSwitch.cpp
    clang-tools-extra/clangd/Headers.cpp
    clang-tools-extra/clangd/Headers.h
    clang-tools-extra/clangd/Hover.cpp
    clang-tools-extra/clangd/IncludeFixer.cpp
    clang-tools-extra/clangd/JSONTransport.cpp
    clang-tools-extra/clangd/ParsedAST.cpp
    clang-tools-extra/clangd/ParsedAST.h
    clang-tools-extra/clangd/Preamble.cpp
    clang-tools-extra/clangd/Preamble.h
    clang-tools-extra/clangd/Protocol.cpp
    clang-tools-extra/clangd/QueryDriverDatabase.cpp
    clang-tools-extra/clangd/Selection.cpp
    clang-tools-extra/clangd/SemanticHighlighting.cpp
    clang-tools-extra/clangd/SourceCode.cpp
    clang-tools-extra/clangd/SourceCode.h
    clang-tools-extra/clangd/TUScheduler.cpp
    clang-tools-extra/clangd/TUScheduler.h
    clang-tools-extra/clangd/XRefs.cpp
    clang-tools-extra/clangd/XRefs.h
    clang-tools-extra/clangd/fuzzer/clangd-fuzzer.cpp
    clang-tools-extra/clangd/index/Background.cpp
    clang-tools-extra/clangd/index/Background.h
    clang-tools-extra/clangd/index/BackgroundIndexLoader.cpp
    clang-tools-extra/clangd/index/BackgroundIndexLoader.h
    clang-tools-extra/clangd/index/BackgroundIndexStorage.cpp
    clang-tools-extra/clangd/index/BackgroundQueue.cpp
    clang-tools-extra/clangd/index/BackgroundRebuild.cpp
    clang-tools-extra/clangd/index/FileIndex.cpp
    clang-tools-extra/clangd/index/FileIndex.h
    clang-tools-extra/clangd/index/Index.cpp
    clang-tools-extra/clangd/index/IndexAction.cpp
    clang-tools-extra/clangd/index/MemIndex.cpp
    clang-tools-extra/clangd/index/Merge.cpp
    clang-tools-extra/clangd/index/Serialization.cpp
    clang-tools-extra/clangd/index/SymbolCollector.cpp
    clang-tools-extra/clangd/index/YAMLSerialization.cpp
    clang-tools-extra/clangd/index/dex/Dex.cpp
    clang-tools-extra/clangd/index/remote/CMakeLists.txt
    clang-tools-extra/clangd/index/remote/Client.cpp
    clang-tools-extra/clangd/index/remote/marshalling/CMakeLists.txt
    clang-tools-extra/clangd/index/remote/marshalling/Marshalling.cpp
    clang-tools-extra/clangd/index/remote/unimplemented/CMakeLists.txt
    clang-tools-extra/clangd/index/remote/unimplemented/UnimplementedClient.cpp
    clang-tools-extra/clangd/refactor/Rename.cpp
    clang-tools-extra/clangd/refactor/Rename.h
    clang-tools-extra/clangd/refactor/Tweak.cpp
    clang-tools-extra/clangd/refactor/Tweak.h
    clang-tools-extra/clangd/refactor/tweaks/AddUsing.cpp
    clang-tools-extra/clangd/refactor/tweaks/CMakeLists.txt
    clang-tools-extra/clangd/refactor/tweaks/DefineInline.cpp
    clang-tools-extra/clangd/refactor/tweaks/DefineOutline.cpp
    clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp
    clang-tools-extra/clangd/refactor/tweaks/ExtractFunction.cpp
    clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp
    clang-tools-extra/clangd/refactor/tweaks/ObjCLocalizeStringLiteral.cpp
    clang-tools-extra/clangd/refactor/tweaks/RawStringLiteral.cpp
    clang-tools-extra/clangd/refactor/tweaks/SwapIfBranches.cpp
    clang-tools-extra/clangd/tool/ClangdMain.cpp
    clang-tools-extra/clangd/unittests/CMakeLists.txt
    clang-tools-extra/clangd/unittests/ClangdLSPServerTests.cpp
    clang-tools-extra/clangd/unittests/ClangdTests.cpp
    clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
    clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp
    clang-tools-extra/clangd/unittests/GlobalCompilationDatabaseTests.cpp
    clang-tools-extra/clangd/unittests/JSONTransportTests.cpp
    clang-tools-extra/clangd/unittests/LSPClient.cpp
    clang-tools-extra/clangd/unittests/SourceCodeTests.cpp
    clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp
    clang-tools-extra/clangd/unittests/TestFS.cpp
    clang-tools-extra/clangd/unittests/TestFS.h
    clang-tools-extra/clangd/unittests/TestTU.h
    clang-tools-extra/clangd/xpc/CMakeLists.txt
    clang-tools-extra/clangd/xpc/Conversion.cpp
    clang-tools-extra/clangd/xpc/XPCTransport.cpp

Removed: 
    clang-tools-extra/clangd/Cancellation.cpp
    clang-tools-extra/clangd/Cancellation.h
    clang-tools-extra/clangd/Context.cpp
    clang-tools-extra/clangd/Context.h
    clang-tools-extra/clangd/FSProvider.cpp
    clang-tools-extra/clangd/FSProvider.h
    clang-tools-extra/clangd/Function.h
    clang-tools-extra/clangd/Logger.cpp
    clang-tools-extra/clangd/Logger.h
    clang-tools-extra/clangd/Path.h
    clang-tools-extra/clangd/Shutdown.cpp
    clang-tools-extra/clangd/Shutdown.h
    clang-tools-extra/clangd/Threading.cpp
    clang-tools-extra/clangd/Threading.h
    clang-tools-extra/clangd/Trace.cpp
    clang-tools-extra/clangd/Trace.h
    clang-tools-extra/clangd/unittests/CancellationTests.cpp
    clang-tools-extra/clangd/unittests/ContextTests.cpp
    clang-tools-extra/clangd/unittests/FunctionTests.cpp
    clang-tools-extra/clangd/unittests/ThreadingTests.cpp
    clang-tools-extra/clangd/unittests/TraceTests.cpp


################################################################################
diff  --git a/clang-tools-extra/clangd/CMakeLists.txt b/clang-tools-extra/clangd/CMakeLists.txt
index 124f087589d6..146f1b33599f 100644
--- a/clang-tools-extra/clangd/CMakeLists.txt
+++ b/clang-tools-extra/clangd/CMakeLists.txt
@@ -1,3 +1,5 @@
+add_subdirectory(support)
+
 # Configure the Features.inc file.
 if (NOT DEFINED CLANGD_BUILD_XPC)
   if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
@@ -25,19 +27,8 @@ set(LLVM_LINK_COMPONENTS
   FrontendOpenMP
   )
 
-if(CLANG_BUILT_STANDALONE)
-  # needed to get HAVE_CXX_ATOMICS64_WITHOUT_LIB defined
-  include(CheckAtomic)
-endif()
-
-set(CLANGD_ATOMIC_LIB "")
-if(NOT HAVE_CXX_ATOMICS_WITHOUT_LIB OR NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB)
-  list(APPEND CLANGD_ATOMIC_LIB "atomic")
-endif()
-
 add_clang_library(clangDaemon
   AST.cpp
-  Cancellation.cpp
   ClangdLSPServer.cpp
   ClangdServer.cpp
   CodeComplete.cpp
@@ -45,7 +36,6 @@ add_clang_library(clangDaemon
   CollectMacros.cpp
   CompileCommands.cpp
   Compiler.cpp
-  Context.cpp
   Diagnostics.cpp
   DraftStore.cpp
   ExpectedTypes.cpp
@@ -54,7 +44,6 @@ add_clang_library(clangDaemon
   FileDistance.cpp
   Format.cpp
   FS.cpp
-  FSProvider.cpp
   FormattedString.cpp
   FuzzyMatch.cpp
   GlobalCompilationDatabase.cpp
@@ -63,7 +52,6 @@ add_clang_library(clangDaemon
   Hover.cpp
   IncludeFixer.cpp
   JSONTransport.cpp
-  Logger.cpp
   PathMapping.cpp
   Protocol.cpp
   Quality.cpp
@@ -73,11 +61,8 @@ add_clang_library(clangDaemon
   Selection.cpp
   SemanticHighlighting.cpp
   SemanticSelection.cpp
-  Shutdown.cpp
   SourceCode.cpp
   QueryDriverDatabase.cpp
-  Threading.cpp
-  Trace.cpp
   TUScheduler.cpp
   URI.cpp
   XRefs.cpp
@@ -128,8 +113,7 @@ add_clang_library(clangDaemon
   clangToolingInclusions
   clangToolingRefactoring
   clangToolingSyntax
-  ${LLVM_PTHREAD_LIB}
-  ${CLANGD_ATOMIC_LIB}
+  clangdSupport
   ${ALL_CLANG_TIDY_CHECKS}
   )
 

diff  --git a/clang-tools-extra/clangd/ClangdLSPServer.cpp b/clang-tools-extra/clangd/ClangdLSPServer.cpp
index f58bfaf99648..4ca4f83ae395 100644
--- a/clang-tools-extra/clangd/ClangdLSPServer.cpp
+++ b/clang-tools-extra/clangd/ClangdLSPServer.cpp
@@ -7,7 +7,6 @@
 //===----------------------------------------------------------------------===//
 
 #include "ClangdLSPServer.h"
-#include "Context.h"
 #include "Diagnostics.h"
 #include "DraftStore.h"
 #include "FormattedString.h"
@@ -16,9 +15,10 @@
 #include "SemanticHighlighting.h"
 #include "SourceCode.h"
 #include "TUScheduler.h"
-#include "Trace.h"
 #include "URI.h"
 #include "refactor/Tweak.h"
+#include "support/Context.h"
+#include "support/Trace.h"
 #include "clang/Basic/Version.h"
 #include "clang/Tooling/Core/Replacement.h"
 #include "llvm/ADT/ArrayRef.h"

diff  --git a/clang-tools-extra/clangd/ClangdLSPServer.h b/clang-tools-extra/clangd/ClangdLSPServer.h
index 9c35ca6bda3a..c3da2f9a9457 100644
--- a/clang-tools-extra/clangd/ClangdLSPServer.h
+++ b/clang-tools-extra/clangd/ClangdLSPServer.h
@@ -10,14 +10,14 @@
 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_CLANGDLSPSERVER_H
 
 #include "ClangdServer.h"
-#include "Context.h"
 #include "DraftStore.h"
 #include "Features.inc"
 #include "FindSymbols.h"
 #include "GlobalCompilationDatabase.h"
-#include "Path.h"
 #include "Protocol.h"
 #include "Transport.h"
+#include "support/Context.h"
+#include "support/Path.h"
 #include "clang/Tooling/Core/Replacement.h"
 #include "llvm/ADT/Optional.h"
 #include "llvm/ADT/StringSet.h"

diff  --git a/clang-tools-extra/clangd/ClangdServer.cpp b/clang-tools-extra/clangd/ClangdServer.cpp
index c5148f81f3df..3dce7fec86c5 100644
--- a/clang-tools-extra/clangd/ClangdServer.cpp
+++ b/clang-tools-extra/clangd/ClangdServer.cpp
@@ -13,7 +13,6 @@
 #include "FormattedString.h"
 #include "HeaderSourceSwitch.h"
 #include "Headers.h"
-#include "Logger.h"
 #include "ParsedAST.h"
 #include "Preamble.h"
 #include "Protocol.h"
@@ -21,13 +20,14 @@
 #include "SemanticSelection.h"
 #include "SourceCode.h"
 #include "TUScheduler.h"
-#include "Trace.h"
 #include "XRefs.h"
 #include "index/CanonicalIncludes.h"
 #include "index/FileIndex.h"
 #include "index/Merge.h"
 #include "refactor/Rename.h"
 #include "refactor/Tweak.h"
+#include "support/Logger.h"
+#include "support/Trace.h"
 #include "clang/Format/Format.h"
 #include "clang/Frontend/CompilerInstance.h"
 #include "clang/Frontend/CompilerInvocation.h"

diff  --git a/clang-tools-extra/clangd/ClangdServer.h b/clang-tools-extra/clangd/ClangdServer.h
index f6e7e0799d83..d36dfd1e9a88 100644
--- a/clang-tools-extra/clangd/ClangdServer.h
+++ b/clang-tools-extra/clangd/ClangdServer.h
@@ -10,11 +10,8 @@
 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_CLANGDSERVER_H
 
 #include "../clang-tidy/ClangTidyOptions.h"
-#include "Cancellation.h"
 #include "CodeComplete.h"
-#include "FSProvider.h"
 #include "FormattedString.h"
-#include "Function.h"
 #include "GlobalCompilationDatabase.h"
 #include "Hover.h"
 #include "Protocol.h"
@@ -26,6 +23,9 @@
 #include "index/Index.h"
 #include "refactor/Rename.h"
 #include "refactor/Tweak.h"
+#include "support/Cancellation.h"
+#include "support/FSProvider.h"
+#include "support/Function.h"
 #include "clang/Tooling/CompilationDatabase.h"
 #include "clang/Tooling/Core/Replacement.h"
 #include "llvm/ADT/FunctionExtras.h"

diff  --git a/clang-tools-extra/clangd/CodeComplete.cpp b/clang-tools-extra/clangd/CodeComplete.cpp
index 3d9bfe509f2b..d218d6b34599 100644
--- a/clang-tools-extra/clangd/CodeComplete.cpp
+++ b/clang-tools-extra/clangd/CodeComplete.cpp
@@ -26,18 +26,18 @@
 #include "FileDistance.h"
 #include "FuzzyMatch.h"
 #include "Headers.h"
-#include "Logger.h"
 #include "Preamble.h"
 #include "Protocol.h"
 #include "Quality.h"
 #include "SourceCode.h"
 #include "TUScheduler.h"
-#include "Threading.h"
-#include "Trace.h"
 #include "URI.h"
 #include "index/Index.h"
 #include "index/Symbol.h"
 #include "index/SymbolOrigin.h"
+#include "support/Logger.h"
+#include "support/Threading.h"
+#include "support/Trace.h"
 #include "clang/AST/Decl.h"
 #include "clang/AST/DeclBase.h"
 #include "clang/Basic/CharInfo.h"

diff  --git a/clang-tools-extra/clangd/CodeComplete.h b/clang-tools-extra/clangd/CodeComplete.h
index 3adea47c89a1..1e2370486862 100644
--- a/clang-tools-extra/clangd/CodeComplete.h
+++ b/clang-tools-extra/clangd/CodeComplete.h
@@ -16,13 +16,13 @@
 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_CODECOMPLETE_H
 
 #include "Headers.h"
-#include "Logger.h"
-#include "Path.h"
 #include "Protocol.h"
 #include "Quality.h"
 #include "index/Index.h"
 #include "index/Symbol.h"
 #include "index/SymbolOrigin.h"
+#include "support/Logger.h"
+#include "support/Path.h"
 #include "clang/Sema/CodeCompleteConsumer.h"
 #include "clang/Sema/CodeCompleteOptions.h"
 #include "clang/Tooling/CompilationDatabase.h"

diff  --git a/clang-tools-extra/clangd/CompileCommands.cpp b/clang-tools-extra/clangd/CompileCommands.cpp
index ae343d5fb3a5..84f72f5f58c7 100644
--- a/clang-tools-extra/clangd/CompileCommands.cpp
+++ b/clang-tools-extra/clangd/CompileCommands.cpp
@@ -7,7 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "CompileCommands.h"
-#include "Logger.h"
+#include "support/Logger.h"
 #include "clang/Frontend/CompilerInvocation.h"
 #include "clang/Tooling/ArgumentsAdjusters.h"
 #include "llvm/Support/FileSystem.h"

diff  --git a/clang-tools-extra/clangd/Compiler.cpp b/clang-tools-extra/clangd/Compiler.cpp
index 47cec5ae12e8..957d7c382125 100644
--- a/clang-tools-extra/clangd/Compiler.cpp
+++ b/clang-tools-extra/clangd/Compiler.cpp
@@ -7,7 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "Compiler.h"
-#include "Logger.h"
+#include "support/Logger.h"
 #include "clang/Basic/TargetInfo.h"
 #include "clang/Lex/PreprocessorOptions.h"
 #include "clang/Serialization/PCHContainerOperations.h"

diff  --git a/clang-tools-extra/clangd/Diagnostics.cpp b/clang-tools-extra/clangd/Diagnostics.cpp
index d72c2bd68ce8..3558ca929798 100644
--- a/clang-tools-extra/clangd/Diagnostics.cpp
+++ b/clang-tools-extra/clangd/Diagnostics.cpp
@@ -9,9 +9,9 @@
 #include "Diagnostics.h"
 #include "../clang-tidy/ClangTidyDiagnosticConsumer.h"
 #include "Compiler.h"
-#include "Logger.h"
 #include "Protocol.h"
 #include "SourceCode.h"
+#include "support/Logger.h"
 #include "clang/Basic/AllDiagnostics.h"
 #include "clang/Basic/Diagnostic.h"
 #include "clang/Basic/DiagnosticIDs.h"

diff  --git a/clang-tools-extra/clangd/Diagnostics.h b/clang-tools-extra/clangd/Diagnostics.h
index 7461f8529c2f..ebf86ba8716a 100644
--- a/clang-tools-extra/clangd/Diagnostics.h
+++ b/clang-tools-extra/clangd/Diagnostics.h
@@ -9,8 +9,8 @@
 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_DIAGNOSTICS_H
 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_DIAGNOSTICS_H
 
-#include "Path.h"
 #include "Protocol.h"
+#include "support/Path.h"
 #include "clang/Basic/Diagnostic.h"
 #include "clang/Basic/LangOptions.h"
 #include "llvm/ADT/ArrayRef.h"

diff  --git a/clang-tools-extra/clangd/DraftStore.cpp b/clang-tools-extra/clangd/DraftStore.cpp
index 03867dcd286e..bef48ddfa37d 100644
--- a/clang-tools-extra/clangd/DraftStore.cpp
+++ b/clang-tools-extra/clangd/DraftStore.cpp
@@ -7,8 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 #include "DraftStore.h"
-#include "Logger.h"
 #include "SourceCode.h"
+#include "support/Logger.h"
 #include "llvm/Support/Errc.h"
 
 namespace clang {

diff  --git a/clang-tools-extra/clangd/DraftStore.h b/clang-tools-extra/clangd/DraftStore.h
index babc679ed763..3c2d0c6a4b0f 100644
--- a/clang-tools-extra/clangd/DraftStore.h
+++ b/clang-tools-extra/clangd/DraftStore.h
@@ -9,8 +9,8 @@
 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_DRAFTSTORE_H
 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_DRAFTSTORE_H
 
-#include "Path.h"
 #include "Protocol.h"
+#include "support/Path.h"
 #include "clang/Basic/LLVM.h"
 #include "llvm/ADT/StringMap.h"
 #include <mutex>

diff  --git a/clang-tools-extra/clangd/FS.h b/clang-tools-extra/clangd/FS.h
index 7b7f7cb25fac..5994bdff9271 100644
--- a/clang-tools-extra/clangd/FS.h
+++ b/clang-tools-extra/clangd/FS.h
@@ -9,7 +9,7 @@
 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_FS_H
 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_FS_H
 
-#include "Path.h"
+#include "support/Path.h"
 #include "clang/Basic/LLVM.h"
 #include "llvm/ADT/Optional.h"
 #include "llvm/ADT/StringMap.h"

diff  --git a/clang-tools-extra/clangd/FileDistance.cpp b/clang-tools-extra/clangd/FileDistance.cpp
index a9ce3e514bcc..584c64d077e1 100644
--- a/clang-tools-extra/clangd/FileDistance.cpp
+++ b/clang-tools-extra/clangd/FileDistance.cpp
@@ -31,7 +31,7 @@
 //===-------------------------------------------------------------------------//
 
 #include "FileDistance.h"
-#include "Logger.h"
+#include "support/Logger.h"
 #include "llvm/ADT/STLExtras.h"
 #include <queue>
 

diff  --git a/clang-tools-extra/clangd/FindSymbols.cpp b/clang-tools-extra/clangd/FindSymbols.cpp
index 06c124c0b35b..58e2ee1e21c7 100644
--- a/clang-tools-extra/clangd/FindSymbols.cpp
+++ b/clang-tools-extra/clangd/FindSymbols.cpp
@@ -9,11 +9,11 @@
 
 #include "AST.h"
 #include "FuzzyMatch.h"
-#include "Logger.h"
 #include "ParsedAST.h"
 #include "Quality.h"
 #include "SourceCode.h"
 #include "index/Index.h"
+#include "support/Logger.h"
 #include "clang/AST/DeclTemplate.h"
 #include "clang/Index/IndexDataConsumer.h"
 #include "clang/Index/IndexSymbol.h"

diff  --git a/clang-tools-extra/clangd/FindTarget.cpp b/clang-tools-extra/clangd/FindTarget.cpp
index be3306f3fc78..2813e30b4335 100644
--- a/clang-tools-extra/clangd/FindTarget.cpp
+++ b/clang-tools-extra/clangd/FindTarget.cpp
@@ -8,7 +8,7 @@
 
 #include "FindTarget.h"
 #include "AST.h"
-#include "Logger.h"
+#include "support/Logger.h"
 #include "clang/AST/ASTTypeTraits.h"
 #include "clang/AST/Decl.h"
 #include "clang/AST/DeclCXX.h"

diff  --git a/clang-tools-extra/clangd/Format.cpp b/clang-tools-extra/clangd/Format.cpp
index b8b9d8e627d2..052cf74f8bd0 100644
--- a/clang-tools-extra/clangd/Format.cpp
+++ b/clang-tools-extra/clangd/Format.cpp
@@ -6,9 +6,9 @@
 //
 //===----------------------------------------------------------------------===//
 #include "Format.h"
-#include "Logger.h"
-#include "clang/Basic/SourceManager.h"
+#include "support/Logger.h"
 #include "clang/Basic/FileManager.h"
+#include "clang/Basic/SourceManager.h"
 #include "clang/Format/Format.h"
 #include "clang/Lex/Lexer.h"
 #include "clang/Tooling/Core/Replacement.h"

diff  --git a/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp b/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp
index 3f8a7d8219f7..5e75864ec8d4 100644
--- a/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp
+++ b/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp
@@ -8,8 +8,8 @@
 
 #include "GlobalCompilationDatabase.h"
 #include "FS.h"
-#include "Logger.h"
-#include "Path.h"
+#include "support/Logger.h"
+#include "support/Path.h"
 #include "clang/Frontend/CompilerInvocation.h"
 #include "clang/Tooling/ArgumentsAdjusters.h"
 #include "clang/Tooling/CompilationDatabase.h"

diff  --git a/clang-tools-extra/clangd/GlobalCompilationDatabase.h b/clang-tools-extra/clangd/GlobalCompilationDatabase.h
index 2fc754927fd9..e9a5417d9d69 100644
--- a/clang-tools-extra/clangd/GlobalCompilationDatabase.h
+++ b/clang-tools-extra/clangd/GlobalCompilationDatabase.h
@@ -10,8 +10,8 @@
 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_GLOBALCOMPILATIONDATABASE_H
 
 #include "CompileCommands.h"
-#include "Function.h"
-#include "Path.h"
+#include "support/Function.h"
+#include "support/Path.h"
 #include "clang/Tooling/ArgumentsAdjusters.h"
 #include "clang/Tooling/CompilationDatabase.h"
 #include "llvm/ADT/Optional.h"

diff  --git a/clang-tools-extra/clangd/HeaderSourceSwitch.cpp b/clang-tools-extra/clangd/HeaderSourceSwitch.cpp
index 1490d3ebe5c0..3ebf0542dcf0 100644
--- a/clang-tools-extra/clangd/HeaderSourceSwitch.cpp
+++ b/clang-tools-extra/clangd/HeaderSourceSwitch.cpp
@@ -8,9 +8,9 @@
 
 #include "HeaderSourceSwitch.h"
 #include "AST.h"
-#include "Logger.h"
 #include "SourceCode.h"
 #include "index/SymbolCollector.h"
+#include "support/Logger.h"
 #include "clang/AST/Decl.h"
 
 namespace clang {

diff  --git a/clang-tools-extra/clangd/Headers.cpp b/clang-tools-extra/clangd/Headers.cpp
index dd4cafd2ddfc..c0e19f2795a0 100644
--- a/clang-tools-extra/clangd/Headers.cpp
+++ b/clang-tools-extra/clangd/Headers.cpp
@@ -8,8 +8,8 @@
 
 #include "Headers.h"
 #include "Compiler.h"
-#include "Logger.h"
 #include "SourceCode.h"
+#include "support/Logger.h"
 #include "clang/Frontend/CompilerInstance.h"
 #include "clang/Frontend/CompilerInvocation.h"
 #include "clang/Frontend/FrontendActions.h"

diff  --git a/clang-tools-extra/clangd/Headers.h b/clang-tools-extra/clangd/Headers.h
index 1f3968765d83..2ffa902d740f 100644
--- a/clang-tools-extra/clangd/Headers.h
+++ b/clang-tools-extra/clangd/Headers.h
@@ -9,10 +9,10 @@
 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_HEADERS_H
 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_HEADERS_H
 
-#include "Path.h"
 #include "Protocol.h"
 #include "SourceCode.h"
 #include "index/Symbol.h"
+#include "support/Path.h"
 #include "clang/Basic/TokenKinds.h"
 #include "clang/Format/Format.h"
 #include "clang/Lex/HeaderSearch.h"

diff  --git a/clang-tools-extra/clangd/Hover.cpp b/clang-tools-extra/clangd/Hover.cpp
index ba8fcd4687b0..b0ac041abe5f 100644
--- a/clang-tools-extra/clangd/Hover.cpp
+++ b/clang-tools-extra/clangd/Hover.cpp
@@ -12,11 +12,11 @@
 #include "CodeCompletionStrings.h"
 #include "FindTarget.h"
 #include "FormattedString.h"
-#include "Logger.h"
 #include "ParsedAST.h"
 #include "Selection.h"
 #include "SourceCode.h"
 #include "index/SymbolCollector.h"
+#include "support/Logger.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/ASTTypeTraits.h"
 #include "clang/AST/Decl.h"

diff  --git a/clang-tools-extra/clangd/IncludeFixer.cpp b/clang-tools-extra/clangd/IncludeFixer.cpp
index 45fb07ad06a1..945f4eced88c 100644
--- a/clang-tools-extra/clangd/IncludeFixer.cpp
+++ b/clang-tools-extra/clangd/IncludeFixer.cpp
@@ -9,11 +9,11 @@
 #include "IncludeFixer.h"
 #include "AST.h"
 #include "Diagnostics.h"
-#include "Logger.h"
 #include "SourceCode.h"
-#include "Trace.h"
 #include "index/Index.h"
 #include "index/Symbol.h"
+#include "support/Logger.h"
+#include "support/Trace.h"
 #include "clang/AST/Decl.h"
 #include "clang/AST/DeclBase.h"
 #include "clang/AST/DeclarationName.h"

diff  --git a/clang-tools-extra/clangd/JSONTransport.cpp b/clang-tools-extra/clangd/JSONTransport.cpp
index a9254732562b..fa86baf6c581 100644
--- a/clang-tools-extra/clangd/JSONTransport.cpp
+++ b/clang-tools-extra/clangd/JSONTransport.cpp
@@ -5,11 +5,11 @@
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
-#include "Cancellation.h"
-#include "Logger.h"
 #include "Protocol.h" // For LSPError
-#include "Shutdown.h"
 #include "Transport.h"
+#include "support/Cancellation.h"
+#include "support/Logger.h"
+#include "support/Shutdown.h"
 #include "llvm/Support/Errno.h"
 #include "llvm/Support/Error.h"
 

diff  --git a/clang-tools-extra/clangd/ParsedAST.cpp b/clang-tools-extra/clangd/ParsedAST.cpp
index 7b2426115df7..61221aaa1491 100644
--- a/clang-tools-extra/clangd/ParsedAST.cpp
+++ b/clang-tools-extra/clangd/ParsedAST.cpp
@@ -14,11 +14,11 @@
 #include "Diagnostics.h"
 #include "Headers.h"
 #include "IncludeFixer.h"
-#include "Logger.h"
 #include "SourceCode.h"
-#include "Trace.h"
 #include "index/CanonicalIncludes.h"
 #include "index/Index.h"
+#include "support/Logger.h"
+#include "support/Trace.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/Decl.h"
 #include "clang/Basic/LangOptions.h"

diff  --git a/clang-tools-extra/clangd/ParsedAST.h b/clang-tools-extra/clangd/ParsedAST.h
index 88fb6c3b2d65..d90f77f9263b 100644
--- a/clang-tools-extra/clangd/ParsedAST.h
+++ b/clang-tools-extra/clangd/ParsedAST.h
@@ -24,9 +24,9 @@
 #include "Compiler.h"
 #include "Diagnostics.h"
 #include "Headers.h"
-#include "Path.h"
 #include "Preamble.h"
 #include "index/CanonicalIncludes.h"
+#include "support/Path.h"
 #include "clang/Frontend/FrontendAction.h"
 #include "clang/Frontend/PrecompiledPreamble.h"
 #include "clang/Lex/Preprocessor.h"

diff  --git a/clang-tools-extra/clangd/Preamble.cpp b/clang-tools-extra/clangd/Preamble.cpp
index 8392748227b4..2768bd1ec6a0 100644
--- a/clang-tools-extra/clangd/Preamble.cpp
+++ b/clang-tools-extra/clangd/Preamble.cpp
@@ -9,8 +9,8 @@
 #include "Preamble.h"
 #include "Compiler.h"
 #include "Headers.h"
-#include "Logger.h"
-#include "Trace.h"
+#include "support/Logger.h"
+#include "support/Trace.h"
 #include "clang/Basic/Diagnostic.h"
 #include "clang/Basic/LangOptions.h"
 #include "clang/Basic/SourceLocation.h"

diff  --git a/clang-tools-extra/clangd/Preamble.h b/clang-tools-extra/clangd/Preamble.h
index 10c292a71f38..f2e1ba98f332 100644
--- a/clang-tools-extra/clangd/Preamble.h
+++ b/clang-tools-extra/clangd/Preamble.h
@@ -27,8 +27,8 @@
 #include "Diagnostics.h"
 #include "FS.h"
 #include "Headers.h"
-#include "Path.h"
 #include "index/CanonicalIncludes.h"
+#include "support/Path.h"
 #include "clang/Frontend/CompilerInvocation.h"
 #include "clang/Frontend/PrecompiledPreamble.h"
 #include "clang/Tooling/CompilationDatabase.h"

diff  --git a/clang-tools-extra/clangd/Protocol.cpp b/clang-tools-extra/clangd/Protocol.cpp
index b0c7ce2acb33..314e6b0bbabc 100644
--- a/clang-tools-extra/clangd/Protocol.cpp
+++ b/clang-tools-extra/clangd/Protocol.cpp
@@ -11,8 +11,8 @@
 //===----------------------------------------------------------------------===//
 
 #include "Protocol.h"
-#include "Logger.h"
 #include "URI.h"
+#include "support/Logger.h"
 #include "clang/Basic/LLVM.h"
 #include "clang/Index/IndexSymbol.h"
 #include "llvm/ADT/Hashing.h"

diff  --git a/clang-tools-extra/clangd/QueryDriverDatabase.cpp b/clang-tools-extra/clangd/QueryDriverDatabase.cpp
index d6502c6b84ba..2ab217dac155 100644
--- a/clang-tools-extra/clangd/QueryDriverDatabase.cpp
+++ b/clang-tools-extra/clangd/QueryDriverDatabase.cpp
@@ -30,9 +30,9 @@
 // in the paths that are explicitly whitelisted by the user.
 
 #include "GlobalCompilationDatabase.h"
-#include "Logger.h"
-#include "Path.h"
-#include "Trace.h"
+#include "support/Logger.h"
+#include "support/Path.h"
+#include "support/Trace.h"
 #include "clang/Driver/Types.h"
 #include "clang/Tooling/CompilationDatabase.h"
 #include "llvm/ADT/DenseMap.h"

diff  --git a/clang-tools-extra/clangd/Selection.cpp b/clang-tools-extra/clangd/Selection.cpp
index b4565446c8ec..7d52714ad3fa 100644
--- a/clang-tools-extra/clangd/Selection.cpp
+++ b/clang-tools-extra/clangd/Selection.cpp
@@ -7,8 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 #include "Selection.h"
-#include "Logger.h"
 #include "SourceCode.h"
+#include "support/Logger.h"
 #include "clang/AST/ASTTypeTraits.h"
 #include "clang/AST/Decl.h"
 #include "clang/AST/DeclCXX.h"

diff  --git a/clang-tools-extra/clangd/SemanticHighlighting.cpp b/clang-tools-extra/clangd/SemanticHighlighting.cpp
index baf13755ecf7..d2470da60140 100644
--- a/clang-tools-extra/clangd/SemanticHighlighting.cpp
+++ b/clang-tools-extra/clangd/SemanticHighlighting.cpp
@@ -8,10 +8,10 @@
 
 #include "SemanticHighlighting.h"
 #include "FindTarget.h"
-#include "Logger.h"
 #include "ParsedAST.h"
 #include "Protocol.h"
 #include "SourceCode.h"
+#include "support/Logger.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/Decl.h"
 #include "clang/AST/DeclCXX.h"

diff  --git a/clang-tools-extra/clangd/SourceCode.cpp b/clang-tools-extra/clangd/SourceCode.cpp
index dd4c863cb96a..d50968bae19b 100644
--- a/clang-tools-extra/clangd/SourceCode.cpp
+++ b/clang-tools-extra/clangd/SourceCode.cpp
@@ -7,11 +7,11 @@
 //===----------------------------------------------------------------------===//
 #include "SourceCode.h"
 
-#include "Context.h"
 #include "FuzzyMatch.h"
-#include "Logger.h"
 #include "Protocol.h"
 #include "refactor/Tweak.h"
+#include "support/Context.h"
+#include "support/Logger.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/Basic/LangOptions.h"
 #include "clang/Basic/SourceLocation.h"

diff  --git a/clang-tools-extra/clangd/SourceCode.h b/clang-tools-extra/clangd/SourceCode.h
index d1e5aa5f7c2b..c00cc17ac9bc 100644
--- a/clang-tools-extra/clangd/SourceCode.h
+++ b/clang-tools-extra/clangd/SourceCode.h
@@ -13,8 +13,8 @@
 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_SOURCECODE_H
 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_SOURCECODE_H
 
-#include "Context.h"
 #include "Protocol.h"
+#include "support/Context.h"
 #include "clang/Basic/Diagnostic.h"
 #include "clang/Basic/LangOptions.h"
 #include "clang/Basic/SourceLocation.h"

diff  --git a/clang-tools-extra/clangd/TUScheduler.cpp b/clang-tools-extra/clangd/TUScheduler.cpp
index 1ff6bbaebc24..db5ac85ce7fc 100644
--- a/clang-tools-extra/clangd/TUScheduler.cpp
+++ b/clang-tools-extra/clangd/TUScheduler.cpp
@@ -47,18 +47,18 @@
 // requests will receive latest build preamble, which might possibly be stale.
 
 #include "TUScheduler.h"
-#include "Cancellation.h"
 #include "Compiler.h"
-#include "Context.h"
 #include "Diagnostics.h"
 #include "GlobalCompilationDatabase.h"
-#include "Logger.h"
 #include "ParsedAST.h"
-#include "Path.h"
 #include "Preamble.h"
-#include "Threading.h"
-#include "Trace.h"
 #include "index/CanonicalIncludes.h"
+#include "support/Cancellation.h"
+#include "support/Context.h"
+#include "support/Logger.h"
+#include "support/Path.h"
+#include "support/Threading.h"
+#include "support/Trace.h"
 #include "clang/Frontend/CompilerInvocation.h"
 #include "clang/Tooling/CompilationDatabase.h"
 #include "llvm/ADT/FunctionExtras.h"

diff  --git a/clang-tools-extra/clangd/TUScheduler.h b/clang-tools-extra/clangd/TUScheduler.h
index 48ed2c76f546..f24a777d5836 100644
--- a/clang-tools-extra/clangd/TUScheduler.h
+++ b/clang-tools-extra/clangd/TUScheduler.h
@@ -11,11 +11,11 @@
 
 #include "Compiler.h"
 #include "Diagnostics.h"
-#include "Function.h"
 #include "GlobalCompilationDatabase.h"
-#include "Path.h"
-#include "Threading.h"
 #include "index/CanonicalIncludes.h"
+#include "support/Function.h"
+#include "support/Path.h"
+#include "support/Threading.h"
 #include "llvm/ADT/Optional.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/StringMap.h"

diff  --git a/clang-tools-extra/clangd/XRefs.cpp b/clang-tools-extra/clangd/XRefs.cpp
index 7eb3c4fcc7a3..441856457e3b 100644
--- a/clang-tools-extra/clangd/XRefs.cpp
+++ b/clang-tools-extra/clangd/XRefs.cpp
@@ -10,7 +10,6 @@
 #include "CodeCompletionStrings.h"
 #include "FindSymbols.h"
 #include "FindTarget.h"
-#include "Logger.h"
 #include "ParsedAST.h"
 #include "Protocol.h"
 #include "Quality.h"
@@ -21,6 +20,7 @@
 #include "index/Merge.h"
 #include "index/Relation.h"
 #include "index/SymbolLocation.h"
+#include "support/Logger.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/ASTTypeTraits.h"
 #include "clang/AST/Attr.h"

diff  --git a/clang-tools-extra/clangd/XRefs.h b/clang-tools-extra/clangd/XRefs.h
index 4645d32c763c..d1ba7bac6660 100644
--- a/clang-tools-extra/clangd/XRefs.h
+++ b/clang-tools-extra/clangd/XRefs.h
@@ -14,11 +14,11 @@
 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_XREFS_H
 
 #include "FormattedString.h"
-#include "Path.h"
 #include "Protocol.h"
 #include "SourceCode.h"
 #include "index/Index.h"
 #include "index/SymbolLocation.h"
+#include "support/Path.h"
 #include "clang/AST/ASTTypeTraits.h"
 #include "clang/AST/Type.h"
 #include "clang/Format/Format.h"

diff  --git a/clang-tools-extra/clangd/fuzzer/clangd-fuzzer.cpp b/clang-tools-extra/clangd/fuzzer/clangd-fuzzer.cpp
index 9776b0585e2b..982d5fa292d3 100644
--- a/clang-tools-extra/clangd/fuzzer/clangd-fuzzer.cpp
+++ b/clang-tools-extra/clangd/fuzzer/clangd-fuzzer.cpp
@@ -15,8 +15,8 @@
 #include "ClangdLSPServer.h"
 #include "ClangdServer.h"
 #include "CodeComplete.h"
-#include "FSProvider.h"
 #include "refactor/Rename.h"
+#include "support/FSProvider.h"
 #include <cstdio>
 #include <sstream>
 

diff  --git a/clang-tools-extra/clangd/index/Background.cpp b/clang-tools-extra/clangd/index/Background.cpp
index 4c5719d0526c..67fed77034f1 100644
--- a/clang-tools-extra/clangd/index/Background.cpp
+++ b/clang-tools-extra/clangd/index/Background.cpp
@@ -8,16 +8,10 @@
 
 #include "index/Background.h"
 #include "Compiler.h"
-#include "Context.h"
-#include "FSProvider.h"
 #include "Headers.h"
-#include "Logger.h"
 #include "ParsedAST.h"
-#include "Path.h"
 #include "SourceCode.h"
 #include "Symbol.h"
-#include "Threading.h"
-#include "Trace.h"
 #include "URI.h"
 #include "index/BackgroundIndexLoader.h"
 #include "index/FileIndex.h"
@@ -27,6 +21,12 @@
 #include "index/Relation.h"
 #include "index/Serialization.h"
 #include "index/SymbolCollector.h"
+#include "support/Context.h"
+#include "support/FSProvider.h"
+#include "support/Logger.h"
+#include "support/Path.h"
+#include "support/Threading.h"
+#include "support/Trace.h"
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Driver/Types.h"

diff  --git a/clang-tools-extra/clangd/index/Background.h b/clang-tools-extra/clangd/index/Background.h
index 2ae11c72d5d4..ffaea75c5d41 100644
--- a/clang-tools-extra/clangd/index/Background.h
+++ b/clang-tools-extra/clangd/index/Background.h
@@ -9,16 +9,16 @@
 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_BACKGROUND_H
 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_BACKGROUND_H
 
-#include "Context.h"
-#include "FSProvider.h"
 #include "GlobalCompilationDatabase.h"
-#include "Path.h"
 #include "SourceCode.h"
-#include "Threading.h"
 #include "index/BackgroundRebuild.h"
 #include "index/FileIndex.h"
 #include "index/Index.h"
 #include "index/Serialization.h"
+#include "support/Context.h"
+#include "support/FSProvider.h"
+#include "support/Path.h"
+#include "support/Threading.h"
 #include "clang/Tooling/CompilationDatabase.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/Support/Threading.h"

diff  --git a/clang-tools-extra/clangd/index/BackgroundIndexLoader.cpp b/clang-tools-extra/clangd/index/BackgroundIndexLoader.cpp
index 08bf07d8b280..5645569c9ae1 100644
--- a/clang-tools-extra/clangd/index/BackgroundIndexLoader.cpp
+++ b/clang-tools-extra/clangd/index/BackgroundIndexLoader.cpp
@@ -8,9 +8,9 @@
 
 #include "index/BackgroundIndexLoader.h"
 #include "GlobalCompilationDatabase.h"
-#include "Logger.h"
-#include "Path.h"
 #include "index/Background.h"
+#include "support/Logger.h"
+#include "support/Path.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/DenseSet.h"
 #include "llvm/ADT/SmallString.h"

diff  --git a/clang-tools-extra/clangd/index/BackgroundIndexLoader.h b/clang-tools-extra/clangd/index/BackgroundIndexLoader.h
index 0caf1b463525..aa7ee39ef0bb 100644
--- a/clang-tools-extra/clangd/index/BackgroundIndexLoader.h
+++ b/clang-tools-extra/clangd/index/BackgroundIndexLoader.h
@@ -9,8 +9,8 @@
 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_BACKGROUND_INDEX_LOADER_H
 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_BACKGROUND_INDEX_LOADER_H
 
-#include "Path.h"
 #include "index/Background.h"
+#include "support/Path.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/Optional.h"

diff  --git a/clang-tools-extra/clangd/index/BackgroundIndexStorage.cpp b/clang-tools-extra/clangd/index/BackgroundIndexStorage.cpp
index 765b710ba149..eee050b0db9a 100644
--- a/clang-tools-extra/clangd/index/BackgroundIndexStorage.cpp
+++ b/clang-tools-extra/clangd/index/BackgroundIndexStorage.cpp
@@ -7,9 +7,9 @@
 //===----------------------------------------------------------------------===//
 
 #include "GlobalCompilationDatabase.h"
-#include "Logger.h"
-#include "Path.h"
 #include "index/Background.h"
+#include "support/Logger.h"
+#include "support/Path.h"
 #include "llvm/ADT/Optional.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/ScopeExit.h"

diff  --git a/clang-tools-extra/clangd/index/BackgroundQueue.cpp b/clang-tools-extra/clangd/index/BackgroundQueue.cpp
index 00d483f38005..3262a2f46d38 100644
--- a/clang-tools-extra/clangd/index/BackgroundQueue.cpp
+++ b/clang-tools-extra/clangd/index/BackgroundQueue.cpp
@@ -6,8 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "Logger.h"
 #include "index/Background.h"
+#include "support/Logger.h"
 
 namespace clang {
 namespace clangd {

diff  --git a/clang-tools-extra/clangd/index/BackgroundRebuild.cpp b/clang-tools-extra/clangd/index/BackgroundRebuild.cpp
index 5cc61a6decb6..2aa5fa9ca812 100644
--- a/clang-tools-extra/clangd/index/BackgroundRebuild.cpp
+++ b/clang-tools-extra/clangd/index/BackgroundRebuild.cpp
@@ -9,13 +9,9 @@
 #include "index/BackgroundRebuild.h"
 #include "Compiler.h"
 #include "Headers.h"
-#include "Logger.h"
 #include "ParsedAST.h"
-#include "Path.h"
 #include "SourceCode.h"
 #include "Symbol.h"
-#include "Threading.h"
-#include "Trace.h"
 #include "URI.h"
 #include "index/FileIndex.h"
 #include "index/IndexAction.h"
@@ -24,6 +20,10 @@
 #include "index/Relation.h"
 #include "index/Serialization.h"
 #include "index/SymbolCollector.h"
+#include "support/Logger.h"
+#include "support/Path.h"
+#include "support/Threading.h"
+#include "support/Trace.h"
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Basic/SourceManager.h"
 #include "llvm/ADT/Hashing.h"

diff  --git a/clang-tools-extra/clangd/index/FileIndex.cpp b/clang-tools-extra/clangd/index/FileIndex.cpp
index 590bf46ec01c..6a94b9c1a696 100644
--- a/clang-tools-extra/clangd/index/FileIndex.cpp
+++ b/clang-tools-extra/clangd/index/FileIndex.cpp
@@ -8,9 +8,7 @@
 
 #include "FileIndex.h"
 #include "CollectMacros.h"
-#include "Logger.h"
 #include "ParsedAST.h"
-#include "Path.h"
 #include "SymbolCollector.h"
 #include "index/CanonicalIncludes.h"
 #include "index/Index.h"
@@ -23,6 +21,8 @@
 #include "index/SymbolID.h"
 #include "index/SymbolOrigin.h"
 #include "index/dex/Dex.h"
+#include "support/Logger.h"
+#include "support/Path.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/Index/IndexingAction.h"
 #include "clang/Index/IndexingOptions.h"

diff  --git a/clang-tools-extra/clangd/index/FileIndex.h b/clang-tools-extra/clangd/index/FileIndex.h
index 539f232a7523..5c8776659e8f 100644
--- a/clang-tools-extra/clangd/index/FileIndex.h
+++ b/clang-tools-extra/clangd/index/FileIndex.h
@@ -19,12 +19,12 @@
 #include "Index.h"
 #include "MemIndex.h"
 #include "Merge.h"
-#include "Path.h"
 #include "index/CanonicalIncludes.h"
 #include "index/Ref.h"
 #include "index/Relation.h"
 #include "index/Serialization.h"
 #include "index/Symbol.h"
+#include "support/Path.h"
 #include "clang/Lex/Preprocessor.h"
 #include "clang/Tooling/CompilationDatabase.h"
 #include "llvm/ADT/DenseSet.h"

diff  --git a/clang-tools-extra/clangd/index/Index.cpp b/clang-tools-extra/clangd/index/Index.cpp
index 9ec4908bbbfc..e4eb1b586cc5 100644
--- a/clang-tools-extra/clangd/index/Index.cpp
+++ b/clang-tools-extra/clangd/index/Index.cpp
@@ -7,7 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "Index.h"
-#include "Logger.h"
+#include "support/Logger.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Error.h"

diff  --git a/clang-tools-extra/clangd/index/IndexAction.cpp b/clang-tools-extra/clangd/index/IndexAction.cpp
index 8fd2159932b4..9f294d4ab925 100644
--- a/clang-tools-extra/clangd/index/IndexAction.cpp
+++ b/clang-tools-extra/clangd/index/IndexAction.cpp
@@ -8,9 +8,9 @@
 
 #include "IndexAction.h"
 #include "Headers.h"
-#include "Logger.h"
 #include "index/Relation.h"
 #include "index/SymbolOrigin.h"
+#include "support/Logger.h"
 #include "clang/AST/ASTConsumer.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/Basic/SourceLocation.h"

diff  --git a/clang-tools-extra/clangd/index/MemIndex.cpp b/clang-tools-extra/clangd/index/MemIndex.cpp
index 453b226e7907..46e9c0a8ee45 100644
--- a/clang-tools-extra/clangd/index/MemIndex.cpp
+++ b/clang-tools-extra/clangd/index/MemIndex.cpp
@@ -8,9 +8,9 @@
 
 #include "MemIndex.h"
 #include "FuzzyMatch.h"
-#include "Logger.h"
 #include "Quality.h"
-#include "Trace.h"
+#include "support/Logger.h"
+#include "support/Trace.h"
 #include "clang/Index/IndexSymbol.h"
 
 namespace clang {

diff  --git a/clang-tools-extra/clangd/index/Merge.cpp b/clang-tools-extra/clangd/index/Merge.cpp
index 0cef7dc7630a..a93aa204e18f 100644
--- a/clang-tools-extra/clangd/index/Merge.cpp
+++ b/clang-tools-extra/clangd/index/Merge.cpp
@@ -7,11 +7,11 @@
 //===----------------------------------------------------------------------===//
 
 #include "Merge.h"
-#include "Logger.h"
-#include "Trace.h"
 #include "index/Symbol.h"
 #include "index/SymbolLocation.h"
 #include "index/SymbolOrigin.h"
+#include "support/Logger.h"
+#include "support/Trace.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/StringSet.h"

diff  --git a/clang-tools-extra/clangd/index/Serialization.cpp b/clang-tools-extra/clangd/index/Serialization.cpp
index 6ba4e046189c..06527a615c20 100644
--- a/clang-tools-extra/clangd/index/Serialization.cpp
+++ b/clang-tools-extra/clangd/index/Serialization.cpp
@@ -8,12 +8,12 @@
 
 #include "Serialization.h"
 #include "Headers.h"
-#include "Logger.h"
 #include "RIFF.h"
 #include "SymbolLocation.h"
 #include "SymbolOrigin.h"
-#include "Trace.h"
 #include "dex/Dex.h"
+#include "support/Logger.h"
+#include "support/Trace.h"
 #include "clang/Tooling/CompilationDatabase.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Compression.h"

diff  --git a/clang-tools-extra/clangd/index/SymbolCollector.cpp b/clang-tools-extra/clangd/index/SymbolCollector.cpp
index 739aef880de9..b502dfb03aec 100644
--- a/clang-tools-extra/clangd/index/SymbolCollector.cpp
+++ b/clang-tools-extra/clangd/index/SymbolCollector.cpp
@@ -12,11 +12,11 @@
 #include "CodeComplete.h"
 #include "CodeCompletionStrings.h"
 #include "ExpectedTypes.h"
-#include "Logger.h"
 #include "SourceCode.h"
 #include "SymbolLocation.h"
 #include "URI.h"
 #include "index/SymbolID.h"
+#include "support/Logger.h"
 #include "clang/AST/Decl.h"
 #include "clang/AST/DeclBase.h"
 #include "clang/AST/DeclCXX.h"

diff  --git a/clang-tools-extra/clangd/index/YAMLSerialization.cpp b/clang-tools-extra/clangd/index/YAMLSerialization.cpp
index fc515a17d100..4f6bd927cc19 100644
--- a/clang-tools-extra/clangd/index/YAMLSerialization.cpp
+++ b/clang-tools-extra/clangd/index/YAMLSerialization.cpp
@@ -17,8 +17,8 @@
 #include "Serialization.h"
 #include "SymbolLocation.h"
 #include "SymbolOrigin.h"
-#include "Trace.h"
 #include "dex/Dex.h"
+#include "support/Trace.h"
 #include "llvm/ADT/Optional.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"

diff  --git a/clang-tools-extra/clangd/index/dex/Dex.cpp b/clang-tools-extra/clangd/index/dex/Dex.cpp
index 36ddedd04e1f..a663e5387ece 100644
--- a/clang-tools-extra/clangd/index/dex/Dex.cpp
+++ b/clang-tools-extra/clangd/index/dex/Dex.cpp
@@ -9,11 +9,11 @@
 #include "Dex.h"
 #include "FileDistance.h"
 #include "FuzzyMatch.h"
-#include "Logger.h"
 #include "Quality.h"
-#include "Trace.h"
 #include "index/Index.h"
 #include "index/dex/Iterator.h"
+#include "support/Logger.h"
+#include "support/Trace.h"
 #include "llvm/ADT/StringSet.h"
 #include "llvm/Support/ScopedPrinter.h"
 #include <algorithm>

diff  --git a/clang-tools-extra/clangd/index/remote/CMakeLists.txt b/clang-tools-extra/clangd/index/remote/CMakeLists.txt
index 1bd336e626d9..a358aae0ef6b 100644
--- a/clang-tools-extra/clangd/index/remote/CMakeLists.txt
+++ b/clang-tools-extra/clangd/index/remote/CMakeLists.txt
@@ -18,6 +18,7 @@ if (CLANGD_ENABLE_REMOTE)
     protobuf
     grpc++
     clangDaemon
+    clangdSupport
     )
 
   add_subdirectory(marshalling)

diff  --git a/clang-tools-extra/clangd/index/remote/Client.cpp b/clang-tools-extra/clangd/index/remote/Client.cpp
index 0c5fe142214b..3ba1dfeb431d 100644
--- a/clang-tools-extra/clangd/index/remote/Client.cpp
+++ b/clang-tools-extra/clangd/index/remote/Client.cpp
@@ -10,10 +10,10 @@
 
 #include "Client.h"
 #include "Index.grpc.pb.h"
-#include "Logger.h"
-#include "Trace.h"
 #include "index/Serialization.h"
 #include "marshalling/Marshalling.h"
+#include "support/Logger.h"
+#include "support/Trace.h"
 #include "llvm/Support/YAMLTraits.h"
 
 namespace clang {

diff  --git a/clang-tools-extra/clangd/index/remote/marshalling/CMakeLists.txt b/clang-tools-extra/clangd/index/remote/marshalling/CMakeLists.txt
index 4789a728951c..0e5e5133eed5 100644
--- a/clang-tools-extra/clangd/index/remote/marshalling/CMakeLists.txt
+++ b/clang-tools-extra/clangd/index/remote/marshalling/CMakeLists.txt
@@ -6,4 +6,5 @@ add_clang_library(clangdRemoteMarshalling
 
   protobuf
   clangDaemon
+  clangdSupport
   )

diff  --git a/clang-tools-extra/clangd/index/remote/marshalling/Marshalling.cpp b/clang-tools-extra/clangd/index/remote/marshalling/Marshalling.cpp
index d2ec07136fa5..60a258a6db2e 100644
--- a/clang-tools-extra/clangd/index/remote/marshalling/Marshalling.cpp
+++ b/clang-tools-extra/clangd/index/remote/marshalling/Marshalling.cpp
@@ -7,8 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 #include "Marshalling.h"
-#include "Logger.h"
 #include "index/Serialization.h"
+#include "support/Logger.h"
 
 namespace clang {
 namespace clangd {

diff  --git a/clang-tools-extra/clangd/index/remote/unimplemented/CMakeLists.txt b/clang-tools-extra/clangd/index/remote/unimplemented/CMakeLists.txt
index aebe4e674ab7..5d223ad3c8b3 100644
--- a/clang-tools-extra/clangd/index/remote/unimplemented/CMakeLists.txt
+++ b/clang-tools-extra/clangd/index/remote/unimplemented/CMakeLists.txt
@@ -7,4 +7,5 @@ add_clang_library(clangdRemoteIndex
 
   LINK_LIBS
   clangDaemon
+  clangdSupport
   )

diff  --git a/clang-tools-extra/clangd/index/remote/unimplemented/UnimplementedClient.cpp b/clang-tools-extra/clangd/index/remote/unimplemented/UnimplementedClient.cpp
index 725f0e472c3a..f0fb612f6332 100644
--- a/clang-tools-extra/clangd/index/remote/unimplemented/UnimplementedClient.cpp
+++ b/clang-tools-extra/clangd/index/remote/unimplemented/UnimplementedClient.cpp
@@ -6,8 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "Logger.h"
 #include "index/remote/Client.h"
+#include "support/Logger.h"
 
 namespace clang {
 namespace clangd {

diff  --git a/clang-tools-extra/clangd/refactor/Rename.cpp b/clang-tools-extra/clangd/refactor/Rename.cpp
index 0585897947df..c08f6ea805aa 100644
--- a/clang-tools-extra/clangd/refactor/Rename.cpp
+++ b/clang-tools-extra/clangd/refactor/Rename.cpp
@@ -9,12 +9,12 @@
 #include "refactor/Rename.h"
 #include "AST.h"
 #include "FindTarget.h"
-#include "Logger.h"
 #include "ParsedAST.h"
 #include "Selection.h"
 #include "SourceCode.h"
-#include "Trace.h"
 #include "index/SymbolCollector.h"
+#include "support/Logger.h"
+#include "support/Trace.h"
 #include "clang/AST/DeclCXX.h"
 #include "clang/AST/DeclTemplate.h"
 #include "clang/Basic/SourceLocation.h"

diff  --git a/clang-tools-extra/clangd/refactor/Rename.h b/clang-tools-extra/clangd/refactor/Rename.h
index 5c53ba633fa2..e27951605ebc 100644
--- a/clang-tools-extra/clangd/refactor/Rename.h
+++ b/clang-tools-extra/clangd/refactor/Rename.h
@@ -9,9 +9,9 @@
 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_REFACTOR_RENAME_H
 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_REFACTOR_RENAME_H
 
-#include "Path.h"
 #include "Protocol.h"
 #include "SourceCode.h"
+#include "support/Path.h"
 #include "clang/Basic/LangOptions.h"
 #include "clang/Tooling/Core/Replacement.h"
 #include "llvm/Support/Error.h"

diff  --git a/clang-tools-extra/clangd/refactor/Tweak.cpp b/clang-tools-extra/clangd/refactor/Tweak.cpp
index 3e3033ce5c7a..b1f4dcd69af6 100644
--- a/clang-tools-extra/clangd/refactor/Tweak.cpp
+++ b/clang-tools-extra/clangd/refactor/Tweak.cpp
@@ -6,10 +6,10 @@
 //
 //===----------------------------------------------------------------------===//
 #include "Tweak.h"
-#include "Logger.h"
-#include "Path.h"
 #include "SourceCode.h"
 #include "index/Index.h"
+#include "support/Logger.h"
+#include "support/Path.h"
 #include "llvm/ADT/None.h"
 #include "llvm/ADT/Optional.h"
 #include "llvm/ADT/STLExtras.h"

diff  --git a/clang-tools-extra/clangd/refactor/Tweak.h b/clang-tools-extra/clangd/refactor/Tweak.h
index 84d3bdb3fc0a..10e3e8d3e565 100644
--- a/clang-tools-extra/clangd/refactor/Tweak.h
+++ b/clang-tools-extra/clangd/refactor/Tweak.h
@@ -20,11 +20,11 @@
 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_REFACTOR_ACTIONS_TWEAK_H
 
 #include "ParsedAST.h"
-#include "Path.h"
 #include "Protocol.h"
 #include "Selection.h"
 #include "SourceCode.h"
 #include "index/Index.h"
+#include "support/Path.h"
 #include "clang/Tooling/Core/Replacement.h"
 #include "llvm/ADT/Optional.h"
 #include "llvm/ADT/StringMap.h"

diff  --git a/clang-tools-extra/clangd/refactor/tweaks/AddUsing.cpp b/clang-tools-extra/clangd/refactor/tweaks/AddUsing.cpp
index f2ef235c43f7..836ac9ac57ab 100644
--- a/clang-tools-extra/clangd/refactor/tweaks/AddUsing.cpp
+++ b/clang-tools-extra/clangd/refactor/tweaks/AddUsing.cpp
@@ -8,8 +8,8 @@
 
 #include "AST.h"
 #include "FindTarget.h"
-#include "Logger.h"
 #include "refactor/Tweak.h"
+#include "support/Logger.h"
 #include "clang/AST/Decl.h"
 #include "clang/AST/RecursiveASTVisitor.h"
 

diff  --git a/clang-tools-extra/clangd/refactor/tweaks/CMakeLists.txt b/clang-tools-extra/clangd/refactor/tweaks/CMakeLists.txt
index 995288bca2cf..c5bff2f34a9a 100644
--- a/clang-tools-extra/clangd/refactor/tweaks/CMakeLists.txt
+++ b/clang-tools-extra/clangd/refactor/tweaks/CMakeLists.txt
@@ -30,6 +30,7 @@ add_clang_library(clangDaemonTweaks OBJECT
   clangAST
   clangBasic
   clangDaemon
+  clangdSupport
   clangFormat
   clangLex
   clangToolingCore

diff  --git a/clang-tools-extra/clangd/refactor/tweaks/DefineInline.cpp b/clang-tools-extra/clangd/refactor/tweaks/DefineInline.cpp
index b1057d8b80e7..e28a2c46c374 100644
--- a/clang-tools-extra/clangd/refactor/tweaks/DefineInline.cpp
+++ b/clang-tools-extra/clangd/refactor/tweaks/DefineInline.cpp
@@ -8,11 +8,11 @@
 
 #include "AST.h"
 #include "FindTarget.h"
-#include "Logger.h"
 #include "Selection.h"
 #include "SourceCode.h"
 #include "XRefs.h"
 #include "refactor/Tweak.h"
+#include "support/Logger.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/ASTTypeTraits.h"
 #include "clang/AST/Decl.h"

diff  --git a/clang-tools-extra/clangd/refactor/tweaks/DefineOutline.cpp b/clang-tools-extra/clangd/refactor/tweaks/DefineOutline.cpp
index c2d344a3a46e..405ff90a5945 100644
--- a/clang-tools-extra/clangd/refactor/tweaks/DefineOutline.cpp
+++ b/clang-tools-extra/clangd/refactor/tweaks/DefineOutline.cpp
@@ -9,12 +9,12 @@
 #include "AST.h"
 #include "FindTarget.h"
 #include "HeaderSourceSwitch.h"
-#include "Logger.h"
 #include "ParsedAST.h"
-#include "Path.h"
 #include "Selection.h"
 #include "SourceCode.h"
 #include "refactor/Tweak.h"
+#include "support/Logger.h"
+#include "support/Path.h"
 #include "clang/AST/ASTTypeTraits.h"
 #include "clang/AST/Attr.h"
 #include "clang/AST/Decl.h"

diff  --git a/clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp b/clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp
index bffd6c02fb6e..d2dfc4a537d4 100644
--- a/clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp
+++ b/clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp
@@ -7,20 +7,20 @@
 //===----------------------------------------------------------------------===//
 #include "refactor/Tweak.h"
 
-#include "Logger.h"
+#include "XRefs.h"
+#include "support/Logger.h"
 #include "clang/AST/Type.h"
 #include "clang/AST/TypeLoc.h"
 #include "clang/Basic/LLVM.h"
 #include "llvm/ADT/None.h"
 #include "llvm/ADT/Optional.h"
+#include "llvm/ADT/StringExtras.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/Error.h"
+#include <AST.h>
 #include <climits>
 #include <memory>
 #include <string>
-#include <AST.h>
-#include "XRefs.h"
-#include "llvm/ADT/StringExtras.h"
 
 namespace clang {
 namespace clangd {

diff  --git a/clang-tools-extra/clangd/refactor/tweaks/ExtractFunction.cpp b/clang-tools-extra/clangd/refactor/tweaks/ExtractFunction.cpp
index a22b5ab60cd5..dd62670646c4 100644
--- a/clang-tools-extra/clangd/refactor/tweaks/ExtractFunction.cpp
+++ b/clang-tools-extra/clangd/refactor/tweaks/ExtractFunction.cpp
@@ -47,11 +47,11 @@
 //===----------------------------------------------------------------------===//
 
 #include "AST.h"
-#include "Logger.h"
 #include "ParsedAST.h"
 #include "Selection.h"
 #include "SourceCode.h"
 #include "refactor/Tweak.h"
+#include "support/Logger.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/Decl.h"
 #include "clang/AST/DeclTemplate.h"

diff  --git a/clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp b/clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp
index cf38227c29d7..69bfe6731418 100644
--- a/clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp
+++ b/clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp
@@ -5,12 +5,12 @@
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
-#include "Logger.h"
 #include "ParsedAST.h"
 #include "Protocol.h"
 #include "Selection.h"
 #include "SourceCode.h"
 #include "refactor/Tweak.h"
+#include "support/Logger.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/Expr.h"
 #include "clang/AST/ExprCXX.h"

diff  --git a/clang-tools-extra/clangd/refactor/tweaks/ObjCLocalizeStringLiteral.cpp b/clang-tools-extra/clangd/refactor/tweaks/ObjCLocalizeStringLiteral.cpp
index 62a306c9316d..2534cf562daa 100644
--- a/clang-tools-extra/clangd/refactor/tweaks/ObjCLocalizeStringLiteral.cpp
+++ b/clang-tools-extra/clangd/refactor/tweaks/ObjCLocalizeStringLiteral.cpp
@@ -6,10 +6,10 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "Logger.h"
 #include "ParsedAST.h"
 #include "SourceCode.h"
 #include "refactor/Tweak.h"
+#include "support/Logger.h"
 #include "clang/AST/ExprObjC.h"
 #include "clang/Basic/LangOptions.h"
 #include "clang/Basic/SourceLocation.h"

diff  --git a/clang-tools-extra/clangd/refactor/tweaks/RawStringLiteral.cpp b/clang-tools-extra/clangd/refactor/tweaks/RawStringLiteral.cpp
index c5f480cacd76..bec45be6c325 100644
--- a/clang-tools-extra/clangd/refactor/tweaks/RawStringLiteral.cpp
+++ b/clang-tools-extra/clangd/refactor/tweaks/RawStringLiteral.cpp
@@ -5,10 +5,10 @@
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
-#include "Logger.h"
 #include "ParsedAST.h"
 #include "SourceCode.h"
 #include "refactor/Tweak.h"
+#include "support/Logger.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/RecursiveASTVisitor.h"
 #include "clang/AST/Stmt.h"

diff  --git a/clang-tools-extra/clangd/refactor/tweaks/SwapIfBranches.cpp b/clang-tools-extra/clangd/refactor/tweaks/SwapIfBranches.cpp
index 1d57cd5c7132..2422743019a1 100644
--- a/clang-tools-extra/clangd/refactor/tweaks/SwapIfBranches.cpp
+++ b/clang-tools-extra/clangd/refactor/tweaks/SwapIfBranches.cpp
@@ -5,10 +5,10 @@
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
-#include "Logger.h"
 #include "ParsedAST.h"
 #include "SourceCode.h"
 #include "refactor/Tweak.h"
+#include "support/Logger.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/RecursiveASTVisitor.h"
 #include "clang/AST/Stmt.h"

diff  --git a/clang-tools-extra/clangd/support/CMakeLists.txt b/clang-tools-extra/clangd/support/CMakeLists.txt
new file mode 100644
index 000000000000..719d7577576d
--- /dev/null
+++ b/clang-tools-extra/clangd/support/CMakeLists.txt
@@ -0,0 +1,31 @@
+# clangd/support contains low-level support libraries that do not depend
+# on clang either programmatically or conceptually.
+
+set(LLVM_LINK_COMPONENTS
+  Support
+  )
+
+if(CLANG_BUILT_STANDALONE)
+  # needed to get HAVE_CXX_ATOMICS64_WITHOUT_LIB defined
+  include(CheckAtomic)
+endif()
+
+set(CLANGD_ATOMIC_LIB "")
+if(NOT HAVE_CXX_ATOMICS_WITHOUT_LIB OR NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB)
+  list(APPEND CLANGD_ATOMIC_LIB "atomic")
+endif()
+
+include_directories(..)
+add_clang_library(clangdSupport
+  Cancellation.cpp
+  Context.cpp
+  FSProvider.cpp
+  Logger.cpp
+  Shutdown.cpp
+  Threading.cpp
+  Trace.cpp
+
+  LINK_LIBS
+  ${LLVM_PTHREAD_LIB}
+  ${CLANGD_ATOMIC_LIB}
+  )

diff  --git a/clang-tools-extra/clangd/Cancellation.cpp b/clang-tools-extra/clangd/support/Cancellation.cpp
similarity index 97%
rename from clang-tools-extra/clangd/Cancellation.cpp
rename to clang-tools-extra/clangd/support/Cancellation.cpp
index 2120e700e719..d544c17e279c 100644
--- a/clang-tools-extra/clangd/Cancellation.cpp
+++ b/clang-tools-extra/clangd/support/Cancellation.cpp
@@ -6,7 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "Cancellation.h"
+#include "support/Cancellation.h"
 #include <atomic>
 
 namespace clang {

diff  --git a/clang-tools-extra/clangd/Cancellation.h b/clang-tools-extra/clangd/support/Cancellation.h
similarity index 96%
rename from clang-tools-extra/clangd/Cancellation.h
rename to clang-tools-extra/clangd/support/Cancellation.h
index 0bee6f355c39..f33b0b5c6763 100644
--- a/clang-tools-extra/clangd/Cancellation.h
+++ b/clang-tools-extra/clangd/support/Cancellation.h
@@ -54,10 +54,10 @@
 //        Measuring the start -> cancel -> acknowledge -> finish timeline would
 //        help find where libraries' cancellation should be improved.
 
-#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_CANCELLATION_H
-#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_CANCELLATION_H
+#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_SUPPORT_CANCELLATION_H
+#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_SUPPORT_CANCELLATION_H
 
-#include "Context.h"
+#include "support/Context.h"
 #include "llvm/Support/Error.h"
 #include <functional>
 #include <system_error>

diff  --git a/clang-tools-extra/clangd/Context.cpp b/clang-tools-extra/clangd/support/Context.cpp
similarity index 97%
rename from clang-tools-extra/clangd/Context.cpp
rename to clang-tools-extra/clangd/support/Context.cpp
index 8e8bba6e97a8..266dd003f8f6 100644
--- a/clang-tools-extra/clangd/Context.cpp
+++ b/clang-tools-extra/clangd/support/Context.cpp
@@ -6,7 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "Context.h"
+#include "support/Context.h"
 #include <cassert>
 
 namespace clang {

diff  --git a/clang-tools-extra/clangd/Context.h b/clang-tools-extra/clangd/support/Context.h
similarity index 93%
rename from clang-tools-extra/clangd/Context.h
rename to clang-tools-extra/clangd/support/Context.h
index 71aeaba95254..894032bdd883 100644
--- a/clang-tools-extra/clangd/Context.h
+++ b/clang-tools-extra/clangd/support/Context.h
@@ -11,8 +11,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_CONTEXT_H_
-#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_CONTEXT_H_
+#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_SUPPORT_CONTEXT_H_
+#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_SUPPORT_CONTEXT_H_
 
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/Support/Compiler.h"
@@ -120,20 +120,20 @@ class Context {
   template <class Type>
   Context derive(const Key<Type> &Key,
                  typename std::decay<Type>::type Value) const & {
-    return Context(std::make_shared<Data>(Data{
-        /*Parent=*/DataPtr, &Key,
-        std::make_unique<TypedAnyStorage<typename std::decay<Type>::type>>(
-            std::move(Value))}));
+    return Context(std::make_shared<Data>(
+        Data{/*Parent=*/DataPtr, &Key,
+             std::make_unique<TypedAnyStorage<typename std::decay<Type>::type>>(
+                 std::move(Value))}));
   }
 
   template <class Type>
   Context
   derive(const Key<Type> &Key,
          typename std::decay<Type>::type Value) && /* takes ownership */ {
-    return Context(std::make_shared<Data>(Data{
-        /*Parent=*/std::move(DataPtr), &Key,
-        std::make_unique<TypedAnyStorage<typename std::decay<Type>::type>>(
-            std::move(Value))}));
+    return Context(std::make_shared<Data>(
+        Data{/*Parent=*/std::move(DataPtr), &Key,
+             std::make_unique<TypedAnyStorage<typename std::decay<Type>::type>>(
+                 std::move(Value))}));
   }
 
   /// Derives a child context, using an anonymous key.
@@ -219,4 +219,4 @@ class LLVM_NODISCARD WithContextValue {
 } // namespace clangd
 } // namespace clang
 
-#endif // LLVM_CLANG_TOOLS_EXTRA_CLANGD_CONTEXT_H_
+#endif

diff  --git a/clang-tools-extra/clangd/FSProvider.cpp b/clang-tools-extra/clangd/support/FSProvider.cpp
similarity index 98%
rename from clang-tools-extra/clangd/FSProvider.cpp
rename to clang-tools-extra/clangd/support/FSProvider.cpp
index 80d6be005cc4..6474a3c4a365 100644
--- a/clang-tools-extra/clangd/FSProvider.cpp
+++ b/clang-tools-extra/clangd/support/FSProvider.cpp
@@ -6,7 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "FSProvider.h"
+#include "support/FSProvider.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/StringRef.h"

diff  --git a/clang-tools-extra/clangd/FSProvider.h b/clang-tools-extra/clangd/support/FSProvider.h
similarity index 91%
rename from clang-tools-extra/clangd/FSProvider.h
rename to clang-tools-extra/clangd/support/FSProvider.h
index 1fe3ba864a33..a53a4149a47b 100644
--- a/clang-tools-extra/clangd/FSProvider.h
+++ b/clang-tools-extra/clangd/support/FSProvider.h
@@ -6,8 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_FSPROVIDER_H
-#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_FSPROVIDER_H
+#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_SUPPORT_FSPROVIDER_H
+#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_SUPPORT_FSPROVIDER_H
 
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
 #include "llvm/Support/VirtualFileSystem.h"

diff  --git a/clang-tools-extra/clangd/Function.h b/clang-tools-extra/clangd/support/Function.h
similarity index 96%
rename from clang-tools-extra/clangd/Function.h
rename to clang-tools-extra/clangd/support/Function.h
index cfcb4a550a76..2cac1b1e7f67 100644
--- a/clang-tools-extra/clangd/Function.h
+++ b/clang-tools-extra/clangd/support/Function.h
@@ -10,8 +10,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_FUNCTION_H
-#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_FUNCTION_H
+#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_SUPPORT_FUNCTION_H
+#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_SUPPORT_FUNCTION_H
 
 #include "llvm/ADT/FunctionExtras.h"
 #include "llvm/Support/Error.h"

diff  --git a/clang-tools-extra/clangd/Logger.cpp b/clang-tools-extra/clangd/support/Logger.cpp
similarity index 96%
rename from clang-tools-extra/clangd/Logger.cpp
rename to clang-tools-extra/clangd/support/Logger.cpp
index 7b8c9a3e6ffc..768d2e52210b 100644
--- a/clang-tools-extra/clangd/Logger.cpp
+++ b/clang-tools-extra/clangd/support/Logger.cpp
@@ -6,8 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "Logger.h"
-#include "Trace.h"
+#include "support/Logger.h"
+#include "support/Trace.h"
 #include "llvm/Support/Chrono.h"
 #include "llvm/Support/FormatVariadic.h"
 #include "llvm/Support/raw_ostream.h"

diff  --git a/clang-tools-extra/clangd/Logger.h b/clang-tools-extra/clangd/support/Logger.h
similarity index 97%
rename from clang-tools-extra/clangd/Logger.h
rename to clang-tools-extra/clangd/support/Logger.h
index 7a5d5140d482..72d1408bdc77 100644
--- a/clang-tools-extra/clangd/Logger.h
+++ b/clang-tools-extra/clangd/support/Logger.h
@@ -6,8 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_LOGGER_H
-#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_LOGGER_H
+#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_SUPPORT_LOGGER_H
+#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_SUPPORT_LOGGER_H
 
 #include "llvm/ADT/Twine.h"
 #include "llvm/Support/Debug.h"

diff  --git a/clang-tools-extra/clangd/Path.h b/clang-tools-extra/clangd/support/Path.h
similarity index 87%
rename from clang-tools-extra/clangd/Path.h
rename to clang-tools-extra/clangd/support/Path.h
index eaa722450425..4d4ad7f49047 100644
--- a/clang-tools-extra/clangd/Path.h
+++ b/clang-tools-extra/clangd/support/Path.h
@@ -6,8 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_PATH_H
-#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_PATH_H
+#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_SUPPORT_PATH_H
+#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_SUPPORT_PATH_H
 
 #include "llvm/ADT/StringRef.h"
 #include <string>

diff  --git a/clang-tools-extra/clangd/Shutdown.cpp b/clang-tools-extra/clangd/support/Shutdown.cpp
similarity index 91%
rename from clang-tools-extra/clangd/Shutdown.cpp
rename to clang-tools-extra/clangd/support/Shutdown.cpp
index 36d977570a4f..7ce01ee171e8 100644
--- a/clang-tools-extra/clangd/Shutdown.cpp
+++ b/clang-tools-extra/clangd/support/Shutdown.cpp
@@ -6,7 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "Shutdown.h"
+#include "support/Shutdown.h"
 
 #include <atomic>
 #include <cstdlib>
@@ -31,10 +31,7 @@ void requestShutdown() {
     std::abort();
 }
 
-bool shutdownRequested() {
-  return ShutdownRequested;
-}
+bool shutdownRequested() { return ShutdownRequested; }
 
 } // namespace clangd
 } // namespace clang
-

diff  --git a/clang-tools-extra/clangd/Shutdown.h b/clang-tools-extra/clangd/support/Shutdown.h
similarity index 96%
rename from clang-tools-extra/clangd/Shutdown.h
rename to clang-tools-extra/clangd/support/Shutdown.h
index 94ada3171f31..896e1521fe6a 100644
--- a/clang-tools-extra/clangd/Shutdown.h
+++ b/clang-tools-extra/clangd/support/Shutdown.h
@@ -40,8 +40,8 @@
 //    returns an error, etc.
 //
 //===----------------------------------------------------------------------===//
-#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_SHUTDOWN_H
-#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_SHUTDOWN_H
+#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_SUPPORT_SHUTDOWN_H
+#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_SUPPORT_SHUTDOWN_H
 
 #include <cerrno>
 #include <chrono>

diff  --git a/clang-tools-extra/clangd/Threading.cpp b/clang-tools-extra/clangd/support/Threading.cpp
similarity index 93%
rename from clang-tools-extra/clangd/Threading.cpp
rename to clang-tools-extra/clangd/support/Threading.cpp
index a651b70f02a6..5f95888ae3e2 100644
--- a/clang-tools-extra/clangd/Threading.cpp
+++ b/clang-tools-extra/clangd/support/Threading.cpp
@@ -1,6 +1,5 @@
-#include "Threading.h"
-#include "Trace.h"
-#include "clang/Basic/Stack.h"
+#include "support/Threading.h"
+#include "support/Trace.h"
 #include "llvm/ADT/ScopeExit.h"
 #include "llvm/Support/FormatVariadic.h"
 #include "llvm/Support/Threading.h"
@@ -10,7 +9,7 @@
 #include <pthread.h>
 #elif defined(__APPLE__)
 #include <sys/resource.h>
-#elif defined (_WIN32)
+#elif defined(_WIN32)
 #include <windows.h>
 #endif
 
@@ -96,7 +95,8 @@ void AsyncTaskRunner::runAsync(const llvm::Twine &Name,
   };
 
   // Ensure our worker threads have big enough stacks to run clang.
-  llvm::llvm_execute_on_thread_async(std::move(Task), clang::DesiredStackSize);
+  llvm::llvm_execute_on_thread_async(std::move(Task),
+                                     /*clang::DesiredStackSize*/ 8 << 20);
 }
 
 Deadline timeoutSeconds(llvm::Optional<double> Seconds) {

diff  --git a/clang-tools-extra/clangd/Threading.h b/clang-tools-extra/clangd/support/Threading.h
similarity index 96%
rename from clang-tools-extra/clangd/Threading.h
rename to clang-tools-extra/clangd/support/Threading.h
index 878069f3b9ee..310dd7bc5a24 100644
--- a/clang-tools-extra/clangd/Threading.h
+++ b/clang-tools-extra/clangd/support/Threading.h
@@ -6,10 +6,10 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_THREADING_H
-#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_THREADING_H
+#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_SUPPORT_THREADING_H
+#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_SUPPORT_THREADING_H
 
-#include "Context.h"
+#include "support/Context.h"
 #include "llvm/ADT/FunctionExtras.h"
 #include "llvm/ADT/Twine.h"
 #include <cassert>

diff  --git a/clang-tools-extra/clangd/Trace.cpp b/clang-tools-extra/clangd/support/Trace.cpp
similarity index 98%
rename from clang-tools-extra/clangd/Trace.cpp
rename to clang-tools-extra/clangd/support/Trace.cpp
index 5bcbf221c435..b880a5b3411d 100644
--- a/clang-tools-extra/clangd/Trace.cpp
+++ b/clang-tools-extra/clangd/support/Trace.cpp
@@ -6,8 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "Trace.h"
-#include "Context.h"
+#include "support/Trace.h"
+#include "support/Context.h"
 #include "llvm/ADT/DenseSet.h"
 #include "llvm/ADT/ScopeExit.h"
 #include "llvm/Support/Chrono.h"
@@ -149,10 +149,10 @@ class JSONTracer : public EventTracer {
   void rawEvent(llvm::StringRef Phase,
                 const llvm::json::Object &Event) /*REQUIRES(Mu)*/ {
     // PID 0 represents the clangd process.
-    Out.object([&]{
+    Out.object([&] {
       Out.attribute("pid", 0);
       Out.attribute("ph", Phase);
-      for (const auto& KV : Event)
+      for (const auto &KV : Event)
         Out.attribute(KV.first, KV.second);
     });
   }

diff  --git a/clang-tools-extra/clangd/Trace.h b/clang-tools-extra/clangd/support/Trace.h
similarity index 96%
rename from clang-tools-extra/clangd/Trace.h
rename to clang-tools-extra/clangd/support/Trace.h
index 55dc0ef0580c..e2c91eb4f100 100644
--- a/clang-tools-extra/clangd/Trace.h
+++ b/clang-tools-extra/clangd/support/Trace.h
@@ -14,10 +14,10 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_TRACE_H_
-#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_TRACE_H_
+#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_SUPPORT_TRACE_H_
+#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_SUPPORT_TRACE_H_
 
-#include "Context.h"
+#include "support/Context.h"
 #include "llvm/ADT/Twine.h"
 #include "llvm/Support/JSON.h"
 #include "llvm/Support/raw_ostream.h"
@@ -104,4 +104,4 @@ class Span {
 } // namespace clangd
 } // namespace clang
 
-#endif // LLVM_CLANG_TOOLS_EXTRA_CLANGD_TRACE_H_
+#endif

diff  --git a/clang-tools-extra/clangd/tool/ClangdMain.cpp b/clang-tools-extra/clangd/tool/ClangdMain.cpp
index 92e46a662953..575722e232c9 100644
--- a/clang-tools-extra/clangd/tool/ClangdMain.cpp
+++ b/clang-tools-extra/clangd/tool/ClangdMain.cpp
@@ -9,15 +9,15 @@
 #include "ClangdLSPServer.h"
 #include "CodeComplete.h"
 #include "Features.inc"
-#include "Path.h"
 #include "PathMapping.h"
 #include "Protocol.h"
-#include "Shutdown.h"
-#include "Trace.h"
 #include "Transport.h"
 #include "index/Background.h"
 #include "index/Serialization.h"
 #include "refactor/Rename.h"
+#include "support/Path.h"
+#include "support/Shutdown.h"
+#include "support/Trace.h"
 #include "clang/Basic/Version.h"
 #include "clang/Format/Format.h"
 #include "llvm/ADT/Optional.h"

diff  --git a/clang-tools-extra/clangd/unittests/CMakeLists.txt b/clang-tools-extra/clangd/unittests/CMakeLists.txt
index 4119445b85a0..962a8785ce8d 100644
--- a/clang-tools-extra/clangd/unittests/CMakeLists.txt
+++ b/clang-tools-extra/clangd/unittests/CMakeLists.txt
@@ -27,7 +27,6 @@ add_unittest(ClangdUnitTests ClangdTests
   Annotations.cpp
   ASTTests.cpp
   BackgroundIndexTests.cpp
-  CancellationTests.cpp
   CanonicalIncludesTests.cpp
   ClangdTests.cpp
   ClangdLSPServerTests.cpp
@@ -35,7 +34,6 @@ add_unittest(ClangdUnitTests ClangdTests
   CodeCompletionStringsTests.cpp
   CollectMacrosTests.cpp
   CompileCommandsTests.cpp
-  ContextTests.cpp
   DexTests.cpp
   DiagnosticsTests.cpp
   DraftStoreTests.cpp
@@ -47,7 +45,6 @@ add_unittest(ClangdUnitTests ClangdTests
   FormattedStringTests.cpp
   FormatTests.cpp
   FSTests.cpp
-  FunctionTests.cpp
   FuzzyMatchTests.cpp
   GlobalCompilationDatabaseTests.cpp
   HeadersTests.cpp
@@ -76,14 +73,18 @@ add_unittest(ClangdUnitTests ClangdTests
   TestFS.cpp
   TestIndex.cpp
   TestTU.cpp
-  ThreadingTests.cpp
-  TraceTests.cpp
   TypeHierarchyTests.cpp
   TweakTests.cpp
   TweakTesting.cpp
   URITests.cpp
   XRefsTests.cpp
 
+  support/CancellationTests.cpp
+  support/ContextTests.cpp
+  support/FunctionTests.cpp
+  support/ThreadingTests.cpp
+  support/TraceTests.cpp
+
   $<TARGET_OBJECTS:obj.clangDaemonTweaks>
   )
 
@@ -107,6 +108,7 @@ clang_target_link_libraries(ClangdTests
 target_link_libraries(ClangdTests
   PRIVATE
   clangDaemon
+  clangdSupport
   clangTidy
   LLVMSupport
   LLVMTestingSupport

diff  --git a/clang-tools-extra/clangd/unittests/ClangdLSPServerTests.cpp b/clang-tools-extra/clangd/unittests/ClangdLSPServerTests.cpp
index 5f169fefd3bd..aa65a2eb521d 100644
--- a/clang-tools-extra/clangd/unittests/ClangdLSPServerTests.cpp
+++ b/clang-tools-extra/clangd/unittests/ClangdLSPServerTests.cpp
@@ -10,10 +10,10 @@
 #include "ClangdLSPServer.h"
 #include "CodeComplete.h"
 #include "LSPClient.h"
-#include "Logger.h"
 #include "Protocol.h"
 #include "TestFS.h"
 #include "refactor/Rename.h"
+#include "support/Logger.h"
 #include "llvm/Support/JSON.h"
 #include "llvm/Testing/Support/SupportHelpers.h"
 #include "gmock/gmock.h"

diff  --git a/clang-tools-extra/clangd/unittests/ClangdTests.cpp b/clang-tools-extra/clangd/unittests/ClangdTests.cpp
index 8bb4cad52dba..81075ff1bbe7 100644
--- a/clang-tools-extra/clangd/unittests/ClangdTests.cpp
+++ b/clang-tools-extra/clangd/unittests/ClangdTests.cpp
@@ -14,8 +14,8 @@
 #include "Matchers.h"
 #include "SyncAPI.h"
 #include "TestFS.h"
-#include "Threading.h"
 #include "URI.h"
+#include "support/Threading.h"
 #include "clang/Config/config.h"
 #include "clang/Sema/CodeCompleteConsumer.h"
 #include "llvm/ADT/SmallVector.h"

diff  --git a/clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp b/clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
index 47637024ab91..d8926d4fd3f5 100644
--- a/clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
+++ b/clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
@@ -18,9 +18,9 @@
 #include "TestFS.h"
 #include "TestIndex.h"
 #include "TestTU.h"
-#include "Threading.h"
 #include "index/Index.h"
 #include "index/MemIndex.h"
+#include "support/Threading.h"
 #include "clang/Sema/CodeCompleteConsumer.h"
 #include "clang/Tooling/CompilationDatabase.h"
 #include "llvm/Support/Error.h"

diff  --git a/clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp b/clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp
index 7f4cff147535..90d3621286db 100644
--- a/clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp
+++ b/clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp
@@ -9,13 +9,13 @@
 #include "Annotations.h"
 #include "Diagnostics.h"
 #include "ParsedAST.h"
-#include "Path.h"
 #include "Protocol.h"
 #include "SourceCode.h"
 #include "TestFS.h"
 #include "TestIndex.h"
 #include "TestTU.h"
 #include "index/MemIndex.h"
+#include "support/Path.h"
 #include "clang/Basic/Diagnostic.h"
 #include "clang/Basic/DiagnosticSema.h"
 #include "llvm/Support/ScopedPrinter.h"

diff  --git a/clang-tools-extra/clangd/unittests/GlobalCompilationDatabaseTests.cpp b/clang-tools-extra/clangd/unittests/GlobalCompilationDatabaseTests.cpp
index aaae58bacd8e..e68b8d727172 100644
--- a/clang-tools-extra/clangd/unittests/GlobalCompilationDatabaseTests.cpp
+++ b/clang-tools-extra/clangd/unittests/GlobalCompilationDatabaseTests.cpp
@@ -9,8 +9,8 @@
 #include "GlobalCompilationDatabase.h"
 
 #include "Matchers.h"
-#include "Path.h"
 #include "TestFS.h"
+#include "support/Path.h"
 #include "clang/Tooling/CompilationDatabase.h"
 #include "llvm/ADT/Optional.h"
 #include "llvm/ADT/SmallString.h"

diff  --git a/clang-tools-extra/clangd/unittests/JSONTransportTests.cpp b/clang-tools-extra/clangd/unittests/JSONTransportTests.cpp
index 2a167bd8fb3c..07ab70edbe3f 100644
--- a/clang-tools-extra/clangd/unittests/JSONTransportTests.cpp
+++ b/clang-tools-extra/clangd/unittests/JSONTransportTests.cpp
@@ -5,9 +5,9 @@
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
-#include "Cancellation.h"
 #include "Protocol.h"
 #include "Transport.h"
+#include "support/Cancellation.h"
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
 #include <cstdio>

diff  --git a/clang-tools-extra/clangd/unittests/LSPClient.cpp b/clang-tools-extra/clangd/unittests/LSPClient.cpp
index 5e43314d1fe5..08bbba2c3e41 100644
--- a/clang-tools-extra/clangd/unittests/LSPClient.cpp
+++ b/clang-tools-extra/clangd/unittests/LSPClient.cpp
@@ -4,8 +4,8 @@
 
 #include "Protocol.h"
 #include "TestFS.h"
-#include "Threading.h"
 #include "Transport.h"
+#include "support/Threading.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/raw_ostream.h"
 #include <queue>

diff  --git a/clang-tools-extra/clangd/unittests/SourceCodeTests.cpp b/clang-tools-extra/clangd/unittests/SourceCodeTests.cpp
index 71721fe81cd9..0521327b623b 100644
--- a/clang-tools-extra/clangd/unittests/SourceCodeTests.cpp
+++ b/clang-tools-extra/clangd/unittests/SourceCodeTests.cpp
@@ -6,10 +6,10 @@
 //
 //===----------------------------------------------------------------------===//
 #include "Annotations.h"
-#include "Context.h"
 #include "Protocol.h"
 #include "SourceCode.h"
 #include "TestTU.h"
+#include "support/Context.h"
 #include "clang/Basic/LangOptions.h"
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Basic/TokenKinds.h"

diff  --git a/clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp b/clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp
index 6f50a5acd4e3..1ed73ed46e22 100644
--- a/clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp
+++ b/clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp
@@ -7,17 +7,17 @@
 //===----------------------------------------------------------------------===//
 
 #include "Annotations.h"
-#include "Cancellation.h"
 #include "ClangdServer.h"
-#include "Context.h"
 #include "Diagnostics.h"
 #include "Matchers.h"
 #include "ParsedAST.h"
-#include "Path.h"
 #include "Preamble.h"
 #include "TUScheduler.h"
 #include "TestFS.h"
-#include "Threading.h"
+#include "support/Cancellation.h"
+#include "support/Context.h"
+#include "support/Path.h"
+#include "support/Threading.h"
 #include "clang/Basic/DiagnosticDriver.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/STLExtras.h"

diff  --git a/clang-tools-extra/clangd/unittests/TestFS.cpp b/clang-tools-extra/clangd/unittests/TestFS.cpp
index aad08f2b61fd..c436e9a7a951 100644
--- a/clang-tools-extra/clangd/unittests/TestFS.cpp
+++ b/clang-tools-extra/clangd/unittests/TestFS.cpp
@@ -7,8 +7,8 @@
 //===----------------------------------------------------------------------===//
 #include "TestFS.h"
 #include "GlobalCompilationDatabase.h"
-#include "Path.h"
 #include "URI.h"
+#include "support/Path.h"
 #include "llvm/ADT/None.h"
 #include "llvm/ADT/Optional.h"
 #include "llvm/ADT/StringRef.h"

diff  --git a/clang-tools-extra/clangd/unittests/TestFS.h b/clang-tools-extra/clangd/unittests/TestFS.h
index a635d7c53a07..7dde78d9c157 100644
--- a/clang-tools-extra/clangd/unittests/TestFS.h
+++ b/clang-tools-extra/clangd/unittests/TestFS.h
@@ -13,7 +13,7 @@
 #define LLVM_CLANG_TOOLS_EXTRA_UNITTESTS_CLANGD_TESTFS_H
 #include "ClangdServer.h"
 #include "GlobalCompilationDatabase.h"
-#include "Path.h"
+#include "support/Path.h"
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/VirtualFileSystem.h"

diff  --git a/clang-tools-extra/clangd/unittests/TestTU.h b/clang-tools-extra/clangd/unittests/TestTU.h
index 229f65a4b95c..415326e7d281 100644
--- a/clang-tools-extra/clangd/unittests/TestTU.h
+++ b/clang-tools-extra/clangd/unittests/TestTU.h
@@ -19,8 +19,8 @@
 
 #include "Compiler.h"
 #include "ParsedAST.h"
-#include "Path.h"
 #include "index/Index.h"
+#include "support/Path.h"
 #include "llvm/ADT/StringMap.h"
 #include "gtest/gtest.h"
 #include <string>

diff  --git a/clang-tools-extra/clangd/unittests/CancellationTests.cpp b/clang-tools-extra/clangd/unittests/support/CancellationTests.cpp
similarity index 96%
rename from clang-tools-extra/clangd/unittests/CancellationTests.cpp
rename to clang-tools-extra/clangd/unittests/support/CancellationTests.cpp
index 09f980748f91..905ee5ecc9c0 100644
--- a/clang-tools-extra/clangd/unittests/CancellationTests.cpp
+++ b/clang-tools-extra/clangd/unittests/support/CancellationTests.cpp
@@ -1,6 +1,6 @@
-#include "Cancellation.h"
-#include "Context.h"
-#include "Threading.h"
+#include "support/Cancellation.h"
+#include "support/Context.h"
+#include "support/Threading.h"
 #include "llvm/Support/Error.h"
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"

diff  --git a/clang-tools-extra/clangd/unittests/ContextTests.cpp b/clang-tools-extra/clangd/unittests/support/ContextTests.cpp
similarity index 98%
rename from clang-tools-extra/clangd/unittests/ContextTests.cpp
rename to clang-tools-extra/clangd/unittests/support/ContextTests.cpp
index c76d565b2a2c..2f195fd1c5d3 100644
--- a/clang-tools-extra/clangd/unittests/ContextTests.cpp
+++ b/clang-tools-extra/clangd/unittests/support/ContextTests.cpp
@@ -6,7 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "Context.h"
+#include "support/Context.h"
 
 #include "gtest/gtest.h"
 

diff  --git a/clang-tools-extra/clangd/unittests/FunctionTests.cpp b/clang-tools-extra/clangd/unittests/support/FunctionTests.cpp
similarity index 97%
rename from clang-tools-extra/clangd/unittests/FunctionTests.cpp
rename to clang-tools-extra/clangd/unittests/support/FunctionTests.cpp
index 0cd8b7910463..bfb1ea49434d 100644
--- a/clang-tools-extra/clangd/unittests/FunctionTests.cpp
+++ b/clang-tools-extra/clangd/unittests/support/FunctionTests.cpp
@@ -6,7 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "Function.h"
+#include "support/Function.h"
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
 

diff  --git a/clang-tools-extra/clangd/unittests/ThreadingTests.cpp b/clang-tools-extra/clangd/unittests/support/ThreadingTests.cpp
similarity index 98%
rename from clang-tools-extra/clangd/unittests/ThreadingTests.cpp
rename to clang-tools-extra/clangd/unittests/support/ThreadingTests.cpp
index 18b9146ef142..015af092012a 100644
--- a/clang-tools-extra/clangd/unittests/ThreadingTests.cpp
+++ b/clang-tools-extra/clangd/unittests/support/ThreadingTests.cpp
@@ -6,7 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "Threading.h"
+#include "support/Threading.h"
 #include "gtest/gtest.h"
 #include <mutex>
 

diff  --git a/clang-tools-extra/clangd/unittests/TraceTests.cpp b/clang-tools-extra/clangd/unittests/support/TraceTests.cpp
similarity index 99%
rename from clang-tools-extra/clangd/unittests/TraceTests.cpp
rename to clang-tools-extra/clangd/unittests/support/TraceTests.cpp
index 1871e6acf10c..1599df55fb91 100644
--- a/clang-tools-extra/clangd/unittests/TraceTests.cpp
+++ b/clang-tools-extra/clangd/unittests/support/TraceTests.cpp
@@ -6,7 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "Trace.h"
+#include "support/Trace.h"
 
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/SmallString.h"

diff  --git a/clang-tools-extra/clangd/xpc/CMakeLists.txt b/clang-tools-extra/clangd/xpc/CMakeLists.txt
index f05767c86b21..df8c361817a8 100644
--- a/clang-tools-extra/clangd/xpc/CMakeLists.txt
+++ b/clang-tools-extra/clangd/xpc/CMakeLists.txt
@@ -20,10 +20,10 @@ set(LLVM_OPTIONAL_SOURCES Conversion.cpp XPCTransport.cpp)
 
 add_clang_library(clangdXpcJsonConversions
   Conversion.cpp
-  LINK_LIBS clangDaemon
+  LINK_LIBS clangDaemon clangdSupport
   )
 
 add_clang_library(clangdXpcTransport
   XPCTransport.cpp
-  LINK_LIBS clangDaemon clangdXpcJsonConversions
+  LINK_LIBS clangDaemon clangdSupport clangdXpcJsonConversions
   )

diff  --git a/clang-tools-extra/clangd/xpc/Conversion.cpp b/clang-tools-extra/clangd/xpc/Conversion.cpp
index 3e8d36b7b430..9b52a68e64fb 100644
--- a/clang-tools-extra/clangd/xpc/Conversion.cpp
+++ b/clang-tools-extra/clangd/xpc/Conversion.cpp
@@ -7,7 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "xpc/Conversion.h"
-#include "Logger.h"
+#include "support/Logger.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/ScopedPrinter.h"
 #include <string>

diff  --git a/clang-tools-extra/clangd/xpc/XPCTransport.cpp b/clang-tools-extra/clangd/xpc/XPCTransport.cpp
index 02c1b083701e..50eacf2115ee 100644
--- a/clang-tools-extra/clangd/xpc/XPCTransport.cpp
+++ b/clang-tools-extra/clangd/xpc/XPCTransport.cpp
@@ -6,9 +6,9 @@
 //
 //===----------------------------------------------------------------------===//
 #include "Conversion.h"
-#include "Logger.h"
 #include "Protocol.h" // For LSPError
 #include "Transport.h"
+#include "support/Logger.h"
 #include "llvm/Support/Errno.h"
 
 #include <xpc/xpc.h>


        


More information about the cfe-commits mailing list