Index: include/llvm/Support/JSON.h =================================================================== --- include/llvm/Support/JSON.h +++ include/llvm/Support/JSON.h @@ -294,9 +294,13 @@ Value(json::Array &&Elements) : Type(T_Array) { create(std::move(Elements)); } + template + Value(const std::vector &C) : Value(json::Array(C)) {} Value(json::Object &&Properties) : Type(T_Object) { create(std::move(Properties)); } + template + Value(const std::map &C) : Value(json::Object(C)) {} // Strings: types with value semantics. Must be valid UTF-8. Value(std::string V) : Type(T_String) { if (LLVM_UNLIKELY(!isUTF8(V))) { Index: unittests/Support/JSONTest.cpp =================================================================== --- unittests/Support/JSONTest.cpp +++ unittests/Support/JSONTest.cpp @@ -47,6 +47,8 @@ s(Object{{"A", Object{{"B", Object{{"X", "Y"}}}}}})); EXPECT_EQ("null", s(llvm::Optional())); EXPECT_EQ("2.5", s(llvm::Optional(2.5))); + EXPECT_EQ("[[2.5,null]]", s(std::vector>>{ + {2.5, llvm::None}})); } TEST(JSONTest, StringOwnership) {