Skip to content

Commit 73ca486

Browse files
author
Krzysztof Parzyszek
authored
[LLVM] Add missing override to GetFormat and GetPropertyMask (#14470)
These functions are virtual, and some of the overrides were not marked as either `final` or `override` causing compilation warnings.
1 parent deb11d3 commit 73ca486

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

src/relay/backend/contrib/ethosu/source_module.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class EthosUModuleNode : public ModuleNode {
8989

9090
std::string GetSource(const std::string& format) final { return c_source; }
9191

92-
std::string GetFormat() { return "c"; }
92+
std::string GetFormat() override { return "c"; }
9393

9494
Array<CompilationArtifact> GetArtifacts() { return compilation_artifacts_; }
9595

@@ -122,7 +122,7 @@ class EthosUModuleNode : public ModuleNode {
122122
}
123123

124124
/*! \brief Get the property of the runtime module .*/
125-
int GetPropertyMask() const { return ModulePropertyMask::kDSOExportable; }
125+
int GetPropertyMask() const override { return ModulePropertyMask::kDSOExportable; }
126126

127127
bool ImplementsFunction(const String& name, bool query_imports) final {
128128
return std::find_if(compilation_artifacts_.begin(), compilation_artifacts_.end(),

src/runtime/contrib/json/json_runtime.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class JSONRuntimeBase : public ModuleNode {
5959
const char* type_key() const override { return "json"; } // May be overridden
6060

6161
/*! \brief Get the property of the runtime module .*/
62-
int GetPropertyMask() const {
62+
int GetPropertyMask() const override {
6363
return ModulePropertyMask::kBinarySerializable | ModulePropertyMask::kRunnable;
6464
}
6565

src/runtime/hexagon/hexagon_module.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class HexagonModuleNode : public runtime::ModuleNode {
6363
std::string GetSource(const std::string& format) override;
6464
const char* type_key() const final { return "hexagon"; }
6565
/*! \brief Get the property of the runtime module .*/
66-
int GetPropertyMask() const {
66+
int GetPropertyMask() const override {
6767
return ModulePropertyMask::kBinarySerializable | ModulePropertyMask::kRunnable;
6868
}
6969
void SaveToFile(const std::string& file_name, const std::string& format) override;

src/runtime/static_library.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class StaticLibraryNode final : public runtime::ModuleNode {
6464

6565
// TODO(tvm-team): Make this module serializable
6666
/*! \brief Get the property of the runtime module .*/
67-
int GetPropertyMask() const { return ModulePropertyMask::kDSOExportable; }
67+
int GetPropertyMask() const override { return ModulePropertyMask::kDSOExportable; }
6868

6969
bool ImplementsFunction(const String& name, bool query_imports) final {
7070
return std::find(func_names_.begin(), func_names_.end(), name) != func_names_.end();

src/target/llvm/llvm_module.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ class LLVMModuleNode final : public runtime::ModuleNode {
9595

9696
/*! \brief Get the property of the runtime module .*/
9797
// TODO(tvm-team): Make it serializable
98-
int GetPropertyMask() const {
98+
int GetPropertyMask() const override {
9999
return runtime::ModulePropertyMask::kRunnable | runtime::ModulePropertyMask::kDSOExportable;
100100
}
101101

src/target/source/source_module.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class SourceModuleNode : public runtime::ModuleNode {
7676

7777
std::string GetSource(const std::string& format) final { return code_; }
7878

79-
std::string GetFormat() { return fmt_; }
79+
std::string GetFormat() override { return fmt_; }
8080

8181
protected:
8282
std::string code_;
@@ -117,7 +117,7 @@ class CSourceModuleNode : public runtime::ModuleNode {
117117

118118
std::string GetSource(const std::string& format) final { return code_; }
119119

120-
std::string GetFormat() { return fmt_; }
120+
std::string GetFormat() override { return fmt_; }
121121

122122
void SaveToFile(const std::string& file_name, const std::string& format) final {
123123
std::string fmt = GetFileFormat(file_name, format);
@@ -130,7 +130,7 @@ class CSourceModuleNode : public runtime::ModuleNode {
130130
}
131131
}
132132

133-
int GetPropertyMask() const { return runtime::ModulePropertyMask::kDSOExportable; }
133+
int GetPropertyMask() const override { return runtime::ModulePropertyMask::kDSOExportable; }
134134

135135
bool ImplementsFunction(const String& name, bool query_imports) final {
136136
return std::find(func_names_.begin(), func_names_.end(), name) != func_names_.end();
@@ -183,7 +183,7 @@ class CSourceCrtMetadataModuleNode : public runtime::ModuleNode {
183183

184184
std::string GetSource(const std::string& format) final { return code_.str(); }
185185

186-
std::string GetFormat() { return fmt_; }
186+
std::string GetFormat() override { return fmt_; }
187187
PackedFunc GetFunction(const std::string& name, const ObjectPtr<Object>& sptr_to_self) final {
188188
return PackedFunc();
189189
}
@@ -200,7 +200,7 @@ class CSourceCrtMetadataModuleNode : public runtime::ModuleNode {
200200
}
201201
}
202202

203-
int GetPropertyMask() const { return runtime::ModulePropertyMask::kDSOExportable; }
203+
int GetPropertyMask() const override { return runtime::ModulePropertyMask::kDSOExportable; }
204204

205205
bool ImplementsFunction(const String& name, bool query_imports) final {
206206
return std::find(func_names_.begin(), func_names_.end(), name) != func_names_.end();

0 commit comments

Comments
 (0)