diff --git a/clang-tools-extra/clangd/CMakeLists.txt b/clang-tools-extra/clangd/CMakeLists.txt --- 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 @@ 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 @@ CollectMacros.cpp CompileCommands.cpp Compiler.cpp - Context.cpp Diagnostics.cpp DraftStore.cpp ExpectedTypes.cpp @@ -54,7 +44,6 @@ FileDistance.cpp Format.cpp FS.cpp - FSProvider.cpp FormattedString.cpp FuzzyMatch.cpp GlobalCompilationDatabase.cpp @@ -63,7 +52,6 @@ Hover.cpp IncludeFixer.cpp JSONTransport.cpp - Logger.cpp PathMapping.cpp Protocol.cpp Quality.cpp @@ -73,11 +61,8 @@ 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 @@ clangToolingInclusions clangToolingRefactoring clangToolingSyntax - ${LLVM_PTHREAD_LIB} - ${CLANGD_ATOMIC_LIB} + clangdSupport ${ALL_CLANG_TIDY_CHECKS} ) diff --git a/clang-tools-extra/clangd/ClangdLSPServer.h b/clang-tools-extra/clangd/ClangdLSPServer.h --- 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/ClangdLSPServer.cpp b/clang-tools-extra/clangd/ClangdLSPServer.cpp --- 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/ClangdServer.h b/clang-tools-extra/clangd/ClangdServer.h --- 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/ClangdServer.cpp b/clang-tools-extra/clangd/ClangdServer.cpp --- 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/CodeComplete.h b/clang-tools-extra/clangd/CodeComplete.h --- 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/CodeComplete.cpp b/clang-tools-extra/clangd/CodeComplete.cpp --- 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/CompileCommands.cpp b/clang-tools-extra/clangd/CompileCommands.cpp --- 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 --- 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.h b/clang-tools-extra/clangd/Diagnostics.h --- 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/Diagnostics.cpp b/clang-tools-extra/clangd/Diagnostics.cpp --- 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/DraftStore.h b/clang-tools-extra/clangd/DraftStore.h --- 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 diff --git a/clang-tools-extra/clangd/DraftStore.cpp b/clang-tools-extra/clangd/DraftStore.cpp --- 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/FS.h b/clang-tools-extra/clangd/FS.h --- 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 --- 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 diff --git a/clang-tools-extra/clangd/FindSymbols.cpp b/clang-tools-extra/clangd/FindSymbols.cpp --- 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 --- 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 --- 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.h b/clang-tools-extra/clangd/GlobalCompilationDatabase.h --- 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/GlobalCompilationDatabase.cpp b/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp --- 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/HeaderSourceSwitch.cpp b/clang-tools-extra/clangd/HeaderSourceSwitch.cpp --- 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.h b/clang-tools-extra/clangd/Headers.h --- 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/Headers.cpp b/clang-tools-extra/clangd/Headers.cpp --- 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/Hover.cpp b/clang-tools-extra/clangd/Hover.cpp --- 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 --- 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 --- 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.h b/clang-tools-extra/clangd/ParsedAST.h --- 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/ParsedAST.cpp b/clang-tools-extra/clangd/ParsedAST.cpp --- 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/Preamble.h b/clang-tools-extra/clangd/Preamble.h --- 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/Preamble.cpp b/clang-tools-extra/clangd/Preamble.cpp --- 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/Protocol.cpp b/clang-tools-extra/clangd/Protocol.cpp --- 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 --- 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 --- 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 --- 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.h b/clang-tools-extra/clangd/SourceCode.h --- 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/SourceCode.cpp b/clang-tools-extra/clangd/SourceCode.cpp --- 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/TUScheduler.h b/clang-tools-extra/clangd/TUScheduler.h --- 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/TUScheduler.cpp b/clang-tools-extra/clangd/TUScheduler.cpp --- 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/XRefs.h b/clang-tools-extra/clangd/XRefs.h --- 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/XRefs.cpp b/clang-tools-extra/clangd/XRefs.cpp --- 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/fuzzer/clangd-fuzzer.cpp b/clang-tools-extra/clangd/fuzzer/clangd-fuzzer.cpp --- 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 #include diff --git a/clang-tools-extra/clangd/index/Background.h b/clang-tools-extra/clangd/index/Background.h --- 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/Background.cpp b/clang-tools-extra/clangd/index/Background.cpp --- 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/BackgroundIndexLoader.h b/clang-tools-extra/clangd/index/BackgroundIndexLoader.h --- 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/BackgroundIndexLoader.cpp b/clang-tools-extra/clangd/index/BackgroundIndexLoader.cpp --- 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/BackgroundIndexStorage.cpp b/clang-tools-extra/clangd/index/BackgroundIndexStorage.cpp --- 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 --- 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 --- 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.h b/clang-tools-extra/clangd/index/FileIndex.h --- 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/FileIndex.cpp b/clang-tools-extra/clangd/index/FileIndex.cpp --- 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/Index.cpp b/clang-tools-extra/clangd/index/Index.cpp --- 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 --- 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 --- 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 --- 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 --- 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 --- 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 --- 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 --- 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 diff --git a/clang-tools-extra/clangd/index/remote/CMakeLists.txt b/clang-tools-extra/clangd/index/remote/CMakeLists.txt --- a/clang-tools-extra/clangd/index/remote/CMakeLists.txt +++ b/clang-tools-extra/clangd/index/remote/CMakeLists.txt @@ -18,6 +18,7 @@ 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 --- 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 --- a/clang-tools-extra/clangd/index/remote/marshalling/CMakeLists.txt +++ b/clang-tools-extra/clangd/index/remote/marshalling/CMakeLists.txt @@ -6,4 +6,5 @@ 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 --- 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 --- a/clang-tools-extra/clangd/index/remote/unimplemented/CMakeLists.txt +++ b/clang-tools-extra/clangd/index/remote/unimplemented/CMakeLists.txt @@ -7,4 +7,5 @@ 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 --- 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.h b/clang-tools-extra/clangd/refactor/Rename.h --- 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/Rename.cpp b/clang-tools-extra/clangd/refactor/Rename.cpp --- 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/Tweak.h b/clang-tools-extra/clangd/refactor/Tweak.h --- 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/Tweak.cpp b/clang-tools-extra/clangd/refactor/Tweak.cpp --- 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/tweaks/AddUsing.cpp b/clang-tools-extra/clangd/refactor/tweaks/AddUsing.cpp --- 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 --- a/clang-tools-extra/clangd/refactor/tweaks/CMakeLists.txt +++ b/clang-tools-extra/clangd/refactor/tweaks/CMakeLists.txt @@ -30,6 +30,7 @@ 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 --- 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 --- 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 --- 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 #include #include #include -#include -#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 --- 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 --- 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 --- 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 --- 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 --- 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 --- /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.h b/clang-tools-extra/clangd/support/Cancellation.h rename from clang-tools-extra/clangd/Cancellation.h rename to clang-tools-extra/clangd/support/Cancellation.h --- 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 #include diff --git a/clang-tools-extra/clangd/Cancellation.cpp b/clang-tools-extra/clangd/support/Cancellation.cpp rename from clang-tools-extra/clangd/Cancellation.cpp rename to clang-tools-extra/clangd/support/Cancellation.cpp --- 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 namespace clang { diff --git a/clang-tools-extra/clangd/Context.h b/clang-tools-extra/clangd/support/Context.h rename from clang-tools-extra/clangd/Context.h rename to clang-tools-extra/clangd/support/Context.h --- 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 @@ template Context derive(const Key &Key, typename std::decay::type Value) const & { - return Context(std::make_shared(Data{ - /*Parent=*/DataPtr, &Key, - std::make_unique::type>>( - std::move(Value))})); + return Context(std::make_shared( + Data{/*Parent=*/DataPtr, &Key, + std::make_unique::type>>( + std::move(Value))})); } template Context derive(const Key &Key, typename std::decay::type Value) && /* takes ownership */ { - return Context(std::make_shared(Data{ - /*Parent=*/std::move(DataPtr), &Key, - std::make_unique::type>>( - std::move(Value))})); + return Context(std::make_shared( + Data{/*Parent=*/std::move(DataPtr), &Key, + std::make_unique::type>>( + std::move(Value))})); } /// Derives a child context, using an anonymous key. @@ -219,4 +219,4 @@ } // namespace clangd } // namespace clang -#endif // LLVM_CLANG_TOOLS_EXTRA_CLANGD_CONTEXT_H_ +#endif diff --git a/clang-tools-extra/clangd/Context.cpp b/clang-tools-extra/clangd/support/Context.cpp rename from clang-tools-extra/clangd/Context.cpp rename to clang-tools-extra/clangd/support/Context.cpp --- 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 namespace clang { diff --git a/clang-tools-extra/clangd/FSProvider.h b/clang-tools-extra/clangd/support/FSProvider.h rename from clang-tools-extra/clangd/FSProvider.h rename to clang-tools-extra/clangd/support/FSProvider.h --- 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/FSProvider.cpp b/clang-tools-extra/clangd/support/FSProvider.cpp rename from clang-tools-extra/clangd/FSProvider.cpp rename to clang-tools-extra/clangd/support/FSProvider.cpp --- 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/Function.h b/clang-tools-extra/clangd/support/Function.h rename from clang-tools-extra/clangd/Function.h rename to clang-tools-extra/clangd/support/Function.h --- 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.h b/clang-tools-extra/clangd/support/Logger.h rename from clang-tools-extra/clangd/Logger.h rename to clang-tools-extra/clangd/support/Logger.h --- 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/Logger.cpp b/clang-tools-extra/clangd/support/Logger.cpp rename from clang-tools-extra/clangd/Logger.cpp rename to clang-tools-extra/clangd/support/Logger.cpp --- 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/Path.h b/clang-tools-extra/clangd/support/Path.h rename from clang-tools-extra/clangd/Path.h rename to clang-tools-extra/clangd/support/Path.h --- 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 diff --git a/clang-tools-extra/clangd/Shutdown.h b/clang-tools-extra/clangd/support/Shutdown.h rename from clang-tools-extra/clangd/Shutdown.h rename to clang-tools-extra/clangd/support/Shutdown.h --- 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 #include diff --git a/clang-tools-extra/clangd/Shutdown.cpp b/clang-tools-extra/clangd/support/Shutdown.cpp rename from clang-tools-extra/clangd/Shutdown.cpp rename to clang-tools-extra/clangd/support/Shutdown.cpp --- 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 #include @@ -31,10 +31,7 @@ std::abort(); } -bool shutdownRequested() { - return ShutdownRequested; -} +bool shutdownRequested() { return ShutdownRequested; } } // namespace clangd } // namespace clang - diff --git a/clang-tools-extra/clangd/Threading.h b/clang-tools-extra/clangd/support/Threading.h rename from clang-tools-extra/clangd/Threading.h rename to clang-tools-extra/clangd/support/Threading.h --- 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 diff --git a/clang-tools-extra/clangd/Threading.cpp b/clang-tools-extra/clangd/support/Threading.cpp rename from clang-tools-extra/clangd/Threading.cpp rename to clang-tools-extra/clangd/support/Threading.cpp --- 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 #elif defined(__APPLE__) #include -#elif defined (_WIN32) +#elif defined(_WIN32) #include #endif @@ -96,7 +95,8 @@ }; // 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 Seconds) { diff --git a/clang-tools-extra/clangd/Trace.h b/clang-tools-extra/clangd/support/Trace.h rename from clang-tools-extra/clangd/Trace.h rename to clang-tools-extra/clangd/support/Trace.h --- 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 @@ } // namespace clangd } // namespace clang -#endif // LLVM_CLANG_TOOLS_EXTRA_CLANGD_TRACE_H_ +#endif diff --git a/clang-tools-extra/clangd/Trace.cpp b/clang-tools-extra/clangd/support/Trace.cpp rename from clang-tools-extra/clangd/Trace.cpp rename to clang-tools-extra/clangd/support/Trace.cpp --- 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 @@ 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/tool/ClangdMain.cpp b/clang-tools-extra/clangd/tool/ClangdMain.cpp --- 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 --- a/clang-tools-extra/clangd/unittests/CMakeLists.txt +++ b/clang-tools-extra/clangd/unittests/CMakeLists.txt @@ -27,7 +27,6 @@ Annotations.cpp ASTTests.cpp BackgroundIndexTests.cpp - CancellationTests.cpp CanonicalIncludesTests.cpp ClangdTests.cpp ClangdLSPServerTests.cpp @@ -35,7 +34,6 @@ CodeCompletionStringsTests.cpp CollectMacrosTests.cpp CompileCommandsTests.cpp - ContextTests.cpp DexTests.cpp DiagnosticsTests.cpp DraftStoreTests.cpp @@ -47,7 +45,6 @@ FormattedStringTests.cpp FormatTests.cpp FSTests.cpp - FunctionTests.cpp FuzzyMatchTests.cpp GlobalCompilationDatabaseTests.cpp HeadersTests.cpp @@ -76,14 +73,18 @@ 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 + $ ) @@ -107,6 +108,7 @@ 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 --- 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 --- 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 --- 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 --- 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 --- 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 --- 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 diff --git a/clang-tools-extra/clangd/unittests/LSPClient.cpp b/clang-tools-extra/clangd/unittests/LSPClient.cpp --- 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 diff --git a/clang-tools-extra/clangd/unittests/SourceCodeTests.cpp b/clang-tools-extra/clangd/unittests/SourceCodeTests.cpp --- 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 --- 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.h b/clang-tools-extra/clangd/unittests/TestFS.h --- 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/TestFS.cpp b/clang-tools-extra/clangd/unittests/TestFS.cpp --- 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/TestTU.h b/clang-tools-extra/clangd/unittests/TestTU.h --- 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 diff --git a/clang-tools-extra/clangd/unittests/CancellationTests.cpp b/clang-tools-extra/clangd/unittests/support/CancellationTests.cpp rename from clang-tools-extra/clangd/unittests/CancellationTests.cpp rename to clang-tools-extra/clangd/unittests/support/CancellationTests.cpp --- 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 rename from clang-tools-extra/clangd/unittests/ContextTests.cpp rename to clang-tools-extra/clangd/unittests/support/ContextTests.cpp --- 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 rename from clang-tools-extra/clangd/unittests/FunctionTests.cpp rename to clang-tools-extra/clangd/unittests/support/FunctionTests.cpp --- 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 rename from clang-tools-extra/clangd/unittests/ThreadingTests.cpp rename to clang-tools-extra/clangd/unittests/support/ThreadingTests.cpp --- 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 diff --git a/clang-tools-extra/clangd/unittests/TraceTests.cpp b/clang-tools-extra/clangd/unittests/support/TraceTests.cpp rename from clang-tools-extra/clangd/unittests/TraceTests.cpp rename to clang-tools-extra/clangd/unittests/support/TraceTests.cpp --- 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 --- a/clang-tools-extra/clangd/xpc/CMakeLists.txt +++ b/clang-tools-extra/clangd/xpc/CMakeLists.txt @@ -20,10 +20,10 @@ 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 --- 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 diff --git a/clang-tools-extra/clangd/xpc/XPCTransport.cpp b/clang-tools-extra/clangd/xpc/XPCTransport.cpp --- 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