Modernise code to use override specifier
Generated by clang-tidy.
Test: m checkbuild
Change-Id: I9edd67d241453ebca9a3e84c72e2b122e72cd5df
diff --git a/code_writer.cpp b/code_writer.cpp
index 1fe5e83..6d54d40 100644
--- a/code_writer.cpp
+++ b/code_writer.cpp
@@ -117,7 +117,7 @@
public:
StringCodeWriter(std::string* buf)
: CodeWriter(std::unique_ptr<std::ostream>(new std::stringstream())), buf_(buf) {}
- ~StringCodeWriter() { Close(); }
+ ~StringCodeWriter() override { Close(); }
bool Close() override {
// extract whats written to the stringstream to the external buffer.
// we are sure that ostream_ is indeed stringstream.
diff --git a/generate_java_binder.cpp b/generate_java_binder.cpp
index b50d500..d9764be 100644
--- a/generate_java_binder.cpp
+++ b/generate_java_binder.cpp
@@ -72,7 +72,7 @@
public:
StubClass(const Type* type, const InterfaceType* interfaceType, JavaTypeNamespace* types,
const Options& options);
- virtual ~StubClass() = default;
+ ~StubClass() override = default;
Variable* transact_code;
Variable* transact_data;
@@ -307,7 +307,7 @@
public:
ProxyClass(const JavaTypeNamespace* types, const Type* type, const InterfaceType* interfaceType,
const Options& options);
- virtual ~ProxyClass();
+ ~ProxyClass() override;
Variable* mRemote;
};
diff --git a/line_reader.cpp b/line_reader.cpp
index 0bcaa1d..5e076d8 100644
--- a/line_reader.cpp
+++ b/line_reader.cpp
@@ -30,7 +30,7 @@
class FileLineReader : public LineReader {
public:
FileLineReader() = default;
- virtual ~FileLineReader() {
+ ~FileLineReader() override {
input_stream_.close();
}
@@ -57,7 +57,7 @@
class MemoryLineReader : public LineReader {
public:
explicit MemoryLineReader(const string& contents) : input_stream_(contents) {}
- virtual ~MemoryLineReader() = default;
+ ~MemoryLineReader() override = default;
bool ReadLine(string* line) override {
if (!input_stream_.good()) {
diff --git a/tests/end_to_end_tests.cpp b/tests/end_to_end_tests.cpp
index d3dc27c..7602a86 100644
--- a/tests/end_to_end_tests.cpp
+++ b/tests/end_to_end_tests.cpp
@@ -38,7 +38,7 @@
class EndToEndTest : public ::testing::Test {
protected:
- virtual void SetUp() {
+ void SetUp() override {
}
void AddStubAidls(const char** parcelables, const char** interfaces,
diff --git a/tests/fake_io_delegate.cpp b/tests/fake_io_delegate.cpp
index 9456bb8..b63e1e3 100644
--- a/tests/fake_io_delegate.cpp
+++ b/tests/fake_io_delegate.cpp
@@ -37,7 +37,7 @@
class BrokenCodeWriter : public CodeWriter {
bool Write(const char* /* format */, ...) override { return true; }
bool Close() override { return false; }
- virtual ~BrokenCodeWriter() = default;
+ ~BrokenCodeWriter() override = default;
}; // class BrokenCodeWriter
unique_ptr<string> FakeIoDelegate::GetFileContents(
diff --git a/type_cpp.cpp b/type_cpp.cpp
index 58cc119..c3cab98 100644
--- a/type_cpp.cpp
+++ b/type_cpp.cpp
@@ -47,7 +47,7 @@
public:
VoidType() : Type(ValidatableType::KIND_BUILT_IN, kNoPackage, "void",
{}, "void", kNoValidMethod, kNoValidMethod) {}
- virtual ~VoidType() = default;
+ ~VoidType() override = default;
bool CanWriteToParcel() const override { return false; }
}; // class VoidType
@@ -117,7 +117,7 @@
read_array_method, write_array_method,
false)) {}
- virtual ~PrimitiveType() = default;
+ ~PrimitiveType() override = default;
bool IsCppPrimitive() const override { return true; }
private:
@@ -137,7 +137,7 @@
"readByteVector", "writeByteVector",
false)) {}
- virtual ~ByteType() = default;
+ ~ByteType() override = default;
bool IsCppPrimitive() const override { return true; }
private:
@@ -157,7 +157,7 @@
new BinderType(interface, src_file_name, kNoNullableType,
"readNullableStrongBinder"),
"readStrongBinder") {}
- virtual ~BinderType() = default;
+ ~BinderType() override = default;
string WriteCast(const string& val) const override {
return write_cast_ + "(" + val + ")";
@@ -198,7 +198,7 @@
: Type(ValidatableType::KIND_PARCELABLE, parcelable.GetPackage(), parcelable.GetName(),
{cpp_header}, GetCppName(parcelable), "readParcelable", "writeNullableParcelable",
kNoArrayType, kNoNullableType, src_file_name) {}
- virtual ~NullableParcelableType() = default;
+ ~NullableParcelableType() override = default;
private:
static string GetCppName(const AidlParcelable& parcelable) {
@@ -218,7 +218,7 @@
GetCppName(parcelable), "readParcelableVector",
"writeParcelableVector", false, src_file_name),
new NullableParcelableType(parcelable, cpp_header, src_file_name), src_file_name) {}
- virtual ~ParcelableType() = default;
+ ~ParcelableType() override = default;
private:
static string GetCppName(const AidlParcelable& parcelable) {
@@ -235,7 +235,7 @@
{"binder/Map.h", "binder/Value.h"},
"::std::unique_ptr<::android::binder::Map>",
"readNullableMap", "writeNullableMap") {}
- virtual ~NullableMap() = default;
+ ~NullableMap() override = default;
};
@@ -249,7 +249,7 @@
"readMap", "writeMap",
kNoArrayType,
new NullableMap() ) {}
- virtual ~MapType() = default;
+ ~MapType() override = default;
private:
DISALLOW_COPY_AND_ASSIGN(MapType);
@@ -263,7 +263,7 @@
{"utils/String16.h", "memory", "vector"},
"::std::unique_ptr<::std::vector<std::unique_ptr<::android::String16>>>",
"readString16Vector", "writeString16Vector") {}
- virtual ~NullableStringListType() = default;
+ ~NullableStringListType() override = default;
private:
DISALLOW_COPY_AND_ASSIGN(NullableStringListType);
@@ -278,7 +278,7 @@
"::std::vector<::android::String16>",
"readString16Vector", "writeString16Vector",
kNoArrayType, new NullableStringListType()) {}
- virtual ~StringListType() = default;
+ ~StringListType() override = default;
private:
DISALLOW_COPY_AND_ASSIGN(StringListType);
@@ -292,7 +292,7 @@
{"memory", "string", "vector"},
"::std::unique_ptr<::std::vector<std::unique_ptr<::std::string>>>",
"readUtf8VectorFromUtf16Vector", "writeUtf8VectorAsUtf16Vector") {}
- virtual ~NullableUtf8InCppStringListType() = default;
+ ~NullableUtf8InCppStringListType() override = default;
private:
DISALLOW_COPY_AND_ASSIGN(NullableUtf8InCppStringListType);
@@ -307,7 +307,7 @@
"::std::vector<::std::string>",
"readUtf8VectorFromUtf16Vector", "writeUtf8VectorAsUtf16Vector",
kNoArrayType, new NullableUtf8InCppStringListType()) {}
- virtual ~Utf8InCppStringListType() = default;
+ ~Utf8InCppStringListType() override = default;
private:
DISALLOW_COPY_AND_ASSIGN(Utf8InCppStringListType);
@@ -320,7 +320,7 @@
"List<android.os.IBinder>", {"binder/IBinder.h", "vector"},
"::std::unique_ptr<::std::vector<::android::sp<::android::IBinder>>>",
"readStrongBinderVector", "writeStrongBinderVector") {}
- virtual ~NullableBinderListType() = default;
+ ~NullableBinderListType() override = default;
private:
DISALLOW_COPY_AND_ASSIGN(NullableBinderListType);
@@ -334,7 +334,7 @@
"::std::vector<::android::sp<::android::IBinder>>",
"readStrongBinderVector", "writeStrongBinderVector",
kNoArrayType, new NullableBinderListType()) {}
- virtual ~BinderListType() = default;
+ ~BinderListType() override = default;
private:
DISALLOW_COPY_AND_ASSIGN(BinderListType);