Skip to content

Commit 2cd0be0

Browse files
committed
[clangd] Fix MSVC compile error, attempt 2
1 parent 6d53897 commit 2cd0be0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,13 @@ FileShardedIndex::FileShardedIndex(IndexFileIn Input, PathRef HintPath)
190190
}
191191
}
192192
std::vector<PathRef> FileShardedIndex::getAllFiles() const {
193-
return std::vector<PathRef>(Shards.keys().begin(), Shards.keys().end());
193+
// It should be enough to construct a vector with {Shards.keys().begin(),
194+
// Shards.keys().end()} but MSVC fails to compile that.
195+
std::vector<PathRef> Result;
196+
Result.reserve(Shards.size());
197+
for (PathRef Key : Shards.keys())
198+
Result.push_back(Key);
199+
return Result;
194200
}
195201

196202
IndexFileIn FileShardedIndex::getShard(PathRef File) const {

0 commit comments

Comments
 (0)