Skip to content

Commit 68f66f3

Browse files
committed
Revert "[libc++][format] Add basic_format_parse_context."
This reverts commit 35a57f3. A build is broken during clang bootstrap with: In file included from ../libcxx/src/format.cpp:9: /tmp/ci-nGNyLRM9V3/include/c++/v1/format:153:16: error: no member named 'is_constant_evaluated' in namespace 'std::__1' if (_VSTD::is_constant_evaluated() && __id >= __num_args_) ~~~~~~~^ 1 error generated.
1 parent 32ef6d8 commit 68f66f3

File tree

8 files changed

+0
-556
lines changed

8 files changed

+0
-556
lines changed

libcxx/include/format

Lines changed: 0 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -19,51 +19,14 @@ namespace std {
1919
explicit format_error(const string& what_arg);
2020
explicit format_error(const char* what_arg);
2121
};
22-
23-
// [format.parse.ctx], class template basic_format_parse_context
24-
template<class charT>
25-
class basic_format_parse_context {
26-
public:
27-
using char_type = charT;
28-
using const_iterator = typename basic_string_view<charT>::const_iterator;
29-
using iterator = const_iterator;
30-
31-
private:
32-
iterator begin_; // exposition only
33-
iterator end_; // exposition only
34-
enum indexing { unknown, manual, automatic }; // exposition only
35-
indexing indexing_; // exposition only
36-
size_t next_arg_id_; // exposition only
37-
size_t num_args_; // exposition only
38-
39-
public:
40-
constexpr explicit basic_format_parse_context(basic_string_view<charT> fmt,
41-
size_t num_args = 0) noexcept;
42-
basic_format_parse_context(const basic_format_parse_context&) = delete;
43-
basic_format_parse_context& operator=(const basic_format_parse_context&) = delete;
44-
45-
constexpr const_iterator begin() const noexcept;
46-
constexpr const_iterator end() const noexcept;
47-
constexpr void advance_to(const_iterator it);
48-
49-
constexpr size_t next_arg_id();
50-
constexpr void check_arg_id(size_t id);
51-
};
52-
using format_parse_context = basic_format_parse_context<char>;
53-
using wformat_parse_context = basic_format_parse_context<wchar_t>;
5422
}
5523
5624
*/
5725

5826
#include <__config>
5927
#include <stdexcept>
60-
#include <string_view>
6128
#include <version>
6229

63-
#ifdef _LIBCPP_NO_EXCEPTIONS
64-
#include <cstdlib>
65-
#endif
66-
6730
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
6831
# pragma GCC system_header
6932
#endif
@@ -84,88 +47,6 @@ public:
8447
virtual ~format_error() noexcept;
8548
};
8649

87-
_LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY void
88-
__throw_format_error(const char* __s) {
89-
#ifndef _LIBCPP_NO_EXCEPTIONS
90-
throw format_error(__s);
91-
#else
92-
(void)__s;
93-
_VSTD::abort();
94-
#endif
95-
}
96-
97-
template <class _CharT>
98-
class _LIBCPP_TEMPLATE_VIS basic_format_parse_context {
99-
public:
100-
using char_type = _CharT;
101-
using const_iterator =
102-
typename _VSTD::basic_string_view<_CharT>::const_iterator;
103-
using iterator = const_iterator;
104-
105-
public:
106-
_LIBCPP_INLINE_VISIBILITY
107-
constexpr explicit basic_format_parse_context(
108-
_VSTD::basic_string_view<_CharT> __fmt, size_t __num_args = 0) noexcept
109-
: __begin_(__fmt.begin()),
110-
__end_(__fmt.end()),
111-
__indexing_(__unknown),
112-
__next_arg_id_(0),
113-
__num_args_(__num_args) {}
114-
115-
basic_format_parse_context(const basic_format_parse_context&) = delete;
116-
basic_format_parse_context&
117-
operator=(const basic_format_parse_context&) = delete;
118-
119-
_LIBCPP_INLINE_VISIBILITY constexpr const_iterator begin() const noexcept {
120-
return __begin_;
121-
}
122-
_LIBCPP_INLINE_VISIBILITY constexpr const_iterator end() const noexcept {
123-
return __end_;
124-
}
125-
_LIBCPP_INLINE_VISIBILITY constexpr void advance_to(const_iterator __it) {
126-
__begin_ = __it;
127-
}
128-
129-
_LIBCPP_INLINE_VISIBILITY constexpr size_t next_arg_id() {
130-
if (__indexing_ == __manual)
131-
__throw_format_error("Using automatic argument numbering in manual "
132-
"argument numbering mode");
133-
134-
if (__indexing_ == __unknown)
135-
__indexing_ = __automatic;
136-
return __next_arg_id_++;
137-
}
138-
_LIBCPP_INLINE_VISIBILITY constexpr void check_arg_id(size_t __id) {
139-
if (__indexing_ == __automatic)
140-
__throw_format_error("Using manual argument numbering in automatic "
141-
"argument numbering mode");
142-
143-
if (__indexing_ == __unknown)
144-
__indexing_ = __manual;
145-
146-
// Throws an exception to make the expression a non core constant
147-
// expression as required by:
148-
// [format.parse.ctx]/11
149-
// Remarks: Call expressions where id >= num_args_ are not core constant
150-
// expressions ([expr.const]).
151-
// Note: the Throws clause [format.parse.ctx]/10 doesn't specify the
152-
// behavior when id >= num_args_.
153-
if (_VSTD::is_constant_evaluated() && __id >= __num_args_)
154-
__throw_format_error("Argument index outside the valid range");
155-
}
156-
157-
private:
158-
iterator __begin_;
159-
iterator __end_;
160-
enum _Indexing { __unknown, __manual, __automatic };
161-
_Indexing __indexing_;
162-
size_t __next_arg_id_;
163-
size_t __num_args_;
164-
};
165-
166-
using format_parse_context = basic_format_parse_context<char>;
167-
using wformat_parse_context = basic_format_parse_context<wchar_t>;
168-
16950
#endif //_LIBCPP_STD_VER > 17
17051

17152
_LIBCPP_END_NAMESPACE_STD

libcxx/test/std/utilities/format/format.formatter/format.parse.ctx/advance_to.pass.cpp

Lines changed: 0 additions & 67 deletions
This file was deleted.

libcxx/test/std/utilities/format/format.formatter/format.parse.ctx/begin.pass.cpp

Lines changed: 0 additions & 53 deletions
This file was deleted.

libcxx/test/std/utilities/format/format.formatter/format.parse.ctx/check_arg_id.pass.cpp

Lines changed: 0 additions & 68 deletions
This file was deleted.

0 commit comments

Comments
 (0)