Skip to content

Commit f4e3ec2

Browse files
committed
make non-const functions private
1 parent f6e8d52 commit f4e3ec2

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

llvm/include/llvm/Support/CharSet.h

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,8 @@ template <typename T> class SmallVectorImpl;
3030

3131
namespace details {
3232
class CharSetConverterImplBase {
33-
public:
34-
virtual ~CharSetConverterImplBase() = default;
35-
36-
/// Resets the converter to the initial state.
37-
virtual void reset() = 0;
3833

34+
private:
3935
/// Converts a string.
4036
/// \param[in] Source source string
4137
/// \param[out] Result container for converted string
@@ -55,12 +51,21 @@ class CharSetConverterImplBase {
5551
/// In case of an error, the result string contains the successfully converted
5652
/// part of the input string.
5753
///
58-
59-
std::error_code convert(StringRef Source,
60-
SmallVectorImpl<char> &Result) const;
61-
6254
virtual std::error_code convertString(StringRef Source,
6355
SmallVectorImpl<char> &Result) = 0;
56+
57+
/// Resets the converter to the initial state.
58+
virtual void reset() = 0;
59+
60+
public:
61+
virtual ~CharSetConverterImplBase() = default;
62+
63+
/// Converts a string and resets the converter to the initial state.
64+
std::error_code convert(StringRef Source, SmallVectorImpl<char> &Result) {
65+
auto EC = convertString(Source, Result);
66+
reset();
67+
return EC;
68+
}
6469
};
6570
} // namespace details
6671

@@ -118,15 +123,12 @@ class CharSetConverter {
118123
/// \return error code in case something went wrong
119124
std::error_code convert(StringRef Source,
120125
SmallVectorImpl<char> &Result) const {
121-
auto EC = Converter->convertString(Source, Result);
122-
Converter->reset();
123-
return EC;
126+
return Converter->convert(Source, Result);
124127
}
125128

126129
ErrorOr<std::string> convert(StringRef Source) const {
127130
SmallString<100> Result;
128-
auto EC = Converter->convertString(Source, Result);
129-
Converter->reset();
131+
auto EC = Converter->convert(Source, Result);
130132
if (!EC)
131133
return std::string(Result);
132134
return EC;

0 commit comments

Comments
 (0)