Run clang-tidy (modernize-use-override) (#4251)

This commit is contained in:
Eisuke Kawashima
2021-07-01 12:18:56 +09:00
committed by GitHub
parent 333ae7d655
commit 013ba4f21d
103 changed files with 542 additions and 507 deletions

View File

@@ -232,7 +232,7 @@ class streambuf : public std::basic_streambuf<char> {
}
/// Mundane destructor freeing the allocated resources
virtual ~streambuf() {
~streambuf() override {
if (write_buffer) delete[] write_buffer;
}
@@ -240,7 +240,7 @@ class streambuf : public std::basic_streambuf<char> {
/** It is essential to override this virtual function for the stream
member function readsome to work correctly (c.f. 27.6.1.3, alinea 30)
*/
virtual std::streamsize showmanyc() {
std::streamsize showmanyc() override {
int_type const failure = traits_type::eof();
int_type status = underflow();
if (status == failure) return -1;
@@ -248,7 +248,7 @@ class streambuf : public std::basic_streambuf<char> {
}
/// C.f. C++ standard section 27.5.2.4.3
virtual int_type underflow() {
int_type underflow() override {
int_type const failure = traits_type::eof();
if (py_read == bp::object()) {
throw std::invalid_argument(
@@ -273,7 +273,7 @@ class streambuf : public std::basic_streambuf<char> {
}
/// C.f. C++ standard section 27.5.2.4.5
virtual int_type overflow(int_type c = traits_type_eof()) {
int_type overflow(int_type c = traits_type_eof()) override {
if (py_write == bp::object()) {
throw std::invalid_argument(
"That Python file object has no 'write' attribute");
@@ -329,7 +329,7 @@ class streambuf : public std::basic_streambuf<char> {
read buffer, set the Python file object seek position to the
seek position in that read buffer.
*/
virtual int sync() {
int sync() override {
int result = 0;
farthest_pptr = std::max(farthest_pptr, pptr());
if (farthest_pptr && farthest_pptr > pbase()) {
@@ -350,9 +350,9 @@ class streambuf : public std::basic_streambuf<char> {
is avoided as much as possible (e.g. parsers which may do a lot of
backtracking)
*/
virtual pos_type seekoff(off_type off, std::ios_base::seekdir way,
std::ios_base::openmode which = std::ios_base::in |
std::ios_base::out) {
pos_type seekoff(off_type off, std::ios_base::seekdir way,
std::ios_base::openmode which =
std::ios_base::in | std::ios_base::out) override {
/* In practice, "which" is either std::ios_base::in or out
since we end up here because either seekp or seekg was called
on the stream using this buffer. That simplifies the code
@@ -408,9 +408,9 @@ class streambuf : public std::basic_streambuf<char> {
}
/// C.f. C++ standard section 27.5.2.4.2
virtual pos_type seekpos(pos_type sp,
std::ios_base::openmode which = std::ios_base::in |
std::ios_base::out) {
pos_type seekpos(pos_type sp,
std::ios_base::openmode which =
std::ios_base::in | std::ios_base::out) override {
return streambuf::seekoff(sp, std::ios_base::beg, which);
}
@@ -492,7 +492,7 @@ class streambuf : public std::basic_streambuf<char> {
exceptions(std::ios_base::badbit);
}
~istream() {
~istream() override {
// do nothing.
// This used to do:
// if (this->good()) this->sync();
@@ -508,7 +508,7 @@ class streambuf : public std::basic_streambuf<char> {
exceptions(std::ios_base::badbit);
}
~ostream() {
~ostream() override {
if (this->good()) this->flush();
}
};
@@ -528,7 +528,7 @@ struct ostream : private streambuf_capsule, streambuf::ostream {
: streambuf_capsule(python_file_obj, buffer_size),
streambuf::ostream(python_streambuf) {}
~ostream() noexcept {
~ostream() noexcept override {
if (this->good()) {
this->flush();
}