From 211ceb9fd568c639a8f42b3b21b742f0ce489b1f Mon Sep 17 00:00:00 2001 From: Mehdi Amini Date: Thu, 9 May 2019 22:45:38 -0700 Subject: [PATCH] Add override keyword on overidden virtual method (NFC) Fix clang warnings -- PiperOrigin-RevId: 247556495 --- mlir/lib/IR/AsmPrinter.cpp | 18 ++++++++++-------- mlir/lib/Parser/Parser.cpp | 8 ++++---- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/mlir/lib/IR/AsmPrinter.cpp b/mlir/lib/IR/AsmPrinter.cpp index 4355919a70fb..f21595e17909 100644 --- a/mlir/lib/IR/AsmPrinter.cpp +++ b/mlir/lib/IR/AsmPrinter.cpp @@ -1140,22 +1140,24 @@ public: bool printBlockTerminator = true); void printOperation(Operation *op); - void printGenericOp(Operation *op); + void printGenericOp(Operation *op) override; // Implement OpAsmPrinter. - raw_ostream &getStream() const { return os; } - void printType(Type type) { ModulePrinter::printType(type); } - void printAttribute(Attribute attr) { ModulePrinter::printAttribute(attr); } - void printAttributeAndType(Attribute attr) { + raw_ostream &getStream() const override { return os; } + void printType(Type type) override { ModulePrinter::printType(type); } + void printAttribute(Attribute attr) override { + ModulePrinter::printAttribute(attr); + } + void printAttributeAndType(Attribute attr) override { ModulePrinter::printAttributeAndType(attr); } - void printFunctionReference(Function *func) { + void printFunctionReference(Function *func) override { return ModulePrinter::printFunctionReference(func); } - void printOperand(Value *value) { printValueID(value); } + void printOperand(Value *value) override { printValueID(value); } void printOptionalAttrDict(ArrayRef attrs, - ArrayRef elidedAttrs = {}) { + ArrayRef elidedAttrs = {}) override { return ModulePrinter::printOptionalAttrDict(attrs, elidedAttrs); }; diff --git a/mlir/lib/Parser/Parser.cpp b/mlir/lib/Parser/Parser.cpp index 245a50f46b71..abd7bd28fa70 100644 --- a/mlir/lib/Parser/Parser.cpp +++ b/mlir/lib/Parser/Parser.cpp @@ -3203,7 +3203,7 @@ public: /// Parse a function name like '@foo' and return the name in a form that can /// be passed to resolveFunctionName when a function type is available. - virtual ParseResult parseFunctionName(StringRef &result, llvm::SMLoc &loc) { + ParseResult parseFunctionName(StringRef &result, llvm::SMLoc &loc) override { if (parseOptionalFunctionName(result, loc)) return emitError(loc, "expected function name"); return success(); @@ -3320,8 +3320,8 @@ public: } /// Resolve a parse function name and a type into a function reference. - virtual ParseResult resolveFunctionName(StringRef name, FunctionType type, - llvm::SMLoc loc, Function *&result) { + ParseResult resolveFunctionName(StringRef name, FunctionType type, + llvm::SMLoc loc, Function *&result) override { result = parser.resolveFunctionReference(name, loc, type); return failure(result == nullptr); } @@ -3355,7 +3355,7 @@ public: /// Parse a region argument. Region arguments define new values, so this also /// checks if the values with the same name has not been defined yet. The /// type of the argument will be resolved later by a call to `parseRegion`. - ParseResult parseRegionArgument(OperandType &argument) { + ParseResult parseRegionArgument(OperandType &argument) override { // Use parseOperand to fill in the OperandType structure. if (parseOperand(argument)) return failure();