diff options
author | Adam Nemet <anemet@apple.com> | 2017-05-15 18:14:35 +0000 |
---|---|---|
committer | Adam Nemet <anemet@apple.com> | 2017-05-15 18:14:35 +0000 |
commit | 076047b4d9997f47a76cd127e0382071d30936c2 (patch) | |
tree | 64ee87e7b3f60cfe93bb12acb5bee2252d7a0af8 /clang-tools-extra/clangd/DraftStore.h | |
parent | 6cd179893dcd77e2cba96486fe4baba8f3dccfaf (diff) | |
download | bcm5719-llvm-076047b4d9997f47a76cd127e0382071d30936c2.tar.gz bcm5719-llvm-076047b4d9997f47a76cd127e0382071d30936c2.zip |
Revert "[ClangD] Refactor clangd into separate components"
This reverts commit r303067.
Caused http://green.lab.llvm.org/green/job/clang-stage1-configure-RA/34305/
And even after Simon's fix there is still a test failure.
llvm-svn: 303094
Diffstat (limited to 'clang-tools-extra/clangd/DraftStore.h')
-rw-r--r-- | clang-tools-extra/clangd/DraftStore.h | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/clang-tools-extra/clangd/DraftStore.h b/clang-tools-extra/clangd/DraftStore.h deleted file mode 100644 index c4e31e7c813..00000000000 --- a/clang-tools-extra/clangd/DraftStore.h +++ /dev/null @@ -1,61 +0,0 @@ -//===--- DraftStore.h - File contents container -----------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_DRAFTSTORE_H -#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_DRAFTSTORE_H - -#include "Path.h" -#include "clang/Basic/LLVM.h" -#include "llvm/ADT/StringMap.h" -#include <mutex> -#include <string> -#include <vector> - -namespace clang { -namespace clangd { - -/// Using 'unsigned' here to avoid undefined behaviour on overflow. -typedef unsigned DocVersion; - -/// Document draft with a version of this draft. -struct VersionedDraft { - DocVersion Version; - /// If the value of the field is None, draft is now deleted - llvm::Optional<std::string> Draft; -}; - -/// A thread-safe container for files opened in a workspace, addressed by -/// filenames. The contents are owned by the DraftStore. Versions are mantained -/// for the all added documents, including removed ones. The document version is -/// incremented on each update and removal of the document. -class DraftStore { -public: - /// \return version and contents of the stored document. - /// For untracked files, a (0, None) pair is returned. - VersionedDraft getDraft(PathRef File) const; - /// \return version of the tracked document. - /// For untracked files, 0 is returned. - DocVersion getVersion(PathRef File) const; - - /// Replace contents of the draft for \p File with \p Contents. - /// \return The new version of the draft for \p File. - DocVersion updateDraft(PathRef File, StringRef Contents); - /// Remove the contents of the draft - /// \return The new version of the draft for \p File. - DocVersion removeDraft(PathRef File); - -private: - mutable std::mutex Mutex; - llvm::StringMap<VersionedDraft> Drafts; -}; - -} // namespace clangd -} // namespace clang - -#endif |