Fix windows build after r369894

Constructing a std::vector from a llvm::map_range fails on windows,
apparently because std::vector expects the input iterator to have a
const operator* (map_range iterator has a non-const one).

This avoids the cleverness and unrolls the map-loop manually (which is
also slightly shorter).

llvm-svn: 369905
This commit is contained in:
Pavel Labath 2019-08-26 12:42:32 +00:00
parent 27f56c1200
commit f899bf135f
1 changed files with 4 additions and 6 deletions

View File

@ -108,12 +108,10 @@ ParseFPOAndStringify(llvm::StringRef prog) {
llvm::BumpPtrAllocator alloc;
std::vector<std::pair<llvm::StringRef, Node *>> parsed =
ParseFPOProgram(prog, alloc);
auto range = llvm::map_range(
parsed, [](const std::pair<llvm::StringRef, Node *> &pair) {
return std::make_pair(pair.first, ASTPrinter::Print(pair.second));
});
return std::vector<std::pair<std::string, std::string>>(range.begin(),
range.end());
std::vector<std::pair<std::string, std::string>> result;
for (const auto &p : parsed)
result.emplace_back(p.first, ASTPrinter::Print(p.second));
return result;
}
TEST(PostfixExpression, ParseFPOProgram) {