[clang-tools-extra] 574663f - [clangd][NFC] Silence some buildbot warnings after 0250b053

Nathan James via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 9 06:56:11 PST 2021


Author: Nathan James
Date: 2021-03-09T14:55:55Z
New Revision: 574663f9d522420be7a67d9c55728af8330e1dd3

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

LOG: [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 {
         |          ^~~~~

Added: 
    

Modified: 
    clang-tools-extra/clangd/DraftStore.cpp
    clang-tools-extra/clangd/DraftStore.h

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clangd/DraftStore.cpp b/clang-tools-extra/clangd/DraftStore.cpp
index b640f88f5773..e040d1ee93d6 100644
--- a/clang-tools-extra/clangd/DraftStore.cpp
+++ b/clang-tools-extra/clangd/DraftStore.cpp
@@ -24,7 +24,7 @@ llvm::Optional<DraftStore::Draft> DraftStore::getDraft(PathRef File) const {
   if (It == Drafts.end())
     return None;
 
-  return It->second.Draft;
+  return It->second.D;
 }
 
 std::vector<Path> DraftStore::getActiveFiles() const {
@@ -78,10 +78,10 @@ std::string DraftStore::addDraft(PathRef File, llvm::StringRef Version,
   std::lock_guard<std::mutex> Lock(Mutex);
 
   auto &D = Drafts[File];
-  updateVersion(D.Draft, Version);
+  updateVersion(D.D, Version);
   std::time(&D.MTime);
-  D.Draft.Contents = std::make_shared<std::string>(Contents);
-  return D.Draft.Version;
+  D.D.Contents = std::make_shared<std::string>(Contents);
+  return D.D.Version;
 }
 
 void DraftStore::removeDraft(PathRef File) {
@@ -121,7 +121,7 @@ llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> DraftStore::asVFS() const {
   for (const auto &Draft : Drafts)
     MemFS->addFile(Draft.getKey(), Draft.getValue().MTime,
                    std::make_unique<SharedStringBuffer>(
-                       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 ff3056e41c29..6b50b23995a0 100644
--- a/clang-tools-extra/clangd/DraftStore.h
+++ b/clang-tools-extra/clangd/DraftStore.h
@@ -52,7 +52,7 @@ class DraftStore {
 
 private:
   struct DraftAndTime {
-    Draft Draft;
+    Draft D;
     std::time_t MTime;
   };
   mutable std::mutex Mutex;


        


More information about the cfe-commits mailing list