diff options
author | Louis Dionne <ldionne@apple.com> | 2019-04-02 21:43:07 +0000 |
---|---|---|
committer | Louis Dionne <ldionne@apple.com> | 2019-04-02 21:43:07 +0000 |
commit | 1754774369ac8bd5b0d1e0cc88adc4acba9d2666 (patch) | |
tree | 555261ab4f3e2950e0d184f7204bd61092e0d7fc /libcxx/include/ios | |
parent | fc5a176f6aae00b2848b337addb87c097a093627 (diff) | |
download | bcm5719-llvm-1754774369ac8bd5b0d1e0cc88adc4acba9d2666.tar.gz bcm5719-llvm-1754774369ac8bd5b0d1e0cc88adc4acba9d2666.zip |
[libc++] Fix error flags and exceptions propagated from input stream operations
Summary:
Before this patch, we would only ever throw an exception if the badbit
was set on the stream. The Standard is currently very unclear on how
exceptions should be propagated and what error flags should be set by
the input stream operations. This commit changes libc++ to behave under
a different (but valid) interpretation of the Standard. This interpretation
of the Standard matches what other implementations are doing.
I will submit a paper in San Diego to clarify the Standard such that the
interpretation used in this commit (and other implementations) is the only
possible one.
PR21586
PR15949
rdar://problem/15347558
Reviewers: mclow.lists, EricWF
Subscribers: christof, dexonsmith, cfe-commits
Differential Revision: https://reviews.llvm.org/D49863
llvm-svn: 357531
Diffstat (limited to 'libcxx/include/ios')
-rw-r--r-- | libcxx/include/ios | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libcxx/include/ios b/libcxx/include/ios index 96e84eb3835..ce4e1769f2f 100644 --- a/libcxx/include/ios +++ b/libcxx/include/ios @@ -330,6 +330,15 @@ public: void __set_badbit_and_consider_rethrow(); void __set_failbit_and_consider_rethrow(); + _LIBCPP_INLINE_VISIBILITY + void __setstate_nothrow(iostate __state) + { + if (__rdbuf_) + __rdstate_ |= __state; + else + __rdstate_ |= __state | ios_base::badbit; + } + protected: _LIBCPP_INLINE_VISIBILITY ios_base() {// purposefully does no initialization |