From a303c417bbdb53703c2c17398b08486bde78f1f6 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Tue, 2 May 2017 18:30:13 +0000 Subject: Vendor import of llvm trunk r301939: https://llvm.org/svn/llvm-project/llvm/trunk@301939 --- unittests/Support/BinaryStreamTest.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'unittests/Support/BinaryStreamTest.cpp') diff --git a/unittests/Support/BinaryStreamTest.cpp b/unittests/Support/BinaryStreamTest.cpp index 1e646a6cf900..74c51e382d99 100644 --- a/unittests/Support/BinaryStreamTest.cpp +++ b/unittests/Support/BinaryStreamTest.cpp @@ -358,12 +358,14 @@ TEST_F(BinaryStreamTest, VarStreamArray) { struct StringExtractor { public: - Error operator()(BinaryStreamRef Stream, uint32_t &Len, StringRef &Item) { - if (Index == 0) + typedef uint32_t ContextType; + static Error extract(BinaryStreamRef Stream, uint32_t &Len, StringRef &Item, + uint32_t *Index) { + if (*Index == 0) Len = strlen("1. Test"); - else if (Index == 1) + else if (*Index == 1) Len = strlen("2. Longer Test"); - else if (Index == 2) + else if (*Index == 2) Len = strlen("3. Really Long Test"); else Len = strlen("4. Super Extra Longest Test Of All"); @@ -372,16 +374,14 @@ TEST_F(BinaryStreamTest, VarStreamArray) { return EC; Item = StringRef(reinterpret_cast(Bytes.data()), Bytes.size()); - ++Index; + ++(*Index); return Error::success(); } - - private: - uint32_t Index = 0; }; for (auto &Stream : Streams) { - VarStreamArray Array(*Stream.Input); + uint32_t Context = 0; + VarStreamArray Array(*Stream.Input, &Context); auto Iter = Array.begin(); ASSERT_EQ("1. Test", *Iter++); ASSERT_EQ("2. Longer Test", *Iter++); -- cgit v1.2.3