From: Nathan James Date: Tue, 9 Mar 2021 14:55:55 +0000 (+0000) Subject: [clangd][NFC] Silence some buildbot warnings after 0250b053 X-Git-Tag: llvmorg-14-init~12906 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=574663f9d522420be7a67d9c55728af8330e1dd3;p=platform%2Fupstream%2Fllvm.git [clangd][NFC] Silence some buildbot warnings after 0250b053 https://reviews.llvm.org/D94554 introduced code which wont compile with some build flags due to a field having the same identifier as a type. clang-tools-extra/clangd/DraftStore.h:55:11: error: declaration of ‘clang::clangd::DraftStore::Draft clang::clangd::DraftStore::DraftAndTime::Draft’ changes meaning of ‘Draft’ [-fpermissive] 55 | Draft Draft; | ^~~~~ clang-tools-extra/clangd/DraftStore.h:30:10: note: ‘Draft’ declared here as ‘struct clang::clangd::DraftStore::Draft’ 30 | struct Draft { | ^~~~~ --- diff --git a/clang-tools-extra/clangd/DraftStore.cpp b/clang-tools-extra/clangd/DraftStore.cpp index b640f88..e040d1e 100644 --- a/clang-tools-extra/clangd/DraftStore.cpp +++ b/clang-tools-extra/clangd/DraftStore.cpp @@ -24,7 +24,7 @@ llvm::Optional DraftStore::getDraft(PathRef File) const { if (It == Drafts.end()) return None; - return It->second.Draft; + return It->second.D; } std::vector DraftStore::getActiveFiles() const { @@ -78,10 +78,10 @@ std::string DraftStore::addDraft(PathRef File, llvm::StringRef Version, std::lock_guard Lock(Mutex); auto &D = Drafts[File]; - updateVersion(D.Draft, Version); + updateVersion(D.D, Version); std::time(&D.MTime); - D.Draft.Contents = std::make_shared(Contents); - return D.Draft.Version; + D.D.Contents = std::make_shared(Contents); + return D.D.Version; } void DraftStore::removeDraft(PathRef File) { @@ -121,7 +121,7 @@ llvm::IntrusiveRefCntPtr DraftStore::asVFS() const { for (const auto &Draft : Drafts) MemFS->addFile(Draft.getKey(), Draft.getValue().MTime, std::make_unique( - Draft.getValue().Draft.Contents, Draft.getKey())); + Draft.getValue().D.Contents, Draft.getKey())); return MemFS; } } // namespace clangd diff --git a/clang-tools-extra/clangd/DraftStore.h b/clang-tools-extra/clangd/DraftStore.h index ff3056e..6b50b23 100644 --- a/clang-tools-extra/clangd/DraftStore.h +++ b/clang-tools-extra/clangd/DraftStore.h @@ -52,7 +52,7 @@ public: private: struct DraftAndTime { - Draft Draft; + Draft D; std::time_t MTime; }; mutable std::mutex Mutex;