Author: Kadir Cetinkaya
Date: 2020-04-15T09:33:12+02:00
New Revision: 2cd0be02b9cbe4592dbf1ad3faef13970674b468

URL: 
https://github.com/llvm/llvm-project/commit/2cd0be02b9cbe4592dbf1ad3faef13970674b468
DIFF: 
https://github.com/llvm/llvm-project/commit/2cd0be02b9cbe4592dbf1ad3faef13970674b468.diff

LOG: [clangd] Fix MSVC compile error, attempt 2

Added: 
    

Modified: 
    clang-tools-extra/clangd/index/FileIndex.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clangd/index/FileIndex.cpp 
b/clang-tools-extra/clangd/index/FileIndex.cpp
index 92a11cd06e56..91914be00148 100644
--- a/clang-tools-extra/clangd/index/FileIndex.cpp
+++ b/clang-tools-extra/clangd/index/FileIndex.cpp
@@ -190,7 +190,13 @@ FileShardedIndex::FileShardedIndex(IndexFileIn Input, 
PathRef HintPath)
   }
 }
 std::vector<PathRef> FileShardedIndex::getAllFiles() const {
-  return std::vector<PathRef>(Shards.keys().begin(), Shards.keys().end());
+  // It should be enough to construct a vector with {Shards.keys().begin(),
+  // Shards.keys().end()} but MSVC fails to compile that.
+  std::vector<PathRef> Result;
+  Result.reserve(Shards.size());
+  for (PathRef Key : Shards.keys())
+    Result.push_back(Key);
+  return Result;
 }
 
 IndexFileIn FileShardedIndex::getShard(PathRef File) const {


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to