[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 {
         |          ^~~~~
This commit is contained in:
Nathan James 2021-03-09 14:55:55 +00:00
parent 0250b053b5
commit 574663f9d5
No known key found for this signature in database
GPG Key ID: CC007AFCDA90AA5F
2 changed files with 6 additions and 6 deletions

View File

@ -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

View File

@ -52,7 +52,7 @@ public:
private:
struct DraftAndTime {
Draft Draft;
Draft D;
std::time_t MTime;
};
mutable std::mutex Mutex;