peek should set eofbit if sgetc() returns eof.

llvm-svn: 167238
diff --git a/libcxx/include/istream b/libcxx/include/istream
index 72b2004..7b48186 100644
--- a/libcxx/include/istream
+++ b/libcxx/include/istream
@@ -1189,7 +1189,11 @@
 #endif  // _LIBCPP_NO_EXCEPTIONS
         sentry __sen(*this, true);
         if (__sen)
+        {
             __r = this->rdbuf()->sgetc();
+            if (traits_type::eq_int_type(__r, traits_type::eof()))
+                this->setstate(ios_base::eofbit);
+        }
 #ifndef _LIBCPP_NO_EXCEPTIONS
     }
     catch (...)